summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2005-11-22 21:51:20 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2005-11-22 21:51:20 +0000
commit50a8c02612cfc366a87ee461248b6ac58a7f97b6 (patch)
tree388c18c1f761df92064f2b39f33c22b329055474
parentb893974d38f04fd8cc11e1d33947b85c26721301 (diff)
Added probing for Dell ESM server
ok marco@
-rw-r--r--sys/arch/i386/i386/esm.c56
-rw-r--r--sys/arch/i386/i386/esmreg.h25
2 files changed, 75 insertions, 6 deletions
diff --git a/sys/arch/i386/i386/esm.c b/sys/arch/i386/i386/esm.c
index 13a44201154..5437d60c9fe 100644
--- a/sys/arch/i386/i386/esm.c
+++ b/sys/arch/i386/i386/esm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: esm.c,v 1.10 2005/11/22 13:50:31 dlg Exp $ */
+/* $OpenBSD: esm.c,v 1.11 2005/11/22 21:51:19 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -26,12 +26,14 @@
#include <sys/queue.h>
#include <sys/sensors.h>
+#include <dev/isa/isareg.h>
#include <machine/bus.h>
-#include <arch/i386/i386/esmreg.h>
#include <arch/i386/i386/esmvar.h>
+#include <arch/i386/i386/esmreg.h>
+#include <arch/i386/isa/isa_machdep.h>
-#define ESM_DEBUG
+/* #define ESM_DEBUG */
#ifdef ESM_DEBUG
#define DPRINTF(x...) do { if (esmdebug) printf(x); } while (0)
@@ -42,6 +44,7 @@ int esmdebug = 2;
#define DPRINTFN(n,x...) /* n: x */
#endif
+int esm_probe(void);
int esm_match(struct device *, void *, void *);
void esm_attach(struct device *, struct device *, void *);
@@ -111,13 +114,56 @@ int esm_smb_cmd(struct esm_softc *, struct esm_smb_req *,
int64_t esm_val2temp(u_int16_t);
int64_t esm_val2volts(u_int16_t);
+
+/* Determine if this is a Dell server */
+int
+esm_probe(void)
+{
+ const char *pdellstr;
+ struct dell_sysid *pdellid;
+ uint16_t sysid;
+
+ pdellstr = (const char *)ISA_HOLE_VADDR(DELL_SYSSTR_ADDR);
+ DPRINTF("Dell String: %s\n", pdellstr);
+ if (strncmp(pdellstr, "Dell System", 11))
+ return (0);
+
+ pdellid = (struct dell_sysid *)ISA_HOLE_VADDR(DELL_SYSID_ADDR);
+ if ((sysid = pdellid->sys_id) == DELL_SYSID_EXT)
+ sysid = pdellid->ext_id;
+ DPRINTF("SysId: %x\n", sysid);
+
+ switch(sysid) {
+ case DELL_SYSID_2300:
+ case DELL_SYSID_4300:
+ case DELL_SYSID_4350:
+ case DELL_SYSID_6300:
+ case DELL_SYSID_6350:
+ case DELL_SYSID_2400:
+ case DELL_SYSID_2450:
+ case DELL_SYSID_4400:
+ case DELL_SYSID_6400:
+ case DELL_SYSID_6450:
+ case DELL_SYSID_2500:
+ case DELL_SYSID_2550:
+ return (1);
+ default:
+ return (0);
+ }
+
+ /* NOTREACHED */
+ return (0);
+}
+
int
esm_match(struct device *parent, void *match, void *aux)
{
struct esm_attach_args *eaa = aux;
- if (strncmp(eaa->eaa_name, esm_cd.cd_name,
- sizeof(esm_cd.cd_name)) == 0)
+ if (!esm_probe())
+ return (0);
+
+ if (strncmp(eaa->eaa_name, esm_cd.cd_name, sizeof(esm_cd.cd_name)) == 0)
return (1);
return (0);
diff --git a/sys/arch/i386/i386/esmreg.h b/sys/arch/i386/i386/esmreg.h
index ded8736e623..6057d694a26 100644
--- a/sys/arch/i386/i386/esmreg.h
+++ b/sys/arch/i386/i386/esmreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: esmreg.h,v 1.2 2005/11/21 22:05:36 marco Exp $ */
+/* $OpenBSD: esmreg.h,v 1.3 2005/11/22 21:51:19 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -67,6 +67,29 @@
#define ESM2_MAX_CMD_LEN 0x20
#define ESM2_UUID_LEN 0x08
+#define DELL_SYSSTR_ADDR 0xFE076L
+#define DELL_SYSID_ADDR 0xFE840L
+#define DELL_SYSID_2300 0x81
+#define DELL_SYSID_4300 0x7C
+#define DELL_SYSID_4350 0x84
+#define DELL_SYSID_6300 0x7F
+#define DELL_SYSID_6350 0x83
+#define DELL_SYSID_2400 0x9B
+#define DELL_SYSID_2450 0xA6
+#define DELL_SYSID_4400 0x9A
+#define DELL_SYSID_6400 0x9C
+#define DELL_SYSID_6450 0xA2
+#define DELL_SYSID_2500 0xD9
+#define DELL_SYSID_2550 0xD1
+#define DELL_SYSID_EXT 0xFE
+
+struct dell_sysid
+{
+ uint16_t ext_id;
+ uint8_t bios_ver[3];
+ uint8_t sys_id;
+} __packed;
+
struct esm_watchdog_prop {
u_int8_t cmd;
u_int8_t reserved;