xref: /qemu/include/hw/isa/superio.h (revision 4c3119a6e3ea7bdab718015b6f5176cfaf52f7ce)
11854eb28SPhilippe Mathieu-Daudé /*
21854eb28SPhilippe Mathieu-Daudé  * Generic ISA Super I/O
31854eb28SPhilippe Mathieu-Daudé  *
41854eb28SPhilippe Mathieu-Daudé  * Copyright (c) 2018 Philippe Mathieu-Daudé
51854eb28SPhilippe Mathieu-Daudé  *
61854eb28SPhilippe Mathieu-Daudé  * This code is licensed under the GNU GPLv2 and later.
71854eb28SPhilippe Mathieu-Daudé  * See the COPYING file in the top-level directory.
81854eb28SPhilippe Mathieu-Daudé  * SPDX-License-Identifier: GPL-2.0-or-later
91854eb28SPhilippe Mathieu-Daudé  */
101854eb28SPhilippe Mathieu-Daudé #ifndef HW_ISA_SUPERIO_H
111854eb28SPhilippe Mathieu-Daudé #define HW_ISA_SUPERIO_H
121854eb28SPhilippe Mathieu-Daudé 
131854eb28SPhilippe Mathieu-Daudé #include "qemu-common.h"
141854eb28SPhilippe Mathieu-Daudé #include "sysemu/sysemu.h"
151854eb28SPhilippe Mathieu-Daudé #include "hw/isa/isa.h"
161854eb28SPhilippe Mathieu-Daudé 
171854eb28SPhilippe Mathieu-Daudé #define TYPE_ISA_SUPERIO "isa-superio"
181854eb28SPhilippe Mathieu-Daudé #define ISA_SUPERIO(obj) \
191854eb28SPhilippe Mathieu-Daudé     OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO)
201854eb28SPhilippe Mathieu-Daudé #define ISA_SUPERIO_GET_CLASS(obj) \
211854eb28SPhilippe Mathieu-Daudé     OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO)
221854eb28SPhilippe Mathieu-Daudé #define ISA_SUPERIO_CLASS(klass) \
231854eb28SPhilippe Mathieu-Daudé     OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO)
241854eb28SPhilippe Mathieu-Daudé 
251854eb28SPhilippe Mathieu-Daudé typedef struct ISASuperIODevice {
26*4c3119a6SPhilippe Mathieu-Daudé     /*< private >*/
271854eb28SPhilippe Mathieu-Daudé     ISADevice parent_obj;
28*4c3119a6SPhilippe Mathieu-Daudé     /*< public >*/
29*4c3119a6SPhilippe Mathieu-Daudé 
30*4c3119a6SPhilippe Mathieu-Daudé     ISADevice *parallel[MAX_PARALLEL_PORTS];
311854eb28SPhilippe Mathieu-Daudé } ISASuperIODevice;
321854eb28SPhilippe Mathieu-Daudé 
331854eb28SPhilippe Mathieu-Daudé typedef struct ISASuperIOFuncs {
341854eb28SPhilippe Mathieu-Daudé     size_t count;
351854eb28SPhilippe Mathieu-Daudé     bool (*is_enabled)(ISASuperIODevice *sio, uint8_t index);
361854eb28SPhilippe Mathieu-Daudé     uint16_t (*get_iobase)(ISASuperIODevice *sio, uint8_t index);
371854eb28SPhilippe Mathieu-Daudé     unsigned int (*get_irq)(ISASuperIODevice *sio, uint8_t index);
381854eb28SPhilippe Mathieu-Daudé     unsigned int (*get_dma)(ISASuperIODevice *sio, uint8_t index);
391854eb28SPhilippe Mathieu-Daudé } ISASuperIOFuncs;
401854eb28SPhilippe Mathieu-Daudé 
411854eb28SPhilippe Mathieu-Daudé typedef struct ISASuperIOClass {
421854eb28SPhilippe Mathieu-Daudé     /*< private >*/
431854eb28SPhilippe Mathieu-Daudé     ISADeviceClass parent_class;
441854eb28SPhilippe Mathieu-Daudé     /*< public >*/
451854eb28SPhilippe Mathieu-Daudé     DeviceRealize parent_realize;
46*4c3119a6SPhilippe Mathieu-Daudé 
47*4c3119a6SPhilippe Mathieu-Daudé     ISASuperIOFuncs parallel;
481854eb28SPhilippe Mathieu-Daudé } ISASuperIOClass;
491854eb28SPhilippe Mathieu-Daudé 
501854eb28SPhilippe Mathieu-Daudé #endif /* HW_ISA_SUPERIO_H */
51