On Sun, 4 May 2014, Mark Cave-Ayland wrote:
On 21/04/14 21:58, BALATON Zoltan wrote:
The names of some device tree properties are different on old world and new world Mac hardware and the name of the root node is always "device-tree" on Apple's OpenFirmware implementation. MorphOS on Apple hardware expects these names to find these devices.
Signed-off-by: BALATON Zoltan balaton@eik.bme.hu
v2: improved commit log v3: fixed a typo in the device type of the pmu node (via-pmu instead of via_pmu)
Index: openbios-devel/arch/ppc/qemu/init.c
--- openbios-devel/arch/ppc/qemu/init.c (revision 1286) +++ openbios-devel/arch/ppc/qemu/init.c (working copy) @@ -702,6 +732,12 @@ push_str("/"); fword("find-device");
- /* Apple calls the root node device-tree */
- if (is_apple()) {
push_str("device-tree");
fword("device-name");
- }
switch(machine_id) { case ARCH_HEATHROW: /* OldWorld */
Index: openbios-devel/drivers/cuda.c
--- openbios-devel/drivers/cuda.c (revision 1286) +++ openbios-devel/drivers/cuda.c (working copy) @@ -184,32 +184,33 @@ phandle_t ph=get_cur_dev(); int props[2];
- push_str("via-cuda");
push_str((is_oldworld() ? "via-cuda" : "via-pmu")); fword("device-type");
set_int_property(ph, "#address-cells", 1); set_int_property(ph, "#size-cells", 0);
set_property(ph, "compatible", "cuda", 5);
props[0] = __cpu_to_be32(IO_CUDA_OFFSET); props[1] = __cpu_to_be32(IO_CUDA_SIZE);
set_property(ph, "reg", (char *)&props, sizeof(props));
/* on newworld machines the cuda is on interrupt 0x19 */
- if (is_oldworld()) {
set_property(ph, "compatible", "cuda", 5);
/* we emulate an oldworld hardware, so we must use
* non-standard oldworld property (needed by linux 2.6.18)
*/
set_int_property(ph, "AAPL,interrupts", 0x12);
- } else {
set_property(ph, "compatible", "pmu", 4);
/* on newworld machines the cuda is on interrupt 0x19 */
- props[0] = 0x19;
- props[1] = 0;
- NEWWORLD(set_property(ph, "interrupts", (char *)props,
sizeof(props)));
- NEWWORLD(set_int_property(ph, "#interrupt-cells", 2));
props[0] = 0x19;
props[1] = 0;
set_property(ph, "interrupts", (char *)&props,
sizeof(props));
set_int_property(ph, "#interrupt-cells", 2);
- }
- /* we emulate an oldworld hardware, so we must use
* non-standard oldworld property (needed by linux 2.6.18)
*/
- OLDWORLD(set_int_property(ph, "AAPL,interrupts", 0x12));
bind_func("ppc32-reset-all", ppc32_reset_all); push_str("' ppc32-reset-all to reset-all"); fword("eval");
@@ -380,7 +381,8 @@
ph = find_dev(buf); set_property(ph, "device_type", "power-mgt", 10);
- set_property(ph, "compatible", "power-mgt", 10);
OLDWORLD(set_property(ph, "compatible", "power-mgt", 10));
NEWWORLD(set_property(ph, "compatible", "via-pmu-99", 11)); }
cuda_t *cuda_init (const char *path, phys_addr_t base)
@@ -395,11 +397,13 @@ if (cuda == NULL) return NULL;
- snprintf(buf, sizeof(buf), "%s/via-cuda", path);
OLDWORLD(snprintf(buf, sizeof(buf), "%s/via-cuda", path));
NEWWORLD(snprintf(buf, sizeof(buf), "%s/via-pmu", path)); REGISTER_NAMED_NODE(ob_cuda, buf);
aliases = find_dev("/aliases");
- set_property(aliases, "via-cuda", buf, strlen(buf) + 1);
OLDWORLD(set_property(aliases, "via-cuda", buf, strlen(buf) + 1));
NEWWORLD(set_property(aliases, "via-pmu", buf, strlen(buf) + 1));
cuda->base = base; cuda_writeb(cuda, B, cuda_readb(cuda, B) | TREQ | TIP);
This looks reasonable to me. Alex, are you able to apply or Ack as appropriate?
One thing I know about that changing via-cuda to via-pmu breaks the ADB keyboard for the Finnix Linux image I've tried although it still works in OpenBIOS. (This might be a bug in the Linux driver, I did not investigate further.) The proper fix to use a usb keyboard to match real hardware breaks OpenBIOS though.
Regards, BALATON Zoltan