public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sami Mujawar" <sami.mujawar@arm.com>
To: <devel@edk2.groups.io>
Cc: Sami Mujawar <sami.mujawar@arm.com>, <ard.biesheuvel@arm.com>,
	<leif@nuviainc.com>, <Alexei.Fedorov@arm.com>,
	<Pierre.Gondois@arm.com>, <Matteo.Carlini@arm.com>,
	<Ben.Adderson@arm.com>, <thomas.abraham@arm.com>, <nd@arm.com>
Subject: [PATCH edk2-platforms v1 5/7] Platform/ARM: FVP: Enable SSDT Serial generation
Date: Thu, 13 Aug 2020 10:08:21 +0100	[thread overview]
Message-ID: <20200813090823.69908-6-sami.mujawar@arm.com> (raw)
In-Reply-To: <20200813090823.69908-1-sami.mujawar@arm.com>

The SSDT Serial Port Generator queries the
Configuration Manager for a list of serial
port devices. It uses the SerialPortFixupLib
to build SSDT AML tables describing the
serial ports.

The SerialPortFixupLib uses the AmlLib library
interfaces to load a Serial Port AML template
code and represents it as an AML tree. It then
traverses the AML tree to locate and fixup the
Base address and Interrupt information for the
serial port devices. The AML tree is then
serialized to a buffer representing the
definition block which is returned as an ACPI
SSDT table.

The SSDT Serial Port Generator returns a list
of SSDT AML tables representing the serial port
devices to the Table Manager for installing.

This patch enables dynamic SSDT Serial Port
generation for FVP platform and adds support
to the Configuration Manager to return the
CM_ARM_SERIAL_PORT_INFO objects that represents
the serial port devices on the platform.

Change-Id: Icdae65887a7a53ac555dca964f9e1d3e43085517
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl     | 25 ++------------
 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c | 36 ++++++++++++++++++++
 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h |  5 ++-
 3 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
index 9192a0070772209e5cec8d7d9a71ea7a9e10aa69..3475f976b59fc68384ed11f7de23f552efe441e9 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/AslTables/Dsdt.asl
@@ -1,8 +1,9 @@
 /** @file
   Differentiated System Description Table Fields (DSDT)
 
-  Copyright (c) 2014-2017, ARM Ltd. All rights reserved.<BR>
-    SPDX-License-Identifier: BSD-2-Clause-Patent
+  Copyright (c) 2014-2020, Arm Ltd. All rights reserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
@@ -43,25 +44,5 @@ DefinitionBlock("DsdtTable.aml", "DSDT", 1, "ARMLTD", "ARM-VEXP", 1) {
       Name(_HID, "ACPI0007")
       Name(_UID, 7)
     }
-
-    // UART PL011
-    Device(COM2) {
-      Name(_HID, "ARMH0011")
-      Name(_CID, "PL011")
-      Name(_UID, Zero)
-
-      Method(_STA) {
-        Return(0xF)
-      }
-
-      Method(_CRS, 0x0, NotSerialized) {
-        Name(RBUF, ResourceTemplate() {
-          Memory32Fixed(ReadWrite, 0x1c090000, 0x1000)
-          Interrupt(ResourceConsumer, Level, ActiveHigh, Exclusive) { 0x25 }
-        })
-        Return (RBUF)
-      }
-    }
-
   } // Scope(_SB)
 }
diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
index 76ea46023250d244205a5d8bc715e6e49e37b673..d49da52634cf70228852e4351c5538b85aab60e0 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -74,6 +74,13 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
       EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION,
       CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdDbg2),
       NULL
+    },
+    // SSDT Serial Port Table
+    {
+      EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE,
+      0,  // Not used.
+      CREATE_STD_ACPI_TABLE_GEN_ID (EStdAcpiTableIdSsdtSerialPort),
+      NULL
     }
   },
 
@@ -212,6 +219,28 @@ EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
     0x1000                                                    // BaseAddressLen
   },
 
+  // Standard Serial Ports
+  {
+    // Serial Port - UART0
+    {
+      0x1C090000,                                             // BaseAddress
+      37,                                                     // Interrupt
+      FixedPcdGet64 (PcdSerialDbgUartBaudRate),               // BaudRate
+      FixedPcdGet32 (PcdSerialDbgUartClkInHz),                // Clock
+      EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART,       // Port subtype
+      0x1000                                                  // BaseAddressLen
+    },
+    // Serial Port - UART3
+    {
+      0x1C0C0000,                                             // BaseAddress
+      40,                                                     // Interrupt
+      FixedPcdGet64 (PcdSerialDbgUartBaudRate),               // BaudRate
+      FixedPcdGet32 (PcdSerialDbgUartClkInHz),                // Clock
+      EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART,       // Port subtype
+      0x1000                                                  // BaseAddressLen
+    },
+  },
+
   // GIC ITS
   {
     // The GIC ITS ID.
@@ -457,6 +486,13 @@ GetArmNameSpaceObject (
       1
       );
     HANDLE_CM_OBJECT (
+      EArmObjSerialPortInfo,
+      CmObjectId,
+      PlatformRepo->StdSerialPort,
+      (sizeof (PlatformRepo->StdSerialPort) /
+          sizeof (PlatformRepo->StdSerialPort[0]))
+      );
+    HANDLE_CM_OBJECT (
       EArmObjGicItsInfo,
       CmObjectId,
       PlatformRepo->GicItsInfo,
diff --git a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
index 6fb959ab7ae2c77f750781d05660957488fae8cd..65561aa487dac95c1c870eb109238cdc88213205 100644
--- a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
@@ -114,7 +114,7 @@ extern CHAR8  dsdt_aml_code[];
 
 /** The number of ACPI tables to install
 */
-#define PLAT_ACPI_TABLE_COUNT       6
+#define PLAT_ACPI_TABLE_COUNT       7
 
 /** The number of platform generic timer blocks
 */
@@ -174,6 +174,9 @@ typedef struct PlatformRepositoryInfo {
   /// Serial port information for the DBG2 UART port
   CM_ARM_SERIAL_PORT_INFO               DbgSerialPort;
 
+  /// Standard Serial Ports
+  CM_ARM_SERIAL_PORT_INFO               StdSerialPort[2];
+
   /// GIC ITS information
   CM_ARM_GIC_ITS_INFO                   GicItsInfo;
 } EDKII_PLATFORM_REPOSITORY_INFO;
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'


  parent reply	other threads:[~2020-08-13  9:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-13  9:08 [PATCH edk2-platforms v1 0/7] Updates to support Dynamic AML Sami Mujawar
2020-08-13  9:08 ` [PATCH edk2-platforms v1 1/7] Platform/ARM/Juno: Remove SSDT UART table Sami Mujawar
2020-08-13  9:08 ` [PATCH edk2-platforms v1 2/7] ArmPlatformPkg: Juno: Increase FD size Sami Mujawar
2020-08-13  9:08 ` [PATCH edk2-platforms v1 3/7] Platform/ARM: FVP: Fix serial port interrupt Sami Mujawar
2020-08-13  9:08 ` [PATCH edk2-platforms v1 4/7] Platform/ARM: FVP: Add UART base address length Sami Mujawar
2020-08-13  9:08 ` Sami Mujawar [this message]
2020-08-13  9:08 ` [PATCH edk2-platforms v1 6/7] Platform/ARM: Juno: Configuration Mgr lib linkage Sami Mujawar
2020-08-13  9:08 ` [PATCH edk2-platforms v1 7/7] Platform/ARM: FVP: " Sami Mujawar
2020-08-13 12:31 ` [PATCH edk2-platforms v1 0/7] Updates to support Dynamic AML Ard Biesheuvel
2020-08-13 12:39   ` Sami Mujawar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200813090823.69908-6-sami.mujawar@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox