From: "Chang, Abner" <abner.chang@amd.com>
To: Nickle Wang <nickle.wang@hpe.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Yang, Atom" <Atom.Yang@amd.com>, Nick Ramirez <nramirez@nvidia.com>
Subject: Re: [edk2-staging][PATCH v3 13/15] edk2-staging/RedfishClientPkg: Introduce Computer System collection driver
Date: Thu, 28 Jul 2022 03:46:59 +0000 [thread overview]
Message-ID: <MN2PR12MB396636F598EBFAB9736FDB18EA969@MN2PR12MB3966.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20220727013802.247-14-nickle.wang@hpe.com>
[AMD Official Use Only - General]
Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Nickle Wang <nickle.wang@hpe.com>
> Sent: Wednesday, July 27, 2022 9:38 AM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Yang, Atom
> <Atom.Yang@amd.com>; Nick Ramirez <nramirez@nvidia.com>
> Subject: [edk2-staging][PATCH v3 13/15] edk2-staging/RedfishClientPkg:
> Introduce Computer System collection driver
>
> [CAUTION: External Email]
>
> Introduce new feature driver to support Computer System Collection
> schema. Update corresponding FDF and DSC file to enable this feature driver.
>
> Signed-off-by: Nickle Wang <nickle.wang@hpe.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Yang Atom <Atom.Yang@amd.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
> .../ComputerSystemCollectionDxe.c | 667 ++++++++++++++++++
> .../ComputerSystemCollectionDxe.h | 21 +
> .../ComputerSystemCollectionDxe.inf | 56 ++
> RedfishClientPkg/RedfishClient.fdf.inc | 2 +
> .../RedfishClientComponents.dsc.inc | 2 +
> RedfishClientPkg/RedfishClientLibs.dsc.inc | 1 +
> 6 files changed, 749 insertions(+)
> create mode 100644
> RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.c
> create mode 100644
> RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.h
> create mode 100644
> RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.inf
>
> diff --git
> a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> emCollectionDxe.c
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> emCollectionDxe.c
> new file mode 100644
> index 0000000000..dbf5ab3395
> --- /dev/null
> +++
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> +++ emCollectionDxe.c
> @@ -0,0 +1,667 @@
> +/** @file
> +
> + Redfish feature driver implementation - ComputerSystemCollection
> +
> + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include "ComputerSystemCollectionDxe.h"
> +
> +REDFISH_COLLECTION_PRIVATE *mRedfishCollectionPrivate = NULL;
> +
> +EFI_STATUS
> +HandleResource (
> + IN REDFISH_COLLECTION_PRIVATE *Private,
> + IN EFI_STRING Uri
> + )
> +{
> + EFI_STATUS Status;
> + REDFISH_SCHEMA_INFO SchemaInfo;
> + EFI_STRING ConfigLang;
> + EFI_STRING ReturnedConfigLang;
> + UINTN Index;
> +
> + if (Private == NULL || IS_EMPTY_STRING (Uri)) {
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + //
> + // Resource match
> + //
> +
> + DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %s\n",
> + __FUNCTION__, Uri));
> +
> + Status = GetRedfishSchemaInfo (Private->RedfishService,
> + Private->JsonStructProtocol, Uri, &SchemaInfo); if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %s
> %r\n", __FUNCTION__, Uri, Status));
> + return Status;
> + }
> + //
> + // Check and see if this is target resource that we want to handle.
> + // Some resource is handled by other provider so we have to make sure
> this first.
> + //
> + DEBUG ((REDFISH_DEBUG_TRACE, "%s Identify for %s\n", __FUNCTION__,
> + Uri)); ConfigLang = RedfishGetConfigLanguage (Uri); if (ConfigLang
> + == NULL) {
> + Status = EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, Private-
> >InformationExchange);
> + if (EFI_ERROR (Status)) {
> + if (Status == EFI_UNSUPPORTED) {
> + DEBUG ((DEBUG_INFO, "%a, \"%s\" is not handled by us\n",
> __FUNCTION__, Uri));
> + return EFI_SUCCESS;
> + }
> +
> + DEBUG ((DEBUG_ERROR, "%a, fail to identify resource: \"%s\": %r\n",
> __FUNCTION__, Uri, Status));
> + return Status;
> + }
> + } else {
> + DEBUG ((REDFISH_DEBUG_TRACE, "%a, history record found: %s\n",
> __FUNCTION__, ConfigLang));
> + //
> + // Set exchange information
> + //
> + Status = GetArrayIndexFromArrayTypeConfigureLang (ConfigLang,
> &ReturnedConfigLang, &Index);
> + if (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND) {
> + Private->InformationExchange->ReturnedInformation.Type =
> InformationTypeCollectionMemberConfigLanguage;
> + Private->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList.Count = 1;
> + Private->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList.List =
> + AllocateZeroPool(sizeof
> + (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG));
> +
> + if (Private->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList.List == NULL) {
> + DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for
> REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG.\n", __FUNCTION__));
> + return EFI_OUT_OF_RESOURCES;
> + }
> + Private->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList.List [0].Index = Index;
> + Private->InformationExchange-
> >ReturnedInformation.ConfigureLanguageList.List [0].ConfigureLang =
> + (EFI_STRING)AllocateCopyPool(StrSize(ReturnedConfigLang), (VOID
> *)ReturnedConfigLang);
> + } else {
> + DEBUG ((DEBUG_ERROR, "%a,
> GetArrayIndexFromArrayTypeConfigureLang fail: %r\n", __FUNCTION__,
> Status));
> + }
> + FreePool (ConfigLang);
> + }
> +
> + //
> + // Check and see if target property exist or not even when collection
> memeber exists.
> + // If not, we sill do provision.
> + //
> + DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __FUNCTION__,
> + Uri)); Status = EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri);
> + if (EFI_ERROR (Status)) {
> + //
> + // The target property does not exist, do the provision to create property.
> + //
> + DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n",
> __FUNCTION__, Uri));
> + Status = EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, Uri,
> Private->InformationExchange, FALSE);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to provision with GET mode: %r\n",
> __FUNCTION__, Status));
> + }
> +
> + return Status;
> + }
> +
> + //
> + // Consume first.
> + //
> + DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %s\n",
> __FUNCTION__,
> + Uri)); Status = EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to consume resoruce for: %s:
> + %r\n", __FUNCTION__, Uri, Status)); }
> +
> + //
> + // Patch.
> + //
> + DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %s\n", __FUNCTION__,
> + Uri)); Status = EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to update resoruce for: %s: %r\n",
> + __FUNCTION__, Uri, Status)); }
> +
> + return Status;
> +}
> +
> +EFI_STATUS
> +HandleCollectionResource (
> + IN REDFISH_COLLECTION_PRIVATE *Private
> + )
> +{
> + EFI_STATUS Status;
> + EFI_REDFISH_COMPUTERSYSTEMCOLLECTION *Collection;
> + EFI_REDFISH_COMPUTERSYSTEMCOLLECTION_CS *CollectionCs;
> + RedfishCS_Link *List;
> + RedfishCS_Header *Header;
> + RedfishCS_Type_Uri_Data *UriData;
> + EFI_STRING MemberUri;
> +
> + if (Private == NULL) {
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + if (Private->JsonStructProtocol == NULL || Private->CollectionJson ==
> NULL) {
> + return EFI_NOT_READY;
> + }
> +
> + DEBUG ((REDFISH_DEBUG_TRACE, "%a, process collection for: %s\n",
> + __FUNCTION__, Private->CollectionUri));
> +
> + //
> + // Convert JSON text to C structure.
> + //
> + Status = Private->JsonStructProtocol->ToStructure (
> + Private->JsonStructProtocol,
> + NULL,
> + Private->CollectionJson,
> + (EFI_REST_JSON_STRUCTURE_HEADER **)&Collection
> + ); if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n",
> __FUNCTION__, Status));
> + return Status;
> + }
> +
> + CollectionCs = Collection->ComputerSystemCollection;
> +
> + if (*CollectionCs->Membersodata_count == 0) {
> + return EFI_NOT_FOUND;
> + }
> +
> + if (IsLinkEmpty (&CollectionCs->Members)) {
> + return EFI_NOT_FOUND;
> + }
> +
> + List = GetFirstLink (&CollectionCs->Members); while (TRUE) {
> +
> + Header = (RedfishCS_Header *)List;
> + if (Header->ResourceType == RedfishCS_Type_Uri) {
> + UriData = (RedfishCS_Type_Uri_Data *)Header;
> + MemberUri = NULL;
> + MemberUri = StrAsciiToUnicode (UriData->Uri);
> + ASSERT (MemberUri != NULL);
> + if (MemberUri != NULL) {
> + Status = HandleResource (Private, MemberUri);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, process ComputerSystemCollection
> resource: %a failed: %r\n", __FUNCTION__, UriData->Uri, Status));
> + }
> +
> + FreePool (MemberUri);
> + }
> + }
> +
> + if (IsLinkAtEnd (&CollectionCs->Members, List)) {
> + break;
> + }
> +
> + List = GetNextLink (&CollectionCs->Members, List); }
> +
> + //
> + // Release resource.
> + //
> + Private->JsonStructProtocol->DestoryStructure
> + (Private->JsonStructProtocol, (EFI_REST_JSON_STRUCTURE_HEADER
> + *)Collection);
> +
> + return EFI_SUCCESS;
> +}
> +
> +EFI_STATUS
> +CreateCollectionResource (
> + IN REDFISH_COLLECTION_PRIVATE *Private
> + )
> +{
> + EFI_STATUS Status;
> + REDFISH_SCHEMA_INFO SchemaInfo;
> +
> + if (Private == NULL) {
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + DEBUG ((REDFISH_DEBUG_TRACE, "%a, create resource for collection for:
> + %s\n", __FUNCTION__, Private->CollectionUri));
> +
> + Status = GetSupportedSchemaVersion (REDFISH_SCHEMA_NAME,
> + &SchemaInfo); if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to find supported schema from HII
> database: %r\n", __FUNCTION__, Status));
> + return Status;
> + }
> +
> + DEBUG ((REDFISH_DEBUG_TRACE, "%a, supported schema: %a
> %a.%a.%a\n",
> + __FUNCTION__, SchemaInfo.Schema, SchemaInfo.Major,
> SchemaInfo.Minor,
> + SchemaInfo.Errata));
> +
> + Status = EdkIIRedfishResourceConfigProvisionging (&SchemaInfo,
> + Private->CollectionUri, Private->InformationExchange, TRUE); if
> (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to create resoruce for: %s: %r\n",
> + __FUNCTION__, Private->CollectionUri, Status)); }
> +
> + return Status;
> +}
> +
> +EFI_STATUS
> +ReleaseCollectionResource (
> + IN REDFISH_COLLECTION_PRIVATE *Private
> + )
> +{
> +
> + if (Private == NULL) {
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + //
> + // Release resource
> + //
> + if (Private->RedResponse.Payload != NULL) {
> + RedfishFreeResponse (
> + Private->RedResponse.StatusCode,
> + Private->RedResponse.HeaderCount,
> + Private->RedResponse.Headers,
> + Private->RedResponse.Payload
> + );
> + Private->RedResponse.StatusCode = NULL;
> + Private->RedResponse.HeaderCount = 0;
> + Private->RedResponse.Headers = NULL;
> + Private->RedResponse.Payload = NULL; }
> +
> + if (Private->CollectionJson != NULL) {
> + FreePool (Private->CollectionJson);
> + Private->CollectionJson = NULL;
> + }
> +
> + if (Private->RedfishVersion != NULL) {
> + FreePool (Private->RedfishVersion);
> + Private->RedfishVersion = NULL;
> + }
> +
> + return EFI_SUCCESS;
> +}
> +
> +EFI_STATUS
> +CollectionHandler (
> + IN REDFISH_COLLECTION_PRIVATE *Private
> + )
> +{
> + EFI_STATUS Status;
> +
> + if (Private == NULL) {
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + DEBUG ((REDFISH_DEBUG_TRACE, "%a, collection handler for %s\n",
> + __FUNCTION__, Private->CollectionUri));
> +
> + //
> + // Query collection from Redfish service.
> + //
> + Status = GetResourceByUri (Private->RedfishService,
> + Private->CollectionUri, &Private->RedResponse); if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, unable to get resource from: %s :%r\n",
> __FUNCTION__, Private->CollectionUri, Status));
> + goto ON_RELEASE;
> + }
> +
> + Private->CollectionPayload = Private->RedResponse.Payload; ASSERT
> + (Private->CollectionPayload != NULL);
> +
> + Private->CollectionJson = JsonDumpString (RedfishJsonInPayload
> + (Private->CollectionPayload), EDKII_JSON_COMPACT); ASSERT
> + (Private->CollectionJson != NULL);
> +
> + Status = HandleCollectionResource (Private); if (EFI_ERROR (Status)
> + && Status == EFI_NOT_FOUND) {
> + Status = CreateCollectionResource (Private); }
> +
> +ON_RELEASE:
> +
> + ReleaseCollectionResource (Private);
> +
> + return Status;
> +}
> +
> +/**
> + The callback function provided by Redfish Feature driver.
> +
> + @param[in] This Pointer to EDKII_REDFISH_FEATURE_PROTOCOL
> instance.
> + @param[in] FeatureAction The action Redfish feature driver should
> take.
> + @param[in] Uri The collection URI.
> + @param[in] Context The context of Redfish feature driver.
> + @param[in,out] InformationExchange The pointer to
> + RESOURCE_INFORMATION_EXCHANGE
> +
> + @retval EFI_SUCCESS Redfish feature driver callback is executed
> successfully.
> + @retval Others Some errors happened.
> +
> + @retval EFI_SUCCESS Redfish feature driver callback is executed
> successfully.
> + @retval Others Some errors happened.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +RedfishCollectionFeatureCallback (
> + IN EDKII_REDFISH_FEATURE_PROTOCOL *This,
> + IN FEATURE_CALLBACK_ACTION FeatureAction,
> + IN VOID *Context,
> + IN OUT RESOURCE_INFORMATION_EXCHANGE *InformationExchange
> + )
> +{
> + EFI_STATUS Status;
> + REDFISH_SERVICE RedfishService;
> + REDFISH_COLLECTION_PRIVATE *Private;
> + EFI_STRING ResourceUri;
> +
> + if (FeatureAction != CallbackActionStartOperation) {
> + return EFI_UNSUPPORTED;
> + }
> +
> + Private = (REDFISH_COLLECTION_PRIVATE *)Context;
> +
> + RedfishService = Private->RedfishService; if (RedfishService ==
> + NULL) {
> + return EFI_NOT_READY;
> + }
> +
> + //
> + // Save in private structure.
> + //
> + Private->InformationExchange = InformationExchange;
> +
> + //
> + // Find Redfish version on BMC
> + //
> + Private->RedfishVersion = RedfishGetVersion (RedfishService);
> +
> + //
> + // Create the full URI from Redfish service root.
> + //
> + ResourceUri = (EFI_STRING)AllocateZeroPool (MAX_URI_LENGTH *
> + sizeof(CHAR16)); if (ResourceUri == NULL) {
> + DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for full URI.\n",
> __FUNCTION__));
> + return EFI_OUT_OF_RESOURCES;
> + }
> + StrCatS (ResourceUri, MAX_URI_LENGTH, Private->RedfishVersion);
> + StrCatS (ResourceUri, MAX_URI_LENGTH,
> + InformationExchange->SendInformation.FullUri);
> +
> + //
> + // Initialize collection path
> + //
> + Private->CollectionUri = RedfishGetUri (ResourceUri); if
> + (Private->CollectionUri == NULL) {
> + ASSERT (FALSE);
> + return EFI_OUT_OF_RESOURCES;
> + }
> +
> + Status = CollectionHandler (Private); if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, CollectionHandler failure: %r\n",
> + __FUNCTION__, Status)); }
> +
> + return EFI_SUCCESS;
> +}
> +
> +/**
> + Initialize a Redfish configure handler.
> +
> + This function will be called by the Redfish config driver to
> + initialize each Redfish configure handler.
> +
> + @param[in] This Pointer to
> EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL instance.
> + @param[in] RedfishConfigServiceInfo Redfish service informaion.
> +
> + @retval EFI_SUCCESS The handler has been initialized successfully.
> + @retval EFI_DEVICE_ERROR Failed to create or configure the REST EX
> protocol instance.
> + @retval EFI_ALREADY_STARTED This handler has already been
> initialized.
> + @retval Other Error happens during the initialization.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +RedfishCollectionInit (
> + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This,
> + IN REDFISH_CONFIG_SERVICE_INFORMATION
> *RedfishConfigServiceInfo
> + )
> +{
> + REDFISH_COLLECTION_PRIVATE *Private;
> +
> + Private = REDFISH_COLLECTION_PRIVATE_DATA_FROM_PROTOCOL (This);
> +
> + Private->RedfishService = RedfishCreateService
> + (RedfishConfigServiceInfo); if (Private->RedfishService == NULL) {
> + return EFI_DEVICE_ERROR;
> + }
> +
> + return EFI_SUCCESS;
> +}
> +
> +/**
> + Stop a Redfish configure handler.
> +
> + @param[in] This Pointer to
> EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL instance.
> +
> + @retval EFI_SUCCESS This handler has been stoped successfully.
> + @retval Others Some error happened.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +RedfishCollectionStop (
> + IN EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *This
> + )
> +{
> + REDFISH_COLLECTION_PRIVATE *Private;
> +
> + Private = REDFISH_COLLECTION_PRIVATE_DATA_FROM_PROTOCOL (This);
> +
> + if (Private->RedfishService != NULL) {
> + RedfishCleanupService (Private->RedfishService);
> + Private->RedfishService = NULL;
> + }
> +
> + ReleaseCollectionResource (Private);
> +
> + if (Private->FeatureProtocol != NULL) {
> + Private->FeatureProtocol->Unregister (
> + Private->FeatureProtocol,
> + REDFISH_MANAGED_URI,
> + NULL
> + );
> + }
> +
> + return EFI_SUCCESS;
> +}
> +
> +/**
> + Callback function when gEfiRestJsonStructureProtocolGuid is installed.
> +
> + @param[in] Event Event whose notification function is being invoked.
> + @param[in] Context Pointer to the notification function's context.
> +**/
> +VOID
> +EFIAPI
> +EfiRestJasonStructureProtocolIsReady
> + (
> + IN EFI_EVENT Event,
> + IN VOID *Context
> + )
> +{
> + EFI_STATUS Status;
> +
> + if (mRedfishCollectionPrivate == NULL) {
> + return;
> + }
> +
> + if (mRedfishCollectionPrivate->JsonStructProtocol != NULL) {
> + return;
> + }
> +
> + Status = gBS->LocateProtocol (
> + &gEfiRestJsonStructureProtocolGuid,
> + NULL,
> + (VOID **)&mRedfishCollectionPrivate->JsonStructProtocol
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to locate
> + gEfiRestJsonStructureProtocolGuid: %r\n", __FUNCTION__, Status)); }
> +
> + gBS->CloseEvent (Event);
> +}
> +
> +/**
> + Callback function when gEdkIIRedfishFeatureProtocolGuid is installed.
> +
> + @param[in] Event Event whose notification function is being invoked.
> + @param[in] Context Pointer to the notification function's context.
> +**/
> +VOID
> +EFIAPI
> +EdkIIRedfishFeatureProtocolIsReady
> + (
> + IN EFI_EVENT Event,
> + IN VOID *Context
> + )
> +{
> + EFI_STATUS Status;
> + EDKII_REDFISH_FEATURE_PROTOCOL *FeatureProtocol;
> +
> + if (mRedfishCollectionPrivate == NULL) {
> + return;
> + }
> +
> + if (mRedfishCollectionPrivate->FeatureProtocol != NULL) {
> + return;
> + }
> +
> + Status = gBS->LocateProtocol (
> + &gEdkIIRedfishFeatureProtocolGuid,
> + NULL,
> + (VOID **)&FeatureProtocol
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to locate
> gEdkIIRedfishFeatureProtocolGuid: %r\n", __FUNCTION__, Status));
> + gBS->CloseEvent (Event);
> + return;
> + }
> +
> + Status = FeatureProtocol->Register (
> + FeatureProtocol,
> + REDFISH_MANAGED_URI,
> + RedfishCollectionFeatureCallback,
> + (VOID *)mRedfishCollectionPrivate
> + );
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a, failed to register %s: %r\n",
> + __FUNCTION__, REDFISH_MANAGED_URI, Status)); }
> +
> + mRedfishCollectionPrivate->FeatureProtocol = FeatureProtocol;
> +
> + gBS->CloseEvent (Event);
> +}
> +
> +/**
> + Unloads an image.
> +
> + @param ImageHandle Handle that identifies the image to be
> unloaded.
> +
> + @retval EFI_SUCCESS The image has been unloaded.
> + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image
> handle.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +RedfishCollectionUnload (
> + IN EFI_HANDLE ImageHandle
> + )
> +{
> + EFI_STATUS Status;
> + EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL *ConfigHandler;
> +
> + if (mRedfishCollectionPrivate == NULL) {
> + return EFI_NOT_READY;
> + }
> +
> + ConfigHandler = NULL;
> +
> + //
> + // Firstly, find ConfigHandler Protocol interface in this ImageHandle.
> + //
> + Status = gBS->OpenProtocol (
> + ImageHandle,
> + &gEdkIIRedfishConfigHandlerProtocolGuid,
> + (VOID **) &ConfigHandler,
> + NULL,
> + NULL,
> + EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
> + );
> + if (EFI_ERROR (Status) || ConfigHandler == NULL) {
> + return Status;
> + }
> +
> + ConfigHandler->Stop (ConfigHandler);
> +
> + //
> + // Last, uninstall ConfigHandler Protocol.
> + //
> + Status = gBS->UninstallMultipleProtocolInterfaces (
> + ImageHandle,
> + &gEdkIIRedfishConfigHandlerProtocolGuid,
> + ConfigHandler,
> + NULL
> + );
> +
> + FreePool (mRedfishCollectionPrivate); mRedfishCollectionPrivate =
> + NULL;
> +
> + return Status;
> +}
> +
> +EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL mRedfishConfigHandler = {
> + RedfishCollectionInit,
> + RedfishCollectionStop
> +};
> +
> +/**
> + This is the declaration of an EFI image entry point. This entry point
> +is
> + the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers
> +including
> + both device drivers and bus drivers. It initialize the global
> +variables and
> + publish the driver binding protocol.
> +
> + @param[in] ImageHandle The firmware allocated handle for the UEFI
> image.
> + @param[in] SystemTable A pointer to the EFI System Table.
> +
> + @retval EFI_SUCCESS The operation completed successfully.
> + @retval EFI_ACCESS_DENIED EFI_ISCSI_INITIATOR_NAME_PROTOCOL
> was installed unexpectedly.
> + @retval Others Other errors as indicated.
> +**/
> +EFI_STATUS
> +EFIAPI
> +RedfishCollectionEntryPoint (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + )
> +{
> + EFI_STATUS Status;
> + VOID *Registration;
> +
> + if (mRedfishCollectionPrivate != NULL) {
> + return EFI_ALREADY_STARTED;
> + }
> +
> + mRedfishCollectionPrivate = AllocateZeroPool (sizeof
> + (REDFISH_COLLECTION_PRIVATE)); CopyMem
> + (&mRedfishCollectionPrivate->ConfigHandler, &mRedfishConfigHandler,
> + sizeof (EDKII_REDFISH_CONFIG_HANDLER_PROTOCOL));
> +
> + Status = gBS->InstallProtocolInterface (
> + &ImageHandle,
> + &gEdkIIRedfishConfigHandlerProtocolGuid,
> + EFI_NATIVE_INTERFACE,
> + &mRedfishCollectionPrivate->ConfigHandler
> + );
> +
> + EfiCreateProtocolNotifyEvent (
> + &gEfiRestJsonStructureProtocolGuid,
> + TPL_CALLBACK,
> + EfiRestJasonStructureProtocolIsReady,
> + NULL,
> + &Registration
> + );
> +
> + EfiCreateProtocolNotifyEvent (
> + &gEdkIIRedfishFeatureProtocolGuid,
> + TPL_CALLBACK,
> + EdkIIRedfishFeatureProtocolIsReady,
> + NULL,
> + &Registration
> + );
> +
> + return Status;
> +}
> diff --git
> a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> emCollectionDxe.h
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> emCollectionDxe.h
> new file mode 100644
> index 0000000000..a4778c1012
> --- /dev/null
> +++
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> +++ emCollectionDxe.h
> @@ -0,0 +1,21 @@
> +/** @file
> +
> + Redfish feature driver implementation - internal header file
> +
> + (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef EFI_REDFISH_COMPUTERSYSTEM_COLLECTION_H_
> +#define EFI_REDFISH_COMPUTERSYSTEM_COLLECTION_H_
> +
> +#include
> +<RedfishJsonStructure/ComputerSystemCollection/EfiComputerSystemColl
> ect
> +ion.h>
> +#include <RedfishCollectionCommon.h>
> +
> +#define REDFISH_SCHEMA_NAME "ComputerSystem"
> +#define REDFISH_MANAGED_URI L"Systems/{}"
> +#define MAX_URI_LENGTH 256
> +
> +#endif
> diff --git
> a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> emCollectionDxe.inf
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> emCollectionDxe.inf
> new file mode 100644
> index 0000000000..107d6c0769
> --- /dev/null
> +++
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> +++ emCollectionDxe.inf
> @@ -0,0 +1,56 @@
> +## @file
> +#
> +# Redfish ComputerSystemCollection collection driver.
> +#
> +# (C) Copyright 2020-2022 Hewlett Packard Enterprise Development
> +LP<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # ##
> +
> +
> +[Defines]
> + INF_VERSION = 0x00010005
> + BASE_NAME = ComputerSystemCollectionDxe
> + FILE_GUID = df883f2e-9f58-4514-9cc9-06cbe6f63073
> + MODULE_TYPE = DXE_DRIVER
> + VERSION_STRING = 1.0
> + ENTRY_POINT = RedfishCollectionEntryPoint
> + UNLOAD_IMAGE = RedfishCollectionUnload
> +
> +[Packages]
> + MdePkg/MdePkg.dec
> + MdeModulePkg/MdeModulePkg.dec
> + RedfishPkg/RedfishPkg.dec
> + RedfishClientPkg/RedfishClientPkg.dec
> +
> +[Sources]
> + ComputerSystemCollectionDxe.h
> + ComputerSystemCollectionDxe.c
> +
> +[LibraryClasses]
> + DebugLib
> + BaseMemoryLib
> + ConverterCommonLib
> + MemoryAllocationLib
> + RedfishFeatureUtilityLib
> + RedfishLib
> + UefiLib
> + UefiDriverEntryPoint
> + UefiBootServicesTableLib
> + EdkIIRedfishResourceConfigLib
> + RedfishVersionLib
> +
> +[Protocols]
> + gEdkIIRedfishConfigHandlerProtocolGuid ## CONSUMED
> + gEfiRestJsonStructureProtocolGuid ## CONSUMED
> + gEdkIIRedfishFeatureProtocolGuid ## CONSUMED
> +
> +[Guids]
> +
> +[Pcd]
> + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaStringSize
> + gEfiRedfishClientPkgTokenSpaceGuid.PcdMaxRedfishSchemaVersionSize
> +
> +[Depex]
> + TRUE
> diff --git a/RedfishClientPkg/RedfishClient.fdf.inc
> b/RedfishClientPkg/RedfishClient.fdf.inc
> index 5c4b9670b0..7d5de56591 100644
> --- a/RedfishClientPkg/RedfishClient.fdf.inc
> +++ b/RedfishClientPkg/RedfishClient.fdf.inc
> @@ -16,6 +16,7 @@
> INF
> RedfishClientPkg/RedfishConfigLangMapDxe/RedfishConfigLangMapDxe.inf
> INF RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.inf
> INF
> RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.inf
> + INF
> RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.inf
>
> !include RedfishClientPkg/RedfishJsonStructureDxe.fdf.inc
> #
> @@ -23,4 +24,5 @@
> #
> INF
> RedfishClientPkg/Converter/Memory/v1_7_1/RedfishMemory_V1_7_1_Dx
> e.inf
> INF
> RedfishClientPkg/Converter/MemoryCollection/RedfishMemoryCollection_
> Dxe.inf
> + INF
> RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerS
> ystemCollection_Dxe.inf
> !endif
> diff --git a/RedfishClientPkg/RedfishClientComponents.dsc.inc
> b/RedfishClientPkg/RedfishClientComponents.dsc.inc
> index 031d87558e..d4a33385f6 100644
> --- a/RedfishClientPkg/RedfishClientComponents.dsc.inc
> +++ b/RedfishClientPkg/RedfishClientComponents.dsc.inc
> @@ -21,6 +21,7 @@
> #
> RedfishClientPkg/Features/Memory/V1_7_1/Dxe/MemoryDxe.inf
>
> RedfishClientPkg/Features/MemoryCollectionDxe/MemoryCollectionDxe.inf
> +
> RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste
> mCollectionDxe.inf
>
> !include RedfishClientPkg/RedfishJsonStructureDxe.dsc.inc
>
> @@ -30,3 +31,4 @@
>
> RedfishClientPkg/Converter/Memory/v1_7_1/RedfishMemory_V1_7_1_Dx
> e.inf
>
> RedfishClientPkg/Converter/MemoryCollection/RedfishMemoryCollection_
> Dxe.inf
> !endif
> +
> RedfishClientPkg/Converter/ComputerSystemCollection/RedfishComputerS
> ystemCollection_Dxe.inf
> diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc
> b/RedfishClientPkg/RedfishClientLibs.dsc.inc
> index 413b83a732..21595613f5 100644
> --- a/RedfishClientPkg/RedfishClientLibs.dsc.inc
> +++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc
> @@ -19,6 +19,7 @@
> #
>
> MemoryV1_7_1Lib|RedfishClientPkg/ConverterLib/edk2library/Memory/v1
> _7_1/Lib.inf
>
> MemoryCollectionLib|RedfishClientPkg/ConverterLib/edk2library/MemoryC
> ollection/Lib.inf
> +
> ComputerSystemCollectionLib|RedfishClientPkg/ConverterLib/edk2library/C
> omputerSystemCollection/Lib.inf
>
> NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf
> HttpLib|NetworkPkg/Library/DxeHttpLib/DxeHttpLib.inf
> --
> 2.32.0.windows.2
next prev parent reply other threads:[~2022-07-28 3:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-27 1:37 [edk2-staging][PATCH v3 00/15] Update RedfishClientpkg Nickle Wang
2022-07-27 1:37 ` [edk2-staging][PATCH v3 01/15] edk2-staging/RedfishClientPkg: Introduce Redfish event library Nickle Wang
2022-07-27 1:37 ` [edk2-staging][PATCH v3 02/15] edk2-staging/RedfishClientPkg: Introduce Redfish version library Nickle Wang
2022-07-27 1:37 ` [edk2-staging][PATCH v3 03/15] edk2-staging/RedfishClientPkg: Update Redfish Resource Config Protocol Nickle Wang
2022-07-27 1:37 ` [edk2-staging][PATCH v3 04/15] edk2-staging/RedfishClientPkg: Introduce Redfish resource config library Nickle Wang
2022-07-28 0:34 ` Chang, Abner
2022-07-27 1:37 ` [edk2-staging][PATCH v3 05/15] edk2-staging/RedfishClientPkg: Introduce resource identify library Nickle Wang
2022-07-27 15:48 ` Chang, Abner
2022-07-27 1:37 ` [edk2-staging][PATCH v3 06/15] edk2-staging/RedfishClientPkg: Introduce RedfishConfigLangMap driver Nickle Wang
2022-07-28 1:44 ` Chang, Abner
2022-07-27 1:37 ` [edk2-staging][PATCH v3 07/15] edk2-staging/RedfishClientPkg: Update ETag driver Nickle Wang
2022-07-28 1:45 ` Chang, Abner
2022-07-27 1:37 ` [edk2-staging][PATCH v3 08/15] edk2-staging/RedfishClientPkg: Update Redfish feature core driver Nickle Wang
2022-07-28 2:25 ` Chang, Abner
2022-07-27 1:37 ` [edk2-staging][PATCH v3 09/15] edk2-staging/RedfishClientPkg: Update RedfishLib Nickle Wang
2022-07-28 2:51 ` Chang, Abner
2022-07-27 1:37 ` [edk2-staging][PATCH v3 10/15] edk2-staging/RedfishClientPkg: Update Redfish feature utility library Nickle Wang
2022-07-28 3:13 ` Chang, Abner
2022-07-28 3:14 ` Chang, Abner
2022-07-27 1:37 ` [edk2-staging][PATCH v3 11/15] edk2-staging/RedfishClientPkg: Rename RedfishMemoryCollection driver Nickle Wang
2022-07-28 3:41 ` Chang, Abner
2022-07-27 1:37 ` [edk2-staging][PATCH v3 12/15] edk2-staging/RedfishClientPkg: Rename Memory feature driver Nickle Wang
2022-07-28 3:43 ` Chang, Abner
2022-07-27 1:38 ` [edk2-staging][PATCH v3 13/15] edk2-staging/RedfishClientPkg: Introduce Computer System collection driver Nickle Wang
2022-07-28 3:46 ` Chang, Abner [this message]
2022-07-27 1:38 ` [edk2-staging][PATCH v3 14/15] edk2-staging/RedfishClientPkg: Introduce Computer System feature driver Nickle Wang
2022-07-28 3:48 ` Chang, Abner
2022-07-27 1:38 ` [edk2-staging][PATCH v3 15/15] edk2-staging/RedfishClientPkg: Introduce Bios " Nickle Wang
2022-07-28 3:48 ` Chang, Abner
2022-07-29 0:29 ` Nickle Wang
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=MN2PR12MB396636F598EBFAB9736FDB18EA969@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