Subject: re: user mode hw io access program: some progress made
To: None <port-i386@netbsd.org>
From: Peter L. Peres <plp@actcom.co.il>
List: port-i386
Date: 12/23/2004 20:10:40
I have managed to port my program using -li386 and raw io 
(i386_get_ioperm, i386_set_ioperm and then raw io using inw() outw() and 
inb() outb() - which are defined in <machine/io.h> and used in 
<machine/bus.h>, and i386_get_ioperm/setioperm which are from libi386). 
/dev/io is not configured on the dafult 1.6.1 kernel build. My program 
works nicely but:

set_ioperm on bits owned by another driver does not return an error. 
F.ex. i386_set_ioperm on 0x378 sets correctly although lp0 is configured 
at the same address. (dmesg: lpt0 at isa0 port 0x378-0x37b irq 7)

Then I can read the port but when I write to it I get a bus fault (as 
expected). Shouldn't the kernel prevent ioperm on a region already owned 
by something else (like lpt0 in this case) ? The current situation is 
good for me, as I can poll bits without disturbing the hardware and the 
driver, but this may not be good in other cases. What is the policy on 
this ? Will this behavior change ?

And, related to this, what is the 'approved' way to prevent the loading 
of a driver at boot time (f.ex. lpt0 as above), and more specifically, 
to unload it at runtime if possible. I have not yet looked into the 
details so I am just asking here first.

tia,
Peter