Re: [edk2-devel] [edk2-redfish-client][PATCH V3] RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver

2024-01-25 Thread Nickle Wang via groups.io


Reviewed-by: Nickle Wang 

Regards,
Nickle

> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Friday, January 26, 2024 10:32 AM
> To: devel@edk2.groups.io
> Cc: Nickle Wang ; Igor Kulchytskyy 
> Subject: [edk2-redfish-client][PATCH V3] RedfishClientPkg/FeatureDriver:
> ComputerSystem_1_13_0 driver
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang 
> 
> Initial version of edk2 Redfish feature of
> Redfish schema ComputerSystem_1_13_0. This driver
> handles ComputerSystem Boot properties but not all.
> 
> Signed-off-by: Abner Chang 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> ---
>  .../v1_13_0/Dxe/ComputerSystemDxe.inf |  53 ++
>  .../v1_13_0/Common/ComputerSystemCommon.h |  29 +
>  .../v1_13_0/Common/ComputerSystemCommon.c | 899
> ++
>  .../v1_13_0/Dxe/ComputerSystemDxe.c   | 702 ++
>  4 files changed, 1683 insertions(+)
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.
> inf
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyste
> mCommon.h
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyste
> mCommon.c
>  create mode 100644
> RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.
> c
> 
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemD
> xe.inf
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemD
> xe.inf
> new file mode 100644
> index 00..be1c2164d8
> --- /dev/null
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemD
> xe.inf
> @@ -0,0 +1,53 @@
> +## @file
> +#
> +#  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> +#  Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +
> +[Defines]
> +  INF_VERSION   = 0x00010005
> +  BASE_NAME = ComputerSystemDxe
> +  FILE_GUID = D94362A1-C358-4059-B014-F07D1AE04F16
> +  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
> +  RedfishAddendumLib
> +  RedfishHttpCacheLib
> +
> +[Protocols]
> +  gEdkIIRedfishConfigHandlerProtocolGuid  ## PRODUCED
> +  gEfiRestJsonStructureProtocolGuid   ## CONSUMED
> +  gEdkIIRedfishResourceConfigProtocolGuid ## PRODUCED
> +
> +[Pcd]
> +  gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize
> +  gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize
> +
> +[Depex]
> +  TRUE
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.h
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.h
> new file mode 100644
> index 00..7b83d2939c
> --- /dev/null
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.h
> @@ -0,0 +1,29 @@
> +/** @file
> +
> +  Redfish feature driver implementation - internal header file
> +  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
> +  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_
> +#define EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_
> +
> +#include
>  >
> +#include 
> +
> +//
> +// Schema information.
> +//
> +#define RESOURCE_SCHEMA  "ComputerSystem"
> +#define RESOURCE_SCHEMA_MAJOR"1"
> +#define RESOURCE_SCHEMA_MINOR"13"
> +#define RESOURCE_SCHEMA_ERRATA   "0"
> +#define RESOURCE_SCHEMA_VERSION  "v1_13_0"
> +#define REDPATH_ARRAY_PATTERNL"/Systems/\\{.*\\}/"
> +#define REDPATH_ARRAY_PREFIX L"/Systems/"
> +#define RESOURCE_SCHEMA_FULL "x-uefi-redfish-
> ComputerSystem.v1_13_0"
> +
> +#endif
> diff --git
> a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.c
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.c
> new file mode 100644
> index 00..cee6c8bf9b
> --- /dev/null
> +++
> b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSyst
> emCommon.c
> @@ -0,0 +1,899 @@
> +/** @file
> +  Redfish feature driver implementation - common functions
> +
> +  (C) Copyright 2020-2022 Hewlett 

[edk2-devel] [edk2-redfish-client][PATCH V3] RedfishClientPkg/FeatureDriver: ComputerSystem_1_13_0 driver

2024-01-25 Thread Chang, Abner via groups.io
From: Abner Chang 

Initial version of edk2 Redfish feature of
Redfish schema ComputerSystem_1_13_0. This driver
handles ComputerSystem Boot properties but not all.

Signed-off-by: Abner Chang 
Cc: Nickle Wang 
Cc: Igor Kulchytskyy 
---
 .../v1_13_0/Dxe/ComputerSystemDxe.inf |  53 ++
 .../v1_13_0/Common/ComputerSystemCommon.h |  29 +
 .../v1_13_0/Common/ComputerSystemCommon.c | 899 ++
 .../v1_13_0/Dxe/ComputerSystemDxe.c   | 702 ++
 4 files changed, 1683 insertions(+)
 create mode 100644 
RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.inf
 create mode 100644 
RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.h
 create mode 100644 
RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
 create mode 100644 
RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.c

diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.inf 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.inf
new file mode 100644
index 00..be1c2164d8
--- /dev/null
+++ b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Dxe/ComputerSystemDxe.inf
@@ -0,0 +1,53 @@
+## @file
+#
+#  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+#  Copyright (c) 2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+
+[Defines]
+  INF_VERSION   = 0x00010005
+  BASE_NAME = ComputerSystemDxe
+  FILE_GUID = D94362A1-C358-4059-B014-F07D1AE04F16
+  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
+  RedfishAddendumLib
+  RedfishHttpCacheLib
+
+[Protocols]
+  gEdkIIRedfishConfigHandlerProtocolGuid  ## PRODUCED
+  gEfiRestJsonStructureProtocolGuid   ## CONSUMED
+  gEdkIIRedfishResourceConfigProtocolGuid ## PRODUCED
+
+[Pcd]
+  gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize
+  gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize
+
+[Depex]
+  TRUE
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.h
 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.h
new file mode 100644
index 00..7b83d2939c
--- /dev/null
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.h
@@ -0,0 +1,29 @@
+/** @file
+
+  Redfish feature driver implementation - internal header file
+  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights 
reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_
+#define EFI_REDFISH_COMPUTERSYSTEM_COMMON_H_
+
+#include 

+#include 
+
+//
+// Schema information.
+//
+#define RESOURCE_SCHEMA  "ComputerSystem"
+#define RESOURCE_SCHEMA_MAJOR"1"
+#define RESOURCE_SCHEMA_MINOR"13"
+#define RESOURCE_SCHEMA_ERRATA   "0"
+#define RESOURCE_SCHEMA_VERSION  "v1_13_0"
+#define REDPATH_ARRAY_PATTERNL"/Systems/\\{.*\\}/"
+#define REDPATH_ARRAY_PREFIX L"/Systems/"
+#define RESOURCE_SCHEMA_FULL "x-uefi-redfish-ComputerSystem.v1_13_0"
+
+#endif
diff --git 
a/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
new file mode 100644
index 00..cee6c8bf9b
--- /dev/null
+++ 
b/RedfishClientPkg/Features/ComputerSystem/v1_13_0/Common/ComputerSystemCommon.c
@@ -0,0 +1,899 @@
+/** @file
+  Redfish feature driver implementation - common functions
+
+  (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP
+  Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+  Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "ComputerSystemCommon.h"
+
+CHAR8  ComputerSystemEmptyJson[] = "{\"@odata.id\": \"\", \"@odata.type\": 
\"#ComputerSystem.v1_13_0.ComputerSystem\", \"Id\": \"\", \"Name\": \"\", 
\"Boot\":{}}";
+
+REDFISH_RESOURCE_COMMON_PRIVATE  *mRedfishResourcePrivate = NULL;
+EFI_HANDLE   mRedfishResourceConfigProtocolHandle = NULL;
+
+/**
+  Consume resource from given URI.
+
+  @param[in]   This