From: Evan Lloyd evan.lloyd@arm.com
This patch set comprises a split version of the single patch previously submitted under the title "Platforms/ARM: Juno: Acpi - update SPCR to aslc." The split divides the change to aslC format from the update to use PCDs. Code is available at: https://github.com/EvanLloyd/OpenPlatformPkg/tree/SPCR_v3
Original Commit message was: Amend the Serial Port Console Redirection Table to enable (i.a.) Microsoft Windows Emergency Management Services (EMS) over the serial port.
This patch replaces the Spcr.asl file which described the SPCR table in TDL format with Spcr.aslc which allows more flexibility by way of permitting the use of PCDs. This means the serial port usage can be modified at build.
Evan Lloyd (1): Platforms/ARM/Juno: Use PCDs for SPCR info
Sami Mujawar (1): Platforms/ARM/Juno: Acpi - update SPCR to aslc.
Platforms/ARM/Juno/ArmJuno.dsc | 1 + Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 12 ++- Platforms/ARM/Juno/AcpiTables/Spcr.asl | 73 --------------- Platforms/ARM/Juno/AcpiTables/Spcr.aslc | 99 ++++++++++++++++++++ 4 files changed, 110 insertions(+), 75 deletions(-) delete mode 100644 Platforms/ARM/Juno/AcpiTables/Spcr.asl create mode 100644 Platforms/ARM/Juno/AcpiTables/Spcr.aslc
From: Sami Mujawar sami.mujawar@arm.com
Amend the Serial Port Console Redirection Table to aslc.
This patch replaces the Spcr.asl file which described the SPCR table in TDL format with Spcr.aslc which introduces the option of using EDK2 build defined PCDs. Using PCDs will allow for future improvements.
No functional changes are made by this change, it is a preliminary step towards introducing improvements to allow build time modifications for bug fixes and improvements.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Sami Mujawar sami.mujawar@arm.com Signed-off-by: Evan Lloyd evan.lloyd@arm.com ---
Notes: SPCR_v2: - Resubmitting following discussion on TDL vs ASLC
SPCR_v3: - Split into 2 commits (aslc then PCDs) [Leif Lindholm]
Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 4 +- Platforms/ARM/Juno/AcpiTables/Spcr.asl | 73 ---------------- Platforms/ARM/Juno/AcpiTables/Spcr.aslc | 89 ++++++++++++++++++++ 3 files changed, 91 insertions(+), 75 deletions(-)
diff --git a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf index 039cff0a743a8e986cfce110a30fcdc83012c22f..3caf4afdc82f9cd6b275d155857b09f3c9a6b8d0 100644 --- a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf +++ b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf @@ -2,7 +2,7 @@ # # ACPI table data and ASL sources required to boot the platform. # -# Copyright (c) 2014-2015, ARM Ltd. All rights reserved. +# Copyright (c) 2014-2016, ARM Ltd. All rights reserved. # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -24,7 +24,7 @@ [Sources] Dsdt.asl Dbg2.asl - Spcr.asl + Spcr.aslc Fadt.aslc Gtdt.aslc Madt.aslc diff --git a/Platforms/ARM/Juno/AcpiTables/Spcr.asl b/Platforms/ARM/Juno/AcpiTables/Spcr.asl deleted file mode 100644 index 2b65326cf8be28c2db8db37ee5fb3bf51cbe5a48..0000000000000000000000000000000000000000 --- a/Platforms/ARM/Juno/AcpiTables/Spcr.asl +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2015, Graeme Gregory graeme.gregory@linaro.org - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * NB: This License is also known as the "BSD 2-Clause License". - * - * - * [SPCR] ACPI Table - * - */ - -[0004] Signature : "SPCR" [Serial Port Console Redirection table] -[0004] Table Length : 00000050 -[0001] Revision : 02 -[0001] Checksum : 29 -[0006] Oem ID : "LINARO" -[0008] Oem Table ID : "ARM-JUNO" -[0004] Oem Revision : 00000000 -[0004] Asl Compiler ID : "INTL" -[0004] Asl Compiler Revision : 20140926 - -[0001] Interface Type : 03 -[0003] Reserved : 000000 - -[000C] Serial Port Register : [Generic Address Structure] -[0001] Space ID : 00 [SystemMemory] -[0001] Bit Width : 20 -[0001] Bit Offset : 00 -[0001] Encoded Access Width : 03 [DWord Access:32] -[0008] Address : 000000007FF80000 - -[0001] Interrupt Type : 08 -[0001] PCAT-compatible IRQ : 00 -[0004] Interrupt : 00000073 -[0001] Baud Rate : 07 -[0001] Parity : 00 -[0001] Stop Bits : 01 -[0001] Flow Control : 00 -[0001] Terminal Type : 03 -[0001] Reserved : 00 -[0002] PCI Device ID : FFFF -[0002] PCI Vendor ID : FFFF -[0001] PCI Bus : 00 -[0001] PCI Device : 00 -[0001] PCI Function : 00 -[0004] PCI Flags : 00000000 -[04Bh] PCI Segment : 00 -[04Ch] Reserved : 00000000 - diff --git a/Platforms/ARM/Juno/AcpiTables/Spcr.aslc b/Platforms/ARM/Juno/AcpiTables/Spcr.aslc new file mode 100644 index 0000000000000000000000000000000000000000..6fea989b13ea2cce389c898e290080327e4202e2 --- /dev/null +++ b/Platforms/ARM/Juno/AcpiTables/Spcr.aslc @@ -0,0 +1,89 @@ +/** @file +* SPCR Table +* +* Copyright (c) 2014 - 2016, ARM Limited. All rights reserved. +* +* This program and the accompanying materials are licensed and made available +* under the terms and conditions of the BSD License which accompanies this +* distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include "ArmPlatform.h" +#include <Library/AcpiLib.h> +#include <Library/ArmLib.h> +#include <Library/PcdLib.h> +#include <IndustryStandard/Acpi.h> +#include <IndustryStandard/SerialPortConsoleRedirectionTable.h> + +/** + * References: + * Serial Port Console Redirection Table Specification Version 1.03 - August 10, 2015 + **/ + + +/// +/// SPCR Flow Control +/// +#define SPCR_FLOW_CONTROL_NONE 0 + + +STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE Spcr = { + ARM_ACPI_HEADER (EFI_ACPI_5_1_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION), + // UINT8 InterfaceType; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART, + // UINT8 Reserved1[3]; + { + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE + }, + // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE BaseAddress; + ARM_GAS32 (0x7FF80000), + // UINT8 InterruptType; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC, + // UINT8 Irq; + 0, // Not used on ARM + // UINT32 GlobalSystemInterrupt; + 0x73, + // UINT8 BaudRate; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200, + // UINT8 Parity; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY, + // UINT8 StopBits; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1, + // UINT8 FlowControl; + SPCR_FLOW_CONTROL_NONE, + // UINT8 TerminalType; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_ANSI, + // UINT8 Reserved2; + EFI_ACPI_RESERVED_BYTE, + // UINT16 PciDeviceId; + 0xFFFF, + // UINT16 PciVendorId; + 0xFFFF, + // UINT8 PciBusNumber; + 0x00, + // UINT8 PciDeviceNumber; + 0x00, + // UINT8 PciFunctionNumber; + 0x00, + // UINT32 PciFlags; + 0x00000000, + // UINT8 PciSegment; + 0x00, + // UINT32 Reserved3; + EFI_ACPI_RESERVED_DWORD +}; + +// +// Reference the table being generated to prevent the optimizer from removing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable = &Spcr;
From: Evan Lloyd evan.lloyd@arm.com
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 evan.lloyd@arm.com ---
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;
Hi,
On 06/27/2016 11:23 AM, evan.lloyd@arm.com wrote:
From: Evan Lloyd evan.lloyd@arm.com
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 evan.lloyd@arm.com
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
I converted my SPCR/etc to aslC a few months ago, and did something similar, but I think it's a mistake. These baud rates need to be user select-able via a HII menu, which once that has been provided should probably allow the selection of the flow control as well (does anyone use anything other 8n1 these days for the bit/parity/stop? those probably could remain hard coded).
Although that comment should not be construed as lack of support for this patch (not that it matters at this point as Leif took it).
// UINT8 Parity; EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY, // UINT8 StopBits;
Thanks, pushed.
On 27 June 2016 at 17:23, evan.lloyd@arm.com wrote:
From: Evan Lloyd evan.lloyd@arm.com
This patch set comprises a split version of the single patch previously submitted under the title "Platforms/ARM: Juno: Acpi - update SPCR to aslc." The split divides the change to aslC format from the update to use PCDs. Code is available at: https://github.com/EvanLloyd/OpenPlatformPkg/tree/SPCR_v3
Original Commit message was: Amend the Serial Port Console Redirection Table to enable (i.a.) Microsoft Windows Emergency Management Services (EMS) over the serial port.
This patch replaces the Spcr.asl file which described the SPCR table in TDL format with Spcr.aslc which allows more flexibility by way of permitting the use of PCDs. This means the serial port usage can be modified at build.
Evan Lloyd (1): Platforms/ARM/Juno: Use PCDs for SPCR info
Sami Mujawar (1): Platforms/ARM/Juno: Acpi - update SPCR to aslc.
Platforms/ARM/Juno/ArmJuno.dsc | 1 + Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 12 ++- Platforms/ARM/Juno/AcpiTables/Spcr.asl | 73 --------------- Platforms/ARM/Juno/AcpiTables/Spcr.aslc | 99 ++++++++++++++++++++ 4 files changed, 110 insertions(+), 75 deletions(-) delete mode 100644 Platforms/ARM/Juno/AcpiTables/Spcr.asl create mode 100644 Platforms/ARM/Juno/AcpiTables/Spcr.aslc
-- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")