[edk2-devel] [PATCH v1 2/2] DynamicTablesPkg: Add an override for 16550 HID in SSDT
Samer El-Haj-Mahmoud
samer.el-haj-mahmoud at arm.com
Wed Jan 20 18:27:38 UTC 2021
> -----Original Message-----
> From: Joey Gouly <joey.gouly at arm.com>
> Sent: Wednesday, January 20, 2021 1:20 PM
> To: devel at edk2.groups.io
> Cc: Joey Gouly <Joey.Gouly at arm.com>; ardb+tianocore at kernel.org; Sami
> Mujawar <Sami.Mujawar at arm.com>; Jeff Brasen (jbrasen at nvidia.com)
> <jbrasen at nvidia.com>; ipark at nvidia.com; Samer El-Haj-Mahmoud
> <Samer.El-Haj-Mahmoud at arm.com>; nd <nd at arm.com>
> Subject: [PATCH v1 2/2] DynamicTablesPkg: Add an override for 16550 HID in
> SSDT
>
> Some platforms advertise support for a 16550 UART, but are not compatible
> with the PNP0500 HID. Allow them to override the HID by setting
> PcdNonSbsaCompliantSerialHid.
>
> Signed-off-by: Joey Gouly <joey.gouly at arm.com>
> ---
> DynamicTablesPkg/DynamicTablesPkg.dec | 3 +++
>
> DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFix
> upLib.inf | 4 +++-
>
> DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFix
> upLib.c | 14 +++++++++++---
> 3 files changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec
> b/DynamicTablesPkg/DynamicTablesPkg.dec
> index
> 291a45a69679ae82219ecd2f26dfabfbab1f7f65..3ec4fff116a8f538be331edf34
> 1867948c025116 100644
> --- a/DynamicTablesPkg/DynamicTablesPkg.dec
> +++ b/DynamicTablesPkg/DynamicTablesPkg.dec
> @@ -44,5 +44,8 @@ [PcdsFixedAtBuild]
> # Maximum number of Custom DT Generators
>
> gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdMaxCustomDTGenerators|1|UI
> NT16|0xC0000003
>
> + # Non SBSA Compliant Serial HID
> +
> +
> gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonSbsaCompliantSerialHid|""|
> V
> + OID*|0x40000008
> +
> [Guids]
> gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613, {
> 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } } diff --git
> a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.inf
> b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.inf
> index
> af3d404393f5f1385ab2d40f45f7222ab66f9b3a..b64825982e8fb7aaf78f3fd68
> 992e1c78d20c408 100644
> ---
> a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.inf
> +++
> b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialP
> +++ ortFixupLib.inf
> @@ -1,7 +1,7 @@
> ## @file
> # SSDT Serial Port fixup Library
> #
> -# Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
> +# Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
> #
> # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -28,3 +28,5 @@
> [LibraryClasses]
> AmlLib
> BaseLib
>
> +[Pcd]
> + gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonSbsaCompliantSerialHid
> diff --git
> a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.c
> b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.c
> index
> 0ff071485ef25f4ca63de0eeab5120d1beece4db..73a8087ed8a8ff84b64531a3c
> 73d319585dfb6cf 100644
> ---
> a/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPort
> FixupLib.c
> +++
> b/DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialP
> +++ ortFixupLib.c
> @@ -1,7 +1,7 @@
> /** @file
> SSDT Serial Port Fixup Library.
>
> - Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
> + Copyright (c) 2019 - 2021, Arm Limited. All rights reserved.<BR>
>
> SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -139,13 +139,21 @@ FixupIds (
> AML_OBJECT_NODE_HANDLE NameOpIdNode;
> CONST CHAR8 * HidString;
> CONST CHAR8 * CidString;
> + CONST CHAR8 * NonSbsaHid;
>
> // Get the _CID and _HID value to write.
> switch (SerialPortInfo->PortSubtype) {
> case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550:
> {
> - HidString = "PNP0501";
> - CidString = "PNP0500";
> + // If there is a non-SBSA compliant HID, use that.
> + NonSbsaHid = (CONST CHAR8*)PcdGetPtr
> (PcdNonSbsaCompliantSerialHid);
> + if ((NonSbsaHid != NULL) && (AsciiStrLen (NonSbsaHid) != 0)) {
> + HidString = NonSbsaHid;
> + CidString = "";
> + } else {
> + HidString = "PNP0501";
> + CidString = "PNP0500";
> + }
> break;
> }
> case EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_ARM_PL011_UART:
> --
Since you are using PcdNonSbsaCompliantSerialHid to indicate that this is a non-BSA compliant 16550 UART, maybe rename the PCD to reflect that? The name PcdNonSbsaCompliantSerialHid may imply that this is not a PL011/ Arm SBSA Generic UART. BSA 1.0 allows both PL011/Generic UART (the definition moved from SBSA spec to the BSA spec) OR a 16550 standard UART. In this case, we are saying the UART is a 16550-like UART, but not exactly standard (i.e. do not use the standard 16550 IDs)
Maybe PcdNon16550CompliantSerialHid or PcdNonBsa16550CompliantSerialHid is a better name that matches what the code is doing?
The comments will need to change as well.
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70592): https://edk2.groups.io/g/devel/message/70592
Mute This Topic: https://groups.io/mt/79984773/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list