Date: Wed, 11 Apr 2007 11:40:50 -0500 From: Craig Boston <craig@tobuj.gank.org> To: Alan Garfield <alan@fromorbit.com> Cc: hackers@freebsd.org Subject: Re: Resources and ACPI Message-ID: <20070411164050.GD60020@nowhere> In-Reply-To: <1176308551.5949.7.camel@hiro.auspc.com.au> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 12, 2007 at 02:22:31AM +1000, Alan Garfield wrote: > ---- > jnet0: <JNet Ethernet Interface> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070411164050.GD60020>