xref: /qemu/include/hw/isa/superio.h (revision 1854eb287e77c07b2089b42319e23c7c0df8a2f1)
1*1854eb28SPhilippe Mathieu-Daudé /*
2*1854eb28SPhilippe Mathieu-Daudé  * Generic ISA Super I/O
3*1854eb28SPhilippe Mathieu-Daudé  *
4*1854eb28SPhilippe Mathieu-Daudé  * Copyright (c) 2018 Philippe Mathieu-Daudé
5*1854eb28SPhilippe Mathieu-Daudé  *
6*1854eb28SPhilippe Mathieu-Daudé  * This code is licensed under the GNU GPLv2 and later.
7*1854eb28SPhilippe Mathieu-Daudé  * See the COPYING file in the top-level directory.
8*1854eb28SPhilippe Mathieu-Daudé  * SPDX-License-Identifier: GPL-2.0-or-later
9*1854eb28SPhilippe Mathieu-Daudé  */
10*1854eb28SPhilippe Mathieu-Daudé #ifndef HW_ISA_SUPERIO_H
11*1854eb28SPhilippe Mathieu-Daudé #define HW_ISA_SUPERIO_H
12*1854eb28SPhilippe Mathieu-Daudé 
13*1854eb28SPhilippe Mathieu-Daudé #include "qemu-common.h"
14*1854eb28SPhilippe Mathieu-Daudé #include "sysemu/sysemu.h"
15*1854eb28SPhilippe Mathieu-Daudé #include "hw/isa/isa.h"
16*1854eb28SPhilippe Mathieu-Daudé 
17*1854eb28SPhilippe Mathieu-Daudé #define TYPE_ISA_SUPERIO "isa-superio"
18*1854eb28SPhilippe Mathieu-Daudé #define ISA_SUPERIO(obj) \
19*1854eb28SPhilippe Mathieu-Daudé     OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO)
20*1854eb28SPhilippe Mathieu-Daudé #define ISA_SUPERIO_GET_CLASS(obj) \
21*1854eb28SPhilippe Mathieu-Daudé     OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO)
22*1854eb28SPhilippe Mathieu-Daudé #define ISA_SUPERIO_CLASS(klass) \
23*1854eb28SPhilippe Mathieu-Daudé     OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO)
24*1854eb28SPhilippe Mathieu-Daudé 
25*1854eb28SPhilippe Mathieu-Daudé typedef struct ISASuperIODevice {
26*1854eb28SPhilippe Mathieu-Daudé     ISADevice parent_obj;
27*1854eb28SPhilippe Mathieu-Daudé } ISASuperIODevice;
28*1854eb28SPhilippe Mathieu-Daudé 
29*1854eb28SPhilippe Mathieu-Daudé typedef struct ISASuperIOFuncs {
30*1854eb28SPhilippe Mathieu-Daudé     size_t count;
31*1854eb28SPhilippe Mathieu-Daudé     bool (*is_enabled)(ISASuperIODevice *sio, uint8_t index);
32*1854eb28SPhilippe Mathieu-Daudé     uint16_t (*get_iobase)(ISASuperIODevice *sio, uint8_t index);
33*1854eb28SPhilippe Mathieu-Daudé     unsigned int (*get_irq)(ISASuperIODevice *sio, uint8_t index);
34*1854eb28SPhilippe Mathieu-Daudé     unsigned int (*get_dma)(ISASuperIODevice *sio, uint8_t index);
35*1854eb28SPhilippe Mathieu-Daudé } ISASuperIOFuncs;
36*1854eb28SPhilippe Mathieu-Daudé 
37*1854eb28SPhilippe Mathieu-Daudé typedef struct ISASuperIOClass {
38*1854eb28SPhilippe Mathieu-Daudé     /*< private >*/
39*1854eb28SPhilippe Mathieu-Daudé     ISADeviceClass parent_class;
40*1854eb28SPhilippe Mathieu-Daudé     /*< public >*/
41*1854eb28SPhilippe Mathieu-Daudé     DeviceRealize parent_realize;
42*1854eb28SPhilippe Mathieu-Daudé } ISASuperIOClass;
43*1854eb28SPhilippe Mathieu-Daudé 
44*1854eb28SPhilippe Mathieu-Daudé #endif /* HW_ISA_SUPERIO_H */
45