From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 11 11:48:36 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 024EE16A403; Wed, 11 Apr 2007 11:48:36 +0000 (UTC) (envelope-from takawata@init-main.com) Received: from sana.init-main.com (104.194.138.210.bn.2iij.net [210.138.194.104]) by mx1.freebsd.org (Postfix) with ESMTP id A32E813C48C; Wed, 11 Apr 2007 11:48:35 +0000 (UTC) (envelope-from takawata@init-main.com) Received: from ns.init-main.com (localhost [127.0.0.1]) by sana.init-main.com (8.13.8/8.13.8) with ESMTP id l3BBm47D024911; Wed, 11 Apr 2007 20:48:04 +0900 (JST) (envelope-from takawata@ns.init-main.com) Message-Id: <200704111148.l3BBm47D024911@sana.init-main.com> To: Alan Garfield From: takawata@jp.freebsd.org In-reply-to: Your message of "Wed, 11 Apr 2007 21:24:54 +1000." <461CC586.5060507@fromorbit.com> Date: Wed, 11 Apr 2007 20:48:04 +0900 Sender: takawata@init-main.com Cc: acpi@freebsd.org, hackers@freebsd.org Subject: Re: Resources and ACPI X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2007 11:48:36 -0000 In message <461CC586.5060507@fromorbit.com>, Alan Garfield さんいわく: >takawata@jp.freebsd.org wrote: >>> If the resources are allocated how do I access/see them? >> >> sc->sc_rid1 = 0; >> sc->sc_res1 = bus_alloc_resource_any(self, SYS_RES_IOPORT, &sc->sc_rid, >RF_ACTIVE); >> sc->sc_rid2 = 0; Oops! sc->sc_rid2 = 1; >> sc->sc_res2 = bus_alloc_resource_any(self, SYS_RES_IOPORT, &sc->sc_rid, >RF_ACTIVE); >> value_af = bus_space_read_8(rman_get_bustag(sc->sc_res2), rman_get_bus >handle(sc->sc_res2), 1); > >Thanks for this, but how does on tell which resources have been >allocated to which other than manually specifying them with >bus_alloc_resource()? Resource manager will do it. Device driver for a PnP aware bus will set resource location for each device under the bus. At that time, the resource is not allocated and activated. Then a device driver for a child device will allocate bus resource. rid parameter tells the order of resource you want to get.