From: Sami Mujawar sami.mujawar@arm.com
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.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Alexei Fedorov alexei.fedorov@arm.com Signed-off-by: Girish Pathak girish.pathak@arm.com Signed-off-by: Sami Mujawar sami.mujawar@arm.com Signed-off-by: Evan Lloyd evan.lloyd@arm.com --- Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 12 ++- Platforms/ARM/Juno/AcpiTables/Spcr.asl | 73 ------------------ Platforms/ARM/Juno/AcpiTables/Spcr.aslc | 79 ++++++++++++++++++++ Platforms/ARM/Juno/ArmJuno.dsc | 1 + 4 files changed, 90 insertions(+), 75 deletions(-)
diff --git a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf index 3159d7d..412f43d 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 Facs.aslc Fadt.aslc Gtdt.aslc @@ -52,3 +52,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.asl b/Platforms/ARM/Juno/AcpiTables/Spcr.asl deleted file mode 100644 index 2b65326..0000000 --- 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 0000000..d76f48a --- /dev/null +++ b/Platforms/ARM/Juno/AcpiTables/Spcr.aslc @@ -0,0 +1,79 @@ +/** @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), + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART, + { + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE + }, + ARM_GAS32 (FixedPcdGet64 (PcdSerialRegisterBase)), + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC, + 0, // Not used on ARM + FixedPcdGet32 (PL011UartInterrupt), +#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 + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1, + SPCR_FLOW_CONTROL_NONE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_ANSI, + EFI_ACPI_RESERVED_BYTE, + 0xFFFF, + 0xFFFF, + 0x00, + 0x00, + 0x00, + 0x00000000, + 0x00, + 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; diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc index d099d86..b718794 100644 --- a/Platforms/ARM/Juno/ArmJuno.dsc +++ b/Platforms/ARM/Juno/ArmJuno.dsc @@ -128,6 +128,7 @@ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 gArmPlatformTokenSpaceGuid.PL011UartInteger|4 gArmPlatformTokenSpaceGuid.PL011UartFractional|0 + gArmPlatformTokenSpaceGuid.PL011UartInterrupt|115
## PL031 RealTimeClock gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x1C170000
I am fine with moving to aslc for this file and replacing my original.
Graeme
On Wed, Mar 09, 2016 at 05:21:22PM +0000, evan.lloyd@arm.com wrote:
From: Sami Mujawar sami.mujawar@arm.com
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.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Alexei Fedorov alexei.fedorov@arm.com Signed-off-by: Girish Pathak girish.pathak@arm.com Signed-off-by: Sami Mujawar sami.mujawar@arm.com Signed-off-by: Evan Lloyd evan.lloyd@arm.com
Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 12 ++- Platforms/ARM/Juno/AcpiTables/Spcr.asl | 73 ------------------ Platforms/ARM/Juno/AcpiTables/Spcr.aslc | 79 ++++++++++++++++++++ Platforms/ARM/Juno/ArmJuno.dsc | 1 + 4 files changed, 90 insertions(+), 75 deletions(-)
diff --git a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf index 3159d7d..412f43d 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 Facs.aslc Fadt.aslc Gtdt.aslc
@@ -52,3 +52,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.asl b/Platforms/ARM/Juno/AcpiTables/Spcr.asl deleted file mode 100644 index 2b65326..0000000 --- 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:
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 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 0000000..d76f48a --- /dev/null +++ b/Platforms/ARM/Juno/AcpiTables/Spcr.aslc @@ -0,0 +1,79 @@ +/** @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),
- EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART,
- {
- EFI_ACPI_RESERVED_BYTE,
- EFI_ACPI_RESERVED_BYTE,
- EFI_ACPI_RESERVED_BYTE
- },
- ARM_GAS32 (FixedPcdGet64 (PcdSerialRegisterBase)),
- EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC,
- 0, // Not used on ARM
- FixedPcdGet32 (PL011UartInterrupt),
+#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
- EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY,
- EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1,
- SPCR_FLOW_CONTROL_NONE,
- EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_ANSI,
- EFI_ACPI_RESERVED_BYTE,
- 0xFFFF,
- 0xFFFF,
- 0x00,
- 0x00,
- 0x00,
- 0x00000000,
- 0x00,
- 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; diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc index d099d86..b718794 100644 --- a/Platforms/ARM/Juno/ArmJuno.dsc +++ b/Platforms/ARM/Juno/ArmJuno.dsc @@ -128,6 +128,7 @@ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 gArmPlatformTokenSpaceGuid.PL011UartInteger|4 gArmPlatformTokenSpaceGuid.PL011UartFractional|0
- gArmPlatformTokenSpaceGuid.PL011UartInterrupt|115
## PL031 RealTimeClock gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x1C170000 -- 2.7.0
Linaro-uefi mailing list Linaro-uefi@lists.linaro.org https://lists.linaro.org/mailman/listinfo/linaro-uefi
On 03/09/2016 10:21 AM, evan.lloyd@arm.com wrote:
From: Sami Mujawar sami.mujawar@arm.com
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.
Please don't use ASL C files. IMHO, these are actually less flexible and more prone to error over time. There is a preprocessor in iasl that can likely be used to do exactly the same thing, and is probably why it exists in the first place. Worst case, look at the macro defining how to use iasl -- it may make sense to use cpp or something else instead.
The issue in my mind is that the C structs will and do change -- it is not a matter of "if it changes" but "*when* it changes". In particular, changes to reserved entries often happen. The thing that also happens is the addition of fields so that the structure defined here can get out of sync with the actual table definition -- and can cause problems in the kernel later on (ACPICA may rely on those new fields in odd ways, for example). Further, iasl provides semantic checks on the content that GCC may or may not see; it is possible, and likely, based on past history, that incorrect tables are provided to the kernel that could have been noticed by iasl. In one case, the table signature was wrong, so the kernel never even saw the table, but of course GCC had no idea that the value of the signature was incorrect.
That's my $0.02 worth. I'm not the UEFI maintainer, so I can't NAK these, but I'd really rather aslc *not* be used.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Alexei Fedorov alexei.fedorov@arm.com Signed-off-by: Girish Pathak girish.pathak@arm.com Signed-off-by: Sami Mujawar sami.mujawar@arm.com Signed-off-by: Evan Lloyd evan.lloyd@arm.com
Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 12 ++- Platforms/ARM/Juno/AcpiTables/Spcr.asl | 73 ------------------ Platforms/ARM/Juno/AcpiTables/Spcr.aslc | 79 ++++++++++++++++++++ Platforms/ARM/Juno/ArmJuno.dsc | 1 + 4 files changed, 90 insertions(+), 75 deletions(-)
diff --git a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf index 3159d7d..412f43d 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 Facs.aslc Fadt.aslc Gtdt.aslc
@@ -52,3 +52,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.asl b/Platforms/ARM/Juno/AcpiTables/Spcr.asl deleted file mode 100644 index 2b65326..0000000 --- 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:
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 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 0000000..d76f48a --- /dev/null +++ b/Platforms/ARM/Juno/AcpiTables/Spcr.aslc @@ -0,0 +1,79 @@ +/** @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),
- EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART,
- {
- EFI_ACPI_RESERVED_BYTE,
- EFI_ACPI_RESERVED_BYTE,
- EFI_ACPI_RESERVED_BYTE
- },
- ARM_GAS32 (FixedPcdGet64 (PcdSerialRegisterBase)),
- EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC,
- 0, // Not used on ARM
- FixedPcdGet32 (PL011UartInterrupt),
+#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
- EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY,
- EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1,
- SPCR_FLOW_CONTROL_NONE,
- EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_ANSI,
- EFI_ACPI_RESERVED_BYTE,
- 0xFFFF,
- 0xFFFF,
- 0x00,
- 0x00,
- 0x00,
- 0x00000000,
- 0x00,
- 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; diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc index d099d86..b718794 100644 --- a/Platforms/ARM/Juno/ArmJuno.dsc +++ b/Platforms/ARM/Juno/ArmJuno.dsc @@ -128,6 +128,7 @@ gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 gArmPlatformTokenSpaceGuid.PL011UartInteger|4 gArmPlatformTokenSpaceGuid.PL011UartFractional|0
- gArmPlatformTokenSpaceGuid.PL011UartInterrupt|115
## PL031 RealTimeClock gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x1C170000
-----Original Message----- From: Al Stone [mailto:al.stone@linaro.org] Sent: 10 March 2016 02:17 To: Evan Lloyd; linaro-uefi@lists.linaro.org Subject: Re: [Linaro-uefi] [PATCH] Platforms/ARM: Juno: Acpi - update SPCR to aslc.
On 03/09/2016 10:21 AM, evan.lloyd@arm.com wrote:
From: Sami Mujawar sami.mujawar@arm.com
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.
Please don't use ASL C files. IMHO, these are actually less flexible and more prone to error over time. There is a preprocessor in iasl that can likely be used to do exactly the same thing, and is probably why it exists in the first place. Worst case, look at the macro defining how to use iasl -- it may make sense to use cpp or something else instead.
1. iasl is not the only ASL/TDL compiler. In the case of a specification change, you have to wait for all of them to catch up before submitting a patch. 2.The compilers do not all support pre-processing. 3.The ASL compilers do not much like some C code as present in AutoGen.h (e.g. extern const UINT32), making it difficult to use PCDs.
(As an aside, I have no idea why the UEFI build system doesn't just use the C pre-processor for ASL, TDL. etc. Trim is an unfortunate halfway house. Maybe, were it to strip the C code from AutoGen.h, there would be some point to it beyond minor error localisation.)
The issue in my mind is that the C structs will and do change -- it is not a matter of "if it changes" but "*when* it changes". In particular, changes to reserved entries often happen. The thing that also happens is the addition of fields so that the structure defined here can get out of sync with the actual table
I absolutely agree that things change. They normally change after something new has been tried out. A benefit of aslC is that you are not prevented from trying a change by some well-intentioned semantic check that doesn't know what the next release of the spec might look like yet.
It is possible in TDL to specify new fields with generic data types. However, that introduces exactly the problem you complain of in C, but in an arcane language familiar to far fewer than C is. Further, I am not sure that all TDL compilers take kindly to redefinitions of "known" tables. (I haven't tried, but I'd bet a pint on it failing.)
definition -- and can cause problems in the kernel later on (ACPICA may rely on those new fields in odd ways, for example). Further, iasl provides semantic checks on the content that GCC may or may not see; it is possible, and likely, based on past history, that incorrect tables are provided to the kernel that could have been noticed by iasl. In one case, the table signature was wrong, so the kernel never even saw the table, but of course GCC had no idea that the value of the signature was incorrect.
That's my $0.02 worth. I'm not the UEFI maintainer, so I can't NAK these, but I'd really rather aslc *not* be used.
In case it is not obvious from my comments above, I'd really rather TDL not be used. Each to his own. One has to assume they both have reasons for existing, however ill-advised we may each think them.
...
ciao, al
Al Stone Software Engineer Linaro Enterprise Group al.stone@linaro.org
Regards, Evan
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
I have no objection to this patch.
I'm concerned that Al is not happy, but I'm happy for Leif to make any decisions about self contained ACPI changes for ARM Ltd platforms until further notice, so long as it still builds and boots.
On 10 March 2016 at 11:41, Evan Lloyd Evan.Lloyd@arm.com wrote:
-----Original Message----- From: Al Stone [mailto:al.stone@linaro.org] Sent: 10 March 2016 02:17 To: Evan Lloyd; linaro-uefi@lists.linaro.org Subject: Re: [Linaro-uefi] [PATCH] Platforms/ARM: Juno: Acpi - update SPCR to aslc.
On 03/09/2016 10:21 AM, evan.lloyd@arm.com wrote:
From: Sami Mujawar sami.mujawar@arm.com
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.
Please don't use ASL C files. IMHO, these are actually less flexible and more prone to error over time. There is a preprocessor in iasl that can likely be used to do exactly the same thing, and is probably why it exists in the first place. Worst case, look at the macro defining how to use iasl -- it may make sense to use cpp or something else instead.
- iasl is not the only ASL/TDL compiler. In the case of a specification change, you have to wait for all of them to catch up before submitting a patch.
2.The compilers do not all support pre-processing. 3.The ASL compilers do not much like some C code as present in AutoGen.h (e.g. extern const UINT32), making it difficult to use PCDs.
(As an aside, I have no idea why the UEFI build system doesn't just use the C pre-processor for ASL, TDL. etc. Trim is an unfortunate halfway house. Maybe, were it to strip the C code from AutoGen.h, there would be some point to it beyond minor error localisation.)
The issue in my mind is that the C structs will and do change -- it is not a matter of "if it changes" but "*when* it changes". In particular, changes to reserved entries often happen. The thing that also happens is the addition of fields so that the structure defined here can get out of sync with the actual table
I absolutely agree that things change. They normally change after something new has been tried out. A benefit of aslC is that you are not prevented from trying a change by some well-intentioned semantic check that doesn't know what the next release of the spec might look like yet.
It is possible in TDL to specify new fields with generic data types. However, that introduces exactly the problem you complain of in C, but in an arcane language familiar to far fewer than C is. Further, I am not sure that all TDL compilers take kindly to redefinitions of "known" tables. (I haven't tried, but I'd bet a pint on it failing.)
definition -- and can cause problems in the kernel later on (ACPICA may rely on those new fields in odd ways, for example). Further, iasl provides semantic checks on the content that GCC may or may not see; it is possible, and likely, based on past history, that incorrect tables are provided to the kernel that could have been noticed by iasl. In one case, the table signature was wrong, so the kernel never even saw the table, but of course GCC had no idea that the value of the signature was incorrect.
That's my $0.02 worth. I'm not the UEFI maintainer, so I can't NAK these, but I'd really rather aslc *not* be used.
In case it is not obvious from my comments above, I'd really rather TDL not be used. Each to his own. One has to assume they both have reasons for existing, however ill-advised we may each think them.
...
ciao, al
Al Stone Software Engineer Linaro Enterprise Group al.stone@linaro.org
Regards, Evan
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. _______________________________________________ Linaro-uefi mailing list Linaro-uefi@lists.linaro.org https://lists.linaro.org/mailman/listinfo/linaro-uefi
OK, given that, I am happy to take this change - but:
This patch does two unrelated changes atomically: - It changes the source file from .asl to .aslc - It adds new functionality available in the .aslc format to initialise an additional field.
I would like to see this split up into two separate commits, please. And if you could include a link to them in a public repository, I would be even happier - having issues importing the current one automatically.
Regards,
Leif
On Wed, Jun 22, 2016 at 10:46:52AM +0100, Ryan Harkin wrote:
I have no objection to this patch.
I'm concerned that Al is not happy, but I'm happy for Leif to make any decisions about self contained ACPI changes for ARM Ltd platforms until further notice, so long as it still builds and boots.
On 10 March 2016 at 11:41, Evan Lloyd Evan.Lloyd@arm.com wrote:
-----Original Message----- From: Al Stone [mailto:al.stone@linaro.org] Sent: 10 March 2016 02:17 To: Evan Lloyd; linaro-uefi@lists.linaro.org Subject: Re: [Linaro-uefi] [PATCH] Platforms/ARM: Juno: Acpi - update SPCR to aslc.
On 03/09/2016 10:21 AM, evan.lloyd@arm.com wrote:
From: Sami Mujawar sami.mujawar@arm.com
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.
Please don't use ASL C files. IMHO, these are actually less flexible and more prone to error over time. There is a preprocessor in iasl that can likely be used to do exactly the same thing, and is probably why it exists in the first place. Worst case, look at the macro defining how to use iasl -- it may make sense to use cpp or something else instead.
- iasl is not the only ASL/TDL compiler. In the case of a specification change, you have to wait for all of them to catch up before submitting a patch.
2.The compilers do not all support pre-processing. 3.The ASL compilers do not much like some C code as present in AutoGen.h (e.g. extern const UINT32), making it difficult to use PCDs.
(As an aside, I have no idea why the UEFI build system doesn't just use the C pre-processor for ASL, TDL. etc. Trim is an unfortunate halfway house. Maybe, were it to strip the C code from AutoGen.h, there would be some point to it beyond minor error localisation.)
The issue in my mind is that the C structs will and do change -- it is not a matter of "if it changes" but "*when* it changes". In particular, changes to reserved entries often happen. The thing that also happens is the addition of fields so that the structure defined here can get out of sync with the actual table
I absolutely agree that things change. They normally change after something new has been tried out. A benefit of aslC is that you are not prevented from trying a change by some well-intentioned semantic check that doesn't know what the next release of the spec might look like yet.
It is possible in TDL to specify new fields with generic data types. However, that introduces exactly the problem you complain of in C, but in an arcane language familiar to far fewer than C is. Further, I am not sure that all TDL compilers take kindly to redefinitions of "known" tables. (I haven't tried, but I'd bet a pint on it failing.)
definition -- and can cause problems in the kernel later on (ACPICA may rely on those new fields in odd ways, for example). Further, iasl provides semantic checks on the content that GCC may or may not see; it is possible, and likely, based on past history, that incorrect tables are provided to the kernel that could have been noticed by iasl. In one case, the table signature was wrong, so the kernel never even saw the table, but of course GCC had no idea that the value of the signature was incorrect.
That's my $0.02 worth. I'm not the UEFI maintainer, so I can't NAK these, but I'd really rather aslc *not* be used.
In case it is not obvious from my comments above, I'd really rather TDL not be used. Each to his own. One has to assume they both have reasons for existing, however ill-advised we may each think them.
...
ciao, al
Al Stone Software Engineer Linaro Enterprise Group al.stone@linaro.org
Regards, Evan
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. _______________________________________________ Linaro-uefi mailing list Linaro-uefi@lists.linaro.org https://lists.linaro.org/mailman/listinfo/linaro-uefi
Linaro-uefi mailing list Linaro-uefi@lists.linaro.org https://lists.linaro.org/mailman/listinfo/linaro-uefi