Module Name: src
Committed By: macallan
Date: Mon Mar 17 08:23:13 UTC 2025
Modified Files:
src/sys/arch/macppc/macppc: rbus_machdep.c
Log Message:
when looking for the cardbus bridge's memory range:
- check 'reserved-segment' first, all core99 machines should have it
- if that fails, look at 'assigned-addresses' which has the range on older OF,
notably the 3400c
- if that doesn't return anything useful, fall back to the default
should fix PR59176
To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/macppc/macppc/rbus_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/macppc/macppc/rbus_machdep.c
diff -u src/sys/arch/macppc/macppc/rbus_machdep.c:1.20 src/sys/arch/macppc/macppc/rbus_machdep.c:1.21
--- src/sys/arch/macppc/macppc/rbus_machdep.c:1.20 Mon Mar 17 07:39:55 2025
+++ src/sys/arch/macppc/macppc/rbus_machdep.c Mon Mar 17 08:23:13 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: rbus_machdep.c,v 1.20 2025/03/17 07:39:55 macallan Exp $ */
+/* $NetBSD: rbus_machdep.c,v 1.21 2025/03/17 08:23:13 macallan Exp $ */
/*
* Copyright (c) 1999
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.20 2025/03/17 07:39:55 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.21 2025/03/17 08:23:13 macallan Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -74,22 +74,40 @@ md_space_unmap(bus_space_tag_t t, bus_sp
rbus_tag_t
rbus_pccbb_parent_mem(struct pci_attach_args *pa)
{
- bus_addr_t start;
- bus_size_t size;
+ bus_addr_t start = 0;
+ bus_size_t size = 0;
int node, reg[5];
macppc_cardbus_init(pa->pa_pc, pa->pa_tag);
node = pcidev_to_ofdev(pa->pa_pc, pa->pa_tag);
- OF_getprop(node, "assigned-addresses", reg, sizeof(reg));
- start = reg[2];
- size = reg[4];
-
- /* XXX PowerBook G3 */
- if (size < 0x10000) {
- start = 0x90000000;
- size = 0x10000000;
+ /*
+ * the Powerbook 3400c has the cardbus controller's memory space in
+ * 'assigned-addresses', at 0xa0000000. Core99 machines do not, they
+ * have 'reserved-segment' instead, which points at 0x90000000 on
+ * my Pismo, TiBook and AluBook.
+ * This leaves the older G3 Powerbooks with pre-3.0 OF, I suspect they
+ * behave like the 3400c.
+ */
+
+ /* first we look for 'reserved-segment' */
+ if (OF_getprop(node, "reserved-segment", &start, 4) == 4) {
+ size = 0x10000000;
+ printf("found reserved-segment %08x\n", start);
+ } else {
+ /* if that fails look at assigned-addresses */
+ OF_getprop(node, "assigned-addresses", reg, sizeof(reg));
+ /* see if the range is big enough */
+ if (reg[4] < 0x10000) {
+ /* nope, use the default */
+ start = 0x90000000;
+ size = 0x10000000;
+ } else {
+ start = reg[2];
+ size = reg[4];
+ printf("found assigned-addresses %08x\n", start);
+ }
}
return rbus_new_root_delegate(pa->pa_memt, start, size, 0);