--- qemu/hw/ide/internal.h 2018/04/24 17:40:36 1.1 +++ qemu/hw/ide/internal.h 2018/04/24 18:30:52 1.1.1.4 @@ -7,6 +7,7 @@ * non-internal declarations are in hw/ide.h */ #include +#include "block_int.h" /* debug IDE devices */ //#define DEBUG_IDE @@ -361,6 +362,8 @@ typedef struct BMDMAState BMDMAState; #define SMART_DISABLE 0xd9 #define SMART_STATUS 0xda +typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind; + typedef void EndTransferFunc(IDEState *); /* NOTE: IDEState represents in fact one drive */ @@ -368,8 +371,7 @@ struct IDEState { IDEBus *bus; uint8_t unit; /* ide config */ - int is_cdrom; - int is_cf; + IDEDriveKind drive_kind; int cylinders, heads, sectors; int64_t nb_sectors; int mult_sectors; @@ -397,6 +399,7 @@ struct IDEState { /* set for lba48 access */ uint8_t lba48; BlockDriverState *bs; + char version[9]; /* ATAPI specific */ uint8_t sense_key; uint8_t asc; @@ -416,6 +419,11 @@ struct IDEState { uint8_t *data_ptr; uint8_t *data_end; uint8_t *io_buffer; + /* PIO save/restore */ + int32_t io_buffer_total_len; + int cur_io_buffer_offset; + int cur_io_buffer_len; + uint8_t end_transfer_fn_idx; QEMUTimer *sector_write_timer; /* only used for win2k install hack */ uint32_t irq_count; /* counts IRQs when using win2k install hack */ /* CF-ATA extended error */ @@ -448,15 +456,15 @@ struct IDEBus { struct IDEDevice { DeviceState qdev; uint32_t unit; - DriveInfo *dinfo; + BlockConf conf; + char *version; + char *serial; }; typedef int (*ide_qdev_initfn)(IDEDevice *dev); struct IDEDeviceInfo { DeviceInfo qdev; ide_qdev_initfn init; - uint32_t unit; - DriveInfo *drive; }; #define BM_STATUS_DMAING 0x01 @@ -548,9 +556,11 @@ uint32_t ide_data_readw(void *opaque, ui void ide_data_writel(void *opaque, uint32_t addr, uint32_t val); uint32_t ide_data_readl(void *opaque, uint32_t addr); -void ide_init_drive(IDEState *s, DriveInfo *dinfo); -void ide_init2(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1, - qemu_irq irq); +int ide_init_drive(IDEState *s, BlockDriverState *bs, + const char *version, const char *serial); +void ide_init2(IDEBus *bus, qemu_irq irq); +void ide_init2_with_non_qdev_drives(IDEBus *bus, DriveInfo *hd0, + DriveInfo *hd1, qemu_irq irq); void ide_init_ioport(IDEBus *bus, int iobase, int iobase2); /* hw/ide/qdev.c */