Module Name:    src
Committed By:   rin
Date:           Thu Dec 28 04:43:55 UTC 2023

Modified Files:
        src/sys/arch/macppc/macppc: rbus_machdep.c

Log Message:
macppc/cardbus: Belatedly catch up with battable resolution change

Fix pmap_extract() failures on models with cardslot, for direct-mapped
buffers allocated by PMAP_ALLOC_POOLPAGE().

This driver had corrupted battable[] over 11 years, since resolution of
battable was changed from 256MB to 8MB:

https://github.com/NetBSD/src/commit/413fb4c3c505a13900a9dff86f563fc58ff04005

Now, indexes for battable[] should be calculated by (va >> 23), but
rather, use oea_iobat_add() instead of directly modifying battable[].

TODO:
- Add some consistency checks to oea_iobat_add().
- Map reasonable VA space for cardbus(4), if OFW does not. Note that
  hardcoded value of 0x90000000-0x9fffffff should be safe for now, not
  that elegant although. For macppc models, IIUC, RAM is *not* mapped to
  0x80000000-0xffffffff, and VA reserved for kernel and copy{in,out} is
  0xc0000000-0xefffffff.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 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.18 src/sys/arch/macppc/macppc/rbus_machdep.c:1.19
--- src/sys/arch/macppc/macppc/rbus_machdep.c:1.18	Fri Jul  1 18:43:05 2011
+++ src/sys/arch/macppc/macppc/rbus_machdep.c	Thu Dec 28 04:43:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rbus_machdep.c,v 1.18 2011/07/01 18:43:05 dyoung Exp $	*/
+/*	$NetBSD: rbus_machdep.c,v 1.19 2023/12/28 04:43:55 rin Exp $	*/
 
 /*
  * Copyright (c) 1999
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.18 2011/07/01 18:43:05 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rbus_machdep.c,v 1.19 2023/12/28 04:43:55 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -92,8 +92,7 @@ rbus_pccbb_parent_mem(struct pci_attach_
 		size  = 0x10000000;
 	}
 
-	battable[start >> 28].batl = BATL(start, BAT_I, BAT_PP_RW);
-	battable[start >> 28].batu = BATU(start, BAT_BL_256M, BAT_Vs);
+	oea_iobat_add(start, size);
 
 	return rbus_new_root_delegate(pa->pa_memt, start, size, 0);
 }

Reply via email to