[edk2-staging][PATCH v3 14/15] edk2-staging/RedfishClientPkg: Introduce Computer System feature driver


Nickle Wang
 

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 <nickle.wang@...>
Cc: Abner Chang <abner.chang@...>
Cc: Yang Atom <Atom.Yang@...>
Cc: Nick Ramirez <nramirez@...>
---
.../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/ComputerSystemDxe.c
create mode 100644 RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.inf

diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
new file mode 100644
index 0000000000..0a9c746f3b
--- /dev/null
+++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.c
@@ -0,0 +1,1614 @@
+/** @file
+ Redfish feature driver implementation - common functions
+
+ (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "ComputerSystemCommon.h"
+
+CHAR8 ComputerSystemEmptyJson[] = "{\"@odata.id\": \"\", \"@odata.type\": \"#ComputerSystem.v1_5_0.ComputerSystem\", \"Id\": \"\", \"Name\": \"\", \"Boot\":{}}";
+
+REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResourcePrivate = NULL;
+
+/**
+ Consume resource from given URI.
+
+ @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIVATE 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 == NULL || IS_EMPTY_STRING (Json)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ComputerSystem = NULL;
+ ComputerSystemCs = NULL;
+ ConfigureLang = NULL;
+
+ Status = 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__, Status));
+ return Status;
+ }
+
+ ComputerSystemCs = 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 = EFI_ALREADY_STARTED;
+ goto ON_RELEASE;
+ }
+
+ //
+ // Handle ASSETTAG
+ //
+ if (ComputerSystemCs->AssetTag != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "AssetTag");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->AssetTag);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "BiosVersion");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->BiosVersion);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 == NULL) {
+ ComputerSystemCs->Boot = AllocateZeroPool (sizeof (RedfishComputerSystem_V1_5_0_Boot_CS));
+ ASSERT (ComputerSystemCs->Boot != NULL);
+ }
+
+ //
+ // Handle BOOT->BOOTNEXT
+ //
+ if (ComputerSystemCs->Boot->BootNext != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "Boot/BootNext");
+ if (ConfigureLang != NULL) {
+ Status = 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", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "Boot/BootOrder");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringArrayType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootOrder);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "Boot/BootSourceOverrideEnabled");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideEnabled);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "Boot/BootSourceOverrideMode");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideMode);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "Boot/BootSourceOverrideTarget");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->BootSourceOverrideTarget);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "Boot/UefiTargetBootSourceOverride");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Boot->UefiTargetBootSourceOverride);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "HostName");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->HostName);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 == NULL) {
+ ComputerSystemCs->HostWatchdogTimer = AllocateZeroPool (sizeof (RedfishComputerSystem_V1_5_0_WatchdogTimer_CS));
+ ASSERT (ComputerSystemCs->HostWatchdogTimer != NULL);
+ }
+
+ //
+ // Handle HOSTWATCHDOGTIMER->FUNCTIONENABLED
+ //
+ if (ComputerSystemCs->HostWatchdogTimer->FunctionEnabled != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "HostWatchdogTimer/FunctionEnabled");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsBooleanType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, (BOOLEAN)*ComputerSystemCs->HostWatchdogTimer->FunctionEnabled);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "HostWatchdogTimer/TimeoutAction");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->HostWatchdogTimer->TimeoutAction);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "HostWatchdogTimer/WarningAction");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->HostWatchdogTimer->WarningAction);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 == NULL) {
+ ComputerSystemCs->HostedServices = AllocateZeroPool (sizeof (RedfishComputerSystem_V1_5_0_HostedServices_CS));
+ ASSERT (ComputerSystemCs->HostedServices != NULL);
+ }
+
+ //
+ // Handle HOSTINGROLES
+ //
+//
+// ****** Warning ******
+// Unsupported array type:
+//
+
+ //
+ // Handle INDICATORLED
+ //
+ if (ComputerSystemCs->IndicatorLED != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "IndicatorLED");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->IndicatorLED);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "Manufacturer");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Manufacturer);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 == NULL) {
+ ComputerSystemCs->MemorySummary = AllocateZeroPool (sizeof (RedfishComputerSystem_V1_5_0_MemorySummary_CS));
+ ASSERT (ComputerSystemCs->MemorySummary != NULL);
+ }
+
+ //
+ // Handle MEMORYSUMMARY->MEMORYMIRRORING
+ //
+ if (ComputerSystemCs->MemorySummary->MemoryMirroring != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "MemorySummary/MemoryMirroring");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->MemorySummary->MemoryMirroring);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "MemorySummary/TotalSystemMemoryGiB");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->MemorySummary->TotalSystemMemoryGiB);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "MemorySummary/TotalSystemPersistentMemoryGiB");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->MemorySummary->TotalSystemPersistentMemoryGiB);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "Model");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->Model);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "PartNumber");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->PartNumber);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "PowerState");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->PowerState);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 == NULL) {
+ ComputerSystemCs->ProcessorSummary = AllocateZeroPool (sizeof (RedfishComputerSystem_V1_5_0_ProcessorSummary_CS));
+ ASSERT (ComputerSystemCs->ProcessorSummary != NULL);
+ }
+
+ //
+ // Handle PROCESSORSUMMARY->COUNT
+ //
+ if (ComputerSystemCs->ProcessorSummary->Count != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "ProcessorSummary/Count");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->ProcessorSummary->Count);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "ProcessorSummary/LogicalProcessorCount");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsNumericType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, (UINTN)*ComputerSystemCs->ProcessorSummary->LogicalProcessorCount);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "ProcessorSummary/Model");
+ if (ConfigureLang != NULL) {
+ Status = 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", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "SKU");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SKU);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "SerialNumber");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SerialNumber);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "SubModel");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SubModel);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 != NULL) {
+ //
+ // Find corresponding configure language for collection resource.
+ //
+ ConfigureLang = GetConfigureLang (ComputerSystemCs->odata_id, "SystemType");
+ if (ConfigureLang != NULL) {
+ Status = ApplyFeatureSettingsStringType (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, ConfigureLang, ComputerSystemCs->SystemType);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, apply setting for %s failed: %r\n", __FUNCTION__, 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 *)ComputerSystem
+ );
+
+ 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 == NULL || ResultJson == NULL || IS_EMPTY_STRING (InputJson) || IS_EMPTY_STRING (ConfigureLang)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s with: %s\n", __FUNCTION__, ConfigureLang, (ProvisionMode ? L"Provision resource" : L"Update resource")));
+
+ *ResultJson = NULL;
+ PropertyChanged = FALSE;
+
+ ComputerSystem = NULL;
+ Status = JsonStructProtocol->ToStructure (
+ JsonStructProtocol,
+ NULL,
+ InputJson,
+ (EFI_REST_JSON_STRUCTURE_HEADER **)&ComputerSystem
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, ToStructure failure: %r\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ ComputerSystemCs = ComputerSystem->ComputerSystem;
+
+ //
+ // ID
+ //
+ if (ComputerSystemCs->Id == NULL && !IS_EMPTY_STRING (ResourceId)) {
+ ComputerSystemCs->Id = AllocateCopyPool (AsciiStrSize (ResourceId), ResourceId);
+ }
+
+ //
+ // Handle ASSETTAG
+ //
+ if (PropertyChecker (ComputerSystemCs->AssetTag, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"AssetTag", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->AssetTag, AsciiStringValue) != 0) {
+ ComputerSystemCs->AssetTag = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle BIOSVERSION
+ //
+ if (PropertyChecker (ComputerSystemCs->BiosVersion, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"BiosVersion", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->BiosVersion, AsciiStringValue) != 0) {
+ ComputerSystemCs->BiosVersion = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle BOOT
+ //
+ if (ComputerSystemCs->Boot != NULL) {
+ //
+ // Handle BOOT->BOOTNEXT
+ //
+ if (PropertyChecker (ComputerSystemCs->Boot->BootNext, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"Boot/BootNext", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootNext, AsciiStringValue) != 0) {
+ ComputerSystemCs->Boot->BootNext = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle BOOT->BOOTORDER
+ //
+ if (PropertyChecker (ComputerSystemCs->Boot->BootOrder, ProvisionMode)) {
+ AsciiStringArrayValue = GetPropertyStringArrayValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"Boot/BootOrder", ConfigureLang, &ArraySize);
+ if (AsciiStringArrayValue != NULL) {
+ if (ProvisionMode || !CompareRedfishStringArrayValues (ComputerSystemCs->Boot->BootOrder, AsciiStringArrayValue, ArraySize)) {
+ AddRedfishCharArray (&ComputerSystemCs->Boot->BootOrder, AsciiStringArrayValue, ArraySize);
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle BOOT->BOOTSOURCEOVERRIDEENABLED
+ //
+ if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideEnabled, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"Boot/BootSourceOverrideEnabled", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootSourceOverrideEnabled, AsciiStringValue) != 0) {
+ ComputerSystemCs->Boot->BootSourceOverrideEnabled = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle BOOT->BOOTSOURCEOVERRIDEMODE
+ //
+ if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideMode, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"Boot/BootSourceOverrideMode", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootSourceOverrideMode, AsciiStringValue) != 0) {
+ ComputerSystemCs->Boot->BootSourceOverrideMode = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle BOOT->BOOTSOURCEOVERRIDETARGET
+ //
+ if (PropertyChecker (ComputerSystemCs->Boot->BootSourceOverrideTarget, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"Boot/BootSourceOverrideTarget", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->BootSourceOverrideTarget, AsciiStringValue) != 0) {
+ ComputerSystemCs->Boot->BootSourceOverrideTarget = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle BOOT->UEFITARGETBOOTSOURCEOVERRIDE
+ //
+ if (PropertyChecker (ComputerSystemCs->Boot->UefiTargetBootSourceOverride, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"Boot/UefiTargetBootSourceOverride", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Boot->UefiTargetBootSourceOverride, AsciiStringValue) != 0) {
+ ComputerSystemCs->Boot->UefiTargetBootSourceOverride = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ }
+
+ //
+ // Handle HOSTNAME
+ //
+ if (PropertyChecker (ComputerSystemCs->HostName, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"HostName", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->HostName, AsciiStringValue) != 0) {
+ ComputerSystemCs->HostName = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle HOSTWATCHDOGTIMER
+ //
+ if (ComputerSystemCs->HostWatchdogTimer != NULL) {
+ //
+ // Handle HOSTWATCHDOGTIMER->FUNCTIONENABLED
+ //
+ if (PropertyChecker (ComputerSystemCs->HostWatchdogTimer->FunctionEnabled, ProvisionMode)) {
+ BooleanValue = GetPropertyBooleanValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"HostWatchdogTimer/FunctionEnabled", ConfigureLang);
+ if (BooleanValue != NULL) {
+ if (ProvisionMode || *ComputerSystemCs->HostWatchdogTimer->FunctionEnabled != *BooleanValue) {
+ IntegerValue = AllocatePool (sizeof (*IntegerValue));
+ if (IntegerValue != NULL) {
+ *IntegerValue = (BooleanValue ? 0x01 : 0x00);
+ ComputerSystemCs->HostWatchdogTimer->FunctionEnabled = IntegerValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ }
+ //
+ // Handle HOSTWATCHDOGTIMER->TIMEOUTACTION
+ //
+ if (PropertyChecker (ComputerSystemCs->HostWatchdogTimer->TimeoutAction, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"HostWatchdogTimer/TimeoutAction", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->HostWatchdogTimer->TimeoutAction, AsciiStringValue) != 0) {
+ ComputerSystemCs->HostWatchdogTimer->TimeoutAction = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle HOSTWATCHDOGTIMER->WARNINGACTION
+ //
+ if (PropertyChecker (ComputerSystemCs->HostWatchdogTimer->WarningAction, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"HostWatchdogTimer/WarningAction", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->HostWatchdogTimer->WarningAction, AsciiStringValue) != 0) {
+ ComputerSystemCs->HostWatchdogTimer->WarningAction = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ }
+
+ //
+ // Handle HOSTEDSERVICES
+ //
+ if (ComputerSystemCs->HostedServices != NULL) {
+ }
+
+ //
+ // Handle HOSTINGROLES
+ //
+//// ****** Warning ******
+// Unsupported array type:
+//
+
+ //
+ // Handle INDICATORLED
+ //
+ if (PropertyChecker (ComputerSystemCs->IndicatorLED, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"IndicatorLED", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->IndicatorLED, AsciiStringValue) != 0) {
+ ComputerSystemCs->IndicatorLED = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle MANUFACTURER
+ //
+ if (PropertyChecker (ComputerSystemCs->Manufacturer, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"Manufacturer", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Manufacturer, AsciiStringValue) != 0) {
+ ComputerSystemCs->Manufacturer = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle MEMORYSUMMARY
+ //
+ if (ComputerSystemCs->MemorySummary != NULL) {
+ //
+ // Handle MEMORYSUMMARY->MEMORYMIRRORING
+ //
+ if (PropertyChecker (ComputerSystemCs->MemorySummary->MemoryMirroring, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"MemorySummary/MemoryMirroring", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->MemorySummary->MemoryMirroring, AsciiStringValue) != 0) {
+ ComputerSystemCs->MemorySummary->MemoryMirroring = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle MEMORYSUMMARY->TOTALSYSTEMMEMORYGIB
+ //
+ if (PropertyChecker (ComputerSystemCs->MemorySummary->TotalSystemMemoryGiB, ProvisionMode)) {
+ NumericValue = GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"MemorySummary/TotalSystemMemoryGiB", ConfigureLang);
+ if (NumericValue != NULL) {
+ if (ProvisionMode || *ComputerSystemCs->MemorySummary->TotalSystemMemoryGiB != *NumericValue) {
+ ComputerSystemCs->MemorySummary->TotalSystemMemoryGiB = NumericValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle MEMORYSUMMARY->TOTALSYSTEMPERSISTENTMEMORYGIB
+ //
+ if (PropertyChecker (ComputerSystemCs->MemorySummary->TotalSystemPersistentMemoryGiB, ProvisionMode)) {
+ NumericValue = GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"MemorySummary/TotalSystemPersistentMemoryGiB", ConfigureLang);
+ if (NumericValue != NULL) {
+ if (ProvisionMode || *ComputerSystemCs->MemorySummary->TotalSystemPersistentMemoryGiB != *NumericValue) {
+ ComputerSystemCs->MemorySummary->TotalSystemPersistentMemoryGiB = NumericValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ }
+
+ //
+ // Handle MODEL
+ //
+ if (PropertyChecker (ComputerSystemCs->Model, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"Model", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->Model, AsciiStringValue) != 0) {
+ ComputerSystemCs->Model = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle PCIEDEVICES
+ //
+//// ****** Warning ******
+// Unsupported array type:
+//
+
+ //
+ // Handle PCIEFUNCTIONS
+ //
+//// ****** Warning ******
+// Unsupported array type:
+//
+
+ //
+ // Handle PARTNUMBER
+ //
+ if (PropertyChecker (ComputerSystemCs->PartNumber, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"PartNumber", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->PartNumber, AsciiStringValue) != 0) {
+ ComputerSystemCs->PartNumber = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle POWERSTATE
+ //
+ if (PropertyChecker (ComputerSystemCs->PowerState, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"PowerState", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->PowerState, AsciiStringValue) != 0) {
+ ComputerSystemCs->PowerState = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle PROCESSORSUMMARY
+ //
+ if (ComputerSystemCs->ProcessorSummary != NULL) {
+ //
+ // Handle PROCESSORSUMMARY->COUNT
+ //
+ if (PropertyChecker (ComputerSystemCs->ProcessorSummary->Count, ProvisionMode)) {
+ NumericValue = GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"ProcessorSummary/Count", ConfigureLang);
+ if (NumericValue != NULL) {
+ if (ProvisionMode || *ComputerSystemCs->ProcessorSummary->Count != *NumericValue) {
+ ComputerSystemCs->ProcessorSummary->Count = NumericValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle PROCESSORSUMMARY->LOGICALPROCESSORCOUNT
+ //
+ if (PropertyChecker (ComputerSystemCs->ProcessorSummary->LogicalProcessorCount, ProvisionMode)) {
+ NumericValue = GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"ProcessorSummary/LogicalProcessorCount", ConfigureLang);
+ if (NumericValue != NULL) {
+ if (ProvisionMode || *ComputerSystemCs->ProcessorSummary->LogicalProcessorCount != *NumericValue) {
+ ComputerSystemCs->ProcessorSummary->LogicalProcessorCount = NumericValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle PROCESSORSUMMARY->MODEL
+ //
+ if (PropertyChecker (ComputerSystemCs->ProcessorSummary->Model, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"ProcessorSummary/Model", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->ProcessorSummary->Model, AsciiStringValue) != 0) {
+ ComputerSystemCs->ProcessorSummary->Model = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ }
+
+ //
+ // Handle REDUNDANCY
+ //
+//// ****** Warning ******
+// Unsupported array type:
+//
+
+ //
+ // Handle SKU
+ //
+ if (PropertyChecker (ComputerSystemCs->SKU, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"SKU", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SKU, AsciiStringValue) != 0) {
+ ComputerSystemCs->SKU = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle SERIALNUMBER
+ //
+ if (PropertyChecker (ComputerSystemCs->SerialNumber, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"SerialNumber", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SerialNumber, AsciiStringValue) != 0) {
+ ComputerSystemCs->SerialNumber = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle SUBMODEL
+ //
+ if (PropertyChecker (ComputerSystemCs->SubModel, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"SubModel", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SubModel, AsciiStringValue) != 0) {
+ ComputerSystemCs->SubModel = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle SYSTEMTYPE
+ //
+ if (PropertyChecker (ComputerSystemCs->SystemType, ProvisionMode)) {
+ AsciiStringValue = GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, L"SystemType", ConfigureLang);
+ if (AsciiStringValue != NULL) {
+ if (ProvisionMode || AsciiStrCmp (ComputerSystemCs->SystemType, AsciiStringValue) != 0) {
+ ComputerSystemCs->SystemType = AsciiStringValue;
+ PropertyChanged = TRUE;
+ }
+ }
+ }
+ //
+ // Handle TRUSTEDMODULES
+ //
+//// ****** Warning ******
+// Unsupported array type:
+//
+
+
+ //
+ // Convert C structure back to JSON text.
+ //
+ Status = JsonStructProtocol->ToJson (
+ JsonStructProtocol,
+ (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystem,
+ 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 == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ EtagStr = NULL;
+ AsciiSPrint (ResourceId, sizeof (ResourceId), "%d", Index);
+
+ Status = 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 = 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 != NULL);
+
+ //
+ // Keep location of new resource.
+ //
+ if (NewResourceLocation != NULL) {
+ RedfisSetRedfishUri (ConfigureLang, NewResourceLocation);
+ }
+
+ //
+ // Handle Etag
+ //
+ if (EtagStr != NULL) {
+ SetEtagWithUri (EtagStr, NewResourceLocation);
+ FreePool (EtagStr);
+ }
+
+RELEASE_RESOURCE:
+
+ if (NewResourceLocation != NULL) {
+ FreePool (NewResourceLocation);
+ }
+
+ if (Json != 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 == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &UnifiedConfigureLangList);
+ if (EFI_ERROR (Status) || UnifiedConfigureLangList.Count == 0) {
+ DEBUG ((DEBUG_ERROR, "%a, No HII question found with configure language: %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 collection driver).
+ //
+ EdkIIRedfishResourceSetConfigureLang (&UnifiedConfigureLangList);
+
+ for (Index = 0; Index < UnifiedConfigureLangList.Count; Index++) {
+ DEBUG ((DEBUG_INFO, "[%d] create ComputerSystem resource from: %s\n", UnifiedConfigureLangList.List[Index].Index, UnifiedConfigureLangList.List[Index].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 == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ EtagStr = NULL;
+ Json = NULL;
+ ConfigureLang = NULL;
+
+ ConfigureLang = RedfishGetConfigLanguage (Private->Uri);
+ if (ConfigureLang == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ Status = ProvisioningComputerSystemProperties (
+ Private->JsonStructProtocol,
+ ComputerSystemEmptyJson,
+ NULL,
+ ConfigureLang,
+ TRUE,
+ &Json
+ );
+ if (EFI_ERROR (Status)) {
+ if (Status == 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 failed: %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 = CreatePayloadToPatchResource (Private->RedfishService, Private->Payload, Json, &EtagStr);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, patch resource for %s failed: %r\n", __FUNCTION__, ConfigureLang, Status));
+ }
+
+ //
+ // Handle Etag
+ //
+ if (EtagStr != NULL) {
+ SetEtagWithUri (EtagStr, Private->Uri);
+ FreePool (EtagStr);
+ }
+
+ON_RELEASE:
+
+ if (Json != NULL) {
+ FreePool (Json);
+ }
+
+ if (ConfigureLang != 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 will be used.
+ FALSE if resource does not exist POST method 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 == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ return (ResourceExist ? ProvisioningComputerSystemExistResource (Private) : ProvisioningComputerSystemResources (Private));
+}
+
+/**
+ Check resource from given URI.
+
+ @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIVATE 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 == NULL || IS_EMPTY_STRING (Json)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = RedfishPlatformConfigGetConfigureLang (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigureLangList, &Count);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, BiosConfigToRedfishGetConfigureLangRegex failed: %r\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ if (Count == 0) {
+ return EFI_NOT_FOUND;
+ }
+
+ Status = EFI_SUCCESS;
+ for (Index = 0; Index < Count; Index++) {
+
+ Property = GetPropertyFromConfigureLang (Private->Uri, ConfigureLangList[Index]);
+ if (Property == 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__, Property));
+ Status = EFI_NOT_FOUND;
+ }
+ }
+
+ FreePool (ConfigureLangList);
+
+ return Status;
+}
+
+/**
+ Update resource to given URI.
+
+ @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIVATE 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 == NULL || IS_EMPTY_STRING (InputJson)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ EtagStr = NULL;
+ Json = NULL;
+ ConfigureLang = NULL;
+
+ ConfigureLang = RedfishGetConfigLanguage (Private->Uri);
+ if (ConfigureLang == NULL) {
+ return EFI_NOT_FOUND;
+ }
+
+ Status = ProvisioningComputerSystemProperties (
+ Private->JsonStructProtocol,
+ InputJson,
+ NULL,
+ ConfigureLang,
+ FALSE,
+ &Json
+ );
+ if (EFI_ERROR (Status)) {
+ if (Status == EFI_NOT_FOUND) {
+ DEBUG ((REDFISH_DEBUG_TRACE, "%a, update resource for %s ignored. Nothing changed\n", __FUNCTION__, ConfigureLang));
+ } else {
+ DEBUG ((DEBUG_ERROR, "%a, update resource for %s failed: %r\n", __FUNCTION__, ConfigureLang, Status));
+ }
+ goto ON_RELEASE;
+ }
+
+ DEBUG ((REDFISH_DEBUG_TRACE, "%a, update resource for %s\n", __FUNCTION__, ConfigureLang));
+ //
+ // PUT back to instance
+ //
+ Status = CreatePayloadToPatchResource (Private->RedfishService, Private->Payload, Json, &EtagStr);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, patch resource for %s failed: %r\n", __FUNCTION__, ConfigureLang, Status));
+ }
+
+ //
+ // Handle Etag
+ //
+ if (EtagStr != NULL) {
+ SetEtagWithUri (EtagStr, Private->Uri);
+ FreePool (EtagStr);
+ }
+
+ON_RELEASE:
+
+ if (Json != NULL) {
+ FreePool (Json);
+ }
+
+ if (ConfigureLang != NULL) {
+ FreePool (ConfigureLang);
+ }
+
+ return Status;
+}
+
+/**
+ Identify resource from given URI.
+
+ @param[in] This Pointer to REDFISH_RESOURCE_COMMON_PRIVATE 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 = RedfishIdentifyResource (Private->Uri, Private->Json);
+ if (Supported) {
+ Status = RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SCHEMA, RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, BiosConfigToRedfishGetConfigureLangRegex failed: %r\n", __FUNCTION__, Status));
+ return Status;
+ }
+
+ if (ConfigLangList.Count == 0) {
+ return EFI_SUCCESS;
+ }
+
+ EndOfChar = StrStr (ConfigLangList.List[0].ConfigureLang, L"}");
+ if (EndOfChar == NULL) {
+ ASSERT (FALSE);
+ return EFI_DEVICE_ERROR;
+ }
+
+ //EndOfChar = StrStr (ConfigLangList.List[0].ConfigureLang, L"}");
+ Status = IsRedpathArray (ConfigLangList.List[0].ConfigureLang, NULL, &EndOfChar);
+ if (EFI_ERROR (Status) && Status != EFI_NOT_FOUND) {
+ ASSERT (FALSE);
+ return EFI_DEVICE_ERROR;
+ }
+ if (Status != EFI_SUCCESS) {
+ //
+ // This is not the collection redpath.
+ //
+ GetRedpathNodeByIndex (ConfigLangList.List[0].ConfigureLang, 0, &EndOfChar);
+ }
+ *(++EndOfChar) = '\0';
+ //
+ // Keep URI and ConfigLang mapping
+ //
+ RedfisSetRedfishUri (ConfigLangList.List[0].ConfigureLang, Private->Uri);
+ //
+ // Set the configuration language in the RESOURCE_INFORMATION_EXCHANGE.
+ // This information is sent back to the parent resource (e.g. the collection driver).
+ //
+ EdkIIRedfishResourceSetConfigureLang (&ConfigLangList);
+ DestroyConfiglanguageList (&ConfigLangList);
+ return EFI_SUCCESS;
+ }
+
+ return EFI_UNSUPPORTED;
+}
diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.h b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.h
new file mode 100644
index 0000000000..64efc7fd99
--- /dev/null
+++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystemCommon.h
@@ -0,0 +1,27 @@
+/** @file
+
+ Redfish feature driver implementation - internal header file
+ (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_
+#define EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_
+
+#include <RedfishJsonStructure/ComputerSystem/v1_5_0/EfiComputerSystemV1_5_0.h>
+#include <RedfishResourceCommon.h>
+
+//
+// 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/ComputerSystemDxe.c b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.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<BR>
+
+ 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, post method is used.
+ FALSE if the resource exist but property 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 == NULL || IS_EMPTY_STRING (Uri)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ DEBUG ((DEBUG_INFO, "%a, provisioning in %s mode\n", __FUNCTION__, (PostMode ? L"POST" : L"PATCH")));
+
+ Private = REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL (This);
+
+ if (Private->RedfishService == NULL) {
+ return EFI_NOT_READY;
+ }
+
+ Status = 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 = Uri;
+ Private->Payload = Response.Payload;
+ ASSERT (Private->Payload != NULL);
+
+ Status = RedfishProvisioningResourceCommon (Private, !PostMode);
+
+ //
+ // Release resource
+ //
+ if (Private->Payload != NULL) {
+ RedfishFreeResponse (
+ Response.StatusCode,
+ Response.HeaderCount,
+ Response.Headers,
+ Response.Payload
+ );
+ Private->Payload = 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 == NULL || IS_EMPTY_STRING (Uri)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Private = REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL (This);
+
+ if (Private->RedfishService == NULL) {
+ return EFI_NOT_READY;
+ }
+
+ Status = 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 = Uri;
+ Private->Payload = Response.Payload;
+ ASSERT (Private->Payload != NULL);
+
+ Private->Json = JsonDumpString (RedfishJsonInPayload (Private->Payload), EDKII_JSON_COMPACT);
+ ASSERT (Private->Json != NULL);
+
+ //
+ // Find etag in HTTP response header
+ //
+ Etag = NULL;
+ Status = GetEtagAndLocation (&Response, &Etag, NULL);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, failed to get ETag from HTTP header\n", __FUNCTION__));
+ }
+
+ Status = RedfishConsumeResourceCommon (Private, Private->Json, Etag);
+ if (EFI_ERROR (Status)) {
+ if (Status != 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 != NULL) {
+ SetEtagWithUri (Etag, Private->Uri);
+ }
+ }
+
+ //
+ // Release resource
+ //
+ if (Private->Payload != NULL) {
+ RedfishFreeResponse (
+ Response.StatusCode,
+ Response.HeaderCount,
+ Response.Headers,
+ Response.Payload
+ );
+ Private->Payload = NULL;
+ }
+
+ if (Private->Json != NULL) {
+ FreePool (Private->Json);
+ Private->Json = 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 == NULL || Info == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Private = 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 == NULL || IS_EMPTY_STRING (Uri)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Private = REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL (This);
+
+ if (Private->RedfishService == NULL) {
+ return EFI_NOT_READY;
+ }
+
+ Status = 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 = Uri;
+ Private->Payload = Response.Payload;
+ ASSERT (Private->Payload != NULL);
+
+ Private->Json = JsonDumpString (RedfishJsonInPayload (Private->Payload), EDKII_JSON_COMPACT);
+ ASSERT (Private->Json != NULL);
+
+ Status = 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 != NULL) {
+ RedfishFreeResponse (
+ Response.StatusCode,
+ Response.HeaderCount,
+ Response.Headers,
+ Response.Payload
+ );
+ Private->Payload = NULL;
+ }
+
+ if (Private->Json != NULL) {
+ FreePool (Private->Json);
+ Private->Json = 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 == NULL || IS_EMPTY_STRING (Uri)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Private = REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL (This);
+
+ if (Private->RedfishService == NULL) {
+ return EFI_NOT_READY;
+ }
+
+ Status = 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 = Uri;
+ Private->Payload = Response.Payload;
+ ASSERT (Private->Payload != NULL);
+
+ Private->Json = JsonDumpString (RedfishJsonInPayload (Private->Payload), EDKII_JSON_COMPACT);
+ ASSERT (Private->Json != NULL);
+
+ Status = 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 != NULL) {
+ RedfishFreeResponse (
+ Response.StatusCode,
+ Response.HeaderCount,
+ Response.Headers,
+ Response.Payload
+ );
+ Private->Payload = NULL;
+ }
+
+ if (Private->Json != NULL) {
+ FreePool (Private->Json);
+ Private->Json = NULL;
+ }
+
+ return Status;
+}
+
+/**
+ Identify resource on given URI.
+
+ @param[in] This Pointer to EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL instance.
+ @param[in] Uri The target URI to consume.
+
+ @retval EFI_SUCCESS This is target resource which we want to 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 == NULL || IS_EMPTY_STRING (Uri)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Private = REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL (This);
+
+ if (Private->RedfishService == NULL) {
+ return EFI_NOT_READY;
+ }
+
+ Status = 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 = Uri;
+ Private->Payload = Response.Payload;
+ ASSERT (Private->Payload != NULL);
+
+ Private->Json = JsonDumpString (RedfishJsonInPayload (Private->Payload), EDKII_JSON_COMPACT);
+ ASSERT (Private->Json != NULL);
+
+ Status = 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 != NULL) {
+ RedfishFreeResponse (
+ Response.StatusCode,
+ Response.HeaderCount,
+ Response.Headers,
+ Response.Payload
+ );
+ Private->Payload = NULL;
+ }
+
+ if (Private->Json != NULL) {
+ FreePool (Private->Json);
+ Private->Json = NULL;
+ }
+
+ return Status;
+}
+
+EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL mRedfishResourceConfig = {
+ 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_HANDLER_PROTOCOL instance.
+ @param[in] RedfishConfigServiceInfo Redfish service informaion.
+
+ @retval EFI_SUCCESS The handler has been initialized successfully.
+ @retval EFI_DEVICE_ERROR Failed to create or configure the REST EX protocol instance.
+ @retval EFI_ALREADY_STARTED This handler has already been initialized.
+ @retval Other Error happens during the initialization.
+
+**/
+EFI_STATUS
+EFIAPI
+RedfishResourceInit (
+ IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This,
+ IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo
+ )
+{
+ REDFISH_RESOURCE_COMMON_PRIVATE *Private;
+
+ Private = REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL (This);
+
+ Private->RedfishService = RedfishCreateService (RedfishConfigServiceInfo);
+ if (Private->RedfishService == 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 successfully.
+ @retval Others Some error happened.
+
+**/
+EFI_STATUS
+EFIAPI
+RedfishResourceStop (
+ IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This
+ )
+{
+ REDFISH_RESOURCE_COMMON_PRIVATE *Private;
+
+ Private = REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_CONFIG_PROTOCOL (This);
+
+ if (Private->Event != NULL) {
+ gBS->CloseEvent (Private->Event);
+ Private->Event = NULL;
+ }
+
+ if (Private->RedfishService != NULL) {
+ RedfishCleanupService (Private->RedfishService);
+ Private->RedfishService = NULL;
+ }
+
+ if (Private->Payload != NULL) {
+ RedfishCleanupPayload (Private->Payload);
+ Private->Payload = NULL;
+ }
+
+ return EFI_SUCCESS;
+}
+
+EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHandler = {
+ 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 == NULL) {
+ return;
+ }
+
+ if (mRedfishResourcePrivate->JsonStructProtocol != NULL) {
+ return;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiRestJsonStructureProtocolGuid,
+ NULL,
+ (VOID **)&mRedfishResourcePrivate->JsonStructProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a, failed to locate gEfiRestJsonStructureProtocolGuid: %r\n", __FUNCTION__, Status));
+ }
+
+ gBS->CloseEvent (Event);
+}
+
+/**
+ Unloads an image.
+
+ @param ImageHandle Handle that identifies the image to be unloaded.
+
+ @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 == NULL) {
+ return EFI_NOT_READY;
+ }
+
+ ConfigHandler = NULL;
+
+ //
+ // Firstly, find ConfigHandler Protocol interface in this ImageHandle.
+ //
+ Status = gBS->OpenProtocol (
+ ImageHandle,
+ &gEdkIIRedfishConfigHandlerProtocolGuid,
+ (VOID **) &ConfigHandler,
+ NULL,
+ NULL,
+ EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
+ );
+ if (EFI_ERROR (Status) || ConfigHandler == NULL) {
+ return Status;
+ }
+
+ ConfigHandler->Stop (ConfigHandler);
+
+ //
+ // Last, uninstall ConfigHandler Protocol and resource protocol.
+ //
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ ImageHandle,
+ &gEdkIIRedfishConfigHandlerProtocolGuid,
+ ConfigHandler,
+ &gEdkIIRedfishResourceConfigProtocolGuid,
+ &mRedfishResourcePrivate->RedfishResourceConfig,
+ NULL
+ );
+
+ FreePool (mRedfishResourcePrivate);
+ mRedfishResourcePrivate = 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 including
+ 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 installed 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 != NULL) {
+ return EFI_ALREADY_STARTED;
+ }
+
+ medfishResourceConfigProtocolHandle = ImageHandle;
+
+ mRedfishResourcePrivate = AllocateZeroPool (sizeof (REDFISH_RESOURCE_COMMON_PRIVATE));
+ CopyMem (&mRedfishResourcePrivate->ConfigHandler, &mRedfishConfigHandler, sizeof (EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL));
+ CopyMem (&mRedfishResourcePrivate->RedfishResourceConfig, &mRedfishResourceConfig, sizeof (EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL));
+
+ //
+ // Publish config handler protocol and resource protocol.
+ //
+ Status = 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/ComputerSystemDxe.inf b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe.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<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = ComputerSystemDxe
+ FILE_GUID = 584bae05-d78d-4df9-b5e9-3e987a99480a
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = RedfishResourceEntryPoint
+ UNLOAD_IMAGE = 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/RedfishClient.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/ComputerSystemDxe.inf
INF RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.inf

!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/RedfishComputerSystem_V1_5_0_Dxe.inf
INF RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerSystemCollection_Dxe.inf
!endif
diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc b/RedfishClientPkg/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.inf {
+ <LibraryClasses>
+ RedfishResourceIdentifyLib|RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_5_0/RedfishResourceIdentifyLibComuterSystem.inf
+ }
RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.inf

!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_V1_5_0_Dxe.inf
RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerSystemCollection_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/MemoryCollection/Lib.inf
+ ComputerSystemV1_5_0Lib|RedfishClientPkg/ConverterLib/edk2library/ComputerSystem/v1_5_0/Lib.inf
ComputerSystemCollectionLib|RedfishClientPkg/ConverterLib/edk2library/ComputerSystemCollection/Lib.inf

NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf
--
2.32.0.windows.2

Join devel@edk2.groups.io to automatically receive all group messages.