RedfishPkg: Remove the Discover Token global variables

gRedfishDiscoveredToken may be allocated several times,
if multiple NIC installed on the system.
To avoid this issue Discover Token related global variables
replaced with the local variables.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
This commit is contained in:
Igor Kulchytskyy
2023-04-20 14:36:38 -04:00
committed by mergify[bot]
parent 18f463edba
commit 5a349b96b1
3 changed files with 140 additions and 120 deletions

View File

@@ -117,17 +117,31 @@ typedef struct {
///< on this network interface.
} EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL;
//
// Redfish Discover Instance signature
//
#define EFI_REDFISH_DISCOVER_DATA_SIGNATURE SIGNATURE_32 ('E', 'R', 'D', 'D')
#define EFI_REDFISH_DISOVER_DATA_FROM_DISCOVER_PROTOCOL(a) \
CR (a, EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL, RedfishDiscoverProtocol, EFI_REDFISH_DISCOVER_DATA_SIGNATURE)
//
// Internal structure used to maintain REST EX properties.
//
typedef struct {
LIST_ENTRY Entry; ///< Link list entry.
EFI_HANDLE OpenDriverAgentHandle; ///< The agent to open network protocol.
EFI_HANDLE OpenDriverControllerHandle; ///< The controller handle to open network protocol.
EFI_HANDLE RestExChildHandle; ///< The child handle created through REST EX Service Protocol.
EFI_HANDLE RestExControllerHandle; ///< The controller handle which provide REST EX protocol.
EFI_REST_EX_PROTOCOL *RestExProtocolInterface; ///< Pointer to EFI_REST_EX_PROTOCOL.
UINT32 RestExId; ///< The identifier installed on REST EX controller handle.
LIST_ENTRY Entry; ///< Link list entry.
UINT32 Signature; ///< Instance signature.
EFI_HANDLE OpenDriverAgentHandle; ///< The agent to open network protocol.
EFI_HANDLE OpenDriverControllerHandle; ///< The controller handle to open network protocol.
EFI_HANDLE RestExChildHandle; ///< The child handle created through REST EX Service Protocol.
EFI_HANDLE RestExControllerHandle; ///< The controller handle which provide REST EX protocol.
EFI_REST_EX_PROTOCOL *RestExProtocolInterface; ///< Pointer to EFI_REST_EX_PROTOCOL.
UINT32 RestExId; ///< The identifier installed on REST EX controller handle.
UINTN NumberOfNetworkInterfaces; ///< Number of network interfaces can do Redfish service discovery.
EFI_REDFISH_DISCOVER_NETWORK_INTERFACE *NetworkInterfaceInstances; ///< Network interface instances. It's an array of instances. The number of entries
///< in array is indicated by NumberOfNetworkInterfaces.
EFI_REDFISH_DISCOVER_PROTOCOL RedfishDiscoverProtocol; ///< EFI_REDFISH_DISCOVER_PROTOCOL protocol.
} EFI_REDFISH_DISCOVER_REST_EX_INSTANCE_INTERNAL;
/**