You've already forked slimbootloader
mirror of
https://github.com/Dasharo/slimbootloader.git
synced 2026-03-06 15:26:20 -08:00
Convert the line endings stored for all text files in the repository to LF. The majority previously used DOS-style CRLF line endings. Add a .gitattributes file to enforce this and treat certain extensions as never being text files. Update PatchCheck.py to insist on LF line endings rather than CRLF. However, its other checks fail on this commit due to lots of pre-existing complaints that it only notices because the line endings have changed. Silicon/QemuSocPkg/FspBin/Patches/0001-Build-QEMU-FSP-2.0-binaries.patch needs to be treated as binary since it contains a mixture of line endings. This change has implications depending on the client platform you are using the repository from: * Windows The usual configuration for Git on Windows means that text files will be checked out to the work tree with DOS-style CRLF line endings. If that's not the case then you can configure Git to do so for the entire machine with: git config --global core.autocrlf true or for just the repository with: git config core.autocrlf true Line endings will be normalised to LF when they are committed to the repository. If you commit a text file with only LF line endings then it will be converted to CRLF line endings in your work tree. * Linux, MacOS and other Unices The usual configuration for Git on such platforms is to check files out of the repository with LF line endings. This is probably the right thing for you. In the unlikely even that you are using Git on Unix but editing or compiling on Windows for some reason then you may need to tweak your configuration to force the use of CRLF line endings as described above. * General For more information see https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings . Fixes: https://github.com/slimbootloader/slimbootloader/issues/1400 Signed-off-by: Mike Crowe <mac@mcrowe.com>
493 lines
11 KiB
C
493 lines
11 KiB
C
/** @file
|
|
Implementation of PcdLib class library for PEI phase.
|
|
|
|
Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
#include <PiPei.h>
|
|
#include <Library/PcdLib.h>
|
|
#include <Library/DebugLib.h>
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
#include "Service.h"
|
|
|
|
/**
|
|
This function provides a means by which to retrieve a value for a given PCD token.
|
|
|
|
Returns the 8-bit value for the token specified by TokenNumber.
|
|
|
|
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
|
|
|
@return Returns the 8-bit value for the token specified by TokenNumber.
|
|
|
|
**/
|
|
UINT8
|
|
EFIAPI
|
|
LibPcdGet8 (
|
|
IN UINTN TokenNumber
|
|
)
|
|
{
|
|
return PeiPcdGet8 (TokenNumber);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to retrieve a value for a given PCD token.
|
|
|
|
Returns the 16-bit value for the token specified by TokenNumber.
|
|
|
|
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
|
|
|
@return Returns the 16-bit value for the token specified by TokenNumber.
|
|
|
|
**/
|
|
UINT16
|
|
EFIAPI
|
|
LibPcdGet16 (
|
|
IN UINTN TokenNumber
|
|
)
|
|
{
|
|
return PeiPcdGet16 (TokenNumber);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to retrieve a value for a given PCD token.
|
|
|
|
Returns the 32-bit value for the token specified by TokenNumber.
|
|
|
|
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
|
|
|
@return Returns the 32-bit value for the token specified by TokenNumber.
|
|
|
|
**/
|
|
UINT32
|
|
EFIAPI
|
|
LibPcdGet32 (
|
|
IN UINTN TokenNumber
|
|
)
|
|
{
|
|
return PeiPcdGet32 (TokenNumber);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to retrieve a value for a given PCD token.
|
|
|
|
Returns the 64-bit value for the token specified by TokenNumber.
|
|
|
|
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
|
|
|
@return Returns the 64-bit value for the token specified by TokenNumber.
|
|
|
|
**/
|
|
UINT64
|
|
EFIAPI
|
|
LibPcdGet64 (
|
|
IN UINTN TokenNumber
|
|
)
|
|
{
|
|
return PeiPcdGet64 (TokenNumber);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to retrieve a value for a given PCD token.
|
|
|
|
Returns the pointer to the buffer of the token specified by TokenNumber.
|
|
|
|
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
|
|
|
@return Returns the pointer to the token specified by TokenNumber.
|
|
|
|
**/
|
|
VOID *
|
|
EFIAPI
|
|
LibPcdGetPtr (
|
|
IN UINTN TokenNumber
|
|
)
|
|
{
|
|
return PeiPcdGetPtr (TokenNumber);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to retrieve a value for a given PCD token.
|
|
|
|
Returns the Boolean value of the token specified by TokenNumber.
|
|
|
|
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
|
|
|
@return Returns the Boolean value of the token specified by TokenNumber.
|
|
|
|
**/
|
|
BOOLEAN
|
|
EFIAPI
|
|
LibPcdGetBool (
|
|
IN UINTN TokenNumber
|
|
)
|
|
{
|
|
return PeiPcdGetBool (TokenNumber);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to retrieve the size of a given PCD token.
|
|
|
|
@param[in] TokenNumber The PCD token number to retrieve a current value for.
|
|
|
|
@return Returns the size of the token specified by TokenNumber.
|
|
|
|
**/
|
|
UINTN
|
|
EFIAPI
|
|
LibPcdGetSize (
|
|
IN UINTN TokenNumber
|
|
)
|
|
{
|
|
return PeiPcdGetSize (TokenNumber);
|
|
}
|
|
|
|
|
|
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets the 8-bit value for the token specified by TokenNumber
|
|
to the value specified by Value. Value is returned.
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in] Value The 8-bit value to set.
|
|
|
|
@return Return the value that was set.
|
|
|
|
**/
|
|
UINT8
|
|
EFIAPI
|
|
LibPcdSet8 (
|
|
IN UINTN TokenNumber,
|
|
IN UINT8 Value
|
|
)
|
|
{
|
|
PeiPcdSet8 (TokenNumber, Value);
|
|
|
|
return Value;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets the 16-bit value for the token specified by TokenNumber
|
|
to the value specified by Value. Value is returned.
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in] Value The 16-bit value to set.
|
|
|
|
@return Return the value that was set.
|
|
|
|
**/
|
|
UINT16
|
|
EFIAPI
|
|
LibPcdSet16 (
|
|
IN UINTN TokenNumber,
|
|
IN UINT16 Value
|
|
)
|
|
{
|
|
PeiPcdSet16 (TokenNumber, Value);
|
|
|
|
return Value;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets the 32-bit value for the token specified by TokenNumber
|
|
to the value specified by Value. Value is returned.
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in] Value The 32-bit value to set.
|
|
|
|
@return Return the value that was set.
|
|
|
|
**/
|
|
UINT32
|
|
EFIAPI
|
|
LibPcdSet32 (
|
|
IN UINTN TokenNumber,
|
|
IN UINT32 Value
|
|
)
|
|
{
|
|
PeiPcdSet32 (TokenNumber, Value);
|
|
|
|
return Value;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets the 64-bit value for the token specified by TokenNumber
|
|
to the value specified by Value. Value is returned.
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in] Value The 64-bit value to set.
|
|
|
|
@return Return the value that was set.
|
|
|
|
**/
|
|
UINT64
|
|
EFIAPI
|
|
LibPcdSet64 (
|
|
IN UINTN TokenNumber,
|
|
IN UINT64 Value
|
|
)
|
|
{
|
|
PeiPcdSet64 (TokenNumber, Value);
|
|
|
|
return Value;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets a buffer for the token specified by TokenNumber to the value
|
|
specified by Buffer and SizeOfBuffer. Buffer is returned.
|
|
If SizeOfBuffer is greater than the maximum size support by TokenNumber,
|
|
then set SizeOfBuffer to the maximum size supported by TokenNumber and
|
|
return NULL to indicate that the set operation was not actually performed.
|
|
|
|
If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
|
|
maximum size supported by TokenName and NULL must be returned.
|
|
|
|
If SizeOfBuffer is NULL, then ASSERT().
|
|
If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
|
|
@param[in] Buffer A pointer to the buffer to set.
|
|
|
|
@return Return the pointer for the buffer been set.
|
|
|
|
**/
|
|
VOID *
|
|
EFIAPI
|
|
LibPcdSetPtr (
|
|
IN UINTN TokenNumber,
|
|
IN OUT UINTN *SizeOfBuffer,
|
|
IN CONST VOID *Buffer
|
|
)
|
|
{
|
|
EFI_STATUS Status;
|
|
UINTN InputSizeOfBuffer;
|
|
|
|
ASSERT (SizeOfBuffer != NULL);
|
|
|
|
if (*SizeOfBuffer > 0) {
|
|
ASSERT (Buffer != NULL);
|
|
}
|
|
|
|
InputSizeOfBuffer = *SizeOfBuffer;
|
|
Status = PeiPcdSetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);
|
|
if (EFI_ERROR (Status) && (*SizeOfBuffer < InputSizeOfBuffer)) {
|
|
return NULL;
|
|
}
|
|
|
|
return (VOID *) Buffer;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets the Boolean value for the token specified by TokenNumber
|
|
to the value specified by Value. Value is returned.
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in] Value The boolean value to set.
|
|
|
|
@return Return the value that was set.
|
|
|
|
**/
|
|
BOOLEAN
|
|
EFIAPI
|
|
LibPcdSetBool (
|
|
IN UINTN TokenNumber,
|
|
IN BOOLEAN Value
|
|
)
|
|
{
|
|
PeiPcdSetBool (TokenNumber, Value);
|
|
|
|
return Value;
|
|
}
|
|
|
|
#endif
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets the 8-bit value for the token specified by TokenNumber
|
|
to the value specified by Value.
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in] Value The 8-bit value to set.
|
|
|
|
@return The status of the set operation.
|
|
|
|
**/
|
|
RETURN_STATUS
|
|
EFIAPI
|
|
LibPcdSet8S (
|
|
IN UINTN TokenNumber,
|
|
IN UINT8 Value
|
|
)
|
|
{
|
|
return PeiPcdSet8 (TokenNumber, Value);
|
|
}
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets the 16-bit value for the token specified by TokenNumber
|
|
to the value specified by Value.
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in] Value The 16-bit value to set.
|
|
|
|
@return The status of the set operation.
|
|
|
|
**/
|
|
RETURN_STATUS
|
|
EFIAPI
|
|
LibPcdSet16S (
|
|
IN UINTN TokenNumber,
|
|
IN UINT16 Value
|
|
)
|
|
{
|
|
return PeiPcdSet16 (TokenNumber, Value);
|
|
}
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets the 32-bit value for the token specified by TokenNumber
|
|
to the value specified by Value.
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in] Value The 32-bit value to set.
|
|
|
|
@return The status of the set operation.
|
|
|
|
**/
|
|
RETURN_STATUS
|
|
EFIAPI
|
|
LibPcdSet32S (
|
|
IN UINTN TokenNumber,
|
|
IN UINT32 Value
|
|
)
|
|
{
|
|
return PeiPcdSet32 (TokenNumber, Value);
|
|
}
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets the 64-bit value for the token specified by TokenNumber
|
|
to the value specified by Value.
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in] Value The 64-bit value to set.
|
|
|
|
@return The status of the set operation.
|
|
|
|
**/
|
|
RETURN_STATUS
|
|
EFIAPI
|
|
LibPcdSet64S (
|
|
IN UINTN TokenNumber,
|
|
IN UINT64 Value
|
|
)
|
|
{
|
|
return PeiPcdSet64 (TokenNumber, Value);
|
|
}
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets a buffer for the token specified by TokenNumber to the value specified
|
|
by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size
|
|
support by TokenNumber, then set SizeOfBuffer to the maximum size supported by
|
|
TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation
|
|
was not actually performed.
|
|
|
|
If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the
|
|
maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned.
|
|
|
|
If SizeOfBuffer is NULL, then ASSERT().
|
|
If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in, out] SizeOfBuffer The size, in bytes, of Buffer.
|
|
@param[in] Buffer A pointer to the buffer to set.
|
|
|
|
@return The status of the set operation.
|
|
|
|
**/
|
|
RETURN_STATUS
|
|
EFIAPI
|
|
LibPcdSetPtrS (
|
|
IN UINTN TokenNumber,
|
|
IN OUT UINTN *SizeOfBuffer,
|
|
IN CONST VOID *Buffer
|
|
)
|
|
{
|
|
ASSERT (SizeOfBuffer != NULL);
|
|
|
|
if (*SizeOfBuffer > 0) {
|
|
ASSERT (Buffer != NULL);
|
|
}
|
|
|
|
return PeiPcdSetPtr (TokenNumber, SizeOfBuffer, (VOID *) Buffer);
|
|
}
|
|
|
|
/**
|
|
This function provides a means by which to set a value for a given PCD token.
|
|
|
|
Sets the boolean value for the token specified by TokenNumber
|
|
to the value specified by Value.
|
|
|
|
@param[in] TokenNumber The PCD token number to set a current value for.
|
|
@param[in] Value The boolean value to set.
|
|
|
|
@return The status of the set operation.
|
|
|
|
**/
|
|
RETURN_STATUS
|
|
EFIAPI
|
|
LibPcdSetBoolS (
|
|
IN UINTN TokenNumber,
|
|
IN BOOLEAN Value
|
|
)
|
|
{
|
|
return PeiPcdSetBool (TokenNumber, Value);
|
|
}
|