[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v2 07/22] hw/isa/superio: Add a Super I/O templa
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [RFC PATCH v2 07/22] hw/isa/superio: Add a Super I/O template based on the PC87312 device |
Date: |
Mon, 5 Mar 2018 18:19:13 -0300 |
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
include/hw/isa/superio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
hw/isa/isa-superio.c | 27 +++++++++++++++++++++++++++
hw/isa/Makefile.objs | 1 +
3 files changed, 72 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..7777f8b9f0
--- /dev/null
+++ b/hw/isa/isa-superio.c
@@ -0,0 +1,27 @@
+/*
+ * 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,
+};
+
+static void isa_superio_register_types(void)
+{
+ type_register_static(&isa_superio_type_info);
+}
+
+type_init(isa_superio_register_types)
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
- [Qemu-devel] [RFC PATCH v2 00/22] remove i386/pc dependency: generic SuperIO, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 01/22] hw/isa: Move parallel_hds_isa_init() to hw/char/parallel-isa.c, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 02/22] hw/dma/i8257: Rename DMA_init() to i8257_dma_init(), Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 03/22] hw/input/i8042: Extract declarations from i386/pc.h into input/i8042.h, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 06/22] hw/isa/pc87312: Use 'unsigned int' for the irq value, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 05/22] hw/isa/pc87312: Use uint16_t for the ISA I/O base address, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 04/22] hw/isa/pc87312: Rename the device type as TYPE_PC87312_SUPERIO, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 07/22] hw/isa/superio: Add a Super I/O template based on the PC87312 device,
Philippe Mathieu-Daudé <=
- [Qemu-devel] [RFC PATCH v2 08/22] hw/isa/pc87312: Inherit from the abstract TYPE_ISA_SUPERIO, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 09/22] hw/isa/superio: Factor out the parallel code from pc87312.c, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 12/22] hw/isa/superio: Add a keyboard/mouse controller (8042), Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 10/22] hw/isa/superio: Factor out the serial code from pc87312.c, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 11/22] hw/isa/superio: Factor out the floppy disc controller code from pc87312.c, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 13/22] hw/isa/superio: Factor out the IDE code from pc87312.c, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 14/22] hw/mips/malta: Code movement, Philippe Mathieu-Daudé, 2018/03/05
- [Qemu-devel] [RFC PATCH v2 15/22] hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c, Philippe Mathieu-Daudé, 2018/03/05