diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2022-10-17 18:55:21 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2022-10-17 18:55:21 +0000 |
commit | ebc6cb9ac1606ea1e3a9381acb2e7cfe0c892988 (patch) | |
tree | 83a307a6dfcd1b47926b83a893e143269fccfcc8 /sys | |
parent | cbbd1c7a3ffc3c1975b4a8a369b588a71db16f7c (diff) |
Fix "map" OpenFirmware call. It does not return a value according to the
IEEE 1275 specification. This should fix booting on machines that would
fail with something like:
OF_map_phys(3fe44000,8192,fed58000,-1) failed
no space for symbol table
Program terminated
Based on a diff provided by Harald Gutch (hgutch@netbsd). Also see
NetBSD PR#56829.
There were (and still are) some questions about whether this diff breaks
the blade1.5k. However the failure in question might have been hardware
related and subsequent testing of the equivalent kernel diff (which
was just committed) was successful. So committing this in the hope it
sticks to ease testing.
ok miod@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/Locore.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/sys/arch/sparc64/stand/ofwboot/Locore.c b/sys/arch/sparc64/stand/ofwboot/Locore.c index d43e29623c4..f8fcf5e0d94 100644 --- a/sys/arch/sparc64/stand/ofwboot/Locore.c +++ b/sys/arch/sparc64/stand/ofwboot/Locore.c @@ -1,4 +1,4 @@ -/* $OpenBSD: Locore.c,v 1.16 2018/12/31 11:44:57 claudio Exp $ */ +/* $OpenBSD: Locore.c,v 1.17 2022/10/17 18:55:20 kettenis Exp $ */ /* $NetBSD: Locore.c,v 1.1 2000/08/20 14:58:36 mrg Exp $ */ /* @@ -46,7 +46,7 @@ static vaddr_t OF_claim_virt(vaddr_t vaddr, int len); static vaddr_t OF_alloc_virt(int len, int align); static int OF_free_virt(vaddr_t vaddr, int len); -static vaddr_t OF_map_phys(paddr_t paddr, off_t size, vaddr_t vaddr, int mode); +static int OF_map_phys(paddr_t paddr, off_t size, vaddr_t vaddr, int mode); static paddr_t OF_alloc_phys(int len, int align); static int OF_free_phys(paddr_t paddr, int len); @@ -438,7 +438,7 @@ OF_free_virt(vaddr_t vaddr, int len) * * Only works while the prom is actively mapping us. */ -static vaddr_t +static int OF_map_phys(paddr_t paddr, off_t size, vaddr_t vaddr, int mode) { struct { @@ -452,13 +452,11 @@ OF_map_phys(paddr_t paddr, off_t size, vaddr_t vaddr, int mode) cell_t vaddr; cell_t paddr_hi; cell_t paddr_lo; - cell_t status; - cell_t retaddr; } args; args.name = ADR2CELL("call-method"); args.nargs = 7; - args.nreturns = 1; + args.nreturns = 0; args.method = ADR2CELL("map"); args.ihandle = HDL2CELL(mmuh); args.mode = mode; @@ -466,12 +464,7 @@ OF_map_phys(paddr_t paddr, off_t size, vaddr_t vaddr, int mode) args.vaddr = ADR2CELL(vaddr); args.paddr_hi = HDQ2CELL_HI(paddr); args.paddr_lo = HDQ2CELL_LO(paddr); - - if (openfirmware(&args) == -1) - return -1; - if (args.status) - return -1; - return (vaddr_t)args.retaddr; + return openfirmware(&args); } |