[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 48/69] hw/isa/superio: Add the SMC FDC37C669 Super I/
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 48/69] hw/isa/superio: Add the SMC FDC37C669 Super I/O |
Date: |
Tue, 13 Mar 2018 23:46:58 +0100 |
From: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
MAINTAINERS | 1 +
hw/isa/Makefile.objs | 2 +-
hw/isa/smc37c669-superio.c | 115 +++++++++++++++++++++++++++++++++++++++++++++
include/hw/isa/superio.h | 1 +
4 files changed, 118 insertions(+), 1 deletion(-)
create mode 100644 hw/isa/smc37c669-superio.c
diff --git a/MAINTAINERS b/MAINTAINERS
index b17324107f..216d01efd6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -416,6 +416,7 @@ Alpha Machines
M: Richard Henderson <address@hidden>
S: Maintained
F: hw/alpha/
+F: hw/isa/smc37c669-superio.c
ARM Machines
------------
diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs
index cac655ba58..83e06f6c04 100644
--- a/hw/isa/Makefile.objs
+++ b/hw/isa/Makefile.objs
@@ -1,5 +1,5 @@
common-obj-$(CONFIG_ISA_BUS) += isa-bus.o
-common-obj-$(CONFIG_ISA_BUS) += isa-superio.o
+common-obj-$(CONFIG_ISA_BUS) += isa-superio.o smc37c669-superio.o
common-obj-$(CONFIG_APM) += apm.o
common-obj-$(CONFIG_I82378) += i82378.o
common-obj-$(CONFIG_PC87312) += pc87312.o
diff --git a/hw/isa/smc37c669-superio.c b/hw/isa/smc37c669-superio.c
new file mode 100644
index 0000000000..aa233c6967
--- /dev/null
+++ b/hw/isa/smc37c669-superio.c
@@ -0,0 +1,115 @@
+/*
+ * SMC FDC37C669 Super I/O controller
+ *
+ * Copyright (c) 2018 Philippe Mathieu-Daudé
+ *
+ * This code is licensed under the GNU GPLv2 and later.
+ * See the COPYING file in the top-level directory.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/isa/superio.h"
+
+/* UARTs (compatible with NS16450 or PC16550) */
+
+static bool is_serial_enabled(ISASuperIODevice *sio, uint8_t index)
+{
+ return index < 2;
+}
+
+static uint16_t get_serial_iobase(ISASuperIODevice *sio, uint8_t index)
+{
+ return index ? 0x2f8 : 0x3f8;
+}
+
+static unsigned int get_serial_irq(ISASuperIODevice *sio, uint8_t index)
+{
+ return index ? 3 : 4;
+}
+
+/* Parallel port */
+
+static bool is_parallel_enabled(ISASuperIODevice *sio, uint8_t index)
+{
+ return index < 1;
+}
+
+static uint16_t get_parallel_iobase(ISASuperIODevice *sio, uint8_t index)
+{
+ return 0x3bc;
+}
+
+static unsigned int get_parallel_irq(ISASuperIODevice *sio, uint8_t index)
+{
+ return 7;
+}
+
+static unsigned int get_parallel_dma(ISASuperIODevice *sio, uint8_t index)
+{
+ return 3;
+}
+
+/* Diskette controller (Software compatible with the Intel PC8477) */
+
+static bool is_fdc_enabled(ISASuperIODevice *sio, uint8_t index)
+{
+ return index < 1;
+}
+
+static uint16_t get_fdc_iobase(ISASuperIODevice *sio, uint8_t index)
+{
+ return 0x3f0;
+}
+
+static unsigned int get_fdc_irq(ISASuperIODevice *sio, uint8_t index)
+{
+ return 6;
+}
+
+static unsigned int get_fdc_dma(ISASuperIODevice *sio, uint8_t index)
+{
+ return 2;
+}
+
+static void smc37c669_class_init(ObjectClass *klass, void *data)
+{
+ ISASuperIOClass *sc = ISA_SUPERIO_CLASS(klass);
+
+ sc->parallel = (ISASuperIOFuncs){
+ .count = 1,
+ .is_enabled = is_parallel_enabled,
+ .get_iobase = get_parallel_iobase,
+ .get_irq = get_parallel_irq,
+ .get_dma = get_parallel_dma,
+ };
+ sc->serial = (ISASuperIOFuncs){
+ .count = 2,
+ .is_enabled = is_serial_enabled,
+ .get_iobase = get_serial_iobase,
+ .get_irq = get_serial_irq,
+ };
+ sc->floppy = (ISASuperIOFuncs){
+ .count = 1,
+ .is_enabled = is_fdc_enabled,
+ .get_iobase = get_fdc_iobase,
+ .get_irq = get_fdc_irq,
+ .get_dma = get_fdc_dma,
+ };
+ sc->ide.count = 0;
+}
+
+static const TypeInfo smc37c669_type_info = {
+ .name = TYPE_SMC37C669_SUPERIO,
+ .parent = TYPE_ISA_SUPERIO,
+ .instance_size = sizeof(ISASuperIODevice),
+ .class_size = sizeof(ISASuperIOClass),
+ .class_init = smc37c669_class_init,
+};
+
+static void smc37c669_register_types(void)
+{
+ type_register_static(&smc37c669_type_info);
+}
+
+type_init(smc37c669_register_types)
diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h
index b47aac3cf8..f9ba29aa30 100644
--- a/include/hw/isa/superio.h
+++ b/include/hw/isa/superio.h
@@ -55,5 +55,6 @@ typedef struct ISASuperIOClass {
} ISASuperIOClass;
#define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio"
+#define TYPE_SMC37C669_SUPERIO "smc37c669-superio"
#endif /* HW_ISA_SUPERIO_H */
--
2.14.3
- [Qemu-devel] [PULL 37/69] hw/isa/superio: Factor out the serial code from pc87312.c, (continued)
- [Qemu-devel] [PULL 37/69] hw/isa/superio: Factor out the serial code from pc87312.c, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 39/69] hw/isa/superio: Add a keyboard/mouse controller (8042), Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 41/69] hw/mips/malta: Code movement, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 38/69] hw/isa/superio: Factor out the floppy disc controller code from pc87312.c, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 40/69] hw/isa/superio: Factor out the IDE code from pc87312.c, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 35/69] hw/isa/pc87312: Inherit from the abstract TYPE_ISA_SUPERIO, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 42/69] hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 46/69] MAINTAINERS: Add entries for the VT82C686B Super I/O, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 47/69] MAINTAINERS: Split the Alpha TCG/machine section, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 49/69] hw/alpha/dp264: Add the ISA DMA controller, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 48/69] hw/isa/superio: Add the SMC FDC37C669 Super I/O,
Paolo Bonzini <=
- [Qemu-devel] [PULL 45/69] hw/isa/vt82c686: Add the TYPE_VT82C686B_SUPERIO, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 44/69] hw/isa/vt82c686: Rename vt82c686b_init() -> vt82c686b_isa_init(), Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 43/69] hw/mips/mips_fulong2e: Factor out vt82c686b_southbridge_init(), Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 51/69] hw/i386/pc: Factor out the superio code, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 50/69] hw/alpha/dp264: Use the TYPE_SMC37C669_SUPERIO, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 52/69] cpu-exec: fix exception_index handling, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 53/69] replay: fix processing async events, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 54/69] replay: fixed replay_enable_events, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 56/69] replay: added replay log format description, Paolo Bonzini, 2018/03/13
- [Qemu-devel] [PULL 55/69] replay: fix save/load vm for non-empty queue, Paolo Bonzini, 2018/03/13