2009-10-07 14:56:22 +00:00
|
|
|
#ifndef HW_IDE_PCI_H
|
|
|
|
#define HW_IDE_PCI_H
|
|
|
|
|
2016-06-22 17:11:19 +00:00
|
|
|
#include "hw/ide/internal.h"
|
2009-10-07 14:56:22 +00:00
|
|
|
|
2014-08-04 21:11:13 +00:00
|
|
|
#define BM_STATUS_DMAING 0x01
|
|
|
|
#define BM_STATUS_ERROR 0x02
|
|
|
|
#define BM_STATUS_INT 0x04
|
|
|
|
|
|
|
|
#define BM_CMD_START 0x01
|
|
|
|
#define BM_CMD_READ 0x08
|
|
|
|
|
2010-12-14 23:23:00 +00:00
|
|
|
typedef struct BMDMAState {
|
|
|
|
IDEDMA dma;
|
|
|
|
uint8_t cmd;
|
|
|
|
uint8_t status;
|
|
|
|
uint32_t addr;
|
|
|
|
|
|
|
|
IDEBus *bus;
|
|
|
|
/* current transfer state */
|
|
|
|
uint32_t cur_addr;
|
|
|
|
uint32_t cur_prd_last;
|
|
|
|
uint32_t cur_prd_addr;
|
|
|
|
uint32_t cur_prd_len;
|
2014-10-07 11:59:15 +00:00
|
|
|
BlockCompletionFunc *dma_cb;
|
2011-08-08 13:09:11 +00:00
|
|
|
MemoryRegion addr_ioport;
|
|
|
|
MemoryRegion extra_io;
|
2010-12-14 23:23:00 +00:00
|
|
|
qemu_irq irq;
|
2011-05-26 13:00:34 +00:00
|
|
|
|
|
|
|
/* Bit 0-2 and 7: BM status register
|
|
|
|
* Bit 3-6: bus->error_status */
|
|
|
|
uint8_t migration_compat_status;
|
2015-02-23 16:17:57 +00:00
|
|
|
uint8_t migration_retry_unit;
|
2015-02-23 16:17:58 +00:00
|
|
|
int64_t migration_retry_sector_num;
|
|
|
|
uint32_t migration_retry_nsector;
|
2015-02-23 16:17:57 +00:00
|
|
|
|
2011-08-08 13:09:11 +00:00
|
|
|
struct PCIIDEState *pci_dev;
|
2010-12-14 23:23:00 +00:00
|
|
|
} BMDMAState;
|
|
|
|
|
2011-08-08 13:09:11 +00:00
|
|
|
typedef struct CMD646BAR {
|
|
|
|
MemoryRegion cmd;
|
|
|
|
MemoryRegion data;
|
|
|
|
IDEBus *bus;
|
|
|
|
struct PCIIDEState *pci_dev;
|
|
|
|
} CMD646BAR;
|
|
|
|
|
2013-07-17 16:44:48 +00:00
|
|
|
#define TYPE_PCI_IDE "pci-ide"
|
|
|
|
#define PCI_IDE(obj) OBJECT_CHECK(PCIIDEState, (obj), TYPE_PCI_IDE)
|
|
|
|
|
2009-10-07 14:56:22 +00:00
|
|
|
typedef struct PCIIDEState {
|
2013-07-17 16:44:48 +00:00
|
|
|
/*< private >*/
|
|
|
|
PCIDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
|
|
|
2009-10-07 14:56:22 +00:00
|
|
|
IDEBus bus[2];
|
|
|
|
BMDMAState bmdma[2];
|
2009-10-07 14:56:26 +00:00
|
|
|
uint32_t secondary; /* used only for cmd646 */
|
2011-08-08 13:09:11 +00:00
|
|
|
MemoryRegion bmdma_bar;
|
|
|
|
CMD646BAR cmd646_bar[2]; /* used only for cmd646 */
|
2009-10-07 14:56:22 +00:00
|
|
|
} PCIIDEState;
|
|
|
|
|
2010-12-14 23:23:00 +00:00
|
|
|
|
|
|
|
static inline IDEState *bmdma_active_if(BMDMAState *bmdma)
|
|
|
|
{
|
2015-02-23 16:17:57 +00:00
|
|
|
assert(bmdma->bus->retry_unit != (uint8_t)-1);
|
|
|
|
return bmdma->bus->ifs + bmdma->bus->retry_unit;
|
2010-12-14 23:23:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-08 13:09:11 +00:00
|
|
|
void bmdma_init(IDEBus *bus, BMDMAState *bm, PCIIDEState *d);
|
|
|
|
void bmdma_cmd_writeb(BMDMAState *bm, uint32_t val);
|
|
|
|
extern MemoryRegionOps bmdma_addr_ioport_ops;
|
2009-10-07 14:56:23 +00:00
|
|
|
void pci_ide_create_devs(PCIDevice *dev, DriveInfo **hd_table);
|
2009-10-07 18:55:32 +00:00
|
|
|
|
|
|
|
extern const VMStateDescription vmstate_ide_pci;
|
2009-10-07 14:56:22 +00:00
|
|
|
#endif
|