Sun Jan 22 10:36:52 2012 UTC ()
Add "dimm" found on Sun US-IIe based machines (eg. Netra X1, Blade 100).


(nakayama)
diff -r1.3 -r1.4 src/sys/dev/i2c/spdmem_i2c.c

cvs diff -r1.3 -r1.4 src/sys/dev/i2c/spdmem_i2c.c (expand / switch to unified diff)

--- src/sys/dev/i2c/spdmem_i2c.c 2011/10/02 19:03:56 1.3
+++ src/sys/dev/i2c/spdmem_i2c.c 2012/01/22 10:36:52 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: spdmem_i2c.c,v 1.3 2011/10/02 19:03:56 jmcneill Exp $ */ 1/* $NetBSD: spdmem_i2c.c,v 1.4 2012/01/22 10:36:52 nakayama Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007 Nicolas Joly 4 * Copyright (c) 2007 Nicolas Joly
5 * Copyright (c) 2007 Paul Goyette 5 * Copyright (c) 2007 Paul Goyette
6 * Copyright (c) 2007 Tobias Nygren 6 * Copyright (c) 2007 Tobias Nygren
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE. 30 * POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33/* 33/*
34 * Serial Presence Detect (SPD) memory identification 34 * Serial Presence Detect (SPD) memory identification
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.3 2011/10/02 19:03:56 jmcneill Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: spdmem_i2c.c,v 1.4 2012/01/22 10:36:52 nakayama Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/endian.h> 42#include <sys/endian.h>
43#include <sys/module.h> 43#include <sys/module.h>
44#include <sys/sysctl.h> 44#include <sys/sysctl.h>
45#include <machine/bswap.h> 45#include <machine/bswap.h>
46 46
47#include <dev/i2c/i2cvar.h> 47#include <dev/i2c/i2cvar.h>
48#include <dev/ic/spdmemreg.h> 48#include <dev/ic/spdmemreg.h>
49#include <dev/ic/spdmemvar.h> 49#include <dev/ic/spdmemvar.h>
50 50
51/* Constants for matching i2c bus address */ 51/* Constants for matching i2c bus address */
@@ -67,27 +67,28 @@ CFATTACH_DECL_NEW(spdmem_iic, sizeof(str @@ -67,27 +67,28 @@ CFATTACH_DECL_NEW(spdmem_iic, sizeof(str
67 67
68static uint8_t spdmem_i2c_read(struct spdmem_softc *, uint8_t); 68static uint8_t spdmem_i2c_read(struct spdmem_softc *, uint8_t);
69 69
70SYSCTL_SETUP_PROTO(sysctl_spdmem_setup); 70SYSCTL_SETUP_PROTO(sysctl_spdmem_setup);
71 71
72static int 72static int
73spdmem_i2c_match(device_t parent, cfdata_t match, void *aux) 73spdmem_i2c_match(device_t parent, cfdata_t match, void *aux)
74{ 74{
75 struct i2c_attach_args *ia = aux; 75 struct i2c_attach_args *ia = aux;
76 struct spdmem_i2c_softc sc; 76 struct spdmem_i2c_softc sc;
77 77
78 if (ia->ia_name) { 78 if (ia->ia_name) {
79 /* add other names as we find more firmware variations */ 79 /* add other names as we find more firmware variations */
80 if (strcmp(ia->ia_name, "dimm-spd")) 80 if (strcmp(ia->ia_name, "dimm-spd") &&
 81 strcmp(ia->ia_name, "dimm"))
81 return 0; 82 return 0;
82 } 83 }
83 84
84 /* only do this lame test when not using direct config */ 85 /* only do this lame test when not using direct config */
85 if (ia->ia_name == NULL) { 86 if (ia->ia_name == NULL) {
86 if ((ia->ia_addr & SPDMEM_I2C_ADDRMASK) != SPDMEM_I2C_ADDR) 87 if ((ia->ia_addr & SPDMEM_I2C_ADDRMASK) != SPDMEM_I2C_ADDR)
87 return 0; 88 return 0;
88 } 89 }
89 90
90 sc.sc_tag = ia->ia_tag; 91 sc.sc_tag = ia->ia_tag;
91 sc.sc_addr = ia->ia_addr; 92 sc.sc_addr = ia->ia_addr;
92 sc.sc_base.sc_read = spdmem_i2c_read; 93 sc.sc_base.sc_read = spdmem_i2c_read;
93 94