If SMBIOS is present and there seems to be good expansion slot info,

note the number of ISA compatible slots.
This commit is contained in:
ad 2008-03-30 15:26:20 +00:00
parent cad7ab7809
commit 26256b6233
2 changed files with 48 additions and 4 deletions

View File

@ -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 <gklok@cogeco.ca>
* 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

View File

@ -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 <jmcneill@invisible.ca>
@ -32,8 +32,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "isa.h"
#include <sys/cdefs.h>
__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 <sys/types.h>
#include <sys/param.h>
@ -41,6 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: platform.c,v 1.3 2007/12/09 21:14:26 xtraeme Exp $")
#include <sys/kernel.h>
#include <sys/pmf.h>
#include <dev/isa/isavar.h>
#include <arch/x86/include/smbiosvar.h>
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();
}