From: Valentin Manea <valentin.manea@gmail.com>
To: qemu-devel@nongnu.org
Cc: Jia Liu <proljc@gmail.com>
Subject: [Qemu-devel] [PATCH 1/4] target-openrisc: Add IDE support to default machine
Date: Fri, 22 Aug 2014 16:09:11 +0300 [thread overview]
Message-ID: <53F740F7.2010706@gmail.com> (raw)
Add MMIO ide device support to the default openrisc machine.
Base address and IRQ line are the same as the or1ksim.
Signed-off-by: Valentin Manea <valentin.manea@gmail.com>
---
default-configs/or32-softmmu.mak | 3 +++
hw/openrisc/openrisc_sim.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/default-configs/or32-softmmu.mak
b/default-configs/or32-softmmu.mak
index cce4746..c3ff078 100644
--- a/default-configs/or32-softmmu.mak
+++ b/default-configs/or32-softmmu.mak
@@ -2,3 +2,6 @@
CONFIG_SERIAL=y
CONFIG_OPENCORES_ETH=y
+CONFIG_IDE_CORE=y
+CONFIG_IDE_QDEV=y
+CONFIG_IDE_MMIO=y
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index b2b4f9b..da8647f 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -24,9 +24,11 @@
#include "hw/char/serial.h"
#include "net/net.h"
#include "hw/loader.h"
+#include "hw/ide.h"
#include "exec/address-spaces.h"
#include "sysemu/sysemu.h"
#include "hw/sysbus.h"
+#include "sysemu/blockdev.h"
#include "sysemu/qtest.h"
#define KERNEL_LOAD_ADDR 0x100
@@ -38,6 +40,32 @@ static void main_cpu_reset(void *opaque)
cpu_reset(CPU(cpu));
}
+static void openrisc_sim_ide_init(MemoryRegion *address_space,
+ hwaddr base,
+ hwaddr descriptors,
+ qemu_irq irq)
+{
+ DeviceState *dev;
+ SysBusDevice *busdev;
+ DriveInfo *dinfo;
+
+
+ dinfo = drive_get(IF_IDE, 0, 0);
+ if (!dinfo) {
+ return;
+ }
+ dev = qdev_create(NULL, "mmio-ide");
+ busdev = SYS_BUS_DEVICE(dev);
+ sysbus_connect_irq(busdev, 0, irq);
+ qdev_prop_set_uint32(dev, "shift", 2);
+ qdev_init_nofail(dev);
+ memory_region_add_subregion(address_space, base,
+ sysbus_mmio_get_region(busdev, 0));
+ memory_region_add_subregion(address_space, descriptors,
+ sysbus_mmio_get_region(busdev, 1));
+ mmio_ide_init_drives(dev, dinfo, NULL);
+}
+
static void openrisc_sim_net_init(MemoryRegion *address_space,
hwaddr base,
hwaddr descriptors,
@@ -129,6 +157,10 @@ static void openrisc_sim_init(MachineState *machine)
0x92000400, cpu->env.irq[4], nd_table);
}
+ /* Platform ATA device */
+ openrisc_sim_ide_init(get_system_memory(), 0x9e000000,
+ 0x9e000100, cpu->env.irq[15]);
+
cpu_openrisc_load_kernel(ram_size, kernel_filename, cpu);
}
--
1.9.1
next reply other threads:[~2014-08-22 13:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-22 13:09 Valentin Manea [this message]
2014-08-22 13:10 ` [Qemu-devel] [PATCH 2/4] target-openrisc: Add OpenCores FB device support Valentin Manea
2014-08-22 13:11 ` [Qemu-devel] [PATCH 3/4] target-openrisc: Add OpenCores keyboard " Valentin Manea
2014-08-22 13:12 ` [Qemu-devel] [PATCH 4/4] target-openrisc: Add LPC32XX touchscreen device Valentin Manea
2014-08-22 16:06 ` Jia Liu
2014-08-22 16:02 ` [Qemu-devel] [PATCH 3/4] target-openrisc: Add OpenCores keyboard device support Jia Liu
2014-08-22 16:00 ` [Qemu-devel] [PATCH 2/4] target-openrisc: Add OpenCores FB " Jia Liu
2014-08-22 16:06 ` Valentin Manea
2014-08-22 14:01 ` [Qemu-devel] [PATCH 0/4] target-openrisc: Some openrisc improvements Valentin Manea
2014-08-22 16:11 ` Jia Liu
2014-08-22 17:09 ` Valentin Manea
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=53F740F7.2010706@gmail.com \
--to=valentin.manea@gmail.com \
--cc=proljc@gmail.com \
--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).