2 * SMC FDC37C669 Super I/O controller
4 * Copyright (c) 2018 Philippe Mathieu-Daudé
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
11 #include "qemu/osdep.h"
12 #include "hw/isa/superio.h"
14 /* UARTs (compatible with NS16450 or PC16550) */
16 static bool is_serial_enabled(ISASuperIODevice
*sio
, uint8_t index
)
21 static uint16_t get_serial_iobase(ISASuperIODevice
*sio
, uint8_t index
)
23 return index
? 0x2f8 : 0x3f8;
26 static unsigned int get_serial_irq(ISASuperIODevice
*sio
, uint8_t index
)
33 static bool is_parallel_enabled(ISASuperIODevice
*sio
, uint8_t index
)
38 static uint16_t get_parallel_iobase(ISASuperIODevice
*sio
, uint8_t index
)
43 static unsigned int get_parallel_irq(ISASuperIODevice
*sio
, uint8_t index
)
48 static unsigned int get_parallel_dma(ISASuperIODevice
*sio
, uint8_t index
)
53 /* Diskette controller (Software compatible with the Intel PC8477) */
55 static bool is_fdc_enabled(ISASuperIODevice
*sio
, uint8_t index
)
60 static uint16_t get_fdc_iobase(ISASuperIODevice
*sio
, uint8_t index
)
65 static unsigned int get_fdc_irq(ISASuperIODevice
*sio
, uint8_t index
)
70 static unsigned int get_fdc_dma(ISASuperIODevice
*sio
, uint8_t index
)
75 static void smc37c669_class_init(ObjectClass
*klass
, void *data
)
77 ISASuperIOClass
*sc
= ISA_SUPERIO_CLASS(klass
);
79 sc
->parallel
= (ISASuperIOFuncs
){
81 .is_enabled
= is_parallel_enabled
,
82 .get_iobase
= get_parallel_iobase
,
83 .get_irq
= get_parallel_irq
,
84 .get_dma
= get_parallel_dma
,
86 sc
->serial
= (ISASuperIOFuncs
){
88 .is_enabled
= is_serial_enabled
,
89 .get_iobase
= get_serial_iobase
,
90 .get_irq
= get_serial_irq
,
92 sc
->floppy
= (ISASuperIOFuncs
){
94 .is_enabled
= is_fdc_enabled
,
95 .get_iobase
= get_fdc_iobase
,
96 .get_irq
= get_fdc_irq
,
97 .get_dma
= get_fdc_dma
,
102 static 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
,
110 static void smc37c669_register_types(void)
112 type_register_static(&smc37c669_type_info
);
115 type_init(smc37c669_register_types
)