From: Evan Lloyd evan.lloyd@arm.com
These updates modify the DBG2 table to AslC instead of TDL, and add PCDs to allow build time customisation.
Thee resultant code is available at: https://github.com/EvanLloyd/OpenPlatformPkg/tree/DBG2_v3
Evan Lloyd (2): Platforms/ARM/Juno: Acpi - update DBG2 to aslc. Platforms/ARM/Juno: Use PCDs for Acpi DBG2
Platforms/ARM/Juno/ArmJuno.dsc | 6 +- Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 4 +- Platforms/ARM/Juno/AcpiTables/Dbg2.asl | 72 --------------- Platforms/ARM/Juno/AcpiTables/Dbg2.aslc | 92 ++++++++++++++++++++ 4 files changed, 100 insertions(+), 74 deletions(-) delete mode 100644 Platforms/ARM/Juno/AcpiTables/Dbg2.asl create mode 100644 Platforms/ARM/Juno/AcpiTables/Dbg2.aslc
From: Evan Lloyd evan.lloyd@arm.com
Amend the Debug Port 2 Table to aslc rather than TDL.
This patch replaces the Dbg2.asl file which described the DBG2 table in TDL format with Dbg2.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, etc.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Evan Lloyd evan.lloyd@arm.com --- Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 2 +- Platforms/ARM/Juno/AcpiTables/Dbg2.asl | 72 --------------- Platforms/ARM/Juno/AcpiTables/Dbg2.aslc | 92 ++++++++++++++++++++ 3 files changed, 93 insertions(+), 73 deletions(-)
diff --git a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf index d62068d65846d9032bc0771cfa7c80e7fd559ee3..2b063fbfb22781d7dc749b25a3ee5c7ca84d56e6 100644 --- a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf +++ b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf @@ -23,7 +23,7 @@ [Defines]
[Sources] Dsdt.asl - Dbg2.asl + Dbg2.aslc Spcr.aslc Fadt.aslc Gtdt.aslc diff --git a/Platforms/ARM/Juno/AcpiTables/Dbg2.asl b/Platforms/ARM/Juno/AcpiTables/Dbg2.asl deleted file mode 100644 index f57fa7e28a3bc34f112dec17cac8f1c27490ab4c..0000000000000000000000000000000000000000 --- a/Platforms/ARM/Juno/AcpiTables/Dbg2.asl +++ /dev/null @@ -1,72 +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". - * - * - * [DBG2] ACPI Table - * - */ - -[0004] Signature : "DBG2" [Debug Port table type 2] -[0004] Table Length : 0000005A -[0001] Revision : 00 -[0001] Checksum : 06 -[0006] Oem ID : "LINARO" -[0008] Oem Table ID : "ARM-JUNO" -[0004] Oem Revision : 00000000 -[0004] Asl Compiler ID : "INTL" -[0004] Asl Compiler Revision : 20140926 - -[0004] Info Offset : 0000002C -[0004] Info Count : 00000001 - -[0001] Revision : 00 -[0002] Length : 002C -[0001] Register Count : 01 -[0002] Namepath Length : 0005 -[0002] Namepath Offset : 0026 -[0002] OEM Data Length : 0000 [Optional field not present] -[0002] OEM Data Offset : 0000 [Optional field not present] -[0002] Port Type : 8000 -[0002] Port Subtype : 0003 -[0002] Reserved : 0000 -[0002] Base Address Offset : 0016 -[0002] Address Size Offset : 0022 - -[000C] Base Address 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 - -[0004] Address Size : 00001000 - -[0004] Namepath : "COM1" -[0001] OEM Data : 00 diff --git a/Platforms/ARM/Juno/AcpiTables/Dbg2.aslc b/Platforms/ARM/Juno/AcpiTables/Dbg2.aslc new file mode 100644 index 0000000000000000000000000000000000000000..5621a98b91fdcaf425d86e27c418dda8ed3df4d5 --- /dev/null +++ b/Platforms/ARM/Juno/AcpiTables/Dbg2.aslc @@ -0,0 +1,92 @@ +/** @file +* DBG2 Table +* +* Copyright (c) 2012-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/DebugPort2Table.h> + +#pragma pack(1) + +#define DBG2_NUM_DEBUG_PORTS 1 +#define DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS 1 +#define DBG2_NAMESPACESTRING_FIELD_SIZE 8 +#define PL011_UART_LENGTH 0x1000 + +#define NAME_STR_UART1 {'C', 'O', 'M', '1', '\0', '\0', '\0', '\0'} + +typedef struct { + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device; + EFI_ACPI_5_1_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister; + UINT32 AddressSize; + UINT8 NameSpaceString[DBG2_NAMESPACESTRING_FIELD_SIZE]; +} DBG2_DEBUG_DEVICE_INFORMATION; + +typedef struct { + EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE Description; + DBG2_DEBUG_DEVICE_INFORMATION Dbg2DeviceInfo[DBG2_NUM_DEBUG_PORTS]; +} DBG2_TABLE; + + +#define DBG2_DEBUG_PORT_DDI(NumReg, SubType, UartBase, UartAddrLen, UartNameStr) { \ + { \ + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION, /* UINT8 Revision */ \ + sizeof (DBG2_DEBUG_DEVICE_INFORMATION), /* UINT16 Length */ \ + NumReg, /* UINT8 NumberofGenericAddressRegisters */ \ + DBG2_NAMESPACESTRING_FIELD_SIZE, /* UINT16 NameSpaceStringLength */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, NameSpaceString), /* UINT16 NameSpaceStringOffset */ \ + 0, /* UINT16 OemDataLength */ \ + 0, /* UINT16 OemDataOffset */ \ + EFI_ACPI_DBG2_PORT_TYPE_SERIAL, /* UINT16 Port Type */ \ + SubType, /* UINT16 Port Subtype */ \ + {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE}, /* UINT8 Reserved[2] */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), /* UINT16 BaseAddressRegister Offset */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize) /* UINT16 AddressSize Offset */ \ + }, \ + ARM_GAS32 (UartBase), /* EFI_ACPI_5_1_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */ \ + UartAddrLen, /* UINT32 AddressSize */ \ + UartNameStr /* UINT8 NameSpaceString[MAX_DBG2_NAME_LEN] */ \ + } + + +STATIC DBG2_TABLE Dbg2 = { + { + ARM_ACPI_HEADER (EFI_ACPI_5_1_DEBUG_PORT_2_TABLE_SIGNATURE, + DBG2_TABLE, + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION), + OFFSET_OF (DBG2_TABLE, Dbg2DeviceInfo), + DBG2_NUM_DEBUG_PORTS /* UINT32 NumberDbgDeviceInfo */ + }, + { + /* + * Kernel Debug Port + */ + DBG2_DEBUG_PORT_DDI (DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS, + EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART, + 0x7FF80000, + PL011_UART_LENGTH, + NAME_STR_UART1), + } +}; + +#pragma pack() + +// +// Reference the table being generated to prevent the optimizer from removing +// the data structure from the executable +// +VOID* CONST ReferenceAcpiTable = &Dbg2;
From: Evan Lloyd evan.lloyd@arm.com
The DBG2 table is used to publish the presence of debug ports available on a system. The original DBG2 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 when sharing ports (e.g. between UEFI trace and remote debug) causes fails.
NOTE: Because this change does not modify the UART in use, the existing problems with serial debug are still present. Changing to UART1 is possible, but requires an update to the ARM Trusted Firmware to allow non-secure use of that UART.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Evan Lloyd evan.lloyd@arm.com --- Platforms/ARM/Juno/ArmJuno.dsc | 6 +++++- Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 2 ++ Platforms/ARM/Juno/AcpiTables/Dbg2.aslc | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Platforms/ARM/Juno/ArmJuno.dsc b/Platforms/ARM/Juno/ArmJuno.dsc index 4f41fb159f193b3593048ce118fd0e8e97843809..9d141725342c36076323d0471127c7b15125794b 100644 --- a/Platforms/ARM/Juno/ArmJuno.dsc +++ b/Platforms/ARM/Juno/ArmJuno.dsc @@ -121,11 +121,15 @@ [PcdsFixedAtBuild.common]
## PL011 - Serial Terminal gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x7FF80000 - gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 gEfiMdePkgTokenSpaceGuid.PcdUartDefaultReceiveFifoDepth|0 gArmPlatformTokenSpaceGuid.PL011UartClkInHz|7372800 gArmPlatformTokenSpaceGuid.PL011UartInterrupt|115
+ ## PL011 - Serial Debug UART + gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase|0x7FF80000 + gArmPlatformTokenSpaceGuid.PcdSerialDbgUartClkInHz|7372800 + gArmPlatformTokenSpaceGuid.PcdSerialDbgUartBaudRate|115200 + ## PL031 RealTimeClock gArmPlatformTokenSpaceGuid.PcdPL031RtcBase|0x1C170000
diff --git a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf index 2b063fbfb22781d7dc749b25a3ee5c7ca84d56e6..e099c02f39dad4bb19692c87a12d8d3d6f1da4b6 100644 --- a/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf +++ b/Platforms/ARM/Juno/AcpiTables/AcpiTables.inf @@ -59,3 +59,5 @@ [FixedPcd] gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate gArmPlatformTokenSpaceGuid.PL011UartClkInHz gArmPlatformTokenSpaceGuid.PL011UartInterrupt + + gArmPlatformTokenSpaceGuid.PcdSerialDbgRegisterBase diff --git a/Platforms/ARM/Juno/AcpiTables/Dbg2.aslc b/Platforms/ARM/Juno/AcpiTables/Dbg2.aslc index 5621a98b91fdcaf425d86e27c418dda8ed3df4d5..be30cd0a655adae315448a5fe186fcb6ebab22f2 100644 --- a/Platforms/ARM/Juno/AcpiTables/Dbg2.aslc +++ b/Platforms/ARM/Juno/AcpiTables/Dbg2.aslc @@ -77,7 +77,7 @@ STATIC DBG2_TABLE Dbg2 = { */ DBG2_DEBUG_PORT_DDI (DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS, EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART, - 0x7FF80000, + FixedPcdGet64 (PcdSerialDbgRegisterBase), PL011_UART_LENGTH, NAME_STR_UART1), }
Series looks good to me, I was just looking at the same for FVP
Reviewed-by: Graeme Gregory graeme.gregory@linaro.org
On Fri, Jul 15, 2016 at 06:32:57PM +0100, evan.lloyd@arm.com wrote:
From: Evan Lloyd evan.lloyd@arm.com
These updates modify the DBG2 table to AslC instead of TDL, and add PCDs to allow build time customisation.
Thee resultant code is available at: https://github.com/EvanLloyd/OpenPlatformPkg/tree/DBG2_v3
Evan Lloyd (2): Platforms/ARM/Juno: Acpi - update DBG2 to aslc. Platforms/ARM/Juno: Use PCDs for Acpi DBG2
Platforms/ARM/Juno/ArmJuno.dsc | 6 +- Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 4 +- Platforms/ARM/Juno/AcpiTables/Dbg2.asl | 72 --------------- Platforms/ARM/Juno/AcpiTables/Dbg2.aslc | 92 ++++++++++++++++++++ 4 files changed, 100 insertions(+), 74 deletions(-) delete mode 100644 Platforms/ARM/Juno/AcpiTables/Dbg2.asl create mode 100644 Platforms/ARM/Juno/AcpiTables/Dbg2.aslc
-- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")
On Fri, Jul 15, 2016 at 06:32:57PM +0100, evan.lloyd@arm.com wrote:
From: Evan Lloyd evan.lloyd@arm.com
These updates modify the DBG2 table to AslC instead of TDL, and add PCDs to allow build time customisation.
Thanks. For the series: Signed-off-by: Leif Lindholm leif.lindholm@linaro.org
Pushed.
Thee resultant code is available at: https://github.com/EvanLloyd/OpenPlatformPkg/tree/DBG2_v3
Evan Lloyd (2): Platforms/ARM/Juno: Acpi - update DBG2 to aslc. Platforms/ARM/Juno: Use PCDs for Acpi DBG2
Platforms/ARM/Juno/ArmJuno.dsc | 6 +- Platforms/ARM/Juno/AcpiTables/AcpiTables.inf | 4 +- Platforms/ARM/Juno/AcpiTables/Dbg2.asl | 72 --------------- Platforms/ARM/Juno/AcpiTables/Dbg2.aslc | 92 ++++++++++++++++++++ 4 files changed, 100 insertions(+), 74 deletions(-) delete mode 100644 Platforms/ARM/Juno/AcpiTables/Dbg2.asl create mode 100644 Platforms/ARM/Juno/AcpiTables/Dbg2.aslc
-- Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")