Skip to content

Commit 2b74cf8

Browse files
committed
RedfishPkg/ConfigHandler: Remove [Depex] section from INF file
UEFI driver shouldn't have the [Depex] section in INF file. Remove Redfish Credential Protocol in dependency section and locate it when the UEFI driver is connected to execute. Signed-off-by: Abner Chang <abner.chang@amd.com>
1 parent b7cf7e4 commit 2b74cf8

File tree

4 files changed

+60
-31
lines changed

4 files changed

+60
-31
lines changed

RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
44
(C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
55
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
6+
Copyright (c) 2026, Advanced Micro Devices, Inc. All rights reserved.<BR>
67
78
SPDX-License-Identifier: BSD-2-Clause-Patent
89
@@ -33,6 +34,18 @@ RedfishConfigOnEndOfDxe (
3334
{
3435
EFI_STATUS Status;
3536

37+
//
38+
// Locate Redfish Credential Protocol to get credential for
39+
// accessing to Redfish service.
40+
//
41+
if (gCredential == NULL) {
42+
Status = gBS->LocateProtocol (&gEdkIIRedfishCredentialProtocolGuid, NULL, (VOID **)&gCredential);
43+
if (EFI_ERROR (Status)) {
44+
DEBUG ((DEBUG_ERROR, "%a: Failed to locate Redfish Credential Protocol.\n", __func__));
45+
return;
46+
}
47+
}
48+
3649
Status = gCredential->StopService (gCredential, ServiceStopTypeSecureBootDisabled);
3750
if (EFI_ERROR (Status) && (Status != EFI_UNSUPPORTED)) {
3851
DEBUG ((DEBUG_ERROR, "Redfish credential protocol failed to stop service on EndOfDxe: %r", Status));
@@ -61,6 +74,18 @@ RedfishConfigOnExitBootService (
6174
{
6275
EFI_STATUS Status;
6376

77+
//
78+
// Locate Redfish Credential Protocol to get credential for
79+
// accessing to Redfish service.
80+
//
81+
if (gCredential == NULL) {
82+
Status = gBS->LocateProtocol (&gEdkIIRedfishCredentialProtocolGuid, NULL, (VOID **)&gCredential);
83+
if (EFI_ERROR (Status)) {
84+
DEBUG ((DEBUG_ERROR, "%a: Failed to locate Redfish Credential Protocol.\n", __func__));
85+
return;
86+
}
87+
}
88+
6489
Status = gCredential->StopService (gCredential, ServiceStopTypeExitBootService);
6590
if (EFI_ERROR (Status) && (Status != EFI_UNSUPPORTED)) {
6691
DEBUG ((DEBUG_ERROR, "Redfish credential protocol failed to stop service on ExitBootService: %r", Status));
@@ -102,30 +127,16 @@ RedfishConfigDriverCommonUnload (
102127
This is the common code for Redfish configuration UEFI and DXE driver
103128
initialization.
104129
105-
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
106-
@param[in] SystemTable A pointer to the EFI System Table.
107-
108130
@retval EFI_SUCCESS The operation completed successfully.
109131
@retval Others An unexpected error occurred.
110132
**/
111133
EFI_STATUS
112134
RedfishConfigCommonInit (
113-
IN EFI_HANDLE ImageHandle,
114-
IN EFI_SYSTEM_TABLE *SystemTable
135+
VOID
115136
)
116137
{
117138
EFI_STATUS Status;
118139

119-
//
120-
// Locate Redfish Credential Protocol to get credential for
121-
// accessing to Redfish service.
122-
//
123-
Status = gBS->LocateProtocol (&gEdkIIRedfishCredentialProtocolGuid, NULL, (VOID **)&gCredential);
124-
if (EFI_ERROR (Status)) {
125-
DEBUG ((DEBUG_ERROR, "%a: No Redfish Credential Protocol is installed on system.", __func__));
126-
return Status;
127-
}
128-
129140
//
130141
// Create EndOfDxe Event.
131142
//

RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
and DXE driver.
44
55
(C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
6+
Copyright (c) 2026, Advanced Micro Devices, Inc. All rights reserved.<BR>
67
78
SPDX-License-Identifier: BSD-2-Clause-Patent
89
910
**/
1011

11-
#pragma once
12+
#ifndef EFI_REDFISH_CONFIG_HANDLER_COMMON_H_
13+
#define EFI_REDFISH_CONFIG_HANDLER_COMMON_H_
1214

1315
#include <Uefi.h>
1416

@@ -63,16 +65,12 @@ RedfishConfigDriverCommonUnload (
6365
This is the common code for Redfish configuration UEFI and DXE driver
6466
initialization.
6567
66-
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
67-
@param[in] SystemTable A pointer to the EFI System Table.
68-
6968
@retval EFI_SUCCESS The operation completed successfully.
7069
@retval Others An unexpected error occurred.
7170
**/
7271
EFI_STATUS
7372
RedfishConfigCommonInit (
74-
IN EFI_HANDLE ImageHandle,
75-
IN EFI_SYSTEM_TABLE *SystemTable
73+
VOID
7674
);
7775

7876
/**
@@ -96,3 +94,5 @@ VOID
9694
RedfishConfigHandlerInitialization (
9795
VOID
9896
);
97+
98+
#endif

RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
77
(C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
8+
Copyright (c) 2026, Advanced Micro Devices, Inc. All rights reserved.<BR>
89
910
SPDX-License-Identifier: BSD-2-Clause-Patent
1011
@@ -130,9 +131,10 @@ RedfishConfigDriverBindingSupported (
130131
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
131132
)
132133
{
133-
EFI_REST_EX_PROTOCOL *RestEx;
134-
EFI_STATUS Status;
135-
EFI_HANDLE ChildHandle;
134+
EFI_REST_EX_PROTOCOL *RestEx;
135+
EFI_STATUS Status;
136+
EFI_HANDLE ChildHandle;
137+
EDKII_REDFISH_CREDENTIAL_PROTOCOL *TestCredentialProtocol;
136138

137139
ChildHandle = NULL;
138140

@@ -171,6 +173,18 @@ RedfishConfigDriverBindingSupported (
171173
&gEfiRestExServiceBindingProtocolGuid,
172174
ChildHandle
173175
);
176+
177+
//
178+
// Check if the Redfish credential protocol is installed or not.
179+
//
180+
Status = gBS->LocateProtocol (&gEdkIIRedfishCredentialProtocolGuid, NULL, (VOID **)&TestCredentialProtocol);
181+
if (EFI_ERROR (Status)) {
182+
DEBUG ((DEBUG_ERROR, "%a: No Redfish Credential Protocol is installed on system.", __func__));
183+
return EFI_UNSUPPORTED;
184+
}
185+
186+
DEBUG ((DEBUG_MANAGEABILITY, "%a: Redfish Credential Protocol is found.\n", __func__));
187+
174188
return Status;
175189
}
176190

@@ -331,6 +345,7 @@ RedfishServiceDiscoveredCallback (
331345
gRedfishConfigData.RedfishServiceInfo.RedfishServiceProductVer = RedfishInstance->Information.ProductVer;
332346
gRedfishConfigData.RedfishServiceInfo.RedfishServiceUseHttps = RedfishInstance->Information.UseHttps;
333347
gRedfishServiceDiscovered = TRUE;
348+
DEBUG ((DEBUG_MANAGEABILITY, "%a: Redfish service %s is discovered!\n", __func__, gRedfishConfigData.RedfishServiceInfo.RedfishServiceUuid));
334349
}
335350

336351
//
@@ -591,10 +606,13 @@ RedfishConfigHandlerDriverEntryPoint (
591606
return Status;
592607
}
593608

594-
Status = RedfishConfigCommonInit (ImageHandle, SystemTable);
609+
Status = RedfishConfigCommonInit ();
595610
if (EFI_ERROR (Status)) {
596-
gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
597-
gEfiRedfishDiscoverProtocolEvent = NULL;
611+
if (gEfiRedfishDiscoverProtocolEvent != NULL) {
612+
gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
613+
gEfiRedfishDiscoverProtocolEvent = NULL;
614+
}
615+
598616
return Status;
599617
}
600618

RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.inf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
66
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
77
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
8+
# Copyright (c) 2026, Advanced Micro Devices, Inc. All rights reserved.<BR>
89
#
910
# SPDX-License-Identifier: BSD-2-Clause-Patent
1011
#
@@ -49,10 +50,9 @@
4950
gEdkIIRedfishCredentialProtocolGuid ## CONSUMES
5051
gEdkIIRedfishConfigHandlerProtocolGuid ## CONSUMES
5152
gEdkIIRedfishHostInterfaceReadyProtocolGuid ## CONSUMES
53+
gEdkIIRedfishCredentialProtocolGuid ## CONSUMES
5254

5355
[Guids]
54-
gEfiEventExitBootServicesGuid ## CONSUMES ## Event
55-
gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event
56+
gEfiEventExitBootServicesGuid ## CONSUMES ## Event
57+
gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event
5658

57-
[Depex]
58-
gEdkIIRedfishCredentialProtocolGuid

0 commit comments

Comments
 (0)