From: John Snow <jsnow@redhat.com>
To: "Andreas Färber" <afaerber@suse.de>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Floppy <qemu-block@nongnu.org>,
mark.cave-ayland@ilande.co.uk, armbru@redhat.com,
hpoussin@reactos.org, Stefan Hajnoczi <stefanha@redhat.com>,
qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH RFC for-2.3? 5/8] fdb: Move FDCtrlISABus to header
Date: Mon, 30 Mar 2015 21:38:02 -0400 [thread overview]
Message-ID: <5519FA7A.6010002@redhat.com> (raw)
In-Reply-To: <1427651603-9210-6-git-send-email-afaerber@suse.de>
You probably meant 'fdc' !
On 03/29/2015 01:53 PM, Andreas Färber wrote:
> To be used for embedding the device.
>
> Add gtk-doc private/public markers for parent field.
>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
> hw/block/fdc.c | 87 -------------------------------------------------
> include/hw/block/fdc.h | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 88 insertions(+), 87 deletions(-)
>
> diff --git a/hw/block/fdc.c b/hw/block/fdc.c
> index 2bf87c9..da521f1 100644
> --- a/hw/block/fdc.c
> +++ b/hw/block/fdc.c
> @@ -31,7 +31,6 @@
> #include "hw/block/fdc.h"
> #include "qemu/error-report.h"
> #include "qemu/timer.h"
> -#include "hw/isa/isa.h"
> #include "hw/sysbus.h"
> #include "sysemu/block-backend.h"
> #include "sysemu/blockdev.h"
> @@ -167,33 +166,7 @@ static void pick_geometry(BlockBackend *blk, int *nb_heads,
> #define FD_SECTOR_SC 2 /* Sector size code */
> #define FD_RESET_SENSEI_COUNT 4 /* Number of sense interrupts on RESET */
>
> -typedef struct FDCtrl FDCtrl;
> -
> /* Floppy disk drive emulation */
> -typedef enum FDiskFlags {
> - FDISK_DBL_SIDES = 0x01,
> -} FDiskFlags;
> -
> -typedef struct FDrive {
> - FDCtrl *fdctrl;
> - BlockBackend *blk;
> - /* Drive status */
> - FDriveType drive;
> - uint8_t perpendicular; /* 2.88 MB access mode */
> - /* Position */
> - uint8_t head;
> - uint8_t track;
> - uint8_t sect;
> - /* Media */
> - FDiskFlags flags;
> - uint8_t last_sect; /* Nb sector per track */
> - uint8_t max_track; /* Nb of tracks */
> - uint16_t bps; /* Bytes per sector */
> - uint8_t ro; /* Is read-only */
> - uint8_t media_changed; /* Is media changed */
> - uint8_t media_rate; /* Data rate of medium */
> -} FDrive;
> -
> static void fd_init(FDrive *drv)
> {
> /* Drive */
> @@ -498,53 +471,6 @@ enum {
> #define FD_MULTI_TRACK(state) ((state) & FD_STATE_MULTI)
> #define FD_FORMAT_CMD(state) ((state) & FD_STATE_FORMAT)
>
> -struct FDCtrl {
> - MemoryRegion iomem;
> - qemu_irq irq;
> - /* Controller state */
> - QEMUTimer *result_timer;
> - int dma_chann;
> - /* Controller's identification */
> - uint8_t version;
> - /* HW */
> - uint8_t sra;
> - uint8_t srb;
> - uint8_t dor;
> - uint8_t dor_vmstate; /* only used as temp during vmstate */
> - uint8_t tdr;
> - uint8_t dsr;
> - uint8_t msr;
> - uint8_t cur_drv;
> - uint8_t status0;
> - uint8_t status1;
> - uint8_t status2;
> - /* Command FIFO */
> - uint8_t *fifo;
> - int32_t fifo_size;
> - uint32_t data_pos;
> - uint32_t data_len;
> - uint8_t data_state;
> - uint8_t data_dir;
> - uint8_t eot; /* last wanted sector */
> - /* States kept only to be returned back */
> - /* precompensation */
> - uint8_t precomp_trk;
> - uint8_t config;
> - uint8_t lock;
> - /* Power down config (also with status regB access mode */
> - uint8_t pwrd;
> - /* Floppy drives */
> - uint8_t num_floppies;
> - /* Sun4m quirks? */
> - int sun4m;
> - FDrive drives[MAX_FD];
> - int reset_sensei;
> - uint32_t check_media_rate;
> - /* Timers state */
> - uint8_t timer0;
> - uint8_t timer1;
> -};
> -
> #define TYPE_SYSBUS_FDC "base-sysbus-fdc"
> #define SYSBUS_FDC(obj) OBJECT_CHECK(FDCtrlSysBus, (obj), TYPE_SYSBUS_FDC)
>
> @@ -556,19 +482,6 @@ typedef struct FDCtrlSysBus {
> struct FDCtrl state;
> } FDCtrlSysBus;
>
> -#define ISA_FDC(obj) OBJECT_CHECK(FDCtrlISABus, (obj), TYPE_ISA_FDC)
> -
> -typedef struct FDCtrlISABus {
> - ISADevice parent_obj;
> -
> - uint32_t iobase;
> - uint32_t irq;
> - uint32_t dma;
> - struct FDCtrl state;
> - int32_t bootindexA;
> - int32_t bootindexB;
> -} FDCtrlISABus;
> -
> static uint32_t fdctrl_read (void *opaque, uint32_t reg)
> {
> FDCtrl *fdctrl = opaque;
> diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h
> index d48b2f8..86d852d 100644
> --- a/include/hw/block/fdc.h
> +++ b/include/hw/block/fdc.h
> @@ -2,6 +2,7 @@
> #define HW_FDC_H
>
> #include "qemu-common.h"
> +#include "hw/isa/isa.h"
>
> /* fdc.c */
> #define MAX_FD 2
> @@ -13,7 +14,94 @@ typedef enum FDriveType {
> FDRIVE_DRV_NONE = 0x03, /* No drive connected */
> } FDriveType;
>
> +typedef enum FDiskFlags {
> + FDISK_DBL_SIDES = 0x01,
> +} FDiskFlags;
> +
> +typedef struct FDCtrl FDCtrl;
> +
> +typedef struct FDrive {
> + FDCtrl *fdctrl;
> + BlockBackend *blk;
> + /* Drive status */
> + FDriveType drive;
> + uint8_t perpendicular; /* 2.88 MB access mode */
> + /* Position */
> + uint8_t head;
> + uint8_t track;
> + uint8_t sect;
> + /* Media */
> + FDiskFlags flags;
> + uint8_t last_sect; /* Nb sector per track */
> + uint8_t max_track; /* Nb of tracks */
> + uint16_t bps; /* Bytes per sector */
> + uint8_t ro; /* Is read-only */
> + uint8_t media_changed; /* Is media changed */
> + uint8_t media_rate; /* Data rate of medium */
> +} FDrive;
> +
> +struct FDCtrl {
> + MemoryRegion iomem;
> + qemu_irq irq;
> + /* Controller state */
> + QEMUTimer *result_timer;
> + int dma_chann;
> + /* Controller's identification */
> + uint8_t version;
> + /* HW */
> + uint8_t sra;
> + uint8_t srb;
> + uint8_t dor;
> + uint8_t dor_vmstate; /* only used as temp during vmstate */
> + uint8_t tdr;
> + uint8_t dsr;
> + uint8_t msr;
> + uint8_t cur_drv;
> + uint8_t status0;
> + uint8_t status1;
> + uint8_t status2;
> + /* Command FIFO */
> + uint8_t *fifo;
> + int32_t fifo_size;
> + uint32_t data_pos;
> + uint32_t data_len;
> + uint8_t data_state;
> + uint8_t data_dir;
> + uint8_t eot; /* last wanted sector */
> + /* States kept only to be returned back */
> + /* precompensation */
> + uint8_t precomp_trk;
> + uint8_t config;
> + uint8_t lock;
> + /* Power down config (also with status regB access mode */
> + uint8_t pwrd;
> + /* Floppy drives */
> + uint8_t num_floppies;
> + /* Sun4m quirks? */
> + int sun4m;
> + FDrive drives[MAX_FD];
> + int reset_sensei;
> + uint32_t check_media_rate;
> + /* Timers state */
> + uint8_t timer0;
> + uint8_t timer1;
> +};
> +
> #define TYPE_ISA_FDC "isa-fdc"
> +#define ISA_FDC(obj) OBJECT_CHECK(FDCtrlISABus, (obj), TYPE_ISA_FDC)
> +
> +typedef struct FDCtrlISABus {
> + /*< private >*/
> + ISADevice parent_obj;
> + /*< public >*/
> +
> + uint32_t iobase;
> + uint32_t irq;
> + uint32_t dma;
> + struct FDCtrl state;
> + int32_t bootindexA;
> + int32_t bootindexB;
> +} FDCtrlISABus;
>
> ISADevice *fdctrl_init_isa(ISABus *bus, DriveInfo **fds);
> void fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
>
Both this and the IDE patch look programmatically sound to me, but I
missed the discussion on why it's needed.
next prev parent reply other threads:[~2015-03-31 1:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-29 17:53 [Qemu-devel] [PATCH RFC for-2.3? 0/8] prep: Fix pc87312 for -device usage Andreas Färber
2015-03-29 17:53 ` [Qemu-devel] [PATCH RFC for-2.3? 1/8] parallel: Factor out header for ISAParallelState struct Andreas Färber
2015-03-29 17:53 ` [Qemu-devel] [PATCH RFC for-2.3? 2/8] pc87312: Create isa-parallel in-place and add alias par0-chardev property Andreas Färber
2015-03-30 14:12 ` Markus Armbruster
2015-03-30 14:36 ` Andreas Färber
2015-03-29 17:53 ` [Qemu-devel] [PATCH RFC for-2.3? 3/8] serial: Move ISASerialState to header Andreas Färber
2015-03-29 17:53 ` [Qemu-devel] [PATCH RFC for-2.3? 4/8] pc87312: Create UARTs in-place and add alias properties Andreas Färber
2015-03-29 17:53 ` [Qemu-devel] [PATCH RFC for-2.3? 5/8] fdb: Move FDCtrlISABus to header Andreas Färber
2015-03-31 1:38 ` John Snow [this message]
2015-05-19 13:02 ` Andreas Färber
2015-05-19 15:40 ` John Snow
2015-03-29 17:53 ` [Qemu-devel] [PATCH RFC for-2.3? 6/8] pc87312: Create FDC in-place Andreas Färber
2015-03-29 17:53 ` [Qemu-devel] [PATCH RFC for-2.3? 7/8] ide: Move ISAIDEState to header Andreas Färber
2015-03-29 17:53 ` [Qemu-devel] [PATCH RFC for-2.3? 8/8] pc87312: Create IDE in-place Andreas Färber
2015-03-30 14:25 ` [Qemu-devel] [PATCH RFC for-2.3? 0/8] prep: Fix pc87312 for -device usage Markus Armbruster
2015-03-30 16:12 ` Paolo Bonzini
2015-03-30 16:18 ` Andreas Färber
2015-03-30 18:09 ` Markus Armbruster
2015-03-30 16:42 ` Markus Armbruster
2015-03-30 17:49 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5519FA7A.6010002@redhat.com \
--to=jsnow@redhat.com \
--cc=afaerber@suse.de \
--cc=armbru@redhat.com \
--cc=hpoussin@reactos.org \
--cc=kwolf@redhat.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.