From patchwork Mon Jun 27 16:23:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evan Lloyd X-Patchwork-Id: 70929 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1154509qgy; Mon, 27 Jun 2016 09:23:52 -0700 (PDT) X-Received: by 10.237.57.41 with SMTP id l38mr24473125qte.74.1467044632354; Mon, 27 Jun 2016 09:23:52 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id n67si17844747qka.89.2016.06.27.09.23.50; Mon, 27 Jun 2016 09:23:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 83936687ED; Mon, 27 Jun 2016 16:23:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id F22B168413; Mon, 27 Jun 2016 16:23:33 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 0FA1968502; Mon, 27 Jun 2016 16:23:31 +0000 (UTC) Received: from cam-smtp0.cambridge.arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by lists.linaro.org (Postfix) with ESMTPS id CE2F9684D4 for ; Mon, 27 Jun 2016 16:23:28 +0000 (UTC) Received: from E107800.Emea.Arm.com (e107800.emea.arm.com [10.1.30.54]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id u5RGNP9T025451; Mon, 27 Jun 2016 17:23:26 +0100 From: evan.lloyd@arm.com To: linaro-uefi@lists.linaro.org Date: Mon, 27 Jun 2016 17:23:25 +0100 Message-Id: <20160627162325.7888-3-evan.lloyd@arm.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160627162325.7888-1-evan.lloyd@arm.com> References: <20160627162325.7888-1-evan.lloyd@arm.com> Cc: WoA-Tech Subject: [Linaro-uefi] [PATCH 2/2] Platforms/ARM/Juno: Use PCDs for SPCR info X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" From: Evan Lloyd The original SPCR used explicit constants for hardware details. That made it difficult to readilly adjust the use of serial ports. This change modifies the explicit constants to use PCDs, so the serial port usage can be adjusted at build. This can help avoid problems where sharing ports (e.g. between UEFI trace and host debug) causes fails. Because the SPCR baud rate selection does not map directly to the PCD used, a compile time error has been added for baud rates not matching the SPCR specification. This is beneficial as it is quite difficult to diagnose an invalid baud rate otherwise. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Evan Lloyd --- Notes: SPCR_v3: - Split into 2 commits (aslc then PCDs) [Leif Lindholm] Platforms/ARM/Juno/ArmJuno.dsc | 1 + Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 8 ++++++++ Platforms/ARM/Juno/AcpiTables/Spcr.aslc | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc index 2caa7413dec3f9f8969b5de28d0a49402fe71e86..3626dfb6e5834f36d136214550ecfde7ed41e4e5 100644 --- a/Platforms/ARM/Juno/ArmJuno.dsc +++ b/Platforms/ARM/Juno/ArmJuno.dsc @@ -124,6 +124,7 @@ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|0 gArmPlatformTokenSpaceGuid.PL011UartInteger|4 gArmPlatformTokenSpaceGuid.PL011UartFractional|0 + gArmPlatformTokenSpaceGuid.PL011UartInterrupt|115 ## PL031 RealTimeClock gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x1C170000 diff --git a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf index 3caf4afdc82f9cd6b275d155857b09f3c9a6b8d0..d62068d65846d9032bc0771cfa7c80e7fd559ee3 100644 --- a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf +++ b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf @@ -51,3 +51,11 @@ gArmTokenSpaceGuid.PcdGenericWatchdogControlBase gArmTokenSpaceGuid.PcdGenericWatchdogRefreshBase + + # + # PL011 UART Settings for Serial Port Console Redirection + # + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate + gArmPlatformTokenSpaceGuid.PL011UartClkInHz + gArmPlatformTokenSpaceGuid.PL011UartInterrupt diff --git a/Platforms/ARM/Juno/AcpiTables/Spcr.aslc b/Platforms/ARM/Juno/AcpiTables/Spcr.aslc index 6fea989b13ea2cce389c898e290080327e4202e2..8371669b7beb3a213b78379803f631ff17b21ce8 100644 --- a/Platforms/ARM/Juno/AcpiTables/Spcr.aslc +++ b/Platforms/ARM/Juno/AcpiTables/Spcr.aslc @@ -45,15 +45,25 @@ STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE Spcr = { EFI_ACPI_RESERVED_BYTE }, // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE BaseAddress; - ARM_GAS32 (0x7FF80000), + ARM_GAS32 (FixedPcdGet64 (PcdSerialRegisterBase)), // UINT8 InterruptType; EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC, // UINT8 Irq; 0, // Not used on ARM // UINT32 GlobalSystemInterrupt; - 0x73, + FixedPcdGet32 (PL011UartInterrupt), // UINT8 BaudRate; +#if (FixedPcdGet64 (PcdUartDefaultBaudRate) == 9600) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_9600, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) == 19200) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_19200, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) == 57600) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_57600, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) == 115200) EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200, +#else +#error Unsupported SPCR Baud Rate +#endif // UINT8 Parity; EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY, // UINT8 StopBits;