2 * SMC FDC37C669 Super I/O controller
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
11 #include "qemu/osdep.h"
12 #include "hw/isa/superio.h"
13 #include "qemu/module.h"
15 /* UARTs (compatible with NS16450 or PC16550) */
17 static uint16_t get_serial_iobase(ISASuperIODevice
*sio
, uint8_t index
)
19 return index
? 0x2f8 : 0x3f8;
22 static unsigned int get_serial_irq(ISASuperIODevice
*sio
, uint8_t index
)
29 static uint16_t get_parallel_iobase(ISASuperIODevice
*sio
, uint8_t index
)
34 static unsigned int get_parallel_irq(ISASuperIODevice
*sio
, uint8_t index
)
39 static unsigned int get_parallel_dma(ISASuperIODevice
*sio
, uint8_t index
)
44 /* Diskette controller (Software compatible with the Intel PC8477) */
46 static uint16_t get_fdc_iobase(ISASuperIODevice
*sio
, uint8_t index
)
51 static unsigned int get_fdc_irq(ISASuperIODevice
*sio
, uint8_t index
)
56 static unsigned int get_fdc_dma(ISASuperIODevice
*sio
, uint8_t index
)
61 static void smc37c669_class_init(ObjectClass
*klass
, void *data
)
63 ISASuperIOClass
*sc
= ISA_SUPERIO_CLASS(klass
);
65 sc
->parallel
= (ISASuperIOFuncs
){
67 .get_iobase
= get_parallel_iobase
,
68 .get_irq
= get_parallel_irq
,
69 .get_dma
= get_parallel_dma
,
71 sc
->serial
= (ISASuperIOFuncs
){
73 .get_iobase
= get_serial_iobase
,
74 .get_irq
= get_serial_irq
,
76 sc
->floppy
= (ISASuperIOFuncs
){
78 .get_iobase
= get_fdc_iobase
,
79 .get_irq
= get_fdc_irq
,
80 .get_dma
= get_fdc_dma
,
85 static const TypeInfo smc37c669_type_info
= {
86 .name
= TYPE_SMC37C669_SUPERIO
,
87 .parent
= TYPE_ISA_SUPERIO
,
88 .class_size
= sizeof(ISASuperIOClass
),
89 .class_init
= smc37c669_class_init
,
92 static void smc37c669_register_types(void)
94 type_register_static(&smc37c669_type_info
);
97 type_init(smc37c669_register_types
)