public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: "Luo, Heng" <heng.luo@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Chaganty, Rangasai V" <rangasai.v.chaganty@intel.com>
Subject: Re: [PATCH 22/40] TigerlakeSiliconPkg/IpBlock: Add PchDmi component
Date: Thu, 4 Feb 2021 03:54:52 +0000	[thread overview]
Message-ID: <BN6PR1101MB21477A40CD17F0ACC5212AA7CDB39@BN6PR1101MB2147.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210201013657.1833-22-heng.luo@intel.com>

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

> -----Original Message-----
> From: Luo, Heng <heng.luo@intel.com>
> Sent: Sunday, January 31, 2021 5:37 PM
> To: devel@edk2.groups.io
> Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>; Desimone,
> Nathaniel L <nathaniel.l.desimone@intel.com>
> Subject: [PATCH 22/40] TigerlakeSiliconPkg/IpBlock: Add PchDmi component
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3171
> 
> Adds the following files:
>   * IpBlock/PchDmi/IncludePrivate
>   * IpBlock/PchDmi/LibraryPrivate
> 
> Cc: Sai Chaganty <rangasai.v.chaganty@intel.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Signed-off-by: Heng Luo <heng.luo@intel.com>
> ---
> 
> Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/IncludePrivate/Library/Pch
> DmiLib.h                             | 175
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +
> 
> Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSmm
> PchDmiLib/PchDmi14.c                   |  50
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> 
> Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSmm
> PchDmiLib/PchDmi14.h                   |  34
> ++++++++++++++++++++++++++++++++++
> 
> Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSmm
> PchDmiLib/PchDmiLib.c                  | 269
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++++++++++++++++++++++
> 
> Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSmm
> PchDmiLib/PchDmiWithS3Lib.c            |  73
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++
> 
> Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSmm
> PchDmiLib/PeiDxeSmmPchDmiLib.inf       |  42
> ++++++++++++++++++++++++++++++++++++++++++
> 
> Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSmm
> PchDmiLib/PeiDxeSmmPchDmiWithS3Lib.inf |  41
> +++++++++++++++++++++++++++++++++++++++++
>  7 files changed, 684 insertions(+)
> 
> diff --git
> a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/IncludePrivate/Library/Pc
> hDmiLib.h
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/IncludePrivate/Library/Pc
> hDmiLib.h
> new file mode 100644
> index 0000000000..77db69c75a
> --- /dev/null
> +++
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/IncludePrivate/Library/Pc
> hDmiLib.h
> @@ -0,0 +1,175 @@
> +/** @file
> 
> +  Header file for PchDmiLib.
> 
> +
> 
> +  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +**/
> 
> +#ifndef _PCH_DMI_LIB_H_
> 
> +#define _PCH_DMI_LIB_H_
> 
> +
> 
> +/**
> 
> +  This function checks if DMI Secured Register Lock (SRL) is set
> 
> +
> 
> +  @retval SRL state
> 
> +**/
> 
> +BOOLEAN
> 
> +IsPchDmiLocked (
> 
> +  VOID
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Get PCH TCO base address.
> 
> +
> 
> +  @retval Address                   Address of TCO base address.
> 
> +**/
> 
> +UINT16
> 
> +PchDmiGetTcoBase (
> 
> +  VOID
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Set PCH LPC/eSPI generic IO range decoding in DMI
> 
> +
> 
> +  @param[in] Address                    Address for generic IO range base address.
> 
> +  @param[in] Length                     Length of generic IO range.
> 
> +  @param[in] RangeIndex                 Index of choosen range
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetLpcGenIoRange (
> 
> +  IN  UINT32                            Address,
> 
> +  IN  UINT32                            Length,
> 
> +  IN  UINT32                            RangeIndex
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Set PCH eSPI eSPI CS1# generic IO range decoding in DMI
> 
> +
> 
> +  @param[in] Address                    Address for generic IO range base address.
> 
> +  @param[in] Length                     Length of generic IO range.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetEspiCs1GenIoRange (
> 
> +  IN  UINT32                            Address,
> 
> +  IN  UINT32                            Length
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Set PCH LPC/eSPI memory range decoding in DMI
> 
> +
> 
> +  @param[in] Address                    Address for memory base address.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetLpcMemRange (
> 
> +  IN  UINT32                            Address
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Set PCH eSPI CS1# memory range decoding in DMI
> 
> +
> 
> +  @param[in] Address                    Address for memory base address.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetEspiCs1MemRange (
> 
> +  IN  UINT32                            Address
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Check if Boot BIOS Strap is set for SPI.
> 
> +
> 
> +  @retval TRUE                Boot BIOS Strap set for SPI
> 
> +  @retval FALSE               Boot BIOS Strap set for LPC/eSPI
> 
> +**/
> 
> +BOOLEAN
> 
> +PchDmiIsBootBiosStrapSetForSpi (
> 
> +  VOID
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Set PCH BIOS range decoding in DMI
> 
> +  Please check EDS for detail of BiosDecodeEnable bit definition.
> 
> +    bit 15: F8-FF Enable
> 
> +    bit 14: F0-F8 Enable
> 
> +    bit 13: E8-EF Enable
> 
> +    bit 12: E0-E8 Enable
> 
> +    bit 11: D8-DF Enable
> 
> +    bit 10: D0-D7 Enable
> 
> +    bit  9: C8-CF Enable
> 
> +    bit  8: C0-C7 Enable
> 
> +    bit  7: Legacy F Segment Enable
> 
> +    bit  6: Legacy E Segment Enable
> 
> +    bit  5: Reserved
> 
> +    bit  4: Reserved
> 
> +    bit  3: 70-7F Enable
> 
> +    bit  2: 60-6F Enable
> 
> +    bit  1: 50-5F Enable
> 
> +    bit  0: 40-4F Enable
> 
> +
> 
> +  @param[in] BiosDecodeEnable           Bios decode enable setting.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetBiosDecodeEnable (
> 
> +  IN  UINT16                            BiosDecodeEnable
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Set PCH LPC/eSPI IO decode ranges in DMI
> 
> +  Please check EDS for detail of LPC/eSPI IO decode ranges bit definition.
> 
> +  Bit  12: FDD range
> 
> +  Bit 9:8: LPT range
> 
> +  Bit 6:4: ComB range
> 
> +  Bit 2:0: ComA range
> 
> +
> 
> +  @param[in] LpcIoDecodeRanges          LPC/eSPI IO decode ranges bit
> settings.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetLpcIoDecodeRanges (
> 
> +  IN  UINT16                            LpcIoDecodeRanges
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Set PCH LPC/eSPI IO enable decoding in DMI
> 
> +
> 
> +  @param[in] LpcIoEnableDecoding        LPC/eSPI IO enable decoding bit
> settings.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetLpcIoEnable (
> 
> +  IN  UINT16                            LpcIoEnableDecoding
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Configure PCH DMI Lock
> 
> +**/
> 
> +VOID
> 
> +PchDmiSetLockWithS3BootScript (
> 
> +  VOID
> 
> +  );
> 
> +
> 
> +/**
> 
> +  Set BIOS interface Lock-Down
> 
> +**/
> 
> +VOID
> 
> +PchDmiSetBiosLockDownWithS3BootScript (
> 
> +  VOID
> 
> +  );
> 
> +#endif // _PCH_DMI_LIB_H_
> 
> diff --git
> a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmi14.c
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmi14.c
> new file mode 100644
> index 0000000000..60bc29c431
> --- /dev/null
> +++
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmi14.c
> @@ -0,0 +1,50 @@
> +/** @file
> 
> +  This file contains functions for PCH DMI SIP14
> 
> +
> 
> +  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +**/
> 
> +
> 
> +#include <Base.h>
> 
> +#include <Uefi/UefiBaseType.h>
> 
> +#include <Library/IoLib.h>
> 
> +#include <Library/DebugLib.h>
> 
> +#include <Library/BaseLib.h>
> 
> +#include <Library/PchInfoLib.h>
> 
> +#include <Library/PchPcrLib.h>
> 
> +#include <Library/PchDmiLib.h>
> 
> +#include <Library/PchCycleDecodingLib.h>
> 
> +#include <Library/PchPcrLib.h>
> 
> +#include <Library/PchInfoLib.h>
> 
> +#include <Register/PchDmiRegs.h>
> 
> +#include <Register/PchDmi14Regs.h>
> 
> +#include <Register/PchPcrRegs.h>
> 
> +
> 
> +/**
> 
> +  This function checks if DMI SIP14 Secured Register Lock (SRL) is set
> 
> +
> 
> +  @retval SRL state
> 
> +**/
> 
> +BOOLEAN
> 
> +IsPchDmi14Locked (
> 
> +  VOID
> 
> +  )
> 
> +{
> 
> +  return ((PchPcrRead32 (PID_DMI, R_PCH_DMI14_PCR_DMIC) &
> B_PCH_DMI14_PCR_DMIC_SRL) != 0);
> 
> +}
> 
> +
> 
> +/**
> 
> + Secure Register Lock data
> 
> +
> 
> + @param[out] SrlRegOffset        Register offset holding Secure Register Lock
> setting
> 
> + @param[out] SrlRegMask          Mask for Secure Register Lock setting
> 
> +**/
> 
> +VOID
> 
> +PchDmi14SrlRegData (
> 
> +  OUT UINT16  *SrlRegOffset,
> 
> +  OUT UINT32  *SrlRegMask
> 
> +  )
> 
> +{
> 
> +  *SrlRegMask = B_PCH_DMI14_PCR_DMIC_SRL;
> 
> +  *SrlRegOffset = R_PCH_DMI14_PCR_DMIC;
> 
> +}
> 
> diff --git
> a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmi14.h
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmi14.h
> new file mode 100644
> index 0000000000..4c19ad82d7
> --- /dev/null
> +++
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmi14.h
> @@ -0,0 +1,34 @@
> +/** @file
> 
> +  Internal header file for PCH DMI library for SIP14
> 
> +
> 
> +  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +**/
> 
> +#ifndef __PCH_DMI_14_H__
> 
> +#define __PCH_DMI_14_H__
> 
> +
> 
> +#include <Library/PchDmiLib.h>
> 
> +
> 
> +/**
> 
> +  This function checks if DMI SIP14 Secured Register Lock (SRL) is set
> 
> +
> 
> +  @retval SRL state
> 
> +**/
> 
> +BOOLEAN
> 
> +IsPchDmi14Locked (
> 
> +  VOID
> 
> +  );
> 
> +
> 
> +/**
> 
> + Secure Register Lock data
> 
> +
> 
> + @param[out] SrlRegOffset        Register offset holding Secure Register Lock
> setting
> 
> + @param[out] SrlRegMask          Mask for Secure Register Lock setting
> 
> +**/
> 
> +VOID
> 
> +PchDmi14SrlRegData (
> 
> +  OUT UINT16  *SrlRegOffset,
> 
> +  OUT UINT32  *SrlRegMask
> 
> +  );
> 
> +
> 
> +#endif
> 
> diff --git
> a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmiLib.c
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmiLib.c
> new file mode 100644
> index 0000000000..972e5145aa
> --- /dev/null
> +++
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmiLib.c
> @@ -0,0 +1,269 @@
> +/** @file
> 
> +  PCH DMI library.
> 
> +
> 
> +  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +**/
> 
> +#include <Base.h>
> 
> +#include <Uefi/UefiBaseType.h>
> 
> +#include <Library/IoLib.h>
> 
> +#include <Library/DebugLib.h>
> 
> +#include <Library/BaseLib.h>
> 
> +#include <Library/PchInfoLib.h>
> 
> +#include <Library/PchPcrLib.h>
> 
> +#include <Library/PchDmiLib.h>
> 
> +#include <Library/PchCycleDecodingLib.h>
> 
> +#include <Register/PchPcrRegs.h>
> 
> +#include <Register/PchDmiRegs.h>
> 
> +#include <Register/PchRegsLpc.h>
> 
> +
> 
> +#include "PchDmi14.h"
> 
> +
> 
> +/**
> 
> +  This function checks if DMI Secured Register Lock (SRL) is set
> 
> +
> 
> +  @retval SRL state
> 
> +**/
> 
> +BOOLEAN
> 
> +IsPchDmiLocked (
> 
> +  VOID
> 
> +  )
> 
> +{
> 
> +  return IsPchDmi14Locked ();
> 
> +}
> 
> +
> 
> +/**
> 
> +  Get PCH TCO base address.
> 
> +
> 
> +  @retval Address                   Address of TCO base address.
> 
> +**/
> 
> +UINT16
> 
> +PchDmiGetTcoBase (
> 
> +  VOID
> 
> +  )
> 
> +{
> 
> +  //
> 
> +  // Read "TCO Base Address" PCR[DMI] + 2778h[15:5]
> 
> +  //
> 
> +  return (PchPcrRead16 (PID_DMI, R_PCH_DMI_PCR_TCOBASE) &
> B_PCH_DMI_PCR_TCOBASE_TCOBA);
> 
> +}
> 
> +
> 
> +/**
> 
> +  Set PCH LPC/eSPI generic IO range decoding in DMI
> 
> +
> 
> +  @param[in] Address                    Address for generic IO range base address.
> 
> +  @param[in] Length                     Length of generic IO range.
> 
> +  @param[in] RangeIndex                 Index of choosen range
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetLpcGenIoRange (
> 
> +  IN  UINT32                            Address,
> 
> +  IN  UINT32                            Length,
> 
> +  IN  UINT32                            RangeIndex
> 
> +  )
> 
> +{
> 
> +  return EFI_UNSUPPORTED;
> 
> +}
> 
> +
> 
> +/**
> 
> +  Set PCH eSPI eSPI CS1# generic IO range decoding in DMI
> 
> +
> 
> +  @param[in] Address                    Address for generic IO range base address.
> 
> +  @param[in] Length                     Length of generic IO range.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetEspiCs1GenIoRange (
> 
> +  IN  UINT32                            Address,
> 
> +  IN  UINT32                            Length
> 
> +  )
> 
> +{
> 
> +  return EFI_UNSUPPORTED;
> 
> +}
> 
> +
> 
> +/**
> 
> +  Set PCH LPC/eSPI memory range decoding in DMI
> 
> +
> 
> +  @param[in] Address                    Address for memory base address.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetLpcMemRange (
> 
> +  IN  UINT32                            Address
> 
> +  )
> 
> +{
> 
> +  if (IsPchDmiLocked ()) {
> 
> +    DEBUG ((DEBUG_ERROR, "%a Error. DMI is locked.\n", __FUNCTION__));
> 
> +    ASSERT (FALSE);
> 
> +    return EFI_UNSUPPORTED;
> 
> +  }
> 
> +
> 
> +  //
> 
> +  // Program LPC Memory Range, PCR[DMI] + 2740h to the same value
> programmed in LPC/eSPI PCI Offset 98h.
> 
> +  //
> 
> +  PchPcrWrite32 (
> 
> +    PID_DMI, R_PCH_DMI_PCR_LPCGMR,
> 
> +    (Address | B_LPC_CFG_LGMR_LMRD_EN)
> 
> +    );
> 
> +
> 
> +  return EFI_SUCCESS;
> 
> +}
> 
> +
> 
> +/**
> 
> +  Set PCH eSPI CS1# memory range decoding in DMI
> 
> +
> 
> +  @param[in] Address                    Address for memory base address.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetEspiCs1MemRange (
> 
> +  IN  UINT32                            Address
> 
> +  )
> 
> +{
> 
> +  if (IsPchDmiLocked ()) {
> 
> +    DEBUG ((DEBUG_ERROR, "%a Error. DMI is locked.\n", __FUNCTION__));
> 
> +    ASSERT (FALSE);
> 
> +    return EFI_UNSUPPORTED;
> 
> +  }
> 
> +
> 
> +  //
> 
> +  // Program LPC Memory Range, PCR[DMI] + 27C0h to the same value
> programmed in eSPI PCI Offset A8h.
> 
> +  //
> 
> +  PchPcrWrite32 (
> 
> +    PID_DMI, R_PCH_DMI_PCR_SEGMR,
> 
> +    (Address | B_LPC_CFG_LGMR_LMRD_EN)
> 
> +    );
> 
> +
> 
> +  return EFI_SUCCESS;
> 
> +}
> 
> +
> 
> +/**
> 
> +  Check if Boot BIOS Strap is set for SPI.
> 
> +
> 
> +  @retval TRUE                Boot BIOS Strap set for SPI
> 
> +  @retval FALSE               Boot BIOS Strap set for LPC/eSPI
> 
> +**/
> 
> +BOOLEAN
> 
> +PchDmiIsBootBiosStrapSetForSpi (
> 
> +  VOID
> 
> +  )
> 
> +{
> 
> +  //
> 
> +  // Check General Control and Status (GCS) [10]
> 
> +  // '0': SPI
> 
> +  // '1': LPC/eSPI
> 
> +  //
> 
> +  return ((PchPcrRead32 (PID_DMI, R_PCH_DMI_PCR_GCS) &
> B_PCH_DMI_PCR_BBS) != B_PCH_DMI_PCR_BBS);
> 
> +}
> 
> +
> 
> +/**
> 
> +  Set PCH BIOS range decoding in DMI
> 
> +  Please check EDS for detail of BiosDecodeEnable bit definition.
> 
> +    bit 15: F8-FF Enable
> 
> +    bit 14: F0-F8 Enable
> 
> +    bit 13: E8-EF Enable
> 
> +    bit 12: E0-E8 Enable
> 
> +    bit 11: D8-DF Enable
> 
> +    bit 10: D0-D7 Enable
> 
> +    bit  9: C8-CF Enable
> 
> +    bit  8: C0-C7 Enable
> 
> +    bit  7: Legacy F Segment Enable
> 
> +    bit  6: Legacy E Segment Enable
> 
> +    bit  5: Reserved
> 
> +    bit  4: Reserved
> 
> +    bit  3: 70-7F Enable
> 
> +    bit  2: 60-6F Enable
> 
> +    bit  1: 50-5F Enable
> 
> +    bit  0: 40-4F Enable
> 
> +
> 
> +  @param[in] BiosDecodeEnable           Bios decode enable setting.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetBiosDecodeEnable (
> 
> +  IN  UINT16                            BiosDecodeEnable
> 
> +  )
> 
> +{
> 
> +  if (IsPchDmiLocked ()) {
> 
> +    ASSERT (FALSE);
> 
> +    return EFI_UNSUPPORTED;
> 
> +  }
> 
> +
> 
> +  //
> 
> +  // program LPC BIOS Decode Enable, PCR[DMI] + 2744h to the same value
> programmed in LPC or SPI Offset D8h.
> 
> +  //
> 
> +  PchPcrWrite16 (PID_DMI, R_PCH_DMI_PCR_LPCBDE, BiosDecodeEnable);
> 
> +  return EFI_SUCCESS;
> 
> +}
> 
> +
> 
> +/**
> 
> +  Set PCH LPC/eSPI IO decode ranges in DMI
> 
> +  Please check EDS for detail of LPC/eSPI IO decode ranges bit definition.
> 
> +  Bit  12: FDD range
> 
> +  Bit 9:8: LPT range
> 
> +  Bit 6:4: ComB range
> 
> +  Bit 2:0: ComA range
> 
> +
> 
> +  @param[in] LpcIoDecodeRanges          LPC/eSPI IO decode ranges bit
> settings.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetLpcIoDecodeRanges (
> 
> +  IN  UINT16                            LpcIoDecodeRanges
> 
> +  )
> 
> +{
> 
> +  //
> 
> +  // This cycle decoding is only allowed to set when DMI is not locked.
> 
> +  //
> 
> +  if (IsPchDmiLocked ()) {
> 
> +    ASSERT (FALSE);
> 
> +    return EFI_UNSUPPORTED;
> 
> +  }
> 
> +
> 
> +  //
> 
> +  // program LPC I/O Decode Ranges, PCR[DMI] + 2770h[15:0] to the same
> value programmed in LPC/eSPI PCI offset 80h.
> 
> +  //
> 
> +  PchPcrWrite16 (PID_DMI, R_PCH_DMI_PCR_LPCIOD,
> LpcIoDecodeRanges);
> 
> +  return EFI_SUCCESS;
> 
> +}
> 
> +
> 
> +/**
> 
> +  Set PCH LPC/eSPI IO enable decoding in DMI
> 
> +
> 
> +  @param[in] LpcIoEnableDecoding        LPC/eSPI IO enable decoding bit
> settings.
> 
> +
> 
> +  @retval EFI_SUCCESS                   Successfully completed.
> 
> +  @retval EFI_UNSUPPORTED               DMIC.SRL is set.
> 
> +**/
> 
> +EFI_STATUS
> 
> +PchDmiSetLpcIoEnable (
> 
> +  IN  UINT16                            LpcIoEnableDecoding
> 
> +  )
> 
> +{
> 
> +  //
> 
> +  // This cycle decoding is only allowed to set when DMI is not locked.
> 
> +  //
> 
> +  if (IsPchDmiLocked ()) {
> 
> +    ASSERT (FALSE);
> 
> +    return EFI_UNSUPPORTED;
> 
> +  }
> 
> +
> 
> +  //
> 
> +  // program LPC I/O Decode Ranges, PCR[DMI] + 2774h[15:0] to the same
> value programmed in LPC/eSPI PCI offset 82h.
> 
> +  //
> 
> +  PchPcrWrite16 (PID_DMI, R_PCH_DMI_PCR_LPCIOE,
> LpcIoEnableDecoding);
> 
> +  return EFI_SUCCESS;
> 
> +}
> 
> diff --git
> a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmiWithS3Lib.c
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmiWithS3Lib.c
> new file mode 100644
> index 0000000000..7d6801ee57
> --- /dev/null
> +++
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PchDmiWithS3Lib.c
> @@ -0,0 +1,73 @@
> +/** @file
> 
> +  PCH DMI library with S3 boot script support.
> 
> +
> 
> +  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> 
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +**/
> 
> +#include <Base.h>
> 
> +#include <Uefi/UefiBaseType.h>
> 
> +#include <Library/IoLib.h>
> 
> +#include <Library/DebugLib.h>
> 
> +#include <Library/BaseLib.h>
> 
> +#include <Library/PchPcrLib.h>
> 
> +#include <Library/PchInfoLib.h>
> 
> +#include <Library/S3BootScriptLib.h>
> 
> +#include <Register/PchPcrRegs.h>
> 
> +#include <Register/PchDmiRegs.h>
> 
> +
> 
> +#include "PchDmi14.h"
> 
> +
> 
> +/**
> 
> +  Configure DMI Lock
> 
> +**/
> 
> +VOID
> 
> +PchDmiSetLockWithS3BootScript (
> 
> +  VOID
> 
> +  )
> 
> +{
> 
> +  UINT32  Data32Or;
> 
> +  UINT32  Data32And;
> 
> +  UINT16  Address;
> 
> +
> 
> +  Data32And = 0xFFFFFFFF;
> 
> +
> 
> +  PchDmi14SrlRegData (&Address, &Data32Or);
> 
> +
> 
> +  PchPcrAndThenOr32 (
> 
> +    PID_DMI, Address,
> 
> +    Data32And,
> 
> +    Data32Or
> 
> +    );
> 
> +  PCH_PCR_BOOT_SCRIPT_READ_WRITE (
> 
> +    S3BootScriptWidthUint32,
> 
> +    PID_DMI, Address,
> 
> +    &Data32Or,
> 
> +    &Data32And
> 
> +    );
> 
> +}
> 
> +
> 
> +/**
> 
> +  Set BIOS interface Lock-Down
> 
> +**/
> 
> +VOID
> 
> +PchDmiSetBiosLockDownWithS3BootScript (
> 
> +  VOID
> 
> +  )
> 
> +{
> 
> +  UINT32  Data32Or;
> 
> +  UINT32  Data32And;
> 
> +
> 
> +  //
> 
> +  // Set BIOS Lock-Down (BILD)
> 
> +  // When set, prevents GCS.BBS from being changed
> 
> +  //
> 
> +  Data32And = 0xFFFFFFFF;
> 
> +  Data32Or = B_PCH_DMI_PCR_BILD;
> 
> +  PchPcrAndThenOr32 (PID_DMI, R_PCH_DMI_PCR_GCS, Data32And,
> Data32Or);
> 
> +  PCH_PCR_BOOT_SCRIPT_READ_WRITE (
> 
> +    S3BootScriptWidthUint32,
> 
> +    PID_DMI, R_PCH_DMI_PCR_GCS,
> 
> +    &Data32Or,
> 
> +    &Data32And
> 
> +    );
> 
> +}
> 
> diff --git
> a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PeiDxeSmmPchDmiLib.inf
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PeiDxeSmmPchDmiLib.inf
> new file mode 100644
> index 0000000000..d33310dd76
> --- /dev/null
> +++
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PeiDxeSmmPchDmiLib.inf
> @@ -0,0 +1,42 @@
> +## @file
> 
> +#  Component description file for the PeiDxeSmmPchDmiLib
> 
> +#
> 
> +#  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> 
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +#
> 
> +##
> 
> +
> 
> +[Defines]
> 
> +INF_VERSION                    = 0x00010017
> 
> +BASE_NAME                      = PeiDxeSmmPchDmiLib
> 
> +FILE_GUID                      = 067DC1C4-2668-4F06-9921-307514B66B34
> 
> +VERSION_STRING                 = 1.0
> 
> +MODULE_TYPE                    = BASE
> 
> +LIBRARY_CLASS                  = PchDmiLib
> 
> +#
> 
> +# The following information is for reference only and not required by the
> build tools.
> 
> +#
> 
> +#  VALID_ARCHITECTURES           = IA32 X64
> 
> +#
> 
> +
> 
> +[LibraryClasses]
> 
> +  BaseLib
> 
> +  IoLib
> 
> +  DebugLib
> 
> +  PchInfoLib
> 
> +  PchPcrLib
> 
> +
> 
> +[Packages]
> 
> +  MdePkg/MdePkg.dec
> 
> +  TigerlakeSiliconPkg/SiPkg.dec
> 
> +
> 
> +
> 
> +[Sources]
> 
> +  PchDmiLib.c
> 
> +  PchDmi14.c
> 
> +  PchDmi14.h
> 
> +
> 
> +[Guids]
> 
> +  gPchDmiConfigGuid         ## CONSUMES
> 
> +
> 
> +[Pcd]
> 
> diff --git
> a/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PeiDxeSmmPchDmiWithS3Lib.inf
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PeiDxeSmmPchDmiWithS3Lib.inf
> new file mode 100644
> index 0000000000..9381a7b5fd
> --- /dev/null
> +++
> b/Silicon/Intel/TigerlakeSiliconPkg/IpBlock/PchDmi/LibraryPrivate/PeiDxeSm
> mPchDmiLib/PeiDxeSmmPchDmiWithS3Lib.inf
> @@ -0,0 +1,41 @@
> +## @file
> 
> +#  Component description file for the PeiDxeSmmPchDmiWithS3Lib
> 
> +#
> 
> +#  Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
> 
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> +#
> 
> +##
> 
> +
> 
> +[Defines]
> 
> +INF_VERSION                    = 0x00010017
> 
> +BASE_NAME                      = PeiDxeSmmPchDmiWithS3Lib
> 
> +FILE_GUID                      = 32CCA047-6AF0-46FF-83DA-32BA62484075
> 
> +VERSION_STRING                 = 1.0
> 
> +MODULE_TYPE                    = BASE
> 
> +LIBRARY_CLASS                  = PchDmiWithS3Lib
> 
> +#
> 
> +# The following information is for reference only and not required by the
> build tools.
> 
> +#
> 
> +#  VALID_ARCHITECTURES           = IA32 X64
> 
> +#
> 
> +
> 
> +[LibraryClasses]
> 
> +  BaseLib
> 
> +  IoLib
> 
> +  DebugLib
> 
> +  PchPcrLib
> 
> +  PchInfoLib
> 
> +  S3BootScriptLib
> 
> +  PchDmiLib
> 
> +
> 
> +
> 
> +[Packages]
> 
> +  MdePkg/MdePkg.dec
> 
> +  TigerlakeSiliconPkg/SiPkg.dec
> 
> +
> 
> +
> 
> +[Sources]
> 
> +  PchDmiWithS3Lib.c
> 
> +  PchDmi14.h
> 
> +
> 
> +[pcd]
> 
> --
> 2.24.0.windows.2


  reply	other threads:[~2021-02-04  3:55 UTC|newest]

Thread overview: 81+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01  1:36 [PATCH 01/40] TigerlakeSiliconPkg: Add package and Include/ConfigBlock headers Heng Luo
2021-02-01  1:36 ` [PATCH 02/40] TigerlakeSiliconPkg/Include: Add Library, PPI and Protocol include headers Heng Luo
2021-02-04  3:51   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 03/40] TigerlakeSiliconPkg/Include: Add Pins, Register and other " Heng Luo
2021-02-04  3:52   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 04/40] TigerlakeSiliconPkg/Cpu: Add Include headers Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 05/40] TigerlakeSiliconPkg/Pch: Add include headers Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 06/40] TigerlakeSiliconPkg/Pch: Add IncludePrivate headers Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 07/40] TigerlakeSiliconPkg/SystemAgent: Add include headers Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 08/40] TigerlakeSiliconPkg/SystemAgent: Add IncludePrivate headers Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 09/40] TigerlakeSiliconPkg/Fru: Add TglCpu/Include headers Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 10/40] TigerlakeSiliconPkg/Fru: Add TglCpu/IncludePrivate headers Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 11/40] TigerlakeSiliconPkg/Fru: Add TglPch/Include headers Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 12/40] TigerlakeSiliconPkg/Fru: Add TglPch/IncludePrivate headers Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 13/40] TigerlakeSiliconPkg/IpBlock: Add Cnvi component Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 14/40] TigerlakeSiliconPkg/IpBlock: Add CpuPcieRp component Heng Luo
2021-02-04  3:53   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 15/40] TigerlakeSiliconPkg/IpBlock: Add Espi component Heng Luo
2021-02-04  3:54   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 16/40] TigerlakeSiliconPkg/IpBlock: Add Gbe component Heng Luo
2021-02-04  3:54   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 17/40] TigerlakeSiliconPkg/IpBlock: Add Gpio component Heng Luo
2021-02-04  3:54   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 18/40] TigerlakeSiliconPkg/IpBlock: Add Graphics component Heng Luo
2021-02-04  3:54   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 19/40] TigerlakeSiliconPkg/IpBlock: Add Hda component Heng Luo
2021-02-04  3:54   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 20/40] TigerlakeSiliconPkg/IpBlock: Add HostBridge component Heng Luo
2021-02-04  3:54   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 21/40] TigerlakeSiliconPkg/IpBlock: Add P2sb component Heng Luo
2021-02-04  3:54   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 22/40] TigerlakeSiliconPkg/IpBlock: Add PchDmi component Heng Luo
2021-02-04  3:54   ` Nate DeSimone [this message]
2021-02-01  1:36 ` [PATCH 23/40] TigerlakeSiliconPkg/IpBlock: Add PcieRp component Heng Luo
2021-02-04  3:55   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 24/40] TigerlakeSiliconPkg/IpBlock: Add Pmc component Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 25/40] TigerlakeSiliconPkg/IpBlock: Add Psf component Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 26/40] TigerlakeSiliconPkg/IpBlock: Add Sata component Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 27/40] TigerlakeSiliconPkg/IpBlock: Add SerialIo component Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 28/40] TigerlakeSiliconPkg/IpBlock: Add Smbus component Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 29/40] TigerlakeSiliconPkg/IpBlock: Add Spi component Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 30/40] TigerlakeSiliconPkg/IpBlock: Add Vtd component Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 31/40] TigerlakeSiliconPkg/Library: Add package common library instances Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 32/40] TigerlakeSiliconPkg/Pch: Add Pch " Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 33/40] TigerlakeSiliconPkg/Pch: Add Pch private " Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 34/40] TigerlakeSiliconPkg/SystemAgent: Add Acpi Tables and " Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 35/40] TigerlakeSiliconPkg/Fru/TglCpu: Add CpuPcieRp and Vtd " Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 36/40] TigerlakeSiliconPkg/Pch: Add Pch modules Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 37/40] TigerlakeSiliconPkg/SystemAgent: Add SystemAgent modules Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 38/40] TigerlakeSiliconPkg/Fru: Add Fru DSC files Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 39/40] TigerlakeSiliconPkg: Add package " Heng Luo
2021-02-04  3:56   ` Nate DeSimone
2021-02-01  1:36 ` [PATCH 40/40] Maintainers.txt: Add TigerlakeSiliconPkg maintainers Heng Luo
2021-02-04  3:51   ` Nate DeSimone
2021-02-04  8:24     ` Heng Luo
2021-02-04  3:51 ` [PATCH 01/40] TigerlakeSiliconPkg: Add package and Include/ConfigBlock headers Nate DeSimone

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BN6PR1101MB21477A40CD17F0ACC5212AA7CDB39@BN6PR1101MB2147.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox