]> Git Repo - qemu.git/blame - hw/ide/pci.h
ahci: properly shadow the TFD register
[qemu.git] / hw / ide / pci.h
CommitLineData
65c0f135
JQ
1#ifndef HW_IDE_PCI_H
2#define HW_IDE_PCI_H
3
4#include <hw/ide/internal.h>
5
7e2648df
PB
6#define BM_STATUS_DMAING 0x01
7#define BM_STATUS_ERROR 0x02
8#define BM_STATUS_INT 0x04
9
10#define BM_CMD_START 0x01
11#define BM_CMD_READ 0x08
12
40a6238a
AG
13typedef struct BMDMAState {
14 IDEDMA dma;
15 uint8_t cmd;
16 uint8_t status;
17 uint32_t addr;
18
19 IDEBus *bus;
20 /* current transfer state */
21 uint32_t cur_addr;
22 uint32_t cur_prd_last;
23 uint32_t cur_prd_addr;
24 uint32_t cur_prd_len;
25 uint8_t unit;
26 BlockDriverCompletionFunc *dma_cb;
27 int64_t sector_num;
28 uint32_t nsector;
a9deb8c6
AK
29 MemoryRegion addr_ioport;
30 MemoryRegion extra_io;
40a6238a
AG
31 QEMUBH *bh;
32 qemu_irq irq;
def93791
KW
33
34 /* Bit 0-2 and 7: BM status register
35 * Bit 3-6: bus->error_status */
36 uint8_t migration_compat_status;
a9deb8c6 37 struct PCIIDEState *pci_dev;
40a6238a
AG
38} BMDMAState;
39
a9deb8c6
AK
40typedef struct CMD646BAR {
41 MemoryRegion cmd;
42 MemoryRegion data;
43 IDEBus *bus;
44 struct PCIIDEState *pci_dev;
45} CMD646BAR;
46
f6c11d56
AF
47#define TYPE_PCI_IDE "pci-ide"
48#define PCI_IDE(obj) OBJECT_CHECK(PCIIDEState, (obj), TYPE_PCI_IDE)
49
65c0f135 50typedef struct PCIIDEState {
f6c11d56
AF
51 /*< private >*/
52 PCIDevice parent_obj;
53 /*< public >*/
54
65c0f135
JQ
55 IDEBus bus[2];
56 BMDMAState bmdma[2];
7e078316 57 uint32_t secondary; /* used only for cmd646 */
a9deb8c6
AK
58 MemoryRegion bmdma_bar;
59 CMD646BAR cmd646_bar[2]; /* used only for cmd646 */
65c0f135
JQ
60} PCIIDEState;
61
40a6238a
AG
62
63static inline IDEState *bmdma_active_if(BMDMAState *bmdma)
64{
65 assert(bmdma->unit != (uint8_t)-1);
66 return bmdma->bus->ifs + bmdma->unit;
67}
68
69
a9deb8c6
AK
70void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d);
71void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val);
72extern MemoryRegionOps bmdma_addr_ioport_ops;
3e7e1558 73void pci_ide_create_devs(PCIDevice *dev, DriveInfo **hd_table);
407a4f30
JQ
74
75extern const VMStateDescription vmstate_ide_pci;
65c0f135 76#endif
This page took 0.465109 seconds and 4 git commands to generate.