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:

413fb4c3c5

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.
This commit is contained in:
rin 2023-12-28 04:43:55 +00:00
parent 96f7cfd903
commit 994167df5a
1 changed files with 3 additions and 4 deletions

View File

@ -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_args *pa)
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);
}