From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.59]) by mx.groups.io with SMTP id smtpd.web11.16021.1683863254528381649 for ; Thu, 11 May 2023 20:47:34 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nvidia.com header.s=selector2 header.b=aWx8yxZP; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.220.59, mailfrom: nicklew@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EZPVFBLohIlL30wm+N6ArWGSwDN3H0urs0GjJbsUcMzWBh45H08B9dm4ENU/HhZenoQ5pUkcbUGMm/lDNURr7XNR8yczrLFHsPfwxC49tLFFwehCRC4mdLsCyEB74oTE7S8CAgMIr0r93IJLd81H1dk7m7sqB4hYpgjxJeIpw3p6wRgow+n/W1uk51VPoZKhvQyoj4AgTvE+lsgC3AeydXaxbh0fyVi7YhdgM4l+6C75CftEHXGaWGzos29EeCTkmjPfJfEIqelYwhGjCdcL0EX6ZzcHpfSynatIMfJkBTr6NlgphhwnvzGyC29XQHhw9KOgKHbkuDMMu1spnDYhKw== 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=I/MnbsMUulis6rgyLSR6+z8DqdAzeRIcyHWJy/0yH00=; b=IhgRd2ZhliJhMwzjoi2K0oP4BgMBFUCbpEyBuq9cHVAzRuTHU0PfH1DVgdS1xotjAXuvgh+9nkksgB67vQsI0A7Jvt21bUJxR28gdABWLu8Iq9Vd1GCCenBCt74f/Np5PoRimjEJ4AYg44holG0IIOTeYGjD5tsEOp+c5UXALEI381G6PB7UcTvaV1x8lqthRsyGlyUWfUE60xOZE0Gn/mmhjdQL7yB1vaFSp+a+/+UISl5RJd9eG/ENjSl9IZtGW/dWxEEPeiOh9Fg50CMfjGSUKOsz5C4x+UMPA8qOKm5DuIutv43cQwmnBa6e/hebfh8QQvB6P1/epW20DBD7Kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I/MnbsMUulis6rgyLSR6+z8DqdAzeRIcyHWJy/0yH00=; b=aWx8yxZPCEhUaRrFhFEwMgHoEfBeDu/++2vRr843zwDTmB3PND6B+Bh0OXIUMmgiAlvRDECgxAw1t2ivUsPuUs1SDv2sMbfmSwNoGoYbu4KNsHXV8QAhlUVuuTyFgy68ykHKWBCcQnyKZ3KY9HKIuTjE7IKwB+7z8PIwWZOnI3aMvXnOYn85lAaO/8GhX/Q8Zkpn3+Zzl/R5OWOp8Hz/Vdv/AM4ar/SKMD/TLPs+z1NvPGg5GhNkxRV3kYnQRaMadoW+FVNwDTWlm07xqFtpQiUarkripnUfWT02AcaShPb6ESngMDOGvENf2bz1VFRdYB1AL3RrBtMvEtyEW5wwVw== Received: from SJ0PR03CA0294.namprd03.prod.outlook.com (2603:10b6:a03:39e::29) by DM6PR12MB4942.namprd12.prod.outlook.com (2603:10b6:5:1be::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.18; Fri, 12 May 2023 03:47:32 +0000 Received: from DM6NAM11FT091.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:39e:cafe::9c) by SJ0PR03CA0294.outlook.office365.com (2603:10b6:a03:39e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.32 via Frontend Transport; Fri, 12 May 2023 03:47:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by DM6NAM11FT091.mail.protection.outlook.com (10.13.173.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.22 via Frontend Transport; Fri, 12 May 2023 03:47:31 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 11 May 2023 20:47:19 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 11 May 2023 20:47:18 -0700 Received: from NV-CL38DL3.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Thu, 11 May 2023 20:47:17 -0700 From: "Nickle Wang" To: CC: Abner Chang , Igor Kulchytskyy Subject: [edk2-redfish-client][PATCH 3/4] RedfishClientPkg: Add mechanism to reboot system if config is changed Date: Fri, 12 May 2023 11:47:17 +0800 Message-ID: <20230512034717.8627-1-nicklew@nvidia.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Return-Path: nicklew@nvidia.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT091:EE_|DM6PR12MB4942:EE_ X-MS-Office365-Filtering-Correlation-Id: fccbc049-2ad3-4f21-4a46-08db529b9d4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NUx6TGZME8y6RiPDdxkTTv2e6Nvv8W0PBfpCprrtmuY4JEnZfJ9BPQhRgSB+vvpTbYretxzs2r6us6ONf3QINqIQl21eH5vmVSKPJ9mxAQCaGnNv5iEw/pB0NMzrg9S3cWe9hDyWZlCb3oYIQsM4dcB1e8xDvvBpax7wi4YGmj6PLQtniaJeDcUmbS8jJRKQNwMGdC2/bUcQmTbhC98e5Ycxk5/6EwSbHn1L0HE3YKeDrR2BtzwuRsioESgh3n+8u5/Ltq0dSBn1sLkEBmqhjTfwpjSUoGlOf9rqaJfDxuOe99j+m9S+iRC0PCiq1LoJwGr+o/0T28tritqBHbkvrQ2WxVKZU2WgedQyXsV0/F6jOjIBVomLtRuxBiYTjIkstLZYmKTkoBlUV+6o4FQ+dTjkHvIIfe5HnWJUHkCQKehYK51OTnG/arpwdB0Dntwh0BHB5tLvpm+YG/gCHnLvOx9WRgnx9wq504XlDQTEWN3Z/gl6C96jr3i5dZA26D+ozqJxTezaiuds3AEBi4vWWyYuU2ybA3cM6rsmcDeyn3WxhQFSK17m40hwTN6LFCNxIDbaps92Zq5MlMiyF6ROaJ8IhBgH3VBSTalDDoMfY7p6anb7R2I6XSNKjYTfZdGiiYf4vSFLuBDymFgfgyzpEIbQPUllON/nexbbEYn/rGUXp5BK4UUv20cJ+i+Ka2X12++wy26/k6oX1Krl0bt7xqQX6fRO+GV2kgY6GwAlvfs9zmjRGB6US/mIfuiGUo3N X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(376002)(396003)(136003)(346002)(39860400002)(451199021)(36840700001)(46966006)(40470700004)(316002)(82310400005)(8676002)(5660300002)(8936002)(41300700001)(6916009)(4326008)(70586007)(36756003)(40460700003)(36860700001)(70206006)(83380400001)(54906003)(478600001)(186003)(1076003)(86362001)(26005)(7696005)(2906002)(30864003)(336012)(426003)(2616005)(47076005)(7636003)(82740400003)(40480700001)(356005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2023 03:47:31.3744 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fccbc049-2ad3-4f21-4a46-08db529b9d4e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT091.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4942 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain When system configuration is updated from RESTful interface, we need a system reboot so that the changes can be applied. Introduce PCD "PcdSystemRebootRequired" to RedfishClientPkg. RedfishFeatureUtility library will enable this flag when system config is updated. RedfishFeatureCore driver will check this flag and perform cold reboot after all Redfish operations are finished. PCD "PcdSystemRebootTimeout" is used to specify how many second BIOS will wait before reboot system. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy --- RedfishClientPkg/RedfishClientPkg.dec | 8 ++- .../RedfishFeatureUtilityLib.inf | 3 + .../RedfishFeatureCoreDxe.inf | 5 ++ .../Library/RedfishFeatureUtilityLib.h | 3 + .../RedfishFeatureCoreDxe.h | 3 + .../RedfishFeatureUtilityLib.c | 65 ++++++++++++++++--- .../RedfishFeatureCoreDxe.c | 40 +++++++++--- 7 files changed, 106 insertions(+), 21 deletions(-) diff --git a/RedfishClientPkg/RedfishClientPkg.dec b/RedfishClientPkg/Redfi= shClientPkg.dec index d3c97ecf..c0ab30ab 100644 --- a/RedfishClientPkg/RedfishClientPkg.dec +++ b/RedfishClientPkg/RedfishClientPkg.dec @@ -2,7 +2,7 @@ # Redfish Client Package # # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
-# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . +# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. # # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -65,3 +65,9 @@ gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupEv= entGuid|{0xB3, 0x8F, 0xE8, 0x7C, 0xD7, 0x4B, 0x79, 0x46, 0x87, 0xA8, 0xA8, = 0xD8, 0xDE, 0xE5, 0x0D, 0x2B}|VOID*|0x10000003 ## Default Redfish version string gEfiRedfishClientPkgTokenSpaceGuid.PcdDefaultRedfishVersion|L"v1"|VOID*|= 0x10000004 + ## The number of seconds that the firmware will wait before system reboo= t + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout|5|UINT1= 6|0x20000002 + +[PcdsDynamicEx] + ## The flag used to indicate that system reboot is required due to syste= m configuration change + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired|FALSE|= BOOLEAN|0x20000001 diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatu= reUtilityLib.inf b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/Redfis= hFeatureUtilityLib.inf index 84f338e6..66d5dce6 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.inf +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.inf @@ -1,6 +1,8 @@ ## @file +# INF for Redfish feature utility library. # # (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserve= d. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -49,6 +51,7 @@ gEdkIIRedfishConfigLangMapProtocolGuid ## CONSUMED ## =20 [Pcd] + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired =20 [Guids] =20 diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.i= nf b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf index ddcf9910..c67525ee 100644 --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf @@ -4,6 +4,8 @@ # drivers for the registration. # # (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserve= d. +# # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -40,6 +42,7 @@ RedfishFeatureUtilityLib UefiBootServicesTableLib UefiDriverEntryPoint + UefiRuntimeServicesTableLib UefiLib =20 [Protocols] @@ -47,6 +50,8 @@ =20 [Pcd] gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupEv= entGuid + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout =20 [Depex] TRUE diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h b/= RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h index d2733476..14296432 100644 --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h @@ -2,6 +2,7 @@ This file defines the Redfish Feature Utility Library interface. =20 (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -14,6 +15,8 @@ #include #include =20 +#define REDFISH_ENABLE_SYSTEM_REBOOT() PcdSetBoolS(PcdRedfishSystemReboot= Required, TRUE) + // // Definition of REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG // diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h= b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h index ff3c787a..a94c7930 100644 --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h @@ -2,6 +2,7 @@ Definitions of RedfishFeatureCoreDxe =20 (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -18,6 +19,8 @@ #include #include #include +#include +#include #include #include =20 diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatu= reUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishF= eatureUtilityLib.c index e87af3d5..ed8a021c 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.c +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.c @@ -2,7 +2,7 @@ Redfish feature utility library implementation =20 (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
- Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -323,7 +323,12 @@ ApplyFeatureSettingsStringType ( RedfishValue.Value.Buffer =3D FeatureValue; =20 Status =3D RedfishPlatformConfigSetValue (Schema, Version, Configure= Lang, RedfishValue); - if (EFI_ERROR (Status)) { + if (!EFI_ERROR (Status)) { + // + // Configuration changed. Enable system reboot flag. + // + REDFISH_ENABLE_SYSTEM_REBOOT (); + } else { DEBUG ((DEBUG_ERROR, "%a, apply %s to %s failed: %r\n", __FUNCTION= __, ConfigureLang, FeatureValue, Status)); } } else { @@ -383,7 +388,12 @@ ApplyFeatureSettingsNumericType ( RedfishValue.Value.Integer =3D (INT64)FeatureValue; =20 Status =3D RedfishPlatformConfigSetValue (Schema, Version, Configure= Lang, RedfishValue); - if (EFI_ERROR (Status)) { + if (!EFI_ERROR (Status)) { + // + // Configuration changed. Enable system reboot flag. + // + REDFISH_ENABLE_SYSTEM_REBOOT (); + } else { DEBUG ((DEBUG_ERROR, "%a, apply %s to 0x%x failed: %r\n", __FUNCTI= ON__, ConfigureLang, FeatureValue, Status)); } } else { @@ -443,7 +453,12 @@ ApplyFeatureSettingsBooleanType ( RedfishValue.Value.Boolean =3D FeatureValue; =20 Status =3D RedfishPlatformConfigSetValue (Schema, Version, Configure= Lang, RedfishValue); - if (EFI_ERROR (Status)) { + if (!EFI_ERROR (Status)) { + // + // Configuration changed. Enable system reboot flag. + // + REDFISH_ENABLE_SYSTEM_REBOOT (); + } else { DEBUG ((DEBUG_ERROR, "%a, apply %s to %a failed: %r\n", __FUNCTION= __, ConfigureLang, (FeatureValue ? "True" : "False"), Status)); } } else { @@ -561,7 +576,12 @@ ApplyFeatureSettingsVagueType ( FreePool (RedfishValue.Value.Buffer); RedfishValue.Value.Buffer =3D CurrentVagueValuePtr->Value->DataV= alue.CharPtr; Status =3D RedfishPlatformConfigSetValue (Sch= ema, Version, ConfigureKeyLang, RedfishValue); - if (EFI_ERROR (Status)) { + if (!EFI_ERROR (Status)) { + // + // Configuration changed. Enable system reboot flag. + // + REDFISH_ENABLE_SYSTEM_REBOOT (); + } else { DEBUG ((DEBUG_ERROR, "%a, apply %a to %a failed: %r\n", __FUNC= TION__, ConfigureKeyLang, CurrentVagueValuePtr->Value->DataValue.CharPtr, S= tatus)); } } else { @@ -588,7 +608,12 @@ ApplyFeatureSettingsVagueType ( =20 RedfishValue.Value.Boolean =3D (BOOLEAN)*CurrentVagueValuePtr->V= alue->DataValue.BoolPtr; Status =3D RedfishPlatformConfigSetValue (Sc= hema, Version, ConfigureKeyLang, RedfishValue); - if (EFI_ERROR (Status)) { + if (!EFI_ERROR (Status)) { + // + // Configuration changed. Enable system reboot flag. + // + REDFISH_ENABLE_SYSTEM_REBOOT (); + } else { DEBUG ((DEBUG_ERROR, "%a, apply %s to %a failed: %r\n", __FUNC= TION__, ConfigureKeyLang, (*CurrentVagueValuePtr->Value->DataValue.BoolPtr = ? "True" : "False"), Status)); } } else { @@ -606,7 +631,12 @@ ApplyFeatureSettingsVagueType ( =20 RedfishValue.Value.Integer =3D (INT64)*CurrentVagueValuePtr->Val= ue->DataValue.Int64Ptr; Status =3D RedfishPlatformConfigSetValue (Sc= hema, Version, ConfigureKeyLang, RedfishValue); - if (EFI_ERROR (Status)) { + if (!EFI_ERROR (Status)) { + // + // Configuration changed. Enable system reboot flag. + // + REDFISH_ENABLE_SYSTEM_REBOOT (); + } else { DEBUG ((DEBUG_ERROR, "%a, apply %s to 0x%x failed: %r\n", __FU= NCTION__, ConfigureKeyLang, *CurrentVagueValuePtr->Value->DataValue.Int64Pt= r, Status)); } } else { @@ -783,7 +813,12 @@ ApplyFeatureSettingsStringArrayType ( ASSERT (Index <=3D RedfishValue.ArrayCount); =20 Status =3D RedfishPlatformConfigSetValue (Schema, Version, Configure= Lang, RedfishValue); - if (EFI_ERROR (Status)) { + if (!EFI_ERROR (Status)) { + // + // Configuration changed. Enable system reboot flag. + // + REDFISH_ENABLE_SYSTEM_REBOOT (); + } else { DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n", __FUNCTION= __, ConfigureLang, Status)); } } else { @@ -876,7 +911,12 @@ ApplyFeatureSettingsNumericArrayType ( ASSERT (Index <=3D RedfishValue.ArrayCount); =20 Status =3D RedfishPlatformConfigSetValue (Schema, Version, Configure= Lang, RedfishValue); - if (EFI_ERROR (Status)) { + if (!EFI_ERROR (Status)) { + // + // Configuration changed. Enable system reboot flag. + // + REDFISH_ENABLE_SYSTEM_REBOOT (); + } else { DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n", __FUNCTION= __, ConfigureLang, Status)); } } else { @@ -969,7 +1009,12 @@ ApplyFeatureSettingsBooleanArrayType ( ASSERT (Index <=3D RedfishValue.ArrayCount); =20 Status =3D RedfishPlatformConfigSetValue (Schema, Version, Configure= Lang, RedfishValue); - if (EFI_ERROR (Status)) { + if (!EFI_ERROR (Status)) { + // + // Configuration changed. Enable system reboot flag. + // + REDFISH_ENABLE_SYSTEM_REBOOT (); + } else { DEBUG ((DEBUG_ERROR, "%a, apply %s array failed: %r\n", __FUNCTION= __, ConfigureLang, Status)); } } else { diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c= b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c index 0e513b16..5a3a9e4c 100644 --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c @@ -3,6 +3,7 @@ for EDK2 Redfish Feature driver registration. =20 (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP
+ Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved= . =20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -13,13 +14,14 @@ EFI_EVENT mEdkIIRedfishFeatureDriverStartupEvent; REDFISH_FEATURE_STARTUP_CONTEXT mFeatureDriverStartupContext; REDFISH_FEATURE_INTERNAL_DATA *ResourceUriNodeList; - -RESOURCE_INFORMATION_EXCHANGE *mInformationExchange; +RESOURCE_INFORMATION_EXCHANGE *mInformationExchange; =20 /** Setup the information to deliver to child feature/collection driver. + @param[in] ThisList REDFISH_FEATURE_INTERNAL_DATA insta= nce. @param[in] ParentConfgLanguageUri Parent configure language URI. + **/ EFI_STATUS SetupExchangeInformationInfo ( @@ -70,7 +72,9 @@ SetupExchangeInformationInfo ( =20 /** Destroy the exchange information. + @param[in] ThisList REDFISH_FEATURE_INTERNAL_DATA instance. + **/ EFI_STATUS DestroryExchangeInformation ( @@ -239,8 +243,10 @@ RedfishFeatureDriverStartup ( ) { REDFISH_FEATURE_STARTUP_CONTEXT *StartupContext; + UINT16 RebootTimeout; =20 StartupContext =3D (REDFISH_FEATURE_STARTUP_CONTEXT *)Context; + RebootTimeout =3D PcdGet16 (PcdRedfishSystemRebootTimeout); // // Invoke EDK2 Redfish feature driver callback to start up // the Redfish operations. @@ -258,6 +264,11 @@ RedfishFeatureDriverStartup ( return; } =20 + // + // Reset PcdRedfishSystemRebootRequired flag + // + PcdSetBoolS (PcdRedfishSystemRebootRequired, FALSE); + // // Signal event before doing provisioning // @@ -272,6 +283,16 @@ RedfishFeatureDriverStartup ( // Signal event after provisioning finished // SignalAfterProvisioningEvent (); + + // + // If system configuration is changed, reboot system. + // + if (PcdGetBool (PcdRedfishSystemRebootRequired)) { + Print (L"System configuration is changed from RESTful interface. Reboo= t system in %d seconds...\n", RebootTimeout); + gBS->Stall (RebootTimeout * 1000000U); + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); + CpuDeadLoop (); + } } =20 /** @@ -298,14 +319,14 @@ NewInternalInstance ( REDFISH_FEATURE_INTERNAL_DATA *NewInternalData; =20 if ((PtrToNewInternalData =3D=3D NULL) || (NodeName =3D=3D NULL)) { - DEBUG ((DEBUG_ERROR, "%a: Inproper given parameters\n", __func__)); + DEBUG ((DEBUG_ERROR, "%a: Inproper given parameters\n", __FUNCTION__))= ; return EFI_INVALID_PARAMETER; } =20 *PtrToNewInternalData =3D NULL; NewInternalData =3D AllocateZeroPool (sizeof (REDFISH_FEATURE_INTE= RNAL_DATA)); if (NewInternalData =3D=3D NULL) { - DEBUG ((DEBUG_ERROR, "%a: No memory for REDFISH_FEATURE_INTERNAL_DATA\= n", __func__)); + DEBUG ((DEBUG_ERROR, "%a: No memory for REDFISH_FEATURE_INTERNAL_DATA\= n", __FUNCTION__)); return EFI_OUT_OF_RESOURCES; } =20 @@ -334,7 +355,6 @@ NewInternalInstance ( The returned LIST_ENTRY is the addr= ess of ChildList link list. @param[out] MatchNodeEntry The matched node entry. - @retval EFI_SUCCESS New entry is inserted successfully. @retval EFI_INVALID_PARAMETER Improper given parameters. @retval EFI_OUT_OF_RESOURCES Lack of memory for the internal data st= ructure. @@ -357,12 +377,12 @@ InsertRedfishFeatureUriNode ( =20 *MatchNodeEntry =3D NULL; if (NodeName =3D=3D NULL) { - DEBUG ((DEBUG_ERROR, "%a: Node name is NULL.\n", __func__)); + DEBUG ((DEBUG_ERROR, "%a: Node name is NULL.\n", __FUNCTION__)); return EFI_INVALID_PARAMETER; } =20 if (NextNodeEntry =3D=3D NULL) { - DEBUG ((DEBUG_ERROR, "%a: NextNodeEntry can't be NULL.\n", __func__)); + DEBUG ((DEBUG_ERROR, "%a: NextNodeEntry can't be NULL.\n", __FUNCTION_= _)); return EFI_INVALID_PARAMETER; } =20 @@ -467,7 +487,7 @@ RedfishFeatureRegister ( BOOLEAN ItsCollection; =20 if ((FeatureManagedUri =3D=3D NULL) || (Callback =3D=3D NULL)) { - DEBUG ((DEBUG_ERROR, "%a: The given parameter is invalid\n", __func__)= ); + DEBUG ((DEBUG_ERROR, "%a: The given parameter is invalid\n", __FUNCTIO= N__)); return EFI_INVALID_PARAMETER; } =20 @@ -483,7 +503,7 @@ RedfishFeatureRegister ( while ((Index < UriLength)) { if ((Index - AnchorIndex + 1) >=3D MaxNodeNameLength) { // Increase one for the NULL terminator - DEBUG ((DEBUG_ERROR, "%a: the length of node name is >=3D MaxNodeNam= eLength\n", __func__)); + DEBUG ((DEBUG_ERROR, "%a: the length of node name is >=3D MaxNodeNam= eLength\n", __FUNCTION__)); ASSERT (FALSE); } =20 @@ -548,7 +568,7 @@ RedfishFeatureRegister ( // // No URI node was created // - DEBUG ((DEBUG_ERROR, "%a: No URI node is added\n", __func__)); + DEBUG ((DEBUG_ERROR, "%a: No URI node is added\n", __FUNCTION__)); return EFI_INVALID_PARAMETER; } =20 --=20 2.17.1