From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 11 16:40:59 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 9537B16A401 for ; Wed, 11 Apr 2007 16:40:59 +0000 (UTC) (envelope-from craig@tobuj.gank.org) Received: from ion.gank.org (ion.gank.org [69.55.238.164]) by mx1.freebsd.org (Postfix) with ESMTP id 87AFD13C483 for ; Wed, 11 Apr 2007 16:40:52 +0000 (UTC) (envelope-from craig@tobuj.gank.org) Received: by ion.gank.org (Postfix, from userid 1001) id 47C6110E8F; Wed, 11 Apr 2007 11:40:52 -0500 (CDT) Date: Wed, 11 Apr 2007 11:40:50 -0500 From: Craig Boston To: Alan Garfield Message-ID: <20070411164050.GD60020@nowhere> Mail-Followup-To: Craig Boston , Alan Garfield , hackers@freebsd.org References: <200704110951.l3B9p4hT024402@sana.init-main.com> <461CCB3D.1090402@fromorbit.com> <20070411140214.GA60020@nowhere> <1176302227.5057.12.camel@hiro.auspc.com.au> <20070411153703.GC60020@nowhere> <1176308551.5949.7.camel@hiro.auspc.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1176308551.5949.7.camel@hiro.auspc.com.au> User-Agent: Mutt/1.4.2.2i Cc: 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 16:40:59 -0000 On Thu, Apr 12, 2007 at 02:22:31AM +1000, Alan Garfield wrote: > ---- > jnet0: port 0xa8,0xae-0xaf irq 19 on acpi0 > jnet0: alloc io port: 00a8 size: 1 > jnet0: alloc io port: 00ae size: 2 > jnet0: Ethernet address: 00:09:3d:00:00:03 > ---- Looks like it's on the right track, glad I could help! > Looking at this all now it's kind of obvious how it works but until you > gave me the break I was neck deep in confusion. Looking back at the thread I see that you're porting a Linux driver, that explains a lot of the confusion. It's been a while since I've worked with the Linux kernel in depth, but I seem to remember that a lot of drivers (especially machine-specific ones) would get the resource directly, e.g. IO port base address, and then do stuff like outb(base_addr + offset, value); value = inb(base_addr + offset); or write to mapped memory directly by constructing a pointer to the address. While doing this is possible in FreeBSD, it's discouraged as the bus_space API tends to make for cleaner code and is also more portable. On architectures with peculiar alignment requirements, or other restrictions (DMA buffers having to be below a particular address comes to mind, or bounce buffers for PAE), the OS will take care of most of the nitty gritty details for you and allow the driver to contain higher-level code. Craig