]>
Commit | Line | Data |
---|---|---|
65c0f135 JQ |
1 | #ifndef HW_IDE_PCI_H |
2 | #define HW_IDE_PCI_H | |
3 | ||
a9c94277 | 4 | #include "hw/ide/internal.h" |
5a6ac100 | 5 | #include "hw/pci/pci.h" |
db1015e9 | 6 | #include "qom/object.h" |
65c0f135 | 7 | |
7e2648df PB |
8 | #define BM_STATUS_DMAING 0x01 |
9 | #define BM_STATUS_ERROR 0x02 | |
10 | #define BM_STATUS_INT 0x04 | |
11 | ||
12 | #define BM_CMD_START 0x01 | |
13 | #define BM_CMD_READ 0x08 | |
14 | ||
40a6238a AG |
15 | typedef struct BMDMAState { |
16 | IDEDMA dma; | |
17 | uint8_t cmd; | |
18 | uint8_t status; | |
19 | uint32_t addr; | |
20 | ||
21 | IDEBus *bus; | |
22 | /* current transfer state */ | |
23 | uint32_t cur_addr; | |
24 | uint32_t cur_prd_last; | |
25 | uint32_t cur_prd_addr; | |
26 | uint32_t cur_prd_len; | |
097310b5 | 27 | BlockCompletionFunc *dma_cb; |
a9deb8c6 AK |
28 | MemoryRegion addr_ioport; |
29 | MemoryRegion extra_io; | |
40a6238a | 30 | qemu_irq irq; |
def93791 KW |
31 | |
32 | /* Bit 0-2 and 7: BM status register | |
33 | * Bit 3-6: bus->error_status */ | |
34 | uint8_t migration_compat_status; | |
a96cb236 | 35 | uint8_t migration_retry_unit; |
dc5d0af4 PB |
36 | int64_t migration_retry_sector_num; |
37 | uint32_t migration_retry_nsector; | |
a96cb236 | 38 | |
a9deb8c6 | 39 | struct PCIIDEState *pci_dev; |
40a6238a AG |
40 | } BMDMAState; |
41 | ||
f6c11d56 | 42 | #define TYPE_PCI_IDE "pci-ide" |
db1015e9 | 43 | typedef struct PCIIDEState PCIIDEState; |
8110fa1d EH |
44 | DECLARE_INSTANCE_CHECKER(PCIIDEState, PCI_IDE, |
45 | TYPE_PCI_IDE) | |
f6c11d56 | 46 | |
db1015e9 | 47 | struct PCIIDEState { |
f6c11d56 AF |
48 | /*< private >*/ |
49 | PCIDevice parent_obj; | |
50 | /*< public >*/ | |
51 | ||
65c0f135 JQ |
52 | IDEBus bus[2]; |
53 | BMDMAState bmdma[2]; | |
7e078316 | 54 | uint32_t secondary; /* used only for cmd646 */ |
a9deb8c6 | 55 | MemoryRegion bmdma_bar; |
8ac98d1a BZ |
56 | MemoryRegion cmd_bar[2]; |
57 | MemoryRegion data_bar[2]; | |
db1015e9 | 58 | }; |
65c0f135 | 59 | |
40a6238a AG |
60 | static inline IDEState *bmdma_active_if(BMDMAState *bmdma) |
61 | { | |
a96cb236 PB |
62 | assert(bmdma->bus->retry_unit != (uint8_t)-1); |
63 | return bmdma->bus->ifs + bmdma->bus->retry_unit; | |
40a6238a AG |
64 | } |
65 | ||
a9deb8c6 AK |
66 | void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d); |
67 | void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val); | |
68 | extern MemoryRegionOps bmdma_addr_ioport_ops; | |
be1765f3 | 69 | void pci_ide_create_devs(PCIDevice *dev); |
407a4f30 JQ |
70 | |
71 | extern const VMStateDescription vmstate_ide_pci; | |
c9ebc75d BZ |
72 | extern const MemoryRegionOps pci_ide_cmd_le_ops; |
73 | extern const MemoryRegionOps pci_ide_data_le_ops; | |
65c0f135 | 74 | #endif |