From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 8C9E3AC09A5 for ; Wed, 14 Aug 2024 03:20:38 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=3DBw8wCD9F7a+n8H2TO/hfNyOfjGXNL3RzvKJzT74WI=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: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:Content-Type; s=20240206; t=1723605638; v=1; b=Ws/oWs2ParoPpW9sobNieoK0XGD6gdDXo8+2x+IIdPT/DA3Kul/jcYc3PO6ITRmE4TzfYFE4 IY+zAyVPaGvhP9Y5HrUHlZ9yfTdLeKCVtiuI/PDWZCGvJ7BLxaKs+fz1VcrAQ9XWSB+tD/luTKm gRf72UnCOyWEDtj1kopy8EL1Z7TFKF5sxFoUGrIB5tnuxDgy1g2MDfTAbm+HUxZWqEGoxZkrDWT 8DvrlVchNCtm3OYfUb7oRCDWEqY3XOb+/VcgFjh8pGKdY4KpcBc6CAtOJsgbLaBSHVMpOdgVwtd sSIktnyeLJVcEpn1htjG78e5OBnDIBs6Gh70bZO/N4s7w== X-Received: by 127.0.0.2 with SMTP id n4ShYY7687511xeJuN6S0iJp; Tue, 13 Aug 2024 20:20:36 -0700 X-Received: from DM1PR04CU001.outbound.protection.outlook.com (DM1PR04CU001.outbound.protection.outlook.com [52.101.61.96]) by mx.groups.io with SMTP id smtpd.web10.89694.1723605630299812910 for ; Tue, 13 Aug 2024 20:20:31 -0700 X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6357.prod.exchangelabs.com (2603:10b6:510:1a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.17; Wed, 14 Aug 2024 03:20:25 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::fc79:e629:93aa:8b8f]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::fc79:e629:93aa:8b8f%3]) with mapi id 15.20.7875.016; Wed, 14 Aug 2024 03:20:25 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: quic_llindhol@quicinc.com, chuong@os.amperecomputing.com, rebecca@os.amperecomputing.com, nhi@os.amperecomputing.com Subject: [edk2-devel] [PATCH 1/2] AmpereSiliconPkg: Implement BMC Configuration screen Date: Wed, 14 Aug 2024 10:18:45 +0700 Message-ID: <20240814031846.2351141-2-nhi@os.amperecomputing.com> In-Reply-To: <20240814031846.2351141-1-nhi@os.amperecomputing.com> References: <20240814031846.2351141-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: SI1PR02CA0012.apcprd02.prod.outlook.com (2603:1096:4:1f7::8) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB7287:EE_|PH0PR01MB6357:EE_ X-MS-Office365-Filtering-Correlation-Id: dbc17be0-c085-4ca6-7907-08dcbc100a2a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?cALjQJpPuBKy/XajZcMXmlNqDIQ94AU+TH0PR2cIggksgK6npxSHB3RqaCzX?= =?us-ascii?Q?NrB+6E/5Fvo0HPy5bItXqUkJsYaXDqMJzD17dp23iG0beinMfK/oje33t5mw?= =?us-ascii?Q?9yzISL7C9TFxMijRvAQD31FcEEty5YKJ6Zuxygh+s8JTqdp+W5H8ZOdZsI52?= =?us-ascii?Q?7y8QHTlspBkhaw5rf4HAhuaP0g1+DG0l+Y12vS7QQJl+Tro+1DGm+rR6KC2O?= =?us-ascii?Q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ii?Q?B2wTrq4BaLkV5FSKserF/Al81R+PndUcxULV1GtlzGqFF4EvZbZgSiNg33/1?= =?us-ascii?Q?exxAYNd5tRRey0puEEL5EfYRxyA/nmsviP94qB5NJMBcsTsq+yHrfYWbUpSr?= =?us-ascii?Q?gOgDrwdVS1wHxUrvJijQWU55cbEDjiAf5qJXcvYSNkdGibrpOYe+pRSd9ywZ?= =?us-ascii?Q?RbD5d9fJv0h/rv+GSutmRXKxBWHN4vI6N5+BRq9GNduZBzTN2ns2LZ5A1Ue0?= =?us-ascii?Q?RrcyFEOO27rJltvfosefx/0=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: dbc17be0-c085-4ca6-7907-08dcbc100a2a X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2024 03:20:25.7010 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ne2kqJdrGi9vdN3aYDWAruAuCK5IASUxmY0kfA3F7dK5a0AyG8NJ/L/s76CyzYamxnnHAplTjw5EAc0uVh5X1Fi2gI0WC9cy/cEr3I3cWEs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6357 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: Tue, 13 Aug 2024 20:20:31 -0700 Resent-From: nhi@os.amperecomputing.com Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: vQStUwwf6goMyHHNEaO9ILsVx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="Ws/oWs2P"; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io This implements the BMC configuration screen to provide basic information such as IPMI version, BMC version, and BMC IPv4. Signed-off-by: Nhi Pham --- Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec | = 8 +- Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.inf | 4= 4 +++ Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.h | 3= 5 +++ Silicon/Ampere/AmpereSiliconPkg/Include/Guid/BmcConfigHii.h | 1= 9 ++ Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigVfr.vfr | 4= 2 +++ Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.c | 32= 6 ++++++++++++++++++++ Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.uni | 1= 8 ++ 7 files changed, 491 insertions(+), 1 deletion(-) diff --git a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec b/Silicon= /Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec index 56e8b2fd2f11..9886bd809a02 100644 --- a/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec +++ b/Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec @@ -1,6 +1,6 @@ ## @file # -# Copyright (c) 2020 - 2023, Ampere Computing LLC. All rights reserved. +# Copyright (c) 2020 - 2024, Ampere Computing LLC. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -47,6 +47,12 @@ [Guids] ## Include/Guid/PlatformManagerHii.h gPlatformManagerExitEventGuid =3D { 0xE8887242, 0x4EFF, 0x4323, { 0x81,= 0xF4, 0xC9, 0x5F, 0xD5, 0x8D, 0x80, 0xD5 } } =20 + # + # BMC Configuration formset UUID + # + ## Include/Guid/BmcConfigHii.h + gBmcConfigFormSetGuid =3D { 0xC4D6ED50, 0x769D, 0x4319, { 0xEB, 0xB7, 0x= CC, 0xDD, 0xC8, 0x9D, 0x3D, 0x2D } } + [Ppis] =20 [PcdsFixedAtBuild] diff --git a/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfig= Dxe.inf b/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe= .inf new file mode 100644 index 000000000000..93938ac0163c --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.inf @@ -0,0 +1,44 @@ +## @file +# +# Copyright (c) 2024, Ampere Computing LLC. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D BmcConfigDxe + FILE_GUID =3D 5D1B9008-9CF5-4A12-AF0F-FB9C06005643 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D BmcConfigEntry + +[Sources.common] + BmcConfigDxe.c + BmcConfigDxe.uni + BmcConfigVfr.vfr + +[Packages] + Features/ManageabilityPkg/ManageabilityPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec + +[LibraryClasses] + BaseMemoryLib + DebugLib + HiiLib + IpmiCommandLib + MemoryAllocationLib + PrintLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Guids] + gBmcConfigFormSetGuid + gEfiIfrTianoGuid + gPlatformManagerFormsetGuid + +[Depex] + TRUE diff --git a/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfig= Dxe.h b/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.h new file mode 100644 index 000000000000..1ebb4be743df --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.h @@ -0,0 +1,35 @@ +/** @file + + Copyright (c) 2024, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef BMC_CONFIG_DXE_H_ +#define BMC_CONFIG_DXE_H_ + +// +// This is the generated IFR binary data for each formset defined in VFR. +// This data array is ready to be used as input of HiiAddPackages() to +// create a packagelist (which contains Form packages, String packages, et= c). +// +extern UINT8 BmcConfigVfrBin[]; + +// +// This is the generated String package data for all .UNI files. +// This data array is ready to be used as input of HiiAddPackages() to +// create a packagelist (which contains Form packages, String packages, et= c). +// +extern UINT8 BmcConfigDxeStrings[]; + +// +// Form definitions +// +#define MAIN_FORM_ID 0x1000 +#define LABEL_UPDATE 0x2000 +#define LABEL_END 0x2300 + +#define MAX_STRING_SIZE 40 + +#endif // BMC_CONFIG_DXE_H_ diff --git a/Silicon/Ampere/AmpereSiliconPkg/Include/Guid/BmcConfigHii.h b/= Silicon/Ampere/AmpereSiliconPkg/Include/Guid/BmcConfigHii.h new file mode 100644 index 000000000000..4466fc457c0b --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Include/Guid/BmcConfigHii.h @@ -0,0 +1,19 @@ +/** @file + + Copyright (c) 2024, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef BMC_CONFIG_HII_H_ +#define BMC_CONFIG_HII_H_ + +#define BMC_CONFIG_FORMSET_GUID \ + { \ + 0xC4D6ED50, 0x769D, 0x4319, { 0xEB, 0xB7, 0xCC, 0xDD, 0xC8, 0x9D, 0x3D= , 0x2D } \ + } + +extern EFI_GUID gBmcConfigFormSetGuid; + +#endif /* BMC_CONFIG_HII_H_ */ diff --git a/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfig= Vfr.vfr b/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigVfr= .vfr new file mode 100644 index 000000000000..dca4d598fc3a --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigVfr.vfr @@ -0,0 +1,42 @@ +/** @file + + Copyright (c) 2024, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include "BmcConfigDxe.h" + +formset + guid =3D BMC_CONFIG_FORMSET_GUID, + title =3D STRING_TOKEN(STR_BMC_CONFIG_FORM), + help =3D STRING_TOKEN(STR_BMC_CONFIG_HELP), + classguid =3D gPlatformManagerFormsetGuid, + + form + formid =3D MAIN_FORM_ID, + title =3D STRING_TOKEN(STR_BMC_CONFIG_FORM); + + text + help =3D STRING_TOKEN(STR_BMC_FIRMWARE_REV_LABEL), + text =3D STRING_TOKEN(STR_BMC_FIRMWARE_REV_LABEL), + text =3D STRING_TOKEN(STR_BMC_FIRMWARE_REV_VALUE), + flags =3D 0, + key =3D 0; + + text + help =3D STRING_TOKEN(STR_BMC_IPMI_VER_LABEL), + text =3D STRING_TOKEN(STR_BMC_IPMI_VER_LABEL), + text =3D STRING_TOKEN(STR_BMC_IPMI_VER_VALUE), + flags =3D 0, + key =3D 0; + + label LABEL_UPDATE; + // dynamic content here + label LABEL_END; + + endform; +endformset; diff --git a/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfig= Dxe.c b/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.c new file mode 100644 index 000000000000..c2453ef83bea --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.c @@ -0,0 +1,326 @@ +/** @file + BMC Configuration screen + + Copyright (c) 2024, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "BmcConfigDxe.h" + +// +// HII Handle for BMC Configuration package +// +EFI_HII_HANDLE mHiiHandle; + +/** + Get BMC LAN Information of specific channel. + + @param[in] BmcChannel BMC Channel to retrieve LAN informa= tion. + @param[out] BmcIpAddress Pointer to buffer to receive BMC IP= v4 address. + @param[out] BmcSubnetMask Pointer to buffer to receive BMC su= bnet mask. + + @retval EFI_SUCCESS The command byte stream was success= fully submit to the device + and a response was successfully rec= eived. + @retval EFI_INVALID_PARAMETER BmcIpAddress or BmcSubnetMask is NU= LL. + @retval other Failed to get BMC LAN info. +**/ +EFI_STATUS +EFIAPI +IpmiGetBmcLanInfo ( + IN UINT8 BmcChannel, + OUT IPMI_LAN_IP_ADDRESS *BmcIpAddress, + OUT IPMI_LAN_SUBNET_MASK *BmcSubnetMask + ) +{ + EFI_STATUS Status; + IPMI_GET_CHANNEL_INFO_REQUEST GetChannelInfoRequest; + IPMI_GET_CHANNEL_INFO_RESPONSE GetChannelInfoResponse; + IPMI_GET_LAN_CONFIGURATION_PARAMETERS_REQUEST GetConfigurationParamete= rsRequest; + IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE *GetConfigurationParamet= ersResponse; + UINT32 ResponseSize; + + if ((BmcIpAddress =3D=3D NULL) || (BmcSubnetMask =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + // + // Get Channel Information + // + ZeroMem (&GetChannelInfoRequest, sizeof (GetChannelInfoRequest)); + GetChannelInfoRequest.ChannelNumber.Bits.ChannelNo =3D BmcChannel; + ResponseSize =3D sizeof (GetChanne= lInfoResponse); + + Status =3D IpmiGetChannelInfo (&GetChannelInfoRequest, &GetChannelInfoRe= sponse, &ResponseSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get BMC channel info\n", __func__)= ); + return Status; + } + + // + // Check for LAN interface + // + if ( EFI_ERROR (Status) + || (GetChannelInfoResponse.CompletionCode !=3D IPMI_COMP_CODE_NORMAL) + || (GetChannelInfoResponse.MediumType.Bits.ChannelMediumType !=3D IPM= I_CHANNEL_MEDIA_TYPE_802_3_LAN)) + { + return EFI_NOT_FOUND; + } + + GetConfigurationParametersResponse =3D AllocateZeroPool ( + sizeof (*GetConfigurationParamete= rsResponse) + + sizeof (IPMI_LAN_IP_ADDRESS) + ); + if (GetConfigurationParametersResponse =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + // + // Get LAN IP Address + // + ZeroMem (&GetConfigurationParametersRequest, sizeof (GetConfigurationPar= ametersRequest)); + GetConfigurationParametersRequest.ChannelNumber.Uint8 =3D BmcChannel; + GetConfigurationParametersRequest.ParameterSelector =3D IpmiLanIpAddre= ss; + GetConfigurationParametersRequest.SetSelector =3D 0; + GetConfigurationParametersRequest.BlockSelector =3D 0; + + ResponseSize =3D sizeof (*GetConfigurationParametersResponse) + sizeof (= IPMI_LAN_IP_ADDRESS); + + Status =3D IpmiGetLanConfigurationParameters (&GetConfigurationParameter= sRequest, GetConfigurationParametersResponse, &ResponseSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get the LAN configuration paramete= r\n", __func__)); + goto Exit; + } + + if (GetChannelInfoResponse.CompletionCode !=3D IPMI_COMP_CODE_NORMAL) { + Status =3D EFI_NOT_FOUND; + goto Exit; + } + + CopyMem ( + BmcIpAddress->IpAddress, + GetConfigurationParametersResponse->ParameterData, + sizeof (IPMI_LAN_IP_ADDRESS) + ); + + // + // Get Subnet Mask + // + ZeroMem (&GetConfigurationParametersRequest, sizeof (GetConfigurationPar= ametersRequest)); + GetConfigurationParametersRequest.ChannelNumber.Uint8 =3D BmcChannel; + GetConfigurationParametersRequest.ParameterSelector =3D IpmiLanSubnetM= ask; + GetConfigurationParametersRequest.SetSelector =3D 0; + GetConfigurationParametersRequest.BlockSelector =3D 0; + + ResponseSize =3D sizeof (*GetConfigurationParametersResponse) + sizeof (= IPMI_LAN_SUBNET_MASK); + + Status =3D IpmiGetLanConfigurationParameters (&GetConfigurationParameter= sRequest, GetConfigurationParametersResponse, &ResponseSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to get the LAN configuration paramete= r\n", __func__)); + goto Exit; + } + + if (GetChannelInfoResponse.CompletionCode !=3D IPMI_COMP_CODE_NORMAL) { + Status =3D EFI_NOT_FOUND; + goto Exit; + } + + CopyMem ( + BmcSubnetMask->IpAddress, + GetConfigurationParametersResponse->ParameterData, + sizeof (IPMI_LAN_SUBNET_MASK) + ); + +Exit: + FreePool (GetConfigurationParametersResponse); + return Status; +} + +/** + This function updates the BMC information. + + @param[in] VOID + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval Other Some error occurs when executing this entry po= int. + +**/ +EFI_STATUS +UpdateBmcConfigForm ( + VOID + ) +{ + EFI_IFR_GUID_LABEL *EndLabel; + EFI_IFR_GUID_LABEL *StartLabel; + EFI_STATUS Status; + IPMI_GET_DEVICE_ID_RESPONSE DeviceId; + IPMI_LAN_IP_ADDRESS BmcIpAddress; + IPMI_LAN_SUBNET_MASK BmcSubnetMask; + UINT16 StrBuf[MAX_STRING_SIZE]; + UINT8 BmcChannel; + VOID *EndOpCodeHandle; + VOID *StartOpCodeHandle; + + Status =3D IpmiGetDeviceId (&DeviceId); + if ( !EFI_ERROR (Status) + && (DeviceId.CompletionCode =3D=3D IPMI_COMP_CODE_NORMAL)) + { + // + // Firmware Revision + // + UnicodeSPrint ( + StrBuf, + sizeof (StrBuf), + L"%d.%02d", + DeviceId.FirmwareRev1.Bits.MajorFirmwareRev, + BcdToDecimal8 (DeviceId.MinorFirmwareRev) + ); + HiiSetString (mHiiHandle, STRING_TOKEN (STR_BMC_FIRMWARE_REV_VALUE), S= trBuf, NULL); + + // + // IPMI Version + // + UnicodeSPrint ( + StrBuf, + sizeof (StrBuf), + L"%d.%d", + DeviceId.SpecificationVersion & 0x0F, + (DeviceId.SpecificationVersion >> 4) & 0x0F + ); + HiiSetString (mHiiHandle, STRING_TOKEN (STR_BMC_IPMI_VER_VALUE), StrBu= f, NULL); + } + + // + // Initialize the container for dynamic opcodes + // + StartOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (StartOpCodeHandle !=3D NULL); + + EndOpCodeHandle =3D HiiAllocateOpCodeHandle (); + ASSERT (EndOpCodeHandle !=3D NULL); + + // + // Create Hii Extend Label OpCode as the start opcode + // + StartLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + StartOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + StartLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + StartLabel->Number =3D LABEL_UPDATE; + + // + // Create Hii Extend Label OpCode as the end opcode + // + EndLabel =3D (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode ( + EndOpCodeHandle, + &gEfiIfrTianoGuid, + NULL, + sizeof (EFI_IFR_GUID_LABEL) + ); + EndLabel->ExtendOpCode =3D EFI_IFR_EXTEND_OP_LABEL; + EndLabel->Number =3D LABEL_END; + + for (BmcChannel =3D IPMI_CHANNEL_NUMBER_IMPLEMENTATION_SPECIFIC_1; BmcCh= annel < IPMI_CHANNEL_NUMBER_IMPLEMENTATION_SPECIFIC_11; BmcChannel++) { + ZeroMem (&BmcIpAddress, sizeof (BmcIpAddress)); + ZeroMem (&BmcSubnetMask, sizeof (BmcSubnetMask)); + Status =3D IpmiGetBmcLanInfo (BmcChannel, &BmcIpAddress, &BmcSubnetMas= k); + if ( EFI_ERROR (Status) || (BmcIpAddress.IpAddress[0] =3D=3D 0)) { + continue; + } + + UnicodeSPrint ( + StrBuf, + sizeof (StrBuf), + L"%d.%d.%d.%d", + BmcIpAddress.IpAddress[0], + BmcIpAddress.IpAddress[1], + BmcIpAddress.IpAddress[2], + BmcIpAddress.IpAddress[3] + ); + + HiiCreateTextOpCode ( + StartOpCodeHandle, + STRING_TOKEN (STR_BMC_IP_ADDRESS_LABEL), + STRING_TOKEN (STR_BMC_IP_ADDRESS_LABEL), + HiiSetString (mHiiHandle, 0, StrBuf, NULL) + ); + + HiiUpdateForm ( + mHiiHandle, // HII handle + &gBmcConfigFormSetGuid, // Formset GUID + MAIN_FORM_ID, // Form ID + StartOpCodeHandle, // Label for where to insert opcodes + EndOpCodeHandle // Insert data + ); + + break; + } + + return Status; +} + +/** + The user Entry Point for the BMC Configuration driver. + + @param[in] ImageHandle The firmware allocated handle for the EFI imag= e. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval Other Some error occurs when executing this entry po= int. + +**/ +EFI_STATUS +EFIAPI +BmcConfigEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE DriverHandle; + + Status =3D EFI_SUCCESS; + DriverHandle =3D NULL; + + // + // Publish our HII data + // + mHiiHandle =3D HiiAddPackages ( + &gBmcConfigFormSetGuid, + DriverHandle, + BmcConfigDxeStrings, + BmcConfigVfrBin, + NULL + ); + if (mHiiHandle =3D=3D NULL) { + ASSERT (mHiiHandle !=3D NULL); + return EFI_OUT_OF_RESOURCES; + } + + Status =3D UpdateBmcConfigForm (); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a Failed to update the BMC Configuration screen= \n", __func__)); + } + + return Status; +} diff --git a/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfig= Dxe.uni b/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe= .uni new file mode 100644 index 000000000000..2d4b3c620eb9 --- /dev/null +++ b/Silicon/Ampere/AmpereSiliconPkg/Drivers/BmcConfigDxe/BmcConfigDxe.uni @@ -0,0 +1,18 @@ +// +// Copyright (c) 2024, Ampere Computing LLC. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// + +#langdef en-US "English" // English + +#string STR_BMC_CONFIG_FORM #language en-US "BMC Configurat= ion" +#string STR_BMC_CONFIG_HELP #language en-US "BMC Configurat= ion" + +#string STR_BMC_FIRMWARE_REV_LABEL #language en-US "BMC Firmware = Revision" +#string STR_BMC_FIRMWARE_REV_VALUE #language en-US "Unknown" + +#string STR_BMC_IPMI_VER_LABEL #language en-US "IPMI Version" +#string STR_BMC_IPMI_VER_VALUE #language en-US "Unknown" + +#string STR_BMC_IP_ADDRESS_LABEL #language en-US "LAN IP Addres= s" --=20 2.25.1 -=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 (#120333): https://edk2.groups.io/g/devel/message/120333 Mute This Topic: https://groups.io/mt/107889121/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-