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>
258 lines
6.2 KiB
C
258 lines
6.2 KiB
C
/** @file
|
|
Config data library instance for data access.
|
|
|
|
Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
|
|
#ifndef __CONFIGURATION_DATA_LIB_H__
|
|
#define __CONFIGURATION_DATA_LIB_H__
|
|
|
|
#define CFG_DATA_SIGNATURE SIGNATURE_32 ('C', 'F', 'G', 'D')
|
|
|
|
#define CDATA_BLOB_ATTR_SIGNED (1 << 0)
|
|
#define CDATA_BLOB_ATTR_MERGED (1 << 7)
|
|
|
|
#define CDATA_FLAG_TYPE_MASK (3 << 0)
|
|
#define CDATA_FLAG_TYPE_NORMAL (0 << 0)
|
|
#define CDATA_FLAG_TYPE_ARRAY (1 << 0)
|
|
#define CDATA_FLAG_TYPE_REFER (2 << 0)
|
|
|
|
#define CFG_LOAD_SRC_PDR (1 << 0)
|
|
#define CFG_LOAD_SRC_BIOS (1 << 1)
|
|
|
|
#define PID_TO_MASK(x) (1 << ((x) & 0x1F))
|
|
|
|
#define CDATA_NO_TAG 0x000
|
|
#define CDATA_PLATFORMID_TAG 0x0F0
|
|
|
|
typedef struct {
|
|
UINT16 PlatformId;
|
|
UINT16 Reserved;
|
|
} PLATFORMID_CFG_DATA;
|
|
|
|
typedef struct {
|
|
UINT16 PlatformId;
|
|
UINT16 Tag : 12;
|
|
UINT16 IsInternal : 1;
|
|
UINT16 Reserved : 3;
|
|
} REFERENCE_CFG_DATA;
|
|
|
|
typedef struct {
|
|
UINT32 Value; // Bit masks on supported platforms
|
|
} CDATA_COND;
|
|
|
|
typedef struct {
|
|
UINT32 ConditionNum : 2; // [1:0] #of condition words present
|
|
UINT32 Length : 10; // [11:2] total size of item (in dwords)
|
|
UINT32 Flags : 4; // [15:12] unused/reserved so far
|
|
UINT32 Version : 4; // [19:16] item (payload) format version
|
|
UINT32 Tag : 12; // [31:20] identifies item (in payload)
|
|
CDATA_COND Condition[0];
|
|
} CDATA_HEADER;
|
|
|
|
typedef struct {
|
|
UINT32 Signature;
|
|
//
|
|
// This header Length
|
|
//
|
|
UINT8 HeaderLength;
|
|
UINT8 Attribute;
|
|
union {
|
|
//
|
|
// Internal configuration data offset in DWORD from the start of data blob.
|
|
// This value is only valid in runtime.
|
|
//
|
|
UINT16 InternalDataOffset;
|
|
//
|
|
// Security version number
|
|
// This is available only in flash. It would be overwritten by CDATA_BLOB.InternalDataOffset in runtime
|
|
//
|
|
UINT8 Svn;
|
|
} ExtraInfo;
|
|
//
|
|
// The total valid configuration data length including this header.
|
|
//
|
|
UINT32 UsedLength;
|
|
//
|
|
// The total space for configration data
|
|
//
|
|
UINT32 TotalLength;
|
|
} CDATA_BLOB;
|
|
|
|
typedef struct {
|
|
|
|
/* header size */
|
|
UINT8 HeaderSize;
|
|
|
|
/* base table ID */
|
|
UINT8 BaseTableId;
|
|
|
|
/* size in byte for every array entry */
|
|
UINT16 ItemSize;
|
|
|
|
/* array entry count */
|
|
UINT16 ItemCount;
|
|
|
|
/* array entry ID bit offset */
|
|
UINT8 ItemIdBitOff;
|
|
|
|
/* array entry ID bit length */
|
|
UINT8 ItemIdBitLen;
|
|
|
|
/* array entry valid bit offset */
|
|
UINT8 ItemValidBitOff;
|
|
|
|
/* unused */
|
|
UINT8 ItemUnused;
|
|
|
|
/* array entry bit mask, 1 bit per entry to indicate the entry exists or not */
|
|
UINT8 BaseTableBitMask[0];
|
|
|
|
} ARRAY_CFG_HDR;
|
|
|
|
|
|
/**
|
|
Load the configuration data blob from media into destination buffer.
|
|
|
|
@param[in] Dst Destination address to load configuration data blob.
|
|
@param[in] Src Source address to load configuration data blob.
|
|
@param[in] Len The destination address buffer size.
|
|
|
|
@retval EFI_SUCCESS Configuration data blob was loaded successfully.
|
|
@retval EFI_NOT_FOUND Configuration data blob cannot be found.
|
|
@retval EFI_OUT_OF_RESOURCES Destination buffer is too small to hold the
|
|
configuration data blob.
|
|
@retval Others Failed to load configuration data blob.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
LoadExternalConfigData (
|
|
IN UINT32 Dst,
|
|
IN UINT32 Src,
|
|
IN UINT32 Len
|
|
);
|
|
|
|
|
|
/**
|
|
Find configuration data header by its tag and platform ID.
|
|
|
|
@param[in] PlatformId Platform ID.
|
|
@param[in] Tag Configuration TAG ID to find.
|
|
|
|
@retval Configuration data header pointer.
|
|
NULL if the tag cannot be found.
|
|
|
|
**/
|
|
CDATA_HEADER *
|
|
EFIAPI
|
|
FindConfigHdrByPidTag (
|
|
UINT16 PlatformId,
|
|
UINT32 Tag
|
|
);
|
|
|
|
/**
|
|
Find configuration data header by its tag.
|
|
|
|
@param[in] Tag Configuration TAG ID to find.
|
|
|
|
@retval Configuration data header pointer.
|
|
NULL if the tag cannot be found.
|
|
|
|
**/
|
|
CDATA_HEADER *
|
|
EFIAPI
|
|
FindConfigHdrByTag (
|
|
UINT32 Tag
|
|
);
|
|
|
|
/**
|
|
Find configuration data by its tag.
|
|
|
|
@param[in] PlatformId Platform ID.
|
|
@param[in] Tag Configuration TAG ID to find.
|
|
|
|
@retval Configuration data pointer.
|
|
NULL if the tag cannot be found.
|
|
|
|
**/
|
|
VOID *
|
|
EFIAPI
|
|
FindConfigDataByPidTag (
|
|
UINT16 PlatformId,
|
|
UINT32 Tag
|
|
);
|
|
|
|
/**
|
|
Find configuration data by its tag.
|
|
|
|
@param[in] Tag Configuration TAG ID to find.
|
|
|
|
@retval Configuration data pointer.
|
|
NULL if the tag cannot be found.
|
|
|
|
**/
|
|
VOID *
|
|
EFIAPI
|
|
FindConfigDataByTag (
|
|
UINT32 Tag
|
|
);
|
|
|
|
/**
|
|
Add new Config Data
|
|
|
|
Ext/Built-In Config Data for a specific board
|
|
is added to the Config Data Blob present at the
|
|
CfgDataPtr in the LDR_GLOBAL_DATA. Exclude the
|
|
CFG_BLOB header here as it is already there with CfgDataPtr.
|
|
|
|
@param[in] CfgAddPtr Address of the CfgBlob that is to be added
|
|
|
|
@retval EFI_SUCCESS if the CfgBlob is added successfully
|
|
@retval EFI_UNSUPPORTED if not a valid CfgBlob
|
|
@retval EFI_OUT_OF_RESOURCES if not enough memory available to add Config Data
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
AddConfigData (
|
|
IN UINT8 *CfgAddPtr
|
|
);
|
|
|
|
/**
|
|
Build a full set of CFGDATA for current platform.
|
|
|
|
@param[in] Buffer Buffer pointer to store the full CFGDATA set.
|
|
@param[in] Length Buffer length.
|
|
|
|
@retval EFI_BUFFER_TOO_SMALL The buffer size is too small to store the CFGDATA.
|
|
@retval EFI_INVALID_PARAMETER The buffer pointer is NULL.
|
|
@retval EFI_NOT_FOUND Could not find some CFGDATA tag.
|
|
@retval EFI_SUCCESS The full set of CFGDATA was built successfully.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
BuildConfigData (
|
|
IN UINT8 *Buffer,
|
|
IN UINT32 Length
|
|
);
|
|
|
|
/**
|
|
Get a full CFGDATA set length.
|
|
|
|
@retval Length of a full CFGDATA set.
|
|
0 indicates no CFGDATA exists.
|
|
|
|
**/
|
|
UINT32
|
|
EFIAPI
|
|
GetConfigDataSize (
|
|
VOID
|
|
);
|
|
|
|
#endif
|