diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-12-27 22:14:24 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-12-27 22:14:24 +0000 |
commit | a2ce9c316a7e9d2acfa3382fbe302b2e17e77913 (patch) | |
tree | 04429084ea297843763adf83babb071b36884d1c /sys | |
parent | b1254e6f3115116fbfd32be74ae3f00983c238f6 (diff) |
if too many of the early regs on a adm1021 are zero, it cannot be one..
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/i2c/i2c_scan.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/i2c/i2c_scan.c b/sys/dev/i2c/i2c_scan.c index 0be2c6123d0..99a44bd2a39 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.26 2005/12/27 21:51:03 deraadt Exp $ */ +/* $OpenBSD: i2c_scan.c,v 1.27 2005/12/27 22:14:23 deraadt Exp $ */ /* * Copyright (c) 2005 Alexander Yurchenko <grange@openbsd.org> @@ -186,17 +186,24 @@ xeonprobe(u_int8_t addr) if (addr == 0x18 || addr == 0x1a || addr == 0x29 || addr == 0x2b || addr == 0x4c || addr == 0x4e) { u_int8_t reg, val; + int zero = 0; - for (reg = 0x00; reg < 0x09; reg++) + for (reg = 0x00; reg < 0x09; reg++) { if (probe(reg) == 0xff) return (NULL); + if (probe(reg) == 0) + zero++; + } + if (zero > 8) + return (NULL); val = probe(0x09); - for (reg = 0x0a; reg < 0xfe; reg++) + for (reg = 0x0a; reg < 0xfe; reg++) { if (probe(reg) != val) return (NULL); + } + /* 0xfe may be maxim, or some other vendor */ if (probe(0xfe) == 0x4d) return ("maxim1617"); - /* 0xfe may be maxim, or some other vendor */ return ("xeontemp"); } return (NULL); |