public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chang, Abner" <abner.chang@amd.com>
To: Nickle Wang <nicklew@nvidia.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Igor Kulchytskyy <igork@ami.com>, Nick Ramirez <nramirez@nvidia.com>
Subject: Re: [PATCH 4/5] RedfishPkg: Helper library of EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL
Date: Sun, 16 Apr 2023 04:18:41 +0000	[thread overview]
Message-ID: <MN2PR12MB3966595388BC0F03AC880E73EA9F9@MN2PR12MB3966.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20230413062101.1746-1-nicklew@nvidia.com>

[AMD Official Use Only - General]



> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Thursday, April 13, 2023 2:21 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>; Nick Ramirez <nramirez@nvidia.com>
> Subject: [PATCH 4/5] RedfishPkg: Helper library of
> EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> This is the helper library for using
> EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL.
> 
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
>  RedfishPkg/RedfishPkg.dec                     |   5 +
>  .../RedfishPlatformConfigLib.inf              |  41 +++
>  .../Library/RedfishPlatformConfigLib.h        | 143 ++++++++
>  .../RedfishPlatformConfigInternal.h           |  31 ++
>  .../RedfishPlatformConfigLib.c                | 310 ++++++++++++++++++
>  5 files changed, 530 insertions(+)
>  create mode 100644
> RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.inf
>  create mode 100644 RedfishPkg/Include/Library/RedfishPlatformConfigLib.h
>  create mode 100644
> RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigInternal
> .h
>  create mode 100644
> RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.c
> 
> diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec index
> e2892ce9cec1..cdb1528cedc9 100644
> --- a/RedfishPkg/RedfishPkg.dec
> +++ b/RedfishPkg/RedfishPkg.dec
> @@ -64,6 +64,11 @@
>    #
>    HiiUtilityLib|Include/Library/HiiUtilityLib.h
> 
> +  ##  @libraryclass  Provides the library functions to access Redfish Platform
> +  #   Config protocol.
> +  #
> +  RedfishPlatformConfigLib|Include/Library/RedfishPlatformConfigLib.h
> +
>  [LibraryClasses.Common.Private]
>    ##  @libraryclass  Provides the private C runtime library functions.
>    #   CRT library is currently used by edk2 JsonLib (open source
> diff --git
> a/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.inf
> b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.in
> f
> new file mode 100644
> index 000000000000..2258609a1c91
> --- /dev/null
> +++ b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigL
> +++ ib.inf
> @@ -0,0 +1,41 @@
> +##  @file
> +#   Library for Redfish Platform Config Protocol
> +#
> +#   (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
> +#   SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010006
> +  BASE_NAME                      = RedfishPlatformConfigLib
> +  FILE_GUID                      = C920FD62-21AC-4638-B9F5-9612942290F6
> +  MODULE_TYPE                    = DXE_DRIVER
> +  VERSION_STRING                 = 1.0
> +  LIBRARY_CLASS                  = RedfishPlatformConfigLib| DXE_DRIVER
> DXE_RUNTIME_DRIVER UEFI_APPLICATION UEFI_DRIVER
> +  CONSTRUCTOR                    = RedfishPlatformConfigLibConstructor
> +  DESTRUCTOR                     = RedfishPlatformConfigLibDestructor
> +
> +#
> +#  VALID_ARCHITECTURES           = IA32 X64 EBC RISCV64
> +#
> +
> +[Sources]
> +  RedfishPlatformConfigLib.c
> +  RedfishPlatformConfigInternal.h
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  MdeModulePkg/MdeModulePkg.dec
> +  RedfishPkg/RedfishPkg.dec
> +
> +[LibraryClasses]
> +  BaseLib
> +  BaseMemoryLib
> +  DebugLib
> +  MemoryAllocationLib
> +  UefiBootServicesTableLib
> +  UefiLib
> +
> +[Protocols]
> +  gEdkIIRedfishPlatformConfigProtocolGuid
> diff --git a/RedfishPkg/Include/Library/RedfishPlatformConfigLib.h
> b/RedfishPkg/Include/Library/RedfishPlatformConfigLib.h
> new file mode 100644
> index 000000000000..51a186163994
> --- /dev/null
> +++ b/RedfishPkg/Include/Library/RedfishPlatformConfigLib.h
> @@ -0,0 +1,143 @@
> +/** @file
> +  Definitions of RedfishPlatformConfigLib
> +
> +  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
> + Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef REDFISH_PLATFORM_CONFIG_LIB_H_
> +#define REDFISH_PLATFORM_CONFIG_LIB_H_
> +
> +#include <Protocol/EdkIIRedfishPlatformConfig.h>
> +
> +/**
> +  Get Redfish value with the given Schema and Configure Language.
> +
> +  @param[in]   Schema              The Redfish schema to query.
> +  @param[in]   Version             The Redfish version to query.
> +  @param[in]   ConfigureLang       The target value which match this configure
> Language.
> +  @param[out]  Value               The returned value.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval EFI_NOT_READY            Redfish Platform Config protocol is not
> ready.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishPlatformConfigGetValue (
> +  IN     CHAR8                *Schema,
> +  IN     CHAR8                *Version,
> +  IN     EFI_STRING           ConfigureLang,
> +  OUT    EDKII_REDFISH_VALUE  *Value
> +  );
> +
> +/**
> +  Set Redfish value with the given Schema and Configure Language.
> +
> +  @param[in]   Schema              The Redfish schema to query.
> +  @param[in]   Version             The Redfish version to query.
> +  @param[in]   ConfigureLang       The target value which match this configure
> Language.
> +  @param[in]   Value               The value to set.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval EFI_NOT_READY            Redfish Platform Config protocol is not
> ready.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishPlatformConfigSetValue (
> +  IN     CHAR8                *Schema,
> +  IN     CHAR8                *Version,
> +  IN     EFI_STRING           ConfigureLang,
> +  IN     EDKII_REDFISH_VALUE  Value
> +  );
> +
> +/**
> +  Get the list of Configure Language from platform configuration by the
> given Schema and Pattern.
> +
> +  @param[in]   Schema              The Redfish schema to query.
> +  @param[in]   Version             The Redfish version to query.
> +  @param[in]   Pattern             The target Configure Language pattern.
> +  @param[out]  ConfigureLangList   The list of Configure Language.
> +  @param[out]  Count               The number of Configure Language in
> ConfigureLangList.
> +
> +  @retval EFI_SUCCESS              ConfigureLangList is returned successfully.
> +  @retval EFI_NOT_READY            Redfish Platform Config protocol is not
> ready.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishPlatformConfigGetConfigureLang (
> +  IN     CHAR8       *Schema,
> +  IN     CHAR8       *Version,
> +  IN     EFI_STRING  Pattern,
> +  OUT    EFI_STRING  **ConfigureLangList,
> +  OUT    UINTN       *Count
> +  );
> +
> +/**
> +  Get the list of supported Redfish schema from platform configuration.
> +
> +  @param[out]  SupportedSchema     The supported schema list which is
> separated by ';'.
> +                                   For example: "x-uefi-redfish-Memory.v1_7_1;x-uefi-
> redfish-Boot.v1_0_1"
> +                                   The SupportedSchema is allocated by the callee. It's
> caller's
> +                                   responsibility to free this buffer using FreePool().
> +
> +  @retval EFI_SUCCESS              Schema is returned successfully.
> +  @retval EFI_NOT_READY            Redfish Platform Config protocol is not
> ready.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +RedfishPlatformConfigGetSupportedSchema (
> +  OUT    CHAR8  **SupportedSchema
> +  );
> +
> +/**
> +  Get Redfish attribute value with the given Schema and Configure Language.
> +
> +  @param[in]   Schema              The Redfish schema to query.
> +  @param[in]   Version             The Redfish version to query.
> +  @param[in]   ConfigureLang       The target value which match this configure
> Language.
> +  @param[out]  AttributeValue      The attribute value.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishPlatformConfigGetAttribute (
> +  IN     CHAR8                    *Schema,
> +  IN     CHAR8                    *Version,
> +  IN     EFI_STRING               ConfigureLang,
> +  OUT    EDKII_REDFISH_ATTRIBUTE  *AttributeValue
> +  );
> +
> +/**
> +  Get Redfish default value with the given Schema and Configure Language.
> +
> +  @param[in]   Schema              The Redfish schema to query.
> +  @param[in]   Version             The Redfish version to query.
> +  @param[in]   ConfigureLang       The target value which match this configure
> Language.
> +  @param[in]   DefaultClass        The UEFI defined default class.
> +                                   Please refer to UEFI spec. 33.2.5.8 "defaults" for details.
> +  @param[out]  Value               The returned value.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishPlatformConfigGetDefaultValue (
> +  IN     CHAR8                *Schema,
> +  IN     CHAR8                *Version,
> +  IN     EFI_STRING           ConfigureLang,
> +  IN     UINT16               DefaultClass,
> +  OUT    EDKII_REDFISH_VALUE  *Value
> +  );
> +
> +#endif
> diff --git
> a/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigInter
> nal.h
> b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigInter
> nal.h
> new file mode 100644
> index 000000000000..a000dc72cbd0
> --- /dev/null
> +++ b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigI
> +++ nternal.h
> @@ -0,0 +1,31 @@
> +/** @file
> +  Internal function header for Redfish Platform Config Library.
> +
> +  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef REDFISH_PLATFORM_CONFIG_H_
> +#define REDFISH_PLATFORM_CONFIG_H_
> +
> +#include <Uefi.h>
> +
> +#include <Library/BaseLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/MemoryAllocationLib.h> #include
> +<Library/RedfishPlatformConfigLib.h>
> +#include <Library/UefiLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +
> +#include <Protocol/EdkIIRedfishPlatformConfig.h>
> +
> +typedef struct {
> +  EFI_EVENT                                 ProtocolEvent; // Protocol notification event.
Please use  "///<" for the comment of structure member.

Thanks
Abner

> +  VOID                                      *Registration; // Protocol notification registration.
> +  EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL    *Protocol;
> +} REDFISH_PLATFORM_CONFIG_LIB_PRIVATE;
> +
> +#endif
> diff --git
> a/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.c
> b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.c
> new file mode 100644
> index 000000000000..3d16f7c08bf3
> --- /dev/null
> +++ b/RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigL
> +++ ib.c
> @@ -0,0 +1,310 @@
> +/** @file
> +  Wrapper function to support Redfish Platform Config protocol.
> +
> +  (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
> + Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights
> reserved.
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include "RedfishPlatformConfigInternal.h"
> +
> +REDFISH_PLATFORM_CONFIG_LIB_PRIVATE
> mRedfishPlatformConfigLibPrivate;
> +
> +/**
> +  Get Redfish value with the given Schema and Configure Language.
> +
> +  @param[in]   Schema              The Redfish schema to query.
> +  @param[in]   Version             The Redfish version to query.
> +  @param[in]   ConfigureLang       The target value which match this configure
> Language.
> +  @param[out]  Value               The returned value.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval EFI_NOT_READY            Redfish Platform Config protocol is not
> ready.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishPlatformConfigGetValue (
> +  IN     CHAR8                *Schema,
> +  IN     CHAR8                *Version,
> +  IN     EFI_STRING           ConfigureLang,
> +  OUT    EDKII_REDFISH_VALUE  *Value
> +  )
> +{
> +  if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) {
> +    return EFI_NOT_READY;
> +  }
> +
> +  return mRedfishPlatformConfigLibPrivate.Protocol->GetValue (
> +                                                      mRedfishPlatformConfigLibPrivate.Protocol,
> +                                                      Schema,
> +                                                      Version,
> +                                                      ConfigureLang,
> +                                                      Value
> +                                                      ); }
> +
> +/**
> +  Get Redfish attribute value with the given Schema and Configure Language.
> +
> +  @param[in]   Schema              The Redfish schema to query.
> +  @param[in]   Version             The Redfish version to query.
> +  @param[in]   ConfigureLang       The target value which match this configure
> Language.
> +  @param[out]  AttributeValue      The attribute value.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishPlatformConfigGetAttribute (
> +  IN     CHAR8                    *Schema,
> +  IN     CHAR8                    *Version,
> +  IN     EFI_STRING               ConfigureLang,
> +  OUT    EDKII_REDFISH_ATTRIBUTE  *AttributeValue
> +  )
> +{
> +  if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) {
> +    return EFI_NOT_READY;
> +  }
> +
> +  return mRedfishPlatformConfigLibPrivate.Protocol->GetAttribute (
> +                                                      mRedfishPlatformConfigLibPrivate.Protocol,
> +                                                      Schema,
> +                                                      Version,
> +                                                      ConfigureLang,
> +                                                      AttributeValue
> +                                                      ); }
> +
> +/**
> +  Get Redfish default value with the given Schema and Configure Language.
> +
> +  @param[in]   Schema              The Redfish schema to query.
> +  @param[in]   Version             The Redfish version to query.
> +  @param[in]   ConfigureLang       The target value which match this configure
> Language.
> +  @param[in]   DefaultClass        The UEFI defined default class.
> +                                   Please refer to UEFI spec. 33.2.5.8 "defaults" for details.
> +  @param[out]  Value               The returned value.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishPlatformConfigGetDefaultValue (
> +  IN     CHAR8                *Schema,
> +  IN     CHAR8                *Version,
> +  IN     EFI_STRING           ConfigureLang,
> +  IN     UINT16               DefaultClass,
> +  OUT    EDKII_REDFISH_VALUE  *Value
> +  )
> +{
> +  if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) {
> +    return EFI_NOT_READY;
> +  }
> +
> +  return mRedfishPlatformConfigLibPrivate.Protocol->GetDefaultValue (
> +                                                      mRedfishPlatformConfigLibPrivate.Protocol,
> +                                                      Schema,
> +                                                      Version,
> +                                                      ConfigureLang,
> +                                                      DefaultClass,
> +                                                      Value
> +                                                      ); }
> +
> +/**
> +  Set Redfish value with the given Schema and Configure Language.
> +
> +  @param[in]   Schema              The Redfish schema to query.
> +  @param[in]   Version             The Redfish version to query.
> +  @param[in]   ConfigureLang       The target value which match this configure
> Language.
> +  @param[in]   Value               The value to set.
> +
> +  @retval EFI_SUCCESS              Value is returned successfully.
> +  @retval EFI_NOT_READY            Redfish Platform Config protocol is not
> ready.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishPlatformConfigSetValue (
> +  IN     CHAR8                *Schema,
> +  IN     CHAR8                *Version,
> +  IN     EFI_STRING           ConfigureLang,
> +  IN     EDKII_REDFISH_VALUE  Value
> +  )
> +{
> +  if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) {
> +    return EFI_NOT_READY;
> +  }
> +
> +  return mRedfishPlatformConfigLibPrivate.Protocol->SetValue (
> +                                                      mRedfishPlatformConfigLibPrivate.Protocol,
> +                                                      Schema,
> +                                                      Version,
> +                                                      ConfigureLang,
> +                                                      Value
> +                                                      ); }
> +
> +/**
> +  Get the list of Configure Language from platform configuration by the
> given Schema and Pattern.
> +
> +  @param[in]   Schema              The Redfish schema to query.
> +  @param[in]   Version             The Redfish version to query.
> +  @param[in]   Pattern             The target Configure Language pattern.
> +  @param[out]  ConfigureLangList   The list of Configure Language.
> +  @param[out]  Count               The number of Configure Language in
> ConfigureLangList.
> +
> +  @retval EFI_SUCCESS              ConfigureLangList is returned successfully.
> +  @retval EFI_NOT_READY            Redfish Platform Config protocol is not
> ready.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +RedfishPlatformConfigGetConfigureLang (
> +  IN     CHAR8       *Schema,
> +  IN     CHAR8       *Version,
> +  IN     EFI_STRING  Pattern,
> +  OUT    EFI_STRING  **ConfigureLangList,
> +  OUT    UINTN       *Count
> +  )
> +{
> +  if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) {
> +    return EFI_NOT_READY;
> +  }
> +
> +  return mRedfishPlatformConfigLibPrivate.Protocol->GetConfigureLang (
> +                                                      mRedfishPlatformConfigLibPrivate.Protocol,
> +                                                      Schema,
> +                                                      Version,
> +                                                      Pattern,
> +                                                      ConfigureLangList,
> +                                                      Count
> +                                                      ); }
> +
> +/**
> +  Get the list of supported Redfish schema from platform configuration.
> +
> +  @param[out]  SupportedSchema     The supported schema list which is
> separated by ';'.
> +                                   For example: "x-uefi-redfish-Memory.v1_7_1;x-uefi-
> redfish-Boot.v1_0_1"
> +                                   The SupportedSchema is allocated by the callee. It's
> caller's
> +                                   responsibility to free this buffer using FreePool().
> +
> +  @retval EFI_SUCCESS              Schema is returned successfully.
> +  @retval EFI_NOT_READY            Redfish Platform Config protocol is not
> ready.
> +  @retval Others                   Some error happened.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +RedfishPlatformConfigGetSupportedSchema (
> +  OUT    CHAR8  **SupportedSchema
> +  )
> +{
> +  if (mRedfishPlatformConfigLibPrivate.Protocol == NULL) {
> +    return EFI_NOT_READY;
> +  }
> +
> +  return mRedfishPlatformConfigLibPrivate.Protocol->GetSupportedSchema
> (
> +                                                      mRedfishPlatformConfigLibPrivate.Protocol,
> +                                                      SupportedSchema
> +                                                      ); }
> +
> +/**
> +  This is a EFI_REDFISH_PLATFORM_CONFIG_PROTOCOL notification event
> handler.
> +
> +  Install HII package notification.
> +
> +  @param[in] Event    Event whose notification function is being invoked.
> +  @param[in] Context  Pointer to the notification function's context.
> +
> +**/
> +VOID
> +EFIAPI
> +RedfishPlatformConfigProtocolInstalled (
> +  IN  EFI_EVENT  Event,
> +  IN  VOID       *Context
> +  )
> +{
> +  EFI_STATUS  Status;
> +
> +  //
> +  // Locate EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL.
> +  //
> +  Status = gBS->LocateProtocol (
> +                  &gEdkIIRedfishPlatformConfigProtocolGuid,
> +                  NULL,
> +                  (VOID **)&mRedfishPlatformConfigLibPrivate.Protocol
> +                  );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "%a, locate
> EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL failure: %r\n",
> __FUNCTION__, Status));
> +    return;
> +  }
> +
> +  gBS->CloseEvent (Event);
> +  mRedfishPlatformConfigLibPrivate.ProtocolEvent = NULL; }
> +
> +/**
> +
> +  Create protocol listener and wait for Redfish Platform Config protocol.
> +
> +  @param ImageHandle     The image handle.
> +  @param SystemTable     The system table.
> +
> +  @retval  EFI_SUCCESS  Protocol listener is registered successfully.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +RedfishPlatformConfigLibConstructor (
> +  IN EFI_HANDLE        ImageHandle,
> +  IN EFI_SYSTEM_TABLE  *SystemTable
> +  )
> +{
> +  ZeroMem (&mRedfishPlatformConfigLibPrivate, sizeof
> +(REDFISH_PLATFORM_CONFIG_LIB_PRIVATE));
> +  mRedfishPlatformConfigLibPrivate.ProtocolEvent =
> EfiCreateProtocolNotifyEvent (
> +                                                     &gEdkIIRedfishPlatformConfigProtocolGuid,
> +                                                     TPL_CALLBACK,
> +                                                     RedfishPlatformConfigProtocolInstalled,
> +                                                     NULL,
> +                                                     &mRedfishPlatformConfigLibPrivate.Registration
> +                                                     );
> +  if (mRedfishPlatformConfigLibPrivate.ProtocolEvent == NULL) {
> +    DEBUG ((DEBUG_ERROR, "%a, failed to create protocol notify
> +event\n", __FUNCTION__));
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  Unloads the application and its installed protocol.
> +
> +  @param ImageHandle       Handle that identifies the image to be unloaded.
> +  @param  SystemTable      The system table.
> +
> +  @retval EFI_SUCCESS      The image has been unloaded.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +RedfishPlatformConfigLibDestructor (
> +  IN EFI_HANDLE        ImageHandle,
> +  IN EFI_SYSTEM_TABLE  *SystemTable
> +  )
> +{
> +  if (mRedfishPlatformConfigLibPrivate.ProtocolEvent != NULL) {
> +    gBS->CloseEvent (mRedfishPlatformConfigLibPrivate.ProtocolEvent);
> +    mRedfishPlatformConfigLibPrivate.ProtocolEvent = NULL;
> +  }
> +
> +  mRedfishPlatformConfigLibPrivate.Protocol = NULL;
> +
> +  return EFI_SUCCESS;
> +}
> --
> 2.17.1

      reply	other threads:[~2023-04-16  4:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-13  6:21 [PATCH 4/5] RedfishPkg: Helper library of EDKII_REDFISH_PLATFORM_CONFIG_PROTOCOL Nickle Wang
2023-04-16  4:18 ` Chang, Abner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR12MB3966595388BC0F03AC880E73EA9F9@MN2PR12MB3966.namprd12.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox