1
2
3
4
5
6
7
8
9
10
11#include "qemu/osdep.h"
12#include "hw/isa/superio.h"
13
14
15
16static bool is_serial_enabled(ISASuperIODevice *sio, uint8_t index)
17{
18 return index < 2;
19}
20
21static uint16_t get_serial_iobase(ISASuperIODevice *sio, uint8_t index)
22{
23 return index ? 0x2f8 : 0x3f8;
24}
25
26static unsigned int get_serial_irq(ISASuperIODevice *sio, uint8_t index)
27{
28 return index ? 3 : 4;
29}
30
31
32
33static bool is_parallel_enabled(ISASuperIODevice *sio, uint8_t index)
34{
35 return index < 1;
36}
37
38static uint16_t get_parallel_iobase(ISASuperIODevice *sio, uint8_t index)
39{
40 return 0x378;
41}
42
43static unsigned int get_parallel_irq(ISASuperIODevice *sio, uint8_t index)
44{
45 return 7;
46}
47
48static unsigned int get_parallel_dma(ISASuperIODevice *sio, uint8_t index)
49{
50 return 3;
51}
52
53
54
55static bool is_fdc_enabled(ISASuperIODevice *sio, uint8_t index)
56{
57 return index < 1;
58}
59
60static uint16_t get_fdc_iobase(ISASuperIODevice *sio, uint8_t index)
61{
62 return 0x3f0;
63}
64
65static unsigned int get_fdc_irq(ISASuperIODevice *sio, uint8_t index)
66{
67 return 6;
68}
69
70static unsigned int get_fdc_dma(ISASuperIODevice *sio, uint8_t index)
71{
72 return 2;
73}
74
75static void smc37c669_class_init(ObjectClass *klass, void *data)
76{
77 ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
78
79 sc->parallel = (ISASuperIOFuncs){
80 .count = 1,
81 .is_enabled = is_parallel_enabled,
82 .get_iobase = get_parallel_iobase,
83 .get_irq = get_parallel_irq,
84 .get_dma = get_parallel_dma,
85 };
86 sc->serial = (ISASuperIOFuncs){
87 .count = 2,
88 .is_enabled = is_serial_enabled,
89 .get_iobase = get_serial_iobase,
90 .get_irq = get_serial_irq,
91 };
92 sc->floppy = (ISASuperIOFuncs){
93 .count = 1,
94 .is_enabled = is_fdc_enabled,
95 .get_iobase = get_fdc_iobase,
96 .get_irq = get_fdc_irq,
97 .get_dma = get_fdc_dma,
98 };
99 sc->ide.count = 0;
100}
101
102static const TypeInfo smc37c669_type_info = {
103 .name = TYPE_SMC37C669_SUPERIO,
104 .parent = TYPE_ISA_SUPERIO,
105 .instance_size = sizeof(ISASuperIODevice),
106 .class_size = sizeof(ISASuperIOClass),
107 .class_init = smc37c669_class_init,
108};
109
110static void smc37c669_register_types(void)
111{
112 type_register_static(&smc37c669_type_info);
113}
114
115type_init(smc37c669_register_types)
116