From owner-svn-src-head@freebsd.org Fri Oct 14 17:16:03 2016 Return-Path: Delivered-To: svn-src-head@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 A5E21C1211F for ; Fri, 14 Oct 2016 17:16:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x230.google.com (mail-io0-x230.google.com [IPv6:2607:f8b0:4001:c06::230]) (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 74BC8D42 for ; Fri, 14 Oct 2016 17:16:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x230.google.com with SMTP id i202so127344363ioi.2 for ; Fri, 14 Oct 2016 10:16:03 -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=qlpBKLImWdQ+oox1XayuRsswXPtrHZ7z2bRuUr6zV8I=; b=UfS0q14kUFcc6IIFTHCtCsTdDsJuPwVs+P/L3Qu9vyKvIXkUFAOOmRSI3ZTLFIPsnv zthkJEWFk2/MIJP9sEQ9n0JJUkRQsmhlfcpzzb+AvDmJ4zxDrljGFWiicNdFoFQxNT3d rRBLb6OU0l9hzsuWcsNeLrXDnf5X4WGhbdMMoWX50TP+eMdYDCBV2+WZXXwZkja5K+TX OjYhJVRjBiWWjG7sT9YvJD7hV15+BlcItwxaS49mgzeMpPN4pxqylosEymhGSQkTZSOZ JCFd6Tvin1uBtgzuI0QrJsUX+TnZgUQx/+b/Ngv29SW7IEx+vdCmc1SfgWTt2x5fRj+p bRbw== 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=qlpBKLImWdQ+oox1XayuRsswXPtrHZ7z2bRuUr6zV8I=; b=IVrcq7uLv6uyKovCJrp7iwX+lPeXD8XTStbiNffHnVryqDrAi91vlVoFh/+DNBd0FC UJRD5XVU9PicQifOKyae4I8b2cREdlDq2w9iECI3BVrUKg1EQ20BNPe0sq+LAstDJAQR XLTzApYlH9PFav7M0LW+tn8g67o7XDPjFpx0/lCSQWoR6n9N+aIyQi4MSghVbNwPUUmO ww99kms8XGTRdL4btLhXj7uA2+BJvsM0aEjWxP2298P2F/BdjKU3L1uvBPE0x/5dpfvm FY+GDGiHB1wb4fst8cDpXHBfRLEzV507X0CjFwgNiMLZR4aQUqMwYaNuBK0+ZYM8eWgw CNPA== X-Gm-Message-State: AA6/9Rkzznnmma/pYOgLZp5D9aZcisFCr2kUA2W87X3oskrw99gb5lSvdRZUmp9ONg5YjxV03ynkKW/fMKYqoA== X-Received: by 10.107.139.79 with SMTP id n76mr14303401iod.166.1476465362851; Fri, 14 Oct 2016 10:16:02 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.77.85 with HTTP; Fri, 14 Oct 2016 10:16:02 -0700 (PDT) X-Originating-IP: [69.53.245.200] In-Reply-To: <201610141710.u9EHArlL089412@repo.freebsd.org> References: <201610141710.u9EHArlL089412@repo.freebsd.org> From: Warner Losh Date: Fri, 14 Oct 2016 11:16:02 -0600 X-Google-Sender-Auth: FpWsXjim2P93vs0DxZi91dZts24 Message-ID: Subject: Re: svn commit: r307326 - head/sys/boot/efi/loader To: Doug Ambrisko Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Oct 2016 17:16:03 -0000 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. Warner On Fri, Oct 14, 2016 at 11:10 AM, Doug Ambrisko wrote: > Author: ambrisko > Date: Fri Oct 14 17:10:53 2016 > New Revision: 307326 > URL: https://svnweb.freebsd.org/changeset/base/307326 > > Log: > In UEFI mode expose the SMBIOS anchor base address via kenv so the kernel > etc. can find out where the SMBIOS entry point is located. In pure > UEFI mode the BIOS is not mapped into the standard address space so the > SMBIOS table might not appear between 0xf0000 and 0xfffff. The > UEFI environment can report this the location of the anchor. If it is > reported then expose it as hint.smbios.0.mem. This can then be used > by other tools. However, we should make smbios(4) useful and have it > take this value and provide accesor function so ipmi(4) etc. don't > have to parse and figure things about the SMBIOS table. I have some > simple patches to smbios(4) to expose this address as sysctl and > for ipmi(4) to get the base address. However, the real fix is to > have ipmi(4) ask smbios(4) for what it wants and have smbios(4) > parse it out and return it. This would make smbios(4) useful and reduce > duplicated code. If this address doesn't point to the anchor then > finding SMBIOS info. will fail as if this didn't exist. So there should > be no harm. > > With this change and the following hack, dmidecode works on a bunch of > UEFI machines that I tested: > > if kenv hint.smbios.0.mem > /dev/null > then > mkdir -p /sys/firmware/efi > mount -t tmpfs -o size=8k tmpfs /sys/firmware/efi > echo "SMBIOS=`kenv hint.smbios.0.mem`" > /sys/firmware/efi/systab > fi > > Linux exposes this information via the /sys/firmware/efi/systab file which > dmidecode looks at. We should update dmidecode to do this the FreeBSD > way when we determine what that is! > > Reviewed by: jhb > > Modified: > head/sys/boot/efi/loader/main.c > > Modified: head/sys/boot/efi/loader/main.c > ============================================================================== > --- head/sys/boot/efi/loader/main.c Fri Oct 14 17:04:07 2016 (r307325) > +++ head/sys/boot/efi/loader/main.c Fri Oct 14 17:10:53 2016 (r307326) > @@ -235,6 +235,7 @@ main(int argc, CHAR16 *argv[]) > uint64_t pool_guid; > UINTN k; > int has_kbd; > + char buf[40]; > > archsw.arch_autoload = efi_autoload; > archsw.arch_getdev = efi_getdev; > @@ -447,6 +448,9 @@ main(int argc, CHAR16 *argv[]) > for (k = 0; k < ST->NumberOfTableEntries; k++) { > guid = &ST->ConfigurationTable[k].VendorGuid; > if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) { > + snprintf(buf, sizeof(buf), "%p", > + ST->ConfigurationTable[k].VendorTable); > + setenv("hint.smbios.0.mem", buf, 1); > smbios_detect(ST->ConfigurationTable[k].VendorTable); > break; > } > @@ -603,7 +607,8 @@ command_configuration(int argc, char *ar > else if (!memcmp(guid, &acpi20, sizeof(EFI_GUID))) > printf("ACPI 2.0 Table"); > else if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) > - printf("SMBIOS Table"); > + printf("SMBIOS Table %p", > + ST->ConfigurationTable[i].VendorTable); > else if (!memcmp(guid, &dxe, sizeof(EFI_GUID))) > printf("DXE Table"); > else if (!memcmp(guid, &hoblist, sizeof(EFI_GUID))) >