summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-05-14 01:53:20 +0000
committerian <ian@FreeBSD.org>2014-05-14 01:53:20 +0000
commit14106897a198286392ed1343f8984675609d1e2a (patch)
treeea48f091a3b1b41f214ed5ffa8cf5ba4241728f1 /sys/dev
parentae2bbb5100a71ca9712eebe64ce4a80b680f030b (diff)
downloadFreeBSD-src-14106897a198286392ed1343f8984675609d1e2a.zip
FreeBSD-src-14106897a198286392ed1343f8984675609d1e2a.tar.gz
MFC r257702, r257745, r257746, r257747, r257751, r257791, r257793,
r257794, r257795, r257992 Teach nexus(4) about Open Firmware (e.g. FDT) on ARM and MIPS, retiring fdtbus in most cases. Make OF_nextprop() work correctly for FDT by using the libfdt fdt_next_property_offset() API. Do not panic if pmap_mincore() is called. An addendum: it is possible, though of questionable utility, for a node to have no properties at all. Add definition for the Atheros 8021 gigabit PHY. Consolidate Apple firmware hacks and improve them by switching on the presence of mac-io devices in the tree, which uniquely identifies Apple hardware. Allow OF_decode_addr() to also be able to map resources on big-endian devices. Make tsec work with the device tree present on the RB800. Be more flexible about which compatible strings to accept. This brings up the PCI Express bus on the RB800 using the firmware device tree. Rename the "bare" platform "mpc85xx", which is what it actually is, and add actual platform probing based on PVR.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/fdt/simplebus.c2
-rw-r--r--sys/dev/mii/atphy.c1
-rw-r--r--sys/dev/mii/miidevs1
-rw-r--r--sys/dev/ofw/ofw_fdt.c95
4 files changed, 31 insertions, 68 deletions
diff --git a/sys/dev/fdt/simplebus.c b/sys/dev/fdt/simplebus.c
index c63cd86..92439cd 100644
--- a/sys/dev/fdt/simplebus.c
+++ b/sys/dev/fdt/simplebus.c
@@ -138,7 +138,7 @@ static driver_t simplebus_driver = {
devclass_t simplebus_devclass;
-DRIVER_MODULE(simplebus, fdtbus, simplebus_driver, simplebus_devclass, 0, 0);
+DRIVER_MODULE(simplebus, nexus, simplebus_driver, simplebus_devclass, 0, 0);
DRIVER_MODULE(simplebus, simplebus, simplebus_driver, simplebus_devclass, 0,
0);
diff --git a/sys/dev/mii/atphy.c b/sys/dev/mii/atphy.c
index cca8813..e480e86 100644
--- a/sys/dev/mii/atphy.c
+++ b/sys/dev/mii/atphy.c
@@ -80,6 +80,7 @@ static int atphy_setmedia(struct mii_softc *, int);
static const struct mii_phydesc atphys[] = {
MII_PHY_DESC(xxATHEROS, F1),
MII_PHY_DESC(xxATHEROS, F1_7),
+ MII_PHY_DESC(xxATHEROS, AR8021),
MII_PHY_DESC(xxATHEROS, F2),
MII_PHY_END
};
diff --git a/sys/dev/mii/miidevs b/sys/dev/mii/miidevs
index 60a883a..d7671b2 100644
--- a/sys/dev/mii/miidevs
+++ b/sys/dev/mii/miidevs
@@ -136,6 +136,7 @@ model yyAMD 79c901home 0x0039 Am79C901 HomePNA 1.0 interface
/* Atheros Communications/Attansic PHYs */
model xxATHEROS F1 0x0001 Atheros F1 10/100/1000 PHY
model xxATHEROS F2 0x0002 Atheros F2 10/100 PHY
+model xxATHEROS AR8021 0x0004 Atheros AR8021 10/100/1000 PHY
model xxATHEROS F1_7 0x0007 Atheros F1 10/100/1000 PHY
/* Asix semiconductor PHYs */
diff --git a/sys/dev/ofw/ofw_fdt.c b/sys/dev/ofw/ofw_fdt.c
index a4aca3c..b53bdab 100644
--- a/sys/dev/ofw/ofw_fdt.c
+++ b/sys/dev/ofw/ofw_fdt.c
@@ -137,26 +137,6 @@ fdt_phandle_offset(phandle_t p)
return (pint - dtoff);
}
-static int
-fdt_pointer_offset(const void *ptr)
-{
- uintptr_t dt_struct, p;
- int offset;
-
- p = (uintptr_t)ptr;
- dt_struct = (uintptr_t)fdtp + fdt_off_dt_struct(fdtp);
-
- if ((p < dt_struct) ||
- p > (dt_struct + fdt_size_dt_struct(fdtp)))
- return (-1);
-
- offset = p - dt_struct;
- if (offset < 0)
- return (-1);
-
- return (offset);
-}
-
/* Return the next sibling of this node or 0. */
static phandle_t
ofw_fdt_peer(ofw_t ofw, phandle_t node)
@@ -285,41 +265,6 @@ ofw_fdt_getprop(ofw_t ofw, phandle_t package, const char *propname, void *buf,
return (len);
}
-static int
-fdt_nextprop(int offset, char *buf, size_t size)
-{
- const struct fdt_property *prop;
- const char *name;
- uint32_t tag;
- int nextoffset, depth;
-
- depth = 0;
- tag = fdt_next_tag(fdtp, offset, &nextoffset);
-
- /* Find the next prop */
- do {
- offset = nextoffset;
- tag = fdt_next_tag(fdtp, offset, &nextoffset);
-
- if (tag == FDT_BEGIN_NODE)
- depth++;
- else if (tag == FDT_END_NODE)
- depth--;
- else if ((tag == FDT_PROP) && (depth == 0)) {
- prop =
- (const struct fdt_property *)fdt_offset_ptr(fdtp,
- offset, sizeof(*prop));
- name = fdt_string(fdtp,
- fdt32_to_cpu(prop->nameoff));
- strncpy(buf, name, size);
- return (strlen(name));
- } else
- depth = -1;
- } while (depth >= 0);
-
- return (0);
-}
-
/*
* Get the next property of a package. Return the actual len of retrieved
* prop name.
@@ -329,26 +274,42 @@ ofw_fdt_nextprop(ofw_t ofw, phandle_t package, const char *previous, char *buf,
size_t size)
{
const struct fdt_property *prop;
- int offset, rv;
+ const char *name;
+ int offset;
offset = fdt_phandle_offset(package);
if (offset < 0)
return (-1);
- if (previous == NULL)
- /* Find the first prop in the node */
- return (fdt_nextprop(offset, buf, size));
+ /* Find the first prop in the node */
+ offset = fdt_first_property_offset(fdtp, offset);
+ if (offset < 0)
+ return (0); /* No properties */
+
+ if (previous != NULL) {
+ while (offset >= 0) {
+ prop = fdt_get_property_by_offset(fdtp, offset, NULL);
+ if (prop == NULL)
+ return (-1); /* Internal error */
+
+ offset = fdt_next_property_offset(fdtp, offset);
+ if (offset < 0)
+ return (0); /* No more properties */
+
+ /* Check if the last one was the one we wanted */
+ name = fdt_string(fdtp, fdt32_to_cpu(prop->nameoff));
+ if (strcmp(name, previous) == 0)
+ break;
+ }
+ }
- /*
- * Advance to the previous prop
- */
- prop = fdt_get_property(fdtp, offset, previous, NULL);
+ prop = fdt_get_property_by_offset(fdtp, offset, &offset);
if (prop == NULL)
- return (-1);
+ return (-1); /* Internal error */
- offset = fdt_pointer_offset(prop);
- rv = fdt_nextprop(offset, buf, size);
- return (rv);
+ strncpy(buf, fdt_string(fdtp, fdt32_to_cpu(prop->nameoff)), size);
+
+ return (strlen(buf));
}
/* Set the value of a property of a package. */
OpenPOWER on IntegriCloud