Merge tag 'v9.1.0'
[qemu/ar7.git] / hw / isa / smc37c669-superio.c
blobd2e58c9a89590a9b21fe31112d8c3fcd2b5718e7
1 /*
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
9 */
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)
24 return index ? 3 : 4;
27 /* Parallel port */
29 static uint16_t get_parallel_iobase(ISASuperIODevice *sio, uint8_t index)
31 return 0x378;
34 static unsigned int get_parallel_irq(ISASuperIODevice *sio, uint8_t index)
36 return 7;
39 static unsigned int get_parallel_dma(ISASuperIODevice *sio, uint8_t index)
41 return 3;
44 /* Diskette controller (Software compatible with the Intel PC8477) */
46 static uint16_t get_fdc_iobase(ISASuperIODevice *sio, uint8_t index)
48 return 0x3f0;
51 static unsigned int get_fdc_irq(ISASuperIODevice *sio, uint8_t index)
53 return 6;
56 static unsigned int get_fdc_dma(ISASuperIODevice *sio, uint8_t index)
58 return 2;
61 static void smc37c669_class_init(ObjectClass *klass, void *data)
63 ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
65 sc->parallel = (ISASuperIOFuncs){
66 .count = 1,
67 .get_iobase = get_parallel_iobase,
68 .get_irq = get_parallel_irq,
69 .get_dma = get_parallel_dma,
71 sc->serial = (ISASuperIOFuncs){
72 .count = 2,
73 .get_iobase = get_serial_iobase,
74 .get_irq = get_serial_irq,
76 sc->floppy = (ISASuperIOFuncs){
77 .count = 1,
78 .get_iobase = get_fdc_iobase,
79 .get_irq = get_fdc_irq,
80 .get_dma = get_fdc_dma,
82 sc->ide.count = 0;
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)