Subject: Re: 3Com ep0
To: None <tech-smp@netbsd.org>
From: David Laight <David.Laight@btinternet.com>
List: tech-smp
Date: 12/08/2001 21:05:54
Surely the 'fix' below is incorrect!
Something deeper must be happening - in particular irq allocated elsewhere
should not be allocated to isa pnp devices.
A quick squint at the netBSD isapnp code makes it appear to be doing
all the isapnp resource allocation itself, rather than relying on
the allocation done by the BIOS (assuming we are on a PC).
IMHO this is a good way to get resource comflicts with the PCI and EISA
buses - unless we can guarantee that this grope is being done after
all the device that use fixed irq numbers have been initialised.
Now, provided it is new enough, the BIOS will have allocated resource
to all isa pnp cards that have the 'required for boot' bit set. Also,
unless the 'I'm running windows 95' option (1) in the bios config is set,
to all the other pnp devices as well. In this case the cards already
has suitable values, all the kernel has to do is read the base address
registers (oh and parse the TLD to get the lengths...)
It looks to me as though netbsd isn't excluding 'allocated' irq from those
it is willing to assign to the isapnp card.
I also recall that some systems (eg multi-cpu pentium pro ones with multiple
ioapic) have the PCI and ISA irq routing completely separate. The BIOS
allocates some IRQ to the ISA bus, and others to the PCI bus. Unless the
OS knows how to reprogram this part of the hardware, it must use the IRQ
allocation that the BIOS setup.
The only difficulty in reading the ISA PNP config registers is that I never
did find out how to get the 'read data port' used by the BIOS. Not a big
problem provided you are never going to ask the BIOS to do anything to ISA
pnp cards later.
(I sorted this lot out getting AMD PcNet-ISA cards to work under a Unix
that didn't know about isa pnp)
David
(1) Unually labelled 'plug and play aware OS'
>
> On 01-Dec-2001 Christos Zoulas <christos@zoulas.com> wrote:
> > never finished it. You can put a hack in isapnp.c
>
> i did:
>
> noud# cat isapnp.c.diff
> --- isapnp.c Sat Dec 1 23:19:33 2001
> +++ isapnp.c.new Sat Dec 8 20:34:07 2001
> @@ -268,6 +268,7 @@
>
> if (isa_intr_alloc(ic, ISAPNP_ALLOC_INTR_MASK & i->bits,
> i->type, &irq) == 0) {
> + if (irq == 3) irq = 5;
> i->num = irq;
> return 0;
> }
> noud#
>
> now my card lives at 5 and comm is on again:
>
> com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
> ep0 at isapnp0 port 0x210/16 irq 5
> ep0: 3Com 3C509B EtherLink III
>
> thanx for pointing me toward bestconfig() in sys/dev/isapnp/isapnp.c
> Christos!
>
> (still puzzles me: GENERIC does the good thing and GENERIC.MP gave irq 3)
> ~n
>
>
> --
> ----------------------------------
> ## UNIX is an abbreviation ##
> ----------------------------------