From owner-freebsd-drivers@FreeBSD.ORG Mon Mar 14 15:25:48 2011 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 654F1106564A; Mon, 14 Mar 2011 15:25:48 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 39EF08FC1E; Mon, 14 Mar 2011 15:25:48 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id B915C46B38; Mon, 14 Mar 2011 11:25:47 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.10]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3DF4A8A01B; Mon, 14 Mar 2011 11:25:47 -0400 (EDT) From: John Baldwin To: freebsd-drivers@freebsd.org Date: Mon, 14 Mar 2011 10:28:57 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; ) References: <3550EA55-ADDE-40AC-9C22-1FAC441A0BC8@freebsd.org> <0A707516-C7D1-4441-B17B-1273B6C256B0@FreeBSD.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201103141028.57324.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 14 Mar 2011 11:25:47 -0400 (EDT) Cc: Subject: Re: Allocating resources to isab children X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2011 15:25:48 -0000 On Sunday, March 13, 2011 12:12:59 pm Henrik Brix Andersen wrote: > On Mar 12, 2011, at 20:47, Henrik Brix Andersen wrote: > > On Mar 12, 2011, at 19:49, Henrik Brix Andersen wrote: > >> I am writing a driver for the GPIO part of the AMD CS5536 south bridge (isab0), but have encountered a problem with resource allocation. > >> The GPIO address (0x6100-0x61FF) is available through PCI BAR 1 as seen in the output from pciconf(8): > >> > >> isab0@pci0:0:15:0: class=0x060100 card=0x20901022 chip=0x20901022 rev=0x03 hdr=0x00 > >> vendor = 'Advanced Micro Devices (AMD)' > >> device = 'CS5536 [Geode companion] ISA' > >> class = bridge > >> subclass = PCI-ISA > >> bar [10] = type I/O Port, range 32, base 0x6000, size 8, enabled > >> bar [14] = type I/O Port, range 32, base 0x6100, size 256, enabled > >> bar [18] = type I/O Port, range 32, base 0x6200, size 64, enabled > >> bar [20] = type I/O Port, range 32, base 0x9d00, size 128, enabled > >> bar [24] = type I/O Port, range 32, base 0x9c00, size 64, enabled > >> > >> However, when I try to allocate the I/O port resource in the minimalistic example below, I always get 0x1100-0x1100, not 0x6100-0x61FF? > >> > >> I have modelled the code after recommendation from John Baldwin in http://lists.freebsd.org/pipermail/freebsd-acpi/2007-August/003964.html but I must be doing something wrong... > > > > Ahh, I just re-read Johns recommendation and realized that isab does not support proxying resource allocations (yet). I will try adding that functionality and report back. > > I have a patch ready for allowing the PCI-ISA bridge to proxy SYS_RES_MEMORY and SYS_RES_IOPORT resource allocations from direct children to the parent PCI bus. > The patch is available from here: http://people.freebsd.org/~brix/src- patches/isa_pci.c.diff Yes, I think this looks good. > Comments are more than welcome. I am still trying to figure out how to allow children to allocate and setup interrupts through isab; any pointers to what needs to be done in that regard are also very welcome since I'm not having much luck with it so far... Well, it depends on where the interrupts come from. Is your device's interrupt actually tied to the INTx line or an MSI or MSI-X message on the ISA bridge? If so it will need to allocate the resource from the isab device. If your device is just using an ISA IRQ then you will probably need to use hints or some other method for figuring out which ISA IRQ your device is using. -- John Baldwin