Subject: Re: PnP weirdness
To: Michael Graff <explorer@flame.org>
From: Constantine Sapuntzakis <csapuntz@lcs.mit.edu>
List: tech-kern
Date: 07/29/1998 15:09:47
There was fix for this problem that just integrated into the OpenBSD source
tree. It involves disabling the ISA PNP cards before doing the legacy
ISA card scan.

Here's the code to disable the ISA PNP cards (at least for OpenBSD
2.3).

void
isapnp_isa_attach_hook(isa_sc)
        struct isa_softc *isa_sc;

{
        struct isapnp_softc sc;
        
        sc.sc_iot = isa_sc->sc_iot;
        sc.sc_ncards = 0;

        if (isapnp_map(&sc))
                return;

	/* Send LFSR sequence */
        isapnp_init(&sc);

	/* Reset cards */
        isapnp_write_reg(&sc, ISAPNP_CONFIG_CONTROL, ISAPNP_CC_RESET_DRV);
        DELAY(2000);

        isapnp_unmap(&sc);
}

Just call this function before you do the isa scan (e.g. from
isa_attach).

Hope this helps!

BTW, I had some problems with the ym (Yamaha OPL-3 SA3) driver too. I
couldn't access the extended registers - no matter what I did.

One idea: Is the ISA PNP assigning ports above 0x400? If so, then
maybe the address cycles never make it onto the ISA bus because of
PCI-ISA bridge? I though I read somewhere that PCI takes all I/O
addresses above 0x400.

-Costa

Michael Graff <explorer@flame.org> writes:

> Lennart Augustsson <augustss@cs.chalmers.se> writes:
> 
> > So what is supposed to happen when you claim to have a PnP aware OS?
> > Should BIOS stop configuring PCI devices?  That sounds like a
> > violation of the spec.
> 
> Bingo.
> 
> I think the whole "PnP aware OS" thing is a crock.  Either the BIOS
> does it, or every OS has to, and the BIOS is the right place for PCI,
> where it is hard to find cards that will conflict.
> 
> With ISA PnP, however, that tends to change...  Some BIOS cannot
> handle ISA PnP, while others do it wrong, ignore conflicting cards, etc.
> Some even do worse, and allow cards to conflict.
> 
> Do we need code to initialize a PCI bus?  Sure, it'd be cool, but not
> for machines with a firmware/BIOS that can do it.  Do we need code that
> will _correctly_ configure ISA PnP cards?  Yes.  Should our code _first_
> look at the BIOS configuration info?  Yes.  Do we do that?  No.
> 
> That is, for instance, why my PnP modem breaks.
> 
> The BIOS configures it at com2's address.  NetBSD finds it on the ISA
> bus (which it is, of course) at com2's address.  Then ISA PnP
> comes along and resets all the cards.  My modem is lame, and _has_ to be
> at com2's address.  So, ISA PnP fails to configure it -- something else
> is already there -- and now the modem is in a reset state, and any access
> to /dev/tty01 (say, the ttyflags in /etc/rc) locks the machine up tight.
> 
> --Michael