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

Go to the source code of this file.

Data Structures

struct  DBG2_DEBUG_DEVICE_INFORMATION
 
struct  DBG2_TABLE
 

Macros

#define DBG2_NUM_DEBUG_PORTS   1
 
#define DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS   1
 
#define INDEX_DBG_PORT0   0
 
#define NAME_STR_DBG_PORT0   "COM0"
 
#define NAMESPACE_STR_DBG_PORT0   "\\_SB_.COM0"
 
#define UID_DBG_PORT0   0
 
#define DBG2_NAMESPACESTRING_FIELD_SIZE   sizeof (NAMESPACE_STR_DBG_PORT0)
 
#define PL011_UART_LENGTH   0x1000
 
#define DBG2_DEBUG_PORT_DDI( SubType, UartBase, UartAddrLen, UartNameStr)
 
#define DBG2_GENERATOR_REVISION   CREATE_REVISION (1, 0)
 

Functions

 GET_OBJECT_LIST (EObjNameSpaceArchCommon, EArchCommonObjSerialDebugPortInfo, CM_ARCH_COMMON_SERIAL_PORT_INFO)
 
STATIC EFI_STATUS SetupDebugUart (IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *CONST SerialPortInfo)
 
STATIC EFI_STATUS EFIAPI FreeDbg2TableEx (IN CONST ACPI_TABLE_GENERATOR *CONST This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN OUT EFI_ACPI_DESCRIPTION_HEADER ***CONST Table, IN CONST UINTN TableCount)
 
STATIC EFI_STATUS EFIAPI BuildDbg2TableEx (IN CONST ACPI_TABLE_GENERATOR *This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, OUT EFI_ACPI_DESCRIPTION_HEADER ***Table, OUT UINTN *CONST TableCount)
 
EFI_STATUS EFIAPI AcpiDbg2LibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI AcpiDbg2LibDestructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

STATIC DBG2_TABLE AcpiDbg2
 
STATIC CONST ACPI_TABLE_GENERATOR Dbg2Generator
 

Detailed Description

DBG2 Table Generator

Copyright (c) 2017 - 2022, Arm Limited. All rights reserved.

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

Reference(s):
  • Microsoft Debug Port Table 2 (DBG2) Specification - December 10, 2015.

Definition in file Dbg2Generator.c.

Macro Definition Documentation

◆ DBG2_DEBUG_PORT_DDI

#define DBG2_DEBUG_PORT_DDI (   SubType,
  UartBase,
  UartAddrLen,
  UartNameStr 
)

A helper macro used for initializing the debug port device information structure.

Parameters
[in]SubTypeThe DBG Port SubType.
[in]UartBaseThe UART port base address.
[in]UartAddrLenThe UART port address range length.
[in]UartNameStrThe UART port name string.

Definition at line 111 of file Dbg2Generator.c.

◆ DBG2_GENERATOR_REVISION

#define DBG2_GENERATOR_REVISION   CREATE_REVISION (1, 0)

This macro defines the DBG2 Table Generator revision.

Definition at line 519 of file Dbg2Generator.c.

◆ DBG2_NAMESPACESTRING_FIELD_SIZE

#define DBG2_NAMESPACESTRING_FIELD_SIZE   sizeof (NAMESPACE_STR_DBG_PORT0)

The length of the namespace string.

Definition at line 69 of file Dbg2Generator.c.

◆ DBG2_NUM_DEBUG_PORTS

#define DBG2_NUM_DEBUG_PORTS   1

ARM standard DBG2 Table Generator

Constructs the DBG2 table for corresponding DBG2 peripheral.

Requirements: The following Configuration Manager Object(s) are required by this Generator:

  • EArchCommonObjSerialDebugPortInfo The number of debug ports represented by the Table.

Definition at line 44 of file Dbg2Generator.c.

◆ DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS

#define DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS   1

The number of Generic Address Registers presented in the debug device information.

Definition at line 49 of file Dbg2Generator.c.

◆ INDEX_DBG_PORT0

#define INDEX_DBG_PORT0   0

The index for the debug port 0 in the Debug port information list.

Definition at line 53 of file Dbg2Generator.c.

◆ NAME_STR_DBG_PORT0

#define NAME_STR_DBG_PORT0   "COM0"

A string representing the name of the debug port 0.

Definition at line 57 of file Dbg2Generator.c.

◆ NAMESPACE_STR_DBG_PORT0

#define NAMESPACE_STR_DBG_PORT0   "\\_SB_.COM0"

A string representing the full path name of the debug port 0.

Definition at line 61 of file Dbg2Generator.c.

◆ PL011_UART_LENGTH

#define PL011_UART_LENGTH   0x1000

The PL011 UART address range length.

Definition at line 73 of file Dbg2Generator.c.

◆ UID_DBG_PORT0

#define UID_DBG_PORT0   0

An UID representing the debug port 0.

Definition at line 65 of file Dbg2Generator.c.

Function Documentation

◆ AcpiDbg2LibConstructor()

EFI_STATUS EFIAPI AcpiDbg2LibConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Register the Generator with the ACPI Table Factory.

Parameters
[in]ImageHandleThe handle to the image.
[in]SystemTablePointer to the System Table.
Return values
EFI_SUCCESSThe Generator is registered.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_ALREADY_STARTEDThe Generator for the Table ID is already registered.

Definition at line 562 of file Dbg2Generator.c.

◆ AcpiDbg2LibDestructor()

EFI_STATUS EFIAPI AcpiDbg2LibDestructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Deregister the Generator from the ACPI Table Factory.

Parameters
[in]ImageHandleThe handle to the image.
[in]SystemTablePointer to the System Table.
Return values
EFI_SUCCESSThe Generator is deregistered.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDThe Generator is not registered.

Definition at line 586 of file Dbg2Generator.c.

◆ BuildDbg2TableEx()

STATIC EFI_STATUS EFIAPI BuildDbg2TableEx ( IN CONST ACPI_TABLE_GENERATOR This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST  AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST  CfgMgrProtocol,
OUT EFI_ACPI_DESCRIPTION_HEADER ***  Table,
OUT UINTN *CONST  TableCount 
)

Construct the DBG2 ACPI table and its associated SSDT table.

This function invokes the Configuration Manager protocol interface to get the required hardware information for generating the ACPI table.

If this function allocates any resources then they must be freed in the FreeXXXXTableResourcesEx function.

Parameters
[in]ThisPointer to the ACPI table generator.
[in]AcpiTableInfoPointer to the ACPI table information.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol interface.
[out]TablePointer to a list of generated ACPI table(s).
[out]TableCountNumber of generated ACPI table(s).
Return values
EFI_SUCCESSTable generated successfully.
EFI_BAD_BUFFER_SIZEThe size returned by the Configuration Manager is less than the Object size for the requested object.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDCould not find information.
EFI_OUT_OF_RESOURCESCould not allocate memory.
EFI_UNSUPPORTEDUnsupported configuration.

Definition at line 324 of file Dbg2Generator.c.

◆ FreeDbg2TableEx()

STATIC EFI_STATUS EFIAPI FreeDbg2TableEx ( IN CONST ACPI_TABLE_GENERATOR *CONST  This,
IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST  AcpiTableInfo,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST  CfgMgrProtocol,
IN OUT EFI_ACPI_DESCRIPTION_HEADER ***CONST  Table,
IN CONST UINTN  TableCount 
)

Free any resources allocated for constructing the tables.

Parameters
[in]ThisPointer to the ACPI table generator.
[in]AcpiTableInfoPointer to the ACPI Table Info.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in,out]TablePointer to an array of pointers to ACPI Table(s).
[in]TableCountNumber of ACPI table(s).
Return values
EFI_SUCCESSThe resources were freed successfully.
EFI_INVALID_PARAMETERThe table pointer is NULL or invalid.

Definition at line 251 of file Dbg2Generator.c.

◆ GET_OBJECT_LIST()

This macro expands to a function that retrieves the Serial debug port information from the Configuration Manager

◆ SetupDebugUart()

STATIC EFI_STATUS SetupDebugUart ( IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *CONST  SerialPortInfo)

Initialize the DBG2 UART with the parameters obtained from the Configuration Manager.

Parameters
[in]SerialPortInfoPointer to the Serial Port Information.
Return values
EFI_SUCCESSSuccess.
EFI_INVALID_PARAMETERThe parameters for serial port initialization are invalid.

Definition at line 201 of file Dbg2Generator.c.

Variable Documentation

◆ AcpiDbg2

STATIC DBG2_TABLE AcpiDbg2
Initial value:
= {
{
EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION
),
OFFSET_OF (DBG2_TABLE, Dbg2DeviceInfo),
},
{
0,
0,
0,
)
}
}
#define EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE
Definition: Acpi62.h:2851
#define ACPI_HEADER(Signature, Type, Revision)
#define NAMESPACE_STR_DBG_PORT0
Definition: Dbg2Generator.c:61
#define DBG2_DEBUG_PORT_DDI( SubType, UartBase, UartAddrLen, UartNameStr)
#define DBG2_NUM_DEBUG_PORTS
Definition: Dbg2Generator.c:44
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758

The DBG2 Table template definition.

Note: fields marked with "{Template}" will be set dynamically

Definition at line 156 of file Dbg2Generator.c.

◆ Dbg2Generator

Initial value:
= {
L"ACPI.STD.DBG2.GENERATOR",
EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
}
#define EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE
Definition: Acpi63.h:2851
#define CREATE_STD_ACPI_TABLE_GEN_ID(TableId)
#define TABLE_GENERATOR_CREATOR_ID
@ EStdAcpiTableIdDbg2
DBG2 Generator.
STATIC EFI_STATUS EFIAPI BuildDbg2TableEx(IN CONST ACPI_TABLE_GENERATOR *This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, OUT EFI_ACPI_DESCRIPTION_HEADER ***Table, OUT UINTN *CONST TableCount)
#define DBG2_GENERATOR_REVISION
STATIC EFI_STATUS EFIAPI FreeDbg2TableEx(IN CONST ACPI_TABLE_GENERATOR *CONST This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN OUT EFI_ACPI_DESCRIPTION_HEADER ***CONST Table, IN CONST UINTN TableCount)
#define NULL
Definition: Base.h:319

The interface for the DBG2 Table Generator.

Definition at line 525 of file Dbg2Generator.c.