Re: [edk2-devel] [edk2-redfish-client][PATCH 3/4] RedfishClientPkg: Add mechanism to reboot system if config is changed
[AMD Official Use Only - General] Reviewed-by: Abner Chang > -Original Message- > From: Nickle Wang > Sent: Friday, May 12, 2023 11:47 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > > Subject: [edk2-redfish-client][PATCH 3/4] RedfishClientPkg: Add mechanism > to reboot system if config is changed > > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. > > > 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/RedfishClientPkg.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 > reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -65,3 +65,9 @@ > > gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupE > ventGuid|{0xB3, 0x8F, 0xE8, 0x7C, 0xD7, 0x4B, 0x79, 0x46, 0x87, 0xA8, 0xA8, > 0xD8, 0xDE, 0xE5, 0x0D, 0x2B}|VOID*|0x1003 >## Default Redfish version string > > gEfiRedfishClientPkgTokenSpaceGuid.PcdDefaultRedfishVersion|L"v1"|VOID > *|0x1004 > + ## The number of seconds that the firmware will wait before system > + reboot > + > + > gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout|5| > UIN > + T16|0x2002 > + > +[PcdsDynamicEx] > + ## The flag used to indicate that system reboot is required due to > +system configuration change > + > +gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired|F > ALSE > +|BOOLEAN|0x2001 > diff --git > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib > .inf > b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib > .inf > index 84f338e6..66d5dce6 100644 > --- > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib > .inf > +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUt > +++ ilityLib.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 > reserved. > # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -49,6 +51,7 @@ >gEdkIIRedfishConfigLangMapProtocolGuid ## CONSUMED ## > > [Pcd] > + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired > > [Guids] > > diff --git > a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf > 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 > reserved. > +# > # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -40,6 +42,7 @@ >RedfishFeatureUtilityLib >UefiBootServicesTableLib >UefiDriverEntryPoint > + UefiRuntimeServicesTableLib >UefiLib > > [Protocols] > @@ -47,6 +50,8 @@ > > [Pcd] > > gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupE > ventGuid > + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired > + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout > > [Depex] >TRUE > diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h > b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h > index d2733476..14296432 100644 > ---
[edk2-devel] [edk2-redfish-client][PATCH 3/4] RedfishClientPkg: Add mechanism to reboot system if config is changed
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/RedfishClientPkg.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 reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -65,3 +65,9 @@ gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupEventGuid|{0xB3, 0x8F, 0xE8, 0x7C, 0xD7, 0x4B, 0x79, 0x46, 0x87, 0xA8, 0xA8, 0xD8, 0xDE, 0xE5, 0x0D, 0x2B}|VOID*|0x1003 ## Default Redfish version string gEfiRedfishClientPkgTokenSpaceGuid.PcdDefaultRedfishVersion|L"v1"|VOID*|0x1004 + ## The number of seconds that the firmware will wait before system reboot + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout|5|UINT16|0x2002 + +[PcdsDynamicEx] + ## The flag used to indicate that system reboot is required due to system configuration change + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired|FALSE|BOOLEAN|0x2001 diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf index 84f338e6..66d5dce6 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.inf +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib.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 reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -49,6 +51,7 @@ gEdkIIRedfishConfigLangMapProtocolGuid ## CONSUMED ## [Pcd] + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired [Guids] diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.inf 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 reserved. +# # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -40,6 +42,7 @@ RedfishFeatureUtilityLib UefiBootServicesTableLib UefiDriverEntryPoint + UefiRuntimeServicesTableLib UefiLib [Protocols] @@ -47,6 +50,8 @@ [Pcd] gEfiRedfishClientPkgTokenSpaceGuid.PcdEdkIIRedfishFeatureDriverStartupEventGuid + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootRequired + gEfiRedfishClientPkgTokenSpaceGuid.PcdRedfishSystemRebootTimeout [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. (C) Copyright 2021-2022 Hewlett Packard Enterprise Development LP + Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -14,6 +15,8 @@ #include #include +#define REDFISH_ENABLE_SYSTEM_REBOOT() PcdSetBoolS(PcdRedfishSystemRebootRequired, TRUE) + // // Definition of REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG // diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.h