From 26256b62334eabe85d3c21354aa54d287e1d35e5 Mon Sep 17 00:00:00 2001 From: ad Date: Sun, 30 Mar 2008 15:26:20 +0000 Subject: [PATCH] If SMBIOS is present and there seems to be good expansion slot info, note the number of ISA compatible slots. --- sys/arch/x86/include/smbiosvar.h | 18 ++++++++++++++++- sys/arch/x86/x86/platform.c | 34 +++++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/sys/arch/x86/include/smbiosvar.h b/sys/arch/x86/include/smbiosvar.h index 67f1859a159a..5f85e85ebf83 100644 --- a/sys/arch/x86/include/smbiosvar.h +++ b/sys/arch/x86/include/smbiosvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: smbiosvar.h,v 1.1 2006/10/01 18:37:55 bouyer Exp $ */ +/* $NetBSD: smbiosvar.h,v 1.2 2008/03/30 15:26:20 ad Exp $ */ /* * Copyright (c) 2006 Gordon Willem Klok * Copyright (c) 2005 Jordan Hargrave @@ -176,6 +176,22 @@ struct smbios_board { u_int8_t noc; /* number of contained objects */ } __packed; +/* + * SMBIOS Structure Type 9 "Expansion slot" + */ +struct smbios_slot { + uint8_t designation; + uint8_t type; + uint8_t width; + uint8_t usage; + uint8_t length; + uint8_t slotid[2]; + uint8_t characteristics[2]; +} __packed; + +#define SMBIOS_SLOT_ISA 0x03 +#define SMBIOS_SLOT_EISA 0x05 + /* * SMBIOS Structure Type 38 "IPMI Information" * DMTF Specification DSP0134 Section 3.3.39 p.g. 91 diff --git a/sys/arch/x86/x86/platform.c b/sys/arch/x86/x86/platform.c index 97ff53884e1b..92c5e4d62aaa 100644 --- a/sys/arch/x86/x86/platform.c +++ b/sys/arch/x86/x86/platform.c @@ -1,4 +1,4 @@ -/* $NetBSD: platform.c,v 1.3 2007/12/09 21:14:26 xtraeme Exp $ */ +/* $NetBSD: platform.c,v 1.4 2008/03/30 15:26:20 ad Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -32,8 +32,10 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "isa.h" + #include -__KERNEL_RCSID(0, "$NetBSD: platform.c,v 1.3 2007/12/09 21:14:26 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: platform.c,v 1.4 2008/03/30 15:26:20 ad Exp $"); #include #include @@ -41,6 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: platform.c,v 1.3 2007/12/09 21:14:26 xtraeme Exp $") #include #include +#include + #include void platform_init(void); /* XXX */ @@ -52,9 +56,10 @@ platform_init(void) { struct smbtable smbios; struct smbios_sys *psys; + struct smbios_slot *pslot; + int nisa, nother; smbios.cookie = 0; - if (smbios_find_table(SMBIOS_TYPE_SYSTEM, &smbios)) { psys = smbios.tblhdr; @@ -64,6 +69,29 @@ platform_init(void) platform_add(&smbios, "system-serial-number", psys->serial); } + smbios.cookie = 0; + nisa = 0; + nother = 0; + while (smbios_find_table(SMBIOS_TYPE_SLOTS, &smbios)) { + pslot = smbios.tblhdr; + switch (pslot->type) { + case SMBIOS_SLOT_ISA: + case SMBIOS_SLOT_EISA: + nisa++; + break; + default: + nother++; + break; + } + } + +#if NISA > 0 + if ((nother | nisa) != 0) { + /* Only if there seems to be good expansion slot info. */ + isa_set_slotcount(nisa); + } +#endif + platform_print(); }