Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 In device_register(), if the device is an "...



details:   https://anonhg.NetBSD.org/src/rev/1b4fad891a02
branches:  trunk
changeset: 362407:1b4fad891a02
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Jun 07 13:35:31 2018 +0000

description:
In device_register(), if the device is an "iic" child of "imcsmb",
attach a I2C_PROP_INDIRECT_DEVICE_WHITELIST property that limits
the allowed devices to "spdmem" and "sdtemp".  Also set the
I2C_PROP_INDIRECT_PROBE_STRATEGY property to I2C_PROBE_STRATEGY_NONE,
since that controller can't issue any of the "quick" commands.

XXX It would be nice to be able to do this in the imcsmb driver
itself, but the way autoconfiguration works makes that infeasible.

diffstat:

 sys/arch/x86/x86/x86_autoconf.c |  36 ++++++++++++++++++++++++++++++++++--
 1 files changed, 34 insertions(+), 2 deletions(-)

diffs (64 lines):

diff -r 8461b8373aa3 -r 1b4fad891a02 sys/arch/x86/x86/x86_autoconf.c
--- a/sys/arch/x86/x86/x86_autoconf.c   Thu Jun 07 13:30:49 2018 +0000
+++ b/sys/arch/x86/x86/x86_autoconf.c   Thu Jun 07 13:35:31 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: x86_autoconf.c,v 1.76 2017/11/09 01:02:56 christos Exp $       */
+/*     $NetBSD: x86_autoconf.c,v 1.77 2018/06/07 13:35:31 thorpej Exp $        */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.76 2017/11/09 01:02:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.77 2018/06/07 13:35:31 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +54,8 @@
 #include <machine/bootinfo.h>
 #include <machine/pio.h>
 
+#include <dev/i2c/i2cvar.h>
+
 #include "acpica.h"
 #include "wsdisplay.h"
 
@@ -547,6 +549,36 @@
 {
        device_t isaboot, pciboot;
 
+       /*
+        * The Intel Integrated Memory Controller has a built-in i2c
+        * controller that's rather limited in capability; it is intended
+        * only for reading memory module EERPOMs and sensors.
+        */
+       if (device_is_a(dev, "iic") &&
+           device_is_a(dev->dv_parent, "imcsmb")) {
+               static const char *imcsmb_device_whitelist[] = {
+                       "spdmem",
+                       "sdtemp",
+                       NULL,
+               };
+               prop_array_t whitelist = prop_array_create();
+               prop_dictionary_t props = device_properties(dev);
+               int i;
+
+               for (i = 0; imcsmb_device_whitelist[i] != NULL; i++) {
+                       prop_string_t pstr = prop_string_create_cstring_nocopy(
+                           imcsmb_device_whitelist[i]);
+                       (void) prop_array_add(whitelist, pstr);
+                       prop_object_release(pstr);
+               }
+               (void) prop_dictionary_set(props,
+                                          I2C_PROP_INDIRECT_DEVICE_WHITELIST,
+                                          whitelist);
+               (void) prop_dictionary_set_cstring_nocopy(props,
+                                          I2C_PROP_INDIRECT_PROBE_STRATEGY,
+                                          I2C_PROBE_STRATEGY_NONE);
+       }
+
        device_acpi_register(dev, aux);
 
        isaboot = device_isa_register(dev, aux);



Home | Main Index | Thread Index | Old Index