/** @file
|
Pch information library.
|
|
All function in this library is available for PEI, DXE, and SMM,
|
But do not support UEFI RUNTIME environment call.
|
|
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/PciSegmentLib.h>
|
#include <Library/PchInfoLib.h>
|
#include <Library/PchPcrLib.h>
|
#include <Library/PrintLib.h>
|
#include <Library/PcdLib.h>
|
#include "PchInfoLibPrivate.h"
|
#include <Register/PchRegs.h>
|
#include <Register/PchRegsLpc.h>
|
#include <PchPcieRpInfo.h>
|
#include <IndustryStandard/Pci30.h>
|
#include <Library/PchPciBdfLib.h>
|
|
/**
|
Return Pch Series
|
|
@retval PCH_SERIES Pch Series
|
**/
|
PCH_SERIES
|
PchSeries (
|
VOID
|
)
|
{
|
return PCH_LP;
|
}
|
|
/**
|
Return Pch stepping type
|
|
@retval PCH_STEPPING Pch stepping type
|
**/
|
PCH_STEPPING
|
PchStepping (
|
VOID
|
)
|
{
|
return 0;
|
}
|
|
/**
|
Check if this is TGL PCH generation
|
|
@retval TRUE It's TGL PCH
|
@retval FALSE It's not TGL PCH
|
**/
|
BOOLEAN
|
IsTglPch (
|
VOID
|
)
|
{
|
return (PchGeneration () == TGL_PCH);
|
}
|
|
/**
|
Get PCH stepping ASCII string.
|
Function determines major and minor stepping versions and writes them into a buffer.
|
The return string is zero terminated
|
|
@param [out] Buffer Output buffer of string
|
@param [in] BufferSize Buffer size.
|
Must not be less then PCH_STEPPING_STR_LENGTH_MAX
|
|
@retval EFI_SUCCESS String copied successfully
|
@retval EFI_INVALID_PARAMETER The stepping is not supported, or parameters are NULL
|
@retval EFI_BUFFER_TOO_SMALL Input buffer size is too small
|
**/
|
EFI_STATUS
|
PchGetSteppingStr (
|
OUT CHAR8 *Buffer,
|
IN UINT32 BufferSize
|
)
|
{
|
PCH_STEPPING PchStep;
|
|
PchStep = PchStepping ();
|
|
if ((Buffer == NULL) || (BufferSize == 0)) {
|
return EFI_INVALID_PARAMETER;
|
}
|
if (BufferSize < PCH_STEPPING_STR_LENGTH_MAX) {
|
return EFI_BUFFER_TOO_SMALL;
|
}
|
|
PchPrintSteppingStr (Buffer, BufferSize, PchStep);
|
|
return EFI_SUCCESS;
|
}
|
|
/**
|
Get Pch Maximum Pcie Controller Number
|
|
@retval Pch Maximum Pcie Root Port Number
|
**/
|
UINT8
|
GetPchMaxPcieControllerNum (
|
VOID
|
)
|
{
|
return GetPchMaxPciePortNum () / PCH_PCIE_CONTROLLER_PORTS;
|
}
|
|
/**
|
return support status for P2SB PCR 20-bit addressing
|
|
@retval TRUE
|
@retval FALSE
|
**/
|
BOOLEAN
|
IsP2sb20bPcrSupported (
|
VOID
|
)
|
{
|
return FALSE;
|
}
|