From andrew@fubar.geek.nz Thu Apr 12 23:00:35 2007 Return-Path: Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B7CBE16A400 for ; Thu, 12 Apr 2007 23:00:35 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from fep06.xtra.co.nz (fep06.xtra.co.nz [210.54.141.240]) by mx1.freebsd.org (Postfix) with ESMTP id 51E1A13C46C for ; Thu, 12 Apr 2007 23:00:34 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from serv.int.fubar.geek.nz ([125.237.114.141]) by fep06.xtra.co.nz with ESMTP id <20070412230033.CMF26198.fep06.xtra.co.nz@serv.int.fubar.geek.nz> for ; Fri, 13 Apr 2007 11:00:33 +1200 Message-Id: <20070412230033.2CD8061FE@serv.int.fubar.geek.nz> Date: Fri, 13 Apr 2007 11:00:33 +1200 (NZST) From: Andrew Turner Reply-To: Andrew Turner To: FreeBSD-gnats-submit@freebsd.org Cc: Subject: Add support for the ofw bus interface to nexus X-Send-Pr-Version: 3.113 X-GNATS-Notify: >Number: 111522 >Category: powerpc >Synopsis: Add support for the ofw bus interface to nexus >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ppc >State: closed >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Apr 12 23:10:04 GMT 2007 >Closed-Date: Sun Apr 22 07:40:09 GMT 2007 >Last-Modified: Sun Apr 22 07:40:09 GMT 2007 >Originator: Andrew Turner >Release: FreeBSD 5.5-RC1 i386 >Organization: >Environment: System: FreeBSD serv.int.fubar.geek.nz 5.5-RC1 FreeBSD 5.5-RC1 #0: Mon May 15 14:09:18 NZST 2006 root@serv.int.fubar.geek.nz:/usr/obj/usr/src/sys/GENERIC i386 >Description: The attached patch adds support for the some of the ofw bus interface to the nexus device. >How-To-Repeat: >Fix: --- ppc-nexus-ofwbus.diff begins here --- Index: sys/powerpc/powerpc/nexus.c =================================================================== RCS file: /cvsroot/src/sys/powerpc/powerpc/nexus.c,v retrieving revision 1.13 diff -u -u -r1.13 nexus.c --- sys/powerpc/powerpc/nexus.c 7 Mar 2007 11:42:14 -0000 1.13 +++ sys/powerpc/powerpc/nexus.c 12 Apr 2007 10:29:35 -0000 @@ -74,6 +74,7 @@ #include +#include "ofw_bus_if.h" #include "pic_if.h" /* @@ -124,6 +125,11 @@ 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 @@ 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 @@ 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)) == 0) + 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)) == 0) + 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)) == 0) + 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)) == 0) + return NULL; + + return dinfo->ndi_compatible; +} --- ppc-nexus-ofwbus.diff ends here --- >Release-Note: >Audit-Trail: From: Rink Springer To: Andrew Turner Cc: FreeBSD-gnats-submit@FreeBSD.org Subject: Re: powerpc/111522: Add support for the ofw bus interface to nexus Date: Fri, 13 Apr 2007 08:39:56 +0200 Hi Andrew, On Fri, Apr 13, 2007 at 11:00:33AM +1200, Andrew Turner wrote: > + if ((dinfo = device_get_ivars(dev)) == 0) style(9) says you should use NULL instead of 0. Other than this, I can't see anything wrong with the patch. Cheers, -- Rink P.W. Springer - http://rink.nu "It is such a quiet thing, to fall. But yet a far more terrible thing, to admit it." - Darth Traya From: Andrew Turner To: Rink Springer Cc: FreeBSD-gnats-submit@FreeBSD.org Subject: Re: powerpc/111522: Add support for the ofw bus interface to nexus Date: Fri, 13 Apr 2007 21:22:56 +1200 --MP_PScor1Tq6r5if1qCZ6+Yn6T Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Fri, 13 Apr 2007 08:39:56 +0200 Rink Springer wrote: > Hi Andrew, > > On Fri, Apr 13, 2007 at 11:00:33AM +1200, Andrew Turner wrote: > > + if ((dinfo = device_get_ivars(dev)) == 0) > > style(9) says you should use NULL instead of 0. Other than this, I > can't see anything wrong with the patch. > > Cheers, > That line is a copy+paste from a similar line further up in the file. I've attached a patch with the new code changed to NULL's. Andrew --MP_PScor1Tq6r5if1qCZ6+Yn6T Content-Type: text/x-patch; name=freebsd-ppc-nexus-ofw.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=freebsd-ppc-nexus-ofw.diff Index: sys/powerpc/powerpc/nexus.c =================================================================== RCS file: /cvsroot/src/sys/powerpc/powerpc/nexus.c,v retrieving revision 1.13 diff -u -u -r1.13 nexus.c --- sys/powerpc/powerpc/nexus.c 7 Mar 2007 11:42:14 -0000 1.13 +++ sys/powerpc/powerpc/nexus.c 13 Apr 2007 09:20:56 -0000 @@ -74,6 +74,7 @@ #include +#include "ofw_bus_if.h" #include "pic_if.h" /* @@ -124,6 +125,11 @@ 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 @@ 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 @@ 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; +} --MP_PScor1Tq6r5if1qCZ6+Yn6T-- From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: powerpc/111522: commit references a PR Date: Fri, 20 Apr 2007 03:25:08 +0000 (UTC) grehan 2007-04-20 03:24:59 UTC FreeBSD src repository Modified files: sys/powerpc/powerpc nexus.c Log: 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 Revision Changes Path 1.14 +56 -0 src/sys/powerpc/powerpc/nexus.c _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org" State-Changed-From-To: open->closed State-Changed-By: linimon State-Changed-When: Sun Apr 22 07:36:48 UTC 2007 State-Changed-Why: Committed by grehan on 2007-04-20. http://www.freebsd.org/cgi/query-pr.cgi?pr=111522 >Unformatted: