From owner-freebsd-arch@FreeBSD.ORG Mon Jan 26 17:44:38 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A47DF16A4CE for ; Mon, 26 Jan 2004 17:44:38 -0800 (PST) Received: from root.org (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 74FBD43D46 for ; Mon, 26 Jan 2004 17:44:37 -0800 (PST) (envelope-from nate@root.org) Received: (qmail 30778 invoked by uid 1000); 27 Jan 2004 01:44:39 -0000 Date: Mon, 26 Jan 2004 17:44:39 -0800 (PST) From: Nate Lawson To: "M. Warner Losh" In-Reply-To: <20040126.183215.26531948.imp@bsdimp.com> Message-ID: <20040126174103.R30729@root.org> References: <20040126165523.W30461@root.org> <20040126.181720.15264443.imp@bsdimp.com> <20040126.183215.26531948.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: arch@freebsd.org Subject: Re: newbus ioport usage X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2004 01:44:38 -0000 On Mon, 26 Jan 2004, M. Warner Losh wrote: > In message: <20040126172211.J30603@root.org> > Nate Lawson writes: > : On Mon, 26 Jan 2004, M. Warner Losh wrote: > : > In message: <20040126165523.W30461@root.org> > : > Nate Lawson writes: > : > : Ok, I'm doing the set/alloc and it works. However, one weird thing. If I > : > : allocate all ports at boot time, it succeeds. My driver goes through > : > : multiple release/allocate cycles and it all works as expected. However if > : > : I boot and attach to only one of the registers, subsequent attempts to > : > : attach the second one fail. The resources are 2 IO ports, 0x101c and > : > : 0x101d. Both are 1 byte. > : > > : > Deos devinfo -r show any cause for the problem? Maybe you aren't > : > releasing them properly? Also, why not allocate them as a block of 2? > : > : I'll look into that. I can't allocate them in one block as they come and > : go, based on system state. In one state, one is available and in another, > : both are available. If I boot while only one is available and then you > : plug in the AC adapter, new ones appear. This is acpi, btw. > > Ummm, wouldn't they both always be allocated to the driver, even if > you could only talk to one of them at any given time? No, the object you evaluate for a list of registers changes dynamically at runtime. The _CST method returns one of the below objects, depending on AC adapter state. If you evaluate it at boot and get CST1, you have no info about CST2, which you might get later. Name (CST1, Package (0x02) { Package (0x04) { ResourceTemplate () { Register (FFixedHW, 0x08, 0x00, 0x0000000000000000) }, } }) Name (CST2, Package (0x03) { Package (0x04) { ResourceTemplate () { Register (FFixedHW, 0x08, 0x00, 0x0000000000000000) }, }, Package (0x04) { ResourceTemplate () { Register (SystemIO, 0x08, 0x00, 0x0000000000001014) }, } }) -Nate