From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web11.8323.1657628405570669608 for ; Tue, 12 Jul 2022 05:20:06 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=O3wgW0c+; spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0192e24d61=nickle.wang@hpe.com) Received: from pps.filterd (m0150244.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26CC8iln008660; Tue, 12 Jul 2022 12:20:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pps0720; bh=UFdBGvXZsk0IhbhIAzv9SXs2b3aYuN/ixQTWaFTHZV4=; b=O3wgW0c+ZHOlPMFP1OrBX0iAC5wRKbk2/MwQu6yh6CnBTA2wSHr+I751IEP+O67Zlp6k 91jt80GTsX94O/uWrlfX5eaMoa8uTuZxNYD2nmg7J7tkxb27Ra5z9+Qau+aK3siscBVH 8hYQHr0zw/QLXGgQJVbMaSrA4hfD/Q407pI2DV1ZaWCeS/GFbHt7+2uWaVT4drw1DE2u qC1vvpUogZ0rJxmeKyw3ryt+Vv2/zifQmDrywxOmgYI6XQSqXRVPa58x47SZ4aKVTNmu J29zcrSo+2LHtnBll7WtiOn3Cdj8fhr4+fim3PB0PmFdHcz90ixetwjlrXHtZIsY+30a Eg== Received: from p1lg14880.it.hpe.com (p1lg14880.it.hpe.com [16.230.97.201]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3h98pp03fv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Jul 2022 12:20:01 +0000 Received: from p1lg14885.dc01.its.hpecorp.net (unknown [10.119.18.236]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by p1lg14880.it.hpe.com (Postfix) with ESMTPS id 29C61800223; Tue, 12 Jul 2022 12:20:00 +0000 (UTC) Received: from WAFM3XJD5N.asiapacific.hpqcorp.net (unknown [16.231.227.36]) by p1lg14885.dc01.its.hpecorp.net (Postfix) with ESMTP id 910C5803287; Tue, 12 Jul 2022 12:19:58 +0000 (UTC) From: "Nickle Wang" To: devel@edk2.groups.io Cc: Andrew Fish , Ray Ni , Abner Chang , Yang Atom , Nick Ramirez Subject: [edk2-staging][PATCH 1/2] edk2-staging/EmulatorPkg: Introduce Hii2RedfishBootDxe driver Date: Tue, 12 Jul 2022 20:19:56 +0800 Message-Id: <20220712121957.542-1-nickle.wang@hpe.com> X-Mailer: git-send-email 2.32.0.windows.2 MIME-Version: 1.0 X-Proofpoint-GUID: rqtgF639ESOLKHm7reIoVIHGl8laX9yS X-Proofpoint-ORIG-GUID: rqtgF639ESOLKHm7reIoVIHGl8laX9yS X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-12_08,2022-07-12_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxlogscore=999 mlxscore=0 lowpriorityscore=0 suspectscore=0 phishscore=0 spamscore=0 clxscore=1011 bulkscore=0 priorityscore=1501 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207120048 Content-Transfer-Encoding: quoted-printable Add Hii2RedfishBootDxe driver with configure language defined in UNI file in order to demonstrate the use of Redfish Platform Config Protocol. Feature drivers under RedfishClientPkg will work with this driver and provide the REST data to Redfish service. Signed-off-by: Nickle Wang Cc: Andrew Fish Cc: Ray Ni Cc: Abner Chang Cc: Yang Atom Cc: Nick Ramirez --- EmulatorPkg/EmulatorPkg.dec | 5 +- EmulatorPkg/EmulatorPkg.dsc | 3 +- EmulatorPkg/EmulatorPkg.fdf | 3 +- .../Hii2RedfishBootDxe/Hii2RedfishBootData.h | 60 ++ .../Hii2RedfishBootDxe/Hii2RedfishBootDxe.c | 702 ++++++++++++++++++ .../Hii2RedfishBootDxe/Hii2RedfishBootDxe.h | 53 ++ .../Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf | 60 ++ .../Hii2RedfishBootDxeMap.uni | 28 + .../Hii2RedfishBootDxeStrings.uni | 41 + .../Hii2RedfishBootDxe/Hii2RedfishBootVfr.vfr | 83 +++ 10 files changed, 1034 insertions(+), 4 deletions(-) create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootData.h create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.c create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.h create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeMap.uni create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeString= s.uni create mode 100644 EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootVfr.vfr diff --git a/EmulatorPkg/EmulatorPkg.dec b/EmulatorPkg/EmulatorPkg.dec index 9e87b50afc..52a62c09c9 100644 --- a/EmulatorPkg/EmulatorPkg.dec +++ b/EmulatorPkg/EmulatorPkg.dec @@ -4,7 +4,7 @@ #=0D # Copyright (c) 2008 - 2019, Intel Corporation. All rights reserved.
=0D # Portions copyright (c) 2011, Apple Inc. All rights reserved.=0D -# (C) Copyright 2020-2021 Hewlett Packard Enterprise Development LP
=0D +# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -47,7 +47,8 @@ gEmuVirtualDisksGuid =3D { 0xf2ba331a, 0x8985, 0x11db, { 0xa4, 0x0= 6, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } }=0D gEmuPhysicalDisksGuid =3D { 0xf2bdcc96, 0x8985, 0x11db, { 0x87, 0x1= 9, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } }=0D gEmuRedfishServiceGuid =3D { 0x3fb208ac, 0x2185, 0x498c, { 0xbf, 0x4= 6, 0xdc, 0x23, 0xda, 0x58, 0x7b, 0x55 } }=0D - gHii2RedfishMemoryFormsetGuid =3D { 0XC2BE579E, 0X3C57, 0X499C, { 0XA9,= 0XDF, 0XE6, 0X23, 0X8A, 0X49, 0X64, 0XF8 }}=0D + gHii2RedfishMemoryFormsetGuid =3D { 0xC2BE579E, 0x3C57, 0x499C, { 0xA9,= 0xDF, 0xE6, 0x23, 0x8A, 0x49, 0x64, 0xF8 }}=0D + gHii2RedfishBootFormsetGuid =3D { 0x8399a787, 0x108e, 0x4e53, { 0x9e, 0= xde, 0x4b, 0x18, 0xcc, 0x9e, 0xab, 0x3b }}=0D =0D [PcdsFeatureFlag]=0D ## If TRUE, if symbols only load on breakpoints and gdb entry=0D diff --git a/EmulatorPkg/EmulatorPkg.dsc b/EmulatorPkg/EmulatorPkg.dsc index e5cb3c3d8d..1d59b4a1dd 100644 --- a/EmulatorPkg/EmulatorPkg.dsc +++ b/EmulatorPkg/EmulatorPkg.dsc @@ -7,7 +7,7 @@ # Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
=0D # Portions copyright (c) 2010 - 2011, Apple Inc. All rights reserved.
= =0D # Copyright (c) Microsoft Corporation.=0D -# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
=0D +# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -490,6 +490,7 @@ =0D !if $(REDFISH_ENABLE) =3D=3D TRUE=0D EmulatorPkg/Hii2RedfishMemoryDxe/Hii2RedfishMemoryDxe.inf=0D + EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf=0D !endif=0D !include RedfishPkg/Redfish.dsc.inc=0D !include RedfishClientPkg/RedfishClient.dsc.inc=0D diff --git a/EmulatorPkg/EmulatorPkg.fdf b/EmulatorPkg/EmulatorPkg.fdf index 5e770af186..f9ff4320d9 100644 --- a/EmulatorPkg/EmulatorPkg.fdf +++ b/EmulatorPkg/EmulatorPkg.fdf @@ -3,7 +3,7 @@ #=0D # Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.
=0D # Portions copyright (c) 2009 - 2011, Apple Inc. All rights reserved.
= =0D -# (C) Copyright 2021 Hewlett Packard Enterprise Development LP
=0D +# (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -214,6 +214,7 @@ INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf #=0D !if $(REDFISH_ENABLE) =3D=3D TRUE=0D INF EmulatorPkg/Hii2RedfishMemoryDxe/Hii2RedfishMemoryDxe.inf=0D + INF EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf=0D !endif=0D !include RedfishPkg/Redfish.fdf.inc=0D !include RedfishClientPkg/RedfishClient.fdf.inc=0D diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootData.h b/Emulato= rPkg/Hii2RedfishBootDxe/Hii2RedfishBootData.h new file mode 100644 index 0000000000..0da28a5032 --- /dev/null +++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootData.h @@ -0,0 +1,60 @@ +/** @file=0D + The header file of HII-to-Redfish boot driver.=0D +=0D + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef HII_2_REDFISH_BOOT_DATA_H_=0D +#define HII_2_REDFISH_BOOT_DATA_H_=0D +=0D +#include =0D +#include =0D +=0D +#define HII_2_REDFISH_BOOT_FORMSET_GUID \=0D + { \=0D + 0x8399a787, 0x108e, 0x4e53, { 0x9e, 0xde, 0x4b, 0x18, 0xcc, 0x9e, 0xab= , 0x3b } \=0D + }=0D +=0D +extern EFI_GUID gHii2RedfishBootFormsetGuid;=0D +=0D +#define FORM_ID 0x001=0D +#define QUESTION_ID_BOOT_SOURCE_OVERRIDE_ENABLED 0x100=0D +#define QUESTION_ID_BOOT_SOURCE_OVERRIDE_MODE 0x101=0D +#define QUESTION_ID_BOOT_SOURCE_OVERRIDE_TARGET 0x102=0D +#define LABEL_BOOT_OPTION 0x200=0D +#define LABEL_BOOT_OPTION_END 0x201=0D +#define BOOT_ORDER_LIST 0x300=0D +#define MAX_BOOT_OPTIONS 100=0D +#define BOOT_OPTION_VAR_STORE_ID 0x800=0D +//=0D +// VarOffset that will be used to create question=0D +// all these values are computed from the structure=0D +// defined below=0D +//=0D +#define VAR_OFFSET(Field) ((UINT16) ((UINTN) &(((HII_2_REDFIS= H_BOOT_OPTION_VARSTORE_DATA *) 0)->Field)))=0D +=0D +#pragma pack(1)=0D +=0D +//=0D +// Definiton of HII_2_REDFISH_BOOT_EFI_VARSTORE_DATA=0D +//=0D +typedef struct {=0D + UINT8 BootSourceOverrideEnabled;=0D + UINT8 BootSourceOverrideMode;=0D + UINT8 BootSourceOverrideTarget;=0D + UINT8 Reversed;=0D +} HII_2_REDFISH_BOOT_EFI_VARSTORE_DATA;=0D +=0D +//=0D +// Definiton of HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA=0D +//=0D +typedef struct {=0D + UINT32 BootOptionOrder[MAX_BOOT_OPTIONS];=0D +} HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA;=0D +=0D +#pragma pack()=0D +=0D +#endif=0D diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.c b/Emulator= Pkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.c new file mode 100644 index 0000000000..203fd8e1ef --- /dev/null +++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.c @@ -0,0 +1,702 @@ +/** @file=0D + HII-to-Redfish boot driver.=0D +=0D + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include "Hii2RedfishBootDxe.h"=0D +=0D +EFI_GUID mHii2RedfishBootGuid =3D HII_2_REDFISH_BOOT_FORMSET_GUID;= =0D +EFI_HII_HANDLE mHiiHandle;=0D +EFI_HANDLE mDriverHandle;=0D +EFI_EVENT mEvent =3D NULL;=0D +CHAR16 mHii2RedfishEfiVar[] =3D L"Hii2RedfishBootEfiVar";=0D +HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA mBootOptionsVarData;=0D +=0D +///=0D +/// HII specific Vendor Device Path definition.=0D +///=0D +HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath =3D {=0D + {=0D + {=0D + HARDWARE_DEVICE_PATH,=0D + HW_VENDOR_DP,=0D + {=0D + (UINT8) (sizeof (VENDOR_DEVICE_PATH)),=0D + (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)=0D + }=0D + },=0D + HII_2_REDFISH_BOOT_FORMSET_GUID=0D + },=0D + {=0D + END_DEVICE_PATH_TYPE,=0D + END_ENTIRE_DEVICE_PATH_SUBTYPE,=0D + {=0D + (UINT8) (END_DEVICE_PATH_LENGTH),=0D + (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)=0D + }=0D + }=0D +};=0D +=0D +/**=0D + This function add 'x-uefi-' configuration language to given string ID.=0D +=0D + @param[in] HiiHandle HII handle=0D + @param[in] StringId String token ID=0D + @param[in] ConfigLang Configure language of question=0D +=0D + @retval EFI_STATUS=0D +=0D +**/=0D +EFI_STATUS=0D +UpdateConfigLanguageToQuestion (=0D + IN EFI_HII_HANDLE HiiHandle,=0D + IN EFI_STRING_ID StringId,=0D + IN EFI_STRING ConfigLang=0D + )=0D +{=0D + CHAR16 ConfigLanguage[32];=0D +=0D + if (HiiHandle =3D=3D NULL || StringId =3D=3D 0 || ConfigLang =3D=3D NULL= ) {=0D + return EFI_INVALID_LANGUAGE;=0D + }=0D +=0D + UnicodeSPrint (ConfigLanguage, sizeof (ConfigLanguage), ConfigLang);=0D +=0D + DEBUG ((DEBUG_INFO, "%a, add config-language for string(%d): %s\n", __FU= NCTION__, StringId, ConfigLanguage));=0D +=0D + HiiSetString (=0D + HiiHandle,=0D + StringId,=0D + ConfigLanguage,=0D + COMPUTER_SYSTEM_SECHEMA_VERSION=0D + );=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + This function add 'x-uefi-' configuration language to given string ID.=0D +=0D + @param[in] HiiHandle HII handle=0D + @param[in] StringId String token ID=0D + @param[in] Index The index of boot option=0D + @param[in] BootOption Boot option context=0D +=0D + @retval EFI_STATUS=0D +=0D +**/=0D +EFI_STATUS=0D +UpdateConfigLanguageToValues (=0D + IN EFI_HII_HANDLE HiiHandle,=0D + IN EFI_STRING_ID StringId,=0D + IN UINTN Index,=0D + IN EFI_BOOT_MANAGER_LOAD_OPTION *BootOption=0D + )=0D +{=0D + CHAR16 ConfigLanguage[10];=0D +=0D + if (HiiHandle =3D=3D NULL || StringId =3D=3D 0 || BootOption =3D=3D NULL= ) {=0D + return EFI_INVALID_LANGUAGE;=0D + }=0D +=0D + UnicodeSPrint (ConfigLanguage, sizeof (ConfigLanguage), L"Boot%04x", Boo= tOption->OptionNumber);=0D +=0D + DEBUG ((DEBUG_INFO, "%a, add config-language for string(%d): %s\n", __FU= NCTION__, StringId, ConfigLanguage));=0D +=0D + HiiSetString (=0D + HiiHandle,=0D + StringId,=0D + ConfigLanguage,=0D + COMPUTER_SYSTEM_SECHEMA_VERSION=0D + );=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + This function creates boot order with ordered-list op-codes in runtime.= =0D +=0D + @retval EFI_STATUS=0D +=0D +**/=0D +EFI_STATUS=0D +RefreshBootOrderList (=0D + VOID=0D + )=0D +{=0D + UINTN Index;=0D + EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;=0D + UINTN BootOptionCount;=0D + EFI_STRING_ID Token;=0D + VOID *StartOpCodeHandle;=0D + VOID *EndOpCodeHandle;=0D + EFI_IFR_GUID_LABEL *StartLabel;=0D + EFI_IFR_GUID_LABEL *EndLabel;=0D + BOOLEAN IsLegacyOption;=0D + VOID *OptionsOpCodeHandle;=0D + UINTN OptionIndex;=0D +=0D + //=0D + // for better user experience=0D + // 1. User changes HD configuration (e.g.: unplug HDD), here we have a c= hance to remove the HDD boot option=0D + // 2. User enables/disables UEFI PXE, here we have a chance to add/remov= e EFI Network boot option=0D + //=0D + EfiBootManagerRefreshAllBootOption ();=0D +=0D + BootOption =3D EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptio= nTypeBoot);=0D +=0D + if (BootOptionCount =3D=3D 0) {=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + //=0D + // Initial var store=0D + //=0D + ZeroMem (&mBootOptionsVarData, sizeof (HII_2_REDFISH_BOOT_OPTION_VARSTOR= E_DATA));=0D +=0D + //=0D + // Allocate space for creation of UpdateData Buffer=0D + //=0D + StartOpCodeHandle =3D HiiAllocateOpCodeHandle ();=0D + ASSERT (StartOpCodeHandle !=3D NULL);=0D +=0D + EndOpCodeHandle =3D HiiAllocateOpCodeHandle ();=0D + ASSERT (EndOpCodeHandle !=3D NULL);=0D +=0D + //=0D + // Create Hii Extend Label OpCode as the start opcode=0D + //=0D + StartLabel =3D (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHa= ndle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));=0D + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL;=0D + StartLabel->Number =3D LABEL_BOOT_OPTION;=0D +=0D + //=0D + // Create Hii Extend Label OpCode as the end opcode=0D + //=0D + EndLabel =3D (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle= , &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));=0D + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL;=0D + EndLabel->Number =3D LABEL_BOOT_OPTION_END;=0D +=0D +=0D + OptionsOpCodeHandle =3D HiiAllocateOpCodeHandle ();=0D + ASSERT (OptionsOpCodeHandle !=3D NULL);=0D +=0D + for (Index =3D 0, OptionIndex =3D 0; Index < BootOptionCount; Index++) {= =0D + //=0D + // Don't display hidden boot options, but retain inactive ones.=0D + //=0D + if ((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) !=3D 0) {=0D + continue;=0D + }=0D +=0D + //=0D + // Group the legacy boot option in the sub title created dynamically=0D + //=0D + IsLegacyOption =3D (BOOLEAN) (=0D + (DevicePathType (BootOption[Index].FilePath) =3D=3D= BBS_DEVICE_PATH) &&=0D + (DevicePathSubType (BootOption[Index].FilePath) =3D= =3D BBS_BBS_DP)=0D + );=0D +=0D + //=0D + // Don't display legacy boot options=0D + //=0D + if (IsLegacyOption) {=0D + continue;=0D + }=0D +=0D + mBootOptionsVarData.BootOptionOrder[OptionIndex++] =3D (UINT32)BootOpt= ion[Index].OptionNumber;=0D +=0D + ASSERT (BootOption[Index].Description !=3D NULL);=0D +=0D + Token =3D HiiSetString (mHiiHandle, 0, BootOption[Index].Description, = NULL);=0D +=0D + //=0D + // Add boot option=0D + //=0D + HiiCreateOneOfOptionOpCode (=0D + OptionsOpCodeHandle,=0D + Token,=0D + 0,=0D + EFI_IFR_TYPE_NUM_SIZE_32,=0D + BootOption[Index].OptionNumber=0D + );=0D +=0D + //=0D + // Add x-uefi configure language for boot options.=0D + //=0D + UpdateConfigLanguageToValues (mHiiHandle, Token, OptionIndex, &BootOpt= ion[Index]);=0D + }=0D +=0D + //=0D + // Create ordered list op-code=0D + //=0D + HiiCreateOrderedListOpCode (=0D + StartOpCodeHandle, // Container for dynamic cre= ated opcodes=0D + BOOT_ORDER_LIST, // Question ID=0D + BOOT_OPTION_VAR_STORE_ID, // VarStore ID=0D + (UINT16)VAR_OFFSET (BootOptionOrder), // Offset in Buffer = Storage=0D + STRING_TOKEN (STR_BOOT_ORDER_LIST), // Question prompt text=0D + STRING_TOKEN (STR_BOOT_ORDER_LIST_HELP), // Question help text=0D + 0, // Question flag=0D + EFI_IFR_UNIQUE_SET, // Ordered list flag, e.g. E= FI_IFR_UNIQUE_SET=0D + EFI_IFR_TYPE_NUM_SIZE_32, // Data type of Question val= ue=0D + MAX_BOOT_OPTIONS, // Maximum container=0D + OptionsOpCodeHandle, // Option Opcode list=0D + NULL // Default Opcode is NULL=0D + );=0D +=0D + //=0D + // Add x-uefi configure language for boot order.=0D + //=0D + UpdateConfigLanguageToQuestion (mHiiHandle, STRING_TOKEN (STR_BOOT_ORDER= _LIST), COMPUTER_SYSTEM_BOOT_BOOTORDER);=0D +=0D + //=0D + // Update HII form=0D + //=0D + HiiUpdateForm (=0D + mHiiHandle,=0D + &mHii2RedfishBootGuid,=0D + FORM_ID,=0D + StartOpCodeHandle,=0D + EndOpCodeHandle=0D + );=0D +=0D + HiiFreeOpCodeHandle (StartOpCodeHandle);=0D + HiiFreeOpCodeHandle (EndOpCodeHandle);=0D + HiiFreeOpCodeHandle (OptionsOpCodeHandle);=0D +=0D + EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + This function update the "BootOrder" EFI Variable based on=0D + BMM Formset's NV map. It then refresh BootOptionMenu=0D + with the new "BootOrder" list.=0D +=0D + @param[in] BootOptionVar Boot option NV data=0D +=0D + @retval EFI_SUCCESS The function complete successfully.=0D + @retval EFI_OUT_OF_RESOURCES Not enough memory to complete the functi= on.=0D + @return The EFI variable can not be saved. See gRT->SetVariable for deta= il return information.=0D +=0D +**/=0D +EFI_STATUS=0D +UpdateBootorderList (=0D + IN HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA *BootOptionVar=0D + )=0D +{=0D + EFI_STATUS Status;=0D + UINT16 Index;=0D + UINT16 OrderIndex;=0D + UINT16 *BootOrder;=0D + UINTN BootOrderSize;=0D + UINT16 OptionNumber;=0D +=0D + if (BootOptionVar =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + //=0D + // First check whether BootOrder is present in current configuration=0D + //=0D + GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrder, &BootOrderSiz= e);=0D + if (BootOrder =3D=3D NULL) {=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D +=0D + //=0D + // OptionOrder is subset of BootOrder=0D + //=0D + for (OrderIndex =3D 0; (OrderIndex < MAX_BOOT_OPTIONS) && (BootOptionVar= ->BootOptionOrder[OrderIndex] !=3D 0); OrderIndex++) {=0D + for (Index =3D OrderIndex; Index < BootOrderSize / sizeof (UINT16); In= dex++) {=0D + if ((BootOrder[Index] =3D=3D (UINT16)BootOptionVar->BootOptionOrder[= OrderIndex]) && (OrderIndex !=3D Index)) {=0D + OptionNumber =3D BootOrder[Index];=0D + CopyMem (&BootOrder[OrderIndex + 1], &BootOrder[OrderIndex], (Inde= x - OrderIndex) * sizeof (UINT16));=0D + BootOrder[OrderIndex] =3D OptionNumber;=0D + }=0D + }=0D + }=0D +=0D + Status =3D gRT->SetVariable (=0D + L"BootOrder",=0D + &gEfiGlobalVariableGuid,=0D + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_A= CCESS | EFI_VARIABLE_NON_VOLATILE,=0D + BootOrderSize,=0D + BootOrder=0D + );=0D + FreePool (BootOrder);=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Initial HII variable if it does not exist.=0D +=0D + @retval EFI_SUCESS HII variable is initialized.=0D +=0D +**/=0D +EFI_STATUS=0D +InitialHiiVairable (=0D + VOID=0D + )=0D +{=0D + EFI_STATUS Status;=0D + UINTN BufferSize;=0D + HII_2_REDFISH_BOOT_EFI_VARSTORE_DATA Hii2RedfishBootVar;=0D +=0D + //=0D + // Get Buffer Storage data from EFI variable.=0D + // Try to get the current setting from variable.=0D + //=0D + BufferSize =3D sizeof (HII_2_REDFISH_BOOT_EFI_VARSTORE_DATA);=0D + Status =3D gRT->GetVariable (=0D + mHii2RedfishEfiVar,=0D + &gHii2RedfishBootFormsetGuid,=0D + NULL,=0D + &BufferSize,=0D + &Hii2RedfishBootVar=0D + );=0D + if (!EFI_ERROR (Status)) {=0D + return EFI_SUCCESS;=0D + }=0D +=0D + //=0D + // Initialization=0D + //=0D + Hii2RedfishBootVar.BootSourceOverrideEnabled =3D STR_DISABLED;=0D + Hii2RedfishBootVar.BootSourceOverrideMode =3D STR_UEFI;=0D + Hii2RedfishBootVar.BootSourceOverrideTarget =3D STR_TARGET_NONE;=0D + Hii2RedfishBootVar.Reversed =3D 0x00;=0D +=0D + Status =3D gRT->SetVariable (=0D + mHii2RedfishEfiVar,=0D + &gHii2RedfishBootFormsetGuid,=0D + VARIABLE_ATTRIBUTE_NV_BS,=0D + BufferSize,=0D + &Hii2RedfishBootVar=0D + );=0D +=0D + //=0D + // Initial var store=0D + //=0D + ZeroMem (&mBootOptionsVarData, sizeof (HII_2_REDFISH_BOOT_OPTION_VARSTOR= E_DATA));=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + This function allows a caller to extract the current configuration for o= ne=0D + or more named elements from the target driver.=0D +=0D + @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL.=0D + @param[in] Request A null-terminated Unicode string in=0D + format.=0D + @param[out] Progress On return, points to a character in the R= equest=0D + string. Points to the string's null termi= nator if=0D + request was successful. Points to the mos= t recent=0D + '&' before the first failing name/value p= air (or=0D + the beginning of the string if the failur= e is in=0D + the first name/value pair) if the request= was not=0D + successful.=0D + @param[out] Results A null-terminated Unicode string in=0D + format which has all valu= es filled=0D + in for the names in the Request string. S= tring to=0D + be allocated by the called function.=0D +=0D + @retval EFI_SUCCESS The Results is filled with the requested = values.=0D + @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.=0D + @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown nam= e.=0D + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this=0D + driver.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +Hii2RedfishBootExtractConfig (=0D + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,=0D + IN CONST EFI_STRING Request,=0D + OUT EFI_STRING *Progress,=0D + OUT EFI_STRING *Results=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + if (Progress =3D=3D NULL || Results =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + *Progress =3D Request;=0D +=0D + if (Request =3D=3D NULL) {=0D + return EFI_UNSUPPORTED;=0D + }=0D +=0D + //=0D + // Check whether request for EFI Varstore. EFI varstore get data=0D + // through hii database, not support in this path.=0D + //=0D + if (HiiIsConfigHdrMatch(Request, &gHii2RedfishBootFormsetGuid, L"Hii2Red= fishBootEfiVar")) {=0D + return EFI_UNSUPPORTED;=0D + }=0D +=0D + //=0D + // Handle boot order list=0D + //=0D + if (HiiIsConfigHdrMatch(Request, &gHii2RedfishBootFormsetGuid, L"Hii2Red= fishBootOptionVar")) {=0D + Status =3D gHiiConfigRouting->BlockToConfig (=0D + gHiiConfigRouting,=0D + Request,=0D + (UINT8 *) &mBootOptionsVarData,=0D + sizeof (HII_2_REDFISH_BOOT_OPTION_VARSTORE= _DATA),=0D + Results,=0D + Progress=0D + );=0D +=0D + //=0D + // Set Progress string to the original request string.=0D + //=0D + if (Request =3D=3D NULL) {=0D + *Progress =3D NULL;=0D + } else if (StrStr (Request, L"OFFSET") =3D=3D NULL) {=0D + *Progress =3D Request + StrLen (Request);=0D + }=0D +=0D + return EFI_SUCCESS;=0D + }=0D +=0D + return EFI_NOT_FOUND;=0D +}=0D +=0D +=0D +/**=0D + This function processes the results of changes in configuration.=0D +=0D + @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL.=0D + @param[in] Configuration A null-terminated Unicode string in =0D + format.=0D + @param[out] Progress A pointer to a string filled in with the = offset of=0D + the most recent '&' before the first fail= ing=0D + name/value pair (or the beginning of the = string if=0D + the failure is in the first name/value pa= ir) or=0D + the terminating NULL if all was successfu= l.=0D +=0D + @retval EFI_SUCCESS The Results is processed successfully.=0D + @retval EFI_INVALID_PARAMETER Configuration is NULL.=0D + @retval EFI_NOT_FOUND Routing data doesn't match any storage in= this=0D + driver.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +Hii2RedfishBootRouteConfig (=0D + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,=0D + IN CONST EFI_STRING Configuration,=0D + OUT EFI_STRING *Progress=0D + )=0D +{=0D + EFI_STATUS Status;=0D + UINTN BufferSize;=0D + HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA BootOptionsVar;=0D +=0D + *Progress =3D Configuration;=0D +=0D + //=0D + // Check whether request for EFI Varstore. EFI varstore get data=0D + // through hii database, not support in this path.=0D + //=0D + if (HiiIsConfigHdrMatch(Configuration, &gHii2RedfishBootFormsetGuid, L"H= ii2RedfishBootEfiVar")) {=0D + return EFI_UNSUPPORTED;=0D + }=0D +=0D + //=0D + // Handle boot order list=0D + //=0D + if (HiiIsConfigHdrMatch(Configuration, &gHii2RedfishBootFormsetGuid, L"H= ii2RedfishBootOptionVar")) {=0D + BufferSize =3D sizeof(HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA);=0D + ZeroMem (&BootOptionsVar, sizeof(HII_2_REDFISH_BOOT_OPTION_VARSTORE_DA= TA));=0D + Status =3D gHiiConfigRouting->ConfigToBlock (=0D + gHiiConfigRouting,=0D + Configuration,=0D + (UINT8 *)&BootOptionsVar,=0D + &BufferSize,=0D + Progress=0D + );=0D +=0D + if (CompareMem (BootOptionsVar.BootOptionOrder, mBootOptionsVarData.Bo= otOptionOrder, (sizeof (UINT32) * MAX_BOOT_OPTIONS))) {=0D + Status =3D UpdateBootorderList (&BootOptionsVar);=0D + if (!EFI_ERROR (Status)) {=0D + //=0D + // Boot order update successed. Copy it to local copy.=0D + //=0D + CopyMem (mBootOptionsVarData.BootOptionOrder, BootOptionsVar.BootO= ptionOrder, (sizeof (UINT32) * MAX_BOOT_OPTIONS));=0D + }=0D + }=0D +=0D + return EFI_SUCCESS;=0D + }=0D +=0D + return EFI_NOT_FOUND;=0D +}=0D +=0D +=0D +/**=0D + This function processes the results of changes in configuration.=0D +=0D + @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTO= COL.=0D + @param[in] Action Specifies the type of action taken by the= browser.=0D + @param[in] QuestionId A unique value which is sent to the origi= nal=0D + exporting driver so that it can identify = the type=0D + of data to expect.=0D + @param[in] Type The type of value for the question.=0D + @param[in] Value A pointer to the data being sent to the o= riginal=0D + exporting driver.=0D + @param[out] ActionRequest On return, points to the action requested= by the=0D + callback function.=0D +=0D + @retval EFI_SUCCESS The callback successfully handled the act= ion.=0D + @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold t= he=0D + variable and its data.=0D + @retval EFI_DEVICE_ERROR The variable could not be saved.=0D + @retval EFI_UNSUPPORTED The specified Action is not supported by = the=0D + callback.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +Hii2RedfishBootDriverCallback (=0D + IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,=0D + IN EFI_BROWSER_ACTION Action,=0D + IN EFI_QUESTION_ID QuestionId,=0D + IN UINT8 Type,=0D + IN EFI_IFR_TYPE_VALUE *Value,=0D + OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest=0D + )=0D +{=0D + DEBUG ((DEBUG_INFO, "%a, action: 0x%x QID: 0x%x\n", __FUNCTION__, Action= , QuestionId));=0D +=0D + if (QuestionId =3D=3D QUESTION_ID_BOOT_SOURCE_OVERRIDE_ENABLED && Action= =3D=3D EFI_BROWSER_ACTION_FORM_OPEN) {=0D + RefreshBootOrderList ();=0D +=0D + return EFI_SUCCESS;=0D + }=0D +=0D + return EFI_UNSUPPORTED;=0D +}=0D +=0D +EFI_HII_CONFIG_ACCESS_PROTOCOL mHii2RedfishConfigAccess =3D {=0D + Hii2RedfishBootExtractConfig,=0D + Hii2RedfishBootRouteConfig,=0D + Hii2RedfishBootDriverCallback=0D +};=0D +=0D +/**=0D + Callback function executed when the ready-to-provisioning event group is= signaled.=0D +=0D + @param[in] Event Event whose notification function is being invoked= .=0D + @param[out] Context Pointer to the Context buffer=0D +=0D +**/=0D +VOID=0D +EFIAPI=0D +Hii2RedfishBootReadyToProvisioning (=0D + IN EFI_EVENT Event,=0D + OUT VOID *Context=0D + )=0D +{=0D + //=0D + // Refresh boot order and create configure language=0D + //=0D + RefreshBootOrderList ();=0D +}=0D +=0D +/**=0D + Main entry for this driver.=0D +=0D + @param[in] ImageHandle Image handle this driver.=0D + @param[in] SystemTable Pointer to SystemTable.=0D +=0D + @retval EFI_SUCESS This function always complete successfully.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +Hii2RedfishBootDxeDriverEntryPoint (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + mDriverHandle =3D NULL;=0D + Status =3D gBS->InstallMultipleProtocolInterfaces (=0D + &mDriverHandle,=0D + &gEfiDevicePathProtocolGuid,=0D + &mHiiVendorDevicePath,=0D + &gEfiHiiConfigAccessProtocolGuid,=0D + &mHii2RedfishConfigAccess,=0D + NULL=0D + );=0D +=0D + //=0D + // Publish our HII data=0D + //=0D + mHiiHandle =3D HiiAddPackages (=0D + &mHii2RedfishBootGuid,=0D + mDriverHandle,=0D + Hii2RedfishBootDxeStrings,=0D + Hii2RedfishBootVfrBin,=0D + NULL=0D + );=0D + if (mHiiHandle =3D=3D NULL) {=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D +=0D + Status =3D InitialHiiVairable ();=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, failed to initial variable: %r\n", __FUNCTIO= N__, Status));=0D + }=0D +=0D + //=0D + // Register read-to-provisioning event=0D + //=0D + Status =3D CreateReadyToProvisioningEvent (=0D + Hii2RedfishBootReadyToProvisioning,=0D + NULL,=0D + &mEvent=0D + );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, failed to register ready-to-provisioning eve= nt: %r\n", __FUNCTION__, Status));=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Unloads the application and its installed protocol.=0D +=0D + @param[in] ImageHandle Handle that identifies the image to be unl= oaded.=0D +=0D + @retval EFI_SUCCESS The image has been unloaded.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +Hii2RedfishBootDxeDriverUnload (=0D + IN EFI_HANDLE ImageHandle=0D + )=0D +{=0D + if (mHiiHandle !=3D NULL) {=0D + HiiRemovePackages (mHiiHandle);=0D + }=0D +=0D + if (mEvent !=3D NULL) {=0D + gBS->CloseEvent (mEvent);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.h b/Emulator= Pkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.h new file mode 100644 index 0000000000..58e6d33f0f --- /dev/null +++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.h @@ -0,0 +1,53 @@ +/** @file=0D + HII-to-Redfish memory driver header file.=0D +=0D + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef HII_2_REDFISH_BOOT_DXE_H_=0D +#define HII_2_REDFISH_BOOT_DXE_H_=0D +=0D +#include =0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +=0D +#include =0D +#include =0D +=0D +#include "Hii2RedfishBootData.h"=0D +=0D +extern UINT8 Hii2RedfishBootVfrBin[];=0D +=0D +#define COMPUTER_SYSTEM_SECHEMA_VERSION "x-uefi-redfish-ComputerSystem.v1_= 5_0"=0D +#define COMPUTER_SYSTEM_BOOT_BOOTORDER L"/Systems/{1}/Boot/BootOrder"=0D +=0D +#pragma pack(1)=0D +=0D +///=0D +/// HII specific Vendor Device Path definition.=0D +///=0D +typedef struct {=0D + VENDOR_DEVICE_PATH VendorDevicePath;=0D + EFI_DEVICE_PATH_PROTOCOL End;=0D +} HII_VENDOR_DEVICE_PATH;=0D +=0D +#pragma pack()=0D +=0D +#endif=0D diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf b/Emulat= orPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf new file mode 100644 index 0000000000..8d40885904 --- /dev/null +++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxe.inf @@ -0,0 +1,60 @@ +## @file=0D +# HII-to-Redfish boot driver.=0D +#=0D +# (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D Hii2RedfishBootDxe=0D + FILE_GUID =3D F9BA69BD-1EDB-4334-9D57-7E974ADF1361= =0D + MODULE_TYPE =3D UEFI_DRIVER=0D + VERSION_STRING =3D 1.0=0D + ENTRY_POINT =3D Hii2RedfishBootDxeDriverEntryPoint=0D + UNLOAD_IMAGE =3D Hii2RedfishBootDxeDriverUnload=0D +=0D +[Sources]=0D + Hii2RedfishBootDxe.c=0D + Hii2RedfishBootDxe.h=0D + Hii2RedfishBootData.h=0D + Hii2RedfishBootVfr.vfr=0D + Hii2RedfishBootDxeStrings.uni=0D + Hii2RedfishBootDxeMap.uni=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + EmulatorPkg/EmulatorPkg.dec=0D + RedfishClientPkg/RedfishClientPkg.dec=0D +=0D +[LibraryClasses]=0D + UefiDriverEntryPoint=0D + BaseLib=0D + BaseMemoryLib=0D + DebugLib=0D + PcdLib=0D + MemoryAllocationLib=0D + UefiBootServicesTableLib=0D + UefiRuntimeServicesTableLib=0D + UefiLib=0D + PrintLib=0D + HiiLib=0D + UefiBootManagerLib=0D + UefiHiiServicesLib=0D + RedfishEventLib=0D +=0D +[Protocols]=0D + gEfiDevicePathProtocolGuid=0D + gEfiHiiConfigAccessProtocolGuid=0D +=0D +=0D +[Guids]=0D + gHii2RedfishBootFormsetGuid=0D + gEfiIfrTianoGuid=0D +=0D +[Depex]=0D + gEfiHiiDatabaseProtocolGuid=0D +=0D diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeMap.uni b/Emu= latorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeMap.uni new file mode 100644 index 0000000000..0589c90df5 --- /dev/null +++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeMap.uni @@ -0,0 +1,28 @@ +/** @file=0D + HII-to-Redfish memory driver.=0D +=0D + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +/=3D#=0D +#langdef x-uefi-redfish-ComputerSystem.v1_5_0 "ComputerSystem.v1_5_0"=0D +=0D +#string STR_BOOT_SOURCE_OVERRIDE_ENABLED #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "/Systems/{1}/Boot/BootSourceOverrideEnabled"=0D +#string STR_BOOT_SOURCE_OVERRIDE_MODE #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "/Systems/{1}/Boot/BootSourceOverrideMode"=0D +#string STR_BOOT_SOURCE_OVERRIDE_TARGET #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "/Systems/{1}/Boot/BootSourceOverrideTarget"=0D +=0D +#string STR_DISABLED #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Disabled"=0D +#string STR_ONCE #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Once"=0D +#string STR_CONTINUOUS #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Continuous"=0D +#string STR_UEFI #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "UEFI"=0D +#string STR_LEGACY #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Legacy"=0D +#string STR_TARGET_NONE #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "None"=0D +#string STR_TARGET_PXE #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Pxe"=0D +#string STR_TARGET_USB #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Usb"=0D +#string STR_TARGET_HDD #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "Hdd"=0D +#string STR_TARGET_BIOS_SETUP #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "BiosSetup"=0D +#string STR_TARGET_UEFI #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "UefiTarget"=0D +#string STR_TARGET_UEFI_HTTP #language x-uefi-redfish-Co= mputerSystem.v1_5_0 "UefiHttp"=0D diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeStrings.uni b= /EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeStrings.uni new file mode 100644 index 0000000000..c2057633c2 --- /dev/null +++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootDxeStrings.uni @@ -0,0 +1,41 @@ +/** @file=0D + HII-to-Redfish memory driver.=0D +=0D + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +/=3D#=0D +#langdef en-US "English"=0D +=0D +#string STR_FORM_SET_TITLE #language en-US "HII to = Redfish (Boot)"=0D +#string STR_FORM_SET_TITLE_HELP #language en-US "HII to = Redfish (Boot)"=0D +#string STR_FORM_TITLE #language en-US "HII to = Redfish Boot properties"=0D +=0D +#string STR_BOOT_ORDER #language en-US "Boot Or= der"=0D +#string STR_BOOT_ORDER_LIST #language en-US "Boot Or= der List"=0D +#string STR_BOOT_ORDER_LIST_HELP #language en-US "Boot Or= der List"=0D +=0D +#string STR_BOOT_SOURCE_OVERRIDE_ENABLED #language en-US "Boot Sou= rce Override Enabled"=0D +#string STR_BOOT_SOURCE_OVERRIDE_ENABLED_HELP #language en-US "Describe= s the state of the Boot Source Override feature."=0D +=0D +#string STR_BOOT_SOURCE_OVERRIDE_MODE #language en-US "Boot Sou= rce Override Mode"=0D +#string STR_BOOT_SOURCE_OVERRIDE_MODE_HELP #language en-US "The BIOS= Boot Mode (either Legacy or UEFI) to be used when BootSourceOverrideTarget= boot source is booted from."=0D +=0D +#string STR_BOOT_SOURCE_OVERRIDE_TARGET #language en-US "Boot Sou= rce Override Target"=0D +#string STR_BOOT_SOURCE_OVERRIDE_TARGET_HELP #language en-US "The curr= ent boot source to be used at next boot instead of the normal boot device, = if BootSourceOverrideEnabled is true."=0D +=0D +#string STR_DISABLED #language en-US "Disabled= "=0D +#string STR_ONCE #language en-US "Once"=0D +#string STR_CONTINUOUS #language en-US "Continuo= us"=0D +#string STR_UEFI #language en-US "UEFI"=0D +#string STR_LEGACY #language en-US "Legacy"= =0D +#string STR_TARGET_NONE #language en-US "None"=0D +#string STR_TARGET_PXE #language en-US "Pxe"=0D +#string STR_TARGET_USB #language en-US "Usb"=0D +#string STR_TARGET_HDD #language en-US "Hdd"=0D +#string STR_TARGET_BIOS_SETUP #language en-US "Bios Set= up Menu"=0D +#string STR_TARGET_UEFI #language en-US "Uefi Tar= get"=0D +#string STR_TARGET_UEFI_HTTP #language en-US "Uefi Htt= p"=0D diff --git a/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootVfr.vfr b/Emulat= orPkg/Hii2RedfishBootDxe/Hii2RedfishBootVfr.vfr new file mode 100644 index 0000000000..3758de6bfd --- /dev/null +++ b/EmulatorPkg/Hii2RedfishBootDxe/Hii2RedfishBootVfr.vfr @@ -0,0 +1,83 @@ +/** @file=0D + HII-to-Redfish boot driver VFR file.=0D +=0D + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +=0D +#include "Hii2RedfishBootData.h"=0D +=0D +formset=0D + guid =3D HII_2_REDFISH_BOOT_FORMSET_GUID,=0D + title =3D STRING_TOKEN(STR_FORM_SET_TITLE),=0D + help =3D STRING_TOKEN(STR_FORM_SET_TITLE_HELP),=0D + classguid =3D EFI_HII_PLATFORM_SETUP_FORMSET_GUID,=0D +=0D + //=0D + // Define a EFI variable Storage (EFI_IFR_VARSTORE_EFI)=0D + //=0D + efivarstore HII_2_REDFISH_BOOT_EFI_VARSTORE_DATA,=0D + attribute =3D EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLAT= ILE, // EFI variable attribures=0D + name =3D Hii2RedfishBootEfiVar,=0D + guid =3D HII_2_REDFISH_BOOT_FORMSET_GUID;=0D +=0D + //=0D + // Define a variable Storage for boot order=0D + //=0D + varstore HII_2_REDFISH_BOOT_OPTION_VARSTORE_DATA,=0D + varid =3D BOOT_OPTION_VAR_STORE_ID,=0D + name =3D Hii2RedfishBootOptionVar,=0D + guid =3D HII_2_REDFISH_BOOT_FORMSET_GUID;=0D +=0D + //=0D + // Define a Form (EFI_IFR_FORM)=0D + //=0D + form formid =3D FORM_ID, // Form ID=0D + title =3D STRING_TOKEN(STR_FORM_TITLE); // Form title=0D +=0D + oneof varid =3D Hii2RedfishBootEfiVar.BootSourceOverrideEnabled,=0D + questionid =3D QUESTION_ID_BOOT_SOURCE_OVERRIDE_ENABLED,=0D + prompt =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_ENABLED),=0D + help =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_ENABLED_HELP),= =0D + flags =3D INTERACTIVE | NUMERIC_SIZE_1,=0D + option text =3D STRING_TOKEN(STR_DISABLED), value =3D ST= R_DISABLED, flags =3D DEFAULT;=0D + option text =3D STRING_TOKEN(STR_ONCE), value =3D ST= R_ONCE, flags =3D 0;=0D + option text =3D STRING_TOKEN(STR_CONTINUOUS), value =3D ST= R_CONTINUOUS, flags =3D 0;=0D + endoneof;=0D +=0D + oneof varid =3D Hii2RedfishBootEfiVar.BootSourceOverrideMode,=0D + questionid =3D QUESTION_ID_BOOT_SOURCE_OVERRIDE_MODE,=0D + prompt =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_MODE),=0D + help =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_MODE_HELP),=0D + flags =3D INTERACTIVE | NUMERIC_SIZE_1,=0D + option text =3D STRING_TOKEN(STR_UEFI), value =3D ST= R_UEFI, flags =3D DEFAULT;=0D + option text =3D STRING_TOKEN(STR_LEGACY), value =3D ST= R_LEGACY, flags =3D 0;=0D + endoneof;=0D +=0D + oneof varid =3D Hii2RedfishBootEfiVar.BootSourceOverrideTarget,=0D + questionid =3D QUESTION_ID_BOOT_SOURCE_OVERRIDE_TARGET,=0D + prompt =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_TARGET),=0D + help =3D STRING_TOKEN(STR_BOOT_SOURCE_OVERRIDE_TARGET_HELP),=0D + flags =3D INTERACTIVE | NUMERIC_SIZE_1,=0D + option text =3D STRING_TOKEN(STR_TARGET_NONE), value = =3D STR_TARGET_NONE, flags =3D DEFAULT;=0D + option text =3D STRING_TOKEN(STR_TARGET_PXE), value = =3D STR_TARGET_PXE, flags =3D 0;=0D + option text =3D STRING_TOKEN(STR_TARGET_USB), value = =3D STR_TARGET_USB, flags =3D 0;=0D + option text =3D STRING_TOKEN(STR_TARGET_HDD), value = =3D STR_TARGET_HDD, flags =3D 0;=0D + option text =3D STRING_TOKEN(STR_TARGET_BIOS_SETUP), value = =3D STR_TARGET_BIOS_SETUP, flags =3D 0;=0D + option text =3D STRING_TOKEN(STR_TARGET_UEFI), value = =3D STR_TARGET_UEFI, flags =3D 0;=0D + option text =3D STRING_TOKEN(STR_TARGET_UEFI_HTTP), value = =3D STR_TARGET_UEFI_HTTP, flags =3D 0;=0D + endoneof;=0D +=0D + subtitle text =3D STRING_TOKEN(STR_BOOT_ORDER);=0D +=0D + //=0D + // This is where we will dynamically add choices for the Boot Manager= =0D + //=0D + label LABEL_BOOT_OPTION;=0D + label LABEL_BOOT_OPTION_END;=0D +=0D + endform;=0D +endformset;=0D --=20 2.32.0.windows.2