[OpenBIOS] [PATCH v2] macio ide: Fix dev tree entries for macio ide ports
BALATON Zoltan
balaton at eik.bme.hu
Sun Jun 22 11:50:19 CEST 2014
Only add the two ide ports that are emulated by QEMU to the device
tree to avoid clients trying to access the non-existent third one and
fix their names and properties for mac99 to match those used by Apple.
This makes MorphOS able to find and use these.
Signed-off-by: BALATON Zoltan <balaton at eik.bme.hu>
---
v2: improved comment about the naming of device tree nodes
References:
http://web.archive.org/web/20081120133742/http://penguinppc.org/historical/dev-trees-html/
---
openbios-devel/drivers/ide.c | 7 ++++++-
openbios-devel/drivers/macio.c | 17 ++++++++++-------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/openbios-devel/drivers/ide.c b/openbios-devel/drivers/ide.c
index 0e0f0cf..327c64a 100644
--- a/openbios-devel/drivers/ide.c
+++ b/openbios-devel/drivers/ide.c
@@ -1526,6 +1526,10 @@ int macio_ide_init(const char *path, uint32_t addr, int nb_channels)
u32 props[8];
struct ide_channel *chan;
+ /* IDE ports on Macs are numbered from 3.
+ * Also see comments in macio.c:openpic_init() */
+ current_channel = 3;
+
for (i = 0; i < nb_channels; i++, current_channel++) {
chan = malloc(sizeof(struct ide_channel));
@@ -1574,7 +1578,8 @@ int macio_ide_init(const char *path, uint32_t addr, int nb_channels)
dnode = find_dev(nodebuff);
- set_property(dnode, "compatible", "heathrow-ata", 13);
+ set_property(dnode, "compatible", (is_oldworld() ?
+ "heathrow-ata" : "keylargo-ata"), 13);
props[0] = 0x00000526;
props[1] = 0x00000085;
diff --git a/openbios-devel/drivers/macio.c b/openbios-devel/drivers/macio.c
index 00d7149..b689f04 100644
--- a/openbios-devel/drivers/macio.c
+++ b/openbios-devel/drivers/macio.c
@@ -130,7 +130,7 @@ macio_nvram_put(char *buf)
else
it_shift = NW_IO_NVRAM_SHIFT;
- for (i=0; i< arch_nvram_size() ; i++)
+ for (i=0; i < arch_nvram_size(); i++)
nvram[i << it_shift] = buf[i];
#ifdef DUMP_NVRAM
printk("new nvram:\n");
@@ -202,13 +202,16 @@ openpic_init(const char *path, phys_addr_t addr)
target_node = find_dev("/pci/mac-io/escc/ch-b");
set_int_property(target_node, "interrupt-parent", dnode);
- target_node = find_dev("/pci/mac-io/ata-1");
- set_int_property(target_node, "interrupt-parent", dnode);
-
- target_node = find_dev("/pci/mac-io/ata-2");
+ /* QEMU only emulates 2 of the 3 ata buses currently */
+ /* On a new world Mac these are not numbered but named by the
+ * ATA version they support. Thus we have: ata-3, ata-3, ata-4
+ * On g3beige they all called just ide.
+ * We take ata-3 and ata-4 which seems to work for both
+ * at least for clients we care about */
+ target_node = find_dev("/pci/mac-io/ata-3");
set_int_property(target_node, "interrupt-parent", dnode);
- target_node = find_dev("/pci/mac-io/ata-3");
+ target_node = find_dev("/pci/mac-io/ata-4");
set_int_property(target_node, "interrupt-parent", dnode);
target_node = find_dev("/pci/mac-io/via-cuda");
@@ -311,7 +314,7 @@ ob_macio_keylargo_init(const char *path, phys_addr_t addr)
/* The NewWorld NVRAM is not located in the MacIO device */
macio_nvram_init("", 0);
escc_init(path, addr);
- macio_ide_init(path, addr, 3);
+ macio_ide_init(path, addr, 2);
openpic_init(path, addr);
ob_unin_init();
}
--
1.8.1.5
More information about the OpenBIOS
mailing list