From owner-freebsd-ppc@FreeBSD.ORG Thu Apr 12 23:10:05 2007 Return-Path: X-Original-To: freebsd-ppc@hub.freebsd.org Delivered-To: freebsd-ppc@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4590416A401 for ; Thu, 12 Apr 2007 23:10:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 2746813C459 for ; Thu, 12 Apr 2007 23:10:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l3CNA4Ik021128 for ; Thu, 12 Apr 2007 23:10:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l3CNA4Gt021125; Thu, 12 Apr 2007 23:10:04 GMT (envelope-from gnats) Resent-Date: Thu, 12 Apr 2007 23:10:04 GMT Resent-Message-Id: <200704122310.l3CNA4Gt021125@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ppc@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Andrew Turner 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 To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: powerpc/111522: Add support for the ofw bus interface to nexus X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Andrew Turner List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Apr 2007 23:10:05 -0000 >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: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Apr 12 23:10:04 GMT 2007 >Closed-Date: >Last-Modified: >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: >Unformatted: