From nobody Thu May 2 03:04:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+72539+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+72539+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1615221675; cv=none; d=zohomail.com; s=zohoarc; b=ShJ8kG+DFrHS7Ia3nO3YzRRfd/RLo1u2bNiMiGmIizsf3ecGVD5aG+t59otZGb1FrVDfKl/BuG4fwfa2mxHzILUQzBJUG5GFhtDWuYPAyad/+mPfsUnJmKzm7V4YQP9XWSpOG5/7vrRAv9z2BCEb1ZG0bzgD00NPzW5ctpbi3lE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1615221675; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=pcg2RJUlaW708HHdxMUUbpgRq9nqSjrllj+ienCEEwc=; b=I1xLZogOrsI9nLxRjLG8zf4vnqrd25ypdoHG2tlXdN2I4DDam80WWaEP/dBbAHVS1wssmKSWW7s5cLQgqGLRPkJjV5c0r+NZXrBZI/q0yBIchakigSNAqG5AwVa2zeO+SITG4yU4q8YaN5w4SmtqGPbKhzcA9JXlYMiFWx3AChU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+72539+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1615221675904895.3583388356319; Mon, 8 Mar 2021 08:41:15 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id GJg4YY1788612xSXdcon8Alm; Mon, 08 Mar 2021 08:41:15 -0800 X-Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mx.groups.io with SMTP id smtpd.web10.5344.1615022774616169268 for ; Sat, 06 Mar 2021 01:26:14 -0800 X-Received: by mail-pf1-f169.google.com with SMTP id w18so3783516pfu.9 for ; Sat, 06 Mar 2021 01:26:14 -0800 (PST) X-Gm-Message-State: dbvA8aUWEGdzaN2y8x7IX2odx1787277AA= X-Google-Smtp-Source: ABdhPJylulBC6WFzp6MwsUnbS4MMgNZA2zFwAu0r+SOusGJqVFbVqSGuKQMQPRIgaz1F9vYVe+k7MQ== X-Received: by 2002:a63:1d0b:: with SMTP id d11mr8190790pgd.190.1615022773640; Sat, 06 Mar 2021 01:26:13 -0800 (PST) X-Received: from localhost.localdomain (61-231-194-89.dynamic-ip.hinet.net. [61.231.194.89]) by smtp.gmail.com with ESMTPSA id k4sm4560415pju.44.2021.03.06.01.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Mar 2021 01:26:13 -0800 (PST) From: "Sunny Hsuan-Wen Wang" To: devel@edk2.groups.io Cc: Sunny Hsuan-Wen Wang , Samer El-Haj-Mahmoud , Pete Batard , Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [PATCH] Platform/RaspberryPi: Dynamically build UARTs info in ACPI Date: Sat, 6 Mar 2021 17:24:06 +0800 Message-Id: <20210306092406.1706-1-sunny.hsuanwen.wang@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sunny.hsuanwen.wang@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1615221675; bh=trZB+o5G5n+dDQ9Ye1Zq2sU7CtK/cyL+L0sIfh7zzV8=; h=Cc:Date:From:Reply-To:Subject:To; b=Ne2HhppA2+Xczq63SiEpvqrKU5xnCVmQ6nJuyWbe6KX+gMGn+qdjSNdAQvbzE3UAM6S 1jm0MhSg33Za4PepoXzgP+2PlZRbt1r2GnMXEsnEvMBGaslEwjN19+JVWEXKWt5KUxRLK Ado0bxEs8ov1eIFqxYam1y+TDhVE0D7guDo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Changes: 1. Add code to ConfigDxe driver and AcpiTables module to dynamically build either Mini UART or PL011 UART info in ACPI. This fixes the issue discussed in https://github.com/pftf/RPi4/issues/118. 2. Merge changes in edk2-platforms-raspberrypi-pl011-bth-noflow.diff in https://github.com/worproject/RPi-Bluetooth-Testing/ for enabling Bluetooth and serial port (Mini UART) in Windows OS. 3. Cleanup by moving duplicate Debug Port 2 table related defines and structures to a newly created header file (RpiDebugPort2Table.h). Testing Done: - Booted to UEFI shell and use acpiview command to check the result of the different UART settings in config.txt (enabling either Mini UART or PL011) and SPCR, DBG2 tables and device BTH0 are dynamically changed as expected. - Successfully booted Windows 10 (20279.1) on SD (made by WOR) with the RPi-Windows-Drivers release ver 0.5 downloaded from https://github.com/worproject/RPi-Windows-Drivers/releases and checked that both Bluetooth and serial port (Mini UART) can work fine. Cc: Samer El-Haj-Mahmoud Cc: Pete Batard Cc: Ard Biesheuvel Cc: Leif Lindholm Signed-off-by: Sunny Hsuan-Wen Wang --- .../RaspberryPi/AcpiTables/AcpiTables.inf | 7 +- .../RaspberryPi/AcpiTables/Dbg2MiniUart.aslc | 82 ++++++++ .../AcpiTables/{Dbg2.aslc =3D> Dbg2Pl011.aslc} | 187 ++++++++--------- .../RaspberryPi/AcpiTables/SpcrMiniUart.aslc | 92 +++++++++ .../AcpiTables/{Spcr.aslc =3D> SpcrPl011.aslc} | 189 +++++++++--------- Platform/RaspberryPi/AcpiTables/Uart.asl | 18 +- .../RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c | 123 +++++++++++- .../IndustryStandard/RpiDebugPort2Table.h | 33 +++ 8 files changed, 516 insertions(+), 215 deletions(-) create mode 100644 Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc rename Platform/RaspberryPi/AcpiTables/{Dbg2.aslc =3D> Dbg2Pl011.aslc} (73= %) create mode 100644 Platform/RaspberryPi/AcpiTables/SpcrMiniUart.aslc rename Platform/RaspberryPi/AcpiTables/{Spcr.aslc =3D> SpcrPl011.aslc} (88= %) create mode 100644 Platform/RaspberryPi/Include/IndustryStandard/RpiDebugP= ort2Table.h diff --git a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf b/Platform/Rasp= berryPi/AcpiTables/AcpiTables.inf index d2cce074e5..6c08cacbb3 100644 --- a/Platform/RaspberryPi/AcpiTables/AcpiTables.inf +++ b/Platform/RaspberryPi/AcpiTables/AcpiTables.inf @@ -2,6 +2,7 @@ # # ACPI table data and ASL sources required to boot the platform. # +# Copyright (c) 2021, Sunny Hsuan-Wen Wang # Copyright (c) 2019, ARM Limited. All rights reserved. # Copyright (c) 2017, Andrey Warkentin # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,12 +28,14 @@ AcpiTables.h Madt.aslc Fadt.aslc - Dbg2.aslc + Dbg2MiniUart.aslc + Dbg2Pl011.aslc Gtdt.aslc Iort.aslc Dsdt.asl Csrt.aslc - Spcr.aslc + SpcrMiniUart.aslc + SpcrPl011.aslc Pptt.aslc SsdtThermal.asl diff --git a/Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc b/Platform/R= aspberryPi/AcpiTables/Dbg2MiniUart.aslc new file mode 100644 index 0000000000..eec4ba1562 --- /dev/null +++ b/Platform/RaspberryPi/AcpiTables/Dbg2MiniUart.aslc @@ -0,0 +1,82 @@ +/** @file + * + * Debug Port Table (DBG2) + * + * Copyright (c) 2021, Sunny Hsuan-Wen Wang + * Copyright (c) 2019, Pete Batard + * Copyright (c) 2012-2020, ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#include +#include +#include +#include +#include + +#include "AcpiTables.h" + +#pragma pack(1) + +#define RPI_UART_INTERFACE_TYPE EFI_ACPI_DBG2_PORT= _SUBTYPE_SERIAL_BCM2835_UART +#define RPI_UART_BASE_ADDRESS BCM2836_MINI_UART_= BASE_ADDRESS +#define RPI_UART_LENGTH BCM2836_MINI_UART_= LENGTH +// +// RPI_UART_STR should match the value used Uart.asl +// +#define RPI_UART_STR { '\\', '_', 'S', = 'B', '.', 'G', 'D', 'V', '0', '.', 'U', 'R', 'T', 'M', 0x00 } + +#define DBG2_DEBUG_PORT_DDI(NumReg, SubType, UartBase, UartAddrLen, UartNa= meStr) { \ + { = \ + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION, /* U= INT8 Revision */ \ + sizeof (DBG2_DEBUG_DEVICE_INFORMATION), /* U= INT16 Length */ \ + NumReg, /* U= INT8 NumberofGenericAddressRegisters */ \ + RPI_DBG2_NAMESPACESTRING_FIELD_SIZE, /* U= INT16 NameSpaceStringLength */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, NameSpaceString), /* U= INT16 NameSpaceStringOffset */ \ + 0, /* U= INT16 OemDataLength */ \ + 0, /* U= INT16 OemDataOffset */ \ + EFI_ACPI_DBG2_PORT_TYPE_SERIAL, /* U= INT16 Port Type */ \ + SubType, /* U= INT16 Port Subtype */ \ + {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE}, /* U= INT8 Reserved[2] */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), /* U= INT16 BaseAddressRegister Offset */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize) /* U= INT16 AddressSize Offset */ \ + }, = \ + ARM_GAS32 (UartBase), /* EFI_ACPI_6_3_GENER= IC_ADDRESS_STRUCTURE BaseAddressRegister */ \ + UartAddrLen, /* UINT32 AddressSiz= e */ \ + UartNameStr /* UINT8 NameSpaceS= tring[MAX_DBG2_NAME_LEN] */ \ + } + + +STATIC DBG2_TABLE Dbg2 =3D { + { + ACPI_HEADER ( + EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE, + DBG2_TABLE, + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION + ), + OFFSET_OF (DBG2_TABLE, Dbg2DeviceInfo), + RPI_DBG2_NUM_DEBUG_PORTS /* U= INT32 NumberDbgDeviceInfo */ + }, + { + /* + * Kernel Debug Port + */ + DBG2_DEBUG_PORT_DDI ( + RPI_DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS, + RPI_UART_INTERFACE_TYPE, + RPI_UART_BASE_ADDRESS, + RPI_UART_LENGTH, + RPI_UART_STR + ), + } +}; + +#pragma pack() + +// +// Reference the table being generated to prevent the optimizer from remov= ing +// the data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Dbg2; diff --git a/Platform/RaspberryPi/AcpiTables/Dbg2.aslc b/Platform/Raspberry= Pi/AcpiTables/Dbg2Pl011.aslc similarity index 73% rename from Platform/RaspberryPi/AcpiTables/Dbg2.aslc rename to Platform/RaspberryPi/AcpiTables/Dbg2Pl011.aslc index e3f2adae7e..5ef58f14a1 100644 --- a/Platform/RaspberryPi/AcpiTables/Dbg2.aslc +++ b/Platform/RaspberryPi/AcpiTables/Dbg2Pl011.aslc @@ -1,105 +1,82 @@ -/** @file - * - * Debug Port Table (DBG2) - * - * Copyright (c) 2019, Pete Batard - * Copyright (c) 2012-2020, ARM Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-2-Clause-Patent - * - **/ - -#include -#include -#include -#include -#include - -#include "AcpiTables.h" - -#pragma pack(1) - -#define RPI_DBG2_NUM_DEBUG_PORTS 1 -#define RPI_DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS 1 -#define RPI_DBG2_NAMESPACESTRING_FIELD_SIZE 15 - -#if (RPI_MODEL =3D=3D 4) -#define RPI_UART_INTERFACE_TYPE EFI_ACPI_DBG2_PORT= _SUBTYPE_SERIAL_ARM_PL011_UART -#define RPI_UART_BASE_ADDRESS BCM2836_PL011_UART= _BASE_ADDRESS -#define RPI_UART_LENGTH BCM2836_PL011_UART= _LENGTH -#define RPI_UART_STR { '\\', '_', 'S', = 'B', '.', 'G', 'D', 'V', '0', '.', 'U', 'R', 'T', '0', 0x00 } -#else -#define RPI_UART_INTERFACE_TYPE EFI_ACPI_DBG2_PORT= _SUBTYPE_SERIAL_BCM2835_UART -#define RPI_UART_BASE_ADDRESS BCM2836_MINI_UART_= BASE_ADDRESS -#define RPI_UART_LENGTH BCM2836_MINI_UART_= LENGTH -// -// RPI_UART_STR should match the value used Uart.asl -// -#define RPI_UART_STR { '\\', '_', 'S', = 'B', '.', 'G', 'D', 'V', '0', '.', 'U', 'R', 'T', 'M', 0x00 } -#endif - -typedef struct { - EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device; - EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE BaseAddressRegiste= r; - UINT32 AddressSize; - UINT8 NameSpaceString[RP= I_DBG2_NAMESPACESTRING_FIELD_SIZE]; -} DBG2_DEBUG_DEVICE_INFORMATION; - -typedef struct { - EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE Description; - DBG2_DEBUG_DEVICE_INFORMATION Dbg2DeviceInfo[RPI= _DBG2_NUM_DEBUG_PORTS]; -} DBG2_TABLE; - - -#define DBG2_DEBUG_PORT_DDI(NumReg, SubType, UartBase, UartAddrLen, UartNa= meStr) { \ - { = \ - EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION, /* U= INT8 Revision */ \ - sizeof (DBG2_DEBUG_DEVICE_INFORMATION), /* U= INT16 Length */ \ - NumReg, /* U= INT8 NumberofGenericAddressRegisters */ \ - RPI_DBG2_NAMESPACESTRING_FIELD_SIZE, /* U= INT16 NameSpaceStringLength */ \ - OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, NameSpaceString), /* U= INT16 NameSpaceStringOffset */ \ - 0, /* U= INT16 OemDataLength */ \ - 0, /* U= INT16 OemDataOffset */ \ - EFI_ACPI_DBG2_PORT_TYPE_SERIAL, /* U= INT16 Port Type */ \ - SubType, /* U= INT16 Port Subtype */ \ - {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE}, /* U= INT8 Reserved[2] */ \ - OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), /* U= INT16 BaseAddressRegister Offset */ \ - OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize) /* U= INT16 AddressSize Offset */ \ - }, = \ - ARM_GAS32 (UartBase), /* EFI_ACPI_6_3_GENER= IC_ADDRESS_STRUCTURE BaseAddressRegister */ \ - UartAddrLen, /* UINT32 AddressSiz= e */ \ - UartNameStr /* UINT8 NameSpaceS= tring[MAX_DBG2_NAME_LEN] */ \ - } - - -STATIC DBG2_TABLE Dbg2 =3D { - { - ACPI_HEADER ( - EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE, - DBG2_TABLE, - EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION - ), - OFFSET_OF (DBG2_TABLE, Dbg2DeviceInfo), - RPI_DBG2_NUM_DEBUG_PORTS /* U= INT32 NumberDbgDeviceInfo */ - }, - { - /* - * Kernel Debug Port - */ - DBG2_DEBUG_PORT_DDI ( - RPI_DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS, - RPI_UART_INTERFACE_TYPE, - RPI_UART_BASE_ADDRESS, - RPI_UART_LENGTH, - RPI_UART_STR - ), - } -}; - -#pragma pack() - -// -// Reference the table being generated to prevent the optimizer from remov= ing -// the data structure from the executable -// -VOID* CONST ReferenceAcpiTable =3D &Dbg2; +/** @file + * + * Debug Port Table (DBG2) + * + * Copyright (c) 2021, Sunny Hsuan-Wen Wang + * Copyright (c) 2019, Pete Batard + * Copyright (c) 2012-2020, ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-2-Clause-Patent + * + **/ + +#include +#include +#include +#include +#include + +#include "AcpiTables.h" + +#pragma pack(1) + +#define RPI_UART_INTERFACE_TYPE EFI_ACPI_DBG2_PORT= _SUBTYPE_SERIAL_ARM_PL011_UART +#define RPI_UART_BASE_ADDRESS BCM2836_PL011_UART= _BASE_ADDRESS +#define RPI_UART_LENGTH BCM2836_PL011_UART= _LENGTH +// +// RPI_UART_STR should match the value used Uart.asl +// +#define RPI_UART_STR { '\\', '_', 'S', = 'B', '.', 'G', 'D', 'V', '0', '.', 'U', 'R', 'T', '0', 0x00 } + +#define DBG2_DEBUG_PORT_DDI(NumReg, SubType, UartBase, UartAddrLen, UartNa= meStr) { \ + { = \ + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION, /* U= INT8 Revision */ \ + sizeof (DBG2_DEBUG_DEVICE_INFORMATION), /* U= INT16 Length */ \ + NumReg, /* U= INT8 NumberofGenericAddressRegisters */ \ + RPI_DBG2_NAMESPACESTRING_FIELD_SIZE, /* U= INT16 NameSpaceStringLength */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, NameSpaceString), /* U= INT16 NameSpaceStringOffset */ \ + 0, /* U= INT16 OemDataLength */ \ + 0, /* U= INT16 OemDataOffset */ \ + EFI_ACPI_DBG2_PORT_TYPE_SERIAL, /* U= INT16 Port Type */ \ + SubType, /* U= INT16 Port Subtype */ \ + {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE}, /* U= INT8 Reserved[2] */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), /* U= INT16 BaseAddressRegister Offset */ \ + OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize) /* U= INT16 AddressSize Offset */ \ + }, = \ + ARM_GAS32 (UartBase), /* EFI_ACPI_6_3_GENER= IC_ADDRESS_STRUCTURE BaseAddressRegister */ \ + UartAddrLen, /* UINT32 AddressSiz= e */ \ + UartNameStr /* UINT8 NameSpaceS= tring[MAX_DBG2_NAME_LEN] */ \ + } + + +STATIC DBG2_TABLE Dbg2 =3D { + { + ACPI_HEADER ( + EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE, + DBG2_TABLE, + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION + ), + OFFSET_OF (DBG2_TABLE, Dbg2DeviceInfo), + RPI_DBG2_NUM_DEBUG_PORTS /* U= INT32 NumberDbgDeviceInfo */ + }, + { + /* + * Kernel Debug Port + */ + DBG2_DEBUG_PORT_DDI ( + RPI_DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS, + RPI_UART_INTERFACE_TYPE, + RPI_UART_BASE_ADDRESS, + RPI_UART_LENGTH, + RPI_UART_STR + ), + } +}; + +#pragma pack() + +// +// Reference the table being generated to prevent the optimizer from remov= ing +// the data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Dbg2; diff --git a/Platform/RaspberryPi/AcpiTables/SpcrMiniUart.aslc b/Platform/R= aspberryPi/AcpiTables/SpcrMiniUart.aslc new file mode 100644 index 0000000000..988d6aec0a --- /dev/null +++ b/Platform/RaspberryPi/AcpiTables/SpcrMiniUart.aslc @@ -0,0 +1,92 @@ +/** @file +* SPCR Table +* +* Copyright (c) 2021, Sunny Hsuan-Wen Wang +* Copyright (c) 2019 Pete Batard +* Copyright (c) 2014-2016, ARM Limited. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include +#include +#include +#include +#include + +#include "AcpiTables.h" + +#define RPI_UART_FLOW_CONTROL_NONE 0 + +#define RPI_UART_INTERFACE_TYPE EFI_ACPI_SERIAL_PORT_CONSOLE_= REDIRECTION_TABLE_INTERFACE_TYPE_BCM2835_UART +#define RPI_UART_BASE_ADDRESS BCM2836_MINI_UART_BASE_ADDRESS +#define RPI_UART_INTERRUPT BCM2836_MINI_UART_INTERRUPT + +STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE Spcr =3D { + ACPI_HEADER ( + EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION + ), + // UINT8 InterfaceType; + RPI_UART_INTERFACE_TYPE, + // UINT8 Reserved1[3]; + { + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE + }, + // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE BaseAddress; + ARM_GAS32 (RPI_UART_BASE_ADDRESS), + // UINT8 InterruptType; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC, + // UINT8 Irq; + 0, // Not used on ARM + // UINT32 GlobalSystemInterrupt; + RPI_UART_INTERRUPT, + // UINT8 BaudRate; +#if (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 9600) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_9600, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 19200) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_19200, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 57600) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_57600, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 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; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1, + // UINT8 FlowControl; + RPI_UART_FLOW_CONTROL_NONE, + // UINT8 TerminalType; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_VT_UTF8, + // 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 remov= ing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Spcr; diff --git a/Platform/RaspberryPi/AcpiTables/Spcr.aslc b/Platform/Raspberry= Pi/AcpiTables/SpcrPl011.aslc similarity index 88% rename from Platform/RaspberryPi/AcpiTables/Spcr.aslc rename to Platform/RaspberryPi/AcpiTables/SpcrPl011.aslc index 07df3a718d..34656cf9a6 100644 --- a/Platform/RaspberryPi/AcpiTables/Spcr.aslc +++ b/Platform/RaspberryPi/AcpiTables/SpcrPl011.aslc @@ -1,97 +1,92 @@ -/** @file -* SPCR Table -* -* Copyright (c) 2019 Pete Batard -* Copyright (c) 2014-2016, ARM Limited. All rights reserved. -* -* SPDX-License-Identifier: BSD-2-Clause-Patent -* -**/ - -#include -#include -#include -#include -#include - -#include "AcpiTables.h" - -#define RPI_UART_FLOW_CONTROL_NONE 0 - -// Prefer PL011 serial output on the Raspberry Pi 4 -#if (RPI_MODEL =3D=3D 4) -#define RPI_UART_INTERFACE_TYPE EFI_ACPI_SERIAL_PORT_CONSOLE_= REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART -#define RPI_UART_BASE_ADDRESS BCM2836_PL011_UART_BASE_ADDRE= SS -#define RPI_UART_INTERRUPT BCM2836_PL011_UART_INTERRUPT -#else -#define RPI_UART_INTERFACE_TYPE EFI_ACPI_SERIAL_PORT_CONSOLE_= REDIRECTION_TABLE_INTERFACE_TYPE_BCM2835_UART -#define RPI_UART_BASE_ADDRESS BCM2836_MINI_UART_BASE_ADDRESS -#define RPI_UART_INTERRUPT BCM2836_MINI_UART_INTERRUPT -#endif -STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE Spcr =3D { - ACPI_HEADER ( - EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, - EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE, - EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION - ), - // UINT8 InterfaceType; - RPI_UART_INTERFACE_TYPE, - // UINT8 Reserved1[3]; - { - EFI_ACPI_RESERVED_BYTE, - EFI_ACPI_RESERVED_BYTE, - EFI_ACPI_RESERVED_BYTE - }, - // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE BaseAddress; - ARM_GAS32 (RPI_UART_BASE_ADDRESS), - // UINT8 InterruptType; - EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC, - // UINT8 Irq; - 0, // Not used on ARM - // UINT32 GlobalSystemInterrupt; - RPI_UART_INTERRUPT, - // UINT8 BaudRate; -#if (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 9600) - EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_9600, -#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 19200) - EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_19200, -#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 57600) - EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_57600, -#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 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; - EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1, - // UINT8 FlowControl; - RPI_UART_FLOW_CONTROL_NONE, - // UINT8 TerminalType; - EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_VT_UTF8, - // 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 remov= ing the -// data structure from the executable -// -VOID* CONST ReferenceAcpiTable =3D &Spcr; +/** @file +* SPCR Table +* +* Copyright (c) 2021, Sunny Hsuan-Wen Wang +* Copyright (c) 2019 Pete Batard +* Copyright (c) 2014-2016, ARM Limited. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include +#include +#include +#include +#include + +#include "AcpiTables.h" + +#define RPI_UART_FLOW_CONTROL_NONE 0 + +#define RPI_UART_INTERFACE_TYPE EFI_ACPI_SERIAL_PORT_CONSOLE_= REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART +#define RPI_UART_BASE_ADDRESS BCM2836_PL011_UART_BASE_ADDRE= SS +#define RPI_UART_INTERRUPT BCM2836_PL011_UART_INTERRUPT + +STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE Spcr =3D { + ACPI_HEADER ( + EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE, + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION + ), + // UINT8 InterfaceType; + RPI_UART_INTERFACE_TYPE, + // UINT8 Reserved1[3]; + { + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE, + EFI_ACPI_RESERVED_BYTE + }, + // EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE BaseAddress; + ARM_GAS32 (RPI_UART_BASE_ADDRESS), + // UINT8 InterruptType; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC, + // UINT8 Irq; + 0, // Not used on ARM + // UINT32 GlobalSystemInterrupt; + RPI_UART_INTERRUPT, + // UINT8 BaudRate; +#if (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 9600) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_9600, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 19200) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_19200, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 57600) + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_57600, +#elif (FixedPcdGet64 (PcdUartDefaultBaudRate) =3D=3D 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; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1, + // UINT8 FlowControl; + RPI_UART_FLOW_CONTROL_NONE, + // UINT8 TerminalType; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_VT_UTF8, + // 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 remov= ing the +// data structure from the executable +// +VOID* CONST ReferenceAcpiTable =3D &Spcr; diff --git a/Platform/RaspberryPi/AcpiTables/Uart.asl b/Platform/RaspberryP= i/AcpiTables/Uart.asl index 81ae6711af..0f6719a27f 100644 --- a/Platform/RaspberryPi/AcpiTables/Uart.asl +++ b/Platform/RaspberryPi/AcpiTables/Uart.asl @@ -2,6 +2,7 @@ * * [DSDT] Serial devices (UART). * + * Copyright (c) 2021, Sunny Hsuan-Wen Wang * Copyright (c) 2020, Pete Batard * Copyright (c) 2018, Andrey Warkentin * Copyright (c) Microsoft Corporation. All rights reserved. @@ -29,6 +30,12 @@ Device (URT0) { MEMORY32FIXED (ReadWrite, 0, BCM2836_PL011_UART_LENGTH, RMEM) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive) { BCM2836_P= L011_UART_INTERRUPT } + + PinFunction (Exclusive, PullDown, BCM_ALT3, "\\_SB.GDV0.GPI0", 0, Reso= urceConsumer, , ) { 32, 33 } + + // fake the CTS signal as we don't support HW flow control yet + // BCM_ALT2 is set as output (low) by default + PinFunction (Exclusive, PullNone, BCM_ALT2, "\\_SB.GDV0.GPI0", 0, Reso= urceConsumer, , ) { 31 } }) Method (_CRS, 0x0, Serialized) { @@ -101,7 +108,10 @@ Device(BTH0) { Name (RBUF, ResourceTemplate () { - // BT UART: URT0 (PL011) or URTM (miniUART) + // + // BT UART: ResourceSource will be dynamically updated to + // either URT0 (PL011) or URTM (miniUART) during boot + // UARTSerialBus( 115200, // InitialBaudRate: in BPS , // BitsPerByte: default to 8 bits @@ -126,11 +136,7 @@ Device(BTH0) // no flow control. 16, // ReceiveBufferSize 16, // TransmitBufferSize -#if (RPI_MODEL =3D=3D 4) - "\\_SB.GDV0.URTM", // ResourceSource: -#else "\\_SB.GDV0.URT0", // ResourceSource: -#endif // UART bus controller name , // ResourceSourceIndex: assumed to be 0 , // ResourceUsage: assumed to be @@ -142,7 +148,7 @@ Device(BTH0) // // RPIQ connection for BT_ON/OFF // - GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GDV0.RPIQ", = 0, ResourceConsumer, , ) { 128 } + //GpioIO (Shared, PullUp, 0, 0, IoRestrictionNone, "\\_SB.GDV0.RPIQ"= , 0, ResourceConsumer, , ) { 128 } }) Return (RBUF) } diff --git a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c b/Platform/= RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c index 19ef950f10..a0335b0d24 100644 --- a/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c +++ b/Platform/RaspberryPi/Drivers/ConfigDxe/ConfigDxe.c @@ -1,5 +1,6 @@ /** @file * + * Copyright (c) 2021, Sunny Hsuan-Wen Wang * Copyright (c) 2019 - 2020, ARM Limited. All rights reserved. * Copyright (c) 2018 - 2020, Andrei Warkentin * @@ -12,6 +13,9 @@ #include #include #include +#include +#include + #include #include #include @@ -40,6 +44,8 @@ STATIC UINT32 mModelFamily =3D 0; STATIC UINT32 mModelInstalledMB =3D 0; STATIC EFI_MAC_ADDRESS mMacAddress; +BOOLEAN mUsePl011Uart; +BOOLEAN mUseMiniUart; /* * The GUID inside Platform/RaspberryPi/RPi3/AcpiTables/AcpiTables.inf and @@ -689,6 +695,71 @@ UpdateSdtNameOps ( } } +// +// BTH0._HID.BCM2EA6 +// +#define BTH0_HID_PATTERN_LEN 17 + +// +// \_SB.GDV0.URT +// +#define RESOURCE_SOURCE_PATTERN_LEN 13 + +// +// Scan the given namespace table (DSDT/SSDT) for AML NameOps +// listed in the NameOpReplace structure. If one is found then +// update the value in the table from the specified Pcd +// +// This allows us to have conditionals in AML controlled +// by options in the BDS or detected during firmware bootstrap. +// We could extend this concept for strings/etc but due to len +// variations its probably easier to encode the strings +// in the ASL and pick the correct one based off a variable. +// +STATIC +VOID +UpdateDevBth0 ( + EFI_ACPI_DESCRIPTION_HEADER *AcpiTable + ) +{ + UINTN Index; + CHAR8 Bth0HidPattern[BTH0_HID_PATTERN_LEN] =3D {0x42, 0x54, 0x48, 0x30= , 0x08, 0x5F, 0X48, 0x49, 0x44, 0x0D, 0x42, 0x43, 0x4D, 0x32, 0x45, 0x41, 0= x36}; + CHAR8 ResourceSourcePattern[BTH0_HID_PATTERN_LEN] =3D {0x5C, 0x5F, 0x5= 3, 0x42, 0x2E, 0x47, 0X44, 0x56, 0x30, 0x2E, 0x55, 0x52, 0x54}; + BOOLEAN FoundBth0HidPattern; + UINT8 *SdtPtr; + UINT32 SdtSize; + + FoundBth0HidPattern =3D FALSE; + SdtSize =3D AcpiTable->Length; + + if (SdtSize > 0) { + SdtPtr =3D (UINT8 *)AcpiTable; + for (Index =3D 0; Index < (SdtSize - BTH0_HID_PATTERN_LEN); Index++) { + if (!FoundBth0HidPattern) { + if (CompareMem (SdtPtr + Index, Bth0HidPattern, BTH0_HID_PATTERN_L= EN) =3D=3D 0) { + FoundBth0HidPattern =3D TRUE; + } + } else { + if (CompareMem (SdtPtr + Index, ResourceSourcePattern, RESOURCE_SO= URCE_PATTERN_LEN) =3D=3D 0) { + if (mUsePl011Uart) { + // + // Since PL011 has been set as Primary UART, set the last char= in + // ResourceSource string to 'M' (0x4D) so that Mini UART can b= e used as Secondary UART for BlueTooth. + // + SdtPtr[Index + RESOURCE_SOURCE_PATTERN_LEN] =3D 0x4D; + } else if (mUseMiniUart) { + // + // Since Mini UART has been set as Primary UART, set the last = char in + // ResourceSource string to '0' (0x30) so that PL011 can be us= ed as Secondary UART for BlueTooth. + // + SdtPtr[Index + RESOURCE_SOURCE_PATTERN_LEN] =3D 0x30; + } + break; + } + } + } + } +} STATIC BOOLEAN @@ -700,13 +771,22 @@ VerifyUpdateTable ( BOOLEAN Result; Result =3D TRUE; - if (SdtTable->PcdToken && !LibPcdGet32 (SdtTable->PcdToken)) { - Result =3D FALSE; - } + if (Result && SdtTable->SdtNameOpReplace) { - UpdateSdtNameOps (AcpiHeader, SdtTable->SdtNameOpReplace); + if (SdtTable->PcdToken && LibPcdGet32 (SdtTable->PcdToken)) { + UpdateSdtNameOps (AcpiHeader, SdtTable->SdtNameOpReplace); + } else { + // + // PcdToken and PCD value are invalid or setting is disabled, so + // no need to update and report the SSDT. + // + return FALSE; + } } + if (AcpiHeader->Signature =3D=3D SIGNATURE_32 ('D', 'S', 'D', 'T')) { + UpdateDevBth0 (AcpiHeader); + } return Result; } @@ -744,8 +824,14 @@ HandleDynamicNamespace ( { UINTN Tables; + EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE *SpcrTable; + DBG2_TABLE *Dbg2Table; + switch (AcpiHeader->Signature) { case SIGNATURE_32 ('D', 'S', 'D', 'T'): + UpdateDevBth0 (AcpiHeader); + return TRUE; + case SIGNATURE_32 ('S', 'S', 'D', 'T'): for (Tables =3D 0; SdtTables[Tables].OemTableId; Tables++) { if (AcpiHeader->OemTableId =3D=3D SdtTables[Tables].OemTableId) { @@ -753,8 +839,30 @@ HandleDynamicNamespace ( } } DEBUG ((DEBUG_ERROR, "Found namespace table not in table list.\n")); - return FALSE; + + case SIGNATURE_32 ('S', 'P', 'C', 'R'): + SpcrTable =3D (EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE *)AcpiHe= ader; + if (mUsePl011Uart && (SpcrTable->InterfaceType =3D=3D EFI_ACPI_SERIAL_= PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART)) { + return TRUE; + } else if (mUseMiniUart && (SpcrTable->InterfaceType =3D=3D EFI_ACPI_S= ERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_BCM2835_UART)) { + return TRUE; + } else { + return FALSE; + } + + return TRUE; + + case SIGNATURE_32 ('D', 'B', 'G', '2'): + Dbg2Table =3D (DBG2_TABLE *)AcpiHeader; + if (mUsePl011Uart && (Dbg2Table->Dbg2DeviceInfo[0].Dbg2Device.PortSubt= ype =3D=3D EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART)) { + return TRUE; + } else if (mUseMiniUart && (Dbg2Table->Dbg2DeviceInfo[0].Dbg2Device.Po= rtSubtype =3D=3D EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_BCM2835_UART)) { + return TRUE; + } else { + return FALSE; + } + return TRUE; } return TRUE; @@ -771,6 +879,11 @@ ConfigInitialize ( EFI_STATUS Status; EFI_EVENT EndOfDxeEvent; + mUsePl011Uart =3D 0; + mUseMiniUart =3D 0; + mUsePl011Uart =3D ((MmioRead32(GPIO_BASE_ADDRESS + 4) & 0x0003F000) =3D= =3D 0x00024000); + mUseMiniUart =3D ((MmioRead32(GPIO_BASE_ADDRESS + 4) & 0x0003F000) =3D= =3D 0x00012000); + Status =3D gBS->LocateProtocol (&gRaspberryPiFirmwareProtocolGuid, NULL, (VOID**)&mFwProtocol); ASSERT_EFI_ERROR (Status); diff --git a/Platform/RaspberryPi/Include/IndustryStandard/RpiDebugPort2Tab= le.h b/Platform/RaspberryPi/Include/IndustryStandard/RpiDebugPort2Table.h new file mode 100644 index 0000000000..41038e8cce --- /dev/null +++ b/Platform/RaspberryPi/Include/IndustryStandard/RpiDebugPort2Table.h @@ -0,0 +1,33 @@ +/** @file + + Copyright (c) 2021, Sunny Hsuan-Wen Wang + + SPDX-License-Identifier: BSD-2-Clause-Patent + + **/ +#ifndef __RPI_DEBUG_PORT_2_H__ +#define __RPI_DEBUG_PORT_2_H__ + +#include + +#define RPI_DBG2_NUM_DEBUG_PORTS 1 +#define RPI_DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS 1 +#define RPI_DBG2_NAMESPACESTRING_FIELD_SIZE 15 + +#pragma pack(1) + + +typedef struct { + EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT Dbg2Device; + EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE BaseAddressRegiste= r; + UINT32 AddressSize; + UINT8 NameSpaceString[RP= I_DBG2_NAMESPACESTRING_FIELD_SIZE]; +} DBG2_DEBUG_DEVICE_INFORMATION; + +typedef struct { + EFI_ACPI_DEBUG_PORT_2_DESCRIPTION_TABLE Description; + DBG2_DEBUG_DEVICE_INFORMATION Dbg2DeviceInfo[RPI= _DBG2_NUM_DEBUG_PORTS]; +} DBG2_TABLE; + +#pragma pack() +#endif //__RPI_DEBUG_PORT_2_H__ \ No newline at end of file -- 2.30.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#72539): https://edk2.groups.io/g/devel/message/72539 Mute This Topic: https://groups.io/mt/81178450/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-