From nobody Mon Feb 9 16:19:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+91882+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91882+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=hpe.com ARC-Seal: i=1; a=rsa-sha256; t=1658885910; cv=none; d=zohomail.com; s=zohoarc; b=esdN1zny5BpPVclQB8YOKeGvgs+PvRSuTeWqlRos9rHrjeaZ6Xspp2V2iflPG3xwsZmNhz9Z/SAkJd/hFFznGXvFzuu4LrwtTDwFWwUDpJb8lvb8XwFKi76UNdKrEgU4NVieFKsvAuTsZa1N0ogIZ5xTQ3uyZv6qAP//L6zd7MM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1658885910; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=e4aGNFSL+r0Qr0lVfXtCraD2tzrZbgRtHxF0CcI1K9I=; b=IpHihGmNP3TEF2jtnPP+j2UMxE3WKch6DUrnVpHTrSqC5QRPk7rYaWrqwBjvcsJdSaDe514/e9ARPPynKh2eJscbTUqX1JlOgINBqv85tRFqVxXb/gQ1K40iOSpTlJSxihMVXGw0tjY6Flgo83L7nqPgCtdsuoOFdr/cYo+0CKs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+91882+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1658885910731292.5961116836547; Tue, 26 Jul 2022 18:38:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Y0BKYY1788612x0KwqdU49xQ; Tue, 26 Jul 2022 18:38:30 -0700 X-Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web08.15039.1658885909762532215 for ; Tue, 26 Jul 2022 18:38:29 -0700 X-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 26R1UcYT002115; Wed, 27 Jul 2022 01:38:28 GMT X-Received: from p1lg14879.it.hpe.com (p1lg14879.it.hpe.com [16.230.97.200]) by mx0b-002e3701.pphosted.com (PPS) with ESMTPS id 3hjurp02cc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Jul 2022 01:38:27 +0000 X-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 p1lg14879.it.hpe.com (Postfix) with ESMTPS id 53F5A132DA; Wed, 27 Jul 2022 01:38:27 +0000 (UTC) X-Received: from WAFM3XJD5N.asiapacific.hpqcorp.net (unknown [16.231.227.36]) by p1lg14885.dc01.its.hpecorp.net (Postfix) with ESMTP id 15ADB803A92; Wed, 27 Jul 2022 01:38:25 +0000 (UTC) From: "Nickle Wang" To: devel@edk2.groups.io Cc: Abner Chang , Yang Atom , Nick Ramirez Subject: [edk2-devel] [edk2-staging][PATCH v3 14/15] edk2-staging/RedfishClientPkg: Introduce Computer System feature driver Date: Wed, 27 Jul 2022 09:38:01 +0800 Message-Id: <20220727013802.247-15-nickle.wang@hpe.com> In-Reply-To: <20220727013802.247-1-nickle.wang@hpe.com> References: <20220727013802.247-1-nickle.wang@hpe.com> MIME-Version: 1.0 X-Proofpoint-GUID: qSkTBy9N5n-3t02xn5tp2323YMxdT6Us X-Proofpoint-ORIG-GUID: qSkTBy9N5n-3t02xn5tp2323YMxdT6Us X-HPE-SCL: -1 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nickle.wang@hpe.com X-Gm-Message-State: QxOqmHrhjBHax9uzLje91URJx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1658885910; bh=qw5evtW+NTwcdijTdPytGpU6nEJXifgEaMhQ1ZUkS0E=; h=Cc:Date:From:Reply-To:Subject:To; b=MXnMN9q6XClFdCm9lI1kQs2YhZ3z2IRRIY/E8afoKSkr+s/NMgjbC0EYu1SfU7kvIwt QMa5Mo5ZiLBIjdPoZBoX9YGYMfgFE158u1jX3GKUFH79+luQ8jeKyonheoFyMbVv/oPT3 eARHR9zA1h5zHRSq1mN3QbH6U5Z8ZnqDFOA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1658885911139100024 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Abner Chang --- .../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 + Redfish feature driver implementation - common functions + + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "ComputerSystemCommon.h" + +CHAR8 ComputerSystemEmptyJson[] =3D "{\"@odata.id\": \"\", \"@odata.type\"= : \"#ComputerSystem.v1_5_0.ComputerSystem\", \"Id\": \"\", \"Name\": \"\", = \"Boot\":{}}"; + +REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate =3D NULL; + +/** + Consume resource from given URI. + + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance. + @param[in] Json The JSON to consume. + @param[in] HeaderEtag The Etag string returned in HTTP header. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishConsumeResourceCommon ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN CHAR8 *Json, + IN CHAR8 *HeaderEtag OPTIONAL + ) +{ + EFI_STATUS Status; + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0 *ComputerSystem; + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0_CS *ComputerSystemCs; + EFI_STRING ConfigureLang; + + + if (Private =3D=3D NULL || IS_EMPTY_STRING (Json)) { + return EFI_INVALID_PARAMETER; + } + + ComputerSystem =3D NULL; + ComputerSystemCs =3D NULL; + ConfigureLang =3D NULL; + + Status =3D Private->JsonStructProtocol->ToStructure ( + Private->JsonStructProtocol, + NULL, + Json, + (EFI_REST_JSON_STRUCTURE_HEADER = **)&ComputerSystem + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __FUNCTION__, S= tatus)); + return Status; + } + + ComputerSystemCs =3D ComputerSystem->ComputerSystem; + + // + // Check ETAG to see if we need to consume it + // + if (CheckEtag (Private->Uri, HeaderEtag, NULL)) { + // + // No change + // + DEBUG ((DEBUG_INFO, "%a, ETAG: %s has no change, ignore consume action= \n", __FUNCTION__, Private->Uri)); + Status =3D EFI_ALREADY_STARTED; + goto ON_RELEASE; + } + + // + // Handle ASSETTAG + // + if (ComputerSystemCs->AssetTag !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Asset= Tag"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->AssetTag); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // BIOS will be handled by feature driver. + // + + // + // Handle BIOSVERSION + // + if (ComputerSystemCs->BiosVersion !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "BiosV= ersion"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->BiosVersion); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle BOOT + // + if (ComputerSystemCs->Boot =3D=3D NULL) { + ComputerSystemCs->Boot =3D AllocateZeroPool (sizeof (RedfishComputerSy= stem_V1_5_0_Boot_CS)); + ASSERT (ComputerSystemCs->Boot !=3D NULL); + } + + // + // Handle BOOT->BOOTNEXT + // + if (ComputerSystemCs->Boot->BootNext !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootNext"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootNext); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle BOOT->BOOTORDER + // + if (ComputerSystemCs->Boot->BootOrder !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootOrder"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringArrayType (RESOURCE_SCHEMA, RES= OURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootOrder); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle BOOT->BOOTSOURCEOVERRIDEENABLED + // + if (ComputerSystemCs->Boot->BootSourceOverrideEnabled !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootSourceOverrideEnabled"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideE= nabled); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle BOOT->BOOTSOURCEOVERRIDEMODE + // + if (ComputerSystemCs->Boot->BootSourceOverrideMode !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootSourceOverrideMode"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideM= ode); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle BOOT->BOOTSOURCEOVERRIDETARGET + // + if (ComputerSystemCs->Boot->BootSourceOverrideTarget !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= BootSourceOverrideTarget"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideT= arget); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle BOOT->UEFITARGETBOOTSOURCEOVERRIDE + // + if (ComputerSystemCs->Boot->UefiTargetBootSourceOverride !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Boot/= UefiTargetBootSourceOverride"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->UefiTargetBootSourc= eOverride); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // ETHERNETINTERFACES will be handled by collection driver. + // + + // + // Handle HOSTNAME + // + if (ComputerSystemCs->HostName !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "HostN= ame"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->HostName); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle HOSTWATCHDOGTIMER + // + if (ComputerSystemCs->HostWatchdogTimer =3D=3D NULL) { + ComputerSystemCs->HostWatchdogTimer =3D AllocateZeroPool (sizeof (Redf= ishComputerSystem_V1_5_0_WatchdogTimer_CS)); + ASSERT (ComputerSystemCs->HostWatchdogTimer !=3D NULL); + } + + // + // Handle HOSTWATCHDOGTIMER->FUNCTIONENABLED + // + if (ComputerSystemCs->HostWatchdogTimer->FunctionEnabled !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "HostW= atchdogTimer/FunctionEnabled"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsBooleanType (RESOURCE_SCHEMA, RESOURC= E_SCHEMA_VERSION, ConfigureLang, (BOOLEAN)*ComputerSystemCs->HostWatchdogTi= mer->FunctionEnabled); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle HOSTWATCHDOGTIMER->TIMEOUTACTION + // + if (ComputerSystemCs->HostWatchdogTimer->TimeoutAction !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "HostW= atchdogTimer/TimeoutAction"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->HostWatchdogTimer->Timeou= tAction); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle HOSTWATCHDOGTIMER->WARNINGACTION + // + if (ComputerSystemCs->HostWatchdogTimer->WarningAction !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "HostW= atchdogTimer/WarningAction"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->HostWatchdogTimer->Warnin= gAction); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle HOSTEDSERVICES + // + if (ComputerSystemCs->HostedServices =3D=3D NULL) { + ComputerSystemCs->HostedServices =3D AllocateZeroPool (sizeof (Redfish= ComputerSystem_V1_5_0_HostedServices_CS)); + ASSERT (ComputerSystemCs->HostedServices !=3D NULL); + } + + // + // Handle HOSTINGROLES + // +// +// ****** Warning ****** +// Unsupported array type: +// + + // + // Handle INDICATORLED + // + if (ComputerSystemCs->IndicatorLED !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Indic= atorLED"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->IndicatorLED); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // LOGSERVICES will be handled by collection driver. + // + + // + // Handle MANUFACTURER + // + if (ComputerSystemCs->Manufacturer !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Manuf= acturer"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Manufacturer); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // MEMORY will be handled by collection driver. + // + + // + // Handle MEMORYSUMMARY + // + if (ComputerSystemCs->MemorySummary =3D=3D NULL) { + ComputerSystemCs->MemorySummary =3D AllocateZeroPool (sizeof (RedfishC= omputerSystem_V1_5_0_MemorySummary_CS)); + ASSERT (ComputerSystemCs->MemorySummary !=3D NULL); + } + + // + // Handle MEMORYSUMMARY->MEMORYMIRRORING + // + if (ComputerSystemCs->MemorySummary->MemoryMirroring !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Memor= ySummary/MemoryMirroring"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->MemorySummary->MemoryMirr= oring); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle MEMORYSUMMARY->TOTALSYSTEMMEMORYGIB + // + if (ComputerSystemCs->MemorySummary->TotalSystemMemoryGiB !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Memor= ySummary/TotalSystemMemoryGiB"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURC= E_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->MemorySummary->T= otalSystemMemoryGiB); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle MEMORYSUMMARY->TOTALSYSTEMPERSISTENTMEMORYGIB + // + if (ComputerSystemCs->MemorySummary->TotalSystemPersistentMemoryGiB !=3D= NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Memor= ySummary/TotalSystemPersistentMemoryGiB"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURC= E_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->MemorySummary->T= otalSystemPersistentMemoryGiB); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle MODEL + // + if (ComputerSystemCs->Model !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Model= "); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Model); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // NETWORKINTERFACES will be handled by collection driver. + // + + // + // Handle PCIEDEVICES + // +// +// ****** Warning ****** +// Unsupported array type: +// + + // + // Handle PCIEFUNCTIONS + // +// +// ****** Warning ****** +// Unsupported array type: +// + + // + // Handle PARTNUMBER + // + if (ComputerSystemCs->PartNumber !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "PartN= umber"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->PartNumber); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle POWERSTATE + // + if (ComputerSystemCs->PowerState !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Power= State"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->PowerState); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle PROCESSORSUMMARY + // + if (ComputerSystemCs->ProcessorSummary =3D=3D NULL) { + ComputerSystemCs->ProcessorSummary =3D AllocateZeroPool (sizeof (Redfi= shComputerSystem_V1_5_0_ProcessorSummary_CS)); + ASSERT (ComputerSystemCs->ProcessorSummary !=3D NULL); + } + + // + // Handle PROCESSORSUMMARY->COUNT + // + if (ComputerSystemCs->ProcessorSummary->Count !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Proce= ssorSummary/Count"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURC= E_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->ProcessorSummary= ->Count); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle PROCESSORSUMMARY->LOGICALPROCESSORCOUNT + // + if (ComputerSystemCs->ProcessorSummary->LogicalProcessorCount !=3D NULL)= { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Proce= ssorSummary/LogicalProcessorCount"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURC= E_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->ProcessorSummary= ->LogicalProcessorCount); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle PROCESSORSUMMARY->MODEL + // + if (ComputerSystemCs->ProcessorSummary->Model !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Proce= ssorSummary/Model"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->ProcessorSummary->Model); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // PROCESSORS will be handled by collection driver. + // + + // + // Handle REDUNDANCY + // +// +// ****** Warning ****** +// Unsupported array type: +// + + // + // Handle SKU + // + if (ComputerSystemCs->SKU !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "SKU"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SKU); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // SECUREBOOT will be handled by feature driver. + // + + // + // Handle SERIALNUMBER + // + if (ComputerSystemCs->SerialNumber !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Seria= lNumber"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SerialNumber); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // SIMPLESTORAGE will be handled by collection driver. + // + + // + // STORAGE will be handled by collection driver. + // + + // + // Handle SUBMODEL + // + if (ComputerSystemCs->SubModel !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "SubMo= del"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SubModel); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle SYSTEMTYPE + // + if (ComputerSystemCs->SystemType !=3D NULL) { + // + // Find corresponding configure language for collection resource. + // + ConfigureLang =3D GetConfigureLang (ComputerSystemCs->odata_id, "Syste= mType"); + if (ConfigureLang !=3D NULL) { + Status =3D ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SystemType); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + + FreePool (ConfigureLang); + } else { + DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __FUNCTION__, Private->Uri)); + } + } + + // + // Handle TRUSTEDMODULES + // +// +// ****** Warning ****** +// Unsupported array type: +// + + +ON_RELEASE: + + // + // Release resource. + // + Private->JsonStructProtocol->DestoryStructure ( + Private->JsonStructProtocol, + (EFI_REST_JSON_STRUCTURE_HEADER *)Compute= rSystem + ); + + return EFI_SUCCESS; +} + +EFI_STATUS +ProvisioningComputerSystemProperties ( + IN EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol, + IN CHAR8 *InputJson, + IN CHAR8 *ResourceId, OPTIONAL + IN EFI_STRING ConfigureLang, + IN BOOLEAN ProvisionMode, + OUT CHAR8 **ResultJson + ) +{ + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0 *ComputerSystem; + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0_CS *ComputerSystemCs; + EFI_STATUS Status; + BOOLEAN PropertyChanged; + CHAR8 *AsciiStringValue; + CHAR8 **AsciiStringArrayValue; + UINTN ArraySize; + BOOLEAN *BooleanValue; + INT32 *IntegerValue; + INT64 *NumericValue; + + + + if (JsonStructProtocol =3D=3D NULL || ResultJson =3D=3D NULL || IS_EMPTY= _STRING (InputJson) || IS_EMPTY_STRING (ConfigureLang)) { + return EFI_INVALID_PARAMETER; + } + + DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s with: %s\n", __FUNCTIO= N__, ConfigureLang, (ProvisionMode ? L"Provision resource" : L"Update resou= rce"))); + + *ResultJson =3D NULL; + PropertyChanged =3D FALSE; + + ComputerSystem =3D NULL; + Status =3D JsonStructProtocol->ToStructure ( + JsonStructProtocol, + NULL, + InputJson, + (EFI_REST_JSON_STRUCTURE_HEADER **)&Compu= terSystem + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, ToStructure failure: %r\n", __FUNCTION__, St= atus)); + return Status; + } + + ComputerSystemCs =3D ComputerSystem->ComputerSystem; + + // + // ID + // + if (ComputerSystemCs->Id =3D=3D NULL && !IS_EMPTY_STRING (ResourceId)) { + ComputerSystemCs->Id =3D AllocateCopyPool (AsciiStrSize (ResourceId), = ResourceId); + } + + // + // Handle ASSETTAG + // + if (PropertyChecker (ComputerSystemCs->AssetTag, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"AssetTag", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->AssetTag, AsciiS= tringValue) !=3D 0) { + ComputerSystemCs->AssetTag =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle BIOSVERSION + // + if (PropertyChecker (ComputerSystemCs->BiosVersion, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"BiosVersion", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->BiosVersion, Asc= iiStringValue) !=3D 0) { + ComputerSystemCs->BiosVersion =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle BOOT + // + if (ComputerSystemCs->Boot !=3D NULL) { + // + // Handle BOOT->BOOTNEXT + // + if (PropertyChecker (ComputerSystemCs->Boot->BootNext, ProvisionMode))= { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootNext", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootNext= , AsciiStringValue) !=3D 0) { + ComputerSystemCs->Boot->BootNext =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle BOOT->BOOTORDER + // + if (PropertyChecker (ComputerSystemCs->Boot->BootOrder, ProvisionMode)= ) { + AsciiStringArrayValue =3D GetPropertyStringArrayValue (RESOURCE_SCHE= MA, RESOURCE_SCHEMA_VERSION, L"Boot/BootOrder", ConfigureLang, &ArraySize); + if (AsciiStringArrayValue !=3D NULL) { + if (ProvisionMode || !CompareRedfishStringArrayValues (ComputerSys= temCs->Boot->BootOrder, AsciiStringArrayValue, ArraySize)) { + AddRedfishCharArray (&ComputerSystemCs->Boot->BootOrder, AsciiSt= ringArrayValue, ArraySize); + PropertyChanged =3D TRUE; + } + } + } + // + // Handle BOOT->BOOTSOURCEOVERRIDEENABLED + // + if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideEnabled= , ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideEnabled", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootSour= ceOverrideEnabled, AsciiStringValue) !=3D 0) { + ComputerSystemCs->Boot->BootSourceOverrideEnabled =3D AsciiStrin= gValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle BOOT->BOOTSOURCEOVERRIDEMODE + // + if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideMode, P= rovisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideMode", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootSour= ceOverrideMode, AsciiStringValue) !=3D 0) { + ComputerSystemCs->Boot->BootSourceOverrideMode =3D AsciiStringVa= lue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle BOOT->BOOTSOURCEOVERRIDETARGET + // + if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideTarget,= ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideTarget", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootSour= ceOverrideTarget, AsciiStringValue) !=3D 0) { + ComputerSystemCs->Boot->BootSourceOverrideTarget =3D AsciiString= Value; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle BOOT->UEFITARGETBOOTSOURCEOVERRIDE + // + if (PropertyChecker (ComputerSystemCs->Boot->UefiTargetBootSourceOverr= ide, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/UefiTargetBootSourceOverride", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->UefiTarg= etBootSourceOverride, AsciiStringValue) !=3D 0) { + ComputerSystemCs->Boot->UefiTargetBootSourceOverride =3D AsciiSt= ringValue; + PropertyChanged =3D TRUE; + } + } + } + } + + // + // Handle HOSTNAME + // + if (PropertyChecker (ComputerSystemCs->HostName, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"HostName", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->HostName, AsciiS= tringValue) !=3D 0) { + ComputerSystemCs->HostName =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle HOSTWATCHDOGTIMER + // + if (ComputerSystemCs->HostWatchdogTimer !=3D NULL) { + // + // Handle HOSTWATCHDOGTIMER->FUNCTIONENABLED + // + if (PropertyChecker (ComputerSystemCs->HostWatchdogTimer->FunctionEnab= led, ProvisionMode)) { + BooleanValue =3D GetPropertyBooleanValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"HostWatchdogTimer/FunctionEnabled", ConfigureLang); + if (BooleanValue !=3D NULL) { + if (ProvisionMode || *ComputerSystemCs->HostWatchdogTimer->Functio= nEnabled !=3D *BooleanValue) { + IntegerValue =3D AllocatePool (sizeof (*IntegerValue)); + if (IntegerValue !=3D NULL) { + *IntegerValue =3D (BooleanValue ? 0x01 : 0x00); + ComputerSystemCs->HostWatchdogTimer->FunctionEnabled =3D Integ= erValue; + PropertyChanged =3D TRUE; + } + } + } + } + // + // Handle HOSTWATCHDOGTIMER->TIMEOUTACTION + // + if (PropertyChecker (ComputerSystemCs->HostWatchdogTimer->TimeoutActio= n, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"HostWatchdogTimer/TimeoutAction", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->HostWatchdogTi= mer->TimeoutAction, AsciiStringValue) !=3D 0) { + ComputerSystemCs->HostWatchdogTimer->TimeoutAction =3D AsciiStri= ngValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle HOSTWATCHDOGTIMER->WARNINGACTION + // + if (PropertyChecker (ComputerSystemCs->HostWatchdogTimer->WarningActio= n, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"HostWatchdogTimer/WarningAction", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->HostWatchdogTi= mer->WarningAction, AsciiStringValue) !=3D 0) { + ComputerSystemCs->HostWatchdogTimer->WarningAction =3D AsciiStri= ngValue; + PropertyChanged =3D TRUE; + } + } + } + } + + // + // Handle HOSTEDSERVICES + // + if (ComputerSystemCs->HostedServices !=3D NULL) { + } + + // + // Handle HOSTINGROLES + // +//// ****** Warning ****** +// Unsupported array type: +// + + // + // Handle INDICATORLED + // + if (PropertyChecker (ComputerSystemCs->IndicatorLED, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"IndicatorLED", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->IndicatorLED, As= ciiStringValue) !=3D 0) { + ComputerSystemCs->IndicatorLED =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle MANUFACTURER + // + if (PropertyChecker (ComputerSystemCs->Manufacturer, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"Manufacturer", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Manufacturer, As= ciiStringValue) !=3D 0) { + ComputerSystemCs->Manufacturer =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle MEMORYSUMMARY + // + if (ComputerSystemCs->MemorySummary !=3D NULL) { + // + // Handle MEMORYSUMMARY->MEMORYMIRRORING + // + if (PropertyChecker (ComputerSystemCs->MemorySummary->MemoryMirroring,= ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"MemorySummary/MemoryMirroring", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->MemorySummary-= >MemoryMirroring, AsciiStringValue) !=3D 0) { + ComputerSystemCs->MemorySummary->MemoryMirroring =3D AsciiString= Value; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle MEMORYSUMMARY->TOTALSYSTEMMEMORYGIB + // + if (PropertyChecker (ComputerSystemCs->MemorySummary->TotalSystemMemor= yGiB, ProvisionMode)) { + NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"MemorySummary/TotalSystemMemoryGiB", ConfigureLang); + if (NumericValue !=3D NULL) { + if (ProvisionMode || *ComputerSystemCs->MemorySummary->TotalSystem= MemoryGiB !=3D *NumericValue) { + ComputerSystemCs->MemorySummary->TotalSystemMemoryGiB =3D Numeri= cValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle MEMORYSUMMARY->TOTALSYSTEMPERSISTENTMEMORYGIB + // + if (PropertyChecker (ComputerSystemCs->MemorySummary->TotalSystemPersi= stentMemoryGiB, ProvisionMode)) { + NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"MemorySummary/TotalSystemPersistentMemoryGiB", ConfigureL= ang); + if (NumericValue !=3D NULL) { + if (ProvisionMode || *ComputerSystemCs->MemorySummary->TotalSystem= PersistentMemoryGiB !=3D *NumericValue) { + ComputerSystemCs->MemorySummary->TotalSystemPersistentMemoryGiB = =3D NumericValue; + PropertyChanged =3D TRUE; + } + } + } + } + + // + // Handle MODEL + // + if (PropertyChecker (ComputerSystemCs->Model, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"Model", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Model, AsciiStri= ngValue) !=3D 0) { + ComputerSystemCs->Model =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle PCIEDEVICES + // +//// ****** Warning ****** +// Unsupported array type: +// + + // + // Handle PCIEFUNCTIONS + // +//// ****** Warning ****** +// Unsupported array type: +// + + // + // Handle PARTNUMBER + // + if (PropertyChecker (ComputerSystemCs->PartNumber, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"PartNumber", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->PartNumber, Asci= iStringValue) !=3D 0) { + ComputerSystemCs->PartNumber =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle POWERSTATE + // + if (PropertyChecker (ComputerSystemCs->PowerState, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"PowerState", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->PowerState, Asci= iStringValue) !=3D 0) { + ComputerSystemCs->PowerState =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle PROCESSORSUMMARY + // + if (ComputerSystemCs->ProcessorSummary !=3D NULL) { + // + // Handle PROCESSORSUMMARY->COUNT + // + if (PropertyChecker (ComputerSystemCs->ProcessorSummary->Count, Provis= ionMode)) { + NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"ProcessorSummary/Count", ConfigureLang); + if (NumericValue !=3D NULL) { + if (ProvisionMode || *ComputerSystemCs->ProcessorSummary->Count != =3D *NumericValue) { + ComputerSystemCs->ProcessorSummary->Count =3D NumericValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle PROCESSORSUMMARY->LOGICALPROCESSORCOUNT + // + if (PropertyChecker (ComputerSystemCs->ProcessorSummary->LogicalProces= sorCount, ProvisionMode)) { + NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"ProcessorSummary/LogicalProcessorCount", ConfigureLang); + if (NumericValue !=3D NULL) { + if (ProvisionMode || *ComputerSystemCs->ProcessorSummary->LogicalP= rocessorCount !=3D *NumericValue) { + ComputerSystemCs->ProcessorSummary->LogicalProcessorCount =3D Nu= mericValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle PROCESSORSUMMARY->MODEL + // + if (PropertyChecker (ComputerSystemCs->ProcessorSummary->Model, Provis= ionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"ProcessorSummary/Model", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->ProcessorSumma= ry->Model, AsciiStringValue) !=3D 0) { + ComputerSystemCs->ProcessorSummary->Model =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + } + + // + // Handle REDUNDANCY + // +//// ****** Warning ****** +// Unsupported array type: +// + + // + // Handle SKU + // + if (PropertyChecker (ComputerSystemCs->SKU, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SKU", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SKU, AsciiString= Value) !=3D 0) { + ComputerSystemCs->SKU =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle SERIALNUMBER + // + if (PropertyChecker (ComputerSystemCs->SerialNumber, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SerialNumber", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SerialNumber, As= ciiStringValue) !=3D 0) { + ComputerSystemCs->SerialNumber =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle SUBMODEL + // + if (PropertyChecker (ComputerSystemCs->SubModel, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SubModel", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SubModel, AsciiS= tringValue) !=3D 0) { + ComputerSystemCs->SubModel =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle SYSTEMTYPE + // + if (PropertyChecker (ComputerSystemCs->SystemType, ProvisionMode)) { + AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SystemType", ConfigureLang); + if (AsciiStringValue !=3D NULL) { + if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SystemType, Asci= iStringValue) !=3D 0) { + ComputerSystemCs->SystemType =3D AsciiStringValue; + PropertyChanged =3D TRUE; + } + } + } + // + // Handle TRUSTEDMODULES + // +//// ****** Warning ****** +// Unsupported array type: +// + + + // + // Convert C structure back to JSON text. + // + Status =3D JsonStructProtocol->ToJson ( + JsonStructProtocol, + (EFI_REST_JSON_STRUCTURE_HEADER *)Compute= rSystem, + ResultJson + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, ToJson() failed: %r\n", __FUNCTION__, Status= )); + return Status; + } + + // + // Release resource. + // + JsonStructProtocol->DestoryStructure ( + JsonStructProtocol, + (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystem + ); + + return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND); +} + +EFI_STATUS +ProvisioningComputerSystemResource ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN UINTN Index, + IN EFI_STRING ConfigureLang + ) +{ + CHAR8 *Json; + EFI_STATUS Status; + EFI_STRING NewResourceLocation; + CHAR8 *EtagStr; + CHAR8 ResourceId[16]; + + if (IS_EMPTY_STRING (ConfigureLang) || Private =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + EtagStr =3D NULL; + AsciiSPrint (ResourceId, sizeof (ResourceId), "%d", Index); + + Status =3D ProvisioningComputerSystemProperties ( + Private->JsonStructProtocol, + ComputerSystemEmptyJson, + ResourceId, + ConfigureLang, + TRUE, + &Json + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, provisioning resource for %s failed: %r\n", = __FUNCTION__, ConfigureLang, Status)); + return Status; + } + + Status =3D CreatePayloadToPostResource (Private->RedfishService, Private= ->Payload, Json, &NewResourceLocation, &EtagStr); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, post ComputerSystem resource for %s failed: = %r\n", __FUNCTION__, ConfigureLang, Status)); + goto RELEASE_RESOURCE; + } + + ASSERT (NewResourceLocation !=3D NULL); + + // + // Keep location of new resource. + // + if (NewResourceLocation !=3D NULL) { + RedfisSetRedfishUri (ConfigureLang, NewResourceLocation); + } + + // + // Handle Etag + // + if (EtagStr !=3D NULL) { + SetEtagWithUri (EtagStr, NewResourceLocation); + FreePool (EtagStr); + } + +RELEASE_RESOURCE: + + if (NewResourceLocation !=3D NULL) { + FreePool (NewResourceLocation); + } + + if (Json !=3D NULL) { + FreePool (Json); + } + + return Status; +} + +EFI_STATUS +ProvisioningComputerSystemResources ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private + ) +{ + UINTN Index; + EFI_STATUS Status; + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST UnifiedConfigureLangList; + + if (Private =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + Status =3D RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHE= MA, RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &UnifiedConfigureLangLi= st); + if (EFI_ERROR (Status) || UnifiedConfigureLangList.Count =3D=3D 0) { + DEBUG ((DEBUG_ERROR, "%a, No HII question found with configure languag= e: %s: %r\n", __FUNCTION__, REDPATH_ARRAY_PATTERN, Status)); + return EFI_NOT_FOUND; + } + // + // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE. + // This information is sent back to the parent resource (e.g. the collec= tion driver). + // + EdkIIRedfishResourceSetConfigureLang (&UnifiedConfigureLangList); + + for (Index =3D 0; Index < UnifiedConfigureLangList.Count; Index++) { + DEBUG ((DEBUG_INFO, "[%d] create ComputerSystem resource from: %s\n", = UnifiedConfigureLangList.List[Index].Index, UnifiedConfigureLangList.List[I= ndex].ConfigureLang)); + ProvisioningComputerSystemResource (Private, UnifiedConfigureLangList.= List[Index].Index, UnifiedConfigureLangList.List[Index].ConfigureLang); + FreePool (UnifiedConfigureLangList.List[Index].ConfigureLang); + } + + return EFI_SUCCESS; +} + + +EFI_STATUS +ProvisioningComputerSystemExistResource ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private + ) +{ + EFI_STATUS Status; + EFI_STRING ConfigureLang; + CHAR8 *EtagStr; + CHAR8 *Json; + + if (Private =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + EtagStr =3D NULL; + Json =3D NULL; + ConfigureLang =3D NULL; + + ConfigureLang =3D RedfishGetConfigLanguage (Private->Uri); + if (ConfigureLang =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + Status =3D ProvisioningComputerSystemProperties ( + Private->JsonStructProtocol, + ComputerSystemEmptyJson, + NULL, + ConfigureLang, + TRUE, + &Json + ); + if (EFI_ERROR (Status)) { + if (Status =3D=3D EFI_NOT_FOUND) { + DEBUG ((REDFISH_DEBUG_TRACE, "%a, provisioning existing resource for= %s ignored. Nothing changed\n", __FUNCTION__, ConfigureLang)); + } else { + DEBUG ((DEBUG_ERROR, "%a, provisioning existing resource for %s fail= ed: %r\n", __FUNCTION__, ConfigureLang, Status)); + } + goto ON_RELEASE; + } + + DEBUG ((REDFISH_DEBUG_TRACE, "%a, provisioning existing resource for %s\= n", __FUNCTION__, ConfigureLang)); + // + // PUT back to instance + // + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Privat= e->Payload, Json, &EtagStr); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, patch resource for %s failed: %r\n", __FUNCT= ION__, ConfigureLang, Status)); + } + + // + // Handle Etag + // + if (EtagStr !=3D NULL) { + SetEtagWithUri (EtagStr, Private->Uri); + FreePool (EtagStr); + } + +ON_RELEASE: + + if (Json !=3D NULL) { + FreePool (Json); + } + + if (ConfigureLang !=3D NULL) { + FreePool (ConfigureLang); + } + + return Status; +} + +/** + Provisioning redfish resource by given URI. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[in] ResourceExist TRUE if resource exists, PUT method wil= l be used. + FALSE if resource does not exist POST m= ethod is used. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishProvisioningResourceCommon ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN BOOLEAN ResourceExist + ) +{ + if (Private =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + return (ResourceExist ? ProvisioningComputerSystemExistResource (Private= ) : ProvisioningComputerSystemResources (Private)); +} + +/** + Check resource from given URI. + + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance. + @param[in] Json The JSON to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishCheckResourceCommon ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN CHAR8 *Json + ) +{ + UINTN Index; + EFI_STATUS Status; + EFI_STRING *ConfigureLangList; + UINTN Count; + EFI_STRING Property; + + if (Private =3D=3D NULL || IS_EMPTY_STRING (Json)) { + return EFI_INVALID_PARAMETER; + } + + Status =3D RedfishPlatformConfigGetConfigureLang (RESOURCE_SCHEMA, RESOU= RCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigureLangList, &Count); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, BiosConfigToRedfishGetConfigureLangRegex fai= led: %r\n", __FUNCTION__, Status)); + return Status; + } + + if (Count =3D=3D 0) { + return EFI_NOT_FOUND; + } + + Status =3D EFI_SUCCESS; + for (Index =3D 0; Index < Count; Index++) { + + Property =3D GetPropertyFromConfigureLang (Private->Uri, ConfigureLang= List[Index]); + if (Property =3D=3D NULL) { + continue; + } + + DEBUG ((DEBUG_INFO, "%a, [%d] check attribute for: %s\n", __FUNCTION__= , Index, Property)); + if (!MatchPropertyWithJsonContext (Property, Json)) { + DEBUG ((DEBUG_INFO, "%a, property is missing: %s\n", __FUNCTION__, P= roperty)); + Status =3D EFI_NOT_FOUND; + } + } + + FreePool (ConfigureLangList); + + return Status; +} + +/** + Update resource to given URI. + + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance. + @param[in] Json The JSON to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishUpdateResourceCommon ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN CHAR8 *InputJson + ) +{ + EFI_STATUS Status; + CHAR8 *Json; + EFI_STRING ConfigureLang; + CHAR8 *EtagStr; + + if (Private =3D=3D NULL || IS_EMPTY_STRING (InputJson)) { + return EFI_INVALID_PARAMETER; + } + + EtagStr =3D NULL; + Json =3D NULL; + ConfigureLang =3D NULL; + + ConfigureLang =3D RedfishGetConfigLanguage (Private->Uri); + if (ConfigureLang =3D=3D NULL) { + return EFI_NOT_FOUND; + } + + Status =3D ProvisioningComputerSystemProperties ( + Private->JsonStructProtocol, + InputJson, + NULL, + ConfigureLang, + FALSE, + &Json + ); + if (EFI_ERROR (Status)) { + if (Status =3D=3D EFI_NOT_FOUND) { + DEBUG ((REDFISH_DEBUG_TRACE, "%a, update resource for %s ignored. No= thing changed\n", __FUNCTION__, ConfigureLang)); + } else { + DEBUG ((DEBUG_ERROR, "%a, update resource for %s failed: %r\n", __FU= NCTION__, ConfigureLang, Status)); + } + goto ON_RELEASE; + } + + DEBUG ((REDFISH_DEBUG_TRACE, "%a, update resource for %s\n", __FUNCTION_= _, ConfigureLang)); + // + // PUT back to instance + // + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Privat= e->Payload, Json, &EtagStr); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, patch resource for %s failed: %r\n", __FUNCT= ION__, ConfigureLang, Status)); + } + + // + // Handle Etag + // + if (EtagStr !=3D NULL) { + SetEtagWithUri (EtagStr, Private->Uri); + FreePool (EtagStr); + } + +ON_RELEASE: + + if (Json !=3D NULL) { + FreePool (Json); + } + + if (ConfigureLang !=3D NULL) { + FreePool (ConfigureLang); + } + + return Status; +} + +/** + Identify resource from given URI. + + @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIV= ATE instance. + @param[in] Json The JSON to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishIdentifyResourceCommon ( + IN REDFISH_RESOURCE_COMMON_PRIVATE *Private, + IN CHAR8 *Json + ) +{ + BOOLEAN Supported; + EFI_STATUS Status; + EFI_STRING EndOfChar; + REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG_LIST ConfigLangList; + + Supported =3D RedfishIdentifyResource (Private->Uri, Private->Json); + if (Supported) { + Status =3D RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SC= HEMA, RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, BiosConfigToRedfishGetConfigureLangRegex f= ailed: %r\n", __FUNCTION__, Status)); + return Status; + } + + if (ConfigLangList.Count =3D=3D 0) { + return EFI_SUCCESS; + } + + EndOfChar =3D StrStr (ConfigLangList.List[0].ConfigureLang, L"}"); + if (EndOfChar =3D=3D NULL) { + ASSERT (FALSE); + return EFI_DEVICE_ERROR; + } + + //EndOfChar =3D StrStr (ConfigLangList.List[0].ConfigureLang, L"}"); + Status =3D IsRedpathArray (ConfigLangList.List[0].ConfigureLang, NULL,= &EndOfChar); + if (EFI_ERROR (Status) && Status !=3D EFI_NOT_FOUND) { + ASSERT (FALSE); + return EFI_DEVICE_ERROR; + } + if (Status !=3D EFI_SUCCESS) { + // + // This is not the collection redpath. + // + GetRedpathNodeByIndex (ConfigLangList.List[0].ConfigureLang, 0, &End= OfChar); + } + *(++EndOfChar) =3D '\0'; + // + // Keep URI and ConfigLang mapping + // + RedfisSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->Ur= i); + // + // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE. + // This information is sent back to the parent resource (e.g. the coll= ection driver). + // + EdkIIRedfishResourceSetConfigureLang (&ConfigLangList); + DestroyConfiglanguageList (&ConfigLangList); + return EFI_SUCCESS; + } + + return EFI_UNSUPPORTED; +} 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 + + Redfish feature driver implementation - internal header file + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_ +#define EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_ + +#include +#include + +// +// Schema information. +// +#define RESOURCE_SCHEMA "ComputerSystem" +#define RESOURCE_SCHEMA_MAJOR "1" +#define RESOURCE_SCHEMA_MINOR "5" +#define RESOURCE_SCHEMA_ERRATA "0" +#define RESOURCE_SCHEMA_VERSION "v1_5_0" +#define REDPATH_ARRAY_PATTERN L"/Systems/\\{.*\\}/" +#define REDPATH_ARRAY_PREFIX L"/Systems/" +#define RESOURCE_SCHEMA_FULL "x-uefi-redfish-ComputerSystem.v1_5_0" + +#endif 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 + Redfish feature driver implementation - ComputerSystem + + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "../Common/ComputerSystemCommon.h" + +extern REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate; + +EFI_HANDLE medfishResourceConfigProtocolHandle; + +/** + Provising redfish resource by given URI. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[in] Uri Target URI to create resource. + @param[in] PostMode TRUE if the resource does not exist, po= st method is used. + FALSE if the resource exist but propert= y is missing, put method is used. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishResourceProvisioningResource ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri, + IN BOOLEAN PostMode + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + + if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + DEBUG ((DEBUG_INFO, "%a, provisioning in %s mode\n", __FUNCTION__, (Post= Mode ? L"POST" : L"PATCH"))); + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + if (Private->RedfishService =3D=3D NULL) { + return EFI_NOT_READY; + } + + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTION_= _, Uri)); + return Status; + } + + Private->Uri =3D Uri; + Private->Payload =3D Response.Payload; + ASSERT (Private->Payload !=3D NULL); + + Status =3D RedfishProvisioningResourceCommon (Private, !PostMode); + + // + // Release resource + // + if (Private->Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + Private->Payload =3D NULL; + } + + return Status; +} + +/** + Consume resource from given URI. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[in] Uri The target URI to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishResourceConsumeResource ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + CHAR8 *Etag; + + if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + if (Private->RedfishService =3D=3D NULL) { + return EFI_NOT_READY; + } + + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTION_= _, Uri)); + return Status; + } + + Private->Uri =3D Uri; + Private->Payload =3D Response.Payload; + ASSERT (Private->Payload !=3D NULL); + + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT); + ASSERT (Private->Json !=3D NULL); + + // + // Find etag in HTTP response header + // + Etag =3D NULL; + Status =3D GetEtagAndLocation (&Response, &Etag, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, failed to get ETag from HTTP header\n", __FU= NCTION__)); + } + + Status =3D RedfishConsumeResourceCommon (Private, Private->Json, Etag); + if (EFI_ERROR (Status)) { + if (Status !=3D EFI_ALREADY_STARTED) { + DEBUG ((DEBUG_ERROR, "%a, failed to consume resource from: %s: %r\n"= , __FUNCTION__, Uri, Status)); + } + } else { + // + // Keep etag after consuming pending settings. + // + if (Etag !=3D NULL) { + SetEtagWithUri (Etag, Private->Uri); + } + } + + // + // Release resource + // + if (Private->Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + Private->Payload =3D NULL; + } + + if (Private->Json !=3D NULL) { + FreePool (Private->Json); + Private->Json =3D NULL; + } + + return Status; +} + +/** + Get information about this protocol. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[out] Schema Supported schema. + @param[out] Major Supported major number. + @param[out] Minor Supported minor number. + @param[out] Errata Supported errata number. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishResourceGetInfo ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + OUT REDFISH_SCHEMA_INFO *Info + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + + if (This =3D=3D NULL || Info =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + AsciiStrCpyS (Info->Schema, REDFISH_SCHEMA_STRING_SIZE, RESOURCE_SCHEMA); + AsciiStrCpyS (Info->Major, REDFISH_SCHEMA_VERSION_SIZE, RESOURCE_SCHEMA_= MAJOR); + AsciiStrCpyS (Info->Minor, REDFISH_SCHEMA_VERSION_SIZE, RESOURCE_SCHEMA_= MINOR); + AsciiStrCpyS (Info->Errata, REDFISH_SCHEMA_VERSION_SIZE, RESOURCE_SCHEMA= _ERRATA); + + return EFI_SUCCESS; +} + +/** + Update resource to given URI. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[in] Uri The target URI to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishResourceUpdate ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + + if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + if (Private->RedfishService =3D=3D NULL) { + return EFI_NOT_READY; + } + + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTION_= _, Uri)); + return Status; + } + + Private->Uri =3D Uri; + Private->Payload =3D Response.Payload; + ASSERT (Private->Payload !=3D NULL); + + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT); + ASSERT (Private->Json !=3D NULL); + + Status =3D RedfishUpdateResourceCommon (Private, Private->Json); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, failed to update resource from: %s: %r\n", _= _FUNCTION__, Uri, Status)); + } + + // + // Release resource + // + if (Private->Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + Private->Payload =3D NULL; + } + + if (Private->Json !=3D NULL) { + FreePool (Private->Json); + Private->Json =3D NULL; + } + + return Status; +} + +/** + Check resource on given URI. + + @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. + @param[in] Uri The target URI to consume. + + @retval EFI_SUCCESS Value is returned successfully. + @retval Others Some error happened. + +**/ +EFI_STATUS +RedfishResourceCheck ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + + if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + if (Private->RedfishService =3D=3D NULL) { + return EFI_NOT_READY; + } + + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTION_= _, Uri)); + return Status; + } + + Private->Uri =3D Uri; + Private->Payload =3D Response.Payload; + ASSERT (Private->Payload !=3D NULL); + + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT); + ASSERT (Private->Json !=3D NULL); + + Status =3D RedfishCheckResourceCommon (Private, Private->Json); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, failed to check resource from: %s: %r\n", __= FUNCTION__, Uri, Status)); + } + + // + // Release resource + // + if (Private->Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + Private->Payload =3D NULL; + } + + if (Private->Json !=3D NULL) { + FreePool (Private->Json); + Private->Json =3D NULL; + } + + return Status; +} + +/** + Identify resource on given URI. + + @param[in] This Pointer to EDKII_REDFISH_RESOURCE_CONFI= G_PROTOCOL instance. + @param[in] Uri The target URI to consume. + + @retval EFI_SUCCESS This is target resource which we want t= o handle. + @retval EFI_UNSUPPORTED This is not the target resource. + @retval Others Some error happened. + +**/ + +EFI_STATUS +RedfishResourceIdentify ( + IN EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL *This, + IN EFI_STRING Uri + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + EFI_STATUS Status; + REDFISH_RESPONSE Response; + + if (This =3D=3D NULL || IS_EMPTY_STRING (Uri)) { + return EFI_INVALID_PARAMETER; + } + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); + + if (Private->RedfishService =3D=3D NULL) { + return EFI_NOT_READY; + } + + Status =3D GetResourceByUri (Private->RedfishService, Uri, &Response); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __FUNCTION_= _, Uri)); + return Status; + } + + Private->Uri =3D Uri; + Private->Payload =3D Response.Payload; + ASSERT (Private->Payload !=3D NULL); + + Private->Json =3D JsonDumpString (RedfishJsonInPayload (Private->Payload= ), EDKII_JSON_COMPACT); + ASSERT (Private->Json !=3D NULL); + + Status =3D RedfishIdentifyResourceCommon (Private, Private->Json); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, identify %s failed: %r\n", __FUNCTION__, Uri= , Status)); + } + // + // Release resource + // + if (Private->Payload !=3D NULL) { + RedfishFreeResponse ( + Response.StatusCode, + Response.HeaderCount, + Response.Headers, + Response.Payload + ); + Private->Payload =3D NULL; + } + + if (Private->Json !=3D NULL) { + FreePool (Private->Json); + Private->Json =3D NULL; + } + + return Status; +} + +EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL mRedfishResourceConfig =3D { + RedfishResourceProvisioningResource, + RedfishResourceConsumeResource, + RedfishResourceUpdate, + RedfishResourceCheck, + RedfishResourceIdentify, + RedfishResourceGetInfo +}; + +/** + Initialize a Redfish configure handler. + + This function will be called by the Redfish config driver to initialize = each Redfish configure + handler. + + @param[in] This Pointer to EDKII_REDFISH_CONFIG_HA= NDLER_PROTOCOL instance. + @param[in] RedfishConfigServiceInfo Redfish service informaion. + + @retval EFI_SUCCESS The handler has been initialized su= ccessfully. + @retval EFI_DEVICE_ERROR Failed to create or configure the R= EST EX protocol instance. + @retval EFI_ALREADY_STARTED This handler has already been initi= alized. + @retval Other Error happens during the initializa= tion. + +**/ +EFI_STATUS +EFIAPI +RedfishResourceInit ( + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This, + IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL (T= his); + + Private->RedfishService =3D RedfishCreateService (RedfishConfigServiceIn= fo); + if (Private->RedfishService =3D=3D NULL) { + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +/** + Stop a Redfish configure handler. + + @param[in] This Pointer to EDKII_REDFISH_CONFIG_HANDLER= _PROTOCOL instance. + + @retval EFI_SUCCESS This handler has been stoped successful= ly. + @retval Others Some error happened. + +**/ +EFI_STATUS +EFIAPI +RedfishResourceStop ( + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This + ) +{ + REDFISH_RESOURCE_COMMON_PRIVATE *Private; + + Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL (T= his); + + if (Private->Event !=3D NULL) { + gBS->CloseEvent (Private->Event); + Private->Event =3D NULL; + } + + if (Private->RedfishService !=3D NULL) { + RedfishCleanupService (Private->RedfishService); + Private->RedfishService =3D NULL; + } + + if (Private->Payload !=3D NULL) { + RedfishCleanupPayload (Private->Payload); + Private->Payload =3D NULL; + } + + return EFI_SUCCESS; +} + +EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHandler =3D { + RedfishResourceInit, + RedfishResourceStop +}; + +/** + Callback function when gEfiRestJsonStructureProtocolGuid is installed. + + @param[in] Event Event whose notification function is being invoked. + @param[in] Context Pointer to the notification function's context. +**/ +VOID +EFIAPI +EfiRestJasonStructureProtocolIsReady + ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + + if (mRedfishResourcePrivate =3D=3D NULL) { + return; + } + + if (mRedfishResourcePrivate->JsonStructProtocol !=3D NULL) { + return; + } + + Status =3D gBS->LocateProtocol ( + &gEfiRestJsonStructureProtocolGuid, + NULL, + (VOID **)&mRedfishResourcePrivate->JsonStructProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a, failed to locate gEfiRestJsonStructureProtoc= olGuid: %r\n", __FUNCTION__, Status)); + } + + gBS->CloseEvent (Event); +} + +/** + Unloads an image. + + @param ImageHandle Handle that identifies the image to be unl= oaded. + + @retval EFI_SUCCESS The image has been unloaded. + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle. + +**/ +EFI_STATUS +EFIAPI +RedfishResourceUnload ( + IN EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler; + + if (mRedfishResourcePrivate =3D=3D NULL) { + return EFI_NOT_READY; + } + + ConfigHandler =3D NULL; + + // + // Firstly, find ConfigHandler Protocol interface in this ImageHandle. + // + Status =3D gBS->OpenProtocol ( + ImageHandle, + &gEdkIIRedfishConfigHandlerProtocolGuid, + (VOID **) &ConfigHandler, + NULL, + NULL, + EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL + ); + if (EFI_ERROR (Status) || ConfigHandler =3D=3D NULL) { + return Status; + } + + ConfigHandler->Stop (ConfigHandler); + + // + // Last, uninstall ConfigHandler Protocol and resource protocol. + // + Status =3D gBS->UninstallMultipleProtocolInterfaces ( + ImageHandle, + &gEdkIIRedfishConfigHandlerProtocolGuid, + ConfigHandler, + &gEdkIIRedfishResourceConfigProtocolGuid, + &mRedfishResourcePrivate->RedfishResourceConfig, + NULL + ); + + FreePool (mRedfishResourcePrivate); + mRedfishResourcePrivate =3D NULL; + + return Status; +} + + +/** + This is the declaration of an EFI image entry point. This entry point is + the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers includ= ing + both device drivers and bus drivers. It initialize the global variables = and + publish the driver binding protocol. + + @param[in] ImageHandle The firmware allocated handle for the UEFI= image. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_ACCESS_DENIED EFI_ISCSI_INITIATOR_NAME_PROTOCOL was inst= alled unexpectedly. + @retval Others Other errors as indicated. +**/ +EFI_STATUS +EFIAPI +RedfishResourceEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + VOID *Registration; + + if (mRedfishResourcePrivate !=3D NULL) { + return EFI_ALREADY_STARTED; + } + + medfishResourceConfigProtocolHandle =3D ImageHandle; + + mRedfishResourcePrivate =3D AllocateZeroPool (sizeof (REDFISH_RESOURCE_C= OMMON_PRIVATE)); + CopyMem (&mRedfishResourcePrivate->ConfigHandler, &mRedfishConfigHandler= , sizeof (EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL)); + CopyMem (&mRedfishResourcePrivate->RedfishResourceConfig, &mRedfishResou= rceConfig, sizeof (EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL)); + + // + // Publish config handler protocol and resource protocol. + // + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &ImageHandle, + &gEdkIIRedfishConfigHandlerProtocolGuid, + &mRedfishResourcePrivate->ConfigHandler, + &gEdkIIRedfishResourceConfigProtocolGuid, + &mRedfishResourcePrivate->RedfishResourceConfig, + NULL + ); + + EfiCreateProtocolNotifyEvent ( + &gEfiRestJsonStructureProtocolGuid, + TPL_CALLBACK, + EfiRestJasonStructureProtocolIsReady, + NULL, + &Registration + ); + + return Status; +} 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 +# +# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D ComputerSystemDxe + FILE_GUID =3D 584bae05-d78d-4df9-b5e9-3e987a99480a + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D RedfishResourceEntryPoint + UNLOAD_IMAGE =3D RedfishResourceUnload + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + RedfishPkg/RedfishPkg.dec + RedfishClientPkg/RedfishClientPkg.dec + +[Sources] + ../Common/ComputerSystemCommon.h + ../Common/ComputerSystemCommon.c + ComputerSystemDxe.c + +[LibraryClasses] + BaseMemoryLib + DebugLib + EdkIIRedfishResourceConfigLib + RedfishLib + RedfishFeatureUtilityLib + RedfishResourceIdentifyLib + UefiLib + UefiDriverEntryPoint + + +[Protocols] + gEdkIIRedfishConfigHandlerProtocolGuid ## PRODUCED + gEfiRestJsonStructureProtocolGuid ## CONSUMED + gEdkIIRedfishResourceConfigProtocolGuid ## PRODUCED + +[Pcd] + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize + +[Depex] + TRUE 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 INF RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.inf INF RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.inf + INF RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDx= e.inf INF RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystem= CollectionDxe.inf =20 !include RedfishClientPkg/RedfishJsonStructureDxe.fdf.inc @@ -24,5 +25,6 @@ # INF RedfishClientPkg/Converter/Memory/v1_7_1/RedfishMemory_V1_7_1_Dxe.inf INF RedfishClientPkg/Converter/MemoryCollection/RedfishMemoryCollection_= Dxe.inf + INF RedfishClientPkg/Converter/ComputerSystem/v1_5_0/RedfishComputerSyst= em_V1_5_0_Dxe.inf INF RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerS= ystemCollection_Dxe.inf !endif 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 RedfishClientPkg/RedfishETagDxe/RedfishETagDxe.inf RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf +!endif # # Below two modules should be pulled in by build tool. # RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.inf RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.inf + RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.in= f { + + RedfishResourceIdentifyLib|RedfishClientPkg/Library/RedfishResourceI= dentifyLibComuterSystem/v1_5_0/RedfishResourceIdentifyLibComuterSystem.inf + } RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemColl= ectionDxe.inf =20 !include RedfishClientPkg/RedfishJsonStructureDxe.dsc.inc @@ -30,5 +35,5 @@ # RedfishClientPkg/Converter/Memory/v1_7_1/RedfishMemory_V1_7_1_Dxe.inf RedfishClientPkg/Converter/MemoryCollection/RedfishMemoryCollection_Dxe.= inf -!endif + RedfishClientPkg/Converter/ComputerSystem/v1_5_0/RedfishComputerSystem_V= 1_5_0_Dxe.inf RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerSyste= mCollection_Dxe.inf 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 @@ # MemoryV1_7_1Lib|RedfishClientPkg/ConverterLib/edk2library/Memory/v1_7_1/= Lib.inf MemoryCollectionLib|RedfishClientPkg/ConverterLib/edk2library/MemoryColl= ection/Lib.inf + ComputerSystemV1_5_0Lib|RedfishClientPkg/ConverterLib/edk2library/Comput= erSystem/v1_5_0/Lib.inf ComputerSystemCollectionLib|RedfishClientPkg/ConverterLib/edk2library/Co= mputerSystemCollection/Lib.inf =20 NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf --=20 2.32.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#91882): https://edk2.groups.io/g/devel/message/91882 Mute This Topic: https://groups.io/mt/92641656/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-