]>
Commit | Line | Data |
---|---|---|
1854eb28 PMD |
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 | ||
1854eb28 PMD |
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 | ||
2cd4f8ac PM |
24 | #define SUPERIO_MAX_SERIAL_PORTS 4 |
25 | ||
1854eb28 | 26 | typedef struct ISASuperIODevice { |
4c3119a6 | 27 | /*< private >*/ |
1854eb28 | 28 | ISADevice parent_obj; |
4c3119a6 PMD |
29 | /*< public >*/ |
30 | ||
31 | ISADevice *parallel[MAX_PARALLEL_PORTS]; | |
2cd4f8ac | 32 | ISADevice *serial[SUPERIO_MAX_SERIAL_PORTS]; |
6f6695b1 | 33 | ISADevice *floppy; |
72d3d8f0 | 34 | ISADevice *kbc; |
c16a4e1b | 35 | ISADevice *ide; |
1854eb28 PMD |
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; | |
4c3119a6 PMD |
51 | |
52 | ISASuperIOFuncs parallel; | |
cd9526ab | 53 | ISASuperIOFuncs serial; |
6f6695b1 | 54 | ISASuperIOFuncs floppy; |
c16a4e1b | 55 | ISASuperIOFuncs ide; |
1854eb28 PMD |
56 | } ISASuperIOClass; |
57 | ||
7313b1f2 | 58 | #define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio" |
7bea0dd4 | 59 | #define TYPE_SMC37C669_SUPERIO "smc37c669-superio" |
7313b1f2 | 60 | |
1854eb28 | 61 | #endif /* HW_ISA_SUPERIO_H */ |