aboutsummaryrefslogtreecommitdiff
path: root/hw/ide
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2012-01-26 11:43:47 +0000
committerPeter Maydell <peter.maydell@linaro.org>2012-01-26 11:43:47 +0000
commitd9fa31a3e20155152ae653cb6b6e6bd7db126e5c (patch)
treeffd626ef517ecdddd3f87722b8944c91d60c75ff /hw/ide
parent4c0e167c9dd354fa161b3e8d315077c34ecaf33a (diff)
ahci: add support for non-PCI based controllers
Add support for ahci on sysbus. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/ide')
-rw-r--r--hw/ide/ahci.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 0af201de2f..0309dd65b0 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -25,6 +25,7 @@
#include <hw/msi.h>
#include <hw/pc.h>
#include <hw/pci.h>
+#include <hw/sysbus.h>
#include "monitor.h"
#include "dma.h"
@@ -1214,3 +1215,46 @@ void ahci_reset(void *opaque)
ahci_reset_port(&d->ahci, i);
}
}
+
+typedef struct SysbusAHCIState {
+ SysBusDevice busdev;
+ AHCIState ahci;
+ uint32_t num_ports;
+} SysbusAHCIState;
+
+static const VMStateDescription vmstate_sysbus_ahci = {
+ .name = "sysbus-ahci",
+ .unmigratable = 1,
+};
+
+static int sysbus_ahci_init(SysBusDevice *dev)
+{
+ SysbusAHCIState *s = FROM_SYSBUS(SysbusAHCIState, dev);
+ ahci_init(&s->ahci, &dev->qdev, s->num_ports);
+
+ sysbus_init_mmio(dev, &s->ahci.mem);
+ sysbus_init_irq(dev, &s->ahci.irq);
+
+ qemu_register_reset(ahci_reset, &s->ahci);
+ return 0;
+}
+
+static SysBusDeviceInfo sysbus_ahci_info = {
+ .qdev.name = "sysbus-ahci",
+ .qdev.size = sizeof(SysbusAHCIState),
+ .qdev.vmsd = &vmstate_sysbus_ahci,
+ .qdev.props = (Property[]) {
+ DEFINE_PROP_UINT32("num-ports", SysbusAHCIState, num_ports, 1),
+ DEFINE_PROP_END_OF_LIST(),
+ },
+ .init = sysbus_ahci_init,
+
+
+};
+
+static void sysbus_ahci_register(void)
+{
+ sysbus_register_withprop(&sysbus_ahci_info);
+}
+
+device_init(sysbus_ahci_register);