xref: /openbmc/qemu/include/hw/isa/superio.h (revision 500eb6db)
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 "sysemu/sysemu.h"
14 #include "hw/isa/isa.h"
15 
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)
23 
24 #define SUPERIO_MAX_SERIAL_PORTS 4
25 
26 typedef struct ISASuperIODevice {
27     /*< private >*/
28     ISADevice parent_obj;
29     /*< public >*/
30 
31     ISADevice *parallel[MAX_PARALLEL_PORTS];
32     ISADevice *serial[SUPERIO_MAX_SERIAL_PORTS];
33     ISADevice *floppy;
34     ISADevice *kbc;
35     ISADevice *ide;
36 } ISASuperIODevice;
37 
38 typedef struct ISASuperIOFuncs {
39     size_t count;
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);
44 } ISASuperIOFuncs;
45 
46 typedef struct ISASuperIOClass {
47     /*< private >*/
48     ISADeviceClass parent_class;
49     /*< public >*/
50     DeviceRealize parent_realize;
51 
52     ISASuperIOFuncs parallel;
53     ISASuperIOFuncs serial;
54     ISASuperIOFuncs floppy;
55     ISASuperIOFuncs ide;
56 } ISASuperIOClass;
57 
58 #define TYPE_FDC37M81X_SUPERIO  "fdc37m81x-superio"
59 #define TYPE_SMC37C669_SUPERIO  "smc37c669-superio"
60 
61 #endif /* HW_ISA_SUPERIO_H */
62