* [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver
@ 2023-05-12 9:58 Chang, Abner
2023-05-12 9:58 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiBmcElog: Add to ManageabilityPkg Chang, Abner
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Chang, Abner @ 2023-05-12 9:58 UTC (permalink / raw)
To: devel; +Cc: Isaac Oram, Abdul Lateef Attar, Nickle Wang, Tinh Nguyen
From: Abner Chang <abner.chang@amd.com>
IpmiBmcElog is cloned from
edk2-platforms/Features/Intel/OutOfBandManagement/
IpmiFeaturePkg/BmcElog 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/BmcElog
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/IpmiBmcElog/BmcElog.inf | 33 +++
.../Universal/IpmiBmcElog/BmcElog.c | 192 ++++++++++++++++++
2 files changed, 225 insertions(+)
create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
new file mode 100644
index 0000000000..4c28862fe5
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
@@ -0,0 +1,33 @@
+### @file
+# Component description file for BMC ELOG.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BmcElog
+ FILE_GUID = A0FF2235-B652-45E3-B3D2-B20F3E714E6F
+ MODULE_TYPE = DXE_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeBmcElogLayer
+
+[Sources]
+ BmcElog.c
+
+[Packages]
+ ManageabilityPkg/ManageabilityPkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ DebugLib
+ IpmiCommandLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+
+[Depex]
+ TRUE
diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
new file mode 100644
index 0000000000..ab179e9d49
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
@@ -0,0 +1,192 @@
+/** @file
+ BMC Event Log functions.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+
+EFI_STATUS
+EFIAPI
+CheckIfSelIsFull (
+ VOID
+ );
+
+/**
+ This function erases event logs and waits unti complete.
+
+ @param [in] ResvId - Reserved ID
+
+ @retval EFI_STATUS EFI_SUCCESS
+ EFI_NO_RESPONSE
+
+**/
+EFI_STATUS
+WaitTillErased (
+ IN UINT8 *ResvId
+ )
+{
+ INTN Counter;
+ IPMI_CLEAR_SEL_REQUEST ClearSel;
+ IPMI_CLEAR_SEL_RESPONSE ClearSelResponse;
+
+ Counter = 0x200;
+ ZeroMem (&ClearSelResponse, sizeof (ClearSelResponse));
+
+ while (TRUE) {
+ ZeroMem (&ClearSel, sizeof (ClearSel));
+ ClearSel.Reserve[0] = ResvId[0];
+ ClearSel.Reserve[1] = ResvId[1];
+ ClearSel.AscC = 0x43;
+ ClearSel.AscL = 0x4C;
+ ClearSel.AscR = 0x52;
+ ClearSel.Erase = 0x00;
+
+ IpmiClearSel (
+ &ClearSel,
+ &ClearSelResponse
+ );
+
+ if ((ClearSelResponse.ErasureProgress & 0xf) == 1) {
+ return EFI_SUCCESS;
+ }
+
+ //
+ // If there is not a response from the BMC controller we need to return and not hang.
+ //
+ --Counter;
+ if (Counter == 0x0) {
+ return EFI_NO_RESPONSE;
+ }
+ }
+}
+
+/**
+ This function activates BMC event log.
+
+ @param [in] EnableElog Enable/Disable event log
+ @param [out] ElogStatus return log status
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+EfiActivateBmcElog (
+ IN BOOLEAN *EnableElog,
+ OUT BOOLEAN *ElogStatus
+ )
+{
+ EFI_STATUS Status;
+ UINT8 ElogStat;
+ IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables;
+ IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables;
+ UINT8 CompletionCode;
+
+ Status = EFI_SUCCESS;
+ ElogStat = 0;
+
+ Status = IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (EnableElog == NULL) {
+ *ElogStatus = GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging;
+ } else {
+ if (Status == EFI_SUCCESS) {
+ if (*EnableElog) {
+ ElogStat = 1;
+ }
+
+ CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, sizeof (UINT8));
+ SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging = ElogStat;
+
+ Status = IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &CompletionCode);
+ }
+ }
+
+ return Status;
+}
+
+/**
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+SetElogRedirInstall (
+ VOID
+ )
+{
+ BOOLEAN EnableElog;
+ BOOLEAN ElogStatus;
+
+ //
+ // Activate the Event Log (This should depend upon Setup).
+ //
+ EfiActivateBmcElog (&EnableElog, &ElogStatus);
+ return EFI_SUCCESS;
+}
+
+/**
+ Entry point of BmcElog DXE driver
+
+ @param [in] ImageHandle ImageHandle of the loaded driver
+ @param [in] SystemTable Pointer to the System Table
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeBmcElogLayer (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ SetElogRedirInstall ();
+
+ CheckIfSelIsFull ();
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function verifies the BMC SEL is full and When it is
+ reports the error to the Error Manager.
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+EFIAPI
+CheckIfSelIsFull (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT8 SelIsFull;
+ IPMI_GET_SEL_INFO_RESPONSE SelInfo;
+
+ Status = IpmiGetSelInfo (&SelInfo);
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ //
+ // Check the Bit7 of the OperationByte if SEL is OverFlow.
+ //
+ SelIsFull = (SelInfo.OperationSupport & 0x80);
+ DEBUG ((DEBUG_INFO, "SelIsFull - 0x%x\n", SelIsFull));
+
+ return EFI_SUCCESS;
+}
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiBmcElog: Add to ManageabilityPkg
2023-05-12 9:58 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver Chang, Abner
@ 2023-05-12 9:58 ` Chang, Abner
2023-05-14 17:24 ` [edk2-devel] " Tinh Nguyen
2023-05-19 3:19 ` Isaac Oram
2023-05-14 17:24 ` [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver Tinh Nguyen
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Chang, Abner @ 2023-05-12 9:58 UTC (permalink / raw)
To: devel; +Cc: Isaac Oram, Abdul Lateef Attar, Nickle Wang
From: Abner Chang <abner.chang@amd.com>
Add IpmiBmcElog to ManageabilityPkg.
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>
---
Features/ManageabilityPkg/ManageabilityPkg.dec | 1 +
Features/ManageabilityPkg/Include/Manageability.dsc | 4 ++++
Features/ManageabilityPkg/ManageabilityPkg.dsc | 2 ++
Features/ManageabilityPkg/Include/PostMemory.fdf | 4 ++++
4 files changed, 11 insertions(+)
diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/ManageabilityPkg/ManageabilityPkg.dec
index 38813c5f48..7c36ec93ff 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -79,4 +79,5 @@
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable|FALSE|BOOLEAN|0x10000004
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE|BOOLEAN|0x10000005
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|FALSE|BOOLEAN|0x10000006
+ gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog|FALSE|BOOLEAN|0x1000000A
diff --git a/Features/ManageabilityPkg/Include/Manageability.dsc b/Features/ManageabilityPkg/Include/Manageability.dsc
index a432b0ff26..6806093d98 100644
--- a/Features/ManageabilityPkg/Include/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Manageability.dsc
@@ -51,3 +51,7 @@
!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
!endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog == TRUE
+ ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
+!endif
diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc b/Features/ManageabilityPkg/ManageabilityPkg.dsc
index e3baf27f2a..2262362f97 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
@@ -37,6 +37,7 @@
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable |TRUE
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable |TRUE
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|TRUE
+ gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog |TRUE
#
# Include common libraries
@@ -53,5 +54,6 @@
[LibraryClasses]
ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
+ IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
!include Include/Manageability.dsc
diff --git a/Features/ManageabilityPkg/Include/PostMemory.fdf b/Features/ManageabilityPkg/Include/PostMemory.fdf
index 9100cb2646..e4eed660fd 100644
--- a/Features/ManageabilityPkg/Include/PostMemory.fdf
+++ b/Features/ManageabilityPkg/Include/PostMemory.fdf
@@ -26,3 +26,7 @@
!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
INF ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
!endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog == TRUE
+ INF ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
+!endif
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver
2023-05-12 9:58 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver Chang, Abner
2023-05-12 9:58 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiBmcElog: Add to ManageabilityPkg Chang, Abner
@ 2023-05-14 17:24 ` Tinh Nguyen
2023-05-15 2:05 ` Chang, Abner
2023-05-15 3:10 ` Attar, AbdulLateef (Abdul Lateef)
2023-05-19 3:19 ` [edk2-devel] " Isaac Oram
3 siblings, 1 reply; 8+ messages in thread
From: Tinh Nguyen @ 2023-05-14 17:24 UTC (permalink / raw)
To: abner.chang, devel
Cc: Isaac Oram, Abdul Lateef Attar, Nickle Wang, Tinh Nguyen
There is a minor typo below
Reviewed-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
Regards,
- Tinh
On 12/05/2023 16:58, abner.chang@amd.com wrote:
> From: Abner Chang <abner.chang@amd.com>
>
> IpmiBmcElog is cloned from
> edk2-platforms/Features/Intel/OutOfBandManagement/
> IpmiFeaturePkg/BmcElog 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/BmcElog
> 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/IpmiBmcElog/BmcElog.inf | 33 +++
> .../Universal/IpmiBmcElog/BmcElog.c | 192 ++++++++++++++++++
> 2 files changed, 225 insertions(+)
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
> create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
>
> diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
> new file mode 100644
> index 0000000000..4c28862fe5
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
> @@ -0,0 +1,33 @@
> +### @file
> +# Component description file for BMC ELOG.
> +#
> +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +###
> +
> +[Defines]
> + INF_VERSION = 0x00010005
> + BASE_NAME = BmcElog
> + FILE_GUID = A0FF2235-B652-45E3-B3D2-B20F3E714E6F
> + MODULE_TYPE = DXE_DRIVER
> + PI_SPECIFICATION_VERSION = 0x0001000A
> + VERSION_STRING = 1.0
> + ENTRY_POINT = InitializeBmcElogLayer
> +
> +[Sources]
> + BmcElog.c
> +
> +[Packages]
> + ManageabilityPkg/ManageabilityPkg.dec
> + MdePkg/MdePkg.dec
> +
> +[LibraryClasses]
> + DebugLib
> + IpmiCommandLib
> + UefiBootServicesTableLib
> + UefiDriverEntryPoint
> +
> +[Depex]
> + TRUE
> diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
> new file mode 100644
> index 0000000000..ab179e9d49
> --- /dev/null
> +++ b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
> @@ -0,0 +1,192 @@
> +/** @file
> + BMC Event Log functions.
> +
> +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
> +SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Uefi.h>
> +#include <Library/BaseLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/BaseMemoryLib.h>
> +#include <Library/MemoryAllocationLib.h>
> +#include <Library/UefiBootServicesTableLib.h>
> +#include <Library/UefiRuntimeServicesTableLib.h>
> +#include <Library/IpmiCommandLib.h>
> +
> +EFI_STATUS
> +EFIAPI
> +CheckIfSelIsFull (
> + VOID
> + );
> +
> +/**
> + This function erases event logs and waits unti complete.
unti -> until
> +
> + @param [in] ResvId - Reserved ID
> +
> + @retval EFI_STATUS EFI_SUCCESS
> + EFI_NO_RESPONSE
> +
> +**/
> +EFI_STATUS
> +WaitTillErased (
> + IN UINT8 *ResvId
> + )
> +{
> + INTN Counter;
> + IPMI_CLEAR_SEL_REQUEST ClearSel;
> + IPMI_CLEAR_SEL_RESPONSE ClearSelResponse;
> +
> + Counter = 0x200;
> + ZeroMem (&ClearSelResponse, sizeof (ClearSelResponse));
> +
> + while (TRUE) {
> + ZeroMem (&ClearSel, sizeof (ClearSel));
> + ClearSel.Reserve[0] = ResvId[0];
> + ClearSel.Reserve[1] = ResvId[1];
> + ClearSel.AscC = 0x43;
> + ClearSel.AscL = 0x4C;
> + ClearSel.AscR = 0x52;
> + ClearSel.Erase = 0x00;
> +
> + IpmiClearSel (
> + &ClearSel,
> + &ClearSelResponse
> + );
> +
> + if ((ClearSelResponse.ErasureProgress & 0xf) == 1) {
> + return EFI_SUCCESS;
> + }
> +
> + //
> + // If there is not a response from the BMC controller we need to return and not hang.
> + //
> + --Counter;
> + if (Counter == 0x0) {
> + return EFI_NO_RESPONSE;
> + }
> + }
> +}
> +
> +/**
> + This function activates BMC event log.
> +
> + @param [in] EnableElog Enable/Disable event log
> + @param [out] ElogStatus return log status
> +
> + @retval EFI_STATUS
> +
> +**/
> +EFI_STATUS
> +EfiActivateBmcElog (
> + IN BOOLEAN *EnableElog,
> + OUT BOOLEAN *ElogStatus
> + )
> +{
> + EFI_STATUS Status;
> + UINT8 ElogStat;
> + IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables;
> + IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables;
> + UINT8 CompletionCode;
> +
> + Status = EFI_SUCCESS;
> + ElogStat = 0;
> +
> + Status = IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables);
> + if (EFI_ERROR (Status)) {
> + return Status;
> + }
> +
> + if (EnableElog == NULL) {
> + *ElogStatus = GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging;
> + } else {
> + if (Status == EFI_SUCCESS) {
> + if (*EnableElog) {
> + ElogStat = 1;
> + }
> +
> + CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, sizeof (UINT8));
> + SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging = ElogStat;
> +
> + Status = IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &CompletionCode);
> + }
> + }
> +
> + return Status;
> +}
> +
> +/**
> +
> + @retval EFI_STATUS
> +
> +**/
> +EFI_STATUS
> +SetElogRedirInstall (
> + VOID
> + )
> +{
> + BOOLEAN EnableElog;
> + BOOLEAN ElogStatus;
> +
> + //
> + // Activate the Event Log (This should depend upon Setup).
> + //
> + EfiActivateBmcElog (&EnableElog, &ElogStatus);
> + return EFI_SUCCESS;
> +}
> +
> +/**
> + Entry point of BmcElog DXE driver
> +
> + @param [in] ImageHandle ImageHandle of the loaded driver
> + @param [in] SystemTable Pointer to the System Table
> +
> + @retval EFI_STATUS
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +InitializeBmcElogLayer (
> + IN EFI_HANDLE ImageHandle,
> + IN EFI_SYSTEM_TABLE *SystemTable
> + )
> +{
> + SetElogRedirInstall ();
> +
> + CheckIfSelIsFull ();
> +
> + return EFI_SUCCESS;
> +}
> +
> +/**
> + This function verifies the BMC SEL is full and When it is
> + reports the error to the Error Manager.
> +
> + @retval EFI_STATUS
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +CheckIfSelIsFull (
> + VOID
> + )
> +{
> + EFI_STATUS Status;
> + UINT8 SelIsFull;
> + IPMI_GET_SEL_INFO_RESPONSE SelInfo;
> +
> + Status = IpmiGetSelInfo (&SelInfo);
> + if (EFI_ERROR (Status)) {
> + return EFI_DEVICE_ERROR;
> + }
> +
> + //
> + // Check the Bit7 of the OperationByte if SEL is OverFlow.
> + //
> + SelIsFull = (SelInfo.OperationSupport & 0x80);
> + DEBUG ((DEBUG_INFO, "SelIsFull - 0x%x\n", SelIsFull));
> +
> + return EFI_SUCCESS;
> +}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiBmcElog: Add to ManageabilityPkg
2023-05-12 9:58 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiBmcElog: Add to ManageabilityPkg Chang, Abner
@ 2023-05-14 17:24 ` Tinh Nguyen
2023-05-19 3:19 ` Isaac Oram
1 sibling, 0 replies; 8+ messages in thread
From: Tinh Nguyen @ 2023-05-14 17:24 UTC (permalink / raw)
To: devel, abner.chang; +Cc: Isaac Oram, Abdul Lateef Attar, Nickle Wang
Reviewed-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
Regards,
- Tinh
On 12/05/2023 16:58, Chang, Abner via groups.io wrote:
> From: Abner Chang <abner.chang@amd.com>
>
> Add IpmiBmcElog to ManageabilityPkg.
>
> 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>
> ---
> Features/ManageabilityPkg/ManageabilityPkg.dec | 1 +
> Features/ManageabilityPkg/Include/Manageability.dsc | 4 ++++
> Features/ManageabilityPkg/ManageabilityPkg.dsc | 2 ++
> Features/ManageabilityPkg/Include/PostMemory.fdf | 4 ++++
> 4 files changed, 11 insertions(+)
>
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/ManageabilityPkg/ManageabilityPkg.dec
> index 38813c5f48..7c36ec93ff 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dec
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
> @@ -79,4 +79,5 @@
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable|FALSE|BOOLEAN|0x10000004
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE|BOOLEAN|0x10000005
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|FALSE|BOOLEAN|0x10000006
> + gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog|FALSE|BOOLEAN|0x1000000A
>
> diff --git a/Features/ManageabilityPkg/Include/Manageability.dsc b/Features/ManageabilityPkg/Include/Manageability.dsc
> index a432b0ff26..6806093d98 100644
> --- a/Features/ManageabilityPkg/Include/Manageability.dsc
> +++ b/Features/ManageabilityPkg/Include/Manageability.dsc
> @@ -51,3 +51,7 @@
> !if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
> ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
> !endif
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog == TRUE
> + ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
> +!endif
> diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> index e3baf27f2a..2262362f97 100644
> --- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
> +++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
> @@ -37,6 +37,7 @@
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable |TRUE
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable |TRUE
> gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|TRUE
> + gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog |TRUE
>
> #
> # Include common libraries
> @@ -53,5 +54,6 @@
>
> [LibraryClasses]
> ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
> + IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
>
> !include Include/Manageability.dsc
> diff --git a/Features/ManageabilityPkg/Include/PostMemory.fdf b/Features/ManageabilityPkg/Include/PostMemory.fdf
> index 9100cb2646..e4eed660fd 100644
> --- a/Features/ManageabilityPkg/Include/PostMemory.fdf
> +++ b/Features/ManageabilityPkg/Include/PostMemory.fdf
> @@ -26,3 +26,7 @@
> !if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
> INF ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
> !endif
> +
> +!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog == TRUE
> + INF ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
> +!endif
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver
2023-05-14 17:24 ` [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver Tinh Nguyen
@ 2023-05-15 2:05 ` Chang, Abner
0 siblings, 0 replies; 8+ messages in thread
From: Chang, Abner @ 2023-05-15 2:05 UTC (permalink / raw)
To: Tinh Nguyen, devel@edk2.groups.io
Cc: Isaac Oram, Attar, AbdulLateef (Abdul Lateef), Nickle Wang,
Tinh Nguyen
[AMD Official Use Only - General]
Typo fixed, I will do the spell check for the new submitted patch.
Thank you.
Abner
> -----Original Message-----
> From: Tinh Nguyen <tinhnguyen@amperemail.onmicrosoft.com>
> Sent: Monday, May 15, 2023 1:24 AM
> To: Chang, Abner <Abner.Chang@amd.com>; devel@edk2.groups.io
> Cc: Isaac Oram <isaac.w.oram@intel.com>; Attar, AbdulLateef (Abdul Lateef)
> <AbdulLateef.Attar@amd.com>; Nickle Wang <nicklew@nvidia.com>; Tinh
> Nguyen <tinhnguyen@os.amperecomputing.com>
> Subject: Re: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog:
> IPMI BMC Elog Driver
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> There is a minor typo below
>
> Reviewed-by: Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
>
> Regards,
>
> - Tinh
>
>
> On 12/05/2023 16:58, abner.chang@amd.com wrote:
> > From: Abner Chang <abner.chang@amd.com>
> >
> > IpmiBmcElog is cloned from
> > edk2-platforms/Features/Intel/OutOfBandManagement/
> > IpmiFeaturePkg/BmcElog 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/BmcElog
> > 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/IpmiBmcElog/BmcElog.inf | 33 +++
> > .../Universal/IpmiBmcElog/BmcElog.c | 192 ++++++++++++++++++
> > 2 files changed, 225 insertions(+)
> > create mode 100644
> Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
> > create mode 100644
> Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
> >
> > diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
> b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
> > new file mode 100644
> > index 0000000000..4c28862fe5
> > --- /dev/null
> > +++ b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
> > @@ -0,0 +1,33 @@
> > +### @file
> > +# Component description file for BMC ELOG.
> > +#
> > +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
> > +#
> > +# SPDX-License-Identifier: BSD-2-Clause-Patent
> > +#
> > +###
> > +
> > +[Defines]
> > + INF_VERSION = 0x00010005
> > + BASE_NAME = BmcElog
> > + FILE_GUID = A0FF2235-B652-45E3-B3D2-B20F3E714E6F
> > + MODULE_TYPE = DXE_DRIVER
> > + PI_SPECIFICATION_VERSION = 0x0001000A
> > + VERSION_STRING = 1.0
> > + ENTRY_POINT = InitializeBmcElogLayer
> > +
> > +[Sources]
> > + BmcElog.c
> > +
> > +[Packages]
> > + ManageabilityPkg/ManageabilityPkg.dec
> > + MdePkg/MdePkg.dec
> > +
> > +[LibraryClasses]
> > + DebugLib
> > + IpmiCommandLib
> > + UefiBootServicesTableLib
> > + UefiDriverEntryPoint
> > +
> > +[Depex]
> > + TRUE
> > diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
> b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
> > new file mode 100644
> > index 0000000000..ab179e9d49
> > --- /dev/null
> > +++ b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
> > @@ -0,0 +1,192 @@
> > +/** @file
> > + BMC Event Log functions.
> > +
> > +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
> > +SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +**/
> > +
> > +#include <Uefi.h>
> > +#include <Library/BaseLib.h>
> > +#include <Library/DebugLib.h>
> > +#include <Library/BaseMemoryLib.h>
> > +#include <Library/MemoryAllocationLib.h>
> > +#include <Library/UefiBootServicesTableLib.h>
> > +#include <Library/UefiRuntimeServicesTableLib.h>
> > +#include <Library/IpmiCommandLib.h>
> > +
> > +EFI_STATUS
> > +EFIAPI
> > +CheckIfSelIsFull (
> > + VOID
> > + );
> > +
> > +/**
> > + This function erases event logs and waits unti complete.
> unti -> until
> > +
> > + @param [in] ResvId - Reserved ID
> > +
> > + @retval EFI_STATUS EFI_SUCCESS
> > + EFI_NO_RESPONSE
> > +
> > +**/
> > +EFI_STATUS
> > +WaitTillErased (
> > + IN UINT8 *ResvId
> > + )
> > +{
> > + INTN Counter;
> > + IPMI_CLEAR_SEL_REQUEST ClearSel;
> > + IPMI_CLEAR_SEL_RESPONSE ClearSelResponse;
> > +
> > + Counter = 0x200;
> > + ZeroMem (&ClearSelResponse, sizeof (ClearSelResponse));
> > +
> > + while (TRUE) {
> > + ZeroMem (&ClearSel, sizeof (ClearSel));
> > + ClearSel.Reserve[0] = ResvId[0];
> > + ClearSel.Reserve[1] = ResvId[1];
> > + ClearSel.AscC = 0x43;
> > + ClearSel.AscL = 0x4C;
> > + ClearSel.AscR = 0x52;
> > + ClearSel.Erase = 0x00;
> > +
> > + IpmiClearSel (
> > + &ClearSel,
> > + &ClearSelResponse
> > + );
> > +
> > + if ((ClearSelResponse.ErasureProgress & 0xf) == 1) {
> > + return EFI_SUCCESS;
> > + }
> > +
> > + //
> > + // If there is not a response from the BMC controller we need to return
> and not hang.
> > + //
> > + --Counter;
> > + if (Counter == 0x0) {
> > + return EFI_NO_RESPONSE;
> > + }
> > + }
> > +}
> > +
> > +/**
> > + This function activates BMC event log.
> > +
> > + @param [in] EnableElog Enable/Disable event log
> > + @param [out] ElogStatus return log status
> > +
> > + @retval EFI_STATUS
> > +
> > +**/
> > +EFI_STATUS
> > +EfiActivateBmcElog (
> > + IN BOOLEAN *EnableElog,
> > + OUT BOOLEAN *ElogStatus
> > + )
> > +{
> > + EFI_STATUS Status;
> > + UINT8 ElogStat;
> > + IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables;
> > + IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables;
> > + UINT8 CompletionCode;
> > +
> > + Status = EFI_SUCCESS;
> > + ElogStat = 0;
> > +
> > + Status = IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables);
> > + if (EFI_ERROR (Status)) {
> > + return Status;
> > + }
> > +
> > + if (EnableElog == NULL) {
> > + *ElogStatus =
> GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging;
> > + } else {
> > + if (Status == EFI_SUCCESS) {
> > + if (*EnableElog) {
> > + ElogStat = 1;
> > + }
> > +
> > + CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables
> + 1, sizeof (UINT8));
> > + SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging = ElogStat;
> > +
> > + Status = IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables,
> &CompletionCode);
> > + }
> > + }
> > +
> > + return Status;
> > +}
> > +
> > +/**
> > +
> > + @retval EFI_STATUS
> > +
> > +**/
> > +EFI_STATUS
> > +SetElogRedirInstall (
> > + VOID
> > + )
> > +{
> > + BOOLEAN EnableElog;
> > + BOOLEAN ElogStatus;
> > +
> > + //
> > + // Activate the Event Log (This should depend upon Setup).
> > + //
> > + EfiActivateBmcElog (&EnableElog, &ElogStatus);
> > + return EFI_SUCCESS;
> > +}
> > +
> > +/**
> > + Entry point of BmcElog DXE driver
> > +
> > + @param [in] ImageHandle ImageHandle of the loaded driver
> > + @param [in] SystemTable Pointer to the System Table
> > +
> > + @retval EFI_STATUS
> > +
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +InitializeBmcElogLayer (
> > + IN EFI_HANDLE ImageHandle,
> > + IN EFI_SYSTEM_TABLE *SystemTable
> > + )
> > +{
> > + SetElogRedirInstall ();
> > +
> > + CheckIfSelIsFull ();
> > +
> > + return EFI_SUCCESS;
> > +}
> > +
> > +/**
> > + This function verifies the BMC SEL is full and When it is
> > + reports the error to the Error Manager.
> > +
> > + @retval EFI_STATUS
> > +
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +CheckIfSelIsFull (
> > + VOID
> > + )
> > +{
> > + EFI_STATUS Status;
> > + UINT8 SelIsFull;
> > + IPMI_GET_SEL_INFO_RESPONSE SelInfo;
> > +
> > + Status = IpmiGetSelInfo (&SelInfo);
> > + if (EFI_ERROR (Status)) {
> > + return EFI_DEVICE_ERROR;
> > + }
> > +
> > + //
> > + // Check the Bit7 of the OperationByte if SEL is OverFlow.
> > + //
> > + SelIsFull = (SelInfo.OperationSupport & 0x80);
> > + DEBUG ((DEBUG_INFO, "SelIsFull - 0x%x\n", SelIsFull));
> > +
> > + return EFI_SUCCESS;
> > +}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver
2023-05-12 9:58 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver Chang, Abner
2023-05-12 9:58 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiBmcElog: Add to ManageabilityPkg Chang, Abner
2023-05-14 17:24 ` [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver Tinh Nguyen
@ 2023-05-15 3:10 ` Attar, AbdulLateef (Abdul Lateef)
2023-05-19 3:19 ` [edk2-devel] " Isaac Oram
3 siblings, 0 replies; 8+ messages in thread
From: Attar, AbdulLateef (Abdul Lateef) @ 2023-05-15 3:10 UTC (permalink / raw)
To: Chang, Abner, devel@edk2.groups.io; +Cc: Isaac Oram, Nickle Wang, Tinh Nguyen
[AMD Official Use Only - General]
Reviewed-by: Abdul Lateef Attar <abdattar@amd.com>
-----Original Message-----
From: Chang, Abner <Abner.Chang@amd.com>
Sent: 12 May 2023 15:28
To: devel@edk2.groups.io
Cc: Isaac Oram <isaac.w.oram@intel.com>; Attar, AbdulLateef (Abdul Lateef) <AbdulLateef.Attar@amd.com>; Nickle Wang <nicklew@nvidia.com>; Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
Subject: [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver
From: Abner Chang <abner.chang@amd.com>
IpmiBmcElog is cloned from
edk2-platforms/Features/Intel/OutOfBandManagement/
IpmiFeaturePkg/BmcElog 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/BmcElog 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/IpmiBmcElog/BmcElog.inf | 33 +++
.../Universal/IpmiBmcElog/BmcElog.c | 192 ++++++++++++++++++
2 files changed, 225 insertions(+)
create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
new file mode 100644
index 0000000000..4c28862fe5
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
@@ -0,0 +1,33 @@
+### @file
+# Component description file for BMC ELOG.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights
+reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # ###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BmcElog
+ FILE_GUID = A0FF2235-B652-45E3-B3D2-B20F3E714E6F
+ MODULE_TYPE = DXE_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeBmcElogLayer
+
+[Sources]
+ BmcElog.c
+
+[Packages]
+ ManageabilityPkg/ManageabilityPkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ DebugLib
+ IpmiCommandLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+
+[Depex]
+ TRUE
diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
new file mode 100644
index 0000000000..ab179e9d49
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
@@ -0,0 +1,192 @@
+/** @file
+ BMC Event Log functions.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h> #include
+<Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+
+EFI_STATUS
+EFIAPI
+CheckIfSelIsFull (
+ VOID
+ );
+
+/**
+ This function erases event logs and waits unti complete.
+
+ @param [in] ResvId - Reserved ID
+
+ @retval EFI_STATUS EFI_SUCCESS
+ EFI_NO_RESPONSE
+
+**/
+EFI_STATUS
+WaitTillErased (
+ IN UINT8 *ResvId
+ )
+{
+ INTN Counter;
+ IPMI_CLEAR_SEL_REQUEST ClearSel;
+ IPMI_CLEAR_SEL_RESPONSE ClearSelResponse;
+
+ Counter = 0x200;
+ ZeroMem (&ClearSelResponse, sizeof (ClearSelResponse));
+
+ while (TRUE) {
+ ZeroMem (&ClearSel, sizeof (ClearSel));
+ ClearSel.Reserve[0] = ResvId[0];
+ ClearSel.Reserve[1] = ResvId[1];
+ ClearSel.AscC = 0x43;
+ ClearSel.AscL = 0x4C;
+ ClearSel.AscR = 0x52;
+ ClearSel.Erase = 0x00;
+
+ IpmiClearSel (
+ &ClearSel,
+ &ClearSelResponse
+ );
+
+ if ((ClearSelResponse.ErasureProgress & 0xf) == 1) {
+ return EFI_SUCCESS;
+ }
+
+ //
+ // If there is not a response from the BMC controller we need to return and not hang.
+ //
+ --Counter;
+ if (Counter == 0x0) {
+ return EFI_NO_RESPONSE;
+ }
+ }
+}
+
+/**
+ This function activates BMC event log.
+
+ @param [in] EnableElog Enable/Disable event log @param [out]
+ ElogStatus return log status
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+EfiActivateBmcElog (
+ IN BOOLEAN *EnableElog,
+ OUT BOOLEAN *ElogStatus
+ )
+{
+ EFI_STATUS Status;
+ UINT8 ElogStat;
+ IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables;
+ IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables;
+ UINT8 CompletionCode;
+
+ Status = EFI_SUCCESS;
+ ElogStat = 0;
+
+ Status = IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables); if
+ (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (EnableElog == NULL) {
+ *ElogStatus =
+ GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging;
+ } else {
+ if (Status == EFI_SUCCESS) {
+ if (*EnableElog) {
+ ElogStat = 1;
+ }
+
+ CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, sizeof (UINT8));
+ SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging =
+ ElogStat;
+
+ Status = IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &CompletionCode);
+ }
+ }
+
+ return Status;
+}
+
+/**
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+SetElogRedirInstall (
+ VOID
+ )
+{
+ BOOLEAN EnableElog;
+ BOOLEAN ElogStatus;
+
+ //
+ // Activate the Event Log (This should depend upon Setup).
+ //
+ EfiActivateBmcElog (&EnableElog, &ElogStatus);
+ return EFI_SUCCESS;
+}
+
+/**
+ Entry point of BmcElog DXE driver
+
+ @param [in] ImageHandle ImageHandle of the loaded driver @param
+ [in] SystemTable Pointer to the System Table
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeBmcElogLayer (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ SetElogRedirInstall ();
+
+ CheckIfSelIsFull ();
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function verifies the BMC SEL is full and When it is
+ reports the error to the Error Manager.
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+EFIAPI
+CheckIfSelIsFull (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT8 SelIsFull;
+ IPMI_GET_SEL_INFO_RESPONSE SelInfo;
+
+ Status = IpmiGetSelInfo (&SelInfo);
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ //
+ // Check the Bit7 of the OperationByte if SEL is OverFlow.
+ //
+ SelIsFull = (SelInfo.OperationSupport & 0x80); DEBUG ((DEBUG_INFO,
+ "SelIsFull - 0x%x\n", SelIsFull));
+
+ return EFI_SUCCESS;
+}
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver
2023-05-12 9:58 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver Chang, Abner
` (2 preceding siblings ...)
2023-05-15 3:10 ` Attar, AbdulLateef (Abdul Lateef)
@ 2023-05-19 3:19 ` Isaac Oram
3 siblings, 0 replies; 8+ messages in thread
From: Isaac Oram @ 2023-05-19 3:19 UTC (permalink / raw)
To: devel@edk2.groups.io, abner.chang@amd.com
Cc: Abdul Lateef Attar, Nickle Wang, Tinh Nguyen
Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang, Abner via groups.io
Sent: Friday, May 12, 2023 2:58 AM
To: devel@edk2.groups.io
Cc: Oram, Isaac W <isaac.w.oram@intel.com>; Abdul Lateef Attar <abdattar@amd.com>; Nickle Wang <nicklew@nvidia.com>; Tinh Nguyen <tinhnguyen@os.amperecomputing.com>
Subject: [edk2-devel] [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver
From: Abner Chang <abner.chang@amd.com>
IpmiBmcElog is cloned from
edk2-platforms/Features/Intel/OutOfBandManagement/
IpmiFeaturePkg/BmcElog 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/BmcElog 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/IpmiBmcElog/BmcElog.inf | 33 +++
.../Universal/IpmiBmcElog/BmcElog.c | 192 ++++++++++++++++++
2 files changed, 225 insertions(+)
create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
create mode 100644 Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
new file mode 100644
index 0000000000..4c28862fe5
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
@@ -0,0 +1,33 @@
+### @file
+# Component description file for BMC ELOG.
+#
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights
+reserved.<BR> # # SPDX-License-Identifier: BSD-2-Clause-Patent # ###
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BmcElog
+ FILE_GUID = A0FF2235-B652-45E3-B3D2-B20F3E714E6F
+ MODULE_TYPE = DXE_DRIVER
+ PI_SPECIFICATION_VERSION = 0x0001000A
+ VERSION_STRING = 1.0
+ ENTRY_POINT = InitializeBmcElogLayer
+
+[Sources]
+ BmcElog.c
+
+[Packages]
+ ManageabilityPkg/ManageabilityPkg.dec
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ DebugLib
+ IpmiCommandLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+
+[Depex]
+ TRUE
diff --git a/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
new file mode 100644
index 0000000000..ab179e9d49
--- /dev/null
+++ b/Features/ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.c
@@ -0,0 +1,192 @@
+/** @file
+ BMC Event Log functions.
+
+Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h> #include
+<Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
+#include <Library/IpmiCommandLib.h>
+
+EFI_STATUS
+EFIAPI
+CheckIfSelIsFull (
+ VOID
+ );
+
+/**
+ This function erases event logs and waits unti complete.
+
+ @param [in] ResvId - Reserved ID
+
+ @retval EFI_STATUS EFI_SUCCESS
+ EFI_NO_RESPONSE
+
+**/
+EFI_STATUS
+WaitTillErased (
+ IN UINT8 *ResvId
+ )
+{
+ INTN Counter;
+ IPMI_CLEAR_SEL_REQUEST ClearSel;
+ IPMI_CLEAR_SEL_RESPONSE ClearSelResponse;
+
+ Counter = 0x200;
+ ZeroMem (&ClearSelResponse, sizeof (ClearSelResponse));
+
+ while (TRUE) {
+ ZeroMem (&ClearSel, sizeof (ClearSel));
+ ClearSel.Reserve[0] = ResvId[0];
+ ClearSel.Reserve[1] = ResvId[1];
+ ClearSel.AscC = 0x43;
+ ClearSel.AscL = 0x4C;
+ ClearSel.AscR = 0x52;
+ ClearSel.Erase = 0x00;
+
+ IpmiClearSel (
+ &ClearSel,
+ &ClearSelResponse
+ );
+
+ if ((ClearSelResponse.ErasureProgress & 0xf) == 1) {
+ return EFI_SUCCESS;
+ }
+
+ //
+ // If there is not a response from the BMC controller we need to return and not hang.
+ //
+ --Counter;
+ if (Counter == 0x0) {
+ return EFI_NO_RESPONSE;
+ }
+ }
+}
+
+/**
+ This function activates BMC event log.
+
+ @param [in] EnableElog Enable/Disable event log @param [out]
+ ElogStatus return log status
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+EfiActivateBmcElog (
+ IN BOOLEAN *EnableElog,
+ OUT BOOLEAN *ElogStatus
+ )
+{
+ EFI_STATUS Status;
+ UINT8 ElogStat;
+ IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables;
+ IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables;
+ UINT8 CompletionCode;
+
+ Status = EFI_SUCCESS;
+ ElogStat = 0;
+
+ Status = IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables); if
+ (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (EnableElog == NULL) {
+ *ElogStatus =
+ GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging;
+ } else {
+ if (Status == EFI_SUCCESS) {
+ if (*EnableElog) {
+ ElogStat = 1;
+ }
+
+ CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, sizeof (UINT8));
+ SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging =
+ ElogStat;
+
+ Status = IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &CompletionCode);
+ }
+ }
+
+ return Status;
+}
+
+/**
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+SetElogRedirInstall (
+ VOID
+ )
+{
+ BOOLEAN EnableElog;
+ BOOLEAN ElogStatus;
+
+ //
+ // Activate the Event Log (This should depend upon Setup).
+ //
+ EfiActivateBmcElog (&EnableElog, &ElogStatus);
+ return EFI_SUCCESS;
+}
+
+/**
+ Entry point of BmcElog DXE driver
+
+ @param [in] ImageHandle ImageHandle of the loaded driver @param
+ [in] SystemTable Pointer to the System Table
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+EFIAPI
+InitializeBmcElogLayer (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ SetElogRedirInstall ();
+
+ CheckIfSelIsFull ();
+
+ return EFI_SUCCESS;
+}
+
+/**
+ This function verifies the BMC SEL is full and When it is
+ reports the error to the Error Manager.
+
+ @retval EFI_STATUS
+
+**/
+EFI_STATUS
+EFIAPI
+CheckIfSelIsFull (
+ VOID
+ )
+{
+ EFI_STATUS Status;
+ UINT8 SelIsFull;
+ IPMI_GET_SEL_INFO_RESPONSE SelInfo;
+
+ Status = IpmiGetSelInfo (&SelInfo);
+ if (EFI_ERROR (Status)) {
+ return EFI_DEVICE_ERROR;
+ }
+
+ //
+ // Check the Bit7 of the OperationByte if SEL is OverFlow.
+ //
+ SelIsFull = (SelInfo.OperationSupport & 0x80); DEBUG ((DEBUG_INFO,
+ "SelIsFull - 0x%x\n", SelIsFull));
+
+ return EFI_SUCCESS;
+}
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiBmcElog: Add to ManageabilityPkg
2023-05-12 9:58 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiBmcElog: Add to ManageabilityPkg Chang, Abner
2023-05-14 17:24 ` [edk2-devel] " Tinh Nguyen
@ 2023-05-19 3:19 ` Isaac Oram
1 sibling, 0 replies; 8+ messages in thread
From: Isaac Oram @ 2023-05-19 3:19 UTC (permalink / raw)
To: devel@edk2.groups.io, abner.chang@amd.com; +Cc: Abdul Lateef Attar, Nickle Wang
Reviewed-by: Isaac Oram <isaac.w.oram@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang, Abner via groups.io
Sent: Friday, May 12, 2023 2:58 AM
To: devel@edk2.groups.io
Cc: Oram, Isaac W <isaac.w.oram@intel.com>; Abdul Lateef Attar <abdattar@amd.com>; Nickle Wang <nicklew@nvidia.com>
Subject: [edk2-devel] [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiBmcElog: Add to ManageabilityPkg
From: Abner Chang <abner.chang@amd.com>
Add IpmiBmcElog to ManageabilityPkg.
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>
---
Features/ManageabilityPkg/ManageabilityPkg.dec | 1 +
Features/ManageabilityPkg/Include/Manageability.dsc | 4 ++++
Features/ManageabilityPkg/ManageabilityPkg.dsc | 2 ++
Features/ManageabilityPkg/Include/PostMemory.fdf | 4 ++++
4 files changed, 11 insertions(+)
diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dec b/Features/ManageabilityPkg/ManageabilityPkg.dec
index 38813c5f48..7c36ec93ff 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dec
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dec
@@ -79,4 +79,5 @@
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable|FALSE|BOOLEAN|0x10000004
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable|FALSE|BOOLEAN|0x10000005
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|FALSE|BOOLEAN|0x10000006
+ gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog|FALSE|BOOLEAN|0x1000000A
diff --git a/Features/ManageabilityPkg/Include/Manageability.dsc b/Features/ManageabilityPkg/Include/Manageability.dsc
index a432b0ff26..6806093d98 100644
--- a/Features/ManageabilityPkg/Include/Manageability.dsc
+++ b/Features/ManageabilityPkg/Include/Manageability.dsc
@@ -51,3 +51,7 @@
!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
!endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog == TRUE
+ ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
+!endif
diff --git a/Features/ManageabilityPkg/ManageabilityPkg.dsc b/Features/ManageabilityPkg/ManageabilityPkg.dsc
index e3baf27f2a..2262362f97 100644
--- a/Features/ManageabilityPkg/ManageabilityPkg.dsc
+++ b/Features/ManageabilityPkg/ManageabilityPkg.dsc
@@ -37,6 +37,7 @@
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmEnable |TRUE
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable |TRUE
gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxePldmSmbiosTransferEnable|TRUE
+ gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog |TRUE
#
# Include common libraries
@@ -53,5 +54,6 @@
[LibraryClasses]
ManageabilityTransportLib|ManageabilityPkg/Library/BaseManageabilityTransportNullLib/BaseManageabilityTransportNull.inf
+ IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf
!include Include/Manageability.dsc
diff --git a/Features/ManageabilityPkg/Include/PostMemory.fdf b/Features/ManageabilityPkg/Include/PostMemory.fdf
index 9100cb2646..e4eed660fd 100644
--- a/Features/ManageabilityPkg/Include/PostMemory.fdf
+++ b/Features/ManageabilityPkg/Include/PostMemory.fdf
@@ -26,3 +26,7 @@
!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeMctpEnable == TRUE
INF ManageabilityPkg/Universal/MctpProtocol/Dxe/MctpProtocolDxe.inf
!endif
+
+!if gManageabilityPkgTokenSpaceGuid.PcdManageabilityDxeIpmiBmcElog == TRUE
+ INF ManageabilityPkg/Universal/IpmiBmcElog/BmcElog.inf
+!endif
--
2.37.1.windows.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-05-19 3:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-12 9:58 [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver Chang, Abner
2023-05-12 9:58 ` [edk2-platforms][PATCH 2/2] ManageabilityPkg/IpmiBmcElog: Add to ManageabilityPkg Chang, Abner
2023-05-14 17:24 ` [edk2-devel] " Tinh Nguyen
2023-05-19 3:19 ` Isaac Oram
2023-05-14 17:24 ` [edk2-platforms][PATCH 1/2] ManageabilityPkg/IpmiBmcElog: IPMI BMC Elog Driver Tinh Nguyen
2023-05-15 2:05 ` Chang, Abner
2023-05-15 3:10 ` Attar, AbdulLateef (Abdul Lateef)
2023-05-19 3:19 ` [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