From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web10.1155.1575447753046547479 for ; Wed, 04 Dec 2019 00:22:33 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: rangasai.v.chaganty@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Dec 2019 00:22:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,276,1571727600"; d="scan'208";a="208770224" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga007.fm.intel.com with ESMTP; 04 Dec 2019 00:22:31 -0800 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 4 Dec 2019 00:22:31 -0800 Received: from fmsmsx104.amr.corp.intel.com ([169.254.3.245]) by fmsmsx156.amr.corp.intel.com ([169.254.13.184]) with mapi id 14.03.0439.000; Wed, 4 Dec 2019 00:22:30 -0800 From: "Chaganty, Rangasai V" To: "Kubacki, Michael A" , "devel@edk2.groups.io" CC: "Gao, Liming" Subject: Re: [edk2-platforms][PATCH V2 15/47] Features/Intel/IpmiFeaturePkg: Add modules Thread-Topic: [edk2-platforms][PATCH V2 15/47] Features/Intel/IpmiFeaturePkg: Add modules Thread-Index: AQHVpYg06eLjS+PG6kSbDkvFjO5ee6eprJIA Date: Wed, 4 Dec 2019 08:22:29 +0000 Message-ID: References: <20191128010614.43628-1-michael.a.kubacki@intel.com> <20191128010614.43628-16-michael.a.kubacki@intel.com> In-Reply-To: <20191128010614.43628-16-michael.a.kubacki@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiY2Q0OTQ0OGMtMjBmMi00ZDk4LWE2YmUtYTA5NWI0OGIwNDM0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTUpibVU0a1M2emsxbFNMeEkzMUk2K3ZrXC8ra0wwUjBVczFcL3hyWWdNWjhVXC8wSk5Tc3B2M2xHVlBwK2NKdkx0UCJ9 x-ctpclassification: CTP_NT x-originating-ip: [10.1.200.107] MIME-Version: 1.0 Return-Path: rangasai.v.chaganty@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Sai Chaganty -----Original Message----- From: Kubacki, Michael A=20 Sent: Wednesday, November 27, 2019 5:06 PM To: devel@edk2.groups.io Cc: Chaganty, Rangasai V ; Gao, Liming Subject: [edk2-platforms][PATCH V2 15/47] Features/Intel/IpmiFeaturePkg: Ad= d modules This change adds the modules for the IPMI feature to IpmiFeaturePkg. Cc: Sai Chaganty Cc: Liming Gao Signed-off-by: Michael Kubacki --- Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec = | 8 + Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature.dsc = | 78 +++++- Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc = | 2 + Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.fdf = | 8 + Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.fdf = | 3 + Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf = | 47 ++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf = | 33 +++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf = | 37 +++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf = | 37 +++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf = | 35 +++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf= | 34 +++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf= | 32 +++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf = | 33 +++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf = | 37 +++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c = | 257 ++++++++++++++++++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c = | 236 ++++++++++++++++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c = | 236 ++++++++++++++++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c = | 84 +++++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c = | 67 +++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.c = | 150 ++++++++++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.c = | 96 ++++++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c = | 112 +++++++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.c = | 164 +++++++++++++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/BmcSsdt.= asl | 28 +++ Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/IpmiOprR= egions.asi | 58 +++++ 25 files changed, 1909 insertions(+), 3 deletions(-) diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeatureP= kg.dec b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d= ec index 4c43fc5f49..1426496d28 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec @@ -36,3 +36,11 @@ =20 [PcdsFeatureFlag] gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiFeatureEnable|FALSE|BOOLEAN|0xA0000= 001 + +[PcdsFixedAtBuild] + gIpmiFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels|3|UINT8|0xF0000001 + +[PcdsDynamic, PcdsDynamicEx] + gIpmiFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag|TRUE|BOOLEAN|0xD0000001 + gIpmiFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue|360|UINT16|0xD0000002 + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress|0xCA2|UINT16|0xD00000= 03 diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Ipmi= Feature.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Ipm= iFeature.dsc index c6a385108b..a82f18a68c 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature= .dsc +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/IpmiFeature= .dsc @@ -18,6 +18,12 @@ # ##########################################################################= ###### [Defines] +!ifndef $(PEI_ARCH) + !error "PEI_ARCH must be specified to build this feature!" +!endif +!ifndef $(DXE_ARCH) + !error "DXE_ARCH must be specified to build this feature!" +!endif =20 ##########################################################################= ###### # @@ -32,6 +38,36 @@ BaseMemoryLib|MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf IpmiLib|MdeModulePkg/Library/BaseIpmiLibNull/BaseIpmiLibNull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplat= e.inf + + ##################################### + # IPMI Feature Package + ##################################### + IpmiCommandLib|OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib= /IpmiCommandLib.inf + +[LibraryClasses.common.PEI_CORE,LibraryClasses.common.PEIM] + ####################################### + # Edk2 Packages + ####################################### + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLibIdt/= PeiServicesTablePointerLibIdt.inf + +[LibraryClasses.common.DXE_DRIVER,LibraryClasses.common.UEFI_DRIVER] + ####################################### + # Edk2 Packages + ####################################### + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf =20 ##########################################################################= ###### # @@ -47,17 +83,50 @@ # generated for it, but the binary will not be put into any firmware= volume. # ##########################################################################= ###### -[Components] +# +# Feature PEI Components +# + +# @todo: Change below line to [Components.$(PEI_ARCH)] after https://bugzi= lla.tianocore.org/show_bug.cgi?id=3D2308 +# is completed. +[Components.IA32] + ##################################### + # IPMI Feature Package + ##################################### + + # Add library instances here that are not included in package components= and should be tested + # in the package build. + + OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiP= latformHookLibNull.inf + + # Add components here that should be included in the package build. + OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf + OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf + +# +# Feature DXE Components +# + +# @todo: Change below line to [Components.$(DXE_ARCH)] after https://bugzi= lla.tianocore.org/show_bug.cgi?id=3D2308 +# is completed. +[Components.X64] ##################################### # IPMI Feature Package ##################################### =20 # Add library instances here that are not included in package components= and should be tested # in the package build. - OutOfBandManagement/IpmiFeaturePkg/Library/IpmiCommandLib/IpmiCommandLib= .inf + OutOfBandManagement/IpmiFeaturePkg/Library/IpmiPlatformHookLibNull/IpmiP= latformHookLibNull.inf =20 # Add components here that should be included in the package build. + OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf + OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf + OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf + OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf + OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf + OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf + OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf =20 ##########################################################################= ######################### # @@ -67,6 +136,9 @@ # applied for any modules or only those modules wit= h the specific # module style (EDK or EDKII) specified in [Compone= nts] section. # +# For advanced features, it is recommended to enabl= e [BuildOptions] in +# the applicable INF file so it does not affect the= whole board package +# build when this DSC file is active. +# ##########################################################################= ######################### [BuildOptions] - *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeatureP= kg.dsc b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.d= sc index 623a52650f..6a3eed0882 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dsc @@ -22,6 +22,8 @@ SUPPORTED_ARCHITECTURES =3D IA32|X64 BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT SKUID_IDENTIFIER =3D DEFAULT + PEI_ARCH =3D IA32 + DXE_ARCH =3D X64 =20 # # This package always builds the feature. diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Post= Memory.fdf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/Post= Memory.fdf index c3847c54c7..b5b37ddd9f 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.= fdf +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PostMemory.= fdf @@ -6,3 +6,11 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent # ## + + INF OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf + INF OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf + INF OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf + INF OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf + INF OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiInit.inf + INF OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf + INF OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus.inf diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreM= emory.fdf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMe= mory.fdf index 0c82d7eb02..4aa2d8e9da 100644 --- a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.f= df +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Include/PreMemory.f= df @@ -6,3 +6,6 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent # ## + +INF OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf +INF OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiInit.inf diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcA= cpi.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi= .inf new file mode 100644 index 0000000000..a84813f55c --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.inf @@ -0,0 +1,47 @@ +### @file +# Component description file for BMC ACPI. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BmcAcpi + FILE_GUID =3D F59DAA23-D5D5-4d16-91FC-D03ABDC12FFE + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D BmcAcpiEntryPoint + +[Sources] + BmcAcpi.c + BmcSsdt/BmcSsdt.asl + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + UefiDriverEntryPoint + BaseMemoryLib + DebugLib + UefiLib + +[Protocols] + gEfiFirmwareVolume2ProtocolGuid + gEfiAcpiTableProtocolGuid + +[Pcd] + gIpmiFeaturePkgTokenSpaceGuid.PcdIpmiIoBaseAddress + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId + +[Depex] + gEfiAcpiTableProtocolGuid + +[BuildOptions] + *_*_*_ASL_FLAGS =3D -oi diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcE= log.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog= .inf new file mode 100644 index 0000000000..665b3d9bda --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.inf @@ -0,0 +1,33 @@ +### @file +# Component description file for BMC ELOG. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BmcElog + FILE_GUID =3D 8A17F6CA-BF1A-45C4-FFFF-FFFF0C829DDD + MODULE_TYPE =3D DXE_DRIVER + PI_SPECIFICATION_VERSION =3D 0x0001000A + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InitializeBmcElogLayer + +[Sources] + BmcElog.c + +[Packages] + MdePkg/MdePkg.dec + OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + DebugLib + UefiBootServicesTableLib + IpmiCommandLib + +[Depex] + TRUE diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.i= nf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf new file mode 100644 index 0000000000..85836cd8ee --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.inf @@ -0,0 +1,37 @@ +### @file +# Component description file for IPMI FRB. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D FrbDxe + FILE_GUID =3D F6C7812D-81BF-4e6d-A87D-E75AF17BD511 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D FrbDxeEntryPoint + +[Sources] + FrbDxe.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + UefiDriverEntryPoint + MemoryAllocationLib + UefiLib + DebugLib + BaseMemoryLib + IpmiCommandLib + PcdLib + +[Depex] + TRUE diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.i= nf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf new file mode 100644 index 0000000000..7ad00ae574 --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.inf @@ -0,0 +1,37 @@ +### @file +# Component description file for IPMI FRB PEIM. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D FrbPei + FILE_GUID =3D 7F9F9788-9F1F-4725-895C-3932F1A04DE8 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InitializeFrbPei + +[Sources] + FrbPei.c + +[Packages] + MdePkg/MdePkg.dec + OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec + +[LibraryClasses] + PeimEntryPoint + DebugLib + BaseMemoryLib + PcdLib + IpmiCommandLib + +[Pcd] + gIpmiFeaturePkgTokenSpaceGuid.PcdFRB2EnabledFlag + gIpmiFeaturePkgTokenSpaceGuid.PcdFRBTimeoutValue + +[Depex] + TRUE diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/Ipmi= Fru.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru= .inf new file mode 100644 index 0000000000..0778b221c1 --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.inf @@ -0,0 +1,35 @@ +### @file +# Component description file for IPMI FRU. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D IpmiFru + FILE_GUID =3D 3F1D6464-2B4C-4640-BAC4-3DD905D26CDA + MODULE_TYPE =3D DXE_DRIVER + PI_SPECIFICATION_VERSION =3D 0x0001000A + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D InitializeFru + +[Sources] + IpmiFru.c + +[Packages] + MdePkg/MdePkg.dec + OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + UefiLib + DebugLib + UefiBootServicesTableLib + BaseMemoryLib + IpmiCommandLib + +[Depex] + TRUE diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/Dxe= IpmiInit.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/D= xeIpmiInit.inf new file mode 100644 index 0000000000..68ff70cd43 --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiIni= t.inf @@ -0,0 +1,34 @@ +### @file +# Component description file for IPMI initialization. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D DxeIpmiInit + FILE_GUID =3D 07A01ACF-46D5-48de-A63D-74FA92AA8450 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D IpmiInterfaceInit + +[Sources] + DxeIpmiInit.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec + +[LibraryClasses] + UefiBootServicesTableLib + DebugLib + UefiDriverEntryPoint + IpmiCommandLib + TimerLib + +[Depex] + TRUE diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/Pei= IpmiInit.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/P= eiIpmiInit.inf new file mode 100644 index 0000000000..825451ede1 --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiIni= t.inf @@ -0,0 +1,32 @@ +### @file +# Component description file for IPMI initialization in PEI. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PeiIpmiInit + FILE_GUID =3D D8F57F4E-D67D-4f2c-8351-C7092986542F + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PeimIpmiInterfaceInit + +[Sources] + PeiIpmiInit.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec + +[LibraryClasses] + PeimEntryPoint + DebugLib + IpmiCommandLib + +[Depex] + TRUE diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.= inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf new file mode 100644 index 0000000000..7e7d2826cb --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.inf @@ -0,0 +1,33 @@ +### @file +# Component description file for IPMI OS watch dog timer driver. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D OsWdt + FILE_GUID =3D BE9B694A-B5D9-48e0-A527-6E1A49EB7028 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D DriverInit + +[Sources] + OsWdt.c + +[Packages] + MdePkg/MdePkg.dec + OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + DebugLib + UefiBootServicesTableLib + BaseMemoryLib + IpmiCommandLib + +[Depex] + TRUE diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/So= lStatus.inf b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/S= olStatus.inf new file mode 100644 index 0000000000..826144e537 --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus= .inf @@ -0,0 +1,37 @@ +### @file +# Component description file for IPMI Serial Over LAN (SOL) driver. +# +# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +### + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D SolStatus + FILE_GUID =3D F9887B5E-2D46-4213-8794-14F1FD39F6B8 + MODULE_TYPE =3D DXE_DRIVER + PI_SPECIFICATION_VERSION =3D 0x0001000A + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D SolStatusEntryPoint + +[Sources] + SolStatus.c + +[Packages] + MdePkg/MdePkg.dec + OutOfBandManagement/IpmiFeaturePkg/IpmiFeaturePkg.dec + +[Pcd] + gIpmiFeaturePkgTokenSpaceGuid.PcdMaxSOLChannels + +[LibraryClasses] + UefiDriverEntryPoint + DebugLib + UefiBootServicesTableLib + IpmiCommandLib + PcdLib + +[Depex] + TRUE diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcA= cpi.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c new file mode 100644 index 0000000000..990b4b9e83 --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcAcpi.c @@ -0,0 +1,257 @@ +/** @file + BMC ACPI. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +// +// Statements that include other header files +// +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifndef EFI_ACPI_CREATOR_ID +#define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('M', 'S', 'F', 'T') +#endif +#ifndef EFI_ACPI_CREATOR_REVISION +#define EFI_ACPI_CREATOR_REVISION 0x0100000D +#endif + +/** + + Locate the first instance of a protocol. If the protocol requested is a= n + FV protocol, then it will return the first FV that contains the ACPI tab= le + storage file. + + @param Protocol - The protocol to find. + Instance - Return pointer to the first instance of the protocol. + Type - The type of protocol to locate. + + @retval EFI_SUCCESS - The function completed successfully. + @retval EFI_NOT_FOUND - The protocol could not be located. + @retval EFI_OUT_OF_RESOURCES - There are not enough resources to find = the protocol. + +**/ +EFI_STATUS +LocateSupportProtocol ( + IN EFI_GUID *Protocol, + OUT VOID **Instance, + IN UINT32 Type + ) +{ + EFI_STATUS Status; + EFI_HANDLE *HandleBuffer; + UINTN NumberOfHandles; + EFI_FV_FILETYPE FileType; + UINT32 FvStatus =3D 0; + EFI_FV_FILE_ATTRIBUTES Attributes; + UINTN Size; + UINTN Index; + + Status =3D gBS->LocateHandleBuffer (ByProtocol, Protocol, NULL, &NumberO= fHandles, &HandleBuffer); + if (EFI_ERROR (Status)) { + return Status; + } + // + // Looking for FV with ACPI storage file + // + for (Index =3D 0; Index < NumberOfHandles; Index++) { + Status =3D gBS->HandleProtocol (HandleBuffer[Index], Protocol, Instanc= e); + ASSERT (!EFI_ERROR (Status)); + + if (!Type) { + // + // Not looking for the FV protocol, so find the first instance of th= e + // protocol. There should not be any errors because our handle buff= er + // should always contain at least one or LocateHandleBuffer would ha= ve + // returned not found. + // + break; + } + // + // See if it has the ACPI storage file + // + Status =3D ((EFI_FIRMWARE_VOLUME2_PROTOCOL *) (*Instance))->ReadFile ( + *Instance, + &gEfiCallerI= dGuid, + NULL, + &Size, + &FileType, + &Attributes, + &FvStatus + ); + + // + // If we found it, then we are done + // + if (!EFI_ERROR (Status)) { + break; + } + } + + gBS->FreePool (HandleBuffer); + return Status; +} + + +EFI_STATUS +UpdateDeviceSsdtTable ( + IN OUT EFI_ACPI_COMMON_HEADER *Table + ) +{ + EFI_ACPI_DESCRIPTION_HEADER *TableHeader =3D NULL; + UINT64 TempOemTableId; + UINT8 *DataPtr; + EFI_ACPI_IO_PORT_DESCRIPTOR *IoRsc; + + TableHeader =3D (EFI_ACPI_DESCRIPTION_HEADER *)Table; + + // + // Update the OEMID and OEM Table ID. + // + CopyMem (&TableHeader->OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof(Ta= bleHeader->OemId)); + TempOemTableId =3D PcdGet64 (PcdAcpiDefaultOemTableId); + CopyMem (&TableHeader->OemTableId, &TempOemTableId, sizeof(UINT64)); + TableHeader->CreatorId =3D EFI_ACPI_CREATOR_ID; + TableHeader->CreatorRevision =3D EFI_ACPI_CREATOR_REVISION; + + // + // Update IO(Decode16, 0xCA2, 0xCA2, 0, 2) + // + DEBUG ((DEBUG_INFO, "UpdateDeviceSsdtTable - IPMI\n")); + for (DataPtr =3D (UINT8 *)(Table + 1); + DataPtr < (UINT8 *) ((UINT8 *) Table + Table->Length - 4); + DataPtr++) { + if (CompareMem(DataPtr, "_CRS", 4) =3D=3D 0) { + DataPtr +=3D 4; // Skip _CRS + ASSERT (*DataPtr =3D=3D AML_BUFFER_OP); + DataPtr ++; // Skip AML_BUFFER_OP + ASSERT ((*DataPtr & (BIT7|BIT6)) =3D=3D 0); + DataPtr ++; // Skip PkgLength - 0xD + ASSERT ((*DataPtr) =3D=3D AML_BYTE_PREFIX); + DataPtr ++; // Skip BufferSize OpCode + DataPtr ++; // Skip BufferSize - 0xA + IoRsc =3D (VOID *)DataPtr; + ASSERT (IoRsc->Header.Bits.Type =3D=3D ACPI_SMALL_ITEM_FLAG); + ASSERT (IoRsc->Header.Bits.Name =3D=3D ACPI_SMALL_IO_PORT_DESCRIPTOR= _NAME); + ASSERT (IoRsc->Header.Bits.Length =3D=3D sizeof(EFI_ACPI_IO_PORT_DES= CRIPTOR) - sizeof(ACPI_SMALL_RESOURCE_HEADER)); + DEBUG ((DEBUG_INFO, "IPMI IO Base in ASL update - 0x%04x <=3D 0x%04x= \n", IoRsc->BaseAddressMin, PcdGet16(PcdIpmiIoBaseAddress))); + IoRsc->BaseAddressMin =3D PcdGet16(PcdIpmiIoBaseAddress); + IoRsc->BaseAddressMax =3D PcdGet16(PcdIpmiIoBaseAddress); + } + } + + return EFI_SUCCESS; +} + +/** + + Entry point for Acpi platform driver. + + @param ImageHandle - A handle for the image that is initializing this = driver. + @param SystemTable - A pointer to the EFI system table. + + @retval EFI_SUCCESS - Driver initialized successfully. + @retval EFI_LOAD_ERROR - Failed to Initialize or has been loaded= . + @retval EFI_OUT_OF_RESOURCES - Could not allocate needed resources. + +**/ +EFI_STATUS +EFIAPI +BmcAcpiEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_STATUS AcpiStatus; + + EFI_FIRMWARE_VOLUME2_PROTOCOL *FwVol; + INTN Instance =3D 0; + EFI_ACPI_COMMON_HEADER *CurrentTable =3D NULL; + UINTN TableHandle =3D 0; + UINT32 FvStatus; + UINT32 Size; + + EFI_ACPI_TABLE_PROTOCOL *AcpiTable; + UINTN TableSize; + + + // + // Find the AcpiTable protocol + // + Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID*= *)&AcpiTable); + if (EFI_ERROR (Status)) { + return EFI_ABORTED; + } + + // + // Locate the firmware volume protocol + // + Status =3D LocateSupportProtocol (&gEfiFirmwareVolume2ProtocolGuid, (VOI= D **) &FwVol, 1); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D EFI_SUCCESS; + Instance =3D 0; + + // + // Read tables from the storage file. + // + while (!EFI_ERROR (Status)) { + CurrentTable =3D NULL; + + Status =3D FwVol->ReadSection ( + FwVol, + &gEfiCallerIdGuid, + EFI_SECTION_RAW, + Instance, + (VOID **) &CurrentTable, + (UINTN *) &Size, + &FvStatus + ); + if (!EFI_ERROR (Status)) { + // + // Perform any table specific updates. + // + AcpiStatus =3D UpdateDeviceSsdtTable (CurrentTable); + if (!EFI_ERROR (AcpiStatus)) { + + TableHandle =3D 0; + TableSize =3D ((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Leng= th; + ASSERT (Size >=3D TableSize); + + Status =3D AcpiTable->InstallAcpiTable ( + AcpiTable, + CurrentTable, + TableSize, + &TableHandle + ); + + ASSERT_EFI_ERROR (Status); + } + + // + // Increment the instance + // + Instance++; + } + } + + return EFI_SUCCESS; +} diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcE= log.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c new file mode 100644 index 0000000000..a6d075b19c --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcElog/BmcElog.c @@ -0,0 +1,236 @@ +/** @file + BMC Event Log functions. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +EFI_STATUS +EFIAPI +CheckIfSelIsFull ( + VOID + ); + +/*++ + + Routine Description: + This function verifies the BMC SEL is full and When it is reports the = error to the Error Manager. + + Arguments: + None + + Returns: + EFI_SUCCESS + EFI_DEVICE_ERROR + +--*/ +EFI_STATUS +WaitTillErased ( + UINT8 *ResvId + ) +/*++ + +Routine Description: + +Arguments: + + BmcElogPrivateData - Bmc event log instance + ResvId - Reserved ID + +Returns: + + EFI_SUCCESS + EFI_NO_RESPONSE + +--*/ +{ + INTN Counter; + IPMI_CLEAR_SEL_REQUEST ClearSel; + IPMI_CLEAR_SEL_RESPONSE ClearSelResponse; + + Counter =3D 0x200; + ZeroMem (&ClearSelResponse, sizeof(ClearSelResponse)); + + while (TRUE) { + ZeroMem (&ClearSel, sizeof(ClearSel)); + ClearSel.Reserve[0] =3D ResvId[0]; + ClearSel.Reserve[1] =3D ResvId[1]; + ClearSel.AscC =3D 0x43; + ClearSel.AscL =3D 0x4C; + ClearSel.AscR =3D 0x52; + ClearSel.Erase =3D 0x00; + + IpmiClearSel ( + &ClearSel, + &ClearSelResponse + ); + + if ((ClearSelResponse.ErasureProgress & 0xf) =3D=3D 1) { + return EFI_SUCCESS; + } + // + // If there is not a response from the BMC controller we need to retu= rn and not hang. + // + --Counter; + if (Counter =3D=3D 0x0) { + return EFI_NO_RESPONSE; + } + } +} + +EFI_STATUS +EfiActivateBmcElog ( + IN BOOLEAN *EnableElog, + OUT BOOLEAN *ElogStatus + ) +/*++ + +Routine Description: + +Arguments: + + This - Protocol pointer + DataType - indicate event log type + EnableElog - Enable/Disable event log + ElogStatus - return log status + +Returns: + + EFI_STATUS + +--*/ +{ + EFI_STATUS Status; + UINT8 ElogStat; + IPMI_SET_BMC_GLOBAL_ENABLES_REQUEST SetBmcGlobalEnables; + IPMI_GET_BMC_GLOBAL_ENABLES_RESPONSE GetBmcGlobalEnables; + UINT8 CompletionCode; + + Status =3D EFI_SUCCESS; + ElogStat =3D 0; + + Status =3D IpmiGetBmcGlobalEnables (&GetBmcGlobalEnables); + if (EFI_ERROR(Status)) { + return Status; + } + + if (EnableElog =3D=3D NULL) { + *ElogStatus =3D GetBmcGlobalEnables.GetEnables.Bits.SystemEventLogging= ; + } else { + if (Status =3D=3D EFI_SUCCESS) { + if (*EnableElog) { + ElogStat =3D 1; + } + + CopyMem (&SetBmcGlobalEnables, (UINT8 *)&GetBmcGlobalEnables + 1, si= zeof(UINT8)); + SetBmcGlobalEnables.SetEnables.Bits.SystemEventLogging =3D ElogStat; + + Status =3D IpmiSetBmcGlobalEnables (&SetBmcGlobalEnables, &Completio= nCode); + } + } + + return Status; +} + +EFI_STATUS +SetElogRedirInstall ( + VOID + ) +/*++ + +Routine Description: + +Arguments: + + None + +Returns: + + EFI_SUCCESS + +--*/ +{ + BOOLEAN EnableElog; + BOOLEAN ElogStatus; + + // + // Activate the Event Log (This should depend upon Setup). + // + EfiActivateBmcElog (&EnableElog, &ElogStatus); + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +InitializeBmcElogLayer ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +/*++ + +Routine Description: + +Arguments: + + ImageHandle - ImageHandle of the loaded driver + SystemTable - Pointer to the System Table + +Returns: + + EFI_STATUS + +--*/ +{ + SetElogRedirInstall (); + + CheckIfSelIsFull (); + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +CheckIfSelIsFull ( + VOID + ) +/*++ + + Routine Description: + This function verifies the BMC SEL is full and When it is reports the = error to the Error Manager. + + Arguments: + None + + Returns: + EFI_SUCCESS + EFI_DEVICE_ERROR + +--*/ +{ + EFI_STATUS Status; + UINT8 SelIsFull; + IPMI_GET_SEL_INFO_RESPONSE SelInfo; + + Status =3D IpmiGetSelInfo (&SelInfo); + if (EFI_ERROR (Status)) { + return EFI_DEVICE_ERROR; + } + + // + // Check the Bit7 of the OperationByte if SEL is OverFlow. + // + SelIsFull =3D (SelInfo.OperationSupport & 0x80); + DEBUG ((DEBUG_INFO, "SelIsFull - 0x%x\n", SelIsFull)); + + return EFI_SUCCESS; +} diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c= b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c new file mode 100644 index 0000000000..28e384490b --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbDxe.c @@ -0,0 +1,236 @@ +/** @file + IPMI FRB Driver. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +EFI_STATUS +EfiDisableFrb ( + VOID + ) +/*++ + + Routine Description: + This routine disables the specified FRB timer. + + Arguments: + This - This pointer + FrbType - Type of FRB timer to get data on + + Returns: + EFI_SUCCESS - FRB timer was disabled + EFI_ABORTED - Timer was already stopped + EFI_UNSUPPORTED - This type of FRB timer is not supported. + +--*/ +{ + EFI_STATUS Status; + IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; + UINT8 CompletionCode; + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; + + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Check if timer is still running, if not abort disable routine. + // + if (GetWatchdogTimer.TimerUse.Bits.TimerRunning =3D=3D 0) { + return EFI_ABORTED; + } + + ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer)); + // + // Just flip the Timer Use bit. This should release the timer. + // + SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 0; + SetWatchdogTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER_B= IOS_FRB2; + SetWatchdogTimer.TimerUseExpirationFlagsClear &=3D ~BIT2; + SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT4; + + Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); + return Status; +} + +VOID +EFIAPI +DisableFRB2Handler ( + IN EFI_EVENT Event, + IN VOID *Context + ) +/*++ + + Routine Description: + Disables FRB2. This function gets called each time the + EFI_EVENT_SIGNAL_READY_TO_BOOT gets signaled + + Arguments: + Standard event notification function arguments: + Event - the event that is signaled. + Context - not used here. + + Returns: + +--*/ +{ + DEBUG((DEBUG_ERROR, "!!! enter DisableFRB2Handler()!!!\n")); + + EfiDisableFrb (); +} + +EFI_STATUS +CheckForAndReportErrors( + VOID + ) +/*++ + + Routine Description: + Check the Watchdog timer expiration flags and report the kind of watch= dog + timeout occurred to the Error Manager. + + Arguments: + + Returns: + EFI_SUCCESS - Errors retrieved and reported + +--*/ +{ + EFI_STATUS Status; + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; + IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; + UINT8 CompletionCode; + + // + // Get the Watchdog timer info to find out what kind of timer expiration= occurred. + // + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); + if (EFI_ERROR (Status)) { + return Status; + } + // + // If FRB2 Failure occurred, report it to the error manager and log a SE= L. + // + if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT1) !=3D 0) { + // + // Report the FRB2 time-out error + // + } else if ((GetWatchdogTimer.TimerUseExpirationFlagsClear & BIT3) !=3D 0= ) { + // + // Report the OS Watchdog timer failure + // + } + + // + // Need to clear Timer expiration flags after checking. + // + ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer)); + SetWatchdogTimer.TimerUse =3D GetWatchdogTimer.Tim= erUse; + SetWatchdogTimer.TimerActions =3D GetWatchdogTimer.Tim= erActions; + SetWatchdogTimer.PretimeoutInterval =3D GetWatchdogTimer.Pre= timeoutInterval; + SetWatchdogTimer.TimerUseExpirationFlagsClear =3D GetWatchdogTimer.Tim= erUseExpirationFlagsClear; + SetWatchdogTimer.InitialCountdownValue =3D GetWatchdogTimer.Ini= tialCountdownValue; + SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 1; + SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT2 | BIT3; + + Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); + + return Status; +} + +EFI_STATUS +ReportFrb2Status ( + VOID + ) +/*++ + + Routine Description: + This routine is built only when DEBUG_MODE is enabled. It is used + to report the status of FRB2 when the FRB2 driver is installed. + + Arguments: + none + + Returns: + EFI_SUCCESS: All info was retrieved and reported + EFI_ERROR: There was an error during info retrieval + +--*/ +{ + EFI_STATUS Status; + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; + + // + // Get the Watchdog timer info to find out what kind of timer expiration= occurred. + // + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Failed to get Watchdog Timer info from BMC.\n")); + return Status; + } + + // + // Check if timer is running, report status to DEBUG_MODE output. + // + if (GetWatchdogTimer.TimerUse.Bits.TimerRunning =3D=3D 1) { + DEBUG ((DEBUG_INFO, "FRB2 Timer is running.\n")); + } else { + DEBUG ((DEBUG_INFO, "FRB2 Timer is not running.\n")); + } + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +FrbDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +/*++ + + Routine Description: + This is the standard EFI driver point. This function intitializes + the private data required for creating FRB Driver. + + Arguments: + ImageHandle - Handle for the image of this driver + SystemTable - Pointer to the EFI System Table + + Returns: + EFI_SUCCESS - Protocol successfully started and installed + EFI_UNSUPPORTED - Protocol can't be started + +--*/ +{ + EFI_EVENT ReadyToBootEvent; + EFI_STATUS Status; + + CheckForAndReportErrors(); + ReportFrb2Status (); + + // + // Register the event to Disable FRB2 before Boot. + // + Status =3D EfiCreateEventReadyToBootEx ( + TPL_NOTIFY, + DisableFRB2Handler, + NULL, + &ReadyToBootEvent + ); + + return Status; +} diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c= b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c new file mode 100644 index 0000000000..3e65eb9dad --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/Frb/FrbPei.c @@ -0,0 +1,84 @@ +/** @file + IPMI FRB PEIM. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include + +#include + +VOID +SetWatchDogTimer ( + IN BOOLEAN Frb2Enabled + ) +{ + EFI_STATUS Status; + IPMI_SET_WATCHDOG_TIMER_REQUEST FrbTimer; + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; + UINT8 CompletionCode; + + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); + if (EFI_ERROR(Status)) { + return ; + } + + if (Frb2Enabled) { + ZeroMem (&FrbTimer, sizeof(FrbTimer)); + //Byte 1 + FrbTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER_BIOS_FRB2; + //Byte 2 + FrbTimer.TimerActions.Uint8 =3D 0; //NormalBoot, NoTimeOutInterrupt= . i.e no action when BMC watchdog timeout + //Byte 3 + FrbTimer.PretimeoutInterval =3D 0; + //Byte 4 + FrbTimer.TimerUseExpirationFlagsClear |=3D BIT1; //set Frb2Expiration= Flag + + //Data Byte 5/6 + FrbTimer.InitialCountdownValue =3D PcdGet16(PcdFRBTimeoutValue) * 10; + + //Set BMC watchdog timer + Status =3D IpmiSetWatchdogTimer (&FrbTimer, &CompletionCode); + Status =3D IpmiResetWatchdogTimer (&CompletionCode); + } +} + +EFI_STATUS +EFIAPI +InitializeFrbPei ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + +Arguments: + + FfsHeader + PeiServices + +Returns: + + EFI_SUCCESS + +--*/ +{ + BOOLEAN Frb2Enabled; + + // + // If we are booting with defaults, then make sure FRB2 is enabled. + // + Frb2Enabled =3D PcdGetBool (PcdFRB2EnabledFlag); + + SetWatchDogTimer (Frb2Enabled); + + return EFI_SUCCESS; +} diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/Ipmi= Fru.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c new file mode 100644 index 0000000000..58e1fb4d7e --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiFru/IpmiFru.c @@ -0,0 +1,67 @@ +/** @file + IPMI FRU Driver. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include + +EFI_STATUS +EFIAPI +InitializeFru ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +/*++ + +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 Status; + IPMI_GET_DEVICE_ID_RESPONSE ControllerInfo; + IPMI_GET_FRU_INVENTORY_AREA_INFO_REQUEST GetFruInventoryAreaInfoReques= t; + IPMI_GET_FRU_INVENTORY_AREA_INFO_RESPONSE GetFruInventoryAreaInfoRespon= se; + + // + // Get all the SDR Records from BMC and retrieve the Record ID from the= structure for future use. + // + Status =3D IpmiGetDeviceId (&ControllerInfo); + if (EFI_ERROR (Status)) { + DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetDeviceId Status=3D%x\n", Stat= us)); + return Status; + } + + DEBUG((DEBUG_ERROR, "!!! IpmiFru FruInventorySupport %x\n", ControllerI= nfo.DeviceSupport.Bits.FruInventorySupport)); + + if (ControllerInfo.DeviceSupport.Bits.FruInventorySupport) { + GetFruInventoryAreaInfoRequest.DeviceId =3D 0; + Status =3D IpmiGetFruInventoryAreaInfo (&GetFruInventoryAreaInfoReques= t, &GetFruInventoryAreaInfoResponse); + if (EFI_ERROR (Status)) { + DEBUG((DEBUG_ERROR, "!!! IpmiFru IpmiGetFruInventoryAreaInfo Status= =3D%x\n", Status)); + return Status; + } + DEBUG((DEBUG_ERROR, "!!! IpmiFru InventoryAreaSize=3D%x\n", GetFruInv= entoryAreaInfoResponse.InventoryAreaSize)); + } + + return EFI_SUCCESS; +} diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/Dxe= IpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/Dxe= IpmiInit.c new file mode 100644 index 0000000000..0639c3b2a1 --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/DxeIpmiIni= t.c @@ -0,0 +1,150 @@ +/** @file + IPMI stack initialization. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#define BMC_TIMEOUT 30 // [s] How long shall BIOS wait for BMC +#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout + +EFI_STATUS +GetSelfTest ( + VOID + ) +/*++ + +Routine Description: + + Execute the Get Self Test results command to determine whether or not th= e BMC self tests + have passed + +Arguments: + + mIpmiInstance - Data structure describing BMC variables and used for s= ending commands + StatusCodeValue - An array used to accumulate error codes for later repo= rting. + ErrorCount - Counter used to keep track of error codes in StatusCod= eValue + +Returns: + + EFI_SUCCESS - BMC Self test results are retrieved and saved into B= mcStatus + EFI_DEVICE_ERROR - BMC failed to return self test results. + +--*/ +{ + EFI_STATUS Status; + IPMI_SELF_TEST_RESULT_RESPONSE TestResult; + + // + // Get the SELF TEST Results. + // + Status =3D IpmiGetSelfTestResult (&TestResult); + if (EFI_ERROR(Status)) { + DEBUG((DEBUG_ERROR, "\n[IPMI] BMC does not respond (status: %r)!\n\n",= Status)); + return Status; + } + + DEBUG((DEBUG_INFO, "[IPMI] BMC self-test result: %02X-%02X\n", TestResul= t.Result, TestResult.Param)); + + return EFI_SUCCESS; +} + +EFI_STATUS +GetDeviceId ( + OUT BOOLEAN *UpdateMode + ) +/*++ + +Routine Description: + Execute the Get Device ID command to determine whether or not the BMC is= in Force Update + Mode. If it is, then report it to the error manager. + +Arguments: + +Returns: + Status + +--*/ +{ + EFI_STATUS Status; + IPMI_GET_DEVICE_ID_RESPONSE BmcInfo; + UINT32 Retries; + + // + // Set up a loop to retry for up to 30 seconds. Calculate retries not ti= meout + // so that in case KCS is not enabled and EfiIpmiSendCommand() returns + // immediately we will not wait all the 30 seconds. + // + Retries =3D BMC_TIMEOUT / BMC_KCS_TIMEOUT + 1; + // + // Get the device ID information for the BMC. + // + do { + Status =3D IpmiGetDeviceId (&BmcInfo); + if (!EFI_ERROR(Status)) { + break; + } + DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d ret= ries left\n", Status, Retries)); + MicroSecondDelay(50 * 1000); + if (Retries-- =3D=3D 0) { + return Status; + } + } while (TRUE); + + DEBUG(( + DEBUG_INFO, + "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n", + BmcInfo.DeviceId, + BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev, + BmcInfo.MinorFirmwareRev + )); + *UpdateMode =3D (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode; + return Status; +} + +/** + The entry point of the Ipmi DXE. + +@param[in] ImageHandle - Handle of this driver image +@param[in] SystemTable - Table containing standard EFI services + +@retval EFI_SUCCESS - Always success is returned even if KCS does not func= tion + + **/ +EFI_STATUS +EFIAPI +IpmiInterfaceInit ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + BOOLEAN UpdateMode; + EFI_STATUS Status; + + DEBUG((DEBUG_ERROR,"IPMI Dxe:Get BMC Device Id\n")); + + // + // Get the Device ID and check if the system is in Force Update mode. + // + Status =3D GetDeviceId (&UpdateMode); + // + // Do not continue initialization if the BMC is in Force Update Mode. + // + if (!EFI_ERROR(Status) && !UpdateMode) { + // + // Get the SELF TEST Results. + // + GetSelfTest (); + } + + return EFI_SUCCESS; +} + + diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/Pei= IpmiInit.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/Pei= IpmiInit.c new file mode 100644 index 0000000000..062d20c44e --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/IpmiInit/PeiIpmiIni= t.c @@ -0,0 +1,96 @@ +/** @file + IPMI stack initialization in PEI. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#define BMC_TIMEOUT_PEI 50 // [s] How long shall BIOS wait for BMC +#define BMC_KCS_TIMEOUT 5 // [s] Single KSC request timeout + +EFI_STATUS +GetDeviceId ( + OUT BOOLEAN *UpdateMode + ) +/*++ + +Routine Description: + Execute the Get Device ID command to determine whether or not the BMC is= in Force Update + Mode. If it is, then report it to the error manager. + +Arguments: + +Returns: + Status + +--*/ +{ + EFI_STATUS Status; + IPMI_GET_DEVICE_ID_RESPONSE BmcInfo; + UINT32 Retries; + + // + // Set up a loop to retry for up to 30 seconds. Calculate retries not ti= meout + // so that in case KCS is not enabled and EfiIpmiSendCommand() returns + // immediately we will not wait all the 30 seconds. + // + Retries =3D BMC_TIMEOUT_PEI/ BMC_KCS_TIMEOUT + 1; + // + // Get the device ID information for the BMC. + // + do { + Status =3D IpmiGetDeviceId (&BmcInfo); + if (!EFI_ERROR(Status)) { + break; + } + DEBUG ((DEBUG_ERROR, "[IPMI] BMC does not respond (status: %r), %d ret= ries left\n", Status, Retries)); + if (Retries-- =3D=3D 0) { + return Status; + } + } while (TRUE); + + DEBUG(( + DEBUG_INFO, + "[IPMI] BMC Device ID: 0x%02X, firmware version: %d.%02X\n", + BmcInfo.DeviceId, + BmcInfo.FirmwareRev1.Bits.MajorFirmwareRev, + BmcInfo.MinorFirmwareRev + )); + *UpdateMode =3D (BOOLEAN)BmcInfo.FirmwareRev1.Bits.UpdateMode; + return Status; +} + +/** + The entry point of the Ipmi PEIM. + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @retval EFI_SUCCESS Indicates that Ipmi initialization completed succe= ssfully. + @retval Others Indicates that Ipmi initialization could not compl= ete successfully. +**/ +EFI_STATUS +EFIAPI +PeimIpmiInterfaceInit ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + BOOLEAN UpdateMode; + EFI_STATUS Status; + + DEBUG ((DEBUG_INFO, "IPMI Peim:Get BMC Device Id\n")); + + // + // Get the Device ID and check if the system is in Force Update mode. + // + Status =3D GetDeviceId (&UpdateMode); + return Status; +} diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.= c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c new file mode 100644 index 0000000000..6d6cb21d08 --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/OsWdt/OsWdt.c @@ -0,0 +1,112 @@ +/** @file + IPMI Os watchdog timer Driver. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include + +BOOLEAN mOsWdtFlag =3D FALSE; + +EFI_EVENT mExitBootServicesEvent; + +VOID +EFIAPI +EnableEfiOsBootWdtHandler ( + IN EFI_EVENT Event, + IN VOID *Context + ) +/*++ + +Routine Description: + Enable the OS Boot Watchdog Timer. + Is called only on legacy or EFI OS boot. + +Arguments: + Event - Event type + *Context - Context for the event + +Returns: + None + +--*/ +{ + EFI_STATUS Status; + IPMI_SET_WATCHDOG_TIMER_REQUEST SetWatchdogTimer; + UINT8 CompletionCode; + IPMI_GET_WATCHDOG_TIMER_RESPONSE GetWatchdogTimer; + static BOOLEAN OsWdtEventHandled =3D FALSE; + + DEBUG((DEBUG_ERROR, "!!! EnableEfiOsBootWdtHandler()!!!\n")); + + // + // Make sure it processes once only. And proceess it only if OsWdtFlag= =3D=3DTRUE; + // + if (OsWdtEventHandled || !mOsWdtFlag) { + return ; + } + + OsWdtEventHandled =3D TRUE; + + Status =3D IpmiGetWatchdogTimer (&GetWatchdogTimer); + if (EFI_ERROR (Status)) { + return ; + } + + ZeroMem (&SetWatchdogTimer, sizeof(SetWatchdogTimer)); + // + // Just flip the Timer Use bit. This should release the timer. + // + SetWatchdogTimer.TimerUse.Bits.TimerRunning =3D 1; + SetWatchdogTimer.TimerUse.Bits.TimerUse =3D IPMI_WATCHDOG_TIMER_O= S_LOADER; + SetWatchdogTimer.TimerActions.Uint8 =3D IPMI_WATCHDOG_TIMER_A= CTION_HARD_RESET; + SetWatchdogTimer.TimerUseExpirationFlagsClear &=3D ~BIT4; + SetWatchdogTimer.TimerUseExpirationFlagsClear |=3D BIT1 | BIT2; + SetWatchdogTimer.InitialCountdownValue =3D 600; // 100ms / count + + Status =3D IpmiSetWatchdogTimer (&SetWatchdogTimer, &CompletionCode); + return ; +} + +EFI_STATUS +EFIAPI +DriverInit ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +/*++ + +Routine Description: + This is the standard EFI driver point. This function intitializes + the private data required for creating ASRR Driver. + +Arguments: + As required for DXE driver enrty routine. + ImageHandle - ImageHandle of the loaded driver + SystemTable - Pointer to the System Table + +Returns: + @retval EFI_SUCCESS Protocol successfully started and installe= d. + @retval EFI_OUT_OF_RESOURCES The event could not be allocated. + +--*/ +{ + EFI_STATUS Status; + + Status =3D gBS->CreateEvent ( + EVT_SIGNAL_EXIT_BOOT_SERVICES, + TPL_NOTIFY, + EnableEfiOsBootWdtHandler, + NULL, + &mExitBootServicesEvent + ); + + return Status; +} diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/So= lStatus.c b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/Sol= Status.c new file mode 100644 index 0000000000..0e3c538d8c --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/SolStatus/SolStatus= .c @@ -0,0 +1,164 @@ +/** @file + IPMI Serial Over Lan Driver. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SOL_CMD_RETRY_COUNT 10 + +/*++ + +Routine Description: + + This routine gets the SOL payload status or settings for a specific ch= annel. + +Arguments: + Channel - LAN channel naumber. + ParamSel - Configuration parameter selection. + Data - Information returned from BMC. +Returns: + EFI_SUCCESS - SOL configuration parameters are successfully read f= rom BMC. + Others - SOL configuration parameters could not be read from = BMC. + +--*/ +EFI_STATUS +GetSOLStatus ( + IN UINT8 Channel, + IN UINT8 ParamSel, + IN OUT UINT8 *Data + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + IPMI_GET_SOL_CONFIGURATION_PARAMETERS_REQUEST GetConfigurationParameter= sRequest; + IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE GetConfigurationParameter= sResponse; + UINT32 DataSize; + UINT8 RetryCount; + + for (RetryCount =3D 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) { + ZeroMem (&GetConfigurationParametersRequest, sizeof(GetConfigurationPa= rametersRequest)); + GetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber =3D= Channel; + GetConfigurationParametersRequest.ParameterSelector =3D= ParamSel; + + ZeroMem (&GetConfigurationParametersResponse, sizeof(GetConfigurationP= arametersResponse)); + + DataSize =3D sizeof(GetConfigurationParametersResponse); + Status =3D IpmiGetSolConfigurationParameters ( + &GetConfigurationParametersRequest, + &GetConfigurationParametersResponse, + &DataSize + ); + + if (Status =3D=3D EFI_SUCCESS){ + break; + } else { + gBS->Stall(100000); + } + } + + if (Status =3D=3D EFI_SUCCESS) { + *Data =3D GetConfigurationParametersResponse.ParameterData[0]; + } + + return Status; +} + +/*++ + +Routine Description: + + This routine sets the SOL payload configuration parameters for a speci= fic channel. + +Arguments: + Channel - LAN channel naumber. + ParamSel - Configuration parameter selection. + Data - Configuration parameter values. +Returns: + EFI_SUCCESS - SOL configuration parameters are sent to BMC. + Others - SOL configuration parameters could not be sent to BM= C. + +--*/ +EFI_STATUS +SetSOLParams ( + IN UINT8 Channel, + IN UINT8 ParamSel, + IN UINT8 Data + ) +{ + EFI_STATUS Status =3D EFI_SUCCESS; + IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST SetConfigurationParameter= sRequest; + UINT8 CompletionCode; + UINT8 RetryCount; + + for (RetryCount =3D 0; RetryCount < SOL_CMD_RETRY_COUNT; RetryCount++) { + ZeroMem (&SetConfigurationParametersRequest, sizeof(SetConfigurationPa= rametersRequest)); + SetConfigurationParametersRequest.ChannelNumber.Bits.ChannelNumber =3D= Channel; + SetConfigurationParametersRequest.ParameterSelector =3D= ParamSel; + SetConfigurationParametersRequest.ParameterData[0] =3D= Data; + + CompletionCode =3D 0; + + Status =3D IpmiSetSolConfigurationParameters ( + &SetConfigurationParametersRequest, + sizeof(SetConfigurationParametersRequest), + &CompletionCode + ); + + if (Status =3D=3D EFI_SUCCESS) { + break; + } else { + gBS->Stall(100000); + } + } + + return Status; +} + +EFI_STATUS +EFIAPI +SolStatusEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +/*++ + + Routine Description: + This is the standard EFI driver point. This function initializes + the private data required for creating SOL Status Driver. + + Arguments: + ImageHandle - Handle for the image of this driver + SystemTable - Pointer to the EFI System Table + + Returns: + EFI_SUCCESS - Protocol successfully installed + EFI_UNSUPPORTED - Protocol can't be installed. + +--*/ +{ + EFI_STATUS Status =3D EFI_SUCCESS; + UINT8 Channel; + BOOLEAN SolEnabled =3D FALSE; + + for (Channel =3D 1; Channel <=3D PcdGet8 (PcdMaxSOLChannels); Channel++)= { + Status =3D GetSOLStatus (Channel, IPMI_SOL_CONFIGURATION_PARAMETER_SOL= _ENABLE, &SolEnabled); + if (Status =3D=3D EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR, "SOL enabling status for channel %x is %x\n", C= hannel, SolEnabled)); + } else { + DEBUG ((DEBUG_ERROR, "Failed to get channel %x SOL status from BMC!,= status is %x\n", Channel, Status)); + } + } + + return Status; +} diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcS= sdt/BmcSsdt.asl b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi= /BmcSsdt/BmcSsdt.asl new file mode 100644 index 0000000000..2194e6a88c --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/Bmc= Ssdt.asl @@ -0,0 +1,28 @@ +/** @file + BMC ACPI SSDT. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +DefinitionBlock ( + "BmcSsdt.aml", + "SSDT", + 0x02, // SSDT revision. + // A Revision field value greater than or equal to 2 sig= nifies that integers + // declared within the Definition Block are to be evalua= ted as 64-bit values + "INTEL", // OEM ID (6 byte string) + "BMCACPI", // OEM table ID (8 byte string) + 0x0 // OEM version of DSDT table (4 byte Integer) + ) +{ + + External(\_SB.PC00.LPC0, DeviceObj) + + Scope (\_SB.PC00.LPC0) + { + #include "IpmiOprRegions.asi" + } + +} diff --git a/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcS= sdt/IpmiOprRegions.asi b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/= BmcAcpi/BmcSsdt/IpmiOprRegions.asi new file mode 100644 index 0000000000..ffd6af3944 --- /dev/null +++ b/Features/Intel/OutOfBandManagement/IpmiFeaturePkg/BmcAcpi/BmcSsdt/Ipm= iOprRegions.asi @@ -0,0 +1,58 @@ +/** @file + IPMI ACPI SSDT. + +Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +Device(IPMC) +{ + // Config DWord, modified during POST + // Bit definitions are the same as PPMFlags: + // [00] =3D Plug and Play BMC Detection enabled in setup + // [31:01] =3D Reserved =3D 0 + + Name(ECFL, 0x80000000) + + // Return the interface specification revision + Method(_SRV) + { + // IPMI Specification Revision v2.0 + Return(0x0200) + } + + Method(_STA, 0) + { + // + // Assume OK + // + Store (0xF, Local0) + + Return(Local0) + + // Bit 0 - Set if the device is present. + // Bit 1 - Set if the device is enabled and decoding its resources= . + // Bit 2 - Set if the device should be shown in the UI. + // Bit 3 - Set if the device is functioning properly (cleared if t= he device failed its diagnostics). + // Bit 4 - Set if the battery is present. + // Bit 5 - Reserved (must be cleared). + } // end of _STA + + // Return the x86 resources consumed by BMC + Name(_CRS, ResourceTemplate() + { + // Uses 8-bit ports 0xCA2-0xCA5 + IO(Decode16, 0xCA2, 0xCA2, 0, 2) + }) + + Name(_HID, "IPI0001") // IPMI device + Name(_IFT, 0x1) // KCS system interface type + Name(_STR, Unicode("IPMI_KCS")) + + Name(_UID, 0) // First interface. + + +} // end of Device(IPMC) + + --=20 2.16.2.windows.1