diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/fdt/simplebus.c | 2 | ||||
-rw-r--r-- | sys/dev/mii/atphy.c | 1 | ||||
-rw-r--r-- | sys/dev/mii/miidevs | 1 | ||||
-rw-r--r-- | sys/dev/ofw/ofw_fdt.c | 95 |
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. */ |