CVS commit: [agc-symver] src/lib

2013-04-01 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Mon Apr  1 07:04:26 UTC 2013

Added Files:
src/lib [agc-symver]: mkvermap

Log Message:
add the script used to generate the Version.map files


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/lib/mkvermap

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/lib/mkvermap
diff -u /dev/null src/lib/mkvermap:1.1.2.1
--- /dev/null	Mon Apr  1 07:04:26 2013
+++ src/lib/mkvermap	Mon Apr  1 07:04:25 2013
@@ -0,0 +1,69 @@
+#! /bin/sh
+
+# $NetBSD: mkvermap,v 1.1.2.1 2013/04/01 07:04:25 agc Exp $
+
+# Copyright (c) 2013 Alistair Crooks a...@netbsd.org
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# Usage: mkvermap c
+#	makes symbol versioning info for /usr/lib/libc.so
+
+major=0
+minor=0
+minimus=0
+if [ -f shlib_version ]; then
+	. ./shlib_version
+fi
+os=$(uname -r)
+output=Version.map
+while [ $# -gt 0 ]; do
+	case $1 in
+	--major=*)		major=${1#--major=} ;;
+	--minor=*)		minor=${1#--minor=} ;;
+	--os=*)			os=${1#--os=} ;;
+	--output=*)		output=${1#--output=} ;;
+	-o)			output=$2; shift ;;
+	-v)			set -x ;;
+	*)			break ;;
+	esac
+	shift
+done
+
+LIB=$1
+
+nm /usr/lib/lib${LIB}.so |
+	awk '$2 ~ /^[BCDRTWV]$/ { print \t $3 ; }' |
+	sort -u |
+	awk -v LIB=${LIB} -v osver=${os} -v major=${major} -v minor=${minor} -v minimus=${minimus} '
+	BEGIN {
+		printf(LIB%s_%s.%s.%s.0 {\nglobal:\n, toupper(LIB), major, minor, minimus)
+	}
+	{ print }
+	END {
+		printf(};\n\n);
+		printf(NetBSD_%s.0 {\n} LIB%s_%s.%s.%s.0;\n\n, osver, toupper(LIB), major, minor, minimus);
+		printf(LIB%s_private_%s.%s.%s.0 {\nlocal:\n\t*;\n};\n\n, toupper(LIB), major, minor, minimus);
+	}'  ${output}
+
+exit 0



CVS commit: src/sys/kern

2013-04-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  1 12:31:34 UTC 2013

Modified Files:
src/sys/kern: subr_time.c

Log Message:
ts2timo: return ETIMEDOUT instead of failing an assertion when the
calculated difference to the target time is zero.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/kern/subr_time.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/kern/subr_time.c
diff -u src/sys/kern/subr_time.c:1.12 src/sys/kern/subr_time.c:1.13
--- src/sys/kern/subr_time.c:1.12	Sun Mar 31 16:46:29 2013
+++ src/sys/kern/subr_time.c	Mon Apr  1 12:31:34 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_time.c,v 1.12 2013/03/31 16:46:29 christos Exp $	*/
+/*	$NetBSD: subr_time.c,v 1.13 2013/04/01 12:31:34 martin Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_time.c,v 1.12 2013/03/31 16:46:29 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_time.c,v 1.13 2013/04/01 12:31:34 martin Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -241,7 +241,7 @@ int
 ts2timo(clockid_t clock_id, int flags, struct timespec *ts,
 int *timo, struct timespec *start)
 {
-	int error;
+	int error, res;
 	struct timespec tsd;
 
 	flags = TIMER_ABSTIME;
@@ -259,8 +259,12 @@ ts2timo(clockid_t clock_id, int flags, s
 	if ((error = itimespecfix(ts)) != 0)
 		return error;
 
-	*timo = tstohz(ts);
-	KASSERT(*timo  0);
+	res = tstohz(ts);
+	if (res == 0)
+		return ETIMEDOUT;
+
+	KASSERT(res  0);
+	*timo = res;
 
 	return 0;
 }



CVS commit: src/sys/dev/mii

2013-04-01 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr  1 13:41:38 UTC 2013

Modified Files:
src/sys/dev/mii: brgphy.c

Log Message:
 In brgphyattach(), set sc_isbge, sc_isbnx and sc_phyflags before PHY_RESET()
because brgphy_reset() refers those flags.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/mii/brgphy.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/dev/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.62 src/sys/dev/mii/brgphy.c:1.63
--- src/sys/dev/mii/brgphy.c:1.62	Tue Mar 19 04:10:12 2013
+++ src/sys/dev/mii/brgphy.c	Mon Apr  1 13:41:37 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.62 2013/03/19 04:10:12 msaitoh Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.63 2013/04/01 13:41:37 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: brgphy.c,v 1.62 2013/03/19 04:10:12 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: brgphy.c,v 1.63 2013/04/01 13:41:37 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -266,14 +266,6 @@ brgphyattach(device_t parent, device_t s
 	sc-mii_anegticks = MII_ANEGTICKS;
 	sc-mii_funcs = brgphy_funcs;
 
-	PHY_RESET(sc);
-
-	sc-mii_capabilities =
-	PHY_READ(sc, MII_BMSR)  ma-mii_capmask;
-	if (sc-mii_capabilities  BMSR_EXTSTAT)
-		sc-mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
-
-
 	if (device_is_a(parent, bge))
 		bsc-sc_isbge = true;
 	else if (device_is_a(parent, bnx))
@@ -289,6 +281,13 @@ brgphyattach(device_t parent, device_t s
 			aprint_error_dev(self, failed to get chipid\n);
 	}
 
+	PHY_RESET(sc);
+
+	sc-mii_capabilities =
+	PHY_READ(sc, MII_BMSR)  ma-mii_capmask;
+	if (sc-mii_capabilities  BMSR_EXTSTAT)
+		sc-mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
+
 	aprint_normal_dev(self, );
 	if ((sc-mii_capabilities  BMSR_MEDIAMASK) == 0 
 	(sc-mii_extcapabilities  EXTSR_MEDIAMASK) == 0)



CVS commit: src/sys/dev/mii

2013-04-01 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr  1 13:44:02 UTC 2013

Modified Files:
src/sys/dev/mii: brgphyreg.h

Log Message:
Sort. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/mii/brgphyreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/mii/brgphyreg.h
diff -u src/sys/dev/mii/brgphyreg.h:1.5 src/sys/dev/mii/brgphyreg.h:1.6
--- src/sys/dev/mii/brgphyreg.h:1.5	Thu Dec  9 23:25:49 2010
+++ src/sys/dev/mii/brgphyreg.h	Mon Apr  1 13:44:02 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphyreg.h,v 1.5 2010/12/09 23:25:49 jym Exp $	*/
+/*	$NetBSD: brgphyreg.h,v 1.6 2013/04/01 13:44:02 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2000
@@ -41,6 +41,14 @@
  * Broadcom BCM5400 registers
  */
 
+#define BRGPHY_MII_1000CTL	0x09	/* 1000baseT control */
+#define	BRGPHY_1000CTL_TST	0xE000	/* Test modes */
+#define	BRGPHY_1000CTL_MSE	0x1000	/* Master/Slave enable */
+#define	BRGPHY_1000CTL_MSC	0x0800	/* Master/Slave configuration */
+#define	BRGPHY_1000CTL_RD	0x0400	/* Repeater/DTE */
+#define	BRGPHY_1000CTL_AFD	0x0200	/* Advertise full duplex */
+#define	BRGPHY_1000CTL_AHD	0x0100	/* Advertise half duplex */
+
 #define BRGPHY_MII_PHY_EXTCTL	0x10	/* PHY extended control */
 #define BRGPHY_PHY_EXTCTL_MAC_PHY	0x8000	/* 10BIT/GMI-interface */
 #define BRGPHY_PHY_EXTCTL_DIS_CROSS	0x4000	/* Disable MDI crossover */
@@ -75,14 +83,6 @@
 #define BRGPHY_PHY_EXTSTS_LOCK_ER	0x0002	/* Lock error */
 #define BRGPHY_PHY_EXTSTS_MLT3_ER	0x0001	/* MLT3 code error */
 
-#define BRGPHY_MII_1000CTL	0x09	/* 1000baseT control */
-#define	BRGPHY_1000CTL_TST	0xE000	/* Test modes */
-#define	BRGPHY_1000CTL_MSE	0x1000	/* Master/Slave enable */
-#define	BRGPHY_1000CTL_MSC	0x0800	/* Master/Slave configuration */
-#define	BRGPHY_1000CTL_RD	0x0400	/* Repeater/DTE */
-#define	BRGPHY_1000CTL_AFD	0x0200	/* Advertise full duplex */
-#define	BRGPHY_1000CTL_AHD	0x0100	/* Advertise half duplex */
-
 #define BRGPHY_MII_RXERRCNT	0x12	/* RX error counter */
 
 #define BRGPHY_MII_FCERRCNT	0x13	/* false carrier sense counter */



CVS commit: src/sys/arch/m68k/fpe

2013-04-01 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Apr  1 13:59:21 UTC 2013

Modified Files:
src/sys/arch/m68k/fpe: fpu_arith.h

Log Message:
quad_t - uint64_t


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/m68k/fpe/fpu_arith.h

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/m68k/fpe/fpu_arith.h
diff -u src/sys/arch/m68k/fpe/fpu_arith.h:1.7 src/sys/arch/m68k/fpe/fpu_arith.h:1.8
--- src/sys/arch/m68k/fpe/fpu_arith.h:1.7	Tue Mar 26 11:30:20 2013
+++ src/sys/arch/m68k/fpe/fpu_arith.h	Mon Apr  1 13:59:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_arith.h,v 1.7 2013/03/26 11:30:20 isaki Exp $ */
+/*	$NetBSD: fpu_arith.h,v 1.8 2013/04/01 13:59:21 isaki Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -57,7 +57,7 @@
 #ifndef FPE_USE_ASM
 
 /* set up for extended-precision arithemtic */
-#define	FPU_DECL_CARRY quad_t fpu_carry, fpu_tmp;
+#define	FPU_DECL_CARRY uint64_t fpu_carry, fpu_tmp;
 
 /*
  * We have three kinds of add:
@@ -79,13 +79,13 @@
 	(r) = (x) + (y) + (!!fpu_carry)
 #define	FPU_ADDS(r, x, y) \
 	{ \
-		fpu_tmp = (quad_t)(x) + (quad_t)(y); \
+		fpu_tmp = (uint64_t)(x) + (uint64_t)(y); \
 		(r) = (uint32_t)fpu_tmp; \
 		fpu_carry = ((fpu_tmp  0xLL) != 0); \
 	}
 #define	FPU_ADDCS(r, x, y) \
 	{ \
-		fpu_tmp = (quad_t)(x) + (quad_t)(y) + (!!fpu_carry); \
+		fpu_tmp = (uint64_t)(x) + (uint64_t)(y) + (!!fpu_carry); \
 		(r) = (uint32_t)fpu_tmp; \
 		fpu_carry = ((fpu_tmp  0xLL) != 0); \
 	}
@@ -93,13 +93,13 @@
 	(r) = (x) - (y) - (!!fpu_carry)
 #define	FPU_SUBS(r, x, y) \
 	{ \
-		fpu_tmp = (quad_t)(x) - (quad_t)(y); \
+		fpu_tmp = (uint64_t)(x) - (uint64_t)(y); \
 		(r) = (uint32_t)fpu_tmp; \
 		fpu_carry = ((fpu_tmp  0xLL) != 0); \
 	}
 #define	FPU_SUBCS(r, x, y) \
 	{ \
-		fpu_tmp = (quad_t)(x) - (quad_t)(y) - (!!fpu_carry); \
+		fpu_tmp = (uint64_t)(x) - (uint64_t)(y) - (!!fpu_carry); \
 		(r) = (uint32_t)fpu_tmp; \
 		fpu_carry = ((fpu_tmp  0xLL) != 0); \
 	}



CVS commit: src/sys/kern

2013-04-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  1 15:46:46 UTC 2013

Modified Files:
src/sys/kern: subr_time.c

Log Message:
do the timeout test centrally.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/subr_time.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/kern/subr_time.c
diff -u src/sys/kern/subr_time.c:1.13 src/sys/kern/subr_time.c:1.14
--- src/sys/kern/subr_time.c:1.13	Mon Apr  1 08:31:34 2013
+++ src/sys/kern/subr_time.c	Mon Apr  1 11:46:46 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_time.c,v 1.13 2013/04/01 12:31:34 martin Exp $	*/
+/*	$NetBSD: subr_time.c,v 1.14 2013/04/01 15:46:46 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_time.c,v 1.13 2013/04/01 12:31:34 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_time.c,v 1.14 2013/04/01 15:46:46 christos Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -169,9 +169,9 @@ itimerfix(struct timeval *tv)
 
 	if (tv-tv_usec  0 || tv-tv_usec = 100)
 		return EINVAL;
-	if (tv-tv_sec  0)
+	if (ts-tv_sec  0 || (ts-tv_sec == 0  ts-tv_usec == 0))
 		return ETIMEDOUT;
-	if (tv-tv_sec == 0  tv-tv_usec != 0  tv-tv_usec  tick)
+	if (tv-tv_sec == 0  tv-tv_usec  tick)
 		tv-tv_usec = tick;
 	return 0;
 }
@@ -182,9 +182,9 @@ itimespecfix(struct timespec *ts)
 
 	if (ts-tv_nsec  0 || ts-tv_nsec = 10)
 		return EINVAL;
-	if (ts-tv_sec  0)
+	if (ts-tv_sec  0 || (ts-tv_sec == 0  ts-tv_nsec == 0))
 		return ETIMEDOUT;
-	if (ts-tv_sec == 0  ts-tv_nsec != 0  ts-tv_nsec  tick * 1000)
+	if (ts-tv_sec == 0  ts-tv_nsec  tick * 1000)
 		ts-tv_nsec = tick * 1000;
 	return 0;
 }
@@ -241,7 +241,7 @@ int
 ts2timo(clockid_t clock_id, int flags, struct timespec *ts,
 int *timo, struct timespec *start)
 {
-	int error, res;
+	int error;
 	struct timespec tsd;
 
 	flags = TIMER_ABSTIME;
@@ -259,12 +259,8 @@ ts2timo(clockid_t clock_id, int flags, s
 	if ((error = itimespecfix(ts)) != 0)
 		return error;
 
-	res = tstohz(ts);
-	if (res == 0)
-		return ETIMEDOUT;
-
-	KASSERT(res  0);
-	*timo = res;
+	*timo = tstohz(ts);
+	KASSERT(*timo  0);
 
 	return 0;
 }



CVS commit: src/sys/arch/powerpc/powerpc

2013-04-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Mon Apr  1 20:14:43 UTC 2013

Modified Files:
src/sys/arch/powerpc/powerpc: ofw_machdep.c

Log Message:
deal with /memory reg property which may contain 64bit addresses on G5


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/powerpc/ofw_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/powerpc/powerpc/ofw_machdep.c
diff -u src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.19 src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.20
--- src/sys/arch/powerpc/powerpc/ofw_machdep.c:1.19	Wed Feb  1 09:54:03 2012
+++ src/sys/arch/powerpc/powerpc/ofw_machdep.c	Mon Apr  1 20:14:42 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.19 2012/02/01 09:54:03 matt Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.20 2013/04/01 20:14:42 macallan Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ofw_machdep.c,v 1.19 2012/02/01 09:54:03 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ofw_machdep.c,v 1.20 2013/04/01 20:14:42 macallan Exp $);
 
 #include sys/param.h
 #include sys/buf.h
@@ -50,6 +50,12 @@ __KERNEL_RCSID(0, $NetBSD: ofw_machdep.
 #include machine/powerpc.h
 #include machine/autoconf.h
 
+#ifdef DEBUG
+#define DPRINTF aprint_error
+#else
+#define DPRINTF while(0) printf
+#endif
+
 #define	OFMEM_REGIONS	32
 static struct mem_region OFmem[OFMEM_REGIONS + 1], OFavail[OFMEM_REGIONS + 3];
 
@@ -63,74 +69,136 @@ static struct mem_region OFmem[OFMEM_REG
 void
 mem_regions(struct mem_region **memp, struct mem_region **availp)
 {
-	int phandle, i, cnt, regcnt;
-	struct mem_region_avail {
-		paddr_t start;
-		paddr_t size;
-	} OFavail_G5[OFMEM_REGIONS + 3] __attribute((unused));
+	int phandle, i, cnt, regcnt, acells, scells;
+	int numregs;
+	uint32_t regs[OFMEM_REGIONS * 4]; /* 2 values + 2 for 64bit */
+
+	DPRINTF(calling mem_regions\n);
+	/* determine acell size */
+	if ((phandle = OF_finddevice(/)) == -1)
+		goto error;
+	cnt = OF_getprop(phandle, #address-cells, acells, sizeof(int));
+	if (cnt = 0)
+		acells = 1;
 
-	/*
-	 * Get memory.
-	 */
+	/* determine scell size */
+	if ((phandle = OF_finddevice(/)) == -1)
+		goto error;
+	cnt = OF_getprop(phandle, #size-cells, scells, sizeof(int));
+	if (cnt = 0)
+		scells = 1;
+
+	/* Get memory */
 	if ((phandle = OF_finddevice(/memory)) == -1)
 		goto error;
 
-	memset(OFmem, 0, sizeof OFmem);
-	regcnt = OF_getprop(phandle, reg,
-		OFmem, sizeof OFmem[0] * OFMEM_REGIONS);
+	memset(regs, 0, sizeof(regs));
+	regcnt = OF_getprop(phandle, reg, regs,
+	sizeof(regs[0]) * OFMEM_REGIONS * 4);
 	if (regcnt = 0)
 		goto error;
 
-	/* Remove zero sized entry in the returned data. */
-	regcnt /= sizeof OFmem[0];
-	for (i = 0; i  regcnt; )
-		if (OFmem[i].size == 0) {
-			memmove(OFmem[i], OFmem[i + 1],
-(regcnt - i) * sizeof OFmem[0]);
-			regcnt--;
-		} else
-			i++;
-
-#if defined (PMAC_G5)
-	/* XXXSL: the G5 implementation of OFW is defines the /memory reg/available
-	 * properties differently. Try to fix it up here with minimal damage to the
-	 * rest of the code
- 	 */
-	{
-		int count;
-		memset(OFavail_G5, 0, sizeof OFavail_G5);
-		count = OF_getprop(phandle, available,
-			OFavail_G5, sizeof OFavail_G5[0] * OFMEM_REGIONS);
-
-		if (count = 0)
-			goto error;
-
-		count /= sizeof OFavail_G5[0];
-		cnt = count * sizeof(OFavail[0]);
-
-		for (i = 0; i  count; i++ )
-		{
-			OFavail[i].start_hi = 0;
-			OFavail[i].start = OFavail_G5[i].start;
-			OFavail[i].size = OFavail_G5[i].size;
+	/* how many mem regions did we get? */
+	numregs = regcnt / (sizeof(uint32_t)*(acells+scells));
+	DPRINTF(regcnt=%d num=%d acell=%d scell=%d\n,
+	regcnt, numregs, acells, scells);
+
+	/* move the data into OFmem */
+	memset(OFmem, 0, sizeof(OFmem));
+	for (i=0, cnt=0; i = numregs; i++) {
+		uint64_t addr, size;
+
+		if (acells  1)
+			memcpy(addr, regs[i * (acells + scells)],
+			sizeof(int32_t) * acells);
+		else
+			addr = regs[i * (acells + scells)];
+
+		if (scells  1)
+			memcpy(size, regs[i * (acells + scells) + acells],
+			sizeof(int32_t) * scells);
+		else
+			size = regs[i * (acells + scells) + acells];
+
+		/* skip entry of 0 size */
+		if (size == 0)
+			continue;
+#ifndef _LP64
+		if (addr  0x || size  0x ||
+			(addr + size)  0x) {
+			aprint_error(Base addr of %llx or size of %llx too
+			 large for 32 bit OS. Skipping., addr, size);
+			continue;
 		}
-	}
-#else
-	memset(OFavail, 0, sizeof OFavail);
-	cnt = OF_getprop(phandle, available,
-		OFavail, sizeof OFavail[0] * OFMEM_REGIONS);
 #endif
-	if (cnt = 0)
+		OFmem[cnt].start = addr;
+		OFmem[cnt].size = size;
+		aprint_normal(mem region %d start=%llx size=%llx\n,
+		cnt, addr, size);
+		cnt++;
+	}
+
+	DPRINTF(available\n);
+
+	/* now do the same thing again, for the available counts */
+	memset(regs, 0, sizeof(regs));
+