Subject: PnP weirdness
To: None <tech-kern@NetBSD.ORG>
From: Lennart Augustsson <augustss@cs.chalmers.se>
List: tech-kern
Date: 07/29/1998 13:50:18
Are there are PnP wizards out there?  I've got a problem.

I'm trying to get a CS4236B sound chip to work.  It sits
on an Intel motherboard and attaches via PnP.

The isapnp code finds the card with no problem and if there
is no driver to attach it says:

isapnp0: <CS4236B, CSC000, ,WSS/SB> port 0x534/4,0x388/4,0x220/16 irq 5 drq 1,0

which is exactly right.  But when the wss driver tries to attach to
the card there is no response at 0x534-0x537.  No life, nothing.

You can get it to work just fine if you access I/O address 0x534
with inb(0x534) BEFORE any isapnp code runs.

Here's part of the isapnp probe routine:

	if (isapnp_map(&sc))
		return 0;
                                        <- inb(0x534) here works
	rv = isapnp_find(&sc, 0);
                                        <- inb(0x534) here does not work
	ia->ia_iobase = ISAPNP_ADDR;
	ia->ia_iosize = 1;

By inserting the inb() early enough the card responds perfectly
at the address at which the isapnp code has configured it.

I don't know, but I suspect that it has to do with BIOS configuring
the card before NetBSD does.  Furthermore the CS4236B emulates
both SB and WSS and access to either port range makes it flip
emulation mode.

So, is this a buggy PnP chip (CS4237 has the same problem)?
Buggy PnP code in NetBSD?  Or what?  Any suggestion on
how to fix this problem are welcome.  (No, I don't want
random inb() sprinkled in my code. :-)

        -- Lennart