xref: /qemu/include/hw/isa/superio.h (revision 1854eb287e77c07b2089b42319e23c7c0df8a2f1)
1 /*
2  * Generic ISA Super I/O
3  *
4  * Copyright (c) 2018 Philippe Mathieu-Daudé
5  *
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
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 typedef struct ISASuperIODevice {
26     ISADevice parent_obj;
27 } ISASuperIODevice;
28 
29 typedef struct ISASuperIOFuncs {
30     size_t count;
31     bool (*is_enabled)(ISASuperIODevice *sio, uint8_t index);
32     uint16_t (*get_iobase)(ISASuperIODevice *sio, uint8_t index);
33     unsigned int (*get_irq)(ISASuperIODevice *sio, uint8_t index);
34     unsigned int (*get_dma)(ISASuperIODevice *sio, uint8_t index);
35 } ISASuperIOFuncs;
36 
37 typedef struct ISASuperIOClass {
38     /*< private >*/
39     ISADeviceClass parent_class;
40     /*< public >*/
41     DeviceRealize parent_realize;
42 } ISASuperIOClass;
43 
44 #endif /* HW_ISA_SUPERIO_H */
45