diff options
author | grehan <grehan@FreeBSD.org> | 2007-04-20 03:24:59 +0000 |
---|---|---|
committer | grehan <grehan@FreeBSD.org> | 2007-04-20 03:24:59 +0000 |
commit | d1c72876f0f97720eb5651593b507d785c266ac8 (patch) | |
tree | edc1db1461f7de678058597624ce4ffc1937ba47 /sys/powerpc | |
parent | a559ca64195cf40d4bce16ab02dbcd1e8350f678 (diff) | |
download | FreeBSD-src-d1c72876f0f97720eb5651593b507d785c266ac8.zip FreeBSD-src-d1c72876f0f97720eb5651593b507d785c266ac8.tar.gz |
Add ofw bus methods to the ppc nexus driver. This will be used in future
EFIKA platform support.
PR: 111522
Submitted by: Andrew Turner, andrew at fubar geek nz
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/aim/nexus.c | 56 | ||||
-rw-r--r-- | sys/powerpc/powerpc/nexus.c | 56 |
2 files changed, 112 insertions, 0 deletions
diff --git a/sys/powerpc/aim/nexus.c b/sys/powerpc/aim/nexus.c index bc7a477..c2b754a 100644 --- a/sys/powerpc/aim/nexus.c +++ b/sys/powerpc/aim/nexus.c @@ -74,6 +74,7 @@ #include <sys/rman.h> +#include "ofw_bus_if.h" #include "pic_if.h" /* @@ -124,6 +125,11 @@ static int nexus_deactivate_resource(device_t, device_t, int, int, static int nexus_release_resource(device_t, device_t, int, int, struct resource *); +static phandle_t nexus_ofw_get_node(device_t, device_t); +static const char *nexus_ofw_get_name(device_t, device_t); +static const char *nexus_ofw_get_type(device_t, device_t); +static const char *nexus_ofw_get_compat(device_t, device_t); + /* * Local routines */ @@ -151,6 +157,12 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), + /* OFW bus interface */ + DEVMETHOD(ofw_bus_get_node, nexus_ofw_get_node), + DEVMETHOD(ofw_bus_get_name, nexus_ofw_get_name), + DEVMETHOD(ofw_bus_get_type, nexus_ofw_get_type), + DEVMETHOD(ofw_bus_get_compat, nexus_ofw_get_compat), + { 0, 0 } }; @@ -416,3 +428,47 @@ nexus_install_intcntlr(device_t dev) return (0); } + +static const char * +nexus_ofw_get_name(device_t bus, device_t dev) +{ + struct nexus_devinfo *dinfo; + + if ((dinfo = device_get_ivars(dev)) == NULL) + return (NULL); + + return (dinfo->ndi_name); +} + +static phandle_t +nexus_ofw_get_node(device_t bus, device_t dev) +{ + struct nexus_devinfo *dinfo; + + if ((dinfo = device_get_ivars(dev)) == NULL) + return (0); + + return (dinfo->ndi_node); +} + +static const char * +nexus_ofw_get_type(device_t bus, device_t dev) +{ + struct nexus_devinfo *dinfo; + + if ((dinfo = device_get_ivars(dev)) == NULL) + return (NULL); + + return (dinfo->ndi_device_type); +} + +static const char * +nexus_ofw_get_compat(device_t bus, device_t dev) +{ + struct nexus_devinfo *dinfo; + + if ((dinfo = device_get_ivars(dev)) == NULL) + return (NULL); + + return (dinfo->ndi_compatible); +} diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c index bc7a477..c2b754a 100644 --- a/sys/powerpc/powerpc/nexus.c +++ b/sys/powerpc/powerpc/nexus.c @@ -74,6 +74,7 @@ #include <sys/rman.h> +#include "ofw_bus_if.h" #include "pic_if.h" /* @@ -124,6 +125,11 @@ static int nexus_deactivate_resource(device_t, device_t, int, int, static int nexus_release_resource(device_t, device_t, int, int, struct resource *); +static phandle_t nexus_ofw_get_node(device_t, device_t); +static const char *nexus_ofw_get_name(device_t, device_t); +static const char *nexus_ofw_get_type(device_t, device_t); +static const char *nexus_ofw_get_compat(device_t, device_t); + /* * Local routines */ @@ -151,6 +157,12 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), DEVMETHOD(bus_release_resource, nexus_release_resource), + /* OFW bus interface */ + DEVMETHOD(ofw_bus_get_node, nexus_ofw_get_node), + DEVMETHOD(ofw_bus_get_name, nexus_ofw_get_name), + DEVMETHOD(ofw_bus_get_type, nexus_ofw_get_type), + DEVMETHOD(ofw_bus_get_compat, nexus_ofw_get_compat), + { 0, 0 } }; @@ -416,3 +428,47 @@ nexus_install_intcntlr(device_t dev) return (0); } + +static const char * +nexus_ofw_get_name(device_t bus, device_t dev) +{ + struct nexus_devinfo *dinfo; + + if ((dinfo = device_get_ivars(dev)) == NULL) + return (NULL); + + return (dinfo->ndi_name); +} + +static phandle_t +nexus_ofw_get_node(device_t bus, device_t dev) +{ + struct nexus_devinfo *dinfo; + + if ((dinfo = device_get_ivars(dev)) == NULL) + return (0); + + return (dinfo->ndi_node); +} + +static const char * +nexus_ofw_get_type(device_t bus, device_t dev) +{ + struct nexus_devinfo *dinfo; + + if ((dinfo = device_get_ivars(dev)) == NULL) + return (NULL); + + return (dinfo->ndi_device_type); +} + +static const char * +nexus_ofw_get_compat(device_t bus, device_t dev) +{ + struct nexus_devinfo *dinfo; + + if ((dinfo = device_get_ivars(dev)) == NULL) + return (NULL); + + return (dinfo->ndi_compatible); +} |