Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions RedfishPkg/Include/Library/RedfishPlatformWantedDeviceLib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/** @file
Definitions of RedfishPlatformWantedDeviceLib.

Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#ifndef REDFISH_PLATFORM_WANTED_DEVICE_LIB_H_
#define REDFISH_PLATFORM_WANTED_DEVICE_LIB_H_

#include <Uefi.h>

/**
This is the function to decide if input controller is the device
that platform want to support. By returning EFI_UNSUPPORTED to
caller (normally Supported function), caller should ignore this device
and do not provide Redfish service on this controller.

@param[in] ControllerHandle The handle of the controller to test.
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
This is optional.

@retval EFI_SUCCESS This is the device supported by platform.
@retval EFI_UNSUPPORTED This device is not supported by platform.
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.

**/
EFI_STATUS
EFIAPI
IsPlatformWantedDevice (
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
);

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/** @file
NULL instace of RedfishPlatformWantedDeviceLib

Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

**/
#include <Library/RedfishPlatformWantedDeviceLib.h>

/**
This is the function to decide if input controller is the device
that platform want to support. By returning EFI_UNSUPPORTED to
caller (normally Supported function), caller should ignore this device
and do not provide Redfish service on this controller.

@param[in] ControllerHandle The handle of the controller to test.
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
This is optional.

@retval EFI_SUCCESS This is the device supported by platform.
@retval EFI_UNSUPPORTED This device is not supported by platform.
@retval EFI_INVALID_PARAMETER ControllerHandle is NULL.

**/
EFI_STATUS
EFIAPI
IsPlatformWantedDevice (
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
if (ControllerHandle == NULL) {
return EFI_INVALID_PARAMETER;
}

//
// Always support Redfish on ControllerHandle.
//
return EFI_SUCCESS;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## @file
# NULL instance of RedfishPlatformWantedDeviceLib
#
# Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##

[Defines]
INF_VERSION = 0x0001000b
BASE_NAME = RedfishPlatformWantedDeviceLibNull
FILE_GUID = C5AEFFCA-3692-401E-8F82-9FFAA0622E45
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = RedfishPlatformWantedDeviceLib

#
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64 RISCV64
#

[Sources]
RedfishPlatformWantedDeviceLibNull.c

[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
RedfishPkg/RedfishPkg.dec
7 changes: 6 additions & 1 deletion RedfishPkg/RedfishPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
# (C) Copyright 2021 Hewlett Packard Enterprise Development LP<BR>
# Copyright (c) 2023, American Megatrends International LLC.
# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -75,6 +75,11 @@
#
RedfishHttpLib|Include/Library/RedfishHttpLib.h

## @libraryclass Provides the library functions for platform to decide
# if this is the device platform supported.
#
RedfishPlatformWantedDeviceLib|Include/Library/RedfishPlatformWantedDeviceLib.h

[LibraryClasses.Common.Private]
## @libraryclass Provides the private C runtime library functions.
# CRT library is currently used by edk2 JsonLib (open source
Expand Down
4 changes: 3 additions & 1 deletion RedfishPkg/RedfishPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
# (C) Copyright 2021 Hewlett-Packard Enterprise Development LP.
# Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
Expand Down Expand Up @@ -47,6 +47,7 @@
RedfishContentCodingLib|RedfishPkg/Library/RedfishContentCodingLibNull/RedfishContentCodingLibNull.inf
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf
RedfishPlatformWantedDeviceLib|RedfishPkg/Library/RedfishPlatformWantedDeviceLibNull/RedfishPlatformWantedDeviceLibNull.inf

# NULL instance of IPMI related library.
IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
Expand All @@ -67,5 +68,6 @@
RedfishPkg/Library/HiiUtilityLib/HiiUtilityLib.inf
RedfishPkg/Library/RedfishPlatformConfigLib/RedfishPlatformConfigLib.inf
RedfishPkg/Library/RedfishHttpLib/RedfishHttpLib.inf
RedfishPkg/Library/RedfishPlatformWantedDeviceLibNull/RedfishPlatformWantedDeviceLibNull.inf

!include RedfishPkg/Redfish.dsc.inc
23 changes: 14 additions & 9 deletions RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>

SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -375,14 +375,19 @@ RedfishRestExDriverBindingSupported (
//
// Test for the HttpServiceBinding Protocol.
//
return gBS->OpenProtocol (
ControllerHandle,
&gEfiHttpServiceBindingProtocolGuid,
NULL,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
);
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiHttpServiceBindingProtocolGuid,
NULL,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_TEST_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}

return IsPlatformWantedDevice (ControllerHandle, RemainingDevicePath);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions RedfishPkg/RedfishRestExDxe/RedfishRestExDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
Copyright (c) 2023, Ampere Computing LLC. All rights reserved.<BR>
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Expand All @@ -23,6 +24,7 @@
#include <Library/HttpIoLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/NetLib.h>
#include <Library/RedfishPlatformWantedDeviceLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
Expand Down
3 changes: 2 additions & 1 deletion RedfishPkg/RedfishRestExDxe/RedfishRestExDxe.inf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
# Copyright (c) 2023, American Megatrends International LLC.
# Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
Expand Down Expand Up @@ -47,6 +47,7 @@
MemoryAllocationLib
NetLib
RedfishDebugLib
RedfishPlatformWantedDeviceLib
UefiLib
UefiBootServicesTableLib
UefiDriverEntryPoint
Expand Down
Loading