From owner-p4-projects@FreeBSD.ORG Wed Oct 15 01:28:04 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D93D4106568B; Wed, 15 Oct 2008 01:28:03 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BADC1065693 for ; Wed, 15 Oct 2008 01:28:03 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 89F738FC14 for ; Wed, 15 Oct 2008 01:28:03 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m9F1S31Q027078 for ; Wed, 15 Oct 2008 01:28:03 GMT (envelope-from nwhitehorn@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m9F1S3KM027076 for perforce@freebsd.org; Wed, 15 Oct 2008 01:28:03 GMT (envelope-from nwhitehorn@freebsd.org) Date: Wed, 15 Oct 2008 01:28:03 GMT Message-Id: <200810150128.m9F1S3KM027076@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to nwhitehorn@freebsd.org using -f From: Nathan Whitehorn To: Perforce Change Reviews Cc: Subject: PERFORCE change 151403 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Oct 2008 01:28:04 -0000 http://perforce.freebsd.org/chv.cgi?CH=151403 Change 151403 by nwhitehorn@nwhitehorn_trantor on 2008/10/15 01:28:02 Make powermac_nvram work on G5 systems by allowing for the #address-cells != 1 case. Affected files ... .. //depot/projects/ppc-g5/sys/dev/powermac_nvram/powermac_nvram.c#5 edit Differences ... ==== //depot/projects/ppc-g5/sys/dev/powermac_nvram/powermac_nvram.c#5 (text+ko) ==== @@ -131,19 +131,25 @@ { struct powermac_nvram_softc *sc; phandle_t node; - u_int32_t reg[2]; - int gen0, gen1; + u_int32_t reg[3]; + int gen0, gen1, i; node = ofw_bus_get_node(dev); sc = device_get_softc(dev); - if (OF_getprop(node, "reg", reg, sizeof(reg)) < 8) + if ((i = OF_getprop(node, "reg", reg, sizeof(reg))) < 8) return ENXIO; sc->sc_dev = dev; sc->sc_node = node; - sc->sc_bank0 = (vm_offset_t)pmap_mapdev(reg[0], NVRAM_SIZE * 2); + /* + * Find which byte of reg corresponds to the 32-bit physical address. + * We should probably read #address-cells from /chosen instead. + */ + i = (i/4) - 2; + + sc->sc_bank0 = (vm_offset_t)pmap_mapdev(reg[i], NVRAM_SIZE * 2); sc->sc_bank1 = sc->sc_bank0 + NVRAM_SIZE; gen0 = powermac_nvram_check((void *)sc->sc_bank0);