From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web09.8536.1657628527361118838 for ; Tue, 12 Jul 2022 05:22:07 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=ATP4rMyk; 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.147.86, mailfrom: prvs=0192e24d61=nickle.wang@hpe.com) Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26CCJUsC023650; Tue, 12 Jul 2022 12:22:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pps0720; bh=FHZDoNESPhOXHPunAzX/cxv7VSlbH+A55t4DP+v7c9Y=; b=ATP4rMykGNoll1JfK/oyGWM3ON2tnksa45HPHzoFb/heTTje6VMkuv2Jynp9z8bVrTqW XHG9Ijm2KnGll5w0iQjJlC0W0ZvHLD0J/GCg7du2Wq7wYbhAKPZjIZFfDwNulGCCOBJA /RD1qwFFaE6CJO2Q4kOmwRg5j3ftOx2XU8MiXzuMuAM0spDrM/krZ0jbQnlbUYK2ITZ2 DwgaANskQnmOMkUE87Y1YEueYANMHdWaEx66baRhVTUjhoDcfTZaj6a631FbRTHi3s3A 4n7gphVDp2oQedTceBOE746j0xz6ofjE0SHBoIEj46DSpaJcjk12QkcUfzRrdIxo0MuD nw== Received: from p1lg14878.it.hpe.com (p1lg14878.it.hpe.com [16.230.97.204]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3h98uw80p3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Jul 2022 12:22:05 +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 p1lg14878.it.hpe.com (Postfix) with ESMTPS id 8213F1479F; Tue, 12 Jul 2022 12:22:03 +0000 (UTC) Received: from WAFM3XJD5N.asiapacific.hpqcorp.net (unknown [16.231.227.36]) by p1lg14885.dc01.its.hpecorp.net (Postfix) with ESMTP id 802428052F6; Tue, 12 Jul 2022 12:22:02 +0000 (UTC) From: "Nickle Wang" To: devel@edk2.groups.io Cc: Abner Chang , Yang Atom , Nick Ramirez Subject: [edk2-staging][PATCH 14/15] edk2-staging/RedfishClientPkg: Introduce Computer System feature driver Date: Tue, 12 Jul 2022 20:21:42 +0800 Message-Id: <20220712122143.1827-15-nickle.wang@hpe.com> X-Mailer: git-send-email 2.32.0.windows.2 In-Reply-To: <20220712122143.1827-1-nickle.wang@hpe.com> References: <20220712122143.1827-1-nickle.wang@hpe.com> MIME-Version: 1.0 X-Proofpoint-GUID: 4u4QtxTOWHiAaZqEodGR0Fh0pMXp65Yj X-Proofpoint-ORIG-GUID: 4u4QtxTOWHiAaZqEodGR0Fh0pMXp65Yj 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 mlxscore=0 bulkscore=0 impostorscore=0 mlxlogscore=999 clxscore=1015 malwarescore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 phishscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2206140000 definitions=main-2207120048 Content-Transfer-Encoding: quoted-printable Introduce new feature driver to support Computer System version 1.5.0 schema. Update corresponding FDF and DSC file to enable this feature driver. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Yang Atom Cc: Nick Ramirez --- .../v1_5_0/Common/ComputerSystemCommon.c | 1614 +++++++++++++++++ .../v1_5_0/Common/ComputerSystemCommon.h | 27 + .../v1_5_0/Dxe/ComputerSystemDxe.c | 645 +++++++ .../v1_5_0/Dxe/ComputerSystemDxe.inf | 51 + RedfishClientPkg/RedfishClient.fdf.inc | 2 + .../RedfishClientComponents.dsc.inc | 7 +- RedfishClientPkg/RedfishClientLibs.dsc.inc | 1 + 7 files changed, 2346 insertions(+), 1 deletion(-) create mode 100644 RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/= ComputerSystemCommon.c create mode 100644 RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/= ComputerSystemCommon.h create mode 100644 RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/Com= puterSystemDxe.c create mode 100644 RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/Com= puterSystemDxe.inf diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Compute= rSystemCommon.c b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Co= mputerSystemCommon.c new file mode 100644 index 0000000000..0a9c746f3b --- /dev/null +++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystem= Common.c @@ -0,0 +1,1614 @@ +/** @file=0D + Redfish feature driver implementation - common functions=0D +=0D + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include "ComputerSystemCommon.h"=0D +=0D +CHAR8 ComputerSystemEmptyJson[] =3D "{\"@odata.id\": \"\", \"@odata.type\"= : \"#ComputerSystem.v1_5_0.ComputerSystem\", \"Id\": \"\", \"Name\": \"\", = \"Boot\":{}}";=0D +=0D +REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate =3D NULL;=0D +=0D +/**=0D + Consume resource from given URI.=0D +=0D + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance.=0D + @param[in] Json The JSON to consume.=0D + @param[in] HeaderEtag The Etag string returned in HTTP header= .=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishConsumeResourceCommon (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private,=0D + IN CHAR8 *Json,=0D + IN CHAR8 *HeaderEtag OPTIONAL=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0 *ComputerSystem;=0D + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0_CS *ComputerSystemCs;=0D + EFI_STRING ConfigureLang;=0D +=0D +=0D + if (Private =3D=3D NULL || IS_EMPTY_STRING (Json)) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + ComputerSystem =3D NULL;=0D + ComputerSystemCs =3D NULL;=0D + ConfigureLang =3D NULL;=0D +=0D + Status =3D Private->JsonStructProtocol->ToStructure (=0D + Private->JsonStructProtocol,=0D + NULL,=0D + Json,=0D + (EFI_REST_JSON_STRUCTURE_HEADER = **)&ComputerSystem=0D + );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __FUNCTION__, S= tatus));=0D + return Status;=0D + }=0D +=0D + ComputerSystemCs =3D ComputerSystem->ComputerSystem;=0D +=0D + //=0D + // Check ETAG to see if we need to consume it=0D + //=0D + if (CheckEtag (Private->Uri, HeaderEtag, NULL)) {=0D + //=0D + // No change=0D + //=0D + DEBUG ((DEBUG_INFO, "%a, ETAG: %s has no change, ignore consume action= \n", __FUNCTION__, Private->Uri));=0D + Status =3D EFI_ALREADY_STARTED;=0D + goto ON_RELEASE;=0D + }=0D +=0D + //=0D + // Handle ASSETTAG=0D + //=0D + if (ComputerSystemCs->AssetTag !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Asset= Tag");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->AssetTag);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // BIOS will be handled by feature driver.=0D + //=0D +=0D + //=0D + // Handle BIOSVERSION=0D + //=0D + if (ComputerSystemCs->BiosVersion !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "BiosV= ersion");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->BiosVersion);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle BOOT=0D + //=0D + if (ComputerSystemCs->Boot =3D=3D NULL) {=0D + ComputerSystemCs->Boot =3D AllocateZeroPool (sizeof (RedfishComputerSy= stem_V1_5_0_Boot_CS));=0D + ASSERT (ComputerSystemCs->Boot !=3D NULL);=0D + }=0D +=0D + //=0D + // Handle BOOT->BOOTNEXT=0D + //=0D + if (ComputerSystemCs->Boot->BootNext !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootNext");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootNext);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle BOOT->BOOTORDER=0D + //=0D + if (ComputerSystemCs->Boot->BootOrder !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootOrder");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringArrayType (RESOURCE_SCHEMA, RES= OURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootOrder);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle BOOT->BOOTSOURCEOVERRIDEENABLED=0D + //=0D + if (ComputerSystemCs->Boot->BootSourceOverrideEnabled !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootSourceOverrideEnabled");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideE= nabled);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle BOOT->BOOTSOURCEOVERRIDEMODE=0D + //=0D + if (ComputerSystemCs->Boot->BootSourceOverrideMode !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootSourceOverrideMode");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideM= ode);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle BOOT->BOOTSOURCEOVERRIDETARGET=0D + //=0D + if (ComputerSystemCs->Boot->BootSourceOverrideTarget !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootSourceOverrideTarget");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideT= arget);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle BOOT->UEFITARGETBOOTSOURCEOVERRIDE=0D + //=0D + if (ComputerSystemCs->Boot->UefiTargetBootSourceOverride !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= UefiTargetBootSourceOverride");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->UefiTargetBootSourc= eOverride);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // ETHERNETINTERFACES will be handled by collection driver.=0D + //=0D +=0D + //=0D + // Handle HOSTNAME=0D + //=0D + if (ComputerSystemCs->HostName !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "HostN= ame");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->HostName);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle HOSTWATCHDOGTIMER=0D + //=0D + if (ComputerSystemCs->HostWatchdogTimer =3D=3D NULL) {=0D + ComputerSystemCs->HostWatchdogTimer =3D AllocateZeroPool (sizeof (Redf= ishComputerSystem_V1_5_0_WatchdogTimer_CS));=0D + ASSERT (ComputerSystemCs->HostWatchdogTimer !=3D NULL);=0D + }=0D +=0D + //=0D + // Handle HOSTWATCHDOGTIMER->FUNCTIONENABLED=0D + //=0D + if (ComputerSystemCs->HostWatchdogTimer->FunctionEnabled !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "HostW= atchdogTimer/FunctionEnabled");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsBooleanType (RESOURCE_SCHEMA, RESOURC= E_SCHEMA_VERSION, ConfigureLang, (BOOLEAN)*ComputerSystemCs->HostWatchdogTi= mer->FunctionEnabled);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle HOSTWATCHDOGTIMER->TIMEOUTACTION=0D + //=0D + if (ComputerSystemCs->HostWatchdogTimer->TimeoutAction !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "HostW= atchdogTimer/TimeoutAction");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->HostWatchdogTimer->Timeou= tAction);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle HOSTWATCHDOGTIMER->WARNINGACTION=0D + //=0D + if (ComputerSystemCs->HostWatchdogTimer->WarningAction !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "HostW= atchdogTimer/WarningAction");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->HostWatchdogTimer->Warnin= gAction);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle HOSTEDSERVICES=0D + //=0D + if (ComputerSystemCs->HostedServices =3D=3D NULL) {=0D + ComputerSystemCs->HostedServices =3D AllocateZeroPool (sizeof (Redfish= ComputerSystem_V1_5_0_HostedServices_CS));=0D + ASSERT (ComputerSystemCs->HostedServices !=3D NULL);=0D + }=0D +=0D + //=0D + // Handle HOSTINGROLES=0D + //=0D +//=0D +// ****** Warning ******=0D +// Unsupported array type:=0D +//=0D +=0D + //=0D + // Handle INDICATORLED=0D + //=0D + if (ComputerSystemCs->IndicatorLED !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Indic= atorLED");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->IndicatorLED);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // LOGSERVICES will be handled by collection driver.=0D + //=0D +=0D + //=0D + // Handle MANUFACTURER=0D + //=0D + if (ComputerSystemCs->Manufacturer !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Manuf= acturer");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Manufacturer);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // MEMORY will be handled by collection driver.=0D + //=0D +=0D + //=0D + // Handle MEMORYSUMMARY=0D + //=0D + if (ComputerSystemCs->MemorySummary =3D=3D NULL) {=0D + ComputerSystemCs->MemorySummary =3D AllocateZeroPool (sizeof (RedfishC= omputerSystem_V1_5_0_MemorySummary_CS));=0D + ASSERT (ComputerSystemCs->MemorySummary !=3D NULL);=0D + }=0D +=0D + //=0D + // Handle MEMORYSUMMARY->MEMORYMIRRORING=0D + //=0D + if (ComputerSystemCs->MemorySummary->MemoryMirroring !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Memor= ySummary/MemoryMirroring");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->MemorySummary->MemoryMirr= oring);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle MEMORYSUMMARY->TOTALSYSTEMMEMORYGIB=0D + //=0D + if (ComputerSystemCs->MemorySummary->TotalSystemMemoryGiB !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Memor= ySummary/TotalSystemMemoryGiB");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURC= E_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->MemorySummary->T= otalSystemMemoryGiB);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle MEMORYSUMMARY->TOTALSYSTEMPERSISTENTMEMORYGIB=0D + //=0D + if (ComputerSystemCs->MemorySummary->TotalSystemPersistentMemoryGiB !=3D= NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Memor= ySummary/TotalSystemPersistentMemoryGiB");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURC= E_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->MemorySummary->T= otalSystemPersistentMemoryGiB);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle MODEL=0D + //=0D + if (ComputerSystemCs->Model !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Model= ");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Model);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // NETWORKINTERFACES will be handled by collection driver.=0D + //=0D +=0D + //=0D + // Handle PCIEDEVICES=0D + //=0D +//=0D +// ****** Warning ******=0D +// Unsupported array type:=0D +//=0D +=0D + //=0D + // Handle PCIEFUNCTIONS=0D + //=0D +//=0D +// ****** Warning ******=0D +// Unsupported array type:=0D +//=0D +=0D + //=0D + // Handle PARTNUMBER=0D + //=0D + if (ComputerSystemCs->PartNumber !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "PartN= umber");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->PartNumber);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle POWERSTATE=0D + //=0D + if (ComputerSystemCs->PowerState !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Power= State");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->PowerState);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle PROCESSORSUMMARY=0D + //=0D + if (ComputerSystemCs->ProcessorSummary =3D=3D NULL) {=0D + ComputerSystemCs->ProcessorSummary =3D AllocateZeroPool (sizeof (Redfi= shComputerSystem_V1_5_0_ProcessorSummary_CS));=0D + ASSERT (ComputerSystemCs->ProcessorSummary !=3D NULL);=0D + }=0D +=0D + //=0D + // Handle PROCESSORSUMMARY->COUNT=0D + //=0D + if (ComputerSystemCs->ProcessorSummary->Count !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Proce= ssorSummary/Count");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURC= E_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->ProcessorSummary= ->Count);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle PROCESSORSUMMARY->LOGICALPROCESSORCOUNT=0D + //=0D + if (ComputerSystemCs->ProcessorSummary->LogicalProcessorCount !=3D NULL)= {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Proce= ssorSummary/LogicalProcessorCount");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURC= E_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->ProcessorSummary= ->LogicalProcessorCount);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle PROCESSORSUMMARY->MODEL=0D + //=0D + if (ComputerSystemCs->ProcessorSummary->Model !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Proce= ssorSummary/Model");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->ProcessorSummary->Model);= =0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // PROCESSORS will be handled by collection driver.=0D + //=0D +=0D + //=0D + // Handle REDUNDANCY=0D + //=0D +//=0D +// ****** Warning ******=0D +// Unsupported array type:=0D +//=0D +=0D + //=0D + // Handle SKU=0D + //=0D + if (ComputerSystemCs->SKU !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "SKU")= ;=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SKU);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // SECUREBOOT will be handled by feature driver.=0D + //=0D +=0D + //=0D + // Handle SERIALNUMBER=0D + //=0D + if (ComputerSystemCs->SerialNumber !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Seria= lNumber");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SerialNumber);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // SIMPLESTORAGE will be handled by collection driver.=0D + //=0D +=0D + //=0D + // STORAGE will be handled by collection driver.=0D + //=0D +=0D + //=0D + // Handle SUBMODEL=0D + //=0D + if (ComputerSystemCs->SubModel !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "SubMo= del");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SubModel);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle SYSTEMTYPE=0D + //=0D + if (ComputerSystemCs->SystemType !=3D NULL) {=0D + //=0D + // Find corresponding configure language for collection resource.=0D + //=0D + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Syste= mType");=0D + if (ConfigureLang !=3D NULL) {=0D + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SystemType);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D +=0D + FreePool (ConfigureLang);=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri));=0D + }=0D + }=0D +=0D + //=0D + // Handle TRUSTEDMODULES=0D + //=0D +//=0D +// ****** Warning ******=0D +// Unsupported array type:=0D +//=0D +=0D +=0D +ON_RELEASE:=0D +=0D + //=0D + // Release resource.=0D + //=0D + Private->JsonStructProtocol->DestoryStructure (=0D + Private->JsonStructProtocol,=0D + (EFI_REST_JSON_STRUCTURE_HEADER *)Compute= rSystem=0D + );=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +EFI_STATUS=0D +ProvisioningComputerSystemProperties (=0D + IN EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol,=0D + IN CHAR8 *InputJson,=0D + IN CHAR8 *ResourceId, OPTIONAL=0D + IN EFI_STRING ConfigureLang,=0D + IN BOOLEAN ProvisionMode,=0D + OUT CHAR8 **ResultJson=0D + )=0D +{=0D + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0 *ComputerSystem;=0D + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0_CS *ComputerSystemCs;=0D + EFI_STATUS Status;=0D + BOOLEAN PropertyChanged;=0D + CHAR8 *AsciiStringValue;=0D + CHAR8 **AsciiStringArrayValue;=0D + UINTN ArraySize;=0D + BOOLEAN *BooleanValue;=0D + INT32 *IntegerValue;=0D + INT64 *NumericValue;=0D +=0D +=0D +=0D + if (JsonStructProtocol =3D=3D NULL || ResultJson =3D=3D NULL || IS_EMPTY= _STRING (InputJson) || IS_EMPTY_STRING (ConfigureLang)) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s with: %s\n", __FUNCTIO= N__, ConfigureLang, (ProvisionMode ? L"Provision resource" : L"Update resou= rce")));=0D +=0D + *ResultJson =3D NULL;=0D + PropertyChanged =3D FALSE;=0D +=0D + ComputerSystem =3D NULL;=0D + Status =3D JsonStructProtocol->ToStructure (=0D + JsonStructProtocol,=0D + NULL,=0D + InputJson,=0D + (EFI_REST_JSON_STRUCTURE_HEADER **)&Compu= terSystem=0D + );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, ToStructure failure: %r\n", __FUNCTION__, St= atus));=0D + return Status;=0D + }=0D +=0D + ComputerSystemCs =3D ComputerSystem->ComputerSystem;=0D +=0D + //=0D + // ID=0D + //=0D + if (ComputerSystemCs->Id =3D=3D NULL && !IS_EMPTY_STRING (ResourceId)) {= =0D + ComputerSystemCs->Id =3D AllocateCopyPool (AsciiStrSize (ResourceId), = ResourceId);=0D + }=0D +=0D + //=0D + // Handle ASSETTAG=0D + //=0D + if (PropertyChecker (ComputerSystemCs->AssetTag, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"AssetTag", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->AssetTag, AsciiS= tringValue) !=3D 0) {=0D + ComputerSystemCs->AssetTag =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle BIOSVERSION=0D + //=0D + if (PropertyChecker (ComputerSystemCs->BiosVersion, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"BiosVersion", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->BiosVersion, Asc= iiStringValue) !=3D 0) {=0D + ComputerSystemCs->BiosVersion =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle BOOT=0D + //=0D + if (ComputerSystemCs->Boot !=3D NULL) {=0D + //=0D + // Handle BOOT->BOOTNEXT=0D + //=0D + if (PropertyChecker (ComputerSystemCs->Boot->BootNext, ProvisionMode))= {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootNext", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootNext= , AsciiStringValue) !=3D 0) {=0D + ComputerSystemCs->Boot->BootNext =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle BOOT->BOOTORDER=0D + //=0D + if (PropertyChecker (ComputerSystemCs->Boot->BootOrder, ProvisionMode)= ) {=0D + AsciiStringArrayValue =3D GetPropertyStringArrayValue (RESOURCE_SCHE= MA, RESOURCE_SCHEMA_VERSION, L"Boot/BootOrder", ConfigureLang, &ArraySize);= =0D + if (AsciiStringArrayValue !=3D NULL) {=0D + if (ProvisionMode || !CompareRedfishStringArrayValues (ComputerSys= temCs->Boot->BootOrder, AsciiStringArrayValue, ArraySize)) {=0D + AddRedfishCharArray (&ComputerSystemCs->Boot->BootOrder, AsciiSt= ringArrayValue, ArraySize);=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle BOOT->BOOTSOURCEOVERRIDEENABLED=0D + //=0D + if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideEnabled= , ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideEnabled", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootSour= ceOverrideEnabled, AsciiStringValue) !=3D 0) {=0D + ComputerSystemCs->Boot->BootSourceOverrideEnabled =3D AsciiStrin= gValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle BOOT->BOOTSOURCEOVERRIDEMODE=0D + //=0D + if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideMode, P= rovisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideMode", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootSour= ceOverrideMode, AsciiStringValue) !=3D 0) {=0D + ComputerSystemCs->Boot->BootSourceOverrideMode =3D AsciiStringVa= lue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle BOOT->BOOTSOURCEOVERRIDETARGET=0D + //=0D + if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideTarget,= ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideTarget", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootSour= ceOverrideTarget, AsciiStringValue) !=3D 0) {=0D + ComputerSystemCs->Boot->BootSourceOverrideTarget =3D AsciiString= Value;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle BOOT->UEFITARGETBOOTSOURCEOVERRIDE=0D + //=0D + if (PropertyChecker (ComputerSystemCs->Boot->UefiTargetBootSourceOverr= ide, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/UefiTargetBootSourceOverride", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->UefiTarg= etBootSourceOverride, AsciiStringValue) !=3D 0) {=0D + ComputerSystemCs->Boot->UefiTargetBootSourceOverride =3D AsciiSt= ringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + }=0D +=0D + //=0D + // Handle HOSTNAME=0D + //=0D + if (PropertyChecker (ComputerSystemCs->HostName, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"HostName", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->HostName, AsciiS= tringValue) !=3D 0) {=0D + ComputerSystemCs->HostName =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle HOSTWATCHDOGTIMER=0D + //=0D + if (ComputerSystemCs->HostWatchdogTimer !=3D NULL) {=0D + //=0D + // Handle HOSTWATCHDOGTIMER->FUNCTIONENABLED=0D + //=0D + if (PropertyChecker (ComputerSystemCs->HostWatchdogTimer->FunctionEnab= led, ProvisionMode)) {=0D + BooleanValue =3D GetPropertyBooleanValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"HostWatchdogTimer/FunctionEnabled", ConfigureLang);=0D + if (BooleanValue !=3D NULL) {=0D + if (ProvisionMode || *ComputerSystemCs->HostWatchdogTimer->Functio= nEnabled !=3D *BooleanValue) {=0D + IntegerValue =3D AllocatePool (sizeof (*IntegerValue));=0D + if (IntegerValue !=3D NULL) {=0D + *IntegerValue =3D (BooleanValue ? 0x01 : 0x00);=0D + ComputerSystemCs->HostWatchdogTimer->FunctionEnabled =3D Integ= erValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + }=0D + //=0D + // Handle HOSTWATCHDOGTIMER->TIMEOUTACTION=0D + //=0D + if (PropertyChecker (ComputerSystemCs->HostWatchdogTimer->TimeoutActio= n, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"HostWatchdogTimer/TimeoutAction", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->HostWatchdogTi= mer->TimeoutAction, AsciiStringValue) !=3D 0) {=0D + ComputerSystemCs->HostWatchdogTimer->TimeoutAction =3D AsciiStri= ngValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle HOSTWATCHDOGTIMER->WARNINGACTION=0D + //=0D + if (PropertyChecker (ComputerSystemCs->HostWatchdogTimer->WarningActio= n, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"HostWatchdogTimer/WarningAction", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->HostWatchdogTi= mer->WarningAction, AsciiStringValue) !=3D 0) {=0D + ComputerSystemCs->HostWatchdogTimer->WarningAction =3D AsciiStri= ngValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + }=0D +=0D + //=0D + // Handle HOSTEDSERVICES=0D + //=0D + if (ComputerSystemCs->HostedServices !=3D NULL) {=0D + }=0D +=0D + //=0D + // Handle HOSTINGROLES=0D + //=0D +//// ****** Warning ******=0D +// Unsupported array type:=0D +//=0D +=0D + //=0D + // Handle INDICATORLED=0D + //=0D + if (PropertyChecker (ComputerSystemCs->IndicatorLED, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"IndicatorLED", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->IndicatorLED, As= ciiStringValue) !=3D 0) {=0D + ComputerSystemCs->IndicatorLED =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle MANUFACTURER=0D + //=0D + if (PropertyChecker (ComputerSystemCs->Manufacturer, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"Manufacturer", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Manufacturer, As= ciiStringValue) !=3D 0) {=0D + ComputerSystemCs->Manufacturer =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle MEMORYSUMMARY=0D + //=0D + if (ComputerSystemCs->MemorySummary !=3D NULL) {=0D + //=0D + // Handle MEMORYSUMMARY->MEMORYMIRRORING=0D + //=0D + if (PropertyChecker (ComputerSystemCs->MemorySummary->MemoryMirroring,= ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"MemorySummary/MemoryMirroring", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->MemorySummary-= >MemoryMirroring, AsciiStringValue) !=3D 0) {=0D + ComputerSystemCs->MemorySummary->MemoryMirroring =3D AsciiString= Value;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle MEMORYSUMMARY->TOTALSYSTEMMEMORYGIB=0D + //=0D + if (PropertyChecker (ComputerSystemCs->MemorySummary->TotalSystemMemor= yGiB, ProvisionMode)) {=0D + NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"MemorySummary/TotalSystemMemoryGiB", ConfigureLang);=0D + if (NumericValue !=3D NULL) {=0D + if (ProvisionMode || *ComputerSystemCs->MemorySummary->TotalSystem= MemoryGiB !=3D *NumericValue) {=0D + ComputerSystemCs->MemorySummary->TotalSystemMemoryGiB =3D Numeri= cValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle MEMORYSUMMARY->TOTALSYSTEMPERSISTENTMEMORYGIB=0D + //=0D + if (PropertyChecker (ComputerSystemCs->MemorySummary->TotalSystemPersi= stentMemoryGiB, ProvisionMode)) {=0D + NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"MemorySummary/TotalSystemPersistentMemoryGiB", ConfigureL= ang);=0D + if (NumericValue !=3D NULL) {=0D + if (ProvisionMode || *ComputerSystemCs->MemorySummary->TotalSystem= PersistentMemoryGiB !=3D *NumericValue) {=0D + ComputerSystemCs->MemorySummary->TotalSystemPersistentMemoryGiB = =3D NumericValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + }=0D +=0D + //=0D + // Handle MODEL=0D + //=0D + if (PropertyChecker (ComputerSystemCs->Model, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"Model", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Model, AsciiStri= ngValue) !=3D 0) {=0D + ComputerSystemCs->Model =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle PCIEDEVICES=0D + //=0D +//// ****** Warning ******=0D +// Unsupported array type:=0D +//=0D +=0D + //=0D + // Handle PCIEFUNCTIONS=0D + //=0D +//// ****** Warning ******=0D +// Unsupported array type:=0D +//=0D +=0D + //=0D + // Handle PARTNUMBER=0D + //=0D + if (PropertyChecker (ComputerSystemCs->PartNumber, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"PartNumber", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->PartNumber, Asci= iStringValue) !=3D 0) {=0D + ComputerSystemCs->PartNumber =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle POWERSTATE=0D + //=0D + if (PropertyChecker (ComputerSystemCs->PowerState, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"PowerState", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->PowerState, Asci= iStringValue) !=3D 0) {=0D + ComputerSystemCs->PowerState =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle PROCESSORSUMMARY=0D + //=0D + if (ComputerSystemCs->ProcessorSummary !=3D NULL) {=0D + //=0D + // Handle PROCESSORSUMMARY->COUNT=0D + //=0D + if (PropertyChecker (ComputerSystemCs->ProcessorSummary->Count, Provis= ionMode)) {=0D + NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"ProcessorSummary/Count", ConfigureLang);=0D + if (NumericValue !=3D NULL) {=0D + if (ProvisionMode || *ComputerSystemCs->ProcessorSummary->Count != =3D *NumericValue) {=0D + ComputerSystemCs->ProcessorSummary->Count =3D NumericValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle PROCESSORSUMMARY->LOGICALPROCESSORCOUNT=0D + //=0D + if (PropertyChecker (ComputerSystemCs->ProcessorSummary->LogicalProces= sorCount, ProvisionMode)) {=0D + NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"ProcessorSummary/LogicalProcessorCount", ConfigureLang);= =0D + if (NumericValue !=3D NULL) {=0D + if (ProvisionMode || *ComputerSystemCs->ProcessorSummary->LogicalP= rocessorCount !=3D *NumericValue) {=0D + ComputerSystemCs->ProcessorSummary->LogicalProcessorCount =3D Nu= mericValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle PROCESSORSUMMARY->MODEL=0D + //=0D + if (PropertyChecker (ComputerSystemCs->ProcessorSummary->Model, Provis= ionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"ProcessorSummary/Model", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->ProcessorSumma= ry->Model, AsciiStringValue) !=3D 0) {=0D + ComputerSystemCs->ProcessorSummary->Model =3D AsciiStringValue;= =0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + }=0D +=0D + //=0D + // Handle REDUNDANCY=0D + //=0D +//// ****** Warning ******=0D +// Unsupported array type:=0D +//=0D +=0D + //=0D + // Handle SKU=0D + //=0D + if (PropertyChecker (ComputerSystemCs->SKU, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SKU", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SKU, AsciiString= Value) !=3D 0) {=0D + ComputerSystemCs->SKU =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle SERIALNUMBER=0D + //=0D + if (PropertyChecker (ComputerSystemCs->SerialNumber, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SerialNumber", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SerialNumber, As= ciiStringValue) !=3D 0) {=0D + ComputerSystemCs->SerialNumber =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle SUBMODEL=0D + //=0D + if (PropertyChecker (ComputerSystemCs->SubModel, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SubModel", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SubModel, AsciiS= tringValue) !=3D 0) {=0D + ComputerSystemCs->SubModel =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle SYSTEMTYPE=0D + //=0D + if (PropertyChecker (ComputerSystemCs->SystemType, ProvisionMode)) {=0D + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SystemType", ConfigureLang);=0D + if (AsciiStringValue !=3D NULL) {=0D + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SystemType, Asci= iStringValue) !=3D 0) {=0D + ComputerSystemCs->SystemType =3D AsciiStringValue;=0D + PropertyChanged =3D TRUE;=0D + }=0D + }=0D + }=0D + //=0D + // Handle TRUSTEDMODULES=0D + //=0D +//// ****** Warning ******=0D +// Unsupported array type:=0D +//=0D +=0D +=0D + //=0D + // Convert C structure back to JSON text.=0D + //=0D + Status =3D JsonStructProtocol->ToJson (=0D + JsonStructProtocol,=0D + (EFI_REST_JSON_STRUCTURE_HEADER *)Compute= rSystem,=0D + ResultJson=0D + );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, ToJson() failed: %r\n", __FUNCTION__, Status= ));=0D + return Status;=0D + }=0D +=0D + //=0D + // Release resource.=0D + //=0D + JsonStructProtocol->DestoryStructure (=0D + JsonStructProtocol,=0D + (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystem=0D + );=0D +=0D + return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);=0D +}=0D +=0D +EFI_STATUS=0D +ProvisioningComputerSystemResource (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private,=0D + IN UINTN Index,=0D + IN EFI_STRING ConfigureLang=0D + )=0D +{=0D + CHAR8 *Json;=0D + EFI_STATUS Status;=0D + EFI_STRING NewResourceLocation;=0D + CHAR8 *EtagStr;=0D + CHAR8 ResourceId[16];=0D +=0D + if (IS_EMPTY_STRING (ConfigureLang) || Private =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + EtagStr =3D NULL;=0D + AsciiSPrint (ResourceId, sizeof (ResourceId), "%d", Index);=0D +=0D + Status =3D ProvisioningComputerSystemProperties (=0D + Private->JsonStructProtocol,=0D + ComputerSystemEmptyJson,=0D + ResourceId,=0D + ConfigureLang,=0D + TRUE,=0D + &Json=0D + );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, provisioning resource for %s failed: %r\n", = __FUNCTION__, ConfigureLang, Status));=0D + return Status;=0D + }=0D +=0D + Status =3D CreatePayloadToPostResource (Private->RedfishService, Private= ->Payload, Json, &NewResourceLocation, &EtagStr);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, post ComputerSystem resource for %s failed: = %r\n", __FUNCTION__, ConfigureLang, Status));=0D + goto RELEASE_RESOURCE;=0D + }=0D +=0D + ASSERT (NewResourceLocation !=3D NULL);=0D +=0D + //=0D + // Keep location of new resource.=0D + //=0D + if (NewResourceLocation !=3D NULL) {=0D + RedfisSetRedfishUri (ConfigureLang, NewResourceLocation);=0D + }=0D +=0D + //=0D + // Handle Etag=0D + //=0D + if (EtagStr !=3D NULL) {=0D + SetEtagWithUri (EtagStr, NewResourceLocation);=0D + FreePool (EtagStr);=0D + }=0D +=0D +RELEASE_RESOURCE:=0D +=0D + if (NewResourceLocation !=3D NULL) {=0D + FreePool (NewResourceLocation);=0D + }=0D +=0D + if (Json !=3D NULL) {=0D + FreePool (Json);=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +EFI_STATUS=0D +ProvisioningComputerSystemResources (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private=0D + )=0D +{=0D + UINTN Index;=0D + EFI_STATUS Status;=0D + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST UnifiedConfigureLangList;=0D +=0D + if (Private =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + Status =3D RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHE= MA, RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &UnifiedConfigureLangLi= st);=0D + if (EFI_ERROR (Status) || UnifiedConfigureLangList.Count =3D=3D 0) {=0D + DEBUG ((DEBUG_ERROR, "%a, No HII question found with configure languag= e: %s: %r\n", __FUNCTION__, REDPATH_ARRAY_PATTERN, Status));=0D + return EFI_NOT_FOUND;=0D + }=0D + //=0D + // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE.= =0D + // This information is sent back to the parent resource (e.g. the collec= tion driver).=0D + //=0D + EdkIIRedfishResourceSetConfigureLang (&UnifiedConfigureLangList);=0D +=0D + for (Index =3D 0; Index < UnifiedConfigureLangList.Count; Index++) {=0D + DEBUG ((DEBUG_INFO, "[%d] create ComputerSystem resource from: %s\n", = UnifiedConfigureLangList.List[Index].Index, UnifiedConfigureLangList.List[I= ndex].ConfigureLang));=0D + ProvisioningComputerSystemResource (Private, UnifiedConfigureLangList.= List[Index].Index, UnifiedConfigureLangList.List[Index].ConfigureLang);=0D + FreePool (UnifiedConfigureLangList.List[Index].ConfigureLang);=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +=0D +EFI_STATUS=0D +ProvisioningComputerSystemExistResource (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EFI_STRING ConfigureLang;=0D + CHAR8 *EtagStr;=0D + CHAR8 *Json;=0D +=0D + if (Private =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + EtagStr =3D NULL;=0D + Json =3D NULL;=0D + ConfigureLang =3D NULL;=0D +=0D + ConfigureLang =3D RedfishGetConfigLanguage (Private->Uri);=0D + if (ConfigureLang =3D=3D NULL) {=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + Status =3D ProvisioningComputerSystemProperties (=0D + Private->JsonStructProtocol,=0D + ComputerSystemEmptyJson,=0D + NULL,=0D + ConfigureLang,=0D + TRUE,=0D + &Json=0D + );=0D + if (EFI_ERROR (Status)) {=0D + if (Status =3D=3D EFI_NOT_FOUND) {=0D + DEBUG ((REDFISH_DEBUG_TRACE, "%a, provisioning existing resource for= %s ignored. Nothing changed\n", __FUNCTION__, ConfigureLang));=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, provisioning existing resource for %s fail= ed: %r\n", __FUNCTION__, ConfigureLang, Status));=0D + }=0D + goto ON_RELEASE;=0D + }=0D +=0D + DEBUG ((REDFISH_DEBUG_TRACE, "%a, provisioning existing resource for %s\= n", __FUNCTION__, ConfigureLang));=0D + //=0D + // PUT back to instance=0D + //=0D + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Privat= e->Payload, Json, &EtagStr);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, patch resource for %s failed: %r\n", __FUNCT= ION__, ConfigureLang, Status));=0D + }=0D +=0D + //=0D + // Handle Etag=0D + //=0D + if (EtagStr !=3D NULL) {=0D + SetEtagWithUri (EtagStr, Private->Uri);=0D + FreePool (EtagStr);=0D + }=0D +=0D +ON_RELEASE:=0D +=0D + if (Json !=3D NULL) {=0D + FreePool (Json);=0D + }=0D +=0D + if (ConfigureLang !=3D NULL) {=0D + FreePool (ConfigureLang);=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Provisioning redfish resource by given URI.=0D +=0D + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance.=0D + @param[in] ResourceExist TRUE if resource exists, PUT method wil= l be used.=0D + FALSE if resource does not exist POST m= ethod is used.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishProvisioningResourceCommon (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private,=0D + IN BOOLEAN ResourceExist=0D + )=0D +{=0D + if (Private =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + return (ResourceExist ? ProvisioningComputerSystemExistResource (Private= ) : ProvisioningComputerSystemResources (Private));=0D +}=0D +=0D +/**=0D + Check resource from given URI.=0D +=0D + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance.=0D + @param[in] Json The JSON to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishCheckResourceCommon (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private,=0D + IN CHAR8 *Json=0D + )=0D +{=0D + UINTN Index;=0D + EFI_STATUS Status;=0D + EFI_STRING *ConfigureLangList;=0D + UINTN Count;=0D + EFI_STRING Property;=0D +=0D + if (Private =3D=3D NULL || IS_EMPTY_STRING (Json)) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + Status =3D RedfishPlatformConfigGetConfigureLang (RESOURCE_SCHEMA, RESOU= RCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigureLangList, &Count);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, BiosConfigToRedfishGetConfigureLangRegex fai= led: %r\n", __FUNCTION__, Status));=0D + return Status;=0D + }=0D +=0D + if (Count =3D=3D 0) {=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + Status =3D EFI_SUCCESS;=0D + for (Index =3D 0; Index < Count; Index++) {=0D +=0D + Property =3D GetPropertyFromConfigureLang (Private->Uri, ConfigureLang= List[Index]);=0D + if (Property =3D=3D NULL) {=0D + continue;=0D + }=0D +=0D + DEBUG ((DEBUG_INFO, "%a, [%d] check attribute for: %s\n", __FUNCTION__= , Index, Property));=0D + if (!MatchPropertyWithJsonContext (Property, Json)) {=0D + DEBUG ((DEBUG_INFO, "%a, property is missing: %s\n", __FUNCTION__, P= roperty));=0D + Status =3D EFI_NOT_FOUND;=0D + }=0D + }=0D +=0D + FreePool (ConfigureLangList);=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Update resource to given URI.=0D +=0D + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance.=0D + @param[in] Json The JSON to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishUpdateResourceCommon (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private,=0D + IN CHAR8 *InputJson=0D + )=0D +{=0D + EFI_STATUS Status;=0D + CHAR8 *Json;=0D + EFI_STRING ConfigureLang;=0D + CHAR8 *EtagStr;=0D +=0D + if (Private =3D=3D NULL || IS_EMPTY_STRING (InputJson)) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + EtagStr =3D NULL;=0D + Json =3D NULL;=0D + ConfigureLang =3D NULL;=0D +=0D + ConfigureLang =3D RedfishGetConfigLanguage (Private->Uri);=0D + if (ConfigureLang =3D=3D NULL) {=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + Status =3D ProvisioningComputerSystemProperties (=0D + Private->JsonStructProtocol,=0D + InputJson,=0D + NULL,=0D + ConfigureLang,=0D + FALSE,=0D + &Json=0D + );=0D + if (EFI_ERROR (Status)) {=0D + if (Status =3D=3D EFI_NOT_FOUND) {=0D + DEBUG ((REDFISH_DEBUG_TRACE, "%a, update resource for %s ignored. No= thing changed\n", __FUNCTION__, ConfigureLang));=0D + } else {=0D + DEBUG ((DEBUG_ERROR, "%a, update resource for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status));=0D + }=0D + goto ON_RELEASE;=0D + }=0D +=0D + DEBUG ((REDFISH_DEBUG_TRACE, "%a, update resource for %s\n", __FUNCTION_= _, ConfigureLang));=0D + //=0D + // PUT back to instance=0D + //=0D + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Privat= e->Payload, Json, &EtagStr);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, patch resource for %s failed: %r\n", __FUNCT= ION__, ConfigureLang, Status));=0D + }=0D +=0D + //=0D + // Handle Etag=0D + //=0D + if (EtagStr !=3D NULL) {=0D + SetEtagWithUri (EtagStr, Private->Uri);=0D + FreePool (EtagStr);=0D + }=0D +=0D +ON_RELEASE:=0D +=0D + if (Json !=3D NULL) {=0D + FreePool (Json);=0D + }=0D +=0D + if (ConfigureLang !=3D NULL) {=0D + FreePool (ConfigureLang);=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Identify resource from given URI.=0D +=0D + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance.=0D + @param[in] Json The JSON to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishIdentifyResourceCommon (=0D + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private,=0D + IN CHAR8 *Json=0D + )=0D +{=0D + BOOLEAN Supported;=0D + EFI_STATUS Status;=0D + EFI_STRING EndOfChar;=0D + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST ConfigLangList;=0D +=0D + Supported =3D RedfishIdentifyResource (Private->Uri, Private->Json);=0D + if (Supported) {=0D + Status =3D RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SC= HEMA, RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, BiosConfigToRedfishGetConfigureLangRegex f= ailed: %r\n", __FUNCTION__, Status));=0D + return Status;=0D + }=0D +=0D + if (ConfigLangList.Count =3D=3D 0) {=0D + return EFI_SUCCESS;=0D + }=0D +=0D + EndOfChar =3D StrStr (ConfigLangList.List[0].ConfigureLang, L"}");=0D + if (EndOfChar =3D=3D NULL) {=0D + ASSERT (FALSE);=0D + return EFI_DEVICE_ERROR;=0D + }=0D +=0D + //EndOfChar =3D StrStr (ConfigLangList.List[0].ConfigureLang, L"}");=0D + Status =3D IsRedpathArray (ConfigLangList.List[0].ConfigureLang, NULL,= &EndOfChar);=0D + if (EFI_ERROR (Status) && Status !=3D EFI_NOT_FOUND) {=0D + ASSERT (FALSE);=0D + return EFI_DEVICE_ERROR;=0D + }=0D + if (Status !=3D EFI_SUCCESS) {=0D + //=0D + // This is not the collection redpath.=0D + //=0D + GetRedpathNodeByIndex (ConfigLangList.List[0].ConfigureLang, 0, &End= OfChar);=0D + }=0D + *(++EndOfChar) =3D '\0';=0D + //=0D + // Keep URI and ConfigLang mapping=0D + //=0D + RedfisSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->Ur= i);=0D + //=0D + // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE= .=0D + // This information is sent back to the parent resource (e.g. the coll= ection driver).=0D + //=0D + EdkIIRedfishResourceSetConfigureLang (&ConfigLangList);=0D + DestroyConfiglanguageList (&ConfigLangList);=0D + return EFI_SUCCESS;=0D + }=0D +=0D + return EFI_UNSUPPORTED;=0D +}=0D diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Compute= rSystemCommon.h b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Co= mputerSystemCommon.h new file mode 100644 index 0000000000..64efc7fd99 --- /dev/null +++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystem= Common.h @@ -0,0 +1,27 @@ +/** @file=0D +=0D + Redfish feature driver implementation - internal header file=0D + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#ifndef EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_=0D +#define EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_=0D +=0D +#include =0D +#include =0D +=0D +//=0D +// Schema information.=0D +//=0D +#define RESOURCE_SCHEMA "ComputerSystem"=0D +#define RESOURCE_SCHEMA_MAJOR "1"=0D +#define RESOURCE_SCHEMA_MINOR "5"=0D +#define RESOURCE_SCHEMA_ERRATA "0"=0D +#define RESOURCE_SCHEMA_VERSION "v1_5_0"=0D +#define REDPATH_ARRAY_PATTERN L"/Systems/\\{.*\\}/"=0D +#define REDPATH_ARRAY_PREFIX L"/Systems/"=0D +#define RESOURCE_SCHEMA_FULL "x-uefi-redfish-ComputerSystem.v1_5_0"=0D +=0D +#endif=0D diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSy= stemDxe.c b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSys= temDxe.c new file mode 100644 index 0000000000..c2a638d7c0 --- /dev/null +++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe= .c @@ -0,0 +1,645 @@ +/** @file=0D + Redfish feature driver implementation - ComputerSystem=0D +=0D + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include "../Common/ComputerSystemCommon.h"=0D +=0D +extern REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate;=0D +=0D +EFI_HANDLE medfishResourceConfigProtocolHandle;=0D +=0D +/**=0D + Provising redfish resource by given URI.=0D +=0D + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance.=0D + @param[in] Uri Target URI to create resource.=0D + @param[in] PostMode TRUE if the resource does not exist, po= st method is used.=0D + FALSE if the resource exist but propert= y is missing, put method is used.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishResourceProvisioningResource (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + IN EFI_STRING Uri,=0D + IN BOOLEAN PostMode=0D + )=0D +{=0D + REDFISH_RESOURCE_COMMON_PRIVATE *Private;=0D + EFI_STATUS Status;=0D + REDFISH_RESPONSE Response;=0D +=0D + if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + DEBUG ((DEBUG_INFO, "%a, provisioning in %s mode\n", __FUNCTION__, (Post= Mode ? L"POST" : L"PATCH")));=0D +=0D + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This);=0D +=0D + if (Private->RedfishService =3D=3D NULL) {=0D + return EFI_NOT_READY;=0D + }=0D +=0D + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTION_= _, Uri));=0D + return Status;=0D + }=0D +=0D + Private->Uri =3D Uri;=0D + Private->Payload =3D Response.Payload;=0D + ASSERT (Private->Payload !=3D NULL);=0D +=0D + Status =3D RedfishProvisioningResourceCommon (Private, !PostMode);=0D +=0D + //=0D + // Release resource=0D + //=0D + if (Private->Payload !=3D NULL) {=0D + RedfishFreeResponse (=0D + Response.StatusCode,=0D + Response.HeaderCount,=0D + Response.Headers,=0D + Response.Payload=0D + );=0D + Private->Payload =3D NULL;=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Consume resource from given URI.=0D +=0D + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance.=0D + @param[in] Uri The target URI to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishResourceConsumeResource (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + IN EFI_STRING Uri=0D + )=0D +{=0D + REDFISH_RESOURCE_COMMON_PRIVATE *Private;=0D + EFI_STATUS Status;=0D + REDFISH_RESPONSE Response;=0D + CHAR8 *Etag;=0D +=0D + if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This);=0D +=0D + if (Private->RedfishService =3D=3D NULL) {=0D + return EFI_NOT_READY;=0D + }=0D +=0D + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTION_= _, Uri));=0D + return Status;=0D + }=0D +=0D + Private->Uri =3D Uri;=0D + Private->Payload =3D Response.Payload;=0D + ASSERT (Private->Payload !=3D NULL);=0D +=0D + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT);=0D + ASSERT (Private->Json !=3D NULL);=0D +=0D + //=0D + // Find etag in HTTP response header=0D + //=0D + Etag =3D NULL;=0D + Status =3D GetEtagAndLocation (&Response, &Etag, NULL);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, failed to get ETag from HTTP header\n", __FU= NCTION__));=0D + }=0D +=0D + Status =3D RedfishConsumeResourceCommon (Private, Private->Json, Etag);= =0D + if (EFI_ERROR (Status)) {=0D + if (Status !=3D EFI_ALREADY_STARTED) {=0D + DEBUG ((DEBUG_ERROR, "%a, failed to consume resource from: %s: %r\n"= , __FUNCTION__, Uri, Status));=0D + }=0D + } else {=0D + //=0D + // Keep etag after consuming pending settings.=0D + //=0D + if (Etag !=3D NULL) {=0D + SetEtagWithUri (Etag, Private->Uri);=0D + }=0D + }=0D +=0D + //=0D + // Release resource=0D + //=0D + if (Private->Payload !=3D NULL) {=0D + RedfishFreeResponse (=0D + Response.StatusCode,=0D + Response.HeaderCount,=0D + Response.Headers,=0D + Response.Payload=0D + );=0D + Private->Payload =3D NULL;=0D + }=0D +=0D + if (Private->Json !=3D NULL) {=0D + FreePool (Private->Json);=0D + Private->Json =3D NULL;=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Get information about this protocol.=0D +=0D + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance.=0D + @param[out] Schema Supported schema.=0D + @param[out] Major Supported major number.=0D + @param[out] Minor Supported minor number.=0D + @param[out] Errata Supported errata number.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishResourceGetInfo (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + OUT REDFISH_SCHEMA_INFO *Info=0D + )=0D +{=0D + REDFISH_RESOURCE_COMMON_PRIVATE *Private;=0D +=0D + if (This =3D=3D NULL || Info =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This);=0D +=0D + AsciiStrCpyS (Info->Schema, REDFISH_SCHEMA_STRING_SIZE, RESOURCE_SCHEMA)= ;=0D + AsciiStrCpyS (Info->Major, REDFISH_SCHEMA_VERSION_SIZE, RESOURCE_SCHEMA_= MAJOR);=0D + AsciiStrCpyS (Info->Minor, REDFISH_SCHEMA_VERSION_SIZE, RESOURCE_SCHEMA_= MINOR);=0D + AsciiStrCpyS (Info->Errata, REDFISH_SCHEMA_VERSION_SIZE, RESOURCE_SCHEMA= _ERRATA);=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Update resource to given URI.=0D +=0D + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance.=0D + @param[in] Uri The target URI to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishResourceUpdate (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + IN EFI_STRING Uri=0D + )=0D +{=0D + REDFISH_RESOURCE_COMMON_PRIVATE *Private;=0D + EFI_STATUS Status;=0D + REDFISH_RESPONSE Response;=0D +=0D + if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This);=0D +=0D + if (Private->RedfishService =3D=3D NULL) {=0D + return EFI_NOT_READY;=0D + }=0D +=0D + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTION_= _, Uri));=0D + return Status;=0D + }=0D +=0D + Private->Uri =3D Uri;=0D + Private->Payload =3D Response.Payload;=0D + ASSERT (Private->Payload !=3D NULL);=0D +=0D + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT);=0D + ASSERT (Private->Json !=3D NULL);=0D +=0D + Status =3D RedfishUpdateResourceCommon (Private, Private->Json);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, failed to update resource from: %s: %r\n", _= _FUNCTION__, Uri, Status));=0D + }=0D +=0D + //=0D + // Release resource=0D + //=0D + if (Private->Payload !=3D NULL) {=0D + RedfishFreeResponse (=0D + Response.StatusCode,=0D + Response.HeaderCount,=0D + Response.Headers,=0D + Response.Payload=0D + );=0D + Private->Payload =3D NULL;=0D + }=0D +=0D + if (Private->Json !=3D NULL) {=0D + FreePool (Private->Json);=0D + Private->Json =3D NULL;=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Check resource on given URI.=0D +=0D + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance.=0D + @param[in] Uri The target URI to consume.=0D +=0D + @retval EFI_SUCCESS Value is returned successfully.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +RedfishResourceCheck (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + IN EFI_STRING Uri=0D + )=0D +{=0D + REDFISH_RESOURCE_COMMON_PRIVATE *Private;=0D + EFI_STATUS Status;=0D + REDFISH_RESPONSE Response;=0D +=0D + if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This);=0D +=0D + if (Private->RedfishService =3D=3D NULL) {=0D + return EFI_NOT_READY;=0D + }=0D +=0D + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTION_= _, Uri));=0D + return Status;=0D + }=0D +=0D + Private->Uri =3D Uri;=0D + Private->Payload =3D Response.Payload;=0D + ASSERT (Private->Payload !=3D NULL);=0D +=0D + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT);=0D + ASSERT (Private->Json !=3D NULL);=0D +=0D + Status =3D RedfishCheckResourceCommon (Private, Private->Json);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, failed to check resource from: %s: %r\n", __= FUNCTION__, Uri, Status));=0D + }=0D +=0D + //=0D + // Release resource=0D + //=0D + if (Private->Payload !=3D NULL) {=0D + RedfishFreeResponse (=0D + Response.StatusCode,=0D + Response.HeaderCount,=0D + Response.Headers,=0D + Response.Payload=0D + );=0D + Private->Payload =3D NULL;=0D + }=0D +=0D + if (Private->Json !=3D NULL) {=0D + FreePool (Private->Json);=0D + Private->Json =3D NULL;=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +/**=0D + Identify resource on given URI.=0D +=0D + @param[in] This Pointer to EDKII_REDFISH_RESOURCE_CONFI= G_PROTOCOL instance.=0D + @param[in] Uri The target URI to consume.=0D +=0D + @retval EFI_SUCCESS This is target resource which we want t= o handle.=0D + @retval EFI_UNSUPPORTED This is not the target resource.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +=0D +EFI_STATUS=0D +RedfishResourceIdentify (=0D + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This,=0D + IN EFI_STRING Uri=0D + )=0D +{=0D + REDFISH_RESOURCE_COMMON_PRIVATE *Private;=0D + EFI_STATUS Status;=0D + REDFISH_RESPONSE Response;=0D +=0D + if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This);=0D +=0D + if (Private->RedfishService =3D=3D NULL) {=0D + return EFI_NOT_READY;=0D + }=0D +=0D + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTION_= _, Uri));=0D + return Status;=0D + }=0D +=0D + Private->Uri =3D Uri;=0D + Private->Payload =3D Response.Payload;=0D + ASSERT (Private->Payload !=3D NULL);=0D +=0D + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT);=0D + ASSERT (Private->Json !=3D NULL);=0D +=0D + Status =3D RedfishIdentifyResourceCommon (Private, Private->Json);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, identify %s failed: %r\n", __FUNCTION__, Uri= , Status));=0D + }=0D + //=0D + // Release resource=0D + //=0D + if (Private->Payload !=3D NULL) {=0D + RedfishFreeResponse (=0D + Response.StatusCode,=0D + Response.HeaderCount,=0D + Response.Headers,=0D + Response.Payload=0D + );=0D + Private->Payload =3D NULL;=0D + }=0D +=0D + if (Private->Json !=3D NULL) {=0D + FreePool (Private->Json);=0D + Private->Json =3D NULL;=0D + }=0D +=0D + return Status;=0D +}=0D +=0D +EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL mRedfishResourceConfig =3D {=0D + RedfishResourceProvisioningResource,=0D + RedfishResourceConsumeResource,=0D + RedfishResourceUpdate,=0D + RedfishResourceCheck,=0D + RedfishResourceIdentify,=0D + RedfishResourceGetInfo=0D +};=0D +=0D +/**=0D + Initialize a Redfish configure handler.=0D +=0D + This function will be called by the Redfish config driver to initialize = each Redfish configure=0D + handler.=0D +=0D + @param[in] This Pointer to EDKII_REDFISH_CONFIG_HA= NDLER_PROTOCOL instance.=0D + @param[in] RedfishConfigServiceInfo Redfish service informaion.=0D +=0D + @retval EFI_SUCCESS The handler has been initialized su= ccessfully.=0D + @retval EFI_DEVICE_ERROR Failed to create or configure the R= EST EX protocol instance.=0D + @retval EFI_ALREADY_STARTED This handler has already been initi= alized.=0D + @retval Other Error happens during the initializa= tion.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RedfishResourceInit (=0D + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This,=0D + IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo=0D + )=0D +{=0D + REDFISH_RESOURCE_COMMON_PRIVATE *Private;=0D +=0D + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL (T= his);=0D +=0D + Private->RedfishService =3D RedfishCreateService (RedfishConfigServiceIn= fo);=0D + if (Private->RedfishService =3D=3D NULL) {=0D + return EFI_DEVICE_ERROR;=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +/**=0D + Stop a Redfish configure handler.=0D +=0D + @param[in] This Pointer to EDKII_REDFISH_CONFIG_HANDLER= _PROTOCOL instance.=0D +=0D + @retval EFI_SUCCESS This handler has been stoped successful= ly.=0D + @retval Others Some error happened.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RedfishResourceStop (=0D + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This=0D + )=0D +{=0D + REDFISH_RESOURCE_COMMON_PRIVATE *Private;=0D +=0D + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL (T= his);=0D +=0D + if (Private->Event !=3D NULL) {=0D + gBS->CloseEvent (Private->Event);=0D + Private->Event =3D NULL;=0D + }=0D +=0D + if (Private->RedfishService !=3D NULL) {=0D + RedfishCleanupService (Private->RedfishService);=0D + Private->RedfishService =3D NULL;=0D + }=0D +=0D + if (Private->Payload !=3D NULL) {=0D + RedfishCleanupPayload (Private->Payload);=0D + Private->Payload =3D NULL;=0D + }=0D +=0D + return EFI_SUCCESS;=0D +}=0D +=0D +EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHandler =3D {=0D + RedfishResourceInit,=0D + RedfishResourceStop=0D +};=0D +=0D +/**=0D + Callback function when gEfiRestJsonStructureProtocolGuid is installed.=0D +=0D + @param[in] Event Event whose notification function is being invoked.= =0D + @param[in] Context Pointer to the notification function's context.=0D +**/=0D +VOID=0D +EFIAPI=0D +EfiRestJasonStructureProtocolIsReady=0D + (=0D + IN EFI_EVENT Event,=0D + IN VOID *Context=0D + )=0D +{=0D + EFI_STATUS Status;=0D +=0D + if (mRedfishResourcePrivate =3D=3D NULL) {=0D + return;=0D + }=0D +=0D + if (mRedfishResourcePrivate->JsonStructProtocol !=3D NULL) {=0D + return;=0D + }=0D +=0D + Status =3D gBS->LocateProtocol (=0D + &gEfiRestJsonStructureProtocolGuid,=0D + NULL,=0D + (VOID **)&mRedfishResourcePrivate->JsonStructProtocol=0D + );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_ERROR, "%a, failed to locate gEfiRestJsonStructureProtoc= olGuid: %r\n", __FUNCTION__, Status));=0D + }=0D +=0D + gBS->CloseEvent (Event);=0D +}=0D +=0D +/**=0D + Unloads an image.=0D +=0D + @param ImageHandle Handle that identifies the image to be unl= oaded.=0D +=0D + @retval EFI_SUCCESS The image has been unloaded.=0D + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RedfishResourceUnload (=0D + IN EFI_HANDLE ImageHandle=0D + )=0D +{=0D + EFI_STATUS Status;=0D + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler;=0D +=0D + if (mRedfishResourcePrivate =3D=3D NULL) {=0D + return EFI_NOT_READY;=0D + }=0D +=0D + ConfigHandler =3D NULL;=0D +=0D + //=0D + // Firstly, find ConfigHandler Protocol interface in this ImageHandle.=0D + //=0D + Status =3D gBS->OpenProtocol (=0D + ImageHandle,=0D + &gEdkIIRedfishConfigHandlerProtocolGuid,=0D + (VOID **) &ConfigHandler,=0D + NULL,=0D + NULL,=0D + EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL=0D + );=0D + if (EFI_ERROR (Status) || ConfigHandler =3D=3D NULL) {=0D + return Status;=0D + }=0D +=0D + ConfigHandler->Stop (ConfigHandler);=0D +=0D + //=0D + // Last, uninstall ConfigHandler Protocol and resource protocol.=0D + //=0D + Status =3D gBS->UninstallMultipleProtocolInterfaces (=0D + ImageHandle,=0D + &gEdkIIRedfishConfigHandlerProtocolGuid,=0D + ConfigHandler,=0D + &gEdkIIRedfishResourceConfigProtocolGuid,=0D + &mRedfishResourcePrivate->RedfishResourceConfig,=0D + NULL=0D + );=0D +=0D + FreePool (mRedfishResourcePrivate);=0D + mRedfishResourcePrivate =3D NULL;=0D +=0D + return Status;=0D +}=0D +=0D +=0D +/**=0D + This is the declaration of an EFI image entry point. This entry point is= =0D + the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers includ= ing=0D + both device drivers and bus drivers. It initialize the global variables = and=0D + publish the driver binding protocol.=0D +=0D + @param[in] ImageHandle The firmware allocated handle for the UEFI= image.=0D + @param[in] SystemTable A pointer to the EFI System Table.=0D +=0D + @retval EFI_SUCCESS The operation completed successfully.=0D + @retval EFI_ACCESS_DENIED EFI_ISCSI_INITIATOR_NAME_PROTOCOL was inst= alled unexpectedly.=0D + @retval Others Other errors as indicated.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +RedfishResourceEntryPoint (=0D + IN EFI_HANDLE ImageHandle,=0D + IN EFI_SYSTEM_TABLE *SystemTable=0D + )=0D +{=0D + EFI_STATUS Status;=0D + VOID *Registration;=0D +=0D + if (mRedfishResourcePrivate !=3D NULL) {=0D + return EFI_ALREADY_STARTED;=0D + }=0D +=0D + medfishResourceConfigProtocolHandle =3D ImageHandle;=0D +=0D + mRedfishResourcePrivate =3D AllocateZeroPool (sizeof (REDFISH_RESOURCE_C= OMMON_PRIVATE));=0D + CopyMem (&mRedfishResourcePrivate->ConfigHandler, &mRedfishConfigHandler= , sizeof (EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL));=0D + CopyMem (&mRedfishResourcePrivate->RedfishResourceConfig, &mRedfishResou= rceConfig, sizeof (EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL));=0D +=0D + //=0D + // Publish config handler protocol and resource protocol.=0D + //=0D + Status =3D gBS->InstallMultipleProtocolInterfaces (=0D + &ImageHandle,=0D + &gEdkIIRedfishConfigHandlerProtocolGuid,=0D + &mRedfishResourcePrivate->ConfigHandler,=0D + &gEdkIIRedfishResourceConfigProtocolGuid,=0D + &mRedfishResourcePrivate->RedfishResourceConfig,=0D + NULL=0D + );=0D +=0D + EfiCreateProtocolNotifyEvent (=0D + &gEfiRestJsonStructureProtocolGuid,=0D + TPL_CALLBACK,=0D + EfiRestJasonStructureProtocolIsReady,=0D + NULL,=0D + &Registration=0D + );=0D +=0D + return Status;=0D +}=0D diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSy= stemDxe.inf b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerS= ystemDxe.inf new file mode 100644 index 0000000000..67412f5f31 --- /dev/null +++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe= .inf @@ -0,0 +1,51 @@ +## @file=0D +#=0D +# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010005=0D + BASE_NAME =3D ComputerSystemDxe=0D + FILE_GUID =3D 584bae05-d78d-4df9-b5e9-3e987a99480a=0D + MODULE_TYPE =3D DXE_DRIVER=0D + VERSION_STRING =3D 1.0=0D + ENTRY_POINT =3D RedfishResourceEntryPoint=0D + UNLOAD_IMAGE =3D RedfishResourceUnload=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + RedfishPkg/RedfishPkg.dec=0D + RedfishClientPkg/RedfishClientPkg.dec=0D +=0D +[Sources]=0D + ../Common/ComputerSystemCommon.h=0D + ../Common/ComputerSystemCommon.c=0D + ComputerSystemDxe.c=0D +=0D +[LibraryClasses]=0D + BaseMemoryLib=0D + DebugLib=0D + EdkIIRedfishResourceConfigLib=0D + RedfishLib=0D + RedfishFeatureUtilityLib=0D + RedfishResourceIdentifyLib=0D + UefiLib=0D + UefiDriverEntryPoint=0D +=0D +=0D +[Protocols]=0D + gEdkIIRedfishConfigHandlerProtocolGuid ## PRODUCED=0D + gEfiRestJsonStructureProtocolGuid ## CONSUMED=0D + gEdkIIRedfishResourceConfigProtocolGuid ## PRODUCED=0D +=0D +[Pcd]=0D + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize=0D + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize=0D +=0D +[Depex]=0D + TRUE=0D diff --git a/RedfishClientPkg/RedfishClient.fdf.inc b/RedfishClientPkg/Redf= ishClient.fdf.inc index 7d5de56591..90240efbf7 100644 --- a/RedfishClientPkg/RedfishClient.fdf.inc +++ b/RedfishClientPkg/RedfishClient.fdf.inc @@ -16,6 +16,7 @@ INF RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf= =0D INF RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.inf=0D INF RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.in= f=0D + INF RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDx= e.inf=0D INF RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystem= CollectionDxe.inf=0D =0D !include RedfishClientPkg/RedfishJsonStructureDxe.fdf.inc=0D @@ -24,5 +25,6 @@ #=0D INF RedfishClientPkg/Converter/Memory/v1_7_1/RedfishMemory_V1_7_1_Dxe.in= f=0D INF RedfishClientPkg/Converter/MemoryCollection/RedfishMemoryCollection_= Dxe.inf=0D + INF RedfishClientPkg/Converter/ComputerSystem/v1_5_0/RedfishComputerSyst= em_V1_5_0_Dxe.inf=0D INF RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerS= ystemCollection_Dxe.inf=0D !endif=0D diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc b/RedfishClie= ntPkg/RedfishClientComponents.dsc.inc index d4a33385f6..084796e4b5 100644 --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc @@ -16,11 +16,16 @@ RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf=0D RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf=0D RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf=0D +!endif=0D #=0D # Below two modules should be pulled in by build tool.=0D #=0D RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.inf=0D RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.inf=0D + RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.in= f {=0D + =0D + RedfishResourceIdentifyLib|RedfishClientPkg/Library/RedfishResourceI= dentifyLibComuterSystem/v1_5_0/RedfishResourceIdentifyLibComuterSystem.inf= =0D + }=0D RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemColl= ectionDxe.inf=0D =0D !include RedfishClientPkg/RedfishJsonStructureDxe.dsc.inc=0D @@ -30,5 +35,5 @@ #=0D RedfishClientPkg/Converter/Memory/v1_7_1/RedfishMemory_V1_7_1_Dxe.inf=0D RedfishClientPkg/Converter/MemoryCollection/RedfishMemoryCollection_Dxe.= inf=0D -!endif=0D + RedfishClientPkg/Converter/ComputerSystem/v1_5_0/RedfishComputerSystem_V= 1_5_0_Dxe.inf=0D RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerSyste= mCollection_Dxe.inf=0D diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc b/RedfishClientPkg/= RedfishClientLibs.dsc.inc index 21595613f5..05ad09ef5e 100644 --- a/RedfishClientPkg/RedfishClientLibs.dsc.inc +++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc @@ -19,6 +19,7 @@ #=0D MemoryV1_7_1Lib|RedfishClientPkg/ConverterLib/edk2library/Memory/v1_7_1/= Lib.inf=0D MemoryCollectionLib|RedfishClientPkg/ConverterLib/edk2library/MemoryColl= ection/Lib.inf=0D + ComputerSystemV1_5_0Lib|RedfishClientPkg/ConverterLib/edk2library/Comput= erSystem/v1_5_0/Lib.inf=0D ComputerSystemCollectionLib|RedfishClientPkg/ConverterLib/edk2library/Co= mputerSystemCollection/Lib.inf=0D =0D NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf=0D --=20 2.32.0.windows.2