[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 15/17] PPC: Add timer handler for newworld mac-io
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 15/17] PPC: Add timer handler for newworld mac-io |
Date: |
Mon, 1 Jul 2013 02:13:40 +0200 |
Mac OS X accesses fancy timer registers inside of the mac-io on bootup.
These really should be ticking at the mac-io bus frequency, but I don't
see anyone upset when we just make them as fast as we want to.
With this patch on top of my previous patch queue and latest OpenBIOS
I am able to boot Mac OS X 10.4 with -M mac99.
Signed-off-by: Alexander Graf <address@hidden>
---
hw/misc/macio/macio.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c
index 548fea6..4c872c9 100644
--- a/hw/misc/macio/macio.c
+++ b/hw/misc/macio/macio.c
@@ -234,11 +234,39 @@ static void macio_oldworld_init(Object *obj)
}
}
+static void timer_write(void *opaque, hwaddr addr, uint64_t value,
+ unsigned size)
+{
+}
+
+static uint64_t timer_read(void *opaque, hwaddr addr, unsigned size)
+{
+ uint32_t value = 0;
+
+ switch (addr) {
+ case 0x38:
+ value = qemu_get_clock_ns(vm_clock);
+ break;
+ case 0x3c:
+ value = qemu_get_clock_ns(vm_clock) >> 32;
+ break;
+ }
+
+ return value;
+}
+
+static const MemoryRegionOps timer_ops = {
+ .read = timer_read,
+ .write = timer_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+};
+
static int macio_newworld_initfn(PCIDevice *d)
{
MacIOState *s = MACIO(d);
NewWorldMacIOState *ns = NEWWORLD_MACIO(d);
SysBusDevice *sysbus_dev;
+ MemoryRegion *timer_memory = g_new(MemoryRegion, 1);
int i;
int cur_irq = 0;
int ret = macio_common_initfn(d);
@@ -265,6 +293,10 @@ static int macio_newworld_initfn(PCIDevice *d)
}
}
+ /* Timer */
+ memory_region_init_io(timer_memory, &timer_ops, NULL, "timer", 0x1000);
+ memory_region_add_subregion(&s->bar, 0x15000, timer_memory);
+
return 0;
}
--
1.8.1.4
- [Qemu-ppc] [PATCH 00/17] PPC: Mac OS X guest bringup v2, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 06/17] PPC: dbdma: Fix debug print, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 03/17] PPC: Macio: Replace tabs with spaces, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 01/17] PPC: Mac: Fix guest exported tbfreq values, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 07/17] PPC: dbdma: Allow new commands in RUN state, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 15/17] PPC: Add timer handler for newworld mac-io,
Alexander Graf <=
- [Qemu-ppc] [PATCH 09/17] PPC: dbdma: Introduce kick function, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 12/17] PPC: dbdma: Move processing to io, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 11/17] PPC: dbdma: macio: Add DMA callback, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 10/17] PPC: dbdma: Move static bh variable to device struct, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 04/17] PPC: dbdma: Replace tabs with spaces, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 05/17] PPC: Mac: Add debug prints in macio and dbdma code, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 02/17] PPC: g3beige: Move secondary IDE bus to mac-io, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 13/17] PPC: dbdma: Wait for DMA until we have data, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 17/17] PPC: dbdma: Support more multi-issue DMA requests, Alexander Graf, 2013/06/30
- [Qemu-ppc] [PATCH 08/17] PPC: dbdma: Move defines into header file, Alexander Graf, 2013/06/30