[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-sparc
Subject:    Sun Blade 1000/2000 testers needed
From:       Mark Kettenis <mark.kettenis () xs4all ! nl>
Date:       2008-02-18 20:55:02
Message-ID: 200802182055.m1IKt20o018448 () brahms ! sibelius ! xs4all ! nl
[Download RAW message or body]

For some work robert@ and I are doing to control the fans on these
machines, I need a bit more information about what machines are out
there.  I'd like to ask people that have one (or a Sun Fire 280R or
Netra T4/20) to build a kernel with this diff and send me the
resulting dmesg.

I'm especially interested in machines that have CPUs running at higher
speeds than 750MHz.

Thanks,

Mark

Index: dev/fru.c
===================================================================
RCS file: dev/fru.c
diff -N dev/fru.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dev/fru.c	18 Feb 2008 20:49:27 -0000
@@ -0,0 +1,84 @@
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+
+#include <dev/i2c/i2cvar.h>
+
+struct fru_softc {
+	struct device	sc_dv;
+	i2c_tag_t	sc_tag;
+	i2c_addr_t	sc_addr;
+};
+
+int	fru_match(struct device *, void *, void *);
+void	fru_attach(struct device *, struct device *, void *);
+uint8_t	fru_read(struct fru_softc *, uint16_t);
+
+struct cfattach fru_ca = {
+	sizeof(struct fru_softc), fru_match, fru_attach
+};
+
+struct cfdriver fru_cd = {
+	NULL, "fru", DV_DULL
+};
+
+int
+fru_match(struct device *parent, void *match, void *aux)
+{
+	struct i2c_attach_args *ia = aux;
+
+	if (strcmp(ia->ia_name, "fru-prom") == 0)
+		return (1);
+	return (0);
+}
+
+void
+fru_attach(struct device *parent, struct device *self, void *aux)
+{
+	struct fru_softc *sc = (struct fru_softc *)self;
+	struct i2c_attach_args *ia = aux;
+	int nsegs, i;
+
+	sc->sc_tag = ia->ia_tag;
+	sc->sc_addr = ia->ia_addr;
+
+	if (fru_read(sc, 0x1800) != 8 ||
+	    fru_read(sc, 0x1801) != 0 ||
+	    fru_read(sc, 0x1802) != 1)
+		goto out;
+
+	printf(":");
+
+	nsegs = fru_read(sc, 0x1805);
+	for (i = 0; i < nsegs; i++) {
+		printf(" %c%c", fru_read(sc, 0x1806 + i * 10),
+		    fru_read(sc, 0x1806 + i * 10 + 1));
+		printf(" %02x%02x/%02x%02x",
+		    fru_read(sc, 0x1806 + i * 10 + 6),
+		    fru_read(sc, 0x1806 + i * 10 + 7),
+		    fru_read(sc, 0x1806 + i * 10 + 8),
+		    fru_read(sc, 0x1806 + i * 10 + 9));
+	}
+
+out:
+	printf("\n");
+}
+
+uint8_t
+fru_read(struct fru_softc *sc, uint16_t reg)
+{
+	uint8_t cmd[2];
+	uint8_t val;
+
+	iic_acquire_bus(sc->sc_tag, 0);
+
+	cmd[0] = reg >> 8;
+	cmd[1] = reg;
+	iic_exec(sc->sc_tag, I2C_OP_WRITE, sc->sc_addr, &cmd, 2, NULL, 0, 0);
+	iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, NULL, 0,
+	    &val, 1, 0);
+
+	iic_release_bus(sc->sc_tag, 0);
+
+	return val;
+}
Index: dev/ofwi2c.c
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/dev/ofwi2c.c,v
retrieving revision 1.8
diff -u -p -r1.8 ofwi2c.c
--- dev/ofwi2c.c	22 Oct 2007 23:55:58 -0000	1.8
+++ dev/ofwi2c.c	18 Feb 2008 20:49:27 -0000
@@ -84,13 +84,22 @@ ofwiic_scan(struct device *self, struct 
 			ia.ia_name += strlen("i2c-");
 
 		/* Skip non-SPD EEPROMs.  */
-		if (strcmp(ia.ia_name, "at24c64") == 0 ||
-		    strcmp(ia.ia_name, "at34c02") == 0) {
+		if (strcmp(ia.ia_name, "at34c02") == 0) {
 			if (OF_getprop(node, "name", name, sizeof(name)) == -1)
 				continue;
 			if (strcmp(name, "dimm") == 0 ||
 			    strcmp(name, "dimm-spd") == 0)
 				ia.ia_name = "spd";
+			else
+				continue;
+		}
+
+		if (strcmp(ia.ia_name, "at24c64") == 0) {
+			if (OF_getprop(node, "device_type",
+			    name, sizeof(name)) == -1)
+				continue;
+			if (strcmp(name, "fru-prom") == 0)
+				ia.ia_name = name;
 			else
 				continue;
 		}
Index: conf/GENERIC
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/conf/GENERIC,v
retrieving revision 1.193
diff -u -p -r1.193 GENERIC
--- conf/GENERIC	12 Feb 2008 10:32:47 -0000	1.193
+++ conf/GENERIC	18 Feb 2008 20:49:27 -0000
@@ -390,6 +390,7 @@ pcfadc*	at iic?				# Philips PCF8591 
 ecadc*	at iic?				# SUNW,envctrl temperature sensors
 spdmem* at iic?				# SPD memory eeproms
 #tda*	at iic?				# Philips TDA8444
+fru*	at iic?				# Atmel AT24C64
 
 # Framebuffers
 agten*		at sbus?		# Fujitsu AG-10e framebuffer
Index: conf/files.sparc64
===================================================================
RCS file: /cvs/src/sys/arch/sparc64/conf/files.sparc64,v
retrieving revision 1.94
diff -u -p -r1.94 files.sparc64
--- conf/files.sparc64	12 Feb 2008 10:12:14 -0000	1.94
+++ conf/files.sparc64	18 Feb 2008 20:49:27 -0000
@@ -316,6 +316,11 @@ device	tda
 attach	tda at i2c
 file	arch/sparc64/dev/tda.c			tda
 
+# AT24C64
+device	fru
+attach	fru at i2c
+file	arch/sparc64/dev/fru.c			fru
+
 #
 # Machine-independent GPIO drivers
 #

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic