summaryrefslogtreecommitdiffstats
path: root/DynamicTablesPkg/Include
diff options
context:
space:
mode:
authorPierre Gondois <pierre.gondois@arm.com>2020-08-06 08:04:50 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-08-13 18:00:06 +0000
commitbade7f423b234fbe67af8a87e23cd2cacb93d6dc (patch)
tree8e8ee70229fd1eda82431a74fa074d0a640cc896 /DynamicTablesPkg/Include
parentf2bd39fb606f0c3e5a8f7998fa215ba4d6e25687 (diff)
downloadedk2-bade7f423b234fbe67af8a87e23cd2cacb93d6dc.tar.gz
edk2-bade7f423b234fbe67af8a87e23cd2cacb93d6dc.tar.bz2
edk2-bade7f423b234fbe67af8a87e23cd2cacb93d6dc.zip
DynamicTablesPkg: SSDT Serial Port Fixup library
According to Arm Server Base Boot Requirements, Platform Design Document version 1.2 revision D, September 2, 2019, section '4.2.1.8 SPCR'; The SPCR console device must be included in the DSDT. Additionally, it is often desirable to describe the serial ports available on a platform so that they are available for use by a rich OS. To facilitate the description of serial ports on a platform a common SSDT Serial Port Fixup library is introduced. It provides interfaces to build a SSDT serial port definition block table based on the serial port information. The SSDT Serial Port Fixup library is used by the SPCR, DBG2 and SSDT Serial Port generator to describe the serial port information in a definition block. +------------+ +------------+ +------------+ | SPCR Gen | | DBG2 Gen | | SERIAL Gen | +------------+ +------------+ +------------+ +----------------------------------+ | SSDT Serial Port Fixup library | +----------------------------------+ The SSDT Serial Port Fixup library: - Parses the SSDT Serial Port template using the AmlLib library to generate an AML tree. - Updates the _UID, _HID and _CID values. - Fixes up the Serial port base address, length and the interrupt number in the _CRS descriptor. - Fixes up the serial-port name. - Serialises the AML Tree to a buffer containing the definition block data. The definition block data is then installed by the corresponding table generator. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
Diffstat (limited to 'DynamicTablesPkg/Include')
-rw-r--r--DynamicTablesPkg/Include/AcpiTableGenerator.h7
-rw-r--r--DynamicTablesPkg/Include/ArmNameSpaceObjects.h9
-rw-r--r--DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h68
3 files changed, 81 insertions, 3 deletions
diff --git a/DynamicTablesPkg/Include/AcpiTableGenerator.h b/DynamicTablesPkg/Include/AcpiTableGenerator.h
index b55feb4e75..ef5018c312 100644
--- a/DynamicTablesPkg/Include/AcpiTableGenerator.h
+++ b/DynamicTablesPkg/Include/AcpiTableGenerator.h
@@ -1,6 +1,6 @@
/** @file
- Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+ Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -55,6 +55,10 @@ The Dynamic Tables Framework implements the following ACPI table generators:
the Configuration Manager and builds the PPTT table.
- SRAT : The SRAT generator collates the system resource affinity information
from the Configuration Manager and builds the SRAT table.
+ - SSDT Serial-Port:
+ The SSDT Serial generator collates the Serial port information
+ from the Configuration Manager and patches the SSDT Serial Port
+ template to build the SSDT Serial port table.
*/
/** The ACPI_TABLE_GENERATOR_ID type describes ACPI table generator ID.
@@ -78,6 +82,7 @@ typedef enum StdAcpiTableId {
EStdAcpiTableIdIort, ///< IORT Generator
EStdAcpiTableIdPptt, ///< PPTT Generator
EStdAcpiTableIdSrat, ///< SRAT Generator
+ EStdAcpiTableIdSsdtSerialPort, ///< SSDT Serial-Port Generator
EStdAcpiTableIdMax
} ESTD_ACPI_TABLE_ID;
diff --git a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
index 57a282d5cb..b2534a6505 100644
--- a/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
+++ b/DynamicTablesPkg/Include/ArmNameSpaceObjects.h
@@ -1,6 +1,6 @@
/** @file
- Copyright (c) 2017 - 2020, ARM Limited. All rights reserved.
+ Copyright (c) 2017 - 2020, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -56,6 +56,7 @@ typedef enum ArmObjectID {
EArmObjDeviceHandleAcpi, ///< 32 - Device Handle Acpi
EArmObjDeviceHandlePci, ///< 33 - Device Handle Pci
EArmObjGenericInitiatorAffinityInfo, ///< 34 - Generic Initiator Affinity
+ EArmObjSerialPortInfo, ///< 35 - Generic Serial Port Info
EArmObjMax
} EARM_OBJECT_ID;
@@ -270,7 +271,8 @@ typedef struct CmArmGicItsInfo {
Serial Port information for the Platform.
ID: EArmObjSerialConsolePortInfo or
- EArmObjSerialDebugPortInfo
+ EArmObjSerialDebugPortInfo or
+ EArmObjSerialPortInfo
*/
typedef struct CmArmSerialPortInfo {
/// The physical base address for the serial port
@@ -287,6 +289,9 @@ typedef struct CmArmSerialPortInfo {
/// Serial Port subtype
UINT16 PortSubtype;
+
+ /// The Base address length
+ UINT64 BaseAddressLength;
} CM_ARM_SERIAL_PORT_INFO;
/** A structure that describes the
diff --git a/DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h b/DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h
new file mode 100644
index 0000000000..4605f3f34b
--- /dev/null
+++ b/DynamicTablesPkg/Include/Library/SsdtSerialPortFixupLib.h
@@ -0,0 +1,68 @@
+/** @file
+ Ssdt Serial Port Fixup Library
+
+ Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef SSDT_SERIAL_PORT_LIB_H_
+#define SSDT_SERIAL_PORT_LIB_H_
+
+/** Build a SSDT table describing the input serial port.
+
+ The table created by this function must be freed by FreeSsdtSerialTable.
+
+ @param [in] AcpiTableInfo Pointer to the ACPI table information.
+ @param [in] SerialPortInfo Serial port to describe in the SSDT table.
+ @param [in] Name The Name to give to the Device.
+ Must be a NULL-terminated ASL NameString
+ e.g.: "DEV0", "DV15.DEV0", etc.
+ @param [in] Uid UID for the Serial Port.
+ @param [out] Table If success, pointer to the created SSDT table.
+
+ @retval EFI_SUCCESS Table generated successfully.
+ @retval EFI_INVALID_PARAMETER A parameter is invalid.
+ @retval EFI_NOT_FOUND Could not find information.
+ @retval EFI_OUT_OF_RESOURCES Could not allocate memory.
+**/
+EFI_STATUS
+EFIAPI
+BuildSsdtSerialPortTable (
+ IN CONST CM_STD_OBJ_ACPI_TABLE_INFO * AcpiTableInfo,
+ IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfo,
+ IN CONST CHAR8 * Name,
+ IN CONST UINT64 Uid,
+ OUT EFI_ACPI_DESCRIPTION_HEADER ** Table
+ );
+
+/** Free an SSDT table previously created by
+ the BuildSsdtSerialTable function.
+
+ @param [in] Table Pointer to a SSDT table allocated by
+ the BuildSsdtSerialTable function.
+
+ @retval EFI_SUCCESS Success.
+**/
+EFI_STATUS
+EFIAPI
+FreeSsdtSerialPortTable (
+ IN EFI_ACPI_DESCRIPTION_HEADER * Table
+ );
+
+/** Validate the Serial Port Information.
+
+ @param [in] SerialPortInfoTable Table of CM_ARM_SERIAL_PORT_INFO.
+ @param [in] SerialPortCount Count of SerialPort in the table.
+
+ @retval EFI_SUCCESS Success.
+ @retval EFI_INVALID_PARAMETER Invalid parameter.
+**/
+EFI_STATUS
+EFIAPI
+ValidateSerialPortInfo (
+ IN CONST CM_ARM_SERIAL_PORT_INFO * SerialPortInfoTable,
+ IN UINT32 SerialPortCount
+ );
+
+#endif // SSDT_SERIAL_PORT_LIB_H_