summaryrefslogtreecommitdiff
path: root/sys/dev/i2c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2005-12-24 22:08:18 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2005-12-24 22:08:18 +0000
commit76321b6afb30361768e0605d340eca7d4aa85f8e (patch)
treecf17a6170e182248902392e57064370d4fdb1dca /sys/dev/i2c
parentd2dcd87a01aaff97e11789e84567c14f9104b6a9 (diff)
handle embedded xeon temperature probes. yes, you got it -- i2c wires
coming off the processor... for an embedded adm1021 on the chip. only the "external" temperature is valid, the other one is disabled.
Diffstat (limited to 'sys/dev/i2c')
-rw-r--r--sys/dev/i2c/adm1021.c7
-rw-r--r--sys/dev/i2c/i2c_scan.c32
2 files changed, 36 insertions, 3 deletions
diff --git a/sys/dev/i2c/adm1021.c b/sys/dev/i2c/adm1021.c
index 3d4924a55ed..3f7e223b61a 100644
--- a/sys/dev/i2c/adm1021.c
+++ b/sys/dev/i2c/adm1021.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1021.c,v 1.3 2005/12/24 19:41:45 deraadt Exp $ */
+/* $OpenBSD: adm1021.c,v 1.4 2005/12/24 22:08:17 deraadt Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -63,7 +63,8 @@ admtemp_match(struct device *parent, void *match, void *aux)
{
struct i2c_attach_args *ia = aux;
- if (strcmp(ia->ia_name, "adm1021") == 0) {
+ if (strcmp(ia->ia_name, "adm1021") == 0 ||
+ strcmp(ia->ia_name, "xeon") == 0) {
/*
* should also ensure that
* config & 0x80 == 0x00
@@ -113,6 +114,8 @@ admtemp_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sensor[ADMTEMP_INT].type = SENSOR_TEMP;
strlcpy(sc->sc_sensor[ADMTEMP_INT].desc, "Internal",
sizeof(sc->sc_sensor[ADMTEMP_INT].desc));
+ if (ia->ia_name && strcmp(ia->ia_name, "xeon") == 0)
+ sc->sc_sensor[ADMTEMP_INT].flags |= SENSOR_FINVALID;
sc->sc_sensor[ADMTEMP_EXT].type = SENSOR_TEMP;
strlcpy(sc->sc_sensor[ADMTEMP_EXT].desc, "External",
diff --git a/sys/dev/i2c/i2c_scan.c b/sys/dev/i2c/i2c_scan.c
index 33bd9ad886c..c5a42d61374 100644
--- a/sys/dev/i2c/i2c_scan.c
+++ b/sys/dev/i2c/i2c_scan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i2c_scan.c,v 1.13 2005/12/24 19:33:40 deraadt Exp $ */
+/* $OpenBSD: i2c_scan.c,v 1.14 2005/12/24 22:08:17 deraadt Exp $ */
/*
* Copyright (c) 2005 Alexander Yurchenko <grange@openbsd.org>
@@ -62,6 +62,8 @@ void iic_probe(struct device *, struct i2cbus_attach_args *, u_int8_t);
struct {
u_int8_t start, end;
} probe_addrs[] = {
+ { 0x18, 0x18 },
+ { 0x1a, 0x1a },
{ 0x20, 0x2f },
{ 0x48, 0x4f }
};
@@ -171,6 +173,30 @@ lm75probe(void)
return (1);
}
+#ifdef __i386__
+static int xeonprobe(u_int8_t);
+
+static int
+xeonprobe(u_int8_t addr)
+{
+ if (addr == 0x18 || addr == 0x1a || addr == 0x29 ||
+ addr == 0x2b || addr == 0x4c || addr == 0x4e) {
+ int reg;
+
+ for (reg = 0x00; reg < 0x09; reg++)
+ if (probe(reg) == 0xff)
+ return (0);
+ for (reg = 0x09; reg < 0xff; reg++)
+ if (probe(reg) != 0xff)
+ return (0);
+ return (1);
+ }
+ return (0);
+}
+#endif
+
+
+
void
iic_probe(struct device *self, struct i2cbus_attach_args *iba, u_int8_t addr)
{
@@ -257,7 +283,11 @@ iic_probe(struct device *self, struct i2cbus_attach_args *iba, u_int8_t addr)
name = "as99127f";
} else if ((addr & 0xfc) == 0x48 && lm75probe()) {
name = "lm75";
+#ifdef __i386__
+ } else if (xeonprobe(addr)) {
+ name = "xeon";
}
+#endif
printf("%s: addr 0x%x", self->dv_xname, addr);
// for (i = 0; i < sizeof(probereg); i++)