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

Go to the source code of this file.

Macros

#define MIN_UART_ADDRESS_LENGTH   0x1000U
 

Functions

EFI_STATUS EFIAPI ValidateSerialPortInfo (IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfoTable, IN UINT32 SerialPortCount)
 
STATIC EFI_STATUS EFIAPI FixupIds (IN AML_ROOT_NODE_HANDLE RootNodeHandle, IN CONST UINT64 Uid, IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo)
 
STATIC EFI_STATUS EFIAPI FixupCrs (IN AML_ROOT_NODE_HANDLE RootNodeHandle, IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo)
 
STATIC EFI_STATUS EFIAPI FixupName (IN AML_ROOT_NODE_HANDLE RootNodeHandle, IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo, IN CONST CHAR8 *Name)
 
STATIC EFI_STATUS EFIAPI FixupSerialPortInfo (IN AML_ROOT_NODE_HANDLE RootNodeHandle, IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo, IN CONST CHAR8 *Name, IN CONST UINT64 Uid, OUT EFI_ACPI_DESCRIPTION_HEADER **Table)
 
EFI_STATUS EFIAPI FreeSsdtSerialPortTable (IN EFI_ACPI_DESCRIPTION_HEADER *Table)
 
EFI_STATUS EFIAPI BuildSsdtSerialPortTable (IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *AcpiTableInfo, IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo, IN CONST CHAR8 *Name, IN CONST UINT64 Uid, OUT EFI_ACPI_DESCRIPTION_HEADER **Table)
 

Variables

CHAR8 ssdtserialporttemplate_aml_code []
 

Detailed Description

SSDT Serial Port Fixup Library.

Copyright (c) 2019 - 2024, Arm Limited. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Reference(s):
  • Arm Server Base Boot Requirements (SBBR), s4.2.1.8 "SPCR".
  • Microsoft Debug Port Table 2 (DBG2) Specification - December 10, 2015.
  • ACPI for Arm Components 1.0 - 2020
  • Arm Generic Interrupt Controller Architecture Specification, Issue H, January 2022. (https://developer.arm.com/documentation/ihi0069/)

Definition in file SsdtSerialPortFixupLib.c.

Macro Definition Documentation

◆ MIN_UART_ADDRESS_LENGTH

#define MIN_UART_ADDRESS_LENGTH   0x1000U

UART address range length.

Definition at line 45 of file SsdtSerialPortFixupLib.c.

Function Documentation

◆ BuildSsdtSerialPortTable()

EFI_STATUS EFIAPI BuildSsdtSerialPortTable ( IN CONST CM_STD_OBJ_ACPI_TABLE_INFO AcpiTableInfo,
IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO SerialPortInfo,
IN CONST CHAR8 *  Name,
IN CONST UINT64  Uid,
OUT EFI_ACPI_DESCRIPTION_HEADER **  Table 
)

Build a SSDT table describing the input serial port.

The table created by this function must be freed by FreeSsdtSerialTable.

Parameters
[in]AcpiTableInfoPointer to the ACPI table information.
[in]SerialPortInfoSerial port to describe in the SSDT table.
[in]NameThe Name to give to the Device. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc.
[in]UidUID for the Serial Port.
[out]TableIf success, pointer to the created SSDT table.
Return values
EFI_SUCCESSTable generated successfully.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDCould not find information.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 482 of file SsdtSerialPortFixupLib.c.

◆ FixupCrs()

STATIC EFI_STATUS EFIAPI FixupCrs ( IN AML_ROOT_NODE_HANDLE  RootNodeHandle,
IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO SerialPortInfo 
)

Fixup the Serial Port _CRS values (BaseAddress, ...).

Parameters
[in]RootNodeHandlePointer to the root of an AML tree.
[in]SerialPortInfoPointer to a Serial Port Information structure. Get the Serial Port Information from there.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_NOT_FOUNDCould not find information.
EFI_OUT_OF_RESOURCESOut of resources.

Definition at line 292 of file SsdtSerialPortFixupLib.c.

◆ FixupIds()

STATIC EFI_STATUS EFIAPI FixupIds ( IN AML_ROOT_NODE_HANDLE  RootNodeHandle,
IN CONST UINT64  Uid,
IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO SerialPortInfo 
)

Fixup the Serial Port Ids (_UID, _HID, _CID).

Parameters
[in]RootNodeHandlePointer to the root of an AML tree.
[in]UidUID for the Serial Port.
[in]SerialPortInfoPointer to a Serial Port Information structure. Get the Serial Port Information from there.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_NOT_FOUNDCould not find information.
EFI_OUT_OF_RESOURCESOut of resources.

Definition at line 165 of file SsdtSerialPortFixupLib.c.

◆ FixupName()

STATIC EFI_STATUS EFIAPI FixupName ( IN AML_ROOT_NODE_HANDLE  RootNodeHandle,
IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO SerialPortInfo,
IN CONST CHAR8 *  Name 
)

Fixup the Serial Port device name.

Parameters
[in]RootNodeHandlePointer to the root of an AML tree.
[in]SerialPortInfoPointer to a Serial Port Information structure. Get the Serial Port Information from there.
[in]NameThe Name to give to the Device. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_NOT_FOUNDCould not find information.
EFI_OUT_OF_RESOURCESOut of resources.

Definition at line 368 of file SsdtSerialPortFixupLib.c.

◆ FixupSerialPortInfo()

STATIC EFI_STATUS EFIAPI FixupSerialPortInfo ( IN AML_ROOT_NODE_HANDLE  RootNodeHandle,
IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO SerialPortInfo,
IN CONST CHAR8 *  Name,
IN CONST UINT64  Uid,
OUT EFI_ACPI_DESCRIPTION_HEADER **  Table 
)

Fixup the Serial Port Information in the AML tree.

For each template value:

  • find the node to update;
  • update the value.
Parameters
[in]RootNodeHandlePointer to the root of the AML tree.
[in]SerialPortInfoPointer to a Serial Port Information structure. Get the Serial Port Information from there.
[in]NameThe Name to give to the Device. Must be a NULL-terminated ASL NameString e.g.: "DEV0", "DV15.DEV0", etc.
[in]UidUID for the Serial Port.
[out]TableIf success, contains the serialized SSDT table.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_NOT_FOUNDCould not find information.
EFI_OUT_OF_RESOURCESOut of resources.

Definition at line 412 of file SsdtSerialPortFixupLib.c.

◆ FreeSsdtSerialPortTable()

EFI_STATUS EFIAPI FreeSsdtSerialPortTable ( IN EFI_ACPI_DESCRIPTION_HEADER Table)

Free an SSDT table previously created by the BuildSsdtSerialTable function.

Parameters
[in]TablePointer to a SSDT table allocated by the BuildSsdtSerialTable function.
Return values
EFI_SUCCESSSuccess.

Definition at line 454 of file SsdtSerialPortFixupLib.c.

◆ ValidateSerialPortInfo()

EFI_STATUS EFIAPI ValidateSerialPortInfo ( IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO SerialPortInfoTable,
IN UINT32  SerialPortCount 
)

Validate the Serial Port Information.

Parameters
[in]SerialPortInfoTableTable of CM_ARCH_COMMON_SERIAL_PORT_INFO.
[in]SerialPortCountCount of SerialPort in the table.
Return values
EFI_SUCCESSSuccess.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 57 of file SsdtSerialPortFixupLib.c.

Variable Documentation

◆ ssdtserialporttemplate_aml_code

CHAR8 ssdtserialporttemplate_aml_code[]
extern

C array containing the compiled AML template. This symbol is defined in the auto generated C file containing the AML bytecode array.