xref: /openbmc/qemu/include/hw/ide/ide-bus.h (revision f74c6177)
1 #ifndef HW_IDE_BUS_H
2 #define HW_IDE_BUS_H
3 
4 #include "exec/ioport.h"
5 #include "hw/ide/ide-dev.h"
6 #include "hw/ide/ide-dma.h"
7 
8 struct IDEBus {
9     BusState qbus;
10     IDEDevice *master;
11     IDEDevice *slave;
12     IDEState ifs[2];
13     QEMUBH *bh;
14 
15     int bus_id;
16     int max_units;
17     IDEDMA *dma;
18     uint8_t unit;
19     uint8_t cmd;
20     qemu_irq irq; /* bus output */
21 
22     int error_status;
23     uint8_t retry_unit;
24     int64_t retry_sector_num;
25     uint32_t retry_nsector;
26     PortioList portio_list;
27     PortioList portio2_list;
28     VMChangeStateEntry *vmstate;
29 };
30 
31 #define TYPE_IDE_BUS "IDE"
32 OBJECT_DECLARE_SIMPLE_TYPE(IDEBus, IDE_BUS)
33 
34 void ide_bus_init(IDEBus *idebus, size_t idebus_size, DeviceState *dev,
35                   int bus_id, int max_units);
36 IDEDevice *ide_bus_create_drive(IDEBus *bus, int unit, DriveInfo *drive);
37 
38 int ide_get_geometry(BusState *bus, int unit,
39                      int16_t *cyls, int8_t *heads, int8_t *secs);
40 int ide_get_bios_chs_trans(BusState *bus, int unit);
41 
42 #endif
43