From owner-svn-src-all@freebsd.org Wed Oct 19 05:44:54 2016 Return-Path: Delivered-To: svn-src-all@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 0420BC17B54 for ; Wed, 19 Oct 2016 05:44:54 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x236.google.com (mail-io0-x236.google.com [IPv6:2607:f8b0:4001:c06::236]) (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 BED4CEA1 for ; Wed, 19 Oct 2016 05:44:53 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x236.google.com with SMTP id r30so21081903ioi.1 for ; Tue, 18 Oct 2016 22:44:53 -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=KasjADQBHzug7wO6PMCJmyPL32KzppgyXdtHkkBRKdk=; b=EGUJ537E2uq2qBAZsZAleW03wkFzoP7DR/7Z1mAP3/Xf068IleszgFiqB1AtDBWaHi tmqR/qfZUlgEevwiZIZhvMj83W8Xfk5G3dAhZ4Iocuy3IJF4Wh8lH1oOhrIuvxLnUcc7 das9z+BPtGfMw6eqnN8IbbFNjIAR005tWqivCWEHDvGdhf5Y4SXEySQCafPhv472GUWi fVy/7RDYia725ppJ4GU/28rBpVkTbIig5u1BGG27Z9veWGpbzEtZtHH+AB5o9NNHSWIq usvFrhUKxSjT0ddkGFXca8JqIJ5VhDXtjzBicNeGVbaPZqmJyDEjWS6eLIYRu6sAptFC +0rQ== 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=KasjADQBHzug7wO6PMCJmyPL32KzppgyXdtHkkBRKdk=; b=HPcfrhgjBajyypC1zuwdOpP2yFG14rvYKFqJAcstRSBYQDV4wPrAi4OvL2jgplA51U fa0nT9qupdRUUaxeAjPQVPBvnIuEVdgZdIzx6OxdOnH4bF293TeLD2ZJTxrSYl0wRoqj Igiz5nAubr27o3MAkXiW5hjZ8rapOpexEzzjohF5vLYDZSC/PgR/GTDidqKM0YTRiWKt mpoKT5XFuG4OKk3LD8icPsXM+zXciMpbV/fCZvx0jClDYrWz6fQF02PKjZk4fcjMDe+U dLfB3bEvcAMa5zvk65Oos+57VNd4bnajl1jNOmHzxkY/7SOepJXuLv0B7FNte8x0OoBM acGg== X-Gm-Message-State: AA6/9Rn41h8w+oKjdv7WHqPnzL1q/6k/M9Zd7ZU2VkF/XbKI8Y7PQTmphAbtLWjqeiEZASHb+RC/F4kzWYtfsQ== X-Received: by 10.107.15.222 with SMTP id 91mr4989356iop.19.1476855893059; Tue, 18 Oct 2016 22:44:53 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.77.85 with HTTP; Tue, 18 Oct 2016 22:44:52 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <1950201.IjTl3rpdGP@ralph.baldwin.cx> References: <201610141710.u9EHArlL089412@repo.freebsd.org> <20161014175542.GB65545@ambrisko.com> <1950201.IjTl3rpdGP@ralph.baldwin.cx> From: Warner Losh Date: Tue, 18 Oct 2016 23:44:52 -0600 X-Google-Sender-Auth: 6WfqHbXHkzeIBclg_wH3Vl9c_No Message-ID: Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader To: John Baldwin Cc: Doug Ambrisko , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Doug Ambrisko , Ravi Pokala Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2016 05:44:54 -0000 On Mon, Oct 17, 2016 at 11:40 AM, John Baldwin wrote: > On Friday, October 14, 2016 12:25:54 PM Warner Losh wrote: >> On Oct 14, 2016 11:55 AM, "Doug Ambrisko" wrote: >> > >> > On Fri, Oct 14, 2016 at 10:33:15AM -0700, Ravi Pokala wrote: >> > | -----Original Message----- >> > | > From: on behalf of Doug Ambrisko < >> ambrisko@ambrisko.com> >> > | > Date: 2016-10-14, Friday at 10:27 >> > | > To: Warner Losh >> > | > Cc: Doug Ambrisko , src-committers < >> src-committers@freebsd.org>, "svn-src-all@freebsd.org" < >> svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" < >> svn-src-head@freebsd.org> >> > | > Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader >> > | > >> > | > On Fri, Oct 14, 2016 at 11:16:02AM -0600, Warner Losh wrote: >> > | > | Love the functionality, but don't like using the 'hint' namespace >> for >> > | > | this. Can we change it now before too many things depend on it? We >> had >> > | > | similar issues in ACPI and moved it to the 'acpi' space. Can we move >> > | > | this to the 'smbios' space please? >> > | > | >> > | > | The reason is that 'hint' is special and sometimes filtered out, so >> it >> > | > | is a poor choice to export data from the boot loader to the kernel. >> > | > >> > | > The reason I picked hint was it could be put /boot/device.hints >> > | > to make it work as well and that it was a hint. Other standards in >> the >> > | > future might use other methods. Looking back over the email I had >> > | > with John he had suggested hint.smbios.0.anchor to make this look >> > | > different. This code had been hanging around for so long I forgot >> > | > about that and we were using hint.smbios.0.mem in our shipping code >> base. >> > | > >> > | > However, I hope that nothing would use this except for smbios(4) and >> > | > for people to make smbios(4) useful for this info. >> > | >> > | Doug's looking at me when he says that. :-) >> > | >> > | We talked about this last night at BAFUG; right now, even if smbios(4) >> > | is able to find the SMBIOS info -- it currently only looks at the >> > | aforementioned 0xf0000 - 0xfffff range, so it can't find it on UEFI -- >> > | smbios(4) doesn't actually provide any interface for that information. >> > | Doug and I have talked about making smbios(4) useful, by parsing the >> > | data and providing KPIs and APIs, for years now; I think I'll *finally* >> > | have the time and motivation to do so "soon". >> > >> > I've actually talked to a few people. However, your the first to >> > step up. This needs to be designed and will take some time and >> > review. I would hope that except for smbios(4), nothing else would >> > use this kenv but there is nothing to prevent that :-( I could name >> > it super_secret_dont_use. >> > >> > BTW, to get you started this patch prevents smbios(4) from blowing chunks >> > when it gets a anchor in high memory and works on legacy machines. >> > >> > --- /sys/x86/bios/smbios.c 2013-10-01 14:28:25.000000000 -0700 >> > +++ ./smbios.c 2016-04-11 11:58:03.234969000 -0700 >> > @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD: release/9.2.0/sys/x8 >> > #include >> > #include >> > #include >> > +#include >> > >> > #include >> > #include >> > @@ -59,7 +60,7 @@ struct smbios_softc { >> > }; >> > >> > #define RES2EPS(res) ((struct smbios_eps >> *)rman_get_virtual(res)) >> > -#define ADDR2EPS(addr) ((struct smbios_eps >> *)BIOS_PADDRTOVADDR(addr)) >> > +#define ADDR2EPS(addr) ((struct smbios_eps *)PHYS_TO_DMAP(addr)) >> > >> > static devclass_t smbios_devclass; >> > >> > @@ -71,19 +72,26 @@ static int smbios_modevent (module_t, in >> > >> > static int smbios_cksum (struct smbios_eps *); >> > >> > +static unsigned long addr; >> > +static SYSCTL_NODE(_hw, OID_AUTO, smbios, CTLFLAG_RD, 0, >> > + "SMBIOS driver parameters"); >> > +SYSCTL_LONG(_hw_smbios, OID_AUTO, mem, CTLFLAG_RW, >> > + &addr, 0, ""); >> > + >> > static void >> > smbios_identify (driver_t *driver, device_t parent) >> > { >> > device_t child; >> > - u_int32_t addr; >> > int length; >> > int rid; >> > >> > if (!device_is_alive(parent)) >> > return; >> > >> > - addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN, >> > - SMBIOS_STEP, SMBIOS_OFF); >> > + if (resource_long_value("smbios", 0, "mem", &addr) != 0 || >> > + addr == 0) >> > + addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, >> SMBIOS_LEN, >> > + SMBIOS_STEP, SMBIOS_OFF); >> > if (addr != 0) { >> > rid = 0; >> > length = ADDR2EPS(addr)->length; >> > >> > Note I don't plan to commit this since it doesn't really do much and we >> > need a lot more. >> >> I was planning on exporting all smbios stuff via sysctl. > > I'm a bit hesitant to do all the type parsing in the kernel vs userland. > However, I think having smbios(4) export a /dev/smbios that you can either > read() or mmap() to access the table would be very convenient and let you > keep the bits to parse the table in userland (and not require root if we > allow read-only access to mortals on /dev/foo). I'd support allowing this also, but we have them hidden in kenv how. Moving them to sysctl is trivial and adds no additional risk to the kernel. Having a /dev/smbios that also exports them and having userland tools to parse nodes that the loader doesn't export is also a good idea, but I don't think that would replace what I have in mind. sysctl is super easy to get data from in shell and other scripts. /dev/smbios would require another program to parse the blob that's exported. I think it would be cool to have that as well and wouldn't interfere with what I was planning on doing. Warner