public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFru: IPMI FRU Driver
@ 2023-05-12  3:26 Chang, Abner
  2023-05-12  3:54 ` Nickle Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chang, Abner @ 2023-05-12  3:26 UTC (permalink / raw)
  To: devel; +Cc: Isaac Oram, Abdul Lateef Attar, Nickle Wang, Tinh Nguyen

From: Abner Chang <abner.chang@amd.com>

IpmiFru is cloned from
edk2-platforms/Features/Intel/OutOfBandManagement/
IpmiFeaturePkg/IpmiFru in order to consolidate
edk2 system manageability support in one place.
Uncustify is applied to C files and no functionalities
are changed in this patch.

We will still keep the one under IpmiFeaturePkg/IpmiFru
until the reference to this instance are removed from
platforms.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Isaac Oram <isaac.w.oram@intel.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
---
 .../Universal/IpmiFru/IpmiFru.inf             | 34 ++++++++++
 .../Universal/IpmiFru/IpmiFru.c               | 67 +++++++++++++++++++
 2 files changed, 101 insertions(+)
 create mode 100644 Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.inf
 create mode 100644 Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.c

diff --git a/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.inf b/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.inf
new file mode 100644
index 0000000000..ddef310309
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.inf
@@ -0,0 +1,34 @@
+### @file
+# Component description file for IPMI FRU.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+  INF_VERSION              = 0x00010005
+  BASE_NAME                = IpmiFru
+  FILE_GUID                = CD9B99D9-E86F-48CF-A8EB-20120AC22666
+  MODULE_TYPE              = DXE_DRIVER
+  PI_SPECIFICATION_VERSION = 0x0001000A
+  VERSION_STRING           = 1.0
+  ENTRY_POINT              = InitializeFru
+
+[Sources]
+  IpmiFru.c
+
+[Packages]
+  ManageabilityPkg/ManageabilityPkg.dec
+  MdePkg/MdePkg.dec
+
+[LibraryClasses]
+  DebugLib
+  IpmiCommandLib
+  UefiBootServicesTableLib
+  UefiDriverEntryPoint
+  UefiLib
+
+[Depex]
+  TRUE
diff --git a/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.c b/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.c
new file mode 100644
index 0000000000..2b489410db
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiFru/IpmiFru.c
@@ -0,0 +1,67 @@
+/** @file
+  IPMI FRU Driver.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/BaseLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h>
+#include <Library/IpmiCommandLib.h>
+#include <IndustryStandard/Ipmi.h>
+
+/*++
+
+Routine Description:
+
+  Initialize SM Redirection Fru Layer
+
+Arguments:
+
+  ImageHandle - ImageHandle of the loaded driver
+  SystemTable - Pointer to the System Table
+
+Returns:
+
+  EFI_STATUS
+
+--*/
+EFI_STATUS
+EFIAPI
+InitializeFru (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  EFI_STATUS                                 Status;
+  IPMI_GET_DEVICE_ID_RESPONSE                ControllerInfo;
+  IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST   GetFruInventoryAreaInfoRequest;
+  IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE  GetFruInventoryAreaInfoResponse;
+
+  //
+  //  Get all the SDR Records from BMC and retrieve the Record ID from the structure for future use.
+  //
+  Status = IpmiGetDeviceId (&ControllerInfo);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "!!! IpmiFru  IpmiGetDeviceId Status=%x\n", Status));
+    return Status;
+  }
+
+  DEBUG ((DEBUG_ERROR, "!!! IpmiFru  FruInventorySupport %x\n", ControllerInfo.DeviceSupport.Bits.FruInventorySupport));
+
+  if (ControllerInfo.DeviceSupport.Bits.FruInventorySupport) {
+    GetFruInventoryAreaInfoRequest.DeviceId = 0;
+    Status                                  = IpmiGetFruInventoryAreaInfo (&GetFruInventoryAreaInfoRequest, &GetFruInventoryAreaInfoResponse);
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "!!! IpmiFru  IpmiGetFruInventoryAreaInfo Status=%x\n", Status));
+      return Status;
+    }
+
+    DEBUG ((DEBUG_ERROR, "!!! IpmiFru  InventoryAreaSize=%x\n", GetFruInventoryAreaInfoResponse.InventoryAreaSize));
+  }
+
+  return EFI_SUCCESS;
+}
-- 
2.37.1.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-19  3:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-12  3:26 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiFru: IPMI FRU Driver Chang, Abner
2023-05-12  3:54 ` Nickle Wang
2023-05-12  7:50 ` Tinh Nguyen
2023-05-19  3:07 ` [edk2-devel] " Isaac Oram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox