From nobody Thu Dec 26 23:41:32 2024 Delivered-To: importer@patchew.org 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+114482+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1706231710995534.253294321644; Thu, 25 Jan 2024 17:15:10 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=WqaIYjYUpA4F3xeNY6DT61y4nEbPc/+MOfyjVZinKVI=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1706231710; v=1; b=ogEniKrZJPRKtMF+7a+hR8UEXMMjIeXbV3cq9mEe+U/2ZtJNnqn109Y7Sq1fTNoqHpkL/e1Y N9N05pLTCtBs7OG6YrkjHDKKTmPZIrnFYPaExSyzbxPQDBw0Blt9hCkfx/yqAPf3lo7ZsvthUyJ 540aiepOK+n3OQsgTsw3CQ7I= X-Received: by 127.0.0.2 with SMTP id hNYpYY1788612xZxxkd14LVe; Thu, 25 Jan 2024 17:15:10 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.67]) by mx.groups.io with SMTP id smtpd.web11.4405.1706231709470550695 for ; Thu, 25 Jan 2024 17:15:09 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wrf7fUnOkLLa4YeebWJ1ugbnioKDb1lbndIBM0usalenPM0WEVh6Y/v38b6cjiYEzW7GYOX4g3iggQ9Zw/EEEs9QSSErOzy+t5iZriaRAHK0TuS2puKcoKuRvyff+NtwDXZb8OD2UjnAdRIpgrIuZ+Iuy11ilTXIWcB6kNusE+VPa9nNpyYivLAg2pDhuaghGV+XUAelUFUnVomy2tlTPWwPMXW0077dufEMkHKU7MguRFMqbGkWdyiXr+C8Tt8rAmron16h6EZMfVJON0pLw/BKnklULd/ndvH96LxUPEUXbOit75CMTGg1q1dvb54JuSU4Cdwd2YMQBLlP/LDjUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=D6AtoSLOjFPyYOWaJtxPRLxPq20I/kA180Piy3T9rAo=; b=LzmNnBGsmIvvpBezU4mKV3KZ9fj4AQPYgAFHg0MCvXgI0Of7sjgpY3m9GkYb4Eh1x8vBqPCjXgKr0/Pfuki6XKT+8QO3P5NFNC7TTNqbJ5iuiiMMdbqiKKP+SIWy2aNTyoggH6+ukfh9Ph7mcrje+nPCR53qjEETwW7++Vtk3DZin6o1816eeeFGOPvY5agLflXgTUcfzJLO9KzW4meQznjJII3Egg0HOfQzzXb1Vm+rD5QkLkcebhUZx9/czxGJ3KEX4dGipvyz2iVl3k6HVw9We1NExHe/bb/mPJOB1t19xh3a9xq4oW/fSxPpPPwrlRVeZxJZHUFxQKlZtVoVeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) X-Received: from MN2PR19CA0060.namprd19.prod.outlook.com (2603:10b6:208:19b::37) by IA1PR12MB8406.namprd12.prod.outlook.com (2603:10b6:208:3da::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.22; Fri, 26 Jan 2024 01:15:06 +0000 X-Received: from BL6PEPF0001AB76.namprd02.prod.outlook.com (2603:10b6:208:19b:cafe::ae) by MN2PR19CA0060.outlook.office365.com (2603:10b6:208:19b::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.22 via Frontend Transport; Fri, 26 Jan 2024 01:15:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; 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+114482+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C X-Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB76.mail.protection.outlook.com (10.167.242.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7228.16 via Frontend Transport; Fri, 26 Jan 2024 01:15:06 +0000 X-Received: from TPE-L1-ABNCHANG.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 25 Jan 2024 19:15:03 -0600 From: "Chang, Abner via groups.io" To: CC: Nickle Wang , Igor Kulchytskyy Subject: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/FeatureDriver: ComputerSystem_1_5_0 driver Date: Fri, 26 Jan 2024 09:14:47 +0800 Message-ID: <20240126011447.1814-1-abner.chang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB76:EE_|IA1PR12MB8406:EE_ X-MS-Office365-Filtering-Correlation-Id: f295e74a-a4e2-4877-c946-08dc1e0c3b2d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: eRCQYDTsQi2BvyJZmp6LzzIMEzLxdJaJEyawpPN94AxC8sSvl9r0l8cMoDgh7rShK6v4TdKDDsjtIwGR647jDVyen1bzqJ0Mp48V8Wrhd8Vyy06KAFqXq7xT6e4XF+GLf8NTEmwiAPo3iXYbnR813xp37U83dgm01VppBGtXSqyqbljmX3RTgzhQswwFG2kUTucvrsdrN3QudJuesMRRlKlJivCPB9QDV9l8OuZzoOtKOQFEchluC8Xr+0lYMD4Yl3D7uBlLFclJOTLitgYw3dYwVgozl9x35/Ko1DS/l1F4eofkQhl8MfPP05HhvkhTZEO1dqXRgNO6MUv39T3bVPsB9tqosvskkWPeziTf0+f2ySHB66v73Qq8/3Z+6Emc7mOetlf43TBnprj1QuvSgyzHhu0hBO3eYX50dKC12w6ZRcB1SGMm1NAs54MU7kXhtAYgTkyc3by6KTee8vk56JjHTxT+YUzStGPVzwxRGRlWOU+9rwuIUyBcsJzhBK9g3x0oosrApR0Sau9Cs4347qrI06hOdfD3suYSLSixqLSxldwXlVDcjQihZdkjBKtdbwarysRwQSibzev0ihocC6IfIUaa+pC3iTvatZRuiZ78R8ttKZTjz8B9nzu8j3Ueycne+phvt9aSEH5ylYT7ysR1PfrHU00ACTTK/DRXj13qemnojzDiR+dF5JpFrXCrJpiwu0hMrT21LCN+/2KcoKNOYq6pvhe/4w14mKb1bla4Lc4W94vnOdwjvt0oQCuz/bYnNha8NiYXPR46OqT2TJ3aQDdzHQgipNBIH5vARSfHkuFN2Xv2pEHlFdqP3wL3ksS3BljHjzD/4lPhI3mZCw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 01:15:06.0596 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f295e74a-a4e2-4877-c946-08dc1e0c3b2d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB76.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8406 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: R689Ttye4HUYntmFU0tneCMcx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1706231711442100001 Content-Type: text/plain; charset="utf-8" From: Abner Chang Update Redfish ComputerSystem_1_5_0 feature driver to align the implementation with latest code. This driver handles all of ComputerSystem v1_5_0 properties and incorporate with Redfish simualtor. Signed-off-by: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy --- .../v1_5_0/Dxe/ComputerSystemDxe.inf | 1 + .../v1_5_0/Common/ComputerSystemCommon.c | 347 ++++++++++++------ .../v1_5_0/Dxe/ComputerSystemDxe.c | 64 ++-- 3 files changed, 271 insertions(+), 141 deletions(-) diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSy= stemDxe.inf b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerS= ystemDxe.inf index 36cbe06211..4e7dc5c7c5 100644 --- a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe= .inf +++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe= .inf @@ -37,6 +37,7 @@ RedfishResourceIdentifyLib UefiLib UefiDriverEntryPoint + RedfishAddendumLib RedfishHttpCacheLib =20 [Protocols] diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Compute= rSystemCommon.c b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/Co= mputerSystemCommon.c index 3ace03bd4c..7cd2a6f378 100644 --- a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystem= Common.c +++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Common/ComputerSystem= Common.c @@ -53,7 +53,7 @@ RedfishConsumeResourceCommon ( (EFI_REST_JSON_STRUCTURE_HEADER = **)&ComputerSystem ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __func__, Statu= s)); + DEBUG ((DEBUG_ERROR, "%a: ToStructure() failed: %r\n", __func__, Statu= s)); return Status; } =20 @@ -66,8 +66,8 @@ RedfishConsumeResourceCommon ( // // No change // - DEBUG ((DEBUG_MANAGEABILITY, "%a, ETAG: %s has no change, ignore consu= me action\n", __func__, Private->Uri)); - Status =3D EFI_ALREADY_STARTED; + DEBUG ((DEBUG_MANAGEABILITY, "%a: ETAG: %s has no change, ignore consu= me action\n", __func__, Private->Uri)); + Status =3D EFI_SUCCESS; goto ON_RELEASE; } =20 @@ -154,12 +154,12 @@ RedfishConsumeResourceCommon ( 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= nc__, ConfigureLang, Status)); + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); } =20 FreePool (ConfigureLang); } else { - DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __func__, Private->Uri)); + DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s= \n", __func__, Private->Uri)); } } =20 @@ -174,12 +174,12 @@ RedfishConsumeResourceCommon ( 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= nc__, ConfigureLang, Status)); + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); } =20 FreePool (ConfigureLang); } else { - DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __func__, Private->Uri)); + DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s= \n", __func__, Private->Uri)); } } =20 @@ -194,12 +194,12 @@ RedfishConsumeResourceCommon ( 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= nc__, ConfigureLang, Status)); + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); } =20 FreePool (ConfigureLang); } else { - DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __func__, Private->Uri)); + DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s= \n", __func__, Private->Uri)); } } =20 @@ -234,12 +234,12 @@ RedfishConsumeResourceCommon ( 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= nc__, ConfigureLang, Status)); + DEBUG ((DEBUG_ERROR, "%a: apply setting for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); } =20 FreePool (ConfigureLang); } else { - DEBUG ((DEBUG_ERROR, "%a, can not get configure language for URI: %s= \n", __func__, Private->Uri)); + DEBUG ((DEBUG_ERROR, "%a: can not get configure language for URI: %s= \n", __func__, Private->Uri)); } } =20 @@ -742,9 +742,9 @@ ON_RELEASE: =20 EFI_STATUS ProvisioningComputerSystemProperties ( - IN EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol, - IN CHAR8 *InputJson, - IN CHAR8 *ResourceId, OPTIONAL + IN EFI_REST_JSON_STRUCTURE_PROTOCOL *JsonStructProtocol, + IN CHAR8 *InputJson, + IN CHAR8 *ResourceId OPTIONAL, IN EFI_STRING ConfigureLang, IN BOOLEAN ProvisionMode, OUT CHAR8 **ResultJson @@ -752,6 +752,8 @@ ProvisioningComputerSystemProperties ( { EFI_REDFISH_COMPUTERSYSTEM_V1_5_0 *ComputerSystem; EFI_REDFISH_COMPUTERSYSTEM_V1_5_0_CS *ComputerSystemCs; + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0 *ComputerSystemEmpty; + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0_CS *ComputerSystemCsEmpty; EFI_STATUS Status; BOOLEAN PropertyChanged; CHAR8 *AsciiStringValue; @@ -778,17 +780,33 @@ ProvisioningComputerSystemProperties ( (EFI_REST_JSON_STRUCTURE_HEADER *= *)&ComputerSystem ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, ToStructure failure: %r\n", __func__, Status= )); + DEBUG ((DEBUG_ERROR, "%a: ToStructure failure: %r\n", __func__, Status= )); + return Status; + } + + ComputerSystemEmpty =3D NULL; + Status =3D JsonStructProtocol->ToStructure ( + JsonStructProtocol, + NULL, + ComputerSystemEmptyJson, + (EFI_REST_JSON_STRUCTURE_HEA= DER **)&ComputerSystemEmpty + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: ToStructure failure: %r\n", __func__, Status= )); return Status; } =20 ComputerSystemCs =3D ComputerSystem->ComputerSystem; + // + // Initial an empty ComputerSystemCS + // + ComputerSystemCsEmpty =3D ComputerSystemEmpty->ComputerSystem; =20 // // ID // if ((ComputerSystemCs->Id =3D=3D NULL) && !IS_EMPTY_STRING (ResourceId))= { - ComputerSystemCs->Id =3D AllocateCopyPool (AsciiStrSize (ResourceId), = ResourceId); + ComputerSystemCsEmpty->Id =3D AllocateCopyPool (AsciiStrSize (Resource= Id), ResourceId); } =20 // @@ -798,8 +816,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"AssetTag", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->AssetTag, Ascii= StringValue) !=3D 0)) { - ComputerSystemCs->AssetTag =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->AssetTag =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -811,8 +829,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"BiosVersion", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->BiosVersion, As= ciiStringValue) !=3D 0)) { - ComputerSystemCs->BiosVersion =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->BiosVersion =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -828,8 +846,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootNext", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot->BootNex= t, AsciiStringValue) !=3D 0)) { - ComputerSystemCs->Boot->BootNext =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->Boot->BootNext =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -841,7 +859,7 @@ ProvisioningComputerSystemProperties ( 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); + AddRedfishCharArray (&ComputerSystemCsEmpty->Boot->BootOrder, As= ciiStringArrayValue, ArraySize); PropertyChanged =3D TRUE; } } @@ -854,8 +872,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideEnabled", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot->BootSou= rceOverrideEnabled, AsciiStringValue) !=3D 0)) { - ComputerSystemCs->Boot->BootSourceOverrideEnabled =3D AsciiStrin= gValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->Boot->BootSourceOverrideEnabled =3D Ascii= StringValue; + PropertyChanged =3D TRUE; } } } @@ -867,8 +885,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideMode", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot->BootSou= rceOverrideMode, AsciiStringValue) !=3D 0)) { - ComputerSystemCs->Boot->BootSourceOverrideMode =3D AsciiStringVa= lue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->Boot->BootSourceOverrideMode =3D AsciiStr= ingValue; + PropertyChanged =3D TRUE; } } } @@ -880,8 +898,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/BootSourceOverrideTarget", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot->BootSou= rceOverrideTarget, AsciiStringValue) !=3D 0)) { - ComputerSystemCs->Boot->BootSourceOverrideTarget =3D AsciiString= Value; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->Boot->BootSourceOverrideTarget =3D AsciiS= tringValue; + PropertyChanged =3D TRUE; } } } @@ -893,8 +911,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"Boot/UefiTargetBootSourceOverride", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Boot->UefiTar= getBootSourceOverride, AsciiStringValue) !=3D 0)) { - ComputerSystemCs->Boot->UefiTargetBootSourceOverride =3D AsciiSt= ringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->Boot->UefiTargetBootSourceOverride =3D As= ciiStringValue; + PropertyChanged =3D TR= UE; } } } @@ -907,8 +925,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"HostName", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->HostName, Ascii= StringValue) !=3D 0)) { - ComputerSystemCs->HostName =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->HostName =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -926,9 +944,9 @@ ProvisioningComputerSystemProperties ( if (ProvisionMode || (*ComputerSystemCs->HostWatchdogTimer->Functi= onEnabled !=3D *BooleanValue)) { IntegerValue =3D AllocatePool (sizeof (*IntegerValue)); if (IntegerValue !=3D NULL) { - *IntegerValue =3D (Bool= eanValue ? 0x01 : 0x00); - ComputerSystemCs->HostWatchdogTimer->FunctionEnabled =3D Integ= erValue; - PropertyChanged =3D TRUE; + *IntegerValue =3D = (BooleanValue ? 0x01 : 0x00); + ComputerSystemCsEmpty->HostWatchdogTimer->FunctionEnabled =3D = IntegerValue; + PropertyChanged =3D = TRUE; } } } @@ -941,8 +959,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"HostWatchdogTimer/TimeoutAction", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->HostWatchdogT= imer->TimeoutAction, AsciiStringValue) !=3D 0)) { - ComputerSystemCs->HostWatchdogTimer->TimeoutAction =3D AsciiStri= ngValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->HostWatchdogTimer->TimeoutAction =3D Asci= iStringValue; + PropertyChanged =3D TRUE; } } } @@ -954,8 +972,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"HostWatchdogTimer/WarningAction", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->HostWatchdogT= imer->WarningAction, AsciiStringValue) !=3D 0)) { - ComputerSystemCs->HostWatchdogTimer->WarningAction =3D AsciiStri= ngValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->HostWatchdogTimer->WarningAction =3D Asci= iStringValue; + PropertyChanged =3D TRUE; } } } @@ -964,7 +982,7 @@ ProvisioningComputerSystemProperties ( // // Handle HOSTEDSERVICES // - if (ComputerSystemCs->HostedServices !=3D NULL) { + if (ComputerSystemCsEmpty->HostedServices !=3D NULL) { } =20 // @@ -981,8 +999,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"IndicatorLED", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->IndicatorLED, A= sciiStringValue) !=3D 0)) { - ComputerSystemCs->IndicatorLED =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->IndicatorLED =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -994,8 +1012,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"Manufacturer", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Manufacturer, A= sciiStringValue) !=3D 0)) { - ComputerSystemCs->Manufacturer =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->Manufacturer =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -1011,8 +1029,8 @@ ProvisioningComputerSystemProperties ( 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; + ComputerSystemCsEmpty->MemorySummary->MemoryMirroring =3D AsciiS= tringValue; + PropertyChanged =3D TRUE; } } } @@ -1024,8 +1042,8 @@ ProvisioningComputerSystemProperties ( NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"MemorySummary/TotalSystemMemoryGiB", ConfigureLang); if (NumericValue !=3D NULL) { if (ProvisionMode || (*ComputerSystemCs->MemorySummary->TotalSyste= mMemoryGiB !=3D *NumericValue)) { - ComputerSystemCs->MemorySummary->TotalSystemMemoryGiB =3D Numeri= cValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->MemorySummary->TotalSystemMemoryGiB =3D N= umericValue; + PropertyChanged =3D T= RUE; } } } @@ -1037,8 +1055,8 @@ ProvisioningComputerSystemProperties ( NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"MemorySummary/TotalSystemPersistentMemoryGiB", ConfigureL= ang); if (NumericValue !=3D NULL) { if (ProvisionMode || (*ComputerSystemCs->MemorySummary->TotalSyste= mPersistentMemoryGiB !=3D *NumericValue)) { - ComputerSystemCs->MemorySummary->TotalSystemPersistentMemoryGiB = =3D NumericValue; - PropertyChanged = =3D TRUE; + ComputerSystemCsEmpty->MemorySummary->TotalSystemPersistentMemor= yGiB =3D NumericValue; + PropertyChanged = =3D TRUE; } } } @@ -1051,8 +1069,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"Model", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->Model, AsciiStr= ingValue) !=3D 0)) { - ComputerSystemCs->Model =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->Model =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -1078,8 +1096,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"PartNumber", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->PartNumber, Asc= iiStringValue) !=3D 0)) { - ComputerSystemCs->PartNumber =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->PartNumber =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -1091,8 +1109,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"PowerState", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->PowerState, Asc= iiStringValue) !=3D 0)) { - ComputerSystemCs->PowerState =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->PowerState =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -1108,8 +1126,8 @@ ProvisioningComputerSystemProperties ( 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; + ComputerSystemCsEmpty->ProcessorSummary->Count =3D NumericValue; + PropertyChanged =3D TRUE; } } } @@ -1121,8 +1139,8 @@ ProvisioningComputerSystemProperties ( NumericValue =3D GetPropertyNumericValue (RESOURCE_SCHEMA, RESOURCE_= SCHEMA_VERSION, L"ProcessorSummary/LogicalProcessorCount", ConfigureLang); if (NumericValue !=3D NULL) { if (ProvisionMode || (*ComputerSystemCs->ProcessorSummary->Logical= ProcessorCount !=3D *NumericValue)) { - ComputerSystemCs->ProcessorSummary->LogicalProcessorCount =3D Nu= mericValue; - PropertyChanged =3D TR= UE; + ComputerSystemCsEmpty->ProcessorSummary->LogicalProcessorCount = =3D NumericValue; + PropertyChanged = =3D TRUE; } } } @@ -1134,8 +1152,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOUR= CE_SCHEMA_VERSION, L"ProcessorSummary/Model", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->ProcessorSumm= ary->Model, AsciiStringValue) !=3D 0)) { - ComputerSystemCs->ProcessorSummary->Model =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->ProcessorSummary->Model =3D AsciiStringVa= lue; + PropertyChanged =3D TRUE; } } } @@ -1155,8 +1173,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SKU", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->SKU, AsciiStrin= gValue) !=3D 0)) { - ComputerSystemCs->SKU =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->SKU =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -1168,8 +1186,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SerialNumber", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->SerialNumber, A= sciiStringValue) !=3D 0)) { - ComputerSystemCs->SerialNumber =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->SerialNumber =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -1181,8 +1199,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SubModel", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->SubModel, Ascii= StringValue) !=3D 0)) { - ComputerSystemCs->SubModel =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->SubModel =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -1194,8 +1212,8 @@ ProvisioningComputerSystemProperties ( AsciiStringValue =3D GetPropertyStringValue (RESOURCE_SCHEMA, RESOURCE= _SCHEMA_VERSION, L"SystemType", ConfigureLang); if (AsciiStringValue !=3D NULL) { if (ProvisionMode || (AsciiStrCmp (ComputerSystemCs->SystemType, Asc= iiStringValue) !=3D 0)) { - ComputerSystemCs->SystemType =3D AsciiStringValue; - PropertyChanged =3D TRUE; + ComputerSystemCsEmpty->SystemType =3D AsciiStringValue; + PropertyChanged =3D TRUE; } } } @@ -1212,14 +1230,24 @@ ProvisioningComputerSystemProperties ( // Status =3D JsonStructProtocol->ToJson ( JsonStructProtocol, - (EFI_REST_JSON_STRUCTURE_HEADER *)Compute= rSystem, + (EFI_REST_JSON_STRUCTURE_HEADER *)Compute= rSystemEmpty, ResultJson ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, ToJson() failed: %r\n", __func__, Status)); + DEBUG ((DEBUG_ERROR, "%a: ToJson() failed: %r\n", __func__, Status)); return Status; } =20 + if (PropertyChanged) { + // Remove Redfish unchangeable properties. + Status =3D RedfishRemoveUnchangeableProperties (ResultJson); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Fail to remove Redfish unchangeable proper= ties from ResultJson.\n", __func__)); + *ResultJson =3D NULL; + return Status; + } + } + // // Release resource. // @@ -1228,6 +1256,17 @@ ProvisioningComputerSystemProperties ( (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystem ); =20 + // + // Free memory allocated for Computersystem empty CS + // + if (ComputerSystemCsEmpty->Boot->BootOrder !=3D NULL) { + DestoryRedfishCharArray (ComputerSystemCsEmpty->Boot->BootOrder, Array= Size); + } + + JsonStructProtocol->DestoryStructure ( + JsonStructProtocol, + (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSystemEm= pty + ); return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND); } =20 @@ -1239,6 +1278,7 @@ ProvisioningComputerSystemResource ( ) { CHAR8 *Json; + CHAR8 *JsonWithAddendum; EFI_STATUS Status; EFI_STRING NewResourceLocation; CHAR8 *EtagStr; @@ -1260,13 +1300,45 @@ ProvisioningComputerSystemResource ( &Json ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, provisioning resource for %s failed: %r\n", = __func__, ConfigureLang, Status)); + DEBUG ((DEBUG_ERROR, "%a: provisioning resource for %s failed: %r\n", = __func__, ConfigureLang, Status)); return Status; } =20 + // + // Check and see if platform has OEM data or not + // + Status =3D RedfishGetOemData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; + } + + // + // Check and see if platform has addendum data or not + // + Status =3D RedfishGetAddendumData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; + } + 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", __func__, ConfigureLang, Status)); + DEBUG ((DEBUG_ERROR, "%a: post ComputerSystem resource for %s failed: = %r\n", __func__, ConfigureLang, Status)); goto RELEASE_RESOURCE; } =20 @@ -1279,16 +1351,12 @@ ProvisioningComputerSystemResource ( RedfishSetRedfishUri (ConfigureLang, NewResourceLocation); } =20 - // - // Handle Etag - // +RELEASE_RESOURCE: + if (EtagStr !=3D NULL) { - SetEtagWithUri (EtagStr, NewResourceLocation); FreePool (EtagStr); } =20 -RELEASE_RESOURCE: - if (NewResourceLocation !=3D NULL) { FreePool (NewResourceLocation); } @@ -1315,7 +1383,7 @@ ProvisioningComputerSystemResources ( =20 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", __func__, REDPATH_ARRAY_PATTERN, Status)); + DEBUG ((DEBUG_ERROR, "%a: No HII question found with configure languag= e: %s: %r\n", __func__, REDPATH_ARRAY_PATTERN, Status)); return EFI_NOT_FOUND; } =20 @@ -1341,14 +1409,13 @@ ProvisioningComputerSystemExistResource ( { EFI_STATUS Status; EFI_STRING ConfigureLang; - CHAR8 *EtagStr; CHAR8 *Json; + CHAR8 *JsonWithAddendum; =20 if (Private =3D=3D NULL) { return EFI_INVALID_PARAMETER; } =20 - EtagStr =3D NULL; Json =3D NULL; ConfigureLang =3D NULL; =20 @@ -1367,29 +1434,55 @@ ProvisioningComputerSystemExistResource ( ); 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", __func__, ConfigureLang)); + DEBUG ((DEBUG_MANAGEABILITY, "%a: provisioning existing resource for= %s ignored. Nothing changed\n", __func__, ConfigureLang)); + Status =3D EFI_SUCCESS; } else { - DEBUG ((DEBUG_ERROR, "%a, provisioning existing resource for %s fail= ed: %r\n", __func__, ConfigureLang, Status)); + DEBUG ((DEBUG_ERROR, "%a: provisioning existing resource for %s fail= ed: %r\n", __func__, ConfigureLang, Status)); } =20 goto ON_RELEASE; } =20 - DEBUG ((REDFISH_DEBUG_TRACE, "%a, provisioning existing resource for %s\= n", __func__, ConfigureLang)); // - // PUT back to instance + // Check and see if platform has OEM data or not // - 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", __func_= _, ConfigureLang, Status)); + Status =3D RedfishGetOemData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; } =20 // - // Handle Etag + // Check and see if platform has addendum data or not // - if (EtagStr !=3D NULL) { - SetEtagWithUri (EtagStr, Private->Uri); - FreePool (EtagStr); + Status =3D RedfishGetAddendumData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; + } + + DEBUG ((DEBUG_MANAGEABILITY, "%a: provisioning existing resource for %s\= n", __func__, ConfigureLang)); + + // + // PUT back to instance + // + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Privat= e->Payload, Json, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: patch resource for %s failed: %r\n", __func_= _, ConfigureLang, Status)); } =20 ON_RELEASE: @@ -1458,7 +1551,7 @@ RedfishCheckResourceCommon ( } =20 // - // Check ETAG to see if we need to check this resource again or not. + // Check ETAG to see if we need to check it // if (CheckEtag (Private->Uri, HeaderEtag, NULL)) { // @@ -1470,12 +1563,12 @@ RedfishCheckResourceCommon ( =20 Status =3D RedfishPlatformConfigGetConfigureLang (RESOURCE_SCHEMA, RESOU= RCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigureLangList, &Count); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, RedfishPlatformConfigGetConfigureLang failed= : %r\n", __func__, Status)); + DEBUG ((DEBUG_ERROR, "%a: failed: %r\n", __func__, Status)); return Status; } =20 if (Count =3D=3D 0) { - return EFI_NOT_FOUND; + return EFI_UNSUPPORTED; } =20 Status =3D EFI_SUCCESS; @@ -1485,9 +1578,9 @@ RedfishCheckResourceCommon ( continue; } =20 - DEBUG ((DEBUG_MANAGEABILITY, "%a, [%d] check attribute for: %s\n", __f= unc__, Index, Property)); + DEBUG ((DEBUG_MANAGEABILITY, "%a: [%d] check attribute for: %s\n", __f= unc__, Index, Property)); if (!MatchPropertyWithJsonContext (Property, Json)) { - DEBUG ((DEBUG_MANAGEABILITY, "%a, property is missing: %s\n", __func= __, Property)); + DEBUG ((DEBUG_MANAGEABILITY, "%a: property is missing: %s\n", __func= __, Property)); Status =3D EFI_NOT_FOUND; } } @@ -1515,14 +1608,13 @@ RedfishUpdateResourceCommon ( { EFI_STATUS Status; CHAR8 *Json; + CHAR8 *JsonWithAddendum; EFI_STRING ConfigureLang; - CHAR8 *EtagStr; =20 if ((Private =3D=3D NULL) || IS_EMPTY_STRING (InputJson)) { return EFI_INVALID_PARAMETER; } =20 - EtagStr =3D NULL; Json =3D NULL; ConfigureLang =3D NULL; =20 @@ -1541,29 +1633,55 @@ RedfishUpdateResourceCommon ( ); 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", __func__, ConfigureLang)); + DEBUG ((DEBUG_MANAGEABILITY, "%a: update resource for %s ignored. No= thing changed\n", __func__, ConfigureLang)); + Status =3D EFI_SUCCESS; } else { - DEBUG ((DEBUG_ERROR, "%a, update resource for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); + DEBUG ((DEBUG_ERROR, "%a: update resource for %s failed: %r\n", __fu= nc__, ConfigureLang, Status)); } =20 goto ON_RELEASE; } =20 - DEBUG ((REDFISH_DEBUG_TRACE, "%a, update resource for %s\n", __func__, C= onfigureLang)); // - // PUT back to instance + // Check and see if platform has OEM data or not // - 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", __func_= _, ConfigureLang, Status)); + Status =3D RedfishGetOemData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; } =20 // - // Handle Etag + // Check and see if platform has addendum data or not // - if (EtagStr !=3D NULL) { - SetEtagWithUri (EtagStr, Private->Uri); - FreePool (EtagStr); + Status =3D RedfishGetAddendumData ( + Private->Uri, + RESOURCE_SCHEMA, + RESOURCE_SCHEMA_VERSION, + Json, + &JsonWithAddendum + ); + if (!EFI_ERROR (Status) && (JsonWithAddendum !=3D NULL)) { + FreePool (Json); + Json =3D JsonWithAddendum; + JsonWithAddendum =3D NULL; + } + + DEBUG ((REDFISH_DEBUG_TRACE, "%a: update resource for %s\n", __func__, C= onfigureLang)); + + // + // PUT back to instance + // + Status =3D CreatePayloadToPatchResource (Private->RedfishService, Privat= e->Payload, Json, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: patch resource for %s failed: %r\n", __func_= _, ConfigureLang, Status)); } =20 ON_RELEASE: @@ -1604,11 +1722,12 @@ RedfishIdentifyResourceCommon ( if (Supported) { Status =3D RedfishFeatureGetUnifiedArrayTypeConfigureLang (RESOURCE_SC= HEMA, RESOURCE_SCHEMA_VERSION, REDPATH_ARRAY_PATTERN, &ConfigLangList); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, RedfishFeatureGetUnifiedArrayTypeConfigure= Lang failed: %r\n", __func__, Status)); + DEBUG ((DEBUG_ERROR, "%a: RedfishFeatureGetUnifiedArrayTypeConfigure= Lang failed: %r\n", __func__, Status)); return Status; } =20 if (ConfigLangList.Count =3D=3D 0) { + DEBUG ((DEBUG_MANAGEABILITY, " No platform Redfish ConfigureLang fo= und for %s\n", __func__, Private->Uri)); return EFI_SUCCESS; } =20 diff --git a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSy= stemDxe.c b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSys= temDxe.c index 04ff5c8270..174a8176a8 100644 --- a/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe= .c +++ b/RedfishClientPkg/Features/ComputerSystem/v1_5_0/Dxe/ComputerSystemDxe= .c @@ -15,7 +15,7 @@ extern REDFISH_RESOURCE_COMMON_PRIVATE *mRedfishResource= Private; extern EFI_HANDLE mRedfishResourceConfigProtocolHand= le; =20 /** - Provisioning redfish resource by given URI. + Provision redfish resource by given URI. =20 @param[in] This Pointer to EFI_HP_REDFISH_HII_PROTOCOL = instance. @param[in] Uri Target URI to create resource. @@ -42,7 +42,7 @@ RedfishResourceProvisioningResource ( return EFI_INVALID_PARAMETER; } =20 - DEBUG ((DEBUG_MANAGEABILITY, "%a, provisioning in %s mode\n", __func__, = (PostMode ? L"POST" : L"PATCH"))); + DEBUG ((DEBUG_MANAGEABILITY, "%a: provisioning in %s mode\n", __func__, = (PostMode ? L"POST" : L"PATCH"))); =20 Private =3D REDFISH_RESOURCE_COMMON_PRIVATE_DATA_FROM_RESOURCE_PROTOCOL = (This); =20 @@ -53,7 +53,7 @@ RedfishResourceProvisioningResource ( ZeroMem (&Response, sizeof (Response)); Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __func__, U= ri)); + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); return Status; } =20 @@ -62,6 +62,14 @@ RedfishResourceProvisioningResource ( ASSERT (Private->Payload !=3D NULL); =20 Status =3D RedfishProvisioningResourceCommon (Private, !PostMode); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: failed to provision resource to: %s: %r\n", = __func__, Uri, Status)); + } else { + // + // Get latest ETag on URI and keep it in variable. + // + SetEtagFromUri (Private->RedfishService, Private->Uri, TRUE); + } =20 // // Release resource @@ -73,7 +81,6 @@ RedfishResourceProvisioningResource ( Response.Headers, Response.Payload ); - RedfishHttpResetResource (Uri); Private->Payload =3D NULL; } =20 @@ -118,7 +125,7 @@ RedfishResourceConsumeResource ( ZeroMem (&Response, sizeof (Response)); Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __func__, U= ri)); + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); return Status; } =20 @@ -137,6 +144,7 @@ RedfishResourceConsumeResource ( Private->Uri =3D PendingSettingUri; ExpectedResponse =3D &PendingSettingResponse; } else { + DEBUG ((REDFISH_DEBUG_TRACE, "%a: No @Redfish.Settings is found\n", __= func__)); Private->Uri =3D Uri; ExpectedResponse =3D &Response; } @@ -154,16 +162,14 @@ RedfishResourceConsumeResource ( GetHttpResponseEtag (ExpectedResponse, &Etag); 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"= , __func__, Uri, Status)); - } - } else { - // - // Keep etag after consuming pending settings. - // - if (Etag !=3D NULL) { - SetEtagWithUri (Etag, Private->Uri); - } + DEBUG ((DEBUG_ERROR, "%a: failed to consume resource from: %s: %r\n", = __func__, Private->Uri, Status)); + } + + // + // Release resource + // + if (Etag !=3D NULL) { + FreePool (Etag); } =20 // @@ -196,10 +202,6 @@ RedfishResourceConsumeResource ( Private->Json =3D NULL; } =20 - if (Etag !=3D NULL) { - FreePool (Etag); - } - return Status; } =20 @@ -269,7 +271,7 @@ RedfishResourceUpdate ( ZeroMem (&Response, sizeof (Response)); Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __func__, U= ri)); + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); return Status; } =20 @@ -282,7 +284,12 @@ RedfishResourceUpdate ( =20 Status =3D RedfishUpdateResourceCommon (Private, Private->Json); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, failed to update resource from: %s: %r\n", _= _func__, Uri, Status)); + DEBUG ((DEBUG_ERROR, "%a: failed to update resource to: %s: %r\n", __f= unc__, Uri, Status)); + } else { + // + // Get latest ETag on URI and keep it in variable. + // + SetEtagFromUri (Private->RedfishService, Private->Uri, TRUE); } =20 // @@ -342,7 +349,7 @@ RedfishResourceCheck ( ZeroMem (&Response, sizeof (Response)); Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __func__, U= ri)); + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); return Status; } =20 @@ -360,12 +367,16 @@ RedfishResourceCheck ( GetHttpResponseEtag (&Response, &Etag); Status =3D RedfishCheckResourceCommon (Private, Private->Json, Etag); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, failed to check resource from: %s: %r\n", __= func__, Uri, Status)); + DEBUG ((DEBUG_ERROR, "%a: failed to check resource from: %s: %r\n", __= func__, Uri, Status)); } =20 // // Release resource // + if (Etag !=3D NULL) { + FreePool (Etag); + } + if (Private->Payload !=3D NULL) { RedfishFreeResponse ( Response.StatusCode, @@ -419,7 +430,7 @@ RedfishResourceIdentify ( ZeroMem (&Response, sizeof (Response)); Status =3D RedfishHttpGetResource (Private->RedfishService, Uri, &Respon= se, TRUE); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, get resource from: %s failed\n", __func__, U= ri)); + DEBUG ((DEBUG_ERROR, "%a: get resource from: %s failed\n", __func__, U= ri)); return Status; } =20 @@ -432,7 +443,7 @@ RedfishResourceIdentify ( =20 Status =3D RedfishIdentifyResourceCommon (Private, Private->Json); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, identify %s failed: %r\n", __func__, Uri, St= atus)); + DEBUG ((DEBUG_ERROR, "%a: identify %s failed: %r\n", __func__, Uri, St= atus)); } =20 // @@ -570,7 +581,7 @@ EfiRestJasonStructureProtocolIsReady ( (VOID **)&mRedfishResourcePrivate->JsonStructProtocol ); if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a, failed to locate gEfiRestJsonStructureProtoc= olGuid: %r\n", __func__, Status)); + DEBUG ((DEBUG_ERROR, "%a: failed to locate gEfiRestJsonStructureProtoc= olGuid: %r\n", __func__, Status)); } =20 gBS->CloseEvent (Event); @@ -645,7 +656,6 @@ RedfishResourceUnload ( @param[in] SystemTable A pointer to the EFI System Table. =20 @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 --=20 2.37.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114482): https://edk2.groups.io/g/devel/message/114482 Mute This Topic: https://groups.io/mt/103967793/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-