[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/25] hw/isa/superio: Add a Super I/O template base
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH 08/25] hw/isa/superio: Add a Super I/O template based on the PC87312 device |
Date: |
Thu, 8 Mar 2018 23:39:29 +0100 |
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
include/hw/isa/superio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
hw/isa/isa-superio.c | 28 ++++++++++++++++++++++++++++
MAINTAINERS | 2 ++
hw/isa/Makefile.objs | 1 +
4 files changed, 75 insertions(+)
create mode 100644 include/hw/isa/superio.h
create mode 100644 hw/isa/isa-superio.c
diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h
new file mode 100644
index 0000000000..cff6ad6c08
--- /dev/null
+++ b/include/hw/isa/superio.h
@@ -0,0 +1,44 @@
+/*
+ * Generic ISA Super I/O
+ *
+ * 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
+ */
+#ifndef HW_ISA_SUPERIO_H
+#define HW_ISA_SUPERIO_H
+
+#include "qemu-common.h"
+#include "sysemu/sysemu.h"
+#include "hw/isa/isa.h"
+
+#define TYPE_ISA_SUPERIO "isa-superio"
+#define ISA_SUPERIO(obj) \
+ OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO)
+#define ISA_SUPERIO_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO)
+#define ISA_SUPERIO_CLASS(klass) \
+ OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO)
+
+typedef struct ISASuperIODevice {
+ ISADevice parent_obj;
+} ISASuperIODevice;
+
+typedef struct ISASuperIOFuncs {
+ size_t count;
+ bool (*is_enabled)(ISASuperIODevice *sio, uint8_t index);
+ uint16_t (*get_iobase)(ISASuperIODevice *sio, uint8_t index);
+ unsigned int (*get_irq)(ISASuperIODevice *sio, uint8_t index);
+ unsigned int (*get_dma)(ISASuperIODevice *sio, uint8_t index);
+} ISASuperIOFuncs;
+
+typedef struct ISASuperIOClass {
+ /*< private >*/
+ ISADeviceClass parent_class;
+ /*< public >*/
+ DeviceRealize parent_realize;
+} ISASuperIOClass;
+
+#endif /* HW_ISA_SUPERIO_H */
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
new file mode 100644
index 0000000000..14ec16f831
--- /dev/null
+++ b/hw/isa/isa-superio.c
@@ -0,0 +1,28 @@
+/*
+ * Generic ISA Super I/O
+ *
+ * Copyright (c) 2010-2012 Herve Poussineau
+ * Copyright (c) 2011-2012 Andreas Färber
+ * 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"
+#include "trace.h"
+
+static const TypeInfo isa_superio_type_info = {
+ .name = TYPE_ISA_SUPERIO,
+ .parent = TYPE_ISA_DEVICE,
+ .abstract = true,
+ .class_size = sizeof(ISASuperIOClass),
+};
+
+static void isa_superio_register_types(void)
+{
+ type_register_static(&isa_superio_type_info);
+}
+
+type_init(isa_superio_register_types)
diff --git a/MAINTAINERS b/MAINTAINERS
index 212eaa836a..98a8918c20 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -922,6 +922,7 @@ F: hw/input/pckbd.c
F: hw/intc/apic*
F: hw/intc/ioapic*
F: hw/intc/i8259*
+F: hw/isa/isa-superio.c
F: hw/misc/debugexit.c
F: hw/misc/pc-testdev.c
F: hw/timer/hpet*
@@ -933,6 +934,7 @@ F: include/hw/char/parallel.h
F: include/hw/dma/i8257.h
F: include/hw/i2c/pm_smbus.h
F: include/hw/input/i8042.h
+F: include/hw/isa/superio.h
F: include/hw/timer/hpet.h
F: include/hw/timer/i8254*
F: include/hw/timer/mc146818rtc*
diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs
index fb37c55cf2..cac655ba58 100644
--- a/hw/isa/Makefile.objs
+++ b/hw/isa/Makefile.objs
@@ -1,4 +1,5 @@
common-obj-$(CONFIG_ISA_BUS) += isa-bus.o
+common-obj-$(CONFIG_ISA_BUS) += isa-superio.o
common-obj-$(CONFIG_APM) += apm.o
common-obj-$(CONFIG_I82378) += i82378.o
common-obj-$(CONFIG_PC87312) += pc87312.o
--
2.16.2
- Re: [Qemu-devel] [PATCH 02/25] hw/dma/i8257: Rename DMA_init() to i8257_dma_init(), (continued)
- [Qemu-devel] [PATCH 03/25] hw/input/i8042: Extract declarations from i386/pc.h into input/i8042.h, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 04/25] MAINTAINERS: Fix the PC87312 include path, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 05/25] hw/isa/pc87312: Rename the device type as TYPE_PC87312_SUPERIO, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 06/25] hw/isa/pc87312: Use uint16_t for the ISA I/O base address, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 07/25] hw/isa/pc87312: Use 'unsigned int' for the irq value, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 08/25] hw/isa/superio: Add a Super I/O template based on the PC87312 device,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 09/25] hw/isa/pc87312: Inherit from the abstract TYPE_ISA_SUPERIO, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 11/25] hw/isa/superio: Factor out the serial code from pc87312.c, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 13/25] hw/isa/superio: Add a keyboard/mouse controller (8042), Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 10/25] hw/isa/superio: Factor out the parallel code from pc87312.c, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 12/25] hw/isa/superio: Factor out the floppy disc controller code from pc87312.c, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 14/25] hw/isa/superio: Factor out the IDE code from pc87312.c, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 16/25] hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 18/25] hw/isa/vt82c686: Rename vt82c686b_init() -> vt82c686b_isa_init(), Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 15/25] hw/mips/malta: Code movement, Philippe Mathieu-Daudé, 2018/03/08
- [Qemu-devel] [PATCH 19/25] hw/isa/vt82c686: Add the TYPE_VT82C686B_SUPERIO, Philippe Mathieu-Daudé, 2018/03/08