From owner-freebsd-current@freebsd.org Mon Oct 10 15:26:28 2016 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AFEEFC07A73 for ; Mon, 10 Oct 2016 15:26:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 738001AE for ; Mon, 10 Oct 2016 15:26:28 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x242.google.com with SMTP id o19so5977861ito.3 for ; Mon, 10 Oct 2016 08:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=DGbO/0vv9/6uf2Q7zD2ITMIotpzF/JHK4l+UoDkI5UE=; b=I21tN8yTh/GQUOR4tJdpVUJXnkU81n55GPbAgWKRs10st7fKLqjClXaq2eaAw9uBE7 2mnDsLtCIQMC1p/l/osN9YRM4rlsxnDyKilNuXTH1Iqk5Y5d6w9ttUk+MdZeoN9Lq5F2 gaF9uH3TOrw6vs4s4fvl0XRgSYN9RwSFCbrZ0KEDiY6vTKKgxtqQqh6z8vhGZAB75Cn9 lc5bCsB93M3ymTlyMU1JOwWTw2mzIE5wVmEIRedTksrQicSkz4pkILfglN9wZHshgbO3 d0inEEMBlV8EMUyjCZr/ISrHCNo/2NeiRmAsqExA8rasCj/befZ4l3ObcHfcP5ADselN uXcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=DGbO/0vv9/6uf2Q7zD2ITMIotpzF/JHK4l+UoDkI5UE=; b=GRc8uOtXrRS9WY92ERLyhl5JrrniclIZ3Bo3gaEVco/QZpxv3b1rMg9glQ6tKv2cqh UgJfM9BIxCCRJzUWsE7kSRxAptq0uWLS7fgytcY4WrZFs43CX2JhESymjY6PF4eFUJiF Vudpt0RniKEgVPi4OdTwcxuv41XokJJy1/ik/0kJB3k/yyYs/VTUtYzQrQs47jrLUTpy gnjKCd8VvLiUIF8PmYnF2KM/9gBenmIdZZirggvGzCYEmpFnIol8i5jaQgo+rml6Gnyf phU//yrV7cQVauwTJUhzn3ULbNMIdDLwIMIP1WVTamAQ9UTVAO2h54yXOxBuq+4brJle 5inA== X-Gm-Message-State: AA6/9Rl7ojz1O8yYRFNczOX/DNInk0dHWU3YlCXi7k9KaQdR0t7qDZMCdvgE7xfXz9B6WM52DUS/uw7TaPLeRg== X-Received: by 10.36.16.138 with SMTP id 132mr12363399ity.60.1476113187739; Mon, 10 Oct 2016 08:26:27 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.77.85 with HTTP; Mon, 10 Oct 2016 08:26:26 -0700 (PDT) X-Originating-IP: [50.205.115.50] In-Reply-To: <20161010134610.32120b55@bsd64.grem.de> References: <53bca4d2-975f-f4a0-d12a-5d73fba01a0c@FreeBSD.org> <20161006044732.GA2393@c720-r292778-amd64.oa.oclc.org> <734c7ac0-9018-051e-1df4-a3b719057e19@FreeBSD.org> <773efe54-8ebb-e0e7-7824-10cfaa96d850@FreeBSD.org> <1EE0A2F3-86B9-4806-875E-3845A209A743@freebsd.org> <20161008180742.GA1912@c720-r292778-amd64> <846bf31f-a757-2be0-a293-8c4ce3d42a2f@FreeBSD.org> <20161009015324.007a7b42@bsd64.grem.de> <20161009065423.GA2012@c720-r292778-amd64> <23c6b4f0-77e9-fe90-0eed-9d0125e7624b@FreeBSD.org> <20161010134610.32120b55@bsd64.grem.de> From: Warner Losh Date: Mon, 10 Oct 2016 09:26:26 -0600 X-Google-Sender-Auth: MnTuMUqRxAZsJw-6g40rOZRkYEM Message-ID: Subject: Re: [request for testing] isl, cyapa on chromebooks To: Michael Gmelin Cc: Andriy Gapon , Matthias Apitz , FreeBSD Current Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2016 15:26:28 -0000 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 wrote: > On Mon, 10 Oct 2016 14:35:22 +0300 > Andriy Gapon 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