4 #include "hw/ide/internal.h"
6 #define BM_STATUS_DMAING 0x01
7 #define BM_STATUS_ERROR 0x02
8 #define BM_STATUS_INT 0x04
10 #define BM_CMD_START 0x01
11 #define BM_CMD_READ 0x08
13 typedef struct BMDMAState
{
20 /* current transfer state */
22 uint32_t cur_prd_last
;
23 uint32_t cur_prd_addr
;
25 BlockCompletionFunc
*dma_cb
;
26 MemoryRegion addr_ioport
;
27 MemoryRegion extra_io
;
30 /* Bit 0-2 and 7: BM status register
31 * Bit 3-6: bus->error_status */
32 uint8_t migration_compat_status
;
33 uint8_t migration_retry_unit
;
34 int64_t migration_retry_sector_num
;
35 uint32_t migration_retry_nsector
;
37 struct PCIIDEState
*pci_dev
;
40 typedef struct CMD646BAR
{
44 struct PCIIDEState
*pci_dev
;
47 #define TYPE_PCI_IDE "pci-ide"
48 #define PCI_IDE(obj) OBJECT_CHECK(PCIIDEState, (obj), TYPE_PCI_IDE)
50 typedef struct PCIIDEState
{
57 uint32_t secondary
; /* used only for cmd646 */
58 MemoryRegion bmdma_bar
;
59 CMD646BAR cmd646_bar
[2]; /* used only for cmd646 */
63 static inline IDEState
*bmdma_active_if(BMDMAState
*bmdma
)
65 assert(bmdma
->bus
->retry_unit
!= (uint8_t)-1);
66 return bmdma
->bus
->ifs
+ bmdma
->bus
->retry_unit
;
70 void bmdma_init(IDEBus
*bus
, BMDMAState
*bm
, PCIIDEState
*d
);
71 void bmdma_cmd_writeb(BMDMAState
*bm
, uint32_t val
);
72 extern MemoryRegionOps bmdma_addr_ioport_ops
;
73 void pci_ide_create_devs(PCIDevice
*dev
, DriveInfo
**hd_table
);
75 extern const VMStateDescription vmstate_ide_pci
;