4 #include "hw/ide/internal.h"
5 #include "hw/pci/pci.h"
7 #define BM_STATUS_DMAING 0x01
8 #define BM_STATUS_ERROR 0x02
9 #define BM_STATUS_INT 0x04
11 #define BM_CMD_START 0x01
12 #define BM_CMD_READ 0x08
14 typedef struct BMDMAState
{
21 /* current transfer state */
23 uint32_t cur_prd_last
;
24 uint32_t cur_prd_addr
;
26 BlockCompletionFunc
*dma_cb
;
27 MemoryRegion addr_ioport
;
28 MemoryRegion extra_io
;
31 /* Bit 0-2 and 7: BM status register
32 * Bit 3-6: bus->error_status */
33 uint8_t migration_compat_status
;
34 uint8_t migration_retry_unit
;
35 int64_t migration_retry_sector_num
;
36 uint32_t migration_retry_nsector
;
38 struct PCIIDEState
*pci_dev
;
41 #define TYPE_PCI_IDE "pci-ide"
42 #define PCI_IDE(obj) OBJECT_CHECK(PCIIDEState, (obj), TYPE_PCI_IDE)
44 typedef struct PCIIDEState
{
51 uint32_t secondary
; /* used only for cmd646 */
52 MemoryRegion bmdma_bar
;
53 MemoryRegion cmd_bar
[2];
54 MemoryRegion data_bar
[2];
57 static inline IDEState
*bmdma_active_if(BMDMAState
*bmdma
)
59 assert(bmdma
->bus
->retry_unit
!= (uint8_t)-1);
60 return bmdma
->bus
->ifs
+ bmdma
->bus
->retry_unit
;
63 void bmdma_init(IDEBus
*bus
, BMDMAState
*bm
, PCIIDEState
*d
);
64 void bmdma_cmd_writeb(BMDMAState
*bm
, uint32_t val
);
65 extern MemoryRegionOps bmdma_addr_ioport_ops
;
66 void pci_ide_create_devs(PCIDevice
*dev
, DriveInfo
**hd_table
);
68 extern const VMStateDescription vmstate_ide_pci
;
69 extern const MemoryRegionOps pci_ide_cmd_le_ops
;
70 extern const MemoryRegionOps pci_ide_data_le_ops
;