2 * Generic ISA Super I/O
4 * Copyright (c) 2018 Philippe Mathieu-Daudé
6 * This code is licensed under the GNU GPLv2 and later.
7 * See the COPYING file in the top-level directory.
8 * SPDX-License-Identifier: GPL-2.0-or-later
10 #ifndef HW_ISA_SUPERIO_H
11 #define HW_ISA_SUPERIO_H
13 #include "sysemu/sysemu.h"
14 #include "hw/isa/isa.h"
16 #define TYPE_ISA_SUPERIO "isa-superio"
17 #define ISA_SUPERIO(obj) \
18 OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO)
19 #define ISA_SUPERIO_GET_CLASS(obj) \
20 OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO)
21 #define ISA_SUPERIO_CLASS(klass) \
22 OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO)
24 #define SUPERIO_MAX_SERIAL_PORTS 4
26 typedef struct ISASuperIODevice
{
31 ISADevice
*parallel
[MAX_PARALLEL_PORTS
];
32 ISADevice
*serial
[SUPERIO_MAX_SERIAL_PORTS
];
38 typedef struct ISASuperIOFuncs
{
40 bool (*is_enabled
)(ISASuperIODevice
*sio
, uint8_t index
);
41 uint16_t (*get_iobase
)(ISASuperIODevice
*sio
, uint8_t index
);
42 unsigned int (*get_irq
)(ISASuperIODevice
*sio
, uint8_t index
);
43 unsigned int (*get_dma
)(ISASuperIODevice
*sio
, uint8_t index
);
46 typedef struct ISASuperIOClass
{
48 ISADeviceClass parent_class
;
50 DeviceRealize parent_realize
;
52 ISASuperIOFuncs parallel
;
53 ISASuperIOFuncs serial
;
54 ISASuperIOFuncs floppy
;
58 #define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio"
59 #define TYPE_SMC37C669_SUPERIO "smc37c669-superio"
61 #endif /* HW_ISA_SUPERIO_H */