Skip to content

Commit cae6fb3

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 cae6fb3

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
lines changed

RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.c

Lines changed: 10 additions & 9 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
@@ -102,16 +103,12 @@ RedfishConfigDriverCommonUnload (
102103
This is the common code for Redfish configuration UEFI and DXE driver
103104
initialization.
104105
105-
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
106-
@param[in] SystemTable A pointer to the EFI System Table.
107-
108106
@retval EFI_SUCCESS The operation completed successfully.
109107
@retval Others An unexpected error occurred.
110108
**/
111109
EFI_STATUS
112110
RedfishConfigCommonInit (
113-
IN EFI_HANDLE ImageHandle,
114-
IN EFI_SYSTEM_TABLE *SystemTable
111+
VOID
115112
)
116113
{
117114
EFI_STATUS Status;
@@ -120,10 +117,14 @@ RedfishConfigCommonInit (
120117
// Locate Redfish Credential Protocol to get credential for
121118
// accessing to Redfish service.
122119
//
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;
120+
if (gCredential == NULL) {
121+
Status = gBS->LocateProtocol (&gEdkIIRedfishCredentialProtocolGuid, NULL, (VOID **)&gCredential);
122+
if (EFI_ERROR (Status)) {
123+
DEBUG ((DEBUG_ERROR, "%a: No Redfish Credential Protocol is installed on system.", __func__));
124+
return Status;
125+
}
126+
127+
DEBUG ((DEBUG_MANAGEABILITY, "%a: Redfish Credential Protocol is found.\n", __func__));
127128
}
128129

129130
//

RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerCommon.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
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
@@ -63,16 +64,12 @@ RedfishConfigDriverCommonUnload (
6364
This is the common code for Redfish configuration UEFI and DXE driver
6465
initialization.
6566
66-
@param[in] ImageHandle The firmware allocated handle for the UEFI image.
67-
@param[in] SystemTable A pointer to the EFI System Table.
68-
6967
@retval EFI_SUCCESS The operation completed successfully.
7068
@retval Others An unexpected error occurred.
7169
**/
7270
EFI_STATUS
7371
RedfishConfigCommonInit (
74-
IN EFI_HANDLE ImageHandle,
75-
IN EFI_SYSTEM_TABLE *SystemTable
72+
VOID
7673
);
7774

7875
/**

RedfishPkg/RedfishConfigHandler/RedfishConfigHandlerDriver.c

Lines changed: 15 additions & 7 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
@@ -171,6 +172,20 @@ RedfishConfigDriverBindingSupported (
171172
&gEfiRestExServiceBindingProtocolGuid,
172173
ChildHandle
173174
);
175+
176+
//
177+
// Check if the Redfish credential protocol is installed or not.
178+
//
179+
Status = RedfishConfigCommonInit ();
180+
if (EFI_ERROR (Status)) {
181+
if (gEfiRedfishDiscoverProtocolEvent != NULL) {
182+
gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
183+
gEfiRedfishDiscoverProtocolEvent = NULL;
184+
}
185+
186+
DEBUG ((DEBUG_ERROR, "%a: Failed to support Redfish Configuration driver. %r\n", __func__, Status));
187+
}
188+
174189
return Status;
175190
}
176191

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

594-
Status = RedfishConfigCommonInit (ImageHandle, SystemTable);
595-
if (EFI_ERROR (Status)) {
596-
gBS->CloseEvent (gEfiRedfishDiscoverProtocolEvent);
597-
gEfiRedfishDiscoverProtocolEvent = NULL;
598-
return Status;
599-
}
600-
601609
//
602610
// Install UEFI Driver Model protocol(s).
603611
//

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
#
@@ -51,8 +52,7 @@
5152
gEdkIIRedfishHostInterfaceReadyProtocolGuid ## CONSUMES
5253

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

57-
[Depex]
58-
gEdkIIRedfishCredentialProtocolGuid

0 commit comments

Comments
 (0)