]>
Commit | Line | Data |
---|---|---|
65c0f135 JQ |
1 | #ifndef HW_IDE_PCI_H |
2 | #define HW_IDE_PCI_H | |
3 | ||
4 | #include <hw/ide/internal.h> | |
5 | ||
40a6238a AG |
6 | typedef struct BMDMAState { |
7 | IDEDMA dma; | |
8 | uint8_t cmd; | |
9 | uint8_t status; | |
10 | uint32_t addr; | |
11 | ||
12 | IDEBus *bus; | |
13 | /* current transfer state */ | |
14 | uint32_t cur_addr; | |
15 | uint32_t cur_prd_last; | |
16 | uint32_t cur_prd_addr; | |
17 | uint32_t cur_prd_len; | |
18 | uint8_t unit; | |
19 | BlockDriverCompletionFunc *dma_cb; | |
20 | int64_t sector_num; | |
21 | uint32_t nsector; | |
a9deb8c6 AK |
22 | MemoryRegion addr_ioport; |
23 | MemoryRegion extra_io; | |
40a6238a AG |
24 | QEMUBH *bh; |
25 | qemu_irq irq; | |
def93791 KW |
26 | |
27 | /* Bit 0-2 and 7: BM status register | |
28 | * Bit 3-6: bus->error_status */ | |
29 | uint8_t migration_compat_status; | |
a9deb8c6 | 30 | struct PCIIDEState *pci_dev; |
40a6238a AG |
31 | } BMDMAState; |
32 | ||
a9deb8c6 AK |
33 | typedef struct CMD646BAR { |
34 | MemoryRegion cmd; | |
35 | MemoryRegion data; | |
36 | IDEBus *bus; | |
37 | struct PCIIDEState *pci_dev; | |
38 | } CMD646BAR; | |
39 | ||
f6c11d56 AF |
40 | #define TYPE_PCI_IDE "pci-ide" |
41 | #define PCI_IDE(obj) OBJECT_CHECK(PCIIDEState, (obj), TYPE_PCI_IDE) | |
42 | ||
65c0f135 | 43 | typedef struct PCIIDEState { |
f6c11d56 AF |
44 | /*< private >*/ |
45 | PCIDevice parent_obj; | |
46 | /*< public >*/ | |
47 | ||
65c0f135 JQ |
48 | IDEBus bus[2]; |
49 | BMDMAState bmdma[2]; | |
7e078316 | 50 | uint32_t secondary; /* used only for cmd646 */ |
a9deb8c6 AK |
51 | MemoryRegion bmdma_bar; |
52 | CMD646BAR cmd646_bar[2]; /* used only for cmd646 */ | |
65c0f135 JQ |
53 | } PCIIDEState; |
54 | ||
40a6238a AG |
55 | |
56 | static inline IDEState *bmdma_active_if(BMDMAState *bmdma) | |
57 | { | |
58 | assert(bmdma->unit != (uint8_t)-1); | |
59 | return bmdma->bus->ifs + bmdma->unit; | |
60 | } | |
61 | ||
62 | ||
a9deb8c6 AK |
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; | |
3e7e1558 | 66 | void pci_ide_create_devs(PCIDevice *dev, DriveInfo **hd_table); |
407a4f30 JQ |
67 | |
68 | extern const VMStateDescription vmstate_ide_pci; | |
65c0f135 | 69 | #endif |