TianoCore EDK2 master
|
#include <Library/TcgStorageCoreLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
Go to the source code of this file.
Provide functions to provide tcg storage core spec related functions.
Copyright (c) 2016, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file TcgStorageCore.c.
TCG_RESULT TcgAddAtom | ( | TCG_CREATE_STRUCT * | CreateStruct, |
const VOID * | Data, | ||
UINT32 | DataSize, | ||
UINT8 | ByteOrInt, | ||
UINT8 | SignOrCont | ||
) |
simple tokens - atoms: tiny, short, medium, long and empty atoms. tiny atom can be a signed or unsigned integer. short, medium, long can be a signed or unsigned integer OR a complete or non-final byte sequence.
CreateStruct | The create structure. |
Data | The data need to add. |
DataSize | The data size. |
ByteOrInt,Data | format is byte or int. |
SignOrCont | sign or cont. |
Definition at line 444 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddBOOLEAN | ( | TCG_CREATE_STRUCT * | CreateStruct, |
BOOLEAN | Value | ||
) |
Adds a BOOLEAN to the Data structure.
[in/out] | CreateStruct Structure used to add the integer | |
[in] | Value | BOOLEAN Value to add |
Definition at line 672 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddByteSequence | ( | TCG_CREATE_STRUCT * | CreateStruct, |
const VOID * | Data, | ||
UINT32 | DataSize, | ||
BOOLEAN | Continued | ||
) |
Adds the Data parameter as a byte sequence to the Data structure.
[in/out] | CreateStruct Structure used to add the byte sequence | |
[in] | Data | Byte sequence that will be encoded and copied into Data structure |
[in] | DataSize | Length of Data provided |
[in] | Continued | TRUE if byte sequence is continued or FALSE if the Data contains the entire byte sequence to be encoded |
Definition at line 529 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddCall | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Add end call.
[in/out] | CreateStruct Structure used to add the integer |
return | the action result. |
Definition at line 777 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddEndList | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Add end list.
[in/out] | CreateStruct Structure used to add the integer |
return | the action result. |
Definition at line 726 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddEndName | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Add end name.
[in/out] | CreateStruct Structure used to add the integer |
return | the action result. |
Definition at line 760 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddEndOfData | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Add end of data.
[in/out] | CreateStruct Structure used to add the integer |
return | the action result. |
Definition at line 794 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddEndOfSession | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Add end of session.
[in/out] | CreateStruct Structure used to add the integer |
return | the action result. |
Definition at line 811 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddEndTransaction | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Add end transaction.
[in/out] | CreateStruct Structure used to add the integer |
return | the action result. |
Definition at line 845 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddInteger | ( | TCG_CREATE_STRUCT * | CreateStruct, |
const VOID * | Data, | ||
UINT32 | DataSize, | ||
BOOLEAN | SignedInteger | ||
) |
Adds an arbitrary-Length integer to the Data structure. The integer will be encoded using the shortest possible atom.
[in/out] | CreateStruct Structure used to add the integer | |
[in] | Data | Integer in host byte order that will be encoded and copied into Data structure |
[in] | DataSize | Length in bytes of the Data provided |
[in] | SignedInteger | TRUE if the integer is signed or FALSE if the integer is unsigned |
Definition at line 552 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddRawByte | ( | TCG_CREATE_STRUCT * | CreateStruct, |
UINT8 | Byte | ||
) |
Adds a single raw token byte to the Data structure.
[in/out] | CreateStruct Structure used to add the byte | |
[in] | Byte | Byte to add |
Definition at line 422 of file TcgStorageCore.c.
TCG_RESULT TcgAddRawTokenData | ( | TCG_CREATE_STRUCT * | CreateStruct, |
const VOID * | Header, | ||
UINT8 | HeaderSize, | ||
const VOID * | Data, | ||
UINT32 | DataSize, | ||
BOOLEAN | ByteSwapData | ||
) |
Adds raw Data with optional Header
CreateStruct | The create structure. |
Header | The header structure. |
HeaderSize | The header size. |
Data | The data need to add. |
DataSize | The data size. |
ByteSwapData | Whether byte or swap data. |
Definition at line 334 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddStartList | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Add start list.
[in/out] | CreateStruct Structure used to add the integer |
return | the action result. |
Definition at line 709 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddStartName | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Add start name.
[in/out] | CreateStruct Structure used to add the integer |
return | the action result. |
Definition at line 743 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddStartTransaction | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Add start transaction.
[in/out] | CreateStruct Structure used to add the integer |
return | the action result. |
Definition at line 828 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddTcgUid | ( | TCG_CREATE_STRUCT * | CreateStruct, |
TCG_UID | Uid | ||
) |
Add tcg uid info.
[in/out] | CreateStruct Structure used to add the integer |
Uid | Input uid info. |
return | the action result. |
Definition at line 691 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddUINT16 | ( | TCG_CREATE_STRUCT * | CreateStruct, |
UINT16 | Value | ||
) |
Adds a 16-bit unsigned integer to the Data structure.
[in/out] | CreateStruct Structure used to add the integer | |
[in] | Value | Integer Value to add |
Definition at line 619 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddUINT32 | ( | TCG_CREATE_STRUCT * | CreateStruct, |
UINT32 | Value | ||
) |
Adds a 32-bit unsigned integer to the Data structure.
[in/out] | CreateStruct Structure used to add the integer | |
[in] | Value | Integer Value to add |
Definition at line 637 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddUINT64 | ( | TCG_CREATE_STRUCT * | CreateStruct, |
UINT64 | Value | ||
) |
Adds a 64-bit unsigned integer to the Data structure.
[in/out] | CreateStruct Structure used to add the integer | |
[in] | Value | Integer Value to add |
Definition at line 655 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgAddUINT8 | ( | TCG_CREATE_STRUCT * | CreateStruct, |
UINT8 | Value | ||
) |
Adds an 8-bit unsigned integer to the Data structure.
[in/out] | CreateStruct Structure used to add the integer | |
[in] | Value | Integer Value to add |
Definition at line 601 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgEndComPacket | ( | TCG_CREATE_STRUCT * | CreateStruct, |
UINT32 * | Size | ||
) |
Ends the ComPacket in the Data structure and ret
[in/out] | CreateStruct Structure used to end the Tcg ComPacket |
[in/out] | Size Describes the Size of the entire ComPacket (Header and payload). Filled out by function. |
Definition at line 299 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgEndPacket | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Ends the current Packet in the Data structure.
[in/out] | CreateStruct Structure used to end the current Tcg Packet |
Definition at line 269 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgEndSubPacket | ( | TCG_CREATE_STRUCT * | CreateStruct | ) |
Ends the current SubPacket in the Data structure. This function will also perform the 4-byte padding required for Subpackets.
[in/out] | CreateStruct Structure used to end the current Tcg SubPacket |
Definition at line 220 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetAtomInfo | ( | const TCG_TOKEN * | TcgToken, |
UINT32 * | HeaderLength, | ||
UINT32 * | DataLength, | ||
UINT8 * | ByteOrInt, | ||
UINT8 * | SignOrCont | ||
) |
Get atom info.
TcgToken | Input token info. |
HeaderLength | return the header length. |
DataLength | return the data length. |
ByteOrInt | return the atom Type. |
SignOrCont | return the sign or count info. |
return | the action result. |
Definition at line 1101 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextBOOLEAN | ( | TCG_PARSE_STRUCT * | ParseStruct, |
BOOLEAN * | Value | ||
) |
Get next specify value.
ParseStruct | Input parse structure. |
Value | Return value. |
return | the action result. |
Definition at line 1403 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextByteSequence | ( | TCG_PARSE_STRUCT * | ParseStruct, |
const VOID ** | Data, | ||
UINT32 * | Length | ||
) |
Get next byte sequence.
ParseStruct | Input parse structure. |
Data | return the data. |
Length | return the length. |
return | the action result. |
Definition at line 1474 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextCall | ( | TCG_PARSE_STRUCT * | ParseStruct | ) |
Get next call.
ParseStruct | Input parse structure. |
return | the action result. |
Definition at line 1599 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextEndList | ( | TCG_PARSE_STRUCT * | ParseStruct | ) |
Get next end list.
ParseStruct | Input parse structure. |
return | the action result. |
Definition at line 1548 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextEndName | ( | TCG_PARSE_STRUCT * | ParseStruct | ) |
Get next end name.
ParseStruct | Input parse structure. |
return | the action result. |
Definition at line 1582 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextEndOfData | ( | TCG_PARSE_STRUCT * | ParseStruct | ) |
Get next end data.
ParseStruct | Input parse structure. |
return | the action result. |
Definition at line 1616 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextEndOfSession | ( | TCG_PARSE_STRUCT * | ParseStruct | ) |
Get next end of session.
ParseStruct | Input parse structure. |
return | the action result. |
Definition at line 1633 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextEndTransaction | ( | TCG_PARSE_STRUCT * | ParseStruct | ) |
Get next end transaction.
ParseStruct | Input parse structure. |
return | the action result. |
Definition at line 1667 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextStartList | ( | TCG_PARSE_STRUCT * | ParseStruct | ) |
Get next start list.
ParseStruct | Input parse structure. |
return | the action result. |
Definition at line 1531 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextStartName | ( | TCG_PARSE_STRUCT * | ParseStruct | ) |
Get next start name.
ParseStruct | Input parse structure. |
return | the action result. |
Definition at line 1565 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextStartTransaction | ( | TCG_PARSE_STRUCT * | ParseStruct | ) |
Get next start transaction.
ParseStruct | Input parse structure. |
return | the action result. |
Definition at line 1650 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextTcgUid | ( | TCG_PARSE_STRUCT * | ParseStruct, |
TCG_UID * | Uid | ||
) |
Get next tcg uid info.
ParseStruct | Input parse structure. |
Uid | Get the uid info. |
return | the action result. |
Definition at line 1436 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextToken | ( | TCG_PARSE_STRUCT * | ParseStruct, |
TCG_TOKEN * | TcgToken | ||
) |
Get next token info.
ParseStruct | Input parse structure info. |
TcgToken | return the tcg token info. |
return | the action result. |
Definition at line 933 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextTokenType | ( | TCG_PARSE_STRUCT * | ParseStruct, |
TCG_TOKEN_TYPE | Type | ||
) |
Get next token Type.
ParseStruct | Input parse structure. |
Type | Input the type need to check. |
return | the action result. |
Definition at line 1505 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextUINT16 | ( | TCG_PARSE_STRUCT * | ParseStruct, |
UINT16 * | Value | ||
) |
Get next specify value.
ParseStruct | Input parse structure. |
Value | Return value. |
return | the action result. |
Definition at line 1314 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextUINT32 | ( | TCG_PARSE_STRUCT * | ParseStruct, |
UINT32 * | Value | ||
) |
Get next specify value.
ParseStruct | Input parse structure. |
Value | Return value. |
return | the action result. |
Definition at line 1347 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextUINT64 | ( | TCG_PARSE_STRUCT * | ParseStruct, |
UINT64 * | Value | ||
) |
Get next specify value.
ParseStruct | Input parse structure. |
Value | Return value. |
return | the action result. |
Definition at line 1380 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetNextUINT8 | ( | TCG_PARSE_STRUCT * | ParseStruct, |
UINT8 * | Value | ||
) |
Get next specify value.
ParseStruct | Input parse structure. |
Value | Return value. |
return | the action result. |
Definition at line 1281 of file TcgStorageCore.c.
UINT8 *EFIAPI TcgGetTokenByteSequence | ( | const TCG_TOKEN * | TcgToken, |
UINT32 * | Length | ||
) |
Get token byte sequence.
TcgToken | Input token info. |
Length | Input the length info. |
Return | the value data. |
Definition at line 1243 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgGetTokenUINT64 | ( | const TCG_TOKEN * | TcgToken, |
UINT64 * | Value | ||
) |
Get token specified value.
TcgToken | Input token info. |
Value | return the value. |
return | the action result. |
Definition at line 1180 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgInitTcgCreateStruct | ( | TCG_CREATE_STRUCT * | CreateStruct, |
VOID * | Buffer, | ||
UINT32 | BufferSize | ||
) |
Required to be called before calling any other Tcg functions with the TCG_CREATE_STRUCT. Initializes the packet variables to NULL. Additionally, the buffer will be memset.
[in/out] | CreateStruct Structure to initialize | |
[in] | Buffer | Buffer allocated by client of library. It will contain the Tcg encoded packet. This cannot be null. |
[in] | BufferSize | Size of buffer provided. It cannot be 0. |
Return | the action result. |
Definition at line 28 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgInitTcgParseStruct | ( | TCG_PARSE_STRUCT * | ParseStruct, |
const VOID * | Buffer, | ||
UINT32 | BufferSize | ||
) |
Initial the tcg parse structure.
ParseStruct | Input parse structure. |
Buffer | Input buffer data. |
BufferSize | Input buffer size. |
return | the action result. |
Definition at line 864 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgStartComPacket | ( | TCG_CREATE_STRUCT * | CreateStruct, |
UINT16 | ComId, | ||
UINT16 | ComIdExtension | ||
) |
Encodes the ComPacket header to the data structure.
[in/out] | CreateStruct Structure to initialize | |
[in] | ComId | ComID of the Tcg ComPacket. |
[in] | ComIdExtension | ComID Extension of the Tcg ComPacket. |
Definition at line 63 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgStartPacket | ( | TCG_CREATE_STRUCT * | CreateStruct, |
UINT32 | Tsn, | ||
UINT32 | Hsn, | ||
UINT32 | SeqNumber, | ||
UINT16 | AckType, | ||
UINT32 | Ack | ||
) |
Starts a new ComPacket in the Data structure.
[in/out] | CreateStruct Structure used to add Tcg Packet | |
[in] | Tsn | Packet Tper session number |
[in] | Hsn | Packet Host session number |
[in] | SeqNumber | Packet Sequence Number |
[in] | AckType | Packet Acknowledge Type |
[in] | Ack | Packet Acknowledge |
Definition at line 112 of file TcgStorageCore.c.
TCG_RESULT EFIAPI TcgStartSubPacket | ( | TCG_CREATE_STRUCT * | CreateStruct, |
UINT16 | Kind | ||
) |
Starts a new SubPacket in the Data structure.
[in/out] | CreateStruct Structure used to start Tcg SubPacket | |
[in] | Kind | SubPacket kind |
Definition at line 170 of file TcgStorageCore.c.