[request for testing] isl, cyapa on chromebooks

Warner Losh imp at bsdimp.com
Mon Oct 10 15:26:28 UTC 2016


I see no reason not to start the table right away based on
smbios.sys.product and other criteria. I don't think we need all the
matches that Linux uses, but we can expand the table if we find it so.
Why have a stop gap that's a table that we kludge together when the
real table is of comparable difficulty and wouldn't need to be
reworked.

Warner

On Mon, Oct 10, 2016 at 5:46 AM, Michael Gmelin <grembo at freebsd.org> wrote:
> On Mon, 10 Oct 2016 14:35:22 +0300
> Andriy Gapon <avg at FreeBSD.org> wrote:
>
>> On 09/10/2016 23:22, Warner Losh wrote:
>> > There seems to be enough information present in the smbios data to
>> > know what devices are at what addresses. Perhaps we should use it as
>> > much as possible in well controlled situations to move this
>> > knowledge into the OS.
>>
>> So, I was thinking about maybe doing something like this to preserve
>> the status quo, to avoid requiring manual hints and to lay a
>> foundation for the proper Chromebook I2C slave discovery:
>>
>>
>> static struct {
>>       uint32_t        ctlrid,
>>       const char      *name;
>>       uint_t          addr;
>> } slaves[] = {
>>       { 0x9c628086,   "isl",          0x88 },
>>       { 0x9c628086,   "cyapa",        0xce },
>> }
>>
>> static void
>> chromebook_i2c_identify(driver_t *driver, device_t bus)
>> {
>>       device_t controller;
>>       device_t child;
>>       int i;
>>
>>       /*
>>        * A stop gap approach to preserve the status quo.
>>        * A more intelligent approach is required to correctly
>>        * identify a machine model and hadrdware available on it.
>>        * For instance, DMI could be used.
>>        * See
>> http://lxr.free-electrons.com/source/drivers/platform/chrome/chromeos_laptop.c
>>        */
>>       controller = device_get_parent(bus);
>>       if (strcmp(device_get_name(controller), "ig4iic") != 0)
>>               return;
>>
>>       for (i = 0; i < nitems(slaves); i++) {
>>               if (device_find_child(bus, slave->name, -1) != NULL)
>>                       continue;
>>               if (slave->ctlrid != pci_get_devid(controller))
>>                       continue;
>>               child = BUS_ADD_CHILD(bus, 0, slave->name, -1);
>>               if (child != NULL)
>>                       iicbus_set_addr(child, slave->addr);
>>       }
>> }
>>
>> static device_method_t chromebook_i2c_methods[] = {
>>       DEVMETHOD(device_identify,      chromebook_i2c_identify),
>>       { 0, 0 }
>> };
>>
>> static driver_t chromebook_i2c_driver = {
>>       "chromebook_i2c",
>>       chromebook_i2c_methods,
>>       0       /* no softc */
>> };
>>
>> static devclass_t chromebook_i2c_devclass;
>>
>> DRIVER_MODULE(chromebook_i2c, iicbus, chromebook_i2c_driver,
>>     chromebook_i2c_devclass, 0, 0);
>> MODULE_DEPEND(chromebook_i2c, iicbus, IICBUS_MINVER, IICBUS_PREFVER,
>>     IICBUS_MAXVER);
>> MODULE_VERSION(chromebook_i2c, 1);
>>
>> The idea is that this is a driver that listens for new iicbus-es and
>> adds isl and cyapa devices to a bus if some criteria are met.
>>
>
> For the Acer c720, these criteria would be:
>
> smbios.bios.vendor=="coreboot"
> smbios.system.maker=="Acer"
> smbios.system.product=="Peppy"
>
> See also
>
> boot/i386/libi386/biosmem.c
> dev/atkbdc/atkbdc.c
>
> - Michael
>
> --
> Michael Gmelin


More information about the freebsd-current mailing list