From owner-freebsd-acpi@FreeBSD.ORG Tue Sep 23 17:21:26 2008 Return-Path: Delivered-To: freebsd-acpi@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E16E1065679; Tue, 23 Sep 2008 17:21:26 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from mail-gw2.york.ac.uk (mail-gw2.york.ac.uk [144.32.128.247]) by mx1.freebsd.org (Postfix) with ESMTP id A768D8FC13; Tue, 23 Sep 2008 17:21:25 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from mail-gw6.york.ac.uk (mail-gw6.york.ac.uk [144.32.129.26]) by mail-gw2.york.ac.uk (8.13.6/8.13.6) with ESMTP id m8NHLNi4009995; Tue, 23 Sep 2008 18:21:23 +0100 (BST) Received: from buffy-128.york.ac.uk ([144.32.128.160] helo=buffy.york.ac.uk) by mail-gw6.york.ac.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1KiBZj-0003fC-Iu; Tue, 23 Sep 2008 18:21:23 +0100 Received: from buffy.york.ac.uk (localhost [127.0.0.1]) by buffy.york.ac.uk (8.14.2/8.14.2) with ESMTP id m8NHLNbo084548; Tue, 23 Sep 2008 18:21:23 +0100 (BST) (envelope-from gavin@FreeBSD.org) Received: (from ga9@localhost) by buffy.york.ac.uk (8.14.2/8.14.2/Submit) id m8NHLNab084547; Tue, 23 Sep 2008 18:21:23 +0100 (BST) (envelope-from gavin@FreeBSD.org) X-Authentication-Warning: buffy.york.ac.uk: ga9 set sender to gavin@FreeBSD.org using -f From: Gavin Atkinson To: John Baldwin In-Reply-To: <200809231037.00392.jhb@freebsd.org> References: <1222173505.80882.15.camel@buffy.york.ac.uk> <200809231037.00392.jhb@freebsd.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Tue, 23 Sep 2008 18:21:22 +0100 Message-Id: <1222190482.80882.28.camel@buffy.york.ac.uk> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 FreeBSD GNOME Team Port X-York-MailScanner: Found to be clean X-York-MailScanner-From: gavin@freebsd.org Cc: freebsd-acpi@FreeBSD.org Subject: Re: Writing a driver: how do I get resources? X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Sep 2008 17:21:26 -0000 On Tue, 2008-09-23 at 10:36 -0400, John Baldwin wrote: > On Tuesday 23 September 2008 08:38:25 am Gavin Atkinson wrote: > > Hi all, > > > > Please forgive me if this email makes very little sense: I've never > > really looked at how ACPI works from a driver's perspective, so don't > > really know if what I'm trying to do is even correct. > > > > I'm expanding the acpi_sony driver to cover the PNP ID SNY6001. When I > > simply claim it by returning 0 from the probe, I get the following I/O > range: > > > > acpi_sony0: port 0-0x1f on acpi0 > > > > However, if I'm reading the AML[1] and Linux drivers[2] correctly, this > > is not the correct range. It appears that the _PRS method offers a > > choice of four I/O ranges and four IRQs, one of which is then selected > > by evaluating _SRS. None of them are 0-0x1f. > > > > Firstly, does that make sense? Secondly, how do I do this from a > > driver? I can't see any other drivers that seem to get this involved in > > ACPI, indeed the only mention of evaluating _PRS is within the ACPI code > > itself. > > > > Lastly, I only have intermittent access to this laptop, so I apologise > > if I can't test things quickly. > > Our ACPI driver isn't smart enough yet (AFAIK) to allocate new resources for a > device that doesn't have any. That logic should be in acpi_alloc_resource() > and once that is present then your driver just needs to do the usual > bus_alloc_resource() stuff to work. Thanks. So I guess there's no easy way to do it at the moment? Gavin