1
2
3
4
5
6
7
8
9
10#ifndef HW_ISA_SUPERIO_H
11#define HW_ISA_SUPERIO_H
12
13#include "qemu-common.h"
14#include "sysemu/sysemu.h"
15#include "hw/isa/isa.h"
16
17#define TYPE_ISA_SUPERIO "isa-superio"
18#define ISA_SUPERIO(obj) \
19 OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO)
20#define ISA_SUPERIO_GET_CLASS(obj) \
21 OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO)
22#define ISA_SUPERIO_CLASS(klass) \
23 OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO)
24
25#define SUPERIO_MAX_SERIAL_PORTS 4
26
27typedef struct ISASuperIODevice {
28
29 ISADevice parent_obj;
30
31
32 ISADevice *parallel[MAX_PARALLEL_PORTS];
33 ISADevice *serial[SUPERIO_MAX_SERIAL_PORTS];
34 ISADevice *floppy;
35 ISADevice *kbc;
36 ISADevice *ide;
37} ISASuperIODevice;
38
39typedef struct ISASuperIOFuncs {
40 size_t count;
41 bool (*is_enabled)(ISASuperIODevice *sio, uint8_t index);
42 uint16_t (*get_iobase)(ISASuperIODevice *sio, uint8_t index);
43 unsigned int (*get_irq)(ISASuperIODevice *sio, uint8_t index);
44 unsigned int (*get_dma)(ISASuperIODevice *sio, uint8_t index);
45} ISASuperIOFuncs;
46
47typedef struct ISASuperIOClass {
48
49 ISADeviceClass parent_class;
50
51 DeviceRealize parent_realize;
52
53 ISASuperIOFuncs parallel;
54 ISASuperIOFuncs serial;
55 ISASuperIOFuncs floppy;
56 ISASuperIOFuncs ide;
57} ISASuperIOClass;
58
59#define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio"
60#define TYPE_SMC37C669_SUPERIO "smc37c669-superio"
61
62#endif
63