From: "Andreas Färber" <andreas.faerber@web.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <andreas.faerber@web.de>,
"Hervé Poussineau" <hpoussin@reactos.org>
Subject: [Qemu-devel] [RFC 05/23] prep: Add i82374 DMA emulation
Date: Tue, 14 Jun 2011 04:37:39 +0200 [thread overview]
Message-ID: <1308019077-61957-6-git-send-email-andreas.faerber@web.de> (raw)
In-Reply-To: <1308019077-61957-5-git-send-email-andreas.faerber@web.de>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Confine to CONFIG_I82374.
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
Makefile.objs | 1 +
default-configs/ppc-softmmu.mak | 1 +
hw/i82374.c | 133 +++++++++++++++++++++++++++++++++++++++
3 files changed, 135 insertions(+), 0 deletions(-)
create mode 100644 hw/i82374.c
diff --git a/Makefile.objs b/Makefile.objs
index 509ab39..b0e4c09 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -201,6 +201,7 @@ hw-obj-$(CONFIG_FDC) += fdc.o
hw-obj-$(CONFIG_ACPI) += acpi.o acpi_piix4.o
hw-obj-$(CONFIG_APM) += pm_smbus.o apm.o
hw-obj-$(CONFIG_DMA) += dma.o
+hw-obj-$(CONFIG_I82374) += i82374.o
hw-obj-$(CONFIG_HPET) += hpet.o
hw-obj-$(CONFIG_APPLESMC) += applesmc.o
hw-obj-$(CONFIG_SMARTCARD) += usb-ccid.o ccid-card-passthru.o
diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
index 4563742..1d1a7c2 100644
--- a/default-configs/ppc-softmmu.mak
+++ b/default-configs/ppc-softmmu.mak
@@ -11,6 +11,7 @@ CONFIG_I8254=y
CONFIG_PCKBD=y
CONFIG_FDC=y
CONFIG_DMA=y
+CONFIG_I82374=y
CONFIG_OPENPIC=y
CONFIG_PREP_PCI=y
CONFIG_MACIO=y
diff --git a/hw/i82374.c b/hw/i82374.c
new file mode 100644
index 0000000..383cf1b
--- /dev/null
+++ b/hw/i82374.c
@@ -0,0 +1,133 @@
+/*
+ * QEMU Intel 82374 emulation (Enhanced DMA controller)
+ *
+ * Copyright (c) 2010 Herve Poussineau
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "isa.h"
+
+//#define DEBUG_I82374
+
+#ifdef DEBUG_I82374
+#define DPRINTF(fmt, ...) \
+do { fprintf(stderr, "i82374: " fmt , ## __VA_ARGS__); } while (0)
+#else
+#define DPRINTF(fmt, ...) \
+do {} while (0)
+#endif
+#define BADF(fmt, ...) \
+do { fprintf(stderr, "i82374 ERROR: " fmt , ## __VA_ARGS__); } while (0)
+
+typedef struct I82374State {
+ uint8_t commands[8];
+} I82374State;
+
+static uint32_t i82374_read_isr(void *opaque, uint32_t nport)
+{
+ uint32_t val = 0;
+
+ BADF("%s: %08x\n", __func__, nport);
+
+ DPRINTF("%s: %08x=%08x\n", __func__, nport, val);
+ return val;
+}
+
+static void i82374_write_command(void *opaque, uint32_t nport, uint32_t data)
+{
+ DPRINTF("%s: %08x=%08x\n", __func__, nport, data);
+
+ if (data != 0x42) {
+ /* Not Stop S/G command */
+ BADF("%s: %08x=%08x\n", __func__, nport, data);
+ }
+}
+
+static uint32_t i82374_read_status(void *opaque, uint32_t nport)
+{
+ uint32_t val = 0;
+
+ BADF("%s: %08x\n", __func__, nport);
+
+ DPRINTF("%s: %08x=%08x\n", __func__, nport, val);
+ return val;
+}
+
+static void i82374_write_descriptor(void *opaque, uint32_t nport, uint32_t data)
+{
+ DPRINTF("%s: %08x=%08x\n", __func__, nport, data);
+
+ BADF("%s: %08x=%08x\n", __func__, nport, data);
+}
+
+static uint32_t i82374_read_descriptor(void *opaque, uint32_t nport)
+{
+ uint32_t val = 0;
+
+ BADF("%s: %08x\n", __func__, nport);
+
+ DPRINTF("%s: %08x=%08x\n", __func__, nport, val);
+ return val;
+}
+
+static void i82374_init(I82374State *s)
+{
+ DMA_init(1, NULL);
+ memset(s->commands, 0, sizeof(s->commands));
+}
+
+typedef struct ISAi82374State {
+ ISADevice dev;
+ uint32_t iobase;
+ I82374State state;
+} ISAi82374State;
+
+static int i82374_isa_init(ISADevice *dev)
+{
+ ISAi82374State *isa = DO_UPCAST(ISAi82374State, dev, dev);
+ I82374State *s = &isa->state;
+
+ register_ioport_read(isa->iobase + 0x0A, 1, 1, i82374_read_isr, s);
+ register_ioport_write(isa->iobase + 0x10, 8, 1, i82374_write_command, s);
+ register_ioport_read(isa->iobase + 0x18, 8, 1, i82374_read_status, s);
+ register_ioport_write(isa->iobase + 0x20, 0x20, 1, i82374_write_descriptor, s);
+ register_ioport_read(isa->iobase + 0x20, 0x20, 1, i82374_read_descriptor, s);
+
+ i82374_init(s);
+
+ return 0;
+}
+
+static ISADeviceInfo i82374_isa_info = {
+ .qdev.name = "i82374",
+ .qdev.size = sizeof(ISAi82374State),
+ .init = i82374_isa_init,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_HEX32("iobase", ISAi82374State, iobase, 0x400),
+ DEFINE_PROP_END_OF_LIST()
+ },
+};
+
+static void i82374_register_devices(void)
+{
+ isa_qdev_register(&i82374_isa_info);
+}
+
+device_init(i82374_register_devices)
--
1.7.5.3
next prev parent reply other threads:[~2011-06-14 2:38 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 2:37 [Qemu-devel] [RFC 00/23] PReP 40P emulation Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [PATCH RFC 01/23] prep: Refactor CPU initialization Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC 02/23] prep: qdev'ify PCI Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC 03/23] prep: Prepare emulation of an IBM RS/6000 6015 / 7020 (40p) Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC 04/23] 40p: Add PCI host Andreas Färber
2011-06-14 2:37 ` Andreas Färber [this message]
2011-06-14 2:37 ` [Qemu-devel] [RFC 06/23] prep: Add i82378 PCI-to-ISA bridge emulation Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC 07/23] 40p: Add a PCI to ISA bridge (i82378) Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [PATCH v5 08/23] qdev: Add support for property type bool Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [PATCH v5 09/23] qdev: Add helpers for reading properties Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC v5 10/23] isa: Provide enable and disable callbacks Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC v5 11/23] isa: Allow to un-assign I/O ports Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC v5 12/23] isa: Allow to un-associate an IRQ Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC v5 13/23] parallel: Implement ISA state callbacks Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC v5 14/23] serial: " Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [PATCH v5 15/23] fdc: Parametrize ISA base, IRQ and DMA Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC v5 16/23] fdc: Implement ISA state callbacks Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC v5 17/23] ide: Allow to discard I/O ports Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC v5 18/23] ide: Implement ISA state callbacks Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC v5 19/23] prep: Add pc87312 Super I/O emulation Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC 20/23] 40p: Add the Super I/O chip (pc87312) Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC 21/23] 40p: Add an audio card and a keyboard Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC 22/23] prep: qdev'ify System I/O (WIP) Andreas Färber
2011-06-14 2:37 ` [Qemu-devel] [RFC 23/23] 40p: Add an 8514/A graphics card Andreas Färber
2011-06-15 4:33 ` Roy Tam
2011-06-15 18:11 ` Andreas Färber
2011-06-16 0:02 ` [Qemu-devel] [RFC v2 23/23] 40p: Add an IBM " Andreas Färber
2011-06-18 20:42 ` Blue Swirl
2011-06-19 10:04 ` Andreas Färber
2011-06-19 12:10 ` Hervé Poussineau
2011-06-19 13:27 ` Blue Swirl
2011-06-19 18:40 ` Andreas Färber
2011-06-19 19:03 ` Blue Swirl
2011-06-19 21:38 ` Andreas Färber
2011-06-19 21:43 ` [Qemu-devel] [RFC v3 " Andreas Färber
2011-06-16 0:05 ` [Qemu-devel] [RFC 23/23] 40p: Add an " Andreas Färber
2011-06-16 1:22 ` Roy Tam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1308019077-61957-6-git-send-email-andreas.faerber@web.de \
--to=andreas.faerber@web.de \
--cc=hpoussin@reactos.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).