Fix nexus_pcib_is_host_bridge() so that it detects my 486's PCI bus

correctly. It has the following code:

        if (class != PCIC_BRIDGE || subclass != PCIS_BRIDGE_HOST)
                return NULL;

My 486 has an Integrated Micro Solutions PCI bridge which identifies
itself as subclass PCIS_BRIDGE_OTHER, not PCIS_BRIDGE_HOST. Consequently,
it gets ignored. In my opinion, the correct test should be:

        if ((class != PCIC_BRIDGE) && (subclass != PCIS_BRIDGE_HOST))
                return NULL;

That way the test still succeeds because the chip's class is PCIC_BRIDGE.
Clearly it's not reasonable to expect all host to PCI bridges to always
have a subclass of PCIS_BRIDGE_HOST since I've got one that doesn't.
This way the sanity test should remain relatively sane while still allowing
some oddball yet correct hardware to work. If somebody has a better way
to do it, go ahead and tweak the test, but be aware that
class == PCIC_BRIDGE and subclass == PCIS_BRIDGE_OTHER is a valid case.

While I was here, I also added an explicit ID string for the IMS chipset.
I also dealt with a minor style nit: it's bad karma not to have a default
case for your switch statements, but the one in this routine doesn't have
one. The default string of "Host to PCI bridge" is now assigned in a
default case of the switch statement instead of initializing "s" with the
string before the switch and then not having any default case.
This commit is contained in:
wpaul 1999-08-09 21:12:18 +00:00
parent 674e3eeff5
commit f99d644811
6 changed files with 54 additions and 18 deletions

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: pcibus.c,v 1.43 1999/07/16 01:00:29 msmith Exp $
* $Id: pcibus.c,v 1.44 1999/08/04 13:38:24 peter Exp $
*
*/
@ -274,10 +274,10 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
u_int32_t id, u_int8_t class, u_int8_t subclass,
u_int8_t *busnum)
{
const char *s = "Host to PCI bridge";
const char *s = NULL;
static u_int8_t pxb[4]; /* hack for 450nx */
if (class != PCIC_BRIDGE || subclass != PCIS_BRIDGE_HOST)
if ((class != PCIC_BRIDGE) && (subclass != PCIS_BRIDGE_HOST))
return NULL;
*busnum = 0;
@ -395,6 +395,12 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
/* just guessing the secondary bus register number ... */
*busnum = pci_cfgread(cfg, 0x45, 1);
break;
case 0x884910e0:
s = "Integrated Micro Solutions VL Bridge";
break;
default:
s = "Host to PCI bridge";
break;
}
return s;

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: pcibus.c,v 1.43 1999/07/16 01:00:29 msmith Exp $
* $Id: pcibus.c,v 1.44 1999/08/04 13:38:24 peter Exp $
*
*/
@ -274,10 +274,10 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
u_int32_t id, u_int8_t class, u_int8_t subclass,
u_int8_t *busnum)
{
const char *s = "Host to PCI bridge";
const char *s = NULL;
static u_int8_t pxb[4]; /* hack for 450nx */
if (class != PCIC_BRIDGE || subclass != PCIS_BRIDGE_HOST)
if ((class != PCIC_BRIDGE) && (subclass != PCIS_BRIDGE_HOST))
return NULL;
*busnum = 0;
@ -395,6 +395,12 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
/* just guessing the secondary bus register number ... */
*busnum = pci_cfgread(cfg, 0x45, 1);
break;
case 0x884910e0:
s = "Integrated Micro Solutions VL Bridge";
break;
default:
s = "Host to PCI bridge";
break;
}
return s;

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: pcibus.c,v 1.43 1999/07/16 01:00:29 msmith Exp $
* $Id: pcibus.c,v 1.44 1999/08/04 13:38:24 peter Exp $
*
*/
@ -274,10 +274,10 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
u_int32_t id, u_int8_t class, u_int8_t subclass,
u_int8_t *busnum)
{
const char *s = "Host to PCI bridge";
const char *s = NULL;
static u_int8_t pxb[4]; /* hack for 450nx */
if (class != PCIC_BRIDGE || subclass != PCIS_BRIDGE_HOST)
if ((class != PCIC_BRIDGE) && (subclass != PCIS_BRIDGE_HOST))
return NULL;
*busnum = 0;
@ -395,6 +395,12 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
/* just guessing the secondary bus register number ... */
*busnum = pci_cfgread(cfg, 0x45, 1);
break;
case 0x884910e0:
s = "Integrated Micro Solutions VL Bridge";
break;
default:
s = "Host to PCI bridge";
break;
}
return s;

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: pcibus.c,v 1.43 1999/07/16 01:00:29 msmith Exp $
* $Id: pcibus.c,v 1.44 1999/08/04 13:38:24 peter Exp $
*
*/
@ -274,10 +274,10 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
u_int32_t id, u_int8_t class, u_int8_t subclass,
u_int8_t *busnum)
{
const char *s = "Host to PCI bridge";
const char *s = NULL;
static u_int8_t pxb[4]; /* hack for 450nx */
if (class != PCIC_BRIDGE || subclass != PCIS_BRIDGE_HOST)
if ((class != PCIC_BRIDGE) && (subclass != PCIS_BRIDGE_HOST))
return NULL;
*busnum = 0;
@ -395,6 +395,12 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
/* just guessing the secondary bus register number ... */
*busnum = pci_cfgread(cfg, 0x45, 1);
break;
case 0x884910e0:
s = "Integrated Micro Solutions VL Bridge";
break;
default:
s = "Host to PCI bridge";
break;
}
return s;

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: pcibus.c,v 1.43 1999/07/16 01:00:29 msmith Exp $
* $Id: pcibus.c,v 1.44 1999/08/04 13:38:24 peter Exp $
*
*/
@ -274,10 +274,10 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
u_int32_t id, u_int8_t class, u_int8_t subclass,
u_int8_t *busnum)
{
const char *s = "Host to PCI bridge";
const char *s = NULL;
static u_int8_t pxb[4]; /* hack for 450nx */
if (class != PCIC_BRIDGE || subclass != PCIS_BRIDGE_HOST)
if ((class != PCIC_BRIDGE) && (subclass != PCIS_BRIDGE_HOST))
return NULL;
*busnum = 0;
@ -395,6 +395,12 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
/* just guessing the secondary bus register number ... */
*busnum = pci_cfgread(cfg, 0x45, 1);
break;
case 0x884910e0:
s = "Integrated Micro Solutions VL Bridge";
break;
default:
s = "Host to PCI bridge";
break;
}
return s;

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: pcibus.c,v 1.43 1999/07/16 01:00:29 msmith Exp $
* $Id: pcibus.c,v 1.44 1999/08/04 13:38:24 peter Exp $
*
*/
@ -274,10 +274,10 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
u_int32_t id, u_int8_t class, u_int8_t subclass,
u_int8_t *busnum)
{
const char *s = "Host to PCI bridge";
const char *s = NULL;
static u_int8_t pxb[4]; /* hack for 450nx */
if (class != PCIC_BRIDGE || subclass != PCIS_BRIDGE_HOST)
if ((class != PCIC_BRIDGE) && (subclass != PCIS_BRIDGE_HOST))
return NULL;
*busnum = 0;
@ -395,6 +395,12 @@ nexus_pcib_is_host_bridge(pcicfgregs *cfg,
/* just guessing the secondary bus register number ... */
*busnum = pci_cfgread(cfg, 0x45, 1);
break;
case 0x884910e0:
s = "Integrated Micro Solutions VL Bridge";
break;
default:
s = "Host to PCI bridge";
break;
}
return s;