4 #include "hw/ide/internal.h"
5 #include "hw/pci/pci.h"
6 #include "qom/object.h"
8 #define BM_STATUS_DMAING 0x01
9 #define BM_STATUS_ERROR 0x02
10 #define BM_STATUS_INT 0x04
12 #define BM_CMD_START 0x01
13 #define BM_CMD_READ 0x08
15 typedef struct BMDMAState
{
22 /* current transfer state */
24 uint32_t cur_prd_last
;
25 uint32_t cur_prd_addr
;
27 BlockCompletionFunc
*dma_cb
;
28 MemoryRegion addr_ioport
;
29 MemoryRegion extra_io
;
32 /* Bit 0-2 and 7: BM status register
33 * Bit 3-6: bus->error_status */
34 uint8_t migration_compat_status
;
35 uint8_t migration_retry_unit
;
36 int64_t migration_retry_sector_num
;
37 uint32_t migration_retry_nsector
;
39 struct PCIIDEState
*pci_dev
;
42 #define TYPE_PCI_IDE "pci-ide"
43 OBJECT_DECLARE_SIMPLE_TYPE(PCIIDEState
, PCI_IDE
)
52 uint32_t secondary
; /* used only for cmd646 */
53 MemoryRegion bmdma_bar
;
54 MemoryRegion cmd_bar
[2];
55 MemoryRegion data_bar
[2];
58 static inline IDEState
*bmdma_active_if(BMDMAState
*bmdma
)
60 assert(bmdma
->bus
->retry_unit
!= (uint8_t)-1);
61 return bmdma
->bus
->ifs
+ bmdma
->bus
->retry_unit
;
64 void bmdma_init(IDEBus
*bus
, BMDMAState
*bm
, PCIIDEState
*d
);
65 void bmdma_cmd_writeb(BMDMAState
*bm
, uint32_t val
);
66 extern MemoryRegionOps bmdma_addr_ioport_ops
;
67 void pci_ide_create_devs(PCIDevice
*dev
);
69 extern const VMStateDescription vmstate_ide_pci
;
70 extern const MemoryRegionOps pci_ide_cmd_le_ops
;
71 extern const MemoryRegionOps pci_ide_data_le_ops
;