xref: /qemu/include/hw/isa/superio.h (revision 2cd4f8acb0e3416c7431d0e48d03f1a4c4a64cc1)
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é 
25*2cd4f8acSPeter Maydell #define SUPERIO_MAX_SERIAL_PORTS 4
26*2cd4f8acSPeter Maydell 
271854eb28SPhilippe Mathieu-Daudé typedef struct ISASuperIODevice {
284c3119a6SPhilippe Mathieu-Daudé     /*< private >*/
291854eb28SPhilippe Mathieu-Daudé     ISADevice parent_obj;
304c3119a6SPhilippe Mathieu-Daudé     /*< public >*/
314c3119a6SPhilippe Mathieu-Daudé 
324c3119a6SPhilippe Mathieu-Daudé     ISADevice *parallel[MAX_PARALLEL_PORTS];
33*2cd4f8acSPeter Maydell     ISADevice *serial[SUPERIO_MAX_SERIAL_PORTS];
346f6695b1SPhilippe Mathieu-Daudé     ISADevice *floppy;
3572d3d8f0SPhilippe Mathieu-Daudé     ISADevice *kbc;
36c16a4e1bSPhilippe Mathieu-Daudé     ISADevice *ide;
371854eb28SPhilippe Mathieu-Daudé } ISASuperIODevice;
381854eb28SPhilippe Mathieu-Daudé 
391854eb28SPhilippe Mathieu-Daudé typedef struct ISASuperIOFuncs {
401854eb28SPhilippe Mathieu-Daudé     size_t count;
411854eb28SPhilippe Mathieu-Daudé     bool (*is_enabled)(ISASuperIODevice *sio, uint8_t index);
421854eb28SPhilippe Mathieu-Daudé     uint16_t (*get_iobase)(ISASuperIODevice *sio, uint8_t index);
431854eb28SPhilippe Mathieu-Daudé     unsigned int (*get_irq)(ISASuperIODevice *sio, uint8_t index);
441854eb28SPhilippe Mathieu-Daudé     unsigned int (*get_dma)(ISASuperIODevice *sio, uint8_t index);
451854eb28SPhilippe Mathieu-Daudé } ISASuperIOFuncs;
461854eb28SPhilippe Mathieu-Daudé 
471854eb28SPhilippe Mathieu-Daudé typedef struct ISASuperIOClass {
481854eb28SPhilippe Mathieu-Daudé     /*< private >*/
491854eb28SPhilippe Mathieu-Daudé     ISADeviceClass parent_class;
501854eb28SPhilippe Mathieu-Daudé     /*< public >*/
511854eb28SPhilippe Mathieu-Daudé     DeviceRealize parent_realize;
524c3119a6SPhilippe Mathieu-Daudé 
534c3119a6SPhilippe Mathieu-Daudé     ISASuperIOFuncs parallel;
54cd9526abSPhilippe Mathieu-Daudé     ISASuperIOFuncs serial;
556f6695b1SPhilippe Mathieu-Daudé     ISASuperIOFuncs floppy;
56c16a4e1bSPhilippe Mathieu-Daudé     ISASuperIOFuncs ide;
571854eb28SPhilippe Mathieu-Daudé } ISASuperIOClass;
581854eb28SPhilippe Mathieu-Daudé 
597313b1f2SPhilippe Mathieu-Daudé #define TYPE_FDC37M81X_SUPERIO  "fdc37m81x-superio"
607bea0dd4SPhilippe Mathieu-Daudé #define TYPE_SMC37C669_SUPERIO  "smc37c669-superio"
617313b1f2SPhilippe Mathieu-Daudé 
621854eb28SPhilippe Mathieu-Daudé #endif /* HW_ISA_SUPERIO_H */
63