From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail03.groups.io (mail03.groups.io [45.79.227.220]) by spool.mail.gandi.net (Postfix) with ESMTPS id 52F76AC0E8E for ; Fri, 12 Apr 2024 08:32:37 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=QahZ8Ify17W7PSsRcfT1cbT+Z36QFrFD1EYu53VweUM=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1712910755; v=1; b=GgBrfoZj56OLADcI982DW2Tkr6VulsE8rUn5oyRq5JWrrC5961qsme7ctoteg143PNmOsPn+ mUsrBEa3SQA1Lyi9ThzVhH/56WuxfLXH8isVt9m5Ei0tuY7Qg0wvA/tb8zNJMDKwkHi0rVmivKa CvSN3J5LxppzzNBT5NiMWQZQ8weRkySPw1p5fuj+AYtXuEh/jwk4J1GufcQnn1Bph3KkI12eHpr lu61XojK+8t4dgx9N50+XDPz3dvuKIaf6DW0kpnNRXBGTuI0a/ZQjgu+Yj5+MHbnkNcg7Fxog2K 8AetYGDEiHWSLXGTB/5hykwJwgz3GfFS1GAJEYy9lZkUA== X-Received: by 127.0.0.2 with SMTP id 7PauYY7687511xs5xbY62DV5; Fri, 12 Apr 2024 01:32:35 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) by mx.groups.io with SMTP id smtpd.web11.41845.1712910755186123121 for ; Fri, 12 Apr 2024 01:32:35 -0700 X-CSE-ConnectionGUID: 6oWQFToCTlyZILqvbbAMxQ== X-CSE-MsgGUID: j5ftDkiIR822RSRNhkNEkQ== X-IronPort-AV: E=McAfee;i="6600,9927,11041"; a="8231671" X-IronPort-AV: E=Sophos;i="6.07,195,1708416000"; d="scan'208";a="8231671" X-Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 01:32:34 -0700 X-CSE-ConnectionGUID: JgAM/94aRWaJEadOVAv5lw== X-CSE-MsgGUID: Am/Er02SRe+maRce0rYadQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,195,1708416000"; d="scan'208";a="21151115" X-Received: from cindykux-mobl.gar.corp.intel.com ([10.225.33.115]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2024 01:32:32 -0700 From: "Cindy Kuo" To: devel@edk2.groups.io Cc: Cindy Kuo , Jiewen Yao , Rahul Kumar , Dandan Bi , Ming Tan , Arthur Chen , Xiao X Chen , Tina Chen Subject: [edk2-devel] [PATCH v4 1/1] SecurityPkg/OpalPasswordDxe: Force reparsing IFR binary when RETRIEVE Date: Fri, 12 Apr 2024 16:32:10 +0800 Message-ID: <9267905a9385b70cfc41d538094285bfb0361406.1712910326.git.cindyx.kuo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 12 Apr 2024 01:32:35 -0700 Resent-From: cindyx.kuo@intel.com Reply-To: devel@edk2.groups.io,cindyx.kuo@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: G4nvNGGuctYbfFGUcKpsqgY7x7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=GgBrfoZj; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.227.220 as permitted sender) smtp.mailfrom=bounce@groups.io REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4735 When change callback action from FORM_OPEN to RETRIEVE, it is observed that NVNE disks will not be displayed when the user enters the formset at the first time. Revisit the formset can see the update. 1. Add HiiUpdateForm() to force reparsing the IFR binary when RETRIEVE. 2. Create dummy label with suppressif statement in VFR for form update usage. Cc: Jiewen Yao Cc: Rahul Kumar Cc: Dandan Bi Cc: Ming Tan Cc: Arthur Chen Cc: Xiao X Chen Cc: Tina Chen Signed-off-by: CindyX Kuo --- .../Tcg/Opal/OpalPassword/OpalDriver.h | 1 + SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c | 82 ++++++++++++++++--- .../Tcg/Opal/OpalPassword/OpalHiiFormValues.h | 6 ++ .../Tcg/Opal/OpalPassword/OpalPasswordDxe.inf | 1 + .../Opal/OpalPassword/OpalPasswordForm.vfr | 8 +- 5 files changed, 86 insertions(+), 12 deletions(-) diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.h b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.h index 2089bd81b6..1a4671c602 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.h +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalDriver.h @@ -23,6 +23,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include +#include #include #include diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c index 56ada1a9f3..47af4fee40 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHii.c @@ -40,6 +40,7 @@ EFI_HII_HANDLE gHiiPackageListHandle = NULL; // const EFI_GUID gHiiPackageListGuid = PACKAGE_LIST_GUID; const EFI_GUID gHiiSetupVariableGuid = SETUP_VARIABLE_GUID; +const EFI_GUID gOpalSetupFormSetGuid = SETUP_FORMSET_GUID; // // Structure that contains state of the HII @@ -611,10 +612,15 @@ DriverCallback ( EFI_BROWSER_ACTION_REQUEST *ActionRequest ) { - HII_KEY HiiKey; - UINT8 HiiKeyId; - UINT32 PpRequest; - OPAL_DISK *OpalDisk; + HII_KEY HiiKey; + UINT8 HiiKeyId; + UINT32 PpRequest; + OPAL_DISK *OpalDisk; + EFI_STATUS Status; + VOID *StartOpCodeHandle; + VOID *EndOpCodeHandle; + EFI_IFR_GUID_LABEL *StartLabel; + EFI_IFR_GUID_LABEL *EndLabel; if (ActionRequest != NULL) { *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE; @@ -633,14 +639,68 @@ DriverCallback ( HiiKeyId = (UINT8)HiiKey.KeyBits.Id; if (Action == EFI_BROWSER_ACTION_RETRIEVE) { - switch (HiiKeyId) { - case HII_KEY_ID_VAR_SUPPORTED_DISKS: - DEBUG ((DEBUG_INFO, "HII_KEY_ID_VAR_SUPPORTED_DISKS\n")); - return HiiPopulateMainMenuForm (); + if ((HiiKeyId == HII_KEY_ID_VAR_SUPPORTED_DISKS) || (HiiKeyId == HII_KEY_ID_VAR_SELECTED_DISK_AVAILABLE_ACTIONS)) { + // + // Allocate space for creation of UpdateData Buffer + // + StartOpCodeHandle = HiiAllocateOpCodeHandle (); + if (StartOpCodeHandle == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + EndOpCodeHandle = HiiAllocateOpCodeHandle (); + if (EndOpCodeHandle == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + // + // Create Hii Extend Label OpCode as the start opcode + // + StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); + StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; + + // + // Create Hii Extend Label OpCode as the end opcode + // + EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL)); + EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL; + + switch (HiiKeyId) { + case HII_KEY_ID_VAR_SUPPORTED_DISKS: + DEBUG ((DEBUG_INFO, "HII_KEY_ID_VAR_SUPPORTED_DISKS\n")); + Status = HiiPopulateMainMenuForm (); + + StartLabel->Number = OPAL_MAIN_MENU_LABEL_START; + EndLabel->Number = OPAL_MAIN_MENU_LABEL_END; + HiiUpdateForm ( + gHiiPackageListHandle, + (EFI_GUID *)&gOpalSetupFormSetGuid, + FORMID_VALUE_MAIN_MENU, + StartOpCodeHandle, + EndOpCodeHandle + ); + break; + + case HII_KEY_ID_VAR_SELECTED_DISK_AVAILABLE_ACTIONS: + DEBUG ((DEBUG_INFO, "HII_KEY_ID_VAR_SELECTED_DISK_AVAILABLE_ACTIONS\n")); + Status = HiiPopulateDiskInfoForm (); + + StartLabel->Number = OPAL_DISK_INFO_LABEL_START; + EndLabel->Number = OPAL_DISK_INFO_LABEL_END; + HiiUpdateForm ( + gHiiPackageListHandle, + (EFI_GUID *)&gOpalSetupFormSetGuid, + FORMID_VALUE_DISK_INFO_FORM_MAIN, + StartOpCodeHandle, + EndOpCodeHandle + ); + break; + } + + HiiFreeOpCodeHandle (StartOpCodeHandle); + HiiFreeOpCodeHandle (EndOpCodeHandle); - case HII_KEY_ID_VAR_SELECTED_DISK_AVAILABLE_ACTIONS: - DEBUG ((DEBUG_INFO, "HII_KEY_ID_VAR_SELECTED_DISK_AVAILABLE_ACTIONS\n")); - return HiiPopulateDiskInfoForm (); + return Status; } } else if (Action == EFI_BROWSER_ACTION_CHANGING) { switch (HiiKeyId) { diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHiiFormValues.h b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHiiFormValues.h index ab6957fc6f..0e098854ba 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalHiiFormValues.h +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalHiiFormValues.h @@ -96,6 +96,12 @@ typedef struct { #define HII_KEY(id) HII_KEY_WITH_INDEX(id, 0) +/* Label */ +#define OPAL_MAIN_MENU_LABEL_START 0x6100 +#define OPAL_MAIN_MENU_LABEL_END 0x6101 +#define OPAL_DISK_INFO_LABEL_START 0x6200 +#define OPAL_DISK_INFO_LABEL_END 0x6201 + #define PACKAGE_LIST_GUID { 0xf0308176, 0x9058, 0x4153, { 0x93, 0x3d, 0xda, 0x2f, 0xdc, 0xc8, 0x3e, 0x44 } } /* {410483CF-F4F9-4ece-848A-1958FD31CEB7} */ diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf index 87519198c0..89e72a74bc 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordDxe.inf @@ -69,6 +69,7 @@ [Guids] gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event gS3StorageDeviceInitListGuid ## SOMETIMES_PRODUCES ## UNDEFINED + gEfiIfrTianoGuid ## CONSUMES [Pcd] gEfiSecurityPkgTokenSpaceGuid.PcdSkipOpalPasswordPrompt ## CONSUMES diff --git a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordForm.vfr b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordForm.vfr index f0d3e220b2..a1049686ff 100644 --- a/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordForm.vfr +++ b/SecurityPkg/Tcg/Opal/OpalPassword/OpalPasswordForm.vfr @@ -25,8 +25,11 @@ formset form formid = FORMID_VALUE_MAIN_MENU, title = STRING_TOKEN(STR_OPAL); - //CONFIG_VARIABLE(HII_KEY(HII_KEY_ID_VAR_SUPPORTED_DISKS), SupportedDisks, 0x0, 0xFFFF); suppressif TRUE; + label OPAL_MAIN_MENU_LABEL_START; + label OPAL_MAIN_MENU_LABEL_END; + + //CONFIG_VARIABLE(HII_KEY(HII_KEY_ID_VAR_SUPPORTED_DISKS), SupportedDisks, 0x0, 0xFFFF); numeric name = SupportedDisks, varid = OpalHiiConfig.SupportedDisks, @@ -149,6 +152,9 @@ form formid = FORMID_VALUE_DISK_INFO_FORM_MAIN, title = STRING_TOKEN(STR_OPAL); suppressif TRUE; + label OPAL_DISK_INFO_LABEL_START; + label OPAL_DISK_INFO_LABEL_END; + numeric name = SelectedDiskAvailableActions, varid = OpalHiiConfig.SelectedDiskAvailableActions, -- 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117662): https://edk2.groups.io/g/devel/message/117662 Mute This Topic: https://groups.io/mt/105478925/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-