From nobody Fri May 10 07:35:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93286+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93286+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1662486191; cv=none; d=zohomail.com; s=zohoarc; b=LSVmneLtMm1eYq6CxNSosJadfFJSGSf8rpedujf1NevCMHZlxEGVP4dGOAxU+JJYerdLFBIpsfLIh6qyicKtuSZF4N7o86aLqD5aKTY7hAxOQgFf5SzuWe2g11XeSrjavIie1DuDOuGc1Ig82ZeOTalP2A75pga3AUtd2zeeJDE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662486191; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=1c5ZiMPh9ZHCoZy81mmtYiBA44BF5XAmBluAZ6Aq+MU=; b=R22zymzraobiKp4fB054IXZ3lcfZQOM2xU3e2rgsfbOsZvaQJi9SzLO4YdyWzKhIyXiMDRPjBO0p6tx6xfwdVHskT86Rs5xxVsF/Vy5LLzeeXxAsT54XinK6hxRxp3qcHi9GpCMwgR7kdCxOv2hcb/DCr8ESTIcLMmWUMgl/mpI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93286+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1662486191756327.5827038661696; Tue, 6 Sep 2022 10:43:11 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2pALYY1788612xNafzrmo8jG; Tue, 06 Sep 2022 10:43:11 -0700 X-Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by mx.groups.io with SMTP id smtpd.web09.2363.1662486190522809487 for ; Tue, 06 Sep 2022 10:43:10 -0700 X-Received: by mail-qk1-f179.google.com with SMTP id i9so2783947qka.0 for ; Tue, 06 Sep 2022 10:43:10 -0700 (PDT) X-Gm-Message-State: jDA1AEYHwExu5cQW9dkP3SSmx1787277AA= X-Google-Smtp-Source: AA6agR5ORgmzdNZkZMjLKGpgrk6ZcQpIs6YnZ0b0ml4yE4mep53CwBJd51dkd7rbCCAlHY2i0MsKfg== X-Received: by 2002:a05:620a:294c:b0:6bc:1d0d:d873 with SMTP id n12-20020a05620a294c00b006bc1d0dd873mr37300086qkp.355.1662486189303; Tue, 06 Sep 2022 10:43:09 -0700 (PDT) X-Received: from aturtleortwo-benjamindomain.. ([2607:f2c0:e98c:e:b132:3785:fa38:a51]) by smtp.gmail.com with ESMTPSA id bi3-20020a05620a318300b006b61b2cb1d2sm11221482qkb.46.2022.09.06.10.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 10:43:08 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Sai Chaganty , Isaac Oram , Chasel Chiu , Nate DeSimone Subject: [edk2-devel][edk2-platforms][PATCH v1 1/7] KabylakeOpenBoardPkg/AspireVn7Dash572G: Cleanup library includes Date: Tue, 6 Sep 2022 13:42:52 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,benjamin.doron00@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662486191; bh=LDlwsNeVeTGXhM7JphAqxAoRI24DDHjQGAEn51Mabqs=; h=Cc:Date:From:Reply-To:Subject:To; b=MnlRrfftyXAzfe7phkBJ0vNXbL3nQsuKVpRktyhVYWvZEDKa9EcfEheNLOVvwo2O0fN wCWj5kYYEGd6k/wWTv88S94Cb7bf0cgz7LggsharyDjDXK2ckHJ5sUMnYJPNvKjTtgyDP vP2j1vS/bpjaWb/ud34YDy+4a/7SGCTRtDQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662486192660100007 Content-Type: text/plain; charset="utf-8" Remove unused includes, LibraryClasses and update a comment or two. Cc: Sai Chaganty Cc: Isaac Oram Cc: Chasel Chiu Cc: Nate DeSimone Signed-off-by: Benjamin Doron Reviewed-by: Isaac Oram --- .../PcieDeviceTable.c | 1 - .../PeiBoardPolicyUpdate.c | 6 ++++-- .../PeiPchPolicyUpdate.h | 3 ++- .../PeiPchPolicyUpdatePreMem.c | 1 - .../PeiSiliconPolicyUpdateLibFsp.inf | 5 ++--- .../BoardAcpiLib/DxeBoardAcpiTableLib.inf | 5 +---- .../SmmAspireVn7Dash572GAcpiEnableLib.c | 9 +++++---- .../BoardAcpiLib/SmmBoardAcpiEnableLib.inf | 3 ++- .../Library/BoardEcLib/EcCommands.c | 14 ++++++++------ .../AspireVn7Dash572GHdaVerbTables.c | 3 ++- .../BoardInitLib/PeiAspireVn7Dash572GInitLib.h | 3 +-- .../PeiAspireVn7Dash572GInitPreMemLib.c | 18 +++++++++--------- .../BoardInitLib/PeiBoardInitPostMemLib.inf | 4 +--- .../BoardInitLib/PeiBoardInitPreMemLib.inf | 5 +---- .../AspireVn7Dash572G/OpenBoardPkg.fdf | 3 ++- .../OpenBoardPkgBuildOption.dsc | 4 ++-- .../DxeGopPolicyInit.h | 3 --- .../DxeSaPolicyInit.h | 3 --- .../DxeSiliconPolicyUpdateLib.c | 3 +-- .../DxeSiliconPolicyUpdateLib.inf | 2 ++ 20 files changed, 45 insertions(+), 53 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapp= er/Library/PeiSiliconPolicyUpdateLibFsp/PcieDeviceTable.c b/Platform/Intel/= KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPolicyU= pdateLibFsp/PcieDeviceTable.c index 205ca581c6f3..537fb5c8e4f4 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PcieDeviceTable.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PcieDeviceTable.c @@ -7,7 +7,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 #include "PeiPchPolicyUpdate.h" -#include =20 #define PCI_CLASS_NETWORK 0x02 #define PCI_CLASS_NETWORK_ETHERNET 0x00 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapp= er/Library/PeiSiliconPolicyUpdateLibFsp/PeiBoardPolicyUpdate.c b/Platform/I= ntel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPo= licyUpdateLibFsp/PeiBoardPolicyUpdate.c index 81cd8b940f05..452c961b17ac 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiBoardPolicyUpdate.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiBoardPolicyUpdate.c @@ -12,14 +12,16 @@ #include #include =20 -/* TODO: +/* + * TODO: * - Validate PCH Sample policies: only SA one used by default. * - Remove likely fuse-disabled devices when reset handling is committed? * - Remove duplicate policy * - Consider updating some policies, rather than overriding. This could= be factored into * BoardInitLib for deduplication * - Copy initialised array, where sane - * - Set IgdDvmt50PreAlloc? */ + * - Set IgdDvmt50PreAlloc? + */ =20 #define SA_VR 0 #define IA_VR 1 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapp= er/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.h b/Platform/Int= el/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPoli= cyUpdateLibFsp/PeiPchPolicyUpdate.h index 5e720b0041e8..134188698077 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.h +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdate.h @@ -17,10 +17,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include -#include =20 #include #include #include =20 +#include + #endif diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapp= er/Library/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdatePreMem.c b/Platfo= rm/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSilic= onPolicyUpdateLibFsp/PeiPchPolicyUpdatePreMem.c index 2bc142c0e5ff..28e4e45375c2 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdatePreMem.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiPchPolicyUpdatePreMem.c @@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "PeiPchPolicyUpdate.h" #include #include -#include #include #include #include diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapp= er/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/= Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/Pe= iSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf index eac9344b0aa2..0e1b42c20cd8 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf @@ -62,19 +62,18 @@ =20 [LibraryClasses.IA32] FspWrapperApiLib - FspWrapperPlatformLib BaseMemoryLib DebugLib - HobLib IoLib PcdLib MmPciLib - ConfigBlockLib + PciLib PeiSaPolicyLib PchInfoLib PchHsioLib PchPcieRpLib SiPolicyLib + MemoryAllocationLib PeiLib =20 [Pcd] diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardAcpiLib/DxeBoardAcpiTableLib.inf b/Platform/Intel/KabylakeOpenBoardPkg= /AspireVn7Dash572G/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf index 0d8264554734..660afe9292ec 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/DxeBoardAcpiTableLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/DxeBoardAcpiTableLib.inf @@ -22,10 +22,7 @@ # =20 [LibraryClasses] - BaseLib - IoLib - PciLib - AslUpdateLib + PcdLib EcLib =20 [Packages] diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardAcpiLib/SmmAspireVn7Dash572GAcpiEnableLib.c b/Platform/Intel/KabylakeO= penBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/SmmAspireVn7Dash572GAcpi= EnableLib.c index 69e9c928ff69..fa2ed9745ea6 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/SmmAspireVn7Dash572GAcpiEnableLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/SmmAspireVn7Dash572GAcpiEnableLib.c @@ -2,6 +2,7 @@ Acer Aspire VN7-572G SMM Board ACPI Enable library =20 Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
+Copyright (c) 2021, Baruch Binyamin Doron
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -20,8 +21,8 @@ AspireVn7Dash572GBoardEnableAcpi ( EFI_STATUS Status; =20 /* Tests at runtime show this re-enables charging and battery reporting - * - Obtained somewhere from somewhere in vendor's SmmKbcDriver (or RtKb= cDriver). - * Further reversing will be performed */ + * - Obtained from somewhere in vendor's SmmKbcDriver. + * Further information is needed */ Status =3D SendEcCommand (0xE9); /* Vendor implements using ACPI "CMDB"= register" */ if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a(): SendEcCommand(0xE9) failed!\n", __FUNCTION= __)); @@ -48,8 +49,8 @@ AspireVn7Dash572GBoardDisableAcpi ( EFI_STATUS Status; =20 /* Tests at runtime show this disables charging and battery reporting - * - Obtained somewhere from somewhere in vendor's SmmKbcDriver (or RtKb= cDriver). - * Further reversing will be performed */ + * - Obtained from somewhere in vendor's SmmKbcDriver. + * Further information is needed */ Status =3D SendEcCommand (0xE9); /* Vendor implements using ACPI "CMDB"= register" */ if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a(): SendEcCommand(0xE9) failed!\n", __FUNCTION= __)); diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardAcpiLib/SmmBoardAcpiEnableLib.inf b/Platform/Intel/KabylakeOpenBoardPk= g/AspireVn7Dash572G/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf index 63a54e1830a5..5db00224dfce 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/SmmBoardAcpiEnableLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/SmmBoardAcpiEnableLib.inf @@ -23,9 +23,10 @@ =20 [LibraryClasses] BaseLib + DebugLib EcLib IoLib - PciLib + PcdLib MmPciLib PchCycleDecodingLib =20 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardEcLib/EcCommands.c b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash= 572G/Library/BoardEcLib/EcCommands.c index 6e752b4e227e..54cfaba47b1b 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardEc= Lib/EcCommands.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardEc= Lib/EcCommands.c @@ -13,7 +13,8 @@ #include #include =20 -/* Notes: +/* + * Notes: * - ACPI "CMDB": Writing to this offset is equivalent to sending commands. * The CMDx bytes contain the command parameters. * @@ -21,9 +22,10 @@ * - Commands: 0x58, 0xE1 and 0xE2 * - 0x51, 0x52: EC flash write? * - ACPI CMDB: 0x63 and 0x64, 0xC7 - * - 0x0B: Flash write (Boolean argument? Set in offset 0x0B?) + * - 0x0B: Flash lock/write (Set offset 0x0B?) + * - Key/recovery detection? * - * Reversing vendor's protocols: + * Vendor's protocols: * - Only read and write are used. * - Query, ACPI "CMDB" processing and command 58 are unused. * - Equivalent KbcPeim is an unused PPI. @@ -32,9 +34,9 @@ */ =20 #define EC_INDEX_IO_PORT 0x1200 -#define EC_INDEX_IO_HIGH_ADDR_PORT EC_INDEX_IO_PORT+1 -#define EC_INDEX_IO_LOW_ADDR_PORT EC_INDEX_IO_PORT+2 -#define EC_INDEX_IO_DATA_PORT EC_INDEX_IO_PORT+3 +#define EC_INDEX_IO_HIGH_ADDR_PORT (EC_INDEX_IO_PORT + 1) +#define EC_INDEX_IO_LOW_ADDR_PORT (EC_INDEX_IO_PORT + 2) +#define EC_INDEX_IO_DATA_PORT (EC_INDEX_IO_PORT + 3) =20 /** Reads a byte of EC RAM. diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/AspireVn7Dash572GHdaVerbTables.c b/Platform/Intel/KabylakeOpen= BoardPkg/AspireVn7Dash572G/Library/BoardInitLib/AspireVn7Dash572GHdaVerbTab= les.c index 0573736060fa..cc7369f3484c 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/AspireVn7Dash572GHdaVerbTables.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/AspireVn7Dash572GHdaVerbTables.c @@ -2,6 +2,7 @@ HDA Verb table for Acer Aspire VN7-572G =20 Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2021, Baruch Binyamin Doron
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -9,7 +10,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _ASPIRE_VN7_572G_HDA_VERB_TABLES_H_ #define _ASPIRE_VN7_572G_HDA_VERB_TABLES_H_ =20 -#include +#include =20 HDAUDIO_VERB_TABLE HdaVerbTableAlc255AspireVn7Dash572G =3D HDAUDIO_VERB_TA= BLE_INIT ( // diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/PeiAspireVn7Dash572GInitLib.h b/Platform/Intel/KabylakeOpenBoa= rdPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GInitLib.h index 83789c90becf..51a7b714c463 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GInitLib.h +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GInitLib.h @@ -8,10 +8,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _PEI_ASPIRE_VN7_572G_BOARD_INIT_LIB_H_ #define _PEI_ASPIRE_VN7_572G_BOARD_INIT_LIB_H_ =20 -#include +#include #include #include -#include #include #include #include diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/PeiAspireVn7Dash572GInitPreMemLib.c b/Platform/Intel/KabylakeO= penBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GInit= PreMemLib.c index 1b4c6b484b43..d0125ebdbcb2 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GInitPreMemLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GInitPreMemLib.c @@ -1,6 +1,7 @@ /** @file =20 Copyright (c) 2017 - 2022, Intel Corporation. All rights reserved.
+Copyright (c) 2021, Baruch Binyamin Doron
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -8,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include -#include #include #include #include @@ -16,7 +16,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include -#include =20 #include #include @@ -47,12 +46,6 @@ GLOBAL_REMOVE_IF_UNREFERENCED const UINT16 RcompTargetAs= pireVn7Dash572G[SA_MRC_M #define DGPU_HOLD_RST GPIO_SKL_LP_GPP_B4 /* Active low */ #define DGPU_PWR_EN GPIO_SKL_LP_GPP_B21 /* Active low */ =20 -EFI_STATUS -EFIAPI -AspireVn7Dash572GBoardDetect ( - VOID - ); - /** Aspire VN7-572G board configuration init function for PEI pre-memory pha= se. =20 @@ -75,7 +68,7 @@ AspireVn7Dash572GInitPreMem ( // PcdSet8S (PcdSaMiscUserBd, 5); // ULT/ULX/Mobile Halo PcdSet8S (PcdMrcCaVrefConfig, 2); // DDR4: "VREF_CA to CH_A and VREF_DQ= _B to CH_B" - // TODO: Clear Dq/Dqs? + // TODO: Search vendor FW for Dq/Dqs. Unnecessary if FSP detects LPDDR PcdSetBoolS (PcdMrcDqPinsInterleaved, TRUE); =20 PcdSet32S (PcdMrcRcompResistor, (UINTN) RcompResistorAspireVn7Dash572G); @@ -241,9 +234,16 @@ AspireVn7Dash572GBoardInitAfterMemoryInit ( if (EFI_ERROR (Status)) { DEBUG ((DEBUG_WARN, "Failed to enable LGMR. Were ACPI tables built for= LGMR memory map?\n")); } + return EFI_SUCCESS; } =20 +EFI_STATUS +EFIAPI +AspireVn7Dash572GBoardDetect ( + VOID + ); + EFI_STATUS EFIAPI AspireVn7Dash572GBoardDebugInit ( diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/PeiBoardInitPostMemLib.inf b/Platform/Intel/KabylakeOpenBoardP= kg/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPostMemLib.inf index c8c49fa20dcc..7b68f66ac78b 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiBoardInitPostMemLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiBoardInitPostMemLib.inf @@ -10,7 +10,7 @@ [Defines] INF_VERSION =3D 0x00010005 BASE_NAME =3D PeiBoardPostMemInitLib - FILE_GUID =3D 7fcc3900-d38d-419f-826b-72481e8b5509 + FILE_GUID =3D 7FCC3900-D38D-419F-826B-72481E8B5509 MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 LIBRARY_CLASS =3D BoardInitLib @@ -18,8 +18,6 @@ [LibraryClasses] BaseLib DebugLib - BaseMemoryLib - MemoryAllocationLib PcdLib SiliconInitLib PchCycleDecodingLib diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/PeiBoardInitPreMemLib.inf b/Platform/Intel/KabylakeOpenBoardPk= g/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPreMemLib.inf index c53114e15450..a3164870ef9b 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiBoardInitPreMemLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiBoardInitPreMemLib.inf @@ -10,7 +10,7 @@ [Defines] INF_VERSION =3D 0x00010005 BASE_NAME =3D PeiBoardInitPreMemLib - FILE_GUID =3D ec3675bc-1470-417d-826e-37378140213d + FILE_GUID =3D EC3675BC-1470-417D-826E-37378140213D MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 LIBRARY_CLASS =3D BoardInitLib @@ -18,8 +18,6 @@ [LibraryClasses] BaseLib DebugLib - BaseMemoryLib - MemoryAllocationLib PcdLib SiliconInitLib TimerLib @@ -30,7 +28,6 @@ EcLib BoardEcLib GpioLib - PeiLib PeiServicesLib PchPmcLib =20 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoar= dPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardP= kg.fdf index 864d5561d7d8..b59d9a4f24e1 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.fdf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.fdf @@ -279,7 +279,7 @@ INF IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim= .inf INF $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPost= Mem.inf =20 !if gSiPkgTokenSpaceGuid.PcdPeiDisplayEnable =3D=3D TRUE -FILE FREEFORM =3D 4ad46122-ffeb-4a52-bfb0-518cfca02db0 { +FILE FREEFORM =3D 4AD46122-FFEB-4A52-BFB0-518CFCA02DB0 { SECTION RAW =3D $(BOARD)/Vbt.bin SECTION UI =3D "Vbt" } @@ -346,6 +346,7 @@ APRIORI DXE { INF UefiCpuPkg/CpuDxe/CpuDxe.inf INF MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf =20 +# TODO: Add NvmExpressDxe if supporting Newgate and RayleighSLS INF MdeModulePkg/Bus/Pci/SataControllerDxe/SataControllerDxe.inf INF MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf INF MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoar= dPkgBuildOption.dsc b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G= /OpenBoardPkgBuildOption.dsc index b1a04c474845..6e2053d67734 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkgBui= ldOption.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkgBui= ldOption.dsc @@ -84,6 +84,7 @@ DEFINE DSC_PLTPKG_FEATURE_BUILD_OPTIONS =3D $(DSC_PLTPKG_= FEATURE_BUILD_OPTIONS) $( DEFINE DSC_PLTPKG_FEATURE_BUILD_OPTIONS =3D $(DSC_PLTPKG_FEATURE_BUILD_OPT= IONS) $(DSC_ACPI_BUILD_OPTIONS) $(UP_SERVER_SUPPORT_BUILD_OPTIONS) $(USBTYP= EC_BUILD_OPTION) $(SINITBIN_BUILD_OPTION) $(MINTREE_FLAG_BUILD_OPTION) =20 # FIXME: $(DSC_PLTPKG_FEATURE_BUILD_OPTIONS) is passed multiple times +# BUGBUG: `-Wl,--allow-multiple-definition` breaks CLANG build [BuildOptions.Common.EDKII] =20 # @@ -141,8 +142,7 @@ MSFT: *_*_X64_ASLCC_FLAGS =3D $(DSC_PLTPKG_FEATURE_= BUILD_OPTIONS) MSFT:*_*_*_DLINK_FLAGS =3D /ALIGN:4096 GCC:*_*_*_DLINK_FLAGS =3D -z common-page-size=3D0x1000 =20 -# FIXME: Protection broken, but works on UefiPayload, and not related to -# FspWrapperNotifyDxe. Cannot be related to SMM? +# FIXME: Protection broken, yet works on UefiPayload. Consider diffing mod= ule/library include lists (unrelated to FspWrapperNotifyDxe). # Force PE/COFF sections to be aligned at 4KB boundaries to support NX pro= tection [BuildOptions.common.EDKII.DXE_DRIVER, BuildOptions.common.EDKII.DXE_CORE,= BuildOptions.common.EDKII.UEFI_DRIVER, BuildOptions.common.EDKII.UEFI_APPL= ICATION] #MSFT:*_*_*_DLINK_FLAGS =3D /ALIGN:4096 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/L= ibrary/DxeSiliconPolicyUpdateLib/DxeGopPolicyInit.h b/Platform/Intel/Kabyla= keOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/D= xeGopPolicyInit.h index 63cad5e3753f..56cab1df9b1d 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= DxeSiliconPolicyUpdateLib/DxeGopPolicyInit.h +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= DxeSiliconPolicyUpdateLib/DxeGopPolicyInit.h @@ -9,11 +9,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define _GOP_POLICY_INIT_DXE_H_ =20 #include -#include #include -#include #include -#include #include #include #include diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/L= ibrary/DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.h b/Platform/Intel/Kabylak= eOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUpdateLib/Dx= eSaPolicyInit.h index 801387b9476f..88a507547f69 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.h +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= DxeSiliconPolicyUpdateLib/DxeSaPolicyInit.h @@ -8,12 +8,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _SA_POLICY_INIT_DXE_H_ #define _SA_POLICY_INIT_DXE_H_ =20 -#include -#include #include #include #include -#include =20 #include =20 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/L= ibrary/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.c b/Platform/Int= el/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUp= dateLib/DxeSiliconPolicyUpdateLib.c index 6298bb53e65d..6840531da986 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.c @@ -1,14 +1,13 @@ /** @file =20 Copyright (c) 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2021, Baruch Binyamin Doron
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ =20 #include #include -#include -#include #include #include =20 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/L= ibrary/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.inf b/Platform/I= ntel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicy= UpdateLib/DxeSiliconPolicyUpdateLib.inf index 63ac194cd0d5..989796cf8244 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.inf @@ -17,6 +17,8 @@ =20 [LibraryClasses] BaseLib + BaseMemoryLib + UefiBootServicesTableLib PcdLib DebugLib ConfigBlockLib --=20 2.37.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93286): https://edk2.groups.io/g/devel/message/93286 Mute This Topic: https://groups.io/mt/93507094/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 10 07:35:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93287+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93287+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1662486193; cv=none; d=zohomail.com; s=zohoarc; b=bb0r76m+UpvgNEu9SoIS53S+d6Z2e3H6yPIQQ3zhZgFfOib2WYnB20jBgPdFMwMO3N7qQRW6ugZ68Cstl1synDeHu1B3FlFVGZ+Wl3IaexKyDHu8ld6N8xb+HopaoJ0G0NZDngMgcB4d2yYN1Qhx2CdtDqIZW/s2c+Le7EYbrV4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662486193; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=UlfmpbJ73Aa9ZfleiA0JFfJrIHqfhjDYPX0dIZgFCZg=; b=bY+YxwUnlMLtTOnlVz7okn+wYf4IXZ5zXRXgJtBGKmGbdWg2JFpdNlTHcNLFGc5lL69uTBTTt7rj+mEY9da9kFWtuHi/HrDCxCz+MYPuMdACHalw3z/hfPRs8o9GDoypR7pPAtVuFiFJGL/KshqC5PdQ3EgPV4GlvZo1OKsUGL4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93287+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1662486193233327.701292976373; Tue, 6 Sep 2022 10:43:13 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Ksc5YY1788612xTM651S4YAV; Tue, 06 Sep 2022 10:43:12 -0700 X-Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by mx.groups.io with SMTP id smtpd.web11.2278.1662486191733097155 for ; Tue, 06 Sep 2022 10:43:11 -0700 X-Received: by mail-qk1-f178.google.com with SMTP id b2so8700691qkh.12 for ; Tue, 06 Sep 2022 10:43:11 -0700 (PDT) X-Gm-Message-State: dMCmCe7Q264JDZE5zCv7MLt2x1787277AA= X-Google-Smtp-Source: AA6agR6+XTTEZf0weClsMsX7dd4+Pj6nGCgwMYdPpsQkBzL512vdPIoHruVXlrmHfJgqxJZCfqSYkg== X-Received: by 2002:a05:620a:101a:b0:6bb:e7de:791f with SMTP id z26-20020a05620a101a00b006bbe7de791fmr37707864qkj.463.1662486190552; Tue, 06 Sep 2022 10:43:10 -0700 (PDT) X-Received: from aturtleortwo-benjamindomain.. ([2607:f2c0:e98c:e:b132:3785:fa38:a51]) by smtp.gmail.com with ESMTPSA id bi3-20020a05620a318300b006b61b2cb1d2sm11221482qkb.46.2022.09.06.10.43.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 10:43:10 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Sai Chaganty , Isaac Oram , Nate DeSimone , Chasel Chiu Subject: [edk2-devel][edk2-platforms][PATCH v1 2/7] KabylakeOpenBoardPkg/AspireVn7Dash572G: Enhance the build-logic Date: Tue, 6 Sep 2022 13:42:53 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,benjamin.doron00@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662486192; bh=sDw4pUGdc1zPJ9gfCGGL2eKKqDziAKp8g5wbVZnqr+8=; h=Cc:Date:From:Reply-To:Subject:To; b=KFRZU/jnrHhNyK1MgPWiKRHJ2tZIoOdy+0Ij5HhlMhIHkoS7OTH5QqSEgn9QRzLV0aL A6Kwt/xT0zqtvid5H33wBPZBB27IHfZGxRkV+irZaRX9Wexh5kFzjQks+HctbNW/mZrJa R3MKLEb6uEx83cVM88LVrmZoA6yl8WLCKa8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662486194769100012 Content-Type: text/plain; charset="utf-8" Update the AspireVn7Dash572G DSC files with assorted enhancements since the initial porting work. Some planned features, such as Secure Boot and measuring the default FSP UPDs to a TPM (which does have security relevance), are now fully working. Enable the working advanced features in use on this board. Cc: Sai Chaganty Cc: Isaac Oram Cc: Nate DeSimone Cc: Chasel Chiu Signed-off-by: Benjamin Doron --- .../AspireVn7Dash572G/OpenBoardPkg.dsc | 63 +++++++++++-------- .../AspireVn7Dash572G/OpenBoardPkgPcd.dsc | 59 ++++++++++------- 2 files changed, 74 insertions(+), 48 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoar= dPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardP= kg.dsc index f4552ee83d6b..75c537f1253f 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc @@ -22,15 +22,6 @@ # DEFINE BIOS_SIZE_OPTION =3D SIZE_60 =20 - # - # Debug logging - # - DEFINE USE_HDMI_DEBUG_PORT =3D FALSE - DEFINE USE_PEI_SPI_LOGGING =3D FALSE - DEFINE USE_MEMORY_LOGGING =3D FALSE - DEFINE RELEASE_LOGGING =3D ($(USE_HDMI_DEBUG_PORT) || $(USE_PEI_SPI= _LOGGING) || $(USE_MEMORY_LOGGING)) - DEFINE TESTING =3D TRUE - PLATFORM_NAME =3D $(PLATFORM_PACKAGE) PLATFORM_GUID =3D AEEEF17C-36B6-4B68-949A-= 1E54CB33492F PLATFORM_VERSION =3D 0.1 @@ -40,9 +31,17 @@ BUILD_TARGETS =3D DEBUG|RELEASE SKUID_IDENTIFIER =3D ALL FLASH_DEFINITION =3D $(PROJECT)/OpenBoardPkg.= fdf - FIX_LOAD_TOP_MEMORY_ADDRESS =3D 0x0 =20 + # + # Debug logging + # + DEFINE USE_HDMI_DEBUG_PORT =3D FALSE + DEFINE USE_PEI_SPI_LOGGING =3D FALSE + DEFINE USE_MEMORY_LOGGING =3D FALSE + DEFINE RELEASE_LOGGING =3D ($(USE_HDMI_DEBUG_PORT) || $(USE_PEI_SPI= _LOGGING) || $(USE_MEMORY_LOGGING)) + DEFINE TESTING =3D FALSE + # # Include PCD configuration for this board. # @@ -143,7 +142,7 @@ ####################################### FspWrapperApiLib|IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/BaseFs= pWrapperApiLib.inf FspWrapperApiTestLib|IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib= /PeiFspWrapperApiTestLib.inf - # This board will set debugging library instances; FIXME: UART2 not used + # Board DSC will select debug library instances; NOTE: UART2 not used SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull= .inf =20 ####################################### @@ -198,12 +197,11 @@ ####################################### PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatfor= mHookLibNull.inf =20 -# NB: MinPlatform sets a NULL DebugLib and only overrides it for DEBUG bui= lds -# TODO: Now that all debug logging is routed through RSC, correct the defi= nes [LibraryClasses.IA32.SEC] ####################################### # Edk2 Packages ####################################### +# NOTE: No way that RSC avoids PeiServices in SEC? Even if valid on re-ent= ry... DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf =20 !if $(USE_HDMI_DEBUG_PORT) =3D=3D TRUE @@ -231,7 +229,8 @@ # Edk2 Packages ####################################### # SPI logging requires local patch: InitializeMemoryServices() before Proc= essLibraryConstructorList() -# In-memory logging may require too many services for early core debug out= put +# Strongly suspect DebugLibSerialPort constructor presents PeiDxeSerialPor= tLibMem dependency on services as a bug +# - While RSC calls Initialize after dependencies and constructors are sat= isfied !if $(RELEASE_LOGGING) =3D=3D TRUE DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebug= LibReportStatusCode.inf !endif @@ -257,7 +256,7 @@ FspWrapperPlatformLib|$(PLATFORM_PACKAGE)/FspWrapper/Library/PeiFspWrapp= erPlatformLib/PeiFspWrapperPlatformLib.inf MultiBoardInitSupportLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/MultiB= oardInitSupportLib/PeiMultiBoardInitSupportLib.inf TestPointLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointLib/PeiTestPointL= ib.inf -!if ($(TARGET) =3D=3D DEBUG || $(TESTING) =3D=3D TRUE) +!if ($(TARGET) =3D=3D DEBUG || $(RELEASE_LOGGING) =3D=3D TRUE) TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/Pei= TestPointCheckLib.inf !endif SetCacheMtrrLib|$(PLATFORM_PACKAGE)/Library/SetCacheMtrrLib/SetCacheMtrr= LibNull.inf @@ -287,7 +286,8 @@ ####################################### # Edk2 Packages ####################################### -# In-memory logging may require too many services for early core debug out= put +# Strongly suspect DebugLibSerialPort constructor presents PeiDxeSerialPor= tLibMem dependency on services as a bug +# - While RSC calls Initialize after dependencies and constructors are sat= isfied !if ($(USE_MEMORY_LOGGING) =3D=3D TRUE || $(USE_HDMI_DEBUG_PORT) =3D=3D TR= UE) DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebug= LibReportStatusCode.inf !endif @@ -315,7 +315,7 @@ MultiBoardInitSupportLib|$(PLATFORM_PACKAGE)/PlatformInit/Library/MultiB= oardInitSupportLib/DxeMultiBoardInitSupportLib.inf TestPointLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointLib/DxeTestPointL= ib.inf =20 -!if ($(TARGET) =3D=3D DEBUG || $(TESTING) =3D=3D TRUE) +!if ($(TARGET) =3D=3D DEBUG || $(RELEASE_LOGGING) =3D=3D TRUE) TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/Dxe= TestPointCheckLib.inf !endif ####################################### @@ -346,7 +346,8 @@ ####################################### # Edk2 Packages ####################################### -# In-memory logging may require too many services for early core debug out= put +# Strongly suspect DebugLibSerialPort constructor presents PeiDxeSerialPor= tLibMem dependency on services as a bug +# - While RSC calls Initialize after dependencies and constructors are sat= isfied !if ($(USE_MEMORY_LOGGING) =3D=3D TRUE || $(USE_HDMI_DEBUG_PORT) =3D=3D TR= UE) DebugLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebug= LibReportStatusCode.inf !endif @@ -370,7 +371,7 @@ BoardAcpiEnableLib|$(PLATFORM_PACKAGE)/Acpi/Library/MultiBoardAcpiSuppor= tLib/SmmMultiBoardAcpiSupportLib.inf MultiBoardAcpiSupportLib|$(PLATFORM_PACKAGE)/Acpi/Library/MultiBoardAcpi= SupportLib/SmmMultiBoardAcpiSupportLib.inf TestPointLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointLib/SmmTestPointL= ib.inf -!if ($(TARGET) =3D=3D DEBUG || $(TESTING) =3D=3D TRUE) +!if ($(TARGET) =3D=3D DEBUG || $(RELEASE_LOGGING) =3D=3D TRUE) TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/Smm= TestPointCheckLib.inf !endif =20 @@ -408,12 +409,12 @@ MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf { DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + # Reverse-ranked priority list +!if $(USE_MEMORY_LOGGING) =3D=3D TRUE + SerialPortLib|MdeModulePkg/Library/PeiDxeSerialPortLibMem/PeiSerialP= ortLibMem.inf +!endif !if $(USE_PEI_SPI_LOGGING) =3D=3D TRUE SerialPortLib|$(PLATFORM_BOARD_PACKAGE)/Library/PeiSerialPortLibSpiF= lash/PeiSerialPortLibSpiFlash.inf -!else -!if $(USE_MEMORY_LOGGING) =3D=3D TRUE - SerialPortLib|MdeModulePkg/Library/PeiDxeSerialPortLibMem/PeiSerialP= ortLibMem.inf -!endif !endif !if $(USE_HDMI_DEBUG_PORT) =3D=3D TRUE SerialPortLib|$(PLATFORM_BOARD_PACKAGE)/Library/I2cHdmiDebugSerialPo= rtLib/PeiI2cHdmiDebugSerialPortLib.inf @@ -431,10 +432,14 @@ IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf { SiliconPolicyInitLib|$(PLATFORM_SI_PACKAGE)/Library/PeiSiliconPolicy= InitLibDependency/PeiPreMemSiliconPolicyInitLibDependency.inf + NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf + NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf } IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf { SiliconPolicyInitLib|$(PLATFORM_SI_PACKAGE)/Library/PeiSiliconPolicy= InitLibDependency/PeiPostMemSiliconPolicyInitLibDependency.inf + NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf + NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf } !else # @@ -444,6 +449,8 @@ IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf { SiliconPolicyInitLib|MinPlatformPkg/PlatformInit/Library/SiliconPoli= cyInitLibNull/SiliconPolicyInitLibNull.inf + NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf + NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf } # # In FSP Dispatch mode the policy will be installed after FSP-S dispatch= ed (only PrePolicy silicon-init executed). @@ -452,6 +459,8 @@ IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf { SiliconPolicyInitLib|MinPlatformPkg/PlatformInit/Library/SiliconPoli= cyInitLibNull/SiliconPolicyInitLibNull.inf + NULL|SecurityPkg/Library/HashInstanceLibSha1/HashInstanceLibSha1.inf + NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf } !endif =20 @@ -555,6 +564,7 @@ MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRun= timeDxe.inf { DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + # Reverse-ranked priority list !if $(USE_MEMORY_LOGGING) =3D=3D TRUE SerialPortLib|MdeModulePkg/Library/PeiDxeSerialPortLibMem/DxeSerialP= ortLibMem.inf !endif @@ -563,12 +573,12 @@ !endif gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|($(USE_MEMORY_= LOGGING) || $(USE_HDMI_DEBUG_PORT)) - gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|512 + gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1024 } - # TODO: Still requires a little more thought MdeModulePkg/Universal/StatusCodeHandler/Smm/StatusCodeHandlerSmm.inf { DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + # Reverse-ranked priority list !if $(USE_MEMORY_LOGGING) =3D=3D TRUE SerialPortLib|MdeModulePkg/Library/PeiDxeSerialPortLibMem/SmmSerialP= ortLibMem.inf !endif @@ -577,8 +587,9 @@ !endif gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|($(USE_MEMORY_= LOGGING) || $(USE_HDMI_DEBUG_PORT)) - gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|512 + gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeMemorySize|1024 } +# TODO: Add NvmExpressDxe if supporting Newgate and RayleighSLS MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.inf MdeModulePkg/Bus/Ata/AtaBusDxe/AtaBusDxe.inf MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoar= dPkgPcd.dsc b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoa= rdPkgPcd.dsc index 490c3ee6bf76..3991c6f17c44 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkgPcd= .dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkgPcd= .dsc @@ -13,9 +13,10 @@ # ##########################################################################= ###### =20 -# TODO: Harden and tune platform by PCDs -# TODO: Consider removing PCDs declared by build report to be unused (but = confirm first) -# - Also, consider more "fixed" and more "dynamic"/"patchable" +# TODO: +# - Harden and tune platform by PCDs +# - Consider removing PCDs declared by build report to be unused (but conf= irm first) +# - Also, consider more "fixed" and more "dynamic"/"patchable" =20 [PcdsFixedAtBuild.common] ###################################### @@ -118,13 +119,14 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdPs2MouseExtendedVerification|FALSE # = TODO/TEST gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|FALSE gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmEnableBspElection|FALSE + # TODO: Hook-up memory, SMM and SMI handler profiling gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileEnable|FALSE =20 # TODO: Prune this list to relevant features only !if gMinPlatformPkgTokenSpaceGuid.PcdBootStage >=3D 6 - # FIXME: SMM path also PatchAndLoadAcpiTable() - gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable = |FALSE - # PcdIpmiFeatureEnable will not be enabled (no BMC) + gAcpiDebugFeaturePkgTokenSpaceGuid.PcdAcpiDebugFeatureEnable = |TRUE + gAcpiDebugFeaturePkgTokenSpaceGuid.PcdUseSmmVersion = |FALSE +# NOTE: PcdIpmiFeatureEnable will not be enabled (no BMC) # TODO: Can be build-time (user) choice gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureEnable = |FALSE gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable = |TRUE @@ -132,12 +134,9 @@ gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbiosFeatureEnable = |TRUE # Requires actual hook-up gUsb3DebugFeaturePkgTokenSpaceGuid.PcdUsb3DebugFeatureEnable = |FALSE - # FIXME: (Similar) DXE module is duplicate? - gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable = |FALSE - # FIXME: Must BootLogoEnableLogo() to turn platform logo into boot logo - # - BGRT must be BMP, but this duplicates FSP logo. Can GetSectionFromAn= yFv()? - gLogoFeaturePkgTokenSpaceGuid.PcdLogoFeatureEnable = |FALSE - gLogoFeaturePkgTokenSpaceGuid.PcdJpgEnable = |FALSE + # FIXME: Version2 not working - doesn't challenge for password + gUserAuthFeaturePkgTokenSpaceGuid.PcdUserAuthenticationFeatureEnable = |TRUE + gLogoFeaturePkgTokenSpaceGuid.PcdLogoFeatureEnable = |TRUE !endif =20 ###################################### @@ -209,7 +208,7 @@ # Board Configuration ###################################### gKabylakeOpenBoardPkgTokenSpaceGuid.PcdMultiBoardSupport|FALSE - gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable|FALSE # TODO: Enable i= f supporting Newgate + gKabylakeOpenBoardPkgTokenSpaceGuid.PcdTbtEnable|FALSE # TODO: Enable i= f supporting Newgate and RayleighSLS =20 [PcdsFixedAtBuild.common] ###################################### @@ -245,16 +244,29 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdBrowserSubtitleTextColor|0x0 gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdFastPS2Detection|TRUE # TODO/TEST +!if FALSE # FIXME: Causes DxeTestPointCheck ASSERT + # Guard DXE phase in non-stop mode, preferred over UAF detection (mutual= ly exclusive) + # NOTE: SMM phase requires disabling PcdCpuSmmRestrictedMemoryAccess, so= only enable to test + # TODO/TEST: Also test with guarded pool-head and with UAF detection fea= ture + gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask|0x43 +#!else + # Guard DXE phase preferred over UAF detection (mutually exclusive) + # TODO: Consider performance impact on release builds + gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPropertyMask|0x03 +!endif + # Protects loader, BS and RT code and data. TODO: Should not protect cod= e and also ACPI memory? + gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPageType|0x7E + gEfiMdeModulePkgTokenSpaceGuid.PcdHeapGuardPoolType|0x7E gEfiMdeModulePkgTokenSpaceGuid.PcdHwErrStorageSize|0x00000800 gEfiMdeModulePkgTokenSpaceGuid.PcdLoadModuleAtFixAddressEnable|$(TOP_MEM= ORY_ADDRESS) gEfiMdeModulePkgTokenSpaceGuid.PcdMaxHardwareErrorVariableSize|0x400 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x8000 -!if $(TESTING) =3D=3D TRUE - # Test with non-stop mode, so not disabling for loader. - gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask|0x43 +!if $(RELEASE_LOGGING) =3D=3D TRUE + # Using non-stop mode, so not disabling for loader. NOTE/TEST: Reconside= r use with SMM, which causes SMM profiling to be enabled + gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask|0x41 !else - # FIXME: Can be broken for CSM. At this time, be permissive for loader. - gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask|0x83 + # FIXME: At this time, be permissive for loader + gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask|0x81 !endif gEfiMdeModulePkgTokenSpaceGuid.PcdReclaimVariableSpaceAtEndOfDxe|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE @@ -269,10 +281,10 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl|FALSE !endif =20 - # UPDs are updated at runtime, don't bother measuring + # Measure default UPDs, code to update UPDs is measured as well # BUGBUG: FSP-S measurement returns DEVICE_ERROR from PtpCrbTpmCommand()= - Step 0. # - Similarly, Tcg2Dxe.c:Tpm2GetCapabilityManufactureID() - first comman= d - fails? - gIntelFsp2WrapperTokenSpaceGuid.PcdFspMeasurementConfig|0x00000006 + gIntelFsp2WrapperTokenSpaceGuid.PcdFspMeasurementConfig|0x80000006 =20 gPcAtChipsetPkgTokenSpaceGuid.PcdAcpiIoBarEnableMask|0x80 gPcAtChipsetPkgTokenSpaceGuid.PcdAcpiIoPciBarRegisterOffset|0x40 @@ -435,6 +447,9 @@ # @ValidRange 0x80000001 | 0 - 4 gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|3 =20 + # Hypothetically, remove all but the trusted console input, but there's = no callback + gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE + [PcdsFixedAtBuild.IA32] ###################################### # Edk2 Configuration @@ -522,7 +537,7 @@ gKabylakeOpenBoardPkgTokenSpaceGuid.PcdLowPowerS0Idle|1 gKabylakeOpenBoardPkgTokenSpaceGuid.PcdPciExpNative|1 =20 - # Thunderbolt Configuration (FIXME: Remove if not supporting Newgate) + # Thunderbolt Configuration (FIXME: Remove if not supporting Newgate and= RayleighSLS) gKabylakeOpenBoardPkgTokenSpaceGuid.PcdDTbtAcDcSwitch|0x0 gKabylakeOpenBoardPkgTokenSpaceGuid.PcdDTbtAcpiGpeSignature|0 gKabylakeOpenBoardPkgTokenSpaceGuid.PcdDTbtAcpiGpeSignaturePorting|0 @@ -567,5 +582,5 @@ !endif !if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable =3D=3D TRUE gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_= VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS - gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"|gTcg2C= onfigFormSetGuid|0x8|3|NV,BS + gEfiSecurityPkgTokenSpaceGuid.PcdTpm2AcpiTableRev|L"TCG2_VERSION"|gTcg2C= onfigFormSetGuid|0x8|4|NV,BS !endif --=20 2.37.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93287): https://edk2.groups.io/g/devel/message/93287 Mute This Topic: https://groups.io/mt/93507096/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 10 07:35:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93288+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93288+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1662486194; cv=none; d=zohomail.com; s=zohoarc; b=apHVWOxW816nCKi/tVG/d6CKKY3yKUQTwAkmxIln6j1I7j22GZbeQWXNv078Vn+pTM2Q7Cgzsiy7JtolktLWVIovXPL0Wf0VBEyRFVqvBdiLk8HNuwA29KSe6eYFoicIn6xMIO8EAoooqbJ6fAgGO/qCnsiSYWKpOOcf8/TJ7/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662486194; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=mlea4ceerIUsdGSDcBSXtXZlNlKEBChEeH3vBsqnGK0=; b=corBB+tQxnZxTVPHHHLuEy9x4pKC3r6ONMMnmNfpRtM9uYQoCl5vrpX5X85QP0qILAZLFplS269BL8lDO/Ig8xukC+BUQRhUyrg0ow/Fi1kvBNn9jr1kEns4fjhMzyu9qoVCGHLhD22p427lqJbdcKGGlLZB2BITTQqOGnPRWDo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93288+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1662486194158965.5443157533723; Tue, 6 Sep 2022 10:43:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id CI5hYY1788612xhOZQ2teqVj; Tue, 06 Sep 2022 10:43:13 -0700 X-Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by mx.groups.io with SMTP id smtpd.web08.2377.1662486192931954863 for ; Tue, 06 Sep 2022 10:43:13 -0700 X-Received: by mail-qk1-f173.google.com with SMTP id w18so8714434qki.8 for ; Tue, 06 Sep 2022 10:43:12 -0700 (PDT) X-Gm-Message-State: WKaMeZmL0ukgqdfhHsu3ci1bx1787277AA= X-Google-Smtp-Source: AA6agR4BPMuf0bXmnBFgrBy0tdoJbh4m4wCKcqqVVR82H8KStl+z/4Z3fYoxL//a70YNQd0H61JkgQ== X-Received: by 2002:a05:620a:4147:b0:6bb:86e5:e4e5 with SMTP id k7-20020a05620a414700b006bb86e5e4e5mr37567565qko.334.1662486191758; Tue, 06 Sep 2022 10:43:11 -0700 (PDT) X-Received: from aturtleortwo-benjamindomain.. ([2607:f2c0:e98c:e:b132:3785:fa38:a51]) by smtp.gmail.com with ESMTPSA id bi3-20020a05620a318300b006b61b2cb1d2sm11221482qkb.46.2022.09.06.10.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 10:43:11 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Sai Chaganty , Isaac Oram , Nate DeSimone , Chasel Chiu Subject: [edk2-devel][edk2-platforms][PATCH v1 3/7] KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi: Improvements for EC ACPI Date: Tue, 6 Sep 2022 13:42:54 -0400 Message-Id: <5febbddf7f101a0a53a948f6c9c1a2c1866891dd.1662485273.git.benjamin.doron00@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,benjamin.doron00@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662486193; bh=IOlAKi2zYrkPfcQh6XufsN8nmfb29n6yC+J4ocMQ00Q=; h=Cc:Date:From:Reply-To:Subject:To; b=H91h4iWDuQg5q3EiiwEMrjMyemxyp+8xvjRf/gD9E4TMU69Hxmog/r/MU12vhIGLc/x UIQZ4RZlJOv7WrOH7yt8oaKSHjdeCGzcN3Mvm7beRkmSH9PSljRyyDBc/f6nIucH8rtK/ XmYRx9UpCHJu9m44BW/2HwSu4R8QGnvIBrc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662486194758100011 Content-Type: text/plain; charset="utf-8" Perform EC read and write via SystemIO when EmbeddedControl is unavailable. Not properly tested yet. Re-sync against coreboot port. Does not yet handle SMM traps. In-progress. Cc: Sai Chaganty Cc: Isaac Oram Cc: Nate DeSimone Cc: Chasel Chiu Signed-off-by: Benjamin Doron --- .../Acpi/BoardAcpiTables.inf | 4 + .../AspireVn7Dash572G/Acpi/BoardSsdt.asl | 29 +++- .../AspireVn7Dash572G/Acpi/battery.asl | 11 +- .../AspireVn7Dash572G/Acpi/ec.asl | 130 ++++++++-------- .../AspireVn7Dash572G/Acpi/eclib.asl | 141 ++++++++++++++++++ .../AspireVn7Dash572G/Acpi/mainboard.asl | 6 +- .../AspireVn7Dash572G/Acpi/thermal.asl | 16 +- 7 files changed, 256 insertions(+), 81 deletions(-) create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/A= cpi/eclib.asl diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/Boa= rdAcpiTables.inf b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Ac= pi/BoardAcpiTables.inf index 806c0d2575c8..9a31b400a35e 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/BoardAcpiT= ables.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/BoardAcpiT= ables.inf @@ -13,5 +13,9 @@ MODULE_TYPE =3D USER_DEFINED VERSION_STRING =3D 1.0 =20 +[Packages] + KabylakeOpenBoardPkg/OpenBoardPkg.dec + MdePkg/MdePkg.dec + [Sources] BoardSsdt.asl diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/Boa= rdSsdt.asl b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/Boa= rdSsdt.asl index cdec0434883e..d1609131ecf7 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/BoardSsdt.= asl +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/BoardSsdt.= asl @@ -6,17 +6,44 @@ =20 **/ =20 +#include + DefinitionBlock ( "Board.aml", "SSDT", - 0x02, + EFI_ACPI_6_3_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION, "ACRSKL", "AcerSKL ", 0x20141018 ) { + External (SSMP, IntObj) + External (SMIF, IntObj) External (\MDBG, MethodObj) =20 + // SW SMI data port + OperationRegion (DPRT, SystemIO, 0xB3, 1) + Field (DPRT, ByteAcc, Lock, Preserve) + { + SSDP, 8 + } + + Name (ESMI, 0xDD) // TODO: Patch at runtime + Method (TRPS, 3, Serialized) + { + \DBGH (Concatenate ("SMIF: ", ToHexString (Arg0))) + \DBGH (Concatenate ("Param0: ", ToHexString (Arg1))) + \DBGH (Concatenate ("Param1: ", ToHexString (Arg2))) + + Local0 =3D Arg1 + Local0 |=3D (Arg2 << 4) + \DBGH (Concatenate ("Local0: ", ToHexString (Local0))) + + SMIF =3D Arg0 + SSDP =3D Local0 + SSMP =3D ESMI + } + // Debug print helper Method (DBGH, 1) { diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/bat= tery.asl b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/batte= ry.asl index 5ae4bdca89d5..1bf652c4a01e 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/battery.asl +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/battery.asl @@ -184,11 +184,17 @@ Method (GBIF, 3, NotSerialized) Local7 =3D EBSN #endif Name (SERN, Buffer (0x06) { " " }) + /* Convert hex to decimal. + * - There appears to be a bug in the vendor's implementation: + * The correct answer has, or can have, 5 digits, so Local6 =3D 5. + * Also see "SERN" buffer. + * - Userspace prints reversed serial number? + */ Local6 =3D 4 While (Local7) { Divide (Local7, 10, Local5, Local7) - SERN[Local6] =3D (Local5 + 0x30) // Add ASCII 0x30 to get character + SERN[Local6] =3D (Local5 + 0x30) // Add 0x30 to get numeric charact= er Local6-- } =20 @@ -310,7 +316,7 @@ Method (GBST, 4, NotSerialized) // All on one page If (Arg2) { Local1 *=3D Local3 - Local1 /=3D 1000 /* Remainder ignored */ + Local1 /=3D 1000 /* Remainder ignored by vendor */ } } Else @@ -382,6 +388,7 @@ Device (BAT0) =20 Method (_BIF, 0, NotSerialized) // _BIF: Battery Information { + /* Bitwise AND by vendor is lossy? */ Local6 =3D B0ST Local7 =3D 20 While (Local6 && Local7) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/ec.= asl b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/ec.asl index df71dd69b491..b8f0dba1597f 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/ec.asl +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/ec.asl @@ -5,18 +5,33 @@ =20 **/ =20 -/* Global TODO: (externally: Optimus GC6 and GPS) +/* + * Global TODO: (externally: Optimus GC6 and GPS) * - TRPS: This is SMI 0xDD, likely in SmmOemDriver. This SW SMI adds to a= nd executes * a table of function pointers produced throughout the OEM 'value= -add' stack. + * - Arg0 - "SFUN" - is index into "$FNC" pointer table? It's easi= er to + * correlate *CommonService use: Offset 13 creates TRPS handlers. + * - Known functions: + * - 0x80 calls offset 0 in ACER_BOOT_DEVICE_SERVICE_PROTOCOL_GU= ID. + * - NB: efiXplorer can miss InstallProtocolInterface() when I= nterface is local + * - 0x81 toggles Intel Dynamic Acceleration in IA32_MISC_ENABLE= MSR. + * - 0x82 does switch on "OSYS" to set EC byte. Suspect this is = for OS features. + * (A CVE exists in the vendor code only if it never sets the offs= et in the buffer.) + * - RBEC/WBEC/MBEC: This is SMI 0xDD, "functions" 0x10, 0x11 and 0x12 in = SmmKbcDriver, + * added into SmmCommonService table at its protocol notify. Perfor= ms read, write + * and read-modify-write from buffer. We will use ACPI instead. * - WMI: This is likely SMI 0xD0 in A01WMISmmCallback. This SW SMI likely= uses the WMI * object and consumes the OEM 'value-add' stack for EC and presuma= bly the A01* - * OEM/ODM 'value-add' stack. + * OEM/ODM 'value-add' stack. An SSDT contains the device and EC0 p= rovides "GCMS" + * and "GOTS" method helpers. * - * Generally, more reversing is needed. + * Generally, more information is needed. + * TODO: Restore stripped features using reference code (except, check Boa= rdAcpiDxe first) + * and implement more board features: lid and touchpad trigger wake = from S3, + * Fn-Ctrl swap, sticky Fn keys and always-on USB charger. */ -/* TODO: Implement more features around reference code (except, check Boar= dAcpiDxe first) */ =20 -// TODO: Enable and test +// TODO/TEST #undef LGMR_ENABLED =20 // "DIDX" - "DeviceIdX" is uninitialised, cannot use "BRTN" method yet @@ -40,17 +55,7 @@ Device (\_SB.PCI0.LPCB.EC0) IO (Decode16, 0x66, 0x66, 0, 1) }) =20 - OperationRegion (ECO1, SystemIO, 0x62, 1) - Field (ECO1, ByteAcc, Lock, Preserve) - { - PX62, 8 - } - - OperationRegion (ECO2, SystemIO, 0x66, 1) - Field (ECO2, ByteAcc, Lock, Preserve) - { - PX66, 8 - } + #include "eclib.asl" =20 #ifdef LGMR_ENABLED OperationRegion (ECMB, SystemMemory, LGMR, 0x200) @@ -84,10 +89,12 @@ Device (\_SB.PCI0.LPCB.EC0) EX3G, 1, /* 3G */ , 3, RFEX, 1, /* RF present */ -#if 0 // Merely a guess - Offset (0x55), - BTH0, 8, /* Battery threshold? TODO: Actually diff in modified = vendor FW */ -#endif +/* + * NOTE: Some reverse engineering, as well as corroborating vendor's hidde= n SetupUtility + * options with the EC's memory space, suggests that offset 0x55 might be = the battery + * threshold + * - TODO: Actually diff changes in modified vendor FW + */ Offset (0x57), , 7, AHKB, 1, /* Hotkey triggered */ @@ -204,14 +211,19 @@ Device (\_SB.PCI0.LPCB.EC0) { TINI () EOSS =3D 0x05 -// OSIN () + // OSYS retrieved by SMM, Arg3 is unused +// TRPS (0x82, 1, 0) =20 - /* Other pages return valid data too, but this seems to be the page + /* + * Other pages return valid data too, but this seems to be the page * we are expecting - persistently in ectool dump with vendor firm= ware - * FIXME: Contents of other pages? */ + * FIXME: Contents of other pages? + */ ETID =3D 0x20 } } + + /* iGFX RC method call stripped */ } =20 Method (TINI, 0, NotSerialized) @@ -223,10 +235,8 @@ Device (\_SB.PCI0.LPCB.EC0) } Else { - /* WBEC: Called SMI function 0x11 */ -// EC_WRITE (0x92, 0) // ETAF =3D 0 - /* MBEC: Called SMI function 0x12 */ -// MBEC (0x10, 0xFD, 0x02) // ETEE =3D 1 + WBEC (0x92, 0) // ETAF =3D 0 + MBEC (0x10, 0xFD, 0x02) // ETEE =3D 1 } } =20 @@ -234,10 +244,8 @@ Device (\_SB.PCI0.LPCB.EC0) Method (ECPS, 1, NotSerialized) // _PTS: Prepare To Sleep { ECSS =3D Arg0 -// COSI =3D OSYS -// SPR1 =3D Arg0 - /* TRPS: Generic SMI trap handler */ -// TRPS (0x82, 0x02) + // OSYS retrieved by SMM +// TRPS (0x82, 0x02, Arg0) If ((Arg0 =3D=3D 3) || (Arg0 =3D=3D 4)) { RFST =3D RFEX @@ -250,38 +258,23 @@ Device (\_SB.PCI0.LPCB.EC0) EOSS =3D Arg0 TINI () Notify (BAT0, 0x81) // Information Change -// COSI =3D OSYS -// SPR1 =3D Arg0 - /* TRPS: Generic SMI trap handler */ -// TRPS (0x82, 0x03) + // OSYS retrieved by SMM +// TRPS (0x82, 0x03, Arg0) If ((Arg0 =3D=3D 3) || (Arg0 =3D=3D 4)) { RFEX =3D RFST Notify (SLPB, 0x02) // Device Wake } + /* iGFX RC method call stripped */ } =20 -#if 0 // TODO: Figure out what this is for - Method (OSIN, 0, NotSerialized) + Method (MBEC, 3, Serialized) { - COSI =3D OSYS - /* TRPS: Generic SMI trap handler */ - TRPS (0x82, 1) - } -#endif - -#if 0 // TODO: Implement - Method (MBEC, 3, Serialized) // Read-Modify-Write - { - /* Based on similar methods/tables at - * https://github.com/linuxhw/ACPI/blob/master/Notebook/Sony/SVE1713/S= VE1713S1RW/506CDC50E671#L9359 - * which use ASL instead of SMM calls */ - Local0 =3D EC_READ (Arg0) + Local0 =3D RBEC (Arg0) Local0 &=3D Arg1 Local0 |=3D Arg2 - EC_WRITE (Arg0, Local0) + WBEC (Arg0, Local0) } -#endif =20 /* Graphical hotkey */ Method (_Q19, 0, NotSerialized) @@ -316,7 +309,8 @@ Device (\_SB.PCI0.LPCB.EC0) } ElseIf ((Local1 > 0x80) && (Local1 < 0xA0)) { - TPEN ^=3D 1 /* TODO: Not working. What else does WMI do here? */ + /* TODO: Not working when called by HID mode. What does WMI do h= ere? */ + TPEN ^=3D 1 } } } @@ -330,8 +324,7 @@ Device (\_SB.PCI0.LPCB.EC0) } Else { - /* MBEC: Called SMI function 0x12 */ -// MBEC (0x92, 0xF7, 0x08) // EOSD =3D 1 + MBEC (0x92, 0xF7, 0x08) // EOSD =3D 1 } =20 Sleep (500) @@ -341,9 +334,8 @@ Device (\_SB.PCI0.LPCB.EC0) =20 Method (_Q3F, 0, NotSerialized) { - \DBGH ("EC Query: 0x3F - TRPS") - /* TRPS: Generic SMI trap handler */ -// TRPS (0x80, 0) + // Arg3 is unused +// TRPS (0x80, 0, 0) } =20 Method (_Q40, 0, NotSerialized) @@ -397,46 +389,44 @@ Device (\_SB.PCI0.LPCB.EC0) =20 Method (_Q60, 0, NotSerialized) { - \DBGH ("EC Query: 0x60 -> WMI") + \DBGH ("EC Query (0x60): WMI") } =20 Method (_Q61, 0, NotSerialized) { - \DBGH ("EC Query: 0x61 -> WMI") + \DBGH ("EC Query (0x61): WMI") } =20 Method (_Q62, 0, NotSerialized) { - \DBGH ("EC Query: 0x62 -> Optimus GC6") + \DBGH ("EC Query (0x62): Optimus GC6 or NVIDIA GPS") } =20 Method (_Q63, 0, NotSerialized) { - \DBGH ("EC Query: 0x63 -> Optimus GC6") + \DBGH ("EC Query (0x63): Optimus GC6 or NVIDIA GPS") } =20 Method (_Q67, 0, NotSerialized) { - \DBGH ("EC Query: 0x67 -> NVIDIA GPS") + \DBGH ("EC Query (0x67): NVIDIA GPS") } =20 Method (_Q68, 0, NotSerialized) { - \DBGH ("EC Query: 0x68 -> NVIDIA GPS") + \DBGH ("EC Query (0x68): NVIDIA GPS") } =20 Method (_Q6C, 0, NotSerialized) { - \DBGH ("EC Query: 0x6C - TRPS") - /* TRPS: Generic SMI trap handler */ -// TRPS (0x81, 0) + // Arg3 is unused +// TRPS (0x81, 0, 0) } =20 Method (_Q6D, 0, NotSerialized) { - \DBGH ("EC Query: 0x6D - TRPS") - /* TRPS: Generic SMI trap handler */ -// TRPS (0x81, 1) + // Arg3 is unused +// TRPS (0x81, 1, 0) } =20 #include "ac.asl" diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/ecl= ib.asl b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/eclib.a= sl new file mode 100644 index 000000000000..57921eb09c8b --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/eclib.asl @@ -0,0 +1,141 @@ +/** @file + This file contains the EC library for ACPI. + + Copyright (c) 2021, Baruch Binyamin Doron + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +Mutex (EMTX, 0) + +OperationRegion (ECO1, SystemIO, EC_D_PORT, 1) +Field (ECO1, ByteAcc, Lock, Preserve) +{ + ECDT, 8 +} + +OperationRegion (ECO2, SystemIO, EC_C_PORT, 1) +Field (ECO2, ByteAcc, Lock, Preserve) +{ + ECSC, 8 +} + +// Send EC command +// Return time elapsed on success, EC_TIME_OUT on failure +Method (SECC, 1, Serialized) +{ + // Wait EC timeout for input buffer to be empty + Local0 =3D 0 + While ((ECSC & EC_S_IBF) && Local0 < EC_TIME_OUT) + { + Stall (1) + Local0++ + } + // Send command if timeout was not reached + If (Local0 < EC_TIME_OUT) + { + ECSC =3D Arg0 + } + + // Return status + Return (Local0) +} + +// Send EC data +// Return time elapsed on success, EC_TIME_OUT on failure +Method (SECD, 1, Serialized) +{ + // Wait EC timeout for input buffer to be empty + Local0 =3D 0 + While ((ECSC & EC_S_IBF) && Local0 < EC_TIME_OUT) + { + Stall (1) + Local0++ + } + // Send data if timeout was not reached + If (Local0 < EC_TIME_OUT) + { + ECDT =3D Arg0 + } + + // Return status + Return (Local0) +} + +// Receive EC data +// Return data on success, EC_TIME_OUT on failure +Method (RECD, 0, Serialized) +{ + // Wait EC timeout for input buffer to be empty + Local0 =3D 0 + While ((ECSC & EC_S_OBF) && Local0 < EC_TIME_OUT) + { + Stall (1) + Local0++ + } + // Return data + If (Local0 < EC_TIME_OUT) + { + Return (ECDT) + } + + // Timeout exceeded, return failure + Return (Local0) +} + +// Read EC byte +// Return data on success, EC_TIME_OUT on failure +Method (RBEC, 1, Serialized) +{ + // Check for mutex acquired to not run with another function + Local0 =3D Acquire (EMTX, 0xFFFF) + If (Local0 =3D=3D 0) + { + Local0 =3D SECC (EC_C_ACPI_READ) + } + + If (Local0 < EC_TIME_OUT) + { + // Send address + Local0 =3D SECD (Arg0) + } + + If (Local0 < EC_TIME_OUT) + { + // Receive data + Local0 =3D RECD () + } + + Release (EMTX) + Return (Local0) +} + +// Write EC byte +// Return time elapsed on success, EC_TIME_OUT on failure +Method (WBEC, 2, Serialized) +{ + // Check for mutex acquired to not run with another function + Local0 =3D Acquire (EMTX, 0xFFFF) + If (Local0 =3D=3D 0) + { + Local0 =3D SECC (EC_C_ACPI_READ) + } + + If (Local0 < EC_TIME_OUT) + { + // Send address + Local0 =3D SECD (Arg0) + } + + If (Local0 < EC_TIME_OUT) + { + // Send data + Local0 =3D SECD (Arg1) + } + + Release (EMTX) + // Return data + Return (Local0) +} diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/mai= nboard.asl b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/mai= nboard.asl index 7a73d37429d0..46edce92fb47 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/mainboard.= asl +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/mainboard.= asl @@ -6,25 +6,27 @@ **/ =20 // TODO: Add HID support for touchpad, etc. +// - Does board actually support DPTF? #include "thermal.asl" =20 External (\_SB.SLPB, DeviceObj) =20 -// TODO: Need hooks from BoardAcpiDxe - Scope (_SB) { Method (MPTS, 1, NotSerialized) // _PTS: Prepare To Sleep { ^PCI0.LPCB.EC0.ECPS (Arg0) + /* TBT and DTS not supported, TPM.PTS can be called elsewhere */ } =20 Method (MWAK, 1, Serialized) // _WAK: Wake { ^PCI0.LPCB.EC0.ECWK (Arg0) + /* No GPIO expander, 8254 clock-gating and PCIe PME can be performed e= lsewhere */ =20 If ((Arg0 =3D=3D 3) || (Arg0 =3D=3D 4)) { + /* DTS and TBT not supported, iGFX RC variable update stripped */ Notify (LID0, 0x80) // Status Change } } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/the= rmal.asl b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/therm= al.asl index 805ee0700cd0..5d6604b41a9f 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/thermal.asl +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Acpi/thermal.asl @@ -15,12 +15,16 @@ Scope (_TZ) { #ifdef LGMR_ENABLED Local0 =3D \_SB.PCI0.LPCB.EC0.MS0T -// Local1 =3D \_SB.PCI0.LPCB.EC0.MCSS + Local1 =3D \_SB.PCI0.LPCB.EC0.MCSS + /* Suppress warning over reading status flag by dummy OR */ + Or (Local1, 1, Local1) Local2 =3D \_SB.PCI0.LPCB.EC0.MOSD #else Local0 =3D \_SB.PCI0.LPCB.EC0.ES0T -// Local1 =3D \_SB.PCI0.LPCB.EC0.ESSF // "MCSS": Considering neighbour= ing bits, likely - // "ESSF" in thermals, not "ECSS" = in notify + /* "MCSS": Considering neighbouring bits, likely + * "ESSF" in thermals, not "ECSS" in power notifications */ + Local1 =3D \_SB.PCI0.LPCB.EC0.ESSF + Or (Local1, 1, Local1) Local2 =3D \_SB.PCI0.LPCB.EC0.EOSD #endif If (Local2) // Thermal trip @@ -59,7 +63,7 @@ Scope (_TZ) Else { /* MBEC: Called SMI function 0x12 */ -// \_SB.PCI0.LPCB.EC0.MBEC (0x90, 0xFE, Arg0) // SCPM =3D Arg0 + \_SB.PCI0.LPCB.EC0.MBEC (0x90, 0xFE, Arg0) // SCPM =3D Arg0 } } =20 @@ -89,6 +93,7 @@ Scope (_TZ) #else Local0 =3D \_SB.PCI0.LPCB.EC0.ES1T #endif + Return (C2K (Local0)) } =20 @@ -116,7 +121,6 @@ Scope (_TZ) Local0 =3D 30 } =20 - Local0 =3D ((Local0 * 10) + 2732) // Celsius to Kelvin - Return (Local0) + Return ((Local0 * 10) + 2732) // Celsius to centi-Kelvin } } --=20 2.37.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93288): https://edk2.groups.io/g/devel/message/93288 Mute This Topic: https://groups.io/mt/93507098/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 10 07:35:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93289+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93289+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1662486194; cv=none; d=zohomail.com; s=zohoarc; b=mhAkr5uFCrXkutCZe1OgXbdmLjsZ/GNb/C32yOd3aaM4+ErF1oWEjtjY3+bjV8AtDQMK0sqHEcPTUGrnLaUj/o2Z9bqatAP8X6mtSNaJwnSkHtn+kI1hLBEeIxvZ6CYZls+MMx3MsIWBpfP61mLyapMgADVDMlwD8Q0yuqpEEzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662486194; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=2rKNkJr8mg+u7L+LCNR4vjfMcANK3vDGmWWZLPpByXQ=; b=Z4+SWIzkYPdwc+bJmxZjONHR55EZAuG1mJV3fHmX1M5zY1PXqrjR8HUbMc2TSEYkFvd+DpG7iWp+BDgwAHtirfsohvN7y+dKw6gdxokBkfZzaSLR/Tp+DgQ/lf+Cn5sUlU+gBJ4GXfBZFY+D6t1HmqlI5ZXllCdg4DCSzUyZ/is= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93289+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1662486194896913.0684394879723; Tue, 6 Sep 2022 10:43:14 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id rdcKYY1788612xWZanof00Br; Tue, 06 Sep 2022 10:43:14 -0700 X-Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) by mx.groups.io with SMTP id smtpd.web09.2363.1662486190522809487 for ; Tue, 06 Sep 2022 10:43:13 -0700 X-Received: by mail-qk1-f179.google.com with SMTP id i9so2784075qka.0 for ; Tue, 06 Sep 2022 10:43:13 -0700 (PDT) X-Gm-Message-State: amF9q0ommX3RN00ZXMVXNKnMx1787277AA= X-Google-Smtp-Source: AA6agR6YehigM1Y+Mtxxzyj5j2ZandHz9guDu78F1ZVtgPpLoxzlRz2mYuPSIGBuLSJnhcZsBtljAg== X-Received: by 2002:ae9:e71a:0:b0:6bb:c3a7:936d with SMTP id m26-20020ae9e71a000000b006bbc3a7936dmr36440838qka.95.1662486192962; Tue, 06 Sep 2022 10:43:12 -0700 (PDT) X-Received: from aturtleortwo-benjamindomain.. ([2607:f2c0:e98c:e:b132:3785:fa38:a51]) by smtp.gmail.com with ESMTPSA id bi3-20020a05620a318300b006b61b2cb1d2sm11221482qkb.46.2022.09.06.10.43.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 10:43:12 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Sai Chaganty , Isaac Oram , Chasel Chiu , Nate DeSimone Subject: [edk2-devel][edk2-platforms][PATCH v1 4/7] KabylakeOpenBoardPkg/AspireVn7Dash572G/DxeBoardInitLib: Resets notify EC Date: Tue, 6 Sep 2022 13:42:55 -0400 Message-Id: <0438eacb8567e8a7b032900e88872445fca791c0.1662485273.git.benjamin.doron00@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,benjamin.doron00@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662486194; bh=NeqU1VE/rk9jVHnx5YCDwK5YpbFxDu2gZletBnt7WLA=; h=Cc:Date:From:Reply-To:Subject:To; b=kA5PVCMvT0et7TVFlBYYYlrSrT7oqzm44VEbtDTAla0B1b1XgtY9Q0ovEgxyRmFeDPz p3/FXmRudbrkK6WBQHbQI62nD4ctS3Tt/kIothuJ9WETMRyiOeUWoLibFZVfCjm9/QAam z8OrDfLcCa99iv37STxrKvCiH/nzM1V1314= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662486196719100019 Content-Type: text/plain; charset="utf-8" Add a callback to notify the EC of platform resets. Cc: Sai Chaganty Cc: Isaac Oram Cc: Chasel Chiu Cc: Nate DeSimone Signed-off-by: Benjamin Doron --- .../Library/BoardInitLib/DxeBoardInitLib.c | 92 ++++++++++++++++++- .../Library/BoardInitLib/DxeBoardInitLib.inf | 4 + 2 files changed, 91 insertions(+), 5 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/DxeBoardInitLib.c b/Platform/Intel/KabylakeOpenBoardPkg/Aspire= Vn7Dash572G/Library/BoardInitLib/DxeBoardInitLib.c index 5c5c26d85c58..07278d956ddc 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.c @@ -8,17 +8,22 @@ **/ =20 #include -#include +#include #include #include #include -#include +#include +#include +#include + +EFI_RESET_NOTIFICATION_PROTOCOL *mResetNotify =3D NULL; =20 /** - Update the EC's clock? + Update the EC's clock. =20 **/ VOID +EFIAPI EcSendTime ( VOID ) @@ -26,11 +31,13 @@ EcSendTime ( EFI_STATUS Status; EFI_TIME EfiTime; // Time could be negative (before 2016) - INTN EcTime; + INT32 EcTime; UINT8 EcTimeByte; INTN Index; UINT8 EcResponse; =20 + DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + Status =3D gRT->GetTime (&EfiTime, NULL); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_INFO, "Failed to retrieve current time\n")); @@ -56,25 +63,72 @@ EcSendTime ( if (!EFI_ERROR (Status)) { DEBUG ((DEBUG_INFO, "EC: response 0x%x\n", EcResponse)); } + + DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); } =20 /** - Configure EC + Process an EC time request. =20 **/ VOID +EFIAPI EcRequestsTime ( VOID ) { UINT8 Dat; =20 + DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + /* This is executed as protocol notify in vendor's RtKbcDriver when *Com= monService * protocol is installed. Effectively, this code could execute from the = entrypoint */ EcCmd90Read (0x79, &Dat); if (Dat & BIT0) { EcSendTime (); } + + DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); +} + +/** + Notify EC of reset events. + + @param[in] ResetType The type of reset to perform. + @param[in] ResetStatus The status code for the reset. + @param[in] DataSize The size, in bytes, of ResetData. + @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, o= r EfiResetShutdown + the data buffer starts with a Null-terminated st= ring, optionally + followed by additional binary data. The string i= s a description + that the caller may use to further indicate the = reason for the + system reset. For a ResetType of EfiResetPlatfor= mSpecific the data + buffer also starts with a Null-terminated string= that is followed + by an EFI_GUID that describes the specific type = of reset to + perform. + +**/ +VOID +EFIAPI +EcResetSystemHook ( + IN EFI_RESET_TYPE ResetType, + IN EFI_STATUS ResetStatus, + IN UINTN DataSize, + IN VOID *ResetData OPTIONAL + ) +{ + // If boolean PCD tokens 0xBD, 0xBE and 0xBF are set in vendor FW, + // OEM also sends command 0x5A with argument 0xAA via ACPI "CMDB" method= and stalls for + // 100000, then sets ResetType to EfiResetShutdown. + // PCD token 0xBF may be set in a separate function of DxeOemDriver if + // some bits of EC RAM offset 0x5E are set. + // TODO: More information is needed + if (ResetType =3D=3D EfiResetShutdown) { + EcCmd91Write (0x76, 7); // "ECSS" register + // TODO: Write twice, like OEM? + EcCmd91Write (0x76, 7); // "ECSS" register + // Now OEM calls function offset 2 in ACER_BOOT_DEVICE_SERVICE_PROTOCO= L_GUID. + // TODO: What does this do? + } } =20 /** @@ -89,7 +143,23 @@ BoardInitAfterPciEnumeration ( VOID ) { + EFI_STATUS Status; + + DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + + // Send EC the present time, if requested EcRequestsTime (); + + // Add a callback to gRT->ResetSystem() to notify EC, rather than hookin= g the table, + // (as vendor's DxeOemDriver does) + Status =3D gBS->LocateProtocol (&gEfiResetNotificationProtocolGuid, NULL= , (VOID **) &mResetNotify); + if (!EFI_ERROR (Status)) { + Status =3D mResetNotify->RegisterResetNotify (mResetNotify, EcResetSys= temHook); + ASSERT_EFI_ERROR (Status); + DEBUG ((DEBUG_INFO, "EC: Added callback to notify EC of resets\n")); + } + + DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); return EFI_SUCCESS; } =20 @@ -120,5 +190,17 @@ BoardInitEndOfFirmware ( VOID ) { + EFI_STATUS Status; + + DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + + // Remove ResetSystem callback. ACPI will be notifying EC of events + if (mResetNotify !=3D NULL) { + Status =3D mResetNotify->UnregisterResetNotify (mResetNotify, EcResetS= ystemHook); + ASSERT_EFI_ERROR (Status); + DEBUG ((DEBUG_INFO, "EC: Removed callback to notify EC of resets\n")); + } + + DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); return EFI_SUCCESS; } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/DxeBoardInitLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/Aspi= reVn7Dash572G/Library/BoardInitLib/DxeBoardInitLib.inf index 9a868ee15fb2..24747fa7b224 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.inf @@ -15,6 +15,7 @@ LIBRARY_CLASS =3D BoardInitLib =20 [LibraryClasses] + UefiBootServicesTableLib UefiRuntimeServicesTableLib DebugLib EcLib @@ -27,3 +28,6 @@ =20 [Sources] DxeBoardInitLib.c + +[Protocols] + gEfiResetNotificationProtocolGuid ## CONSUMES --=20 2.37.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93289): https://edk2.groups.io/g/devel/message/93289 Mute This Topic: https://groups.io/mt/93507099/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 10 07:35:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93290+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93290+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1662486196; cv=none; d=zohomail.com; s=zohoarc; b=mKR2MJPSG6MNynOwsVgYQ/Z7ACSuy42AOCDDC2sXjmd66sdBaBFD/Fh/8PU9RohVXQieJV0Gv6r8PVmUVYWlzM7t1pENRdJ1G9qhUUO6iSuFy3572y3OF2iuP4WAiMDwnWmEcCzevlGl+H1+RWgvGnYrQQv0ZNhKAELxOnIPqDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662486196; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=h6vzne2QwIxaS2ljhz0V/ss9d+jeXD9dQlcudxtVhhM=; b=mWwQIGC/0su58DMeR5dncPn+ohFHQ5xQaNxO3IHcIWrrnWSvcLAYKzjcwdrkkspvLEn17RbLyKDnnpbP3ruo9ec5Wl8uJCF2On2xiGaRSEihiNUPK9oMBWLlnmI9IOqTcx5mM+r5rddWlF0BIVxVOHQuKIDwTpWfAVA8T20kSus= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93290+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16624861968821005.4836689071894; Tue, 6 Sep 2022 10:43:16 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id NEn7YY1788612xOu7DxyT6eG; Tue, 06 Sep 2022 10:43:16 -0700 X-Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by mx.groups.io with SMTP id smtpd.web09.2364.1662486195558901002 for ; Tue, 06 Sep 2022 10:43:15 -0700 X-Received: by mail-qt1-f170.google.com with SMTP id x5so8601078qtv.9 for ; Tue, 06 Sep 2022 10:43:15 -0700 (PDT) X-Gm-Message-State: JNlY5m9iYRFoeVj7M6yH1TYJx1787277AA= X-Google-Smtp-Source: AA6agR6WpcSp6RJfG85YKOCCDPaE05JvvqZ+WTOxz2D0Zu21H9wS0dlkhYbYhZdtHIZ0ayUXML9woA== X-Received: by 2002:ac8:7d92:0:b0:344:aa94:4798 with SMTP id c18-20020ac87d92000000b00344aa944798mr44834074qtd.511.1662486194272; Tue, 06 Sep 2022 10:43:14 -0700 (PDT) X-Received: from aturtleortwo-benjamindomain.. ([2607:f2c0:e98c:e:b132:3785:fa38:a51]) by smtp.gmail.com with ESMTPSA id bi3-20020a05620a318300b006b61b2cb1d2sm11221482qkb.46.2022.09.06.10.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 10:43:13 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Sai Chaganty , Isaac Oram , Chasel Chiu , Nate DeSimone Subject: [edk2-devel][edk2-platforms][PATCH v1 5/7] KabylakeOpenBoardPkg/AspireVn7Dash572G: Use Setup to control security Date: Tue, 6 Sep 2022 13:42:56 -0400 Message-Id: <951f485bd6d63b72e888b4bdcb89327d8088b7ce.1662485273.git.benjamin.doron00@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,benjamin.doron00@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662486196; bh=C2fW59J/tiNz9+/tSKrJedH2ZPTQcA5byw3NNVj5uVA=; h=Cc:Date:From:Reply-To:Subject:To; b=ZRWb/lo67W9GrCGuPOR0lGuTMK1BetlPberM/jDUI/sTYOfECQmhIj74AzPCK8THn6y su8VPew+9KE/cxbvPSTonmbZA5yyhIwWO20N+MlVB4CYBdl60iDCjQkKNIIdVHStWX9nB 2qMpJ9lG9xDI9H5+rHI2uwYhFloCD9YA/Go= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662486200167100026 Content-Type: text/plain; charset="utf-8" Add a HII form to Setup for controlling lockdown UPDs. Default to strict security, allowing it to be lifted for the user's convenience. This is not board-specific, and could be ported to other boards. To add more entries to the HII form, modify the VFR, VFR strings, variable structure and consume the variable in the appropriate place. Cc: Sai Chaganty Cc: Isaac Oram Cc: Chasel Chiu Cc: Nate DeSimone Signed-off-by: Benjamin Doron --- .../PeiBoardPolicyUpdate.c | 56 ++- .../PeiSiliconPolicyUpdateLibFsp.inf | 7 +- .../Include/BoardConfigNvData.h | 37 ++ .../Library/BoardInitLib/BoardConfigVfr.vfr | 68 ++++ .../BoardInitLib/BoardConfigVfrStrings.uni | 29 ++ .../Library/BoardInitLib/DxeBoardConfigHii.c | 374 ++++++++++++++++++ .../Library/BoardInitLib/DxeBoardInitLib.c | 21 +- .../Library/BoardInitLib/DxeBoardInitLib.h | 131 ++++++ .../Library/BoardInitLib/DxeBoardInitLib.inf | 10 + 9 files changed, 712 insertions(+), 21 deletions(-) create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/I= nclude/BoardConfigNvData.h create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/L= ibrary/BoardInitLib/BoardConfigVfr.vfr create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/L= ibrary/BoardInitLib/BoardConfigVfrStrings.uni create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/L= ibrary/BoardInitLib/DxeBoardConfigHii.c create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/L= ibrary/BoardInitLib/DxeBoardInitLib.h diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapp= er/Library/PeiSiliconPolicyUpdateLibFsp/PeiBoardPolicyUpdate.c b/Platform/I= ntel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSiliconPo= licyUpdateLibFsp/PeiBoardPolicyUpdate.c index 452c961b17ac..425deb4d16c0 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiBoardPolicyUpdate.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiBoardPolicyUpdate.c @@ -6,11 +6,13 @@ =20 **/ =20 +#include "PeiSaPolicyUpdate.h" #include "PeiPchPolicyUpdate.h" #include -#include #include -#include +#include +#include +#include =20 /* * TODO: @@ -54,8 +56,6 @@ PeiFspBoardPolicyUpdatePreMem ( DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 // BUGBUG: Preserve FSP defaults - PeiSiliconPolicyInitLibFsp ultimately= overrides to 0. - // Drop when https://edk2.groups.io/g/devel/message/79391 is merged - FspmUpd->FspmConfig.PeciC10Reset =3D 1; FspmUpd->FspmConfig.RefClk =3D 1; // Maybe "auto" is safe, but that isn= 't the FSP default =20 // TODO: Why should this be here? @@ -92,18 +92,43 @@ PeiFspBoardPolicyUpdate ( IN OUT FSPS_UPD *FspsUpd ) { - INTN Index; + EFI_STATUS Status; + EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi; + UINTN DataSize; + EFI_GUID BoardConfigFormsetGuid =3D BOARD_CONFIG= _FORMSET_GUID; + BOARD_CONFIGURATION BoardConfig; + INTN Index; =20 DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 - // FIXME/NB: This is insecure and not production-ready! - // TODO: Configure SPI lockdown by variable on FrontPage? - // - Later, also configure stronger protection: PRRs - FspsUpd->FspsConfig.PchLockDownBiosLock =3D 0; // Default. Will enable,= not remove - FspsUpd->FspsConfig.PchLockDownSpiEiss =3D 0; - // This may be PWRM+0x18[BIT22], causing HSTI "PCH Security Configuratio= n - Reserved Check failure" - // I think the intel_pmc_core kernel module requires this to populate de= bugfs? - FspsUpd->FspsTestConfig.PchPmPmcReadDisable =3D 0; + // Use variable services directly, to avoid casting reference to pointer= into struct + // from PeiGetVariable() + Status =3D PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NU= LL, (VOID **) &VariablePpi); + ASSERT_EFI_ERROR (Status); + + DataSize =3D sizeof (BoardConfig); + Status =3D VariablePpi->GetVariable ( + VariablePpi, + BOARD_CONFIG_NV_NAME, + &BoardConfigFormsetGuid, + NULL, + &DataSize, + &BoardConfig + ); + // TODO: Also configure stronger protection: PRRs + // - Also, we could lift lockdown here for BOOT_ON_FLASH_UPDATE. + // User must do this themselves for flashrom + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "BoardConfig: Set FSP UPDs from variable\n")); + FspsUpd->FspsConfig.PchLockDownBiosLock =3D BoardConfig.LockDownBiosLo= ck; + FspsUpd->FspsConfig.PchLockDownSpiEiss =3D BoardConfig.LockDownBiosLoc= k; + FspsUpd->FspsTestConfig.PchPmPmcReadDisable =3D BoardConfig.LockDownPm= cReadDisable; + } else { + DEBUG ((DEBUG_INFO, "BoardConfig: Set FSP UPDs to secure default\n")); + FspsUpd->FspsConfig.PchLockDownBiosLock =3D 1; // FSP default not sec= ure + FspsUpd->FspsConfig.PchLockDownSpiEiss =3D 1; + FspsUpd->FspsTestConfig.PchPmPmcReadDisable =3D 1; + } =20 // BUGBUG: Preserve FSP defaults - Pei*PolicyLib ultimately overrides // Requires HW support? @@ -116,7 +141,7 @@ PeiFspBoardPolicyUpdate ( FspsUpd->FspsConfig.SerialIoDevMode[0] =3D 2; FspsUpd->FspsConfig.SerialIoDevMode[1] =3D 2; =20 - // Acer IDs (TODO: "Newgate" IDs) + // Acer IDs (TODO: "Newgate" and "RayleighSLS" IDs) FspsUpd->FspsConfig.DefaultSvid =3D 0x1025; FspsUpd->FspsConfig.DefaultSid =3D 0x1037; FspsUpd->FspsConfig.PchSubSystemVendorId =3D 0x1025; @@ -265,7 +290,7 @@ PeiFspBoardPolicyUpdate ( FspsUpd->FspsConfig.PcieRpAspm[9] =3D PchPcieAspmL1; =20 /* SCS config */ - // Although platform NVS area shows this enabled, the SD card reader is = connected over USB, not SCS + // Although vendor's platform NVS area shows this is enabled, the SD car= d reader is connected over USB, not SCS FspsUpd->FspsConfig.ScsEmmcEnabled =3D 0; FspsUpd->FspsConfig.ScsSdCardEnabled =3D 0; =20 @@ -275,7 +300,6 @@ PeiFspBoardPolicyUpdate ( FspsUpd->FspsConfig.PchSirqMode =3D PchContinuousMode; =20 /* HDA config */ - // FIXME: DspEnable is set, per PeiPchPolicyLib, however it is disabled = in the HOB produced by FSP // Returned to DXE as HOB, used to select blob for NHLT // - FIXME: 1ch array DMIC may not be supported by the Linux driver FspsUpd->FspsConfig.PchHdaDspEndpointDmic =3D PchHdaDmic1chArray; diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapp= er/Library/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf b/= Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/Pe= iSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf index 0e1b42c20cd8..ac7e4f65f912 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiSiliconPolicyUpdateLibFsp.inf @@ -75,6 +75,7 @@ SiPolicyLib MemoryAllocationLib PeiLib + PeiServicesLib =20 [Pcd] gSiPkgTokenSpaceGuid.PcdTsegSize ## CONSUMES @@ -135,10 +136,14 @@ gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress gKabylakeOpenBoardPkgTokenSpaceGuid.PcdRootPort4ClkInfo =20 +[Ppis] + gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES + [Guids] gFspNvsBufferVariableGuid ## CONSUMES gTianoLogoGuid ## CONSUMES gEfiMemoryOverwriteControlDataGuid =20 [Depex] - gEdkiiVTdInfoPpiGuid + gEdkiiVTdInfoPpiGuid AND + gEfiPeiReadOnlyVariable2PpiGuid diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Include/= BoardConfigNvData.h b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G= /Include/BoardConfigNvData.h new file mode 100644 index 000000000000..feaa324eaea4 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Include/BoardCo= nfigNvData.h @@ -0,0 +1,37 @@ +/** @file + Header file for NV data structure definition. + +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2021, Baruch Binyamin Doron +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __BOARD_CONFIG_NV_DATA_H__ +#define __BOARD_CONFIG_NV_DATA_H__ + +#define BOARD_CONFIG_FORMSET_GUID \ + { \ + 0x6E38A4A7, 0xB6B7, 0x41E0, { 0xA6, 0xF3, 0x41, 0x35, 0x72, 0xDF, 0x88= , 0x2F } \ + } + +#define BOARD_CONFIGURATION_VARSTORE_ID 0x0001 +#define BOARD_CONFIGURATION_FORM_ID 0x0001 + +#define BOARD_LOCK_DOWN_BIOS_LOCK 0x2000 +#define BOARD_LOCK_DOWN_PMC_READ_DISABLE 0x2001 + +#define QUESTION_SAVE_EXIT 0x2ffe +#define QUESTION_DISCARD_EXIT 0x2fff + +// +// NV data structure +// +typedef struct { + UINT8 LockDownBiosLock; + UINT8 LockDownPmcReadDisable; +} BOARD_CONFIGURATION; + +#define BOARD_CONFIG_NV_NAME L"BoardSetup" + +#endif diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/BoardConfigVfr.vfr b/Platform/Intel/KabylakeOpenBoardPkg/Aspir= eVn7Dash572G/Library/BoardInitLib/BoardConfigVfr.vfr new file mode 100644 index 000000000000..c5af8d955de8 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/BoardConfigVfr.vfr @@ -0,0 +1,68 @@ +/** @file + VFR file used by Aspire VN7-572G board configuration component. + +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2021, Baruch Binyamin Doron +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +formset + guid =3D BOARD_CONFIG_FORMSET_GUID, + title =3D STRING_TOKEN(STR_BOARD_TITLE), + help =3D STRING_TOKEN(STR_BOARD_HELP), + classguid =3D EFI_HII_PLATFORM_SETUP_FORMSET_GUID, + + efivarstore BOARD_CONFIGURATION, + varid =3D BOARD_CONFIGURATION_VARSTORE_ID, + attribute =3D 0x03, // VARIABLE_ATTRIBUTE_NV_BS + name =3D BoardSetup, + guid =3D BOARD_CONFIG_FORMSET_GUID; + + form formid =3D BOARD_CONFIGURATION_FORM_ID, + title =3D STRING_TOKEN(STR_BOARD_TITLE); + + subtitle text =3D STRING_TOKEN(STR_NULL); + + checkbox varid =3D BoardSetup.LockDownBiosLock, + questionid =3D BOARD_LOCK_DOWN_BIOS_LOCK, + prompt =3D STRING_TOKEN(STR_BOARD_LOCK_DOWN_BIOS_LOCK), + help =3D STRING_TOKEN(STR_BOARD_LOCK_DOWN_BIOS_LOCK_HEL= P), + flags =3D RESET_REQUIRED, + default =3D 1, + endcheckbox; + + checkbox varid =3D BoardSetup.LockDownPmcReadDisable, + questionid =3D BOARD_LOCK_DOWN_PMC_READ_DISABLE, + prompt =3D STRING_TOKEN(STR_BOARD_LOCK_DOWN_PMC_READ_DISA= BLE), + help =3D STRING_TOKEN(STR_BOARD_LOCK_DOWN_PMC_READ_DISA= BLE_HELP), + flags =3D RESET_REQUIRED, + default =3D 1, + endcheckbox; + +#if 0 + resetbutton + defaultstore =3D BoardConfig, + prompt =3D STRING_TOKEN(STR_RESET_DEFAULTS_PROMPT_RESET= ), + help =3D STRING_TOKEN(STR_RESET_DEFAULTS_PROMPT_RESET= _HELP), + endresetbutton; +#endif + + text + help =3D STRING_TOKEN(STR_SAVE_EXIT), + text =3D STRING_TOKEN(STR_SAVE_EXIT), + flags =3D INTERACTIVE, + key =3D QUESTION_SAVE_EXIT; + + text + help =3D STRING_TOKEN(STR_DISCARD_EXIT), + text =3D STRING_TOKEN(STR_DISCARD_EXIT), + flags =3D INTERACTIVE, + key =3D QUESTION_DISCARD_EXIT; + + endform; + +endformset; diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/BoardConfigVfrStrings.uni b/Platform/Intel/KabylakeOpenBoardPk= g/AspireVn7Dash572G/Library/BoardInitLib/BoardConfigVfrStrings.uni new file mode 100644 index 000000000000..f3c7b66d0217 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/BoardConfigVfrStrings.uni @@ -0,0 +1,29 @@ +/** @file + String definitions for Aspire VN7-572G board configuration form. + +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2021, Baruch Binyamin Doron +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#langdef en-US "English" + +#string STR_BOARD_TITLE #language en-US "Board = Configuration" +#string STR_BOARD_HELP #language en-US "Press = to select board Setup options." + +#string STR_BOARD_LOCK_DOWN_BIOS_LOCK #language en-US "BIOS L= ock" +#string STR_BOARD_LOCK_DOWN_BIOS_LOCK_HELP #language en-US "Enable= SPI flash lockdown\n" + "Disable th= is option to flash the BIOS image.\n" + "For securi= ty purposes, this option should be enabled." +#string STR_BOARD_LOCK_DOWN_PMC_READ_DISABLE #language en-US "PMC XR= AM read disable" +#string STR_BOARD_LOCK_DOWN_PMC_READ_DISABLE_HELP #language en-US "Disabl= e PMC XRAM read\n" + "Disable th= is option to permit OS drivers to retrieve data from the PMC.\n" + "This may h= ave security impact." + +#string STR_RESET_DEFAULTS_PROMPT_RESET #language en-US "Reset = to defaults" +#string STR_RESET_DEFAULTS_PROMPT_RESET_HELP #language en-US "This w= ill reset the configuration entries to their default values" +#string STR_SAVE_EXIT #language en-US "Commit= Changes and Exit" +#string STR_DISCARD_EXIT #language en-US "Discar= d Changes and Exit" + +#string STR_NULL #language en-US "" diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/DxeBoardConfigHii.c b/Platform/Intel/KabylakeOpenBoardPkg/Aspi= reVn7Dash572G/Library/BoardInitLib/DxeBoardConfigHii.c new file mode 100644 index 000000000000..437d31698f7d --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardConfigHii.c @@ -0,0 +1,374 @@ +/** @file + Installs Aspire VN7-572G board config and handles the HII callbacks. + NOTE: Variable structure is expected to change, so in-place updates are = fragile. + - An updated structure may be larger than a present variable. Will this = over-read, + or will HII validation mitigate this? + + Copyright (c) 2021, Baruch Binyamin Doron + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "DxeBoardInitLib.h" +#include +#include +#include +#include +#include +#include + +BOARD_CONFIG_CALLBACK_DATA gBoardConfigPrivate =3D { + BOARD_CONFIG_CALLBACK_DATA_SIGNATURE, + NULL, + NULL, + { + BoardConfigExtractConfig, + BoardConfigRouteConfig, + BoardConfigCallback + } +}; + +EFI_GUID mBoardConfigFormsetGuid =3D BOARD_CONFIG_FORMSET_GUID; + +HII_VENDOR_DEVICE_PATH mBoardConfigHiiVendorDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8) (sizeof (VENDOR_DEVICE_PATH)), + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + BOARD_CONFIG_FORMSET_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + (UINT8) (END_DEVICE_PATH_LENGTH), + (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8) + } + } +}; + +/** + This function allows a caller to extract the current configuration for o= ne + or more named elements from the target driver. + + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + @param Request A null-terminated Unicode string in format. + @param Progress On return, points to a character in the Request s= tring. + Points to the string's null terminator if request= was successful. + Points to the most recent '&' before the first fa= iling name/value + pair (or the beginning of the string if the failu= re is in the + first name/value pair) if the request was not suc= cessful. + @param Results A null-terminated Unicode string in format which + has all values filled in for the names in the Req= uest string. + String to be allocated by the called function. + + @retval EFI_SUCCESS The Results is filled with the requested= values. + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown na= me. + @retval EFI_NOT_FOUND Routing data doesn't match any storage i= n this driver. + +**/ +EFI_STATUS +EFIAPI +BoardConfigExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results + ) +{ + EFI_STATUS Status; + UINTN DataSize; + BOARD_CONFIGURATION BoardConfig; + + if (Progress =3D=3D NULL || Results =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + *Progress =3D Request; + if ((Request !=3D NULL) && + !HiiIsConfigHdrMatch (Request, &mBoardConfigFormsetGuid, BOARD_CONFIG_= NV_NAME)) { + return EFI_NOT_FOUND; + } + + // Get variable + DataSize =3D sizeof (BoardConfig); + Status =3D gRT->GetVariable ( + BOARD_CONFIG_NV_NAME, + &mBoardConfigFormsetGuid, + NULL, + &DataSize, + &BoardConfig + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // Use HII helper to convert variable data to config + Status =3D gHiiConfigRouting->BlockToConfig ( + gHiiConfigRouting, + Request, + (VOID *) &BoardConfig, + DataSize, + Results, + Progress + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a(): Failed to retrieve board config - %r!\n", = Status)); + } + + return Status; +} + +/** + This function processes the results of changes in configuration. + + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + @param Configuration A null-terminated Unicode string in = format. + @param Progress A pointer to a string filled in with the offset o= f the most + recent '&' before the first failing name/value pa= ir (or the + beginning of the string if the failure is in the = first + name/value pair) or the terminating NULL if all w= as successful. + + @retval EFI_SUCCESS The Results is processed successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_NOT_FOUND Routing data doesn't match any storage i= n this driver. + +**/ +EFI_STATUS +EFIAPI +BoardConfigRouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + ) +{ + EFI_STATUS Status; + UINTN DataSize; + BOARD_CONFIGURATION BoardConfig; + + if (Configuration =3D=3D NULL || Progress =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + *Progress =3D Configuration; + if (!HiiIsConfigHdrMatch (Configuration, &mBoardConfigFormsetGuid, BOARD= _CONFIG_NV_NAME)) { + return EFI_NOT_FOUND; + } + + // Get variable + DataSize =3D sizeof (BoardConfig); + Status =3D gRT->GetVariable ( + BOARD_CONFIG_NV_NAME, + &mBoardConfigFormsetGuid, + NULL, + &DataSize, + &BoardConfig + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // Use HII helper to convert updated config to variable data + Status =3D gHiiConfigRouting->ConfigToBlock ( + gHiiConfigRouting, + Configuration, + (VOID *) &BoardConfig, + &DataSize, + Progress + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a(): Failed to convert board config - %r!\n", S= tatus)); + } + + // Set variable + Status =3D gRT->SetVariable ( + BOARD_CONFIG_NV_NAME, + &mBoardConfigFormsetGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACC= ESS, + DataSize, + &BoardConfig + ); + + return Status; +} + +/** + This callback function is registered with the formset. When user selects= a configuration, + this call back function will be triggered. + + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + @param Action Specifies the type of action taken by the browser. + @param QuestionId A unique value which is sent to the original expo= rting driver + so that it can identify the type of data to expec= t. + @param Type The type of value for the question. + @param Value A pointer to the data being sent to the original = exporting driver. + @param ActionRequest On return, points to the action requested by the = callback function. + + @retval EFI_SUCCESS The callback successfully handled the act= ion. + @retval EFI_INVALID_PARAMETER The setup browser call this function with= invalid parameters. + +**/ +EFI_STATUS +EFIAPI +BoardConfigCallback ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN EFI_BROWSER_ACTION Action, + IN EFI_QUESTION_ID QuestionId, + IN UINT8 Type, + IN EFI_IFR_TYPE_VALUE *Value, + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest + ) +{ + if ((Value =3D=3D NULL) || (ActionRequest =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + if (Action !=3D EFI_BROWSER_ACTION_CHANGED) { + return EFI_UNSUPPORTED; + } + + if (QuestionId =3D=3D QUESTION_SAVE_EXIT) { + *ActionRequest =3D EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; + } else if (QuestionId =3D=3D QUESTION_DISCARD_EXIT) { + *ActionRequest =3D EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT; + } + + return EFI_SUCCESS; +} + +/** + This function installs the HII form. + +**/ +VOID +EFIAPI +InstallBoardConfigHiiForm ( + VOID + ) +{ + EFI_STATUS Status; + BOARD_CONFIGURATION BoardConfig; + EFI_STRING ConfigRequestHdr; + UINTN DataSize; + BOOLEAN ActionFlag; + + DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + + // + // Install Device Path and Config Access protocols to driver handle + // + gBoardConfigPrivate.DriverHandle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &gBoardConfigPrivate.DriverHandle, + &gEfiDevicePathProtocolGuid, + &mBoardConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &gBoardConfigPrivate.ConfigAccess, + NULL + ); + ASSERT_EFI_ERROR (Status); + + // + // Publish our HII data + // + gBoardConfigPrivate.HiiHandle =3D HiiAddPackages ( + &mBoardConfigFormsetGuid, + gBoardConfigPrivate.DriverHandle, + BoardConfigVfrBin, + DxeBoardInitLibStrings, + NULL + ); + ASSERT (gBoardConfigPrivate.HiiHandle !=3D NULL); + + // + // Initialise VarStore data. + // + ZeroMem (&BoardConfig, sizeof (BoardConfig)); + ConfigRequestHdr =3D HiiConstructConfigHdr ( + &mBoardConfigFormsetGuid, + BOARD_CONFIG_NV_NAME, + gBoardConfigPrivate.DriverHandle + ); + ASSERT (ConfigRequestHdr !=3D NULL); + + // Attempt to retrieve variable + DataSize =3D sizeof (BoardConfig); + Status =3D gRT->GetVariable ( + BOARD_CONFIG_NV_NAME, + &mBoardConfigFormsetGuid, + NULL, + &DataSize, + &BoardConfig + ); + // HII helper functions will use ExtractConfig() and RouteConfig(), + // where we will set the variable as required + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Config variable exists, validate contents\n")); + ActionFlag =3D HiiValidateSettings (ConfigRequestHdr); + if (!ActionFlag) { + DEBUG ((DEBUG_INFO, "Variable is invalid, reset to defaults\n")); + ActionFlag =3D HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_C= LASS_STANDARD); + ASSERT (ActionFlag); + } + } else { + DEBUG ((DEBUG_INFO, "Config variable does not exist, create and set to= defaults\n")); + Status =3D gRT->SetVariable ( + BOARD_CONFIG_NV_NAME, + &mBoardConfigFormsetGuid, + EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_A= CCESS, + DataSize, + &BoardConfig + ); + ASSERT_EFI_ERROR (Status); + ActionFlag =3D HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLA= SS_STANDARD); + ASSERT (ActionFlag); + } + + FreePool (ConfigRequestHdr); + + DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); +} + +/** + This function uninstalls the HII form. + +**/ +VOID +EFIAPI +UninstallBoardConfigHiiForm ( + VOID + ) +{ + EFI_STATUS Status; + + DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + + // + // Uninstall Device Path and Config Access protocols + // + Status =3D gBS->UninstallMultipleProtocolInterfaces ( + gBoardConfigPrivate.DriverHandle, + &gEfiDevicePathProtocolGuid, + &mBoardConfigHiiVendorDevicePath, + &gEfiHiiConfigAccessProtocolGuid, + &gBoardConfigPrivate.ConfigAccess, + NULL + ); + ASSERT_EFI_ERROR (Status); + + // + // Remove our HII data + // + HiiRemovePackages (gBoardConfigPrivate.HiiHandle); + + DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); +} diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/DxeBoardInitLib.c b/Platform/Intel/KabylakeOpenBoardPkg/Aspire= Vn7Dash572G/Library/BoardInitLib/DxeBoardInitLib.c index 07278d956ddc..cc99240b5aaa 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.c @@ -7,13 +7,10 @@ =20 **/ =20 -#include +#include "DxeBoardInitLib.h" #include #include -#include #include -#include -#include #include =20 EFI_RESET_NOTIFICATION_PROTOCOL *mResetNotify =3D NULL; @@ -131,6 +128,12 @@ EcResetSystemHook ( } } =20 +VOID +EFIAPI +InstallBoardConfigHiiForm ( + VOID + ); + /** A hook for board-specific initialization after PCI enumeration. =20 @@ -159,6 +162,8 @@ BoardInitAfterPciEnumeration ( DEBUG ((DEBUG_INFO, "EC: Added callback to notify EC of resets\n")); } =20 + InstallBoardConfigHiiForm (); + DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); return EFI_SUCCESS; } @@ -178,6 +183,12 @@ BoardInitReadyToBoot ( return EFI_SUCCESS; } =20 +VOID +EFIAPI +UninstallBoardConfigHiiForm ( + VOID + ); + /** A hook for board-specific functionality for the ExitBootServices event. =20 @@ -201,6 +212,8 @@ BoardInitEndOfFirmware ( DEBUG ((DEBUG_INFO, "EC: Removed callback to notify EC of resets\n")); } =20 + UninstallBoardConfigHiiForm (); + DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); return EFI_SUCCESS; } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/DxeBoardInitLib.h b/Platform/Intel/KabylakeOpenBoardPkg/Aspire= Vn7Dash572G/Library/BoardInitLib/DxeBoardInitLib.h new file mode 100644 index 000000000000..17383b71f7d9 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.h @@ -0,0 +1,131 @@ +/** @file + Aspire VN7-572G Board Initialization DXE library + + Copyright (c) 2021, Baruch Binyamin Doron + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _DXE_BOARD_INIT_LIB_H_ +#define _DXE_BOARD_INIT_LIB_H_ + +#include +#include +#include +#include +#include + +// +// These are the VFR compiler generated data representing our VFR data. +// +extern UINT8 BoardConfigVfrBin[]; + +#define BOARD_CONFIG_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('B', 'C', 'C',= 'B') + +typedef struct { + UINTN Signature; + + // + // HII relative handles + // + EFI_HII_HANDLE HiiHandle; + EFI_HANDLE DriverHandle; + + // + // Produced protocols + // + EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess; +} BOARD_CONFIG_CALLBACK_DATA; + +/// +/// HII specific Vendor Device Path definition. +/// +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} HII_VENDOR_DEVICE_PATH; + +/** + This function allows a caller to extract the current configuration for o= ne + or more named elements from the target driver. + + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + @param Request A null-terminated Unicode string in format. + @param Progress On return, points to a character in the Request s= tring. + Points to the string's null terminator if request= was successful. + Points to the most recent '&' before the first fa= iling name/value + pair (or the beginning of the string if the failu= re is in the + first name/value pair) if the request was not suc= cessful. + @param Results A null-terminated Unicode string in format which + has all values filled in for the names in the Req= uest string. + String to be allocated by the called function. + + @retval EFI_SUCCESS The Results is filled with the requested= values. + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results. + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown na= me. + @retval EFI_NOT_FOUND Routing data doesn't match any storage i= n this driver. + +**/ +EFI_STATUS +EFIAPI +BoardConfigExtractConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Request, + OUT EFI_STRING *Progress, + OUT EFI_STRING *Results + ); + +/** + This function processes the results of changes in configuration. + + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + @param Configuration A null-terminated Unicode string in = format. + @param Progress A pointer to a string filled in with the offset o= f the most + recent '&' before the first failing name/value pa= ir (or the + beginning of the string if the failure is in the = first + name/value pair) or the terminating NULL if all w= as successful. + + @retval EFI_SUCCESS The Results is processed successfully. + @retval EFI_INVALID_PARAMETER Configuration is NULL. + @retval EFI_NOT_FOUND Routing data doesn't match any storage i= n this driver. + +**/ +EFI_STATUS +EFIAPI +BoardConfigRouteConfig ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN CONST EFI_STRING Configuration, + OUT EFI_STRING *Progress + ); + +/** + This callback function is registered with the formset. When user selects= a configuration, + this call back function will be triggered. + + + @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL. + @param Action Specifies the type of action taken by the browser. + @param QuestionId A unique value which is sent to the original expo= rting driver + so that it can identify the type of data to expec= t. + @param Type The type of value for the question. + @param Value A pointer to the data being sent to the original = exporting driver. + @param ActionRequest On return, points to the action requested by the = callback function. + + @retval EFI_SUCCESS The callback successfully handled the act= ion. + @retval EFI_INVALID_PARAMETER The setup browser call this function with= invalid parameters. + +**/ +EFI_STATUS +EFIAPI +BoardConfigCallback ( + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, + IN EFI_BROWSER_ACTION Action, + IN EFI_QUESTION_ID QuestionId, + IN UINT8 Type, + IN EFI_IFR_TYPE_VALUE *Value, + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest + ); + +#endif // _DXE_BOARD_INIT_LIB_H_ diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/DxeBoardInitLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/Aspi= reVn7Dash572G/Library/BoardInitLib/DxeBoardInitLib.inf index 24747fa7b224..cd74f957ce10 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.inf @@ -17,17 +17,27 @@ [LibraryClasses] UefiBootServicesTableLib UefiRuntimeServicesTableLib + BaseMemoryLib DebugLib EcLib BoardEcLib + HiiLib + MemoryAllocationLib + UefiHiiServicesLib =20 [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec MinPlatformPkg/MinPlatformPkg.dec KabylakeOpenBoardPkg/OpenBoardPkg.dec =20 [Sources] DxeBoardInitLib.c + DxeBoardConfigHii.c + BoardConfigVfr.vfr + BoardConfigVfrStrings.uni =20 [Protocols] gEfiResetNotificationProtocolGuid ## CONSUMES + gEfiDevicePathProtocolGuid ## PRODUCES + gEfiHiiConfigAccessProtocolGuid ## PRODUCES --=20 2.37.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93290): https://edk2.groups.io/g/devel/message/93290 Mute This Topic: https://groups.io/mt/93507101/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 10 07:35:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93291+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93291+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1662486198; cv=none; d=zohomail.com; s=zohoarc; b=cRJ0LkjuqEgI9eFiK2A9oxbz26/1MW+cUR8j3YaHWYlJjLZQ5TDB37uL/raPAvD6OaXrzCvf0OMKb0CZAPCF0uanF9dtZdUeFpb0PCjtBNtL4FO3Q5rSH2DWi5NtQx02BPk34K5JvPAn2SrIwFqzRpmz44ByG0f47Z24PpmgPnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662486198; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=D/M0jl1sqfXdr5TOPd7mhiRxQKmWqi1Ft40cHdtcAEo=; b=fZh8FH5yeuBLFLxaIDKbyXw/cvtSRFYEoMZfWoaYm3xdemiRyFpTZqgwkh3O5k97VRZAC+eLyxtl+woLoeGnKWiH1QRZ58L/fqAI+jLPUfvIJEH2jZvE7bZjXHeD8C1zGC9BBC6+/uT/Li/Kv7atVp+JL3A0zr8FeoEKG4KSc3k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93291+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1662486198335784.3842627147044; Tue, 6 Sep 2022 10:43:18 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 70TCYY1788612xvaMP6eihFN; Tue, 06 Sep 2022 10:43:17 -0700 X-Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by mx.groups.io with SMTP id smtpd.web11.2278.1662486191733097155 for ; Tue, 06 Sep 2022 10:43:16 -0700 X-Received: by mail-qk1-f178.google.com with SMTP id b2so8700852qkh.12 for ; Tue, 06 Sep 2022 10:43:16 -0700 (PDT) X-Gm-Message-State: IFON3OS2LHofOrzCpy7a0v4ax1787277AA= X-Google-Smtp-Source: AA6agR57TXmCp0c2XX8508DqiGQ8nqZ0EqFoRXywA9PJGVZEOUt++GMn7SX6qSbN0yzabhjj0ky7mw== X-Received: by 2002:a05:620a:3ce:b0:6c4:5e42:2813 with SMTP id r14-20020a05620a03ce00b006c45e422813mr11367010qkm.212.1662486195529; Tue, 06 Sep 2022 10:43:15 -0700 (PDT) X-Received: from aturtleortwo-benjamindomain.. ([2607:f2c0:e98c:e:b132:3785:fa38:a51]) by smtp.gmail.com with ESMTPSA id bi3-20020a05620a318300b006b61b2cb1d2sm11221482qkb.46.2022.09.06.10.43.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 10:43:15 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Sai Chaganty , Isaac Oram , Chasel Chiu , Nate DeSimone , Ankit Sinha Subject: [edk2-devel][edk2-platforms][PATCH v1 6/7] KabylakeOpenBoardPkg/AspireVn7Dash572G: Improve board detection Date: Tue, 6 Sep 2022 13:42:57 -0400 Message-Id: <5694ab4b9ffb94132360bf216e9ad962fee0cfce.1662485273.git.benjamin.doron00@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,benjamin.doron00@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662486197; bh=da0Qa2WkWasn7+H7sHjn4BBDHnCGXagUt5E6vjx5sOU=; h=Cc:Date:From:Reply-To:Subject:To; b=K87wNbpWwc6iSEwn8dRJjginZ827/qdV70pDVj118hQlaKUrGFD4kkEc6GFHJKviY0J ILWItfsCHqqH0dqXfWl9h7AlXqSK1EJCeV89nDNEC0Xftl9WvIAxPn+PI+bYSvjT4PRBr Z0n77Wk2+6aawH3NqvWsJixmmJxbXcq/5+o= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662486200128100025 Content-Type: text/plain; charset="utf-8" Improvements based on ENE KB9012Q datasheet. Values read from EC ADC are much more consistent now. Some improvement still necessary before this is reliable, as my Rayleigh-SL (PCH-LP) is now consistently detected as a Newgate-SLS (PCH-H). Cc: Sai Chaganty Cc: Isaac Oram Cc: Chasel Chiu Cc: Nate DeSimone Cc: Ankit Sinha Signed-off-by: Benjamin Doron --- .../Include/Library/BoardEcLib.h | 5 +- .../Library/BoardEcLib/BoardEcLib.inf | 1 + .../Library/BoardEcLib/EcCommands.c | 36 ++++++++++---- .../BoardInitLib/PeiAspireVn7Dash572GDetect.c | 47 +++++++++++-------- .../AspireVn7Dash572G/OpenBoardPkg.dsc | 5 +- .../PeiBoardPolicyUpdate.c | 2 +- .../Include/PlatformBoardId.h | 5 +- 7 files changed, 65 insertions(+), 36 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Include/= Library/BoardEcLib.h b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572= G/Include/Library/BoardEcLib.h index 8bb4cccb8f19..56fdd4ed756c 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Include/Library= /BoardEcLib.h +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Include/Library= /BoardEcLib.h @@ -82,8 +82,9 @@ EcIdxWrite ( ); =20 /** - Read EC analog-digital converter. - TODO: Check if ADC is valid. + Read an analog-digital converter from the EC. + TODO: There are actually 8 ADCs, but those can remain unused. + - Handling port enable bits and pin IE could get complicated. =20 @param[in] Adc @param[out] DataBuffer diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardEcLib/BoardEcLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Da= sh572G/Library/BoardEcLib/BoardEcLib.inf index 56527c3b9a3c..7287301583e0 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardEc= Lib/BoardEcLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardEc= Lib/BoardEcLib.inf @@ -18,6 +18,7 @@ DebugLib EcLib IoLib + TimerLib =20 [Packages] MdePkg/MdePkg.dec diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardEcLib/EcCommands.c b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash= 572G/Library/BoardEcLib/EcCommands.c index 54cfaba47b1b..182cda6f1933 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardEc= Lib/EcCommands.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardEc= Lib/EcCommands.c @@ -9,9 +9,11 @@ =20 #include #include +#include #include #include #include +#include =20 /* * Notes: @@ -193,8 +195,9 @@ EcIdxWrite ( } =20 /** - Read EC analog-digital converter. - TODO: Check if ADC is valid. + Read an analog-digital converter from the EC. + TODO: There are actually 8 ADCs, but those can remain unused. + - Handling port enable bits and pin IE could get complicated. =20 @param[in] Adc @param[out] DataBuffer @@ -205,23 +208,36 @@ ReadEcAdcConverter ( OUT UINT16 *DataBuffer ) { - UINT8 AdcConvertersEnabled; // Contains some ADCs and some D= ACs + UINT8 LowAdcsEnabled; // Contains some ADCs and some DACs UINT8 IdxData; =20 if (DataBuffer =3D=3D NULL) { return; } =20 + if (Adc >=3D 4) { + DEBUG ((DEBUG_ERROR, "Handling ADC%d is unsupported!\n", Adc)); + return; + } + // Backup enabled ADCs - EcIdxRead (0xff15, &AdcConvertersEnabled); // ADDAEN + EcIdxRead (0xff15, &LowAdcsEnabled); // ADDAEN =20 - // Enable desired ADC in bitmask (not enabled by EC FW, not used by vend= or FW) - EcIdxWrite (0xff15, AdcConvertersEnabled | ((1 << Adc) & 0xf)); // ADDA= EN + /* 1. Clear IE of the related pin - ADC0: "GPIOIE38[0] (0xFC67[0]) =3D 0= b" */ + EcIdxRead (0xfc67, &IdxData); + IdxData &=3D ~(1 << Adc); + EcIdxWrite (0xfc67, IdxData); =20 - // Sample the desired ADC in binary field; OR the start bit - EcIdxWrite (0xff18, ((Adc << 1) & 0xf) | 1); // ADCTRL + /* 2. Enable desired ADC function in bitmask */ + EcIdxWrite (0xff15, (1 << Adc) & 0xf); // ADDAEN =20 - // Read the desired ADC + /* 3. Enable control of desired ADC in bit field, OR the start bit */ + EcIdxWrite (0xff18, ((Adc << 1) & 7) | 1); // ADCTRL + + /* TODO: Await ADC interrupt */ + MicroSecondDelay (256); // Wait "Voltage Conversion Time" + + /* 4. Read the desired ADC */ EcIdxRead (0xff19, &IdxData); // ADCDAT *DataBuffer =3D (IdxData << 2); // Lower 2-bits of 10-bit ADC are in high bits of next register @@ -229,5 +245,5 @@ ReadEcAdcConverter ( *DataBuffer |=3D ((IdxData & 0xc0) >> 6); =20 // Restore enabled ADCs - EcIdxWrite (0xff15, AdcConvertersEnabled); // ADDAEN + EcIdxWrite (0xff15, LowAdcsEnabled); // ADDAEN } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/PeiAspireVn7Dash572GDetect.c b/Platform/Intel/KabylakeOpenBoar= dPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GDetect.c index 344e06859e9b..0ce747bb67c6 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GDetect.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GDetect.c @@ -1,6 +1,7 @@ /** @file =20 Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+Copyright (c) 2021, Baruch Binyamin Doron
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -10,14 +11,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include =20 -#define ADC_3V_10BIT_GRANULARITY_MAX (3005/1023) +#define ADC_3V_10BIT_GRANULARITY_MAX (3005 / 1023) #define PCB_VER_AD 1 #define MODEL_ID_AD 3 =20 /** - Get Aspire V Nitro (Skylake) board ID. - There are 2 different boards having different ID. - This function will return board ID to caller. + Get Aspire V Nitro (Skylake) board ID. There are 3 different boards + having different PCH (therefore, ID). This function will return board ID= to caller. + - TODO/NB: Detection is still unreliable. Likely must await interrupt. =20 @param[out] DataBuffer =20 @@ -32,34 +33,42 @@ GetAspireVn7Dash572GBoardId ( UINT16 DataBuffer; =20 ReadEcAdcConverter (MODEL_ID_AD, &DataBuffer); - DEBUG ((DEBUG_INFO, "BoardId (raw) =3D 0x%X\n", DataBuffer)); + DEBUG ((DEBUG_INFO, "BoardId (raw) =3D %d\n", DataBuffer)); // Board by max millivoltage range (of 10-bit, 3.005 V ADC) - if (DataBuffer <=3D (1374/ADC_3V_10BIT_GRANULARITY_MAX)) { + if (DataBuffer <=3D (1374 / ADC_3V_10BIT_GRANULARITY_MAX)) { // Consider returning an error DEBUG ((DEBUG_ERROR, "BoardId is reserved?\n")); - } else if (DataBuffer <=3D (2017/ADC_3V_10BIT_GRANULARITY_MAX)) { - *BoardId =3D BoardIdNewgateSLx_dGPU; + *BoardId =3D 0; + } else if (DataBuffer <=3D (2017 / ADC_3V_10BIT_GRANULARITY_MAX)) { + *BoardId =3D BoardIdNewgateSLS_dGPU; + } else if (DataBuffer <=3D (2259 / ADC_3V_10BIT_GRANULARITY_MAX)) { + *BoardId =3D BoardIdRayleighSLS_960M; } else { - *BoardId =3D BoardIdRayleighSLx_dGPU; + *BoardId =3D BoardIdRayleighSL_dGPU; } DEBUG ((DEBUG_INFO, "BoardId =3D 0x%X\n", *BoardId)); =20 ReadEcAdcConverter (PCB_VER_AD, &DataBuffer); - DEBUG ((DEBUG_INFO, "PCB version (raw) =3D 0x%X\n", DataBuffer)); + DEBUG ((DEBUG_INFO, "PCB version (raw) =3D %d\n", DataBuffer)); DEBUG ((DEBUG_INFO, "PCB version: ")); // PCB by max millivoltage range (of 10-bit, 3.005 V ADC) - if (DataBuffer <=3D (2017/ADC_3V_10BIT_GRANULARITY_MAX)) { + if (DataBuffer <=3D (2017 / ADC_3V_10BIT_GRANULARITY_MAX)) { // Consider returning an error DEBUG ((DEBUG_ERROR, "Reserved?\n")); - } else if (DataBuffer <=3D (2259/ADC_3V_10BIT_GRANULARITY_MAX)) { - DEBUG ((DEBUG_ERROR, "-1\n")); - } else if (DataBuffer <=3D (2493/ADC_3V_10BIT_GRANULARITY_MAX)) { - DEBUG ((DEBUG_ERROR, "SC\n")); - } else if (DataBuffer <=3D (2759/ADC_3V_10BIT_GRANULARITY_MAX)) { - DEBUG ((DEBUG_ERROR, "SB\n")); + } else if (DataBuffer <=3D (2259 / ADC_3V_10BIT_GRANULARITY_MAX)) { + DEBUG ((DEBUG_INFO, "-1\n")); + } else if (DataBuffer <=3D (2493 / ADC_3V_10BIT_GRANULARITY_MAX)) { + DEBUG ((DEBUG_INFO, "SC\n")); + } else if (DataBuffer <=3D (2759 / ADC_3V_10BIT_GRANULARITY_MAX)) { + DEBUG ((DEBUG_INFO, "SB\n")); } else { - DEBUG ((DEBUG_ERROR, "SA\n")); + DEBUG ((DEBUG_INFO, "SA\n")); } + + // FIXME + DEBUG ((DEBUG_WARN, "OVERRIDE: Detection is unreliable and other boards = unsupported!\n")); + DEBUG ((DEBUG_INFO, "Setting board SKU to Rayleigh-SL\n")); + *BoardId =3D BoardIdRayleighSL_dGPU; } =20 EFI_STATUS @@ -76,7 +85,7 @@ AspireVn7Dash572GBoardDetect ( =20 DEBUG ((DEBUG_INFO, "AspireVn7Dash572GDetectionCallback\n")); GetAspireVn7Dash572GBoardId (&BoardId); - if (BoardId =3D=3D BoardIdNewgateSLx_dGPU || BoardId =3D=3D BoardIdRayle= ighSLx_dGPU) { + if (BoardId =3D=3D BoardIdNewgateSLS_dGPU || BoardId =3D=3D BoardIdRayle= ighSLS_960M || BoardId =3D=3D BoardIdRayleighSL_dGPU) { LibPcdSetSku (BoardId); ASSERT (LibPcdGetSku() =3D=3D BoardId); } else { diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoar= dPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardP= kg.dsc index 75c537f1253f..4458e7b75118 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.dsc @@ -88,8 +88,9 @@ [SkuIds] 0x00|DEFAULT # 0|DEFAULT is reserved and always required. # For further details on specific SKUs (which dGPU installed), see EC pa= ge of schematics - 0x41|RayleighSLx_dGPU # Detect the UMA board by GPIO - 0x42|NewgateSLx_dGPU + 0x41|NewgateSLS_dGPU + 0x42|RayleighSLS_960M + 0x43|RayleighSL_dGPU # Detect the UMA board by GPIO =20 ##########################################################################= ###### # diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/L= ibrary/PeiSiliconPolicyUpdateLib/PeiBoardPolicyUpdate.c b/Platform/Intel/Ka= bylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateL= ib/PeiBoardPolicyUpdate.c index 95b7c4ad5f77..54c742147b19 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= PeiSiliconPolicyUpdateLib/PeiBoardPolicyUpdate.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= PeiSiliconPolicyUpdateLib/PeiBoardPolicyUpdate.c @@ -175,7 +175,7 @@ PeiFspBoardPolicyUpdate ( // that it does - this appears to be static text?) and is UART0 me= rely supporting // the UART2 devfn? =20 - // Acer IDs (TODO: "Newgate" IDs) + // Acer IDs (TODO: "Newgate" and "RayleighSLS" IDs) //FIXME FspsUpd->FspsConfig.DefaultSvid =3D 0x1025; //FIXME FspsUpd->FspsConfig.DefaultSid =3D 0x1037; PchGeneralConfig->SubSystemVendorId =3D 0x1025; diff --git a/Platform/Intel/KabylakeOpenBoardPkg/Include/PlatformBoardId.h = b/Platform/Intel/KabylakeOpenBoardPkg/Include/PlatformBoardId.h index 0db4fb23583e..78ea0dea88df 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/Include/PlatformBoardId.h +++ b/Platform/Intel/KabylakeOpenBoardPkg/Include/PlatformBoardId.h @@ -22,8 +22,9 @@ Kaby Lake Platform Board Identifiers =20 #define BoardIdSkylakeRvp3 0x4 #define BoardIdGalagoPro3 0x20 -#define BoardIdRayleighSLx_dGPU 0x41 -#define BoardIdNewgateSLx_dGPU 0x42 +#define BoardIdNewgateSLS_dGPU 0x41 +#define BoardIdRayleighSLS_960M 0x42 +#define BoardIdRayleighSL_dGPU 0x43 #define BoardIdKabyLakeYLpddr3Rvp3 0x60 =20 #define BoardIdUnknown1 0xffff --=20 2.37.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93291): https://edk2.groups.io/g/devel/message/93291 Mute This Topic: https://groups.io/mt/93507102/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri May 10 07:35:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93292+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93292+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1662486199; cv=none; d=zohomail.com; s=zohoarc; b=fsDPavUWb5CXXQg10YuLfsO/0xh2uz/4s+8MQFdf9xotme6eqMdGEuwhmXwE8cBuP5noKPfYYE3fhXRnLtv3rmuYwgXpTrx97D5gY5HedPp40oWMe/+8epqJ1FV5HBaIjGskxWSy8qLzxZjFpUkgi4VFaBQrvDO0uT8L7GdyBQY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662486199; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Q4N3JjvK5+MR82+ZsYjBe5jAD3mTO7CAzmbtwNVSsbU=; b=C7cwJ0J+GKnc9t4rNhIbKo5k6IJZQKTVUjGwzyYnWUw4S3icEJ1cvt3umQNyuSuU8ffTFWadjJzNuch4JlPiJ12AwU8hX258JuS4h9j7sTOxrWeynBUppLtlC247cXSQd7WTRhZAZqb2vuqALjoqWisl0g0B+nuZj00V/Nf83IU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93292+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1662486199176972.0639123853866; Tue, 6 Sep 2022 10:43:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ILNQYY1788612x3GRwKsOY7M; Tue, 06 Sep 2022 10:43:18 -0700 X-Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) by mx.groups.io with SMTP id smtpd.web12.2348.1662486198003762239 for ; Tue, 06 Sep 2022 10:43:18 -0700 X-Received: by mail-qk1-f174.google.com with SMTP id g21so8730644qka.5 for ; Tue, 06 Sep 2022 10:43:17 -0700 (PDT) X-Gm-Message-State: jrRVrplTB0P4fG82UeqEj38Dx1787277AA= X-Google-Smtp-Source: AA6agR5CFaS6+M+f4mvnJb9i1FUtu93b3BSJpWT7E98X4hZW9bnnN1d8YbV5OSrNIFI5RsWJ/QzHVQ== X-Received: by 2002:ae9:e404:0:b0:6bb:d8c0:381c with SMTP id q4-20020ae9e404000000b006bbd8c0381cmr37213502qkc.459.1662486196655; Tue, 06 Sep 2022 10:43:16 -0700 (PDT) X-Received: from aturtleortwo-benjamindomain.. ([2607:f2c0:e98c:e:b132:3785:fa38:a51]) by smtp.gmail.com with ESMTPSA id bi3-20020a05620a318300b006b61b2cb1d2sm11221482qkb.46.2022.09.06.10.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 10:43:16 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Sai Chaganty , Isaac Oram , Nate DeSimone , Chasel Chiu Subject: [edk2-devel][edk2-platforms][PATCH v1 7/7] KabylakeOpenBoardPkg/AspireVn7Dash572G: Align DEBUG() use Date: Tue, 6 Sep 2022 13:42:58 -0400 Message-Id: <015f0d3f13746835ca8d6299f858fc352132a4e6.1662485273.git.benjamin.doron00@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,benjamin.doron00@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1662486198; bh=8Hf2+Tq/wC7VQFZBVH5ERwTKFzOd01up1it02G/J8ws=; h=Cc:Date:From:Reply-To:Subject:To; b=cW5bjN5gqL/8alZOdEbd8yjrarunupPUJvuxv//GW4WqbLCj8mLVAn+ILFEUwJ0Xov0 fsAe1sFv08MVA3Qfbw81XUVDQt5QVrvmRNYBJ3tE70CtBR7oGMYWBKa2izFIJLpN8HekQ 1NX79zIa9QEgfB6rFr3sQQLz17B8IUMoKbQ= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1662486200805100031 Content-Type: text/plain; charset="utf-8" Cc: Sai Chaganty Cc: Isaac Oram Cc: Nate DeSimone Cc: Chasel Chiu Signed-off-by: Benjamin Doron --- .../DxeAspireVn7Dash572GAcpiTableLib.c | 5 ++++ .../BoardAcpiLib/DxeBoardAcpiTableLib.inf | 1 + .../SmmAspireVn7Dash572GAcpiEnableLib.c | 8 ++++- .../Library/BoardEcLib/EcCommands.c | 16 +++++----- .../Library/BoardInitLib/DxeBoardConfigHii.c | 8 ++--- .../Library/BoardInitLib/DxeBoardInitLib.c | 23 +++++++++------ .../PeiAspireVn7Dash572GInitPostMemLib.c | 29 ++++++++++++++----- .../PeiAspireVn7Dash572GInitPreMemLib.c | 20 ++++++++++--- .../BoardInitLib/PeiBoardInitPreMemLib.c | 2 ++ .../DxeSiliconPolicyUpdateLib.c | 6 ++-- 10 files changed, 80 insertions(+), 38 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardAcpiLib/DxeAspireVn7Dash572GAcpiTableLib.c b/Platform/Intel/KabylakeOp= enBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/DxeAspireVn7Dash572GAcpiT= ableLib.c index 131e6460279a..994f18b2dc0e 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/DxeAspireVn7Dash572GAcpiTableLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/DxeAspireVn7Dash572GAcpiTableLib.c @@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include @@ -23,6 +24,8 @@ AspireVn7Dash572GUpdateGlobalNvs ( EFI_STATUS Status; UINT8 PowerRegister; =20 + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); + // // Allocate and initialize the NVS area for SMM and ASL communication. // @@ -57,6 +60,8 @@ AspireVn7Dash572GUpdateGlobalNvs ( mGlobalNvsArea.Area->Ps2KbMsEnable =3D PcdGet8 (PcdPs2KbMsEnable); =20 mGlobalNvsArea.Area->BoardId =3D (UINT8) LibPcdGetSku (); + + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); } =20 EFI_STATUS diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardAcpiLib/DxeBoardAcpiTableLib.inf b/Platform/Intel/KabylakeOpenBoardPkg= /AspireVn7Dash572G/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf index 660afe9292ec..dc5bc80d0380 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/DxeBoardAcpiTableLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/DxeBoardAcpiTableLib.inf @@ -23,6 +23,7 @@ =20 [LibraryClasses] PcdLib + DebugLib EcLib =20 [Packages] diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardAcpiLib/SmmAspireVn7Dash572GAcpiEnableLib.c b/Platform/Intel/KabylakeO= penBoardPkg/AspireVn7Dash572G/Library/BoardAcpiLib/SmmAspireVn7Dash572GAcpi= EnableLib.c index fa2ed9745ea6..22c9c76a62e0 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/SmmAspireVn7Dash572GAcpiEnableLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardAc= piLib/SmmAspireVn7Dash572GAcpiEnableLib.c @@ -8,7 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ =20 #include -#include +#include #include #include =20 @@ -20,6 +20,8 @@ AspireVn7Dash572GBoardEnableAcpi ( { EFI_STATUS Status; =20 + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); + /* Tests at runtime show this re-enables charging and battery reporting * - Obtained from somewhere in vendor's SmmKbcDriver. * Further information is needed */ @@ -36,6 +38,7 @@ AspireVn7Dash572GBoardEnableAcpi ( } =20 /* TODO: Set touchpad GPP owner to ACPI? */ + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); =20 return EFI_SUCCESS; } @@ -48,6 +51,8 @@ AspireVn7Dash572GBoardDisableAcpi ( { EFI_STATUS Status; =20 + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); + /* Tests at runtime show this disables charging and battery reporting * - Obtained from somewhere in vendor's SmmKbcDriver. * Further information is needed */ @@ -64,6 +69,7 @@ AspireVn7Dash572GBoardDisableAcpi ( } =20 /* TODO: Set touchpad GPP owner to GPIO? */ + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); =20 return EFI_SUCCESS; } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardEcLib/EcCommands.c b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash= 572G/Library/BoardEcLib/EcCommands.c index 182cda6f1933..24737d9ecb90 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardEc= Lib/EcCommands.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardEc= Lib/EcCommands.c @@ -65,19 +65,19 @@ EcCmd90Read ( =20 Status =3D SendEcCommand (0x90); if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a(): SendEcCommand(0x90) failed!\n", __FUNCTION_= _)); + DEBUG ((DEBUG_ERROR, "%a(): SendEcCommand(0x90) failed!\n", __FUNCTION= __)); return Status; } =20 Status =3D SendEcData (Address); if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a(): SendEcData(Address) failed!\n", __FUNCTION_= _)); + DEBUG ((DEBUG_ERROR, "%a(): SendEcData(Address) failed!\n", __FUNCTION= __)); return Status; } =20 Status =3D ReceiveEcData (Data); if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a(): ReceiveEcData(Data) failed!\n", __FUNCTION_= _)); + DEBUG ((DEBUG_ERROR, "%a(): ReceiveEcData(Data) failed!\n", __FUNCTION= __)); return Status; } return EFI_SUCCESS; @@ -103,19 +103,19 @@ EcCmd91Write ( =20 Status =3D SendEcCommand (0x91); if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a(): SendEcCommand(0x91) failed!\n", __FUNCTION_= _)); + DEBUG ((DEBUG_ERROR, "%a(): SendEcCommand(0x91) failed!\n", __FUNCTION= __)); return Status; } =20 Status =3D SendEcData (Address); if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a(): SendEcData(Address) failed!\n", __FUNCTION_= _)); + DEBUG ((DEBUG_ERROR, "%a(): SendEcData(Address) failed!\n", __FUNCTION= __)); return Status; } =20 Status =3D SendEcData (Data); if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a(): SendEcData(Data) failed!\n", __FUNCTION__)); + DEBUG ((DEBUG_ERROR, "%a(): SendEcData(Data) failed!\n", __FUNCTION__)= ); return Status; } return EFI_SUCCESS; @@ -144,13 +144,13 @@ EcCmd94Query ( =20 Status =3D SendEcCommand (0x94); if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a(): SendEcCommand(0x94) failed!\n", __FUNCTION_= _)); + DEBUG ((DEBUG_ERROR, "%a(): SendEcCommand(0x94) failed!\n", __FUNCTION= __)); return Status; } =20 Status =3D ReceiveEcData (Data); if (EFI_ERROR (Status)) { - DEBUG((DEBUG_ERROR, "%a(): ReceiveEcData(Data) failed!\n", __FUNCTION_= _)); + DEBUG ((DEBUG_ERROR, "%a(): ReceiveEcData(Data) failed!\n", __FUNCTION= __)); return Status; } return EFI_SUCCESS; diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/DxeBoardConfigHii.c b/Platform/Intel/KabylakeOpenBoardPkg/Aspi= reVn7Dash572G/Library/BoardInitLib/DxeBoardConfigHii.c index 437d31698f7d..2c302684913a 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardConfigHii.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardConfigHii.c @@ -261,7 +261,7 @@ InstallBoardConfigHiiForm ( UINTN DataSize; BOOLEAN ActionFlag; =20 - DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 // // Install Device Path and Config Access protocols to driver handle @@ -335,7 +335,7 @@ InstallBoardConfigHiiForm ( =20 FreePool (ConfigRequestHdr); =20 - DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); } =20 /** @@ -350,7 +350,7 @@ UninstallBoardConfigHiiForm ( { EFI_STATUS Status; =20 - DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 // // Uninstall Device Path and Config Access protocols @@ -370,5 +370,5 @@ UninstallBoardConfigHiiForm ( // HiiRemovePackages (gBoardConfigPrivate.HiiHandle); =20 - DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/DxeBoardInitLib.c b/Platform/Intel/KabylakeOpenBoardPkg/Aspire= Vn7Dash572G/Library/BoardInitLib/DxeBoardInitLib.c index cc99240b5aaa..af91034d4701 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/DxeBoardInitLib.c @@ -1,8 +1,8 @@ /** @file Aspire VN7-572G Board Initialization DXE library =20 - Copyright (c) 2021, Baruch Binyamin Doron Copyright (c) 2021, Intel Corporation. All rights reserved.
+ Copyright (c) 2021, Baruch Binyamin Doron
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -33,7 +33,7 @@ EcSendTime ( INTN Index; UINT8 EcResponse; =20 - DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 Status =3D gRT->GetTime (&EfiTime, NULL); if (EFI_ERROR (Status)) { @@ -61,7 +61,7 @@ EcSendTime ( DEBUG ((DEBUG_INFO, "EC: response 0x%x\n", EcResponse)); } =20 - DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); } =20 /** @@ -76,7 +76,7 @@ EcRequestsTime ( { UINT8 Dat; =20 - DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 /* This is executed as protocol notify in vendor's RtKbcDriver when *Com= monService * protocol is installed. Effectively, this code could execute from the = entrypoint */ @@ -85,7 +85,7 @@ EcRequestsTime ( EcSendTime (); } =20 - DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); } =20 /** @@ -113,6 +113,8 @@ EcResetSystemHook ( IN VOID *ResetData OPTIONAL ) { + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); + // If boolean PCD tokens 0xBD, 0xBE and 0xBF are set in vendor FW, // OEM also sends command 0x5A with argument 0xAA via ACPI "CMDB" method= and stalls for // 100000, then sets ResetType to EfiResetShutdown. @@ -126,6 +128,8 @@ EcResetSystemHook ( // Now OEM calls function offset 2 in ACER_BOOT_DEVICE_SERVICE_PROTOCO= L_GUID. // TODO: What does this do? } + + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); } =20 VOID @@ -148,7 +152,7 @@ BoardInitAfterPciEnumeration ( { EFI_STATUS Status; =20 - DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 // Send EC the present time, if requested EcRequestsTime (); @@ -164,7 +168,7 @@ BoardInitAfterPciEnumeration ( =20 InstallBoardConfigHiiForm (); =20 - DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); return EFI_SUCCESS; } =20 @@ -180,6 +184,7 @@ BoardInitReadyToBoot ( VOID ) { + DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__)); return EFI_SUCCESS; } =20 @@ -203,7 +208,7 @@ BoardInitEndOfFirmware ( { EFI_STATUS Status; =20 - DEBUG ((DEBUG_INFO, "%a() Starts\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 // Remove ResetSystem callback. ACPI will be notifying EC of events if (mResetNotify !=3D NULL) { @@ -214,6 +219,6 @@ BoardInitEndOfFirmware ( =20 UninstallBoardConfigHiiForm (); =20 - DEBUG ((DEBUG_INFO, "%a() Ends\n", __FUNCTION__)); + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); return EFI_SUCCESS; } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/PeiAspireVn7Dash572GInitPostMemLib.c b/Platform/Intel/Kabylake= OpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GIni= tPostMemLib.c index 77722f5d6062..2ad2dd866829 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GInitPostMemLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GInitPostMemLib.c @@ -1,6 +1,7 @@ /** @file =20 Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
+Copyright (c) 2021, Baruch Binyamin Doron
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -34,28 +35,32 @@ EcInit ( VOID ) { + EFI_STATUS Status; EFI_BOOT_MODE BootMode; - UINT8 PowerRegister; + UINT8 PowerState; UINT8 OutData; UINT16 ABase; UINT16 Pm1Sts; UINT32 GpeSts; =20 + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); + /* This is called via a "$FNC" in a PeiOemModule pointer table, with "$D= PX" on SiInit */ IoWrite8 (0x6C, 0x5A); // 6Ch is the EC sideband port - PeiServicesGetBootMode (&BootMode); + Status =3D PeiServicesGetBootMode (&BootMode); + ASSERT_EFI_ERROR (Status); if (BootMode =3D=3D BOOT_ON_S3_RESUME) { /* "MLID" in LGMR-based memory map is equivalent to "ELID" in EC-based * memory map. Vendor firmware accesses through LGMR; remapped * - EcCmd* function calls will not remapped */ - EcRead (0x70, &PowerRegister); - if (!(PowerRegister & BIT1)) { // Lid is closed + EcRead (0x70, &PowerState); + if (!(PowerState & BIT1)) { // Lid is closed EcCmd90Read (0x0A, &OutData); if (!(OutData & BIT1)) { EcCmd91Write (0x0A, OutData | BIT1); } =20 - /* Clear events and go back to sleep */ + /* Clear below events and go back to sleep */ PchAcpiBaseGet (&ABase); /* Clear ABase PM1_STS - RW/1C set bits */ Pm1Sts =3D IoRead16 (ABase + R_PCH_ACPI_PM1_STS); @@ -78,6 +83,8 @@ EcInit ( CpuDeadLoop (); } } + + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); } =20 /** @@ -105,15 +112,15 @@ GpioInitPostMem ( { EFI_STATUS Status; =20 - DEBUG ((DEBUG_INFO, "GpioInitPostMem() Start\n")); + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 Status =3D GpioConfigurePads (mGpioTableAspireVn7Dash572GSize, mGpioTabl= eAspireVn7Dash572G); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Failed to configure early GPIOs!\n")); + DEBUG ((DEBUG_ERROR, "Failed to configure GPIOs!\n")); return EFI_DEVICE_ERROR; } =20 - DEBUG ((DEBUG_INFO, "GpioInitPostMem() End\n")); + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); return EFI_SUCCESS; } =20 @@ -128,6 +135,8 @@ AspireVn7Dash572GBoardInitBeforeSiliconInit ( VOID ) { + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); + GpioInitPostMem (); AspireVn7Dash572GInit (); =20 @@ -136,6 +145,7 @@ AspireVn7Dash572GBoardInitBeforeSiliconInit ( /// LateSiliconInit (); =20 + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); return EFI_SUCCESS; } =20 @@ -150,7 +160,10 @@ AspireVn7Dash572GBoardInitAfterSiliconInit ( VOID ) { + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); + EcInit (); =20 + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); return EFI_SUCCESS; } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/PeiAspireVn7Dash572GInitPreMemLib.c b/Platform/Intel/KabylakeO= penBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash572GInit= PreMemLib.c index d0125ebdbcb2..5be644fa72ae 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GInitPreMemLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GInitPreMemLib.c @@ -106,7 +106,7 @@ GpioInitPreMem ( { EFI_STATUS Status; =20 - DEBUG ((DEBUG_INFO, "GpioInitPreMem() Start\n")); + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 Status =3D GpioConfigurePads (mGpioTableAspireVn7Dash572G_earlySize, mGp= ioTableAspireVn7Dash572G_early); if (EFI_ERROR (Status)) { @@ -114,7 +114,7 @@ GpioInitPreMem ( return EFI_DEVICE_ERROR; } =20 - DEBUG ((DEBUG_INFO, "GpioInitPreMem() End\n")); + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); return EFI_SUCCESS; } =20 @@ -129,7 +129,7 @@ DgpuPowerOn ( { UINT32 OutputVal; =20 - DEBUG ((DEBUG_INFO, "DgpuPowerOn() Start\n")); + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); =20 GpioGetOutputValue (DGPU_PRESENT, &OutputVal); if (!OutputVal) { @@ -146,7 +146,7 @@ DgpuPowerOn ( GpioSetOutputValue (DGPU_PWR_EN, 1); // Deassert dGPU_PWR_EN# } =20 - DEBUG ((DEBUG_INFO, "DgpuPowerOn() End\n")); + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); } =20 /** @@ -182,6 +182,8 @@ AspireVn7Dash572GBoardInitBeforeMemoryInit ( { EFI_STATUS Status; =20 + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); + Status =3D GpioInitPreMem (); if (!EFI_ERROR (Status)) { DgpuPowerOn (); @@ -206,6 +208,8 @@ AspireVn7Dash572GBoardInitBeforeMemoryInit ( Status =3D PchInitializeReset (); ASSERT_EFI_ERROR (Status); =20 + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); + return EFI_SUCCESS; } =20 @@ -222,6 +226,8 @@ AspireVn7Dash572GBoardInitAfterMemoryInit ( { EFI_STATUS Status; =20 + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); + // BUGBUG: Workaround for a misbehaving system firmware not setting goId= le // - Based on prior investigation for coreboot, I suspect FSP if ((MmioRead32 (0xFED40044) & PTP_CRB_CONTROL_AREA_STATUS_TPM_IDLE) =3D= =3D 0) { @@ -235,6 +241,8 @@ AspireVn7Dash572GBoardInitAfterMemoryInit ( DEBUG ((DEBUG_WARN, "Failed to enable LGMR. Were ACPI tables built for= LGMR memory map?\n")); } =20 + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); + return EFI_SUCCESS; } =20 @@ -252,6 +260,8 @@ AspireVn7Dash572GBoardDebugInit ( { UINT16 ABase; =20 + DEBUG ((DEBUG_INFO, "%a() Start\n", __FUNCTION__)); + /// /// Do Early PCH init /// @@ -272,6 +282,8 @@ AspireVn7Dash572GBoardDebugInit ( DEBUG ((DEBUG_INFO, "ABase PM1_EN=3D 0x%x\n", IoRead16 (ABase + R_PCH_AC= PI_PM1_EN))); DEBUG ((DEBUG_INFO, "ABase PM1_CNT=3D 0x%x\n", IoRead32 (ABase + R_PCH_A= CPI_PM1_CNT))); =20 + DEBUG ((DEBUG_INFO, "%a() End\n", __FUNCTION__)); + return EFI_SUCCESS; } =20 diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/= BoardInitLib/PeiBoardInitPreMemLib.c b/Platform/Intel/KabylakeOpenBoardPkg/= AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPreMemLib.c index 5f89d87e71f8..9a1b6bf47f0e 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiBoardInitPreMemLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiBoardInitPreMemLib.c @@ -86,6 +86,7 @@ BoardInitBeforeTempRamExit ( VOID ) { + DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__)); return EFI_SUCCESS; } =20 @@ -95,5 +96,6 @@ BoardInitAfterTempRamExit ( VOID ) { + DEBUG ((DEBUG_INFO, "%a()\n", __FUNCTION__)); return EFI_SUCCESS; } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/L= ibrary/DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.c b/Platform/Int= el/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/DxeSiliconPolicyUp= dateLib/DxeSiliconPolicyUpdateLib.c index 6840531da986..ef04ea2feebf 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= DxeSiliconPolicyUpdateLib/DxeSiliconPolicyUpdateLib.c @@ -60,12 +60,10 @@ SiliconPolicyUpdateLate ( Status =3D gBS->LocateProtocol (&gGopPolicyProtocolGuid, NULL, (VOID **)= &GopPolicy); if (!EFI_ERROR (Status)) { Status =3D GopPolicy->GetVbtData (&VbtAddress, &VbtSize); - if (!EFI_ERROR (Status) && GraphicsDxeConfig !=3D NULL) { + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Located VBT at 0x%x with size 0x%x\n", VbtAddre= ss, VbtSize)); GraphicsDxeConfig->VbtAddress =3D VbtAddress; GraphicsDxeConfig->Size =3D VbtSize; - DEBUG ((DEBUG_INFO, "Located VBT at 0x%x with size 0x%x\n", VbtAddre= ss, VbtSize)); - } else { - DEBUG ((DEBUG_ERROR, "No VBT found, or Policy =3D=3D NULL; Status - = %r\n", Status)); } } =20 --=20 2.37.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93292): https://edk2.groups.io/g/devel/message/93292 Mute This Topic: https://groups.io/mt/93507104/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-