RedfishPkg: introduce platform wanted device lib
Introduce platform wanted device lib to RedfishPkg. This library provide the flexibility for platform owner to device which device we like to support Redfish service. This helps to reduce boot time and resource on devices that is not host interface. A null library is implemented and it accepts all devices as default behavior. Signed-off-by: Nickle Wang <nicklew@nvidia.com>
This commit is contained in:
committed by
mergify[bot]
parent
31fc56c70a
commit
b2c4294c49
37
RedfishPkg/Include/Library/RedfishPlatformWantedDeviceLib.h
Normal file
37
RedfishPkg/Include/Library/RedfishPlatformWantedDeviceLib.h
Normal file
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
#
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user