From 489b7dbe7df7e56e513d1373dea8c9574f4c6324 Mon Sep 17 00:00:00 2001 From: kettenis Date: Mon, 17 Oct 2022 18:49:06 +0000 Subject: [PATCH] Fix "map" OpenFirmware call. It does not return a value according to the IEEE 1275 specification. Based on a diff provided by Harald Gutch (hgutch@netbsd). Also see NetBSD PR#56829. ok miod@ --- sys/arch/sparc64/sparc64/ofw_machdep.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/sys/arch/sparc64/sparc64/ofw_machdep.c b/sys/arch/sparc64/sparc64/ofw_machdep.c index 8d28904dab1..7833e38c867 100644 --- a/sys/arch/sparc64/sparc64/ofw_machdep.c +++ b/sys/arch/sparc64/sparc64/ofw_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ofw_machdep.c,v 1.35 2022/10/16 01:22:39 jsg Exp $ */ +/* $OpenBSD: ofw_machdep.c,v 1.36 2022/10/17 18:49:06 kettenis Exp $ */ /* $NetBSD: ofw_machdep.c,v 1.16 2001/07/20 00:07:14 eeh Exp $ */ /* @@ -335,8 +335,6 @@ prom_map_phys(paddr_t paddr, off_t size, vaddr_t vaddr, int mode) cell_t vaddr; cell_t phys_hi; cell_t phys_lo; - cell_t status; - cell_t retaddr; } args; if (mmuh == -1 && ((mmuh = get_mmu_handle()) == -1)) { @@ -345,7 +343,7 @@ prom_map_phys(paddr_t paddr, off_t size, vaddr_t vaddr, int mode) } 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; @@ -353,12 +351,7 @@ prom_map_phys(paddr_t paddr, off_t size, vaddr_t vaddr, int mode) args.vaddr = ADR2CELL(vaddr); args.phys_hi = HDQ2CELL_HI(paddr); args.phys_lo = HDQ2CELL_LO(paddr); - - if (openfirmware(&args) == -1) - return -1; - if (args.status) - return -1; - return (int)args.retaddr; + return openfirmware(&args); } -- 2.20.1