audk/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.h
Mike Maslenkin 7b9f2018d1 RedfishPkg: PlatformHostInterfaceBmcUsbNicLib: use credential protocol
This patch replaces call of IpmiSubmitCommand() issued
REDFISH_IPMI_BOOTSTRAP_CREDENTIAL_ENABLE IPMI command to check
whether bootstrap credential support enabled or not.
The problem is that in accordance with IPMI spec while handling
such command BMC creates bootstrap account. The credentials of this account
is returned as a response. Obviously in this code the response is not used.
From the other side there is an implementation
of EDKII_REDFISH_CREDENTIAL_PROTOCOL exists and used by
RedfishPlatformCredentialIpmiLib.

By design RedfishPlatformCredentialIpmiLib keeps returned bootstrap
credentials and uses it later. So all services using
EDKII_REDFISH_CREDENTIAL_PROTOCOL instance operates with a same
credentials.
Current design of PlatformHostInterfaceBmcUsbNicLib leads to creation
of two bootstrap accounts on BMC side. This is on nesseccary and one
account is not used at all.

Using EDKII_REDFISH_CREDENTIAL_PROTOCOL prevents from creating useless
bootstrap account on BMC side.

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2024-09-05 03:40:45 +00:00

85 lines
3.9 KiB
C

/** @file
Header file to provide the platform Redfish Host Interface information
of USB NIC Device exposed by BMC.
Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#ifndef PLATFORM_HOST_INTERFACE_BMC_USB_NIC_LIB_H_
#define PLATFORM_HOST_INTERFACE_BMC_USB_NIC_LIB_H_
#include <Uefi.h>
#include <IndustryStandard/Ipmi.h>
#include <IndustryStandard/IpmiNetFnApp.h>
#include <IndustryStandard/IpmiNetFnTransport.h>
#include <IndustryStandard/RedfishHostInterfaceIpmi.h>
#include <IndustryStandard/SmBios.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
#include <Library/IpmiCommandLib.h>
#include <Library/RedfishHostInterfaceLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DevicePathLib.h>
#include <Library/RedfishDebugLib.h>
#include <Protocol/EdkIIRedfishCredential2.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/UsbIo.h>
#define BMC_USB_NIC_HOST_INTERFASCE_READINESS_GUID \
{ \
0xDD96F5D7, 0x4AE1, 0x4E6C, {0xA1, 0x30, 0xA5, 0xAC, 0x77, 0xDD, 0xE4, 0xA5} \
}
//
// This is the structure for BMC exposed
// USB NIC information.
//
typedef struct {
LIST_ENTRY NextInstance; ///< Link to the next instance.
BOOLEAN IsExposedByBmc; ///< Flag indicates this USB NIC is
///< exposed by BMC.
BOOLEAN IsSuppportedHostInterface; ///< This BMC USB NIC is supported
///< as Redfish host interface
EFI_SIMPLE_NETWORK_PROTOCOL *ThisSnp; ///< The SNP instance associated with
///< this USB NIC.
EFI_USB_IO_PROTOCOL *ThisUsbIo; ///< The USBIO instance associated with
///< this USB NIC.
UINT16 UsbVendorId; ///< USB Vendor ID of this BMC exposed USB NIC.
UINT16 UsbProductId; ///< USB Product ID of this BMC exposed USB NIC.
UINTN MacAddressSize; ///< HW address size.
UINT8 *MacAddress; ///< HW address.
UINT8 IpmiLanChannelNumber; ///< BMC IPMI Lan Channel number.
//
// Below is the infortmation for building SMBIOS type 42.
//
UINT8 IpAssignedType; ///< Redfish service IP assign type.
UINT8 IpAddressFormat; ///< Redfish service IP version.
UINT8 HostIpAddressIpv4[4]; ///< Host IP address.
UINT8 RedfishIpAddressIpv4[4]; ///< Redfish service IP address.
UINT8 SubnetMaskIpv4[4]; ///< Subnet mask.
UINT8 GatewayIpv4[4]; ///< Gateway IP address.
UINT16 VLanId; ///< VLAN ID.
BOOLEAN CredentialBootstrapping; ///< If Credential bootstrapping is
///< supported.
} HOST_INTERFACE_BMC_USB_NIC_INFO;
//
// This is the structure for caching
// BMC IPMI LAN Channel
//
typedef struct {
LIST_ENTRY NextInstance; ///< Link to the next IPMI LAN Channel.
UINT8 Channel; ///< IPMI Channel number.
EFI_MAC_ADDRESS MacAddress; ///< IPMI LAN Channel MAC address.
UINT8 MacAddressSize; ///< MAC address size;
} BMC_IPMI_LAN_CHANNEL_INFO;
#endif