svn commit: r258272 - head/sys/powerpc/powermac

Nathan Whitehorn nwhitehorn at FreeBSD.org
Sun Nov 17 19:01:14 UTC 2013


Author: nwhitehorn
Date: Sun Nov 17 19:01:13 2013
New Revision: 258272
URL: http://svnweb.freebsd.org/changeset/base/258272

Log:
  Use #address-cells and #size-cells here too instead of guessing. There is
  some comment I wrote about these values "lying" in the negative diff, which
  referes to an earlier misunderstanding about which node to read them from.
  This gets at least the PPC64 kernel booting in the mac99 system model in
  QEMU after bypassing the MacIO ATA driver, which apparently still has
  problems.

Modified:
  head/sys/powerpc/powermac/uninorth.c
  head/sys/powerpc/powermac/uninorthvar.h

Modified: head/sys/powerpc/powermac/uninorth.c
==============================================================================
--- head/sys/powerpc/powermac/uninorth.c	Sun Nov 17 18:27:07 2013	(r258271)
+++ head/sys/powerpc/powermac/uninorth.c	Sun Nov 17 19:01:13 2013	(r258272)
@@ -264,6 +264,7 @@ unin_chip_attach(device_t dev)
 	phandle_t  child;
 	phandle_t  iparent;
 	device_t   cdev;
+	cell_t     acells, scells;
 	char compat[32];
 	char name[32];
 	u_int irq, reg[3];
@@ -275,12 +276,21 @@ unin_chip_attach(device_t dev)
 	if (OF_getprop(root, "reg", reg, sizeof(reg)) < 8)
 		return (ENXIO);
 
-	if (strcmp(ofw_bus_get_name(dev), "u3") == 0
-	    || strcmp(ofw_bus_get_name(dev), "u4") == 0)
-		i = 1; /* #address-cells lies */
-
-	sc->sc_physaddr = reg[i];
-	sc->sc_size = reg[i+1];
+	acells = scells = 1;
+	OF_getprop(OF_parent(root), "#address-cells", &acells, sizeof(acells));
+	OF_getprop(OF_parent(root), "#size-cells", &scells, sizeof(scells));
+
+	i = 0;
+	sc->sc_physaddr = reg[i++];
+	if (acells == 2) {
+		sc->sc_physaddr <<= 32;
+		sc->sc_physaddr |= reg[i++];
+	}
+	sc->sc_size = reg[i++];
+	if (scells == 2) {
+		sc->sc_size <<= 32;
+		sc->sc_size |= reg[i++];
+	}
 
 	sc->sc_mem_rman.rm_type = RMAN_ARRAY;
 	sc->sc_mem_rman.rm_descr = "UniNorth Device Memory";

Modified: head/sys/powerpc/powermac/uninorthvar.h
==============================================================================
--- head/sys/powerpc/powermac/uninorthvar.h	Sun Nov 17 18:27:07 2013	(r258271)
+++ head/sys/powerpc/powermac/uninorthvar.h	Sun Nov 17 19:01:13 2013	(r258272)
@@ -38,9 +38,9 @@ struct uninorth_softc {
 };
 
 struct unin_chip_softc {
-	u_int32_t		sc_physaddr;
+	uint64_t		sc_physaddr;
+	uint64_t		sc_size;
 	vm_offset_t		sc_addr;
-	u_int32_t		sc_size;
 	struct rman  		sc_mem_rman;
 	int			sc_version;
 };


More information about the svn-src-all mailing list