hw/riscv: Move sifive_u_otp model to hw/misc
[qemu/ar7.git] / include / hw / isa / superio.h
blob147cc0a7b751dc46598bd1b35c3e6f7633e8d66f
1 /*
2 * Generic ISA Super I/O
4 * Copyright (c) 2018 Philippe Mathieu-Daudé
6 * This work is licensed under the terms of the GNU GPL, version 2 or 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
13 #include "sysemu/sysemu.h"
14 #include "hw/isa/isa.h"
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)
24 #define SUPERIO_MAX_SERIAL_PORTS 4
26 typedef struct ISASuperIODevice {
27 /*< private >*/
28 ISADevice parent_obj;
29 /*< public >*/
31 ISADevice *parallel[MAX_PARALLEL_PORTS];
32 ISADevice *serial[SUPERIO_MAX_SERIAL_PORTS];
33 ISADevice *floppy;
34 ISADevice *kbc;
35 ISADevice *ide;
36 } ISASuperIODevice;
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;
46 typedef struct ISASuperIOClass {
47 /*< private >*/
48 ISADeviceClass parent_class;
49 /*< public >*/
50 DeviceRealize parent_realize;
52 ISASuperIOFuncs parallel;
53 ISASuperIOFuncs serial;
54 ISASuperIOFuncs floppy;
55 ISASuperIOFuncs ide;
56 } ISASuperIOClass;
58 #define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio"
59 #define TYPE_SMC37C669_SUPERIO "smc37c669-superio"
61 #endif /* HW_ISA_SUPERIO_H */