You've changed a default and selectively fixed the one driver that
people noticed breaks from it. How do you know the rest aren't broken?

On Thu, Jun 07, 2018 at 01:35:31PM +0000, Jason R Thorpe wrote:
> Module Name:  src
> Committed By: thorpej
> Date:         Thu Jun  7 13:35:31 UTC 2018
> 
> Modified Files:
>       src/sys/arch/x86/x86: x86_autoconf.c
> 
> Log Message:
> 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.
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.76 -r1.77 src/sys/arch/x86/x86/x86_autoconf.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 

> Modified files:
> 
> Index: src/sys/arch/x86/x86/x86_autoconf.c
> diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.76 
> src/sys/arch/x86/x86/x86_autoconf.c:1.77
> --- src/sys/arch/x86/x86/x86_autoconf.c:1.76  Thu Nov  9 01:02:56 2017
> +++ src/sys/arch/x86/x86/x86_autoconf.c       Thu Jun  7 13:35:31 2018
> @@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: x86_autoconf
>  #include <machine/bootinfo.h>
>  #include <machine/pio.h>
>  
> +#include <dev/i2c/i2cvar.h>
> +
>  #include "acpica.h"
>  #include "wsdisplay.h"
>  
> @@ -547,6 +549,36 @@ device_register(device_t dev, void *aux)
>  {
>       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);
> 

Reply via email to