summaryrefslogtreecommitdiff
path: root/RedfishPkg/Library
diff options
context:
space:
mode:
Diffstat (limited to 'RedfishPkg/Library')
-rw-r--r--RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c77
-rw-r--r--RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.h2
-rw-r--r--RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf3
-rw-r--r--RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c6
4 files changed, 46 insertions, 42 deletions
diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
index c73e76d..5c3f8f9 100644
--- a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
+++ b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
@@ -23,7 +23,7 @@ static LIST_ENTRY mBmcIpmiLan;
Bootstrapping.
@retval TRUE Yes, it is supported.
- TRUE No, it is not supported.
+ FALSE No, it is not supported.
**/
BOOLEAN
@@ -31,47 +31,53 @@ ProbeRedfishCredentialBootstrap (
VOID
)
{
- EFI_STATUS Status;
- IPMI_BOOTSTRAP_CREDENTIALS_COMMAND_DATA CommandData;
- IPMI_BOOTSTRAP_CREDENTIALS_RESULT_RESPONSE ResponseData;
- UINT32 ResponseSize;
- BOOLEAN ReturnBool;
+ EDKII_REDFISH_AUTH_METHOD AuthMethod;
+ EDKII_REDFISH_CREDENTIAL2_PROTOCOL *CredentialProtocol;
+ CHAR8 *UserName;
+ CHAR8 *Password;
+ BOOLEAN ReturnBool;
+ EFI_STATUS Status;
DEBUG ((DEBUG_MANAGEABILITY, "%a: Entry\n", __func__));
+ ReturnBool = FALSE;
//
- // IPMI callout to NetFn 2C, command 02
- // Request data:
- // Byte 1: REDFISH_IPMI_GROUP_EXTENSION
- // Byte 2: DisableBootstrapControl
+ // Locate HII credential protocol.
//
- CommandData.GroupExtensionId = REDFISH_IPMI_GROUP_EXTENSION;
- CommandData.DisableBootstrapControl = REDFISH_IPMI_BOOTSTRAP_CREDENTIAL_ENABLE;
- ResponseData.CompletionCode = IPMI_COMP_CODE_UNSPECIFIED;
- ResponseSize = sizeof (ResponseData);
- //
- // Response data: Ignored.
- //
- Status = IpmiSubmitCommand (
- IPMI_NETFN_GROUP_EXT,
- REDFISH_IPMI_GET_BOOTSTRAP_CREDENTIALS_CMD,
- (UINT8 *)&CommandData,
- sizeof (CommandData),
- (UINT8 *)&ResponseData,
- &ResponseSize
- );
- if (!EFI_ERROR (Status) &&
- ((ResponseData.CompletionCode == IPMI_COMP_CODE_NORMAL) ||
- (ResponseData.CompletionCode == REDFISH_IPMI_COMP_CODE_BOOTSTRAP_CREDENTIAL_DISABLED)
- ))
- {
- DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, " Redfish Credential Bootstrapping is supported\n"));
+ Status = gBS->LocateProtocol (
+ &gEdkIIRedfishCredential2ProtocolGuid,
+ NULL,
+ (VOID **)&CredentialProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ ASSERT_EFI_ERROR (Status);
+ return FALSE;
+ }
+
+ Status = CredentialProtocol->GetAuthInfo (
+ CredentialProtocol,
+ &AuthMethod,
+ &UserName,
+ &Password
+ );
+ if (!EFI_ERROR (Status)) {
+ ZeroMem (Password, AsciiStrSize (Password));
+ FreePool (Password);
+ ZeroMem (UserName, AsciiStrSize (UserName));
+ FreePool (UserName);
ReturnBool = TRUE;
} else {
- DEBUG ((DEBUG_REDFISH_HOST_INTERFACE, " Redfish Credential Bootstrapping is not supported\n"));
- ReturnBool = FALSE;
+ if (Status == EFI_ACCESS_DENIED) {
+ // bootstrap credential support was disabled
+ ReturnBool = TRUE;
+ }
}
+ DEBUG ((
+ DEBUG_REDFISH_HOST_INTERFACE,
+ " Redfish Credential Bootstrapping is %a\n",
+ ReturnBool ? "supported" : "not supported"
+ ));
return ReturnBool;
}
@@ -1201,8 +1207,9 @@ CheckBmcUsbNic (
DEBUG ((DEBUG_MANAGEABILITY, "%a: Entry, the registration key - 0x%08x.\n", __func__, Registration));
- Handle = NULL;
- Status = EFI_SUCCESS;
+ Handle = NULL;
+ HandleBuffer = NULL;
+ Status = EFI_SUCCESS;
do {
BufferSize = 0;
diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.h b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.h
index 669c304..96b2bdf 100644
--- a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.h
+++ b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.h
@@ -21,7 +21,6 @@
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/DevicePathLib.h>
-#include <Library/IpmiLib.h>
#include <Library/IpmiCommandLib.h>
#include <Library/RedfishHostInterfaceLib.h>
#include <Library/MemoryAllocationLib.h>
@@ -29,6 +28,7 @@
#include <Library/DevicePathLib.h>
#include <Library/RedfishDebugLib.h>
+#include <Protocol/EdkIIRedfishCredential2.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/UsbIo.h>
diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
index 3660249..c379119 100644
--- a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
+++ b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.inf
@@ -29,7 +29,6 @@
[LibraryClasses]
BaseMemoryLib
DebugLib
- IpmiLib
IpmiCommandLib
MemoryAllocationLib
UefiLib
@@ -39,6 +38,7 @@
gEfiSimpleNetworkProtocolGuid ## CONSUMED
gEfiUsbIoProtocolGuid ## CONSUMED
gEfiDevicePathProtocolGuid ## CONSUMED
+ gEdkIIRedfishCredential2ProtocolGuid ## CONSUMED
[Pcd]
gEfiRedfishPkgTokenSpaceGuid.PcdRedfishHostName ## CONSUMED
@@ -47,3 +47,4 @@
[Depex]
gIpmiProtocolGuid
+ AND gEdkIIRedfishCredential2ProtocolGuid
diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
index f8bb51f..694a087 100644
--- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
+++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c
@@ -9,7 +9,7 @@
**/
#include <Uefi.h>
-
+#include <RedfishCommon.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
@@ -17,10 +17,6 @@
#include <Library/RedfishHttpLib.h>
#include <Library/UefiLib.h>
-#ifndef IS_EMPTY_STRING
-#define IS_EMPTY_STRING(a) ((a) == NULL || (a)[0] == '\0')
-#endif
-
#define REDFISH_JSON_STRING_LENGTH 200
#define REDFISH_JSON_OUTPUT_FORMAT (EDKII_JSON_COMPACT | EDKII_JSON_INDENT(2))
#define REDFISH_PRINT_BUFFER_BYTES_PER_ROW 16