TianoCore EDK2 master
Loading...
Searching...
No Matches
IoLibInternalTdx.c File Reference

Go to the source code of this file.

Macros

#define TDVMCALL_ACCESS_SIZE_1   1
 
#define TDVMCALL_ACCESS_SIZE_2   2
 
#define TDVMCALL_ACCESS_SIZE_4   4
 
#define TDVMCALL_ACCESS_SIZE_8   8
 
#define TDVMCALL_ACCESS_READ   0
 
#define TDVMCALL_ACCESS_WRITE   1
 

Functions

BOOLEAN EFIAPI IsTdxGuest (VOID)
 
UINT8 EFIAPI TdIoRead8 (IN UINTN Port)
 
UINT16 EFIAPI TdIoRead16 (IN UINTN Port)
 
UINT32 EFIAPI TdIoRead32 (IN UINTN Port)
 
UINT8 EFIAPI TdIoWrite8 (IN UINTN Port, IN UINT8 Value)
 
UINT16 EFIAPI TdIoWrite16 (IN UINTN Port, IN UINT16 Value)
 
UINT32 EFIAPI TdIoWrite32 (IN UINTN Port, IN UINT32 Value)
 
UINT8 EFIAPI TdMmioRead8 (IN UINTN Address)
 
UINT8 EFIAPI TdMmioWrite8 (IN UINTN Address, IN UINT8 Value)
 
UINT16 EFIAPI TdMmioRead16 (IN UINTN Address)
 
UINT16 EFIAPI TdMmioWrite16 (IN UINTN Address, IN UINT16 Value)
 
UINT32 EFIAPI TdMmioRead32 (IN UINTN Address)
 
UINT32 EFIAPI TdMmioWrite32 (IN UINTN Address, IN UINT32 Value)
 
UINT64 EFIAPI TdMmioRead64 (IN UINTN Address)
 
UINT64 EFIAPI TdMmioWrite64 (IN UINTN Address, IN UINT64 Value)
 
VOID EFIAPI TdIoReadFifo8 (IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
 
VOID EFIAPI TdIoWriteFifo8 (IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
 
VOID EFIAPI TdIoReadFifo16 (IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
 
VOID EFIAPI TdIoWriteFifo16 (IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
 
VOID EFIAPI TdIoReadFifo32 (IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
 
VOID EFIAPI TdIoWriteFifo32 (IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
 

Detailed Description

TDX I/O Library routines.

Copyright (c) 2020-2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file IoLibInternalTdx.c.

Macro Definition Documentation

◆ TDVMCALL_ACCESS_READ

#define TDVMCALL_ACCESS_READ   0

Definition at line 23 of file IoLibInternalTdx.c.

◆ TDVMCALL_ACCESS_SIZE_1

#define TDVMCALL_ACCESS_SIZE_1   1

Definition at line 17 of file IoLibInternalTdx.c.

◆ TDVMCALL_ACCESS_SIZE_2

#define TDVMCALL_ACCESS_SIZE_2   2

Definition at line 18 of file IoLibInternalTdx.c.

◆ TDVMCALL_ACCESS_SIZE_4

#define TDVMCALL_ACCESS_SIZE_4   4

Definition at line 19 of file IoLibInternalTdx.c.

◆ TDVMCALL_ACCESS_SIZE_8

#define TDVMCALL_ACCESS_SIZE_8   8

Definition at line 20 of file IoLibInternalTdx.c.

◆ TDVMCALL_ACCESS_WRITE

#define TDVMCALL_ACCESS_WRITE   1

Definition at line 24 of file IoLibInternalTdx.c.

Function Documentation

◆ IsTdxGuest()

BOOLEAN EFIAPI IsTdxGuest ( VOID  )

Check if it is Tdx guest.

Returns
TRUE It is Tdx guest
FALSE It is not Tdx guest

Definition at line 35 of file IoLibInternalTdx.c.

◆ TdIoRead16()

UINT16 EFIAPI TdIoRead16 ( IN UINTN  Port)

Reads a 16-bit I/O port.

TDVMCALL_IO is invoked to write I/O port.

Parameters
PortThe I/O port to read.
Returns
The value read.

Definition at line 81 of file IoLibInternalTdx.c.

◆ TdIoRead32()

UINT32 EFIAPI TdIoRead32 ( IN UINTN  Port)

Reads a 32-bit I/O port.

TDVMCALL_IO is invoked to read I/O port.

Parameters
PortThe I/O port to read.
Returns
The value read.

Definition at line 110 of file IoLibInternalTdx.c.

◆ TdIoRead8()

UINT8 EFIAPI TdIoRead8 ( IN UINTN  Port)

Reads an 8-bit I/O port.

TDVMCALL_IO is invoked to read I/O port.

Parameters
PortThe I/O port to read.
Returns
The value read.

Definition at line 54 of file IoLibInternalTdx.c.

◆ TdIoReadFifo16()

VOID EFIAPI TdIoReadFifo16 ( IN UINTN  Port,
IN UINTN  Count,
OUT VOID *  Buffer 
)

Reads a 16-bit I/O port fifo into a block of memory.

Reads the 16-bit I/O fifo port specified by Port. The port is read Count times, and the read data is stored in the provided Buffer.

This function must guarantee that all I/O read and write operations are serialized.

If 16-bit I/O port operations are not supported, then ASSERT().

In TDX a serial of TdIoRead16 is invoked to read data from the I/O port.

Parameters
PortThe I/O port to read.
CountThe number of times to read I/O port.
BufferThe buffer to store the read data into.

Definition at line 544 of file IoLibInternalTdx.c.

◆ TdIoReadFifo32()

VOID EFIAPI TdIoReadFifo32 ( IN UINTN  Port,
IN UINTN  Count,
OUT VOID *  Buffer 
)

Reads a 32-bit I/O port fifo into a block of memory.

Reads the 32-bit I/O fifo port specified by Port. The port is read Count times, and the read data is stored in the provided Buffer.

This function must guarantee that all I/O read and write operations are serialized.

If 32-bit I/O port operations are not supported, then ASSERT().

In TDX a serial of TdIoRead32 is invoked to read data from the I/O port.

Parameters
PortThe I/O port to read.
CountThe number of times to read I/O port.
BufferThe buffer to store the read data into.

Definition at line 616 of file IoLibInternalTdx.c.

◆ TdIoReadFifo8()

VOID EFIAPI TdIoReadFifo8 ( IN UINTN  Port,
IN UINTN  Count,
OUT VOID *  Buffer 
)

Reads an 8-bit I/O port fifo into a block of memory.

Reads the 8-bit I/O fifo port specified by Port. The port is read Count times, and the read data is stored in the provided Buffer.

This function must guarantee that all I/O read and write operations are serialized.

If 8-bit I/O port operations are not supported, then ASSERT().

In TDX a serial of TdIoRead8 is invoked to read the I/O port fifo.

Parameters
PortThe I/O port to read.
CountThe number of times to read I/O port.
BufferThe buffer to store the read data into.

Definition at line 472 of file IoLibInternalTdx.c.

◆ TdIoWrite16()

UINT16 EFIAPI TdIoWrite16 ( IN UINTN  Port,
IN UINT16  Value 
)

Writes a 16-bit I/O port.

TDVMCALL_IO is invoked to write I/O port.

Parameters
PortThe I/O port to write.
ValueThe value to write to the I/O port.
Returns
The value written the I/O port.

Definition at line 170 of file IoLibInternalTdx.c.

◆ TdIoWrite32()

UINT32 EFIAPI TdIoWrite32 ( IN UINTN  Port,
IN UINT32  Value 
)

Writes a 32-bit I/O port.

TDVMCALL_IO is invoked to write I/O port.

Parameters
PortThe I/O port to write.
ValueThe value to write to the I/O port.
Returns
The value written the I/O port.

Definition at line 201 of file IoLibInternalTdx.c.

◆ TdIoWrite8()

UINT8 EFIAPI TdIoWrite8 ( IN UINTN  Port,
IN UINT8  Value 
)

Writes an 8-bit I/O port.

TDVMCALL_IO is invoked to write I/O port.

Parameters
PortThe I/O port to write.
ValueThe value to write to the I/O port.
Returns
The value written the I/O port.

Definition at line 140 of file IoLibInternalTdx.c.

◆ TdIoWriteFifo16()

VOID EFIAPI TdIoWriteFifo16 ( IN UINTN  Port,
IN UINTN  Count,
IN VOID *  Buffer 
)

Writes a block of memory into a 16-bit I/O port fifo.

Writes the 16-bit I/O fifo port specified by Port. The port is written Count times, and the write data is retrieved from the provided Buffer.

This function must guarantee that all I/O write and write operations are serialized.

If 16-bit I/O port operations are not supported, then ASSERT().

In TDX a serial of TdIoWrite16 is invoked to write data to the I/O port.

Parameters
PortThe I/O port to write.
CountThe number of times to write I/O port.
BufferThe buffer to retrieve the write data from.

Definition at line 580 of file IoLibInternalTdx.c.

◆ TdIoWriteFifo32()

VOID EFIAPI TdIoWriteFifo32 ( IN UINTN  Port,
IN UINTN  Count,
IN VOID *  Buffer 
)

Writes a block of memory into a 32-bit I/O port fifo.

Writes the 32-bit I/O fifo port specified by Port. The port is written Count times, and the write data is retrieved from the provided Buffer.

This function must guarantee that all I/O write and write operations are serialized.

If 32-bit I/O port operations are not supported, then ASSERT().

In TDX a serial of TdIoWrite32 is invoked to write data to the I/O port.

Parameters
PortThe I/O port to write.
CountThe number of times to write I/O port.
BufferThe buffer to retrieve the write data from.

Definition at line 652 of file IoLibInternalTdx.c.

◆ TdIoWriteFifo8()

VOID EFIAPI TdIoWriteFifo8 ( IN UINTN  Port,
IN UINTN  Count,
IN VOID *  Buffer 
)

Writes a block of memory into an 8-bit I/O port fifo.

Writes the 8-bit I/O fifo port specified by Port. The port is written Count times, and the write data is retrieved from the provided Buffer.

This function must guarantee that all I/O write and write operations are serialized.

If 8-bit I/O port operations are not supported, then ASSERT().

In TDX a serial of TdIoWrite8 is invoked to write data to the I/O port.

Parameters
PortThe I/O port to write.
CountThe number of times to write I/O port.
BufferThe buffer to retrieve the write data from.

Definition at line 508 of file IoLibInternalTdx.c.

◆ TdMmioRead16()

UINT16 EFIAPI TdMmioRead16 ( IN UINTN  Address)

Reads a 16-bit MMIO register.

TDVMCALL_MMIO is invoked to read MMIO registers.

Parameters
AddressThe MMIO register to read.
Returns
The value read.

Definition at line 288 of file IoLibInternalTdx.c.

◆ TdMmioRead32()

UINT32 EFIAPI TdMmioRead32 ( IN UINTN  Address)

Reads a 32-bit MMIO register.

TDVMCALL_MMIO is invoked to read MMIO registers.

Parameters
AddressThe MMIO register to read.
Returns
The value read.

Definition at line 347 of file IoLibInternalTdx.c.

◆ TdMmioRead64()

UINT64 EFIAPI TdMmioRead64 ( IN UINTN  Address)

Reads a 64-bit MMIO register.

TDVMCALL_MMIO is invoked to read MMIO registers.

Parameters
AddressThe MMIO register to read.
Returns
The value read.

Definition at line 406 of file IoLibInternalTdx.c.

◆ TdMmioRead8()

UINT8 EFIAPI TdMmioRead8 ( IN UINTN  Address)

Reads an 8-bit MMIO register.

TDVMCALL_MMIO is invoked to read MMIO registers.

Parameters
AddressThe MMIO register to read.
Returns
The value read.

Definition at line 231 of file IoLibInternalTdx.c.

◆ TdMmioWrite16()

UINT16 EFIAPI TdMmioWrite16 ( IN UINTN  Address,
IN UINT16  Value 
)

Writes a 16-bit MMIO register.

TDVMCALL_MMIO is invoked to write MMIO registers.

Parameters
AddressThe MMIO register to write.
ValueThe value to write to the MMIO register.
Returns
Value.

Definition at line 316 of file IoLibInternalTdx.c.

◆ TdMmioWrite32()

UINT32 EFIAPI TdMmioWrite32 ( IN UINTN  Address,
IN UINT32  Value 
)

Writes a 32-bit MMIO register.

TDVMCALL_MMIO is invoked to write MMIO registers.

Parameters
AddressThe MMIO register to write.
ValueThe value to write to the MMIO register.
Returns
Value.

Definition at line 375 of file IoLibInternalTdx.c.

◆ TdMmioWrite64()

UINT64 EFIAPI TdMmioWrite64 ( IN UINTN  Address,
IN UINT64  Value 
)

Writes a 64-bit MMIO register.

TDVMCALL_MMIO is invoked to write MMIO registers.

Parameters
AddressThe MMIO register to write.
ValueThe value to write to the MMIO register.

Definition at line 432 of file IoLibInternalTdx.c.

◆ TdMmioWrite8()

UINT8 EFIAPI TdMmioWrite8 ( IN UINTN  Address,
IN UINT8  Value 
)

Writes an 8-bit MMIO register.

TDVMCALL_MMIO is invoked to read write registers.

Parameters
AddressThe MMIO register to write.
ValueThe value to write to the MMIO register.
Returns
Value.

Definition at line 259 of file IoLibInternalTdx.c.