From: "PierreGondois" <pierre.gondois@arm.com>
To: Sami Mujawar <sami.mujawar@arm.com>, devel@edk2.groups.io
Cc: nd <nd@arm.com>
Subject: Re: [PATCH v1 06/14] DynamicTablesPkg: FdtHwInfoParser: Add Serial port parser
Date: Thu, 18 Nov 2021 10:11:02 +0000 [thread overview]
Message-ID: <149839da-fb4f-3004-92d4-1122e64bce7b@arm.com> (raw)
In-Reply-To: <0dfa3844-5e72-6430-10bb-da310ec739fc@arm.com>
Hi Sami,
Please find my answer inlined:
On 11/5/21 14:27, Sami Mujawar wrote:
>
> Hi Pierre,
>
> Please find my response inline marked [SAMI].
>
> Regards,
>
> Sami Mujawar
>
>
> On 23/06/2021 01:38 PM, Pierre.Gondois@arm.com wrote:
>> From: Pierre Gondois <Pierre.Gondois@arm.com>
>>
>> The Microsoft Debug Port Table 2 (DBG2), the Serial Port Console
>> Redirector (SPCR) table are mandatory tables required for booting
>> a standards-based operating system. The DBG2 table is used by the
>> OS debugger while the SPCR table is used to configure the serial
>> terminal. Additionally, the serial ports available on a platform
>> for generic use also need to be described in DSDT/SSDT for an OS
>> to be able to use the serial ports.
>>
>> The Arm Base System Architecture 1.0 specification a lists of
>> supported serial port hardware for Arm Platforms. This list
>> includes the following serial port UARTs:
>> - SBSA/Generic UART
>> - a fully 16550 compatible UART.
>> Along, with these the PL011 UART is the most commonly used serial
>> port hardware on Arm platforms.
>>
>> The serial port hardware information is described in the platform
>> Device Tree, the bindings for which can be found at:
>> - linux/Documentation/devicetree/bindings/serial/serial.yaml
>> - linux/Documentation/devicetree/bindings/serial/8250.txt
>> - linux/Documentation/devicetree/bindings/serial/arm_sbsa_uart.txt
>> - linux/Documentation/devicetree/bindings/serial/pl011.yaml
>>
>> The FdtHwInfoParser implements a Serial Port Parser that parses
>> the platform Device Tree to create CM_ARM_SERIAL_PORT_INFO objects
>> with the following IDs:
>> - EArmObjSerialConsolePortInfo (for use by SPCR)
>> - EArmObjSerialDebugPortInfo (for use by DBG2)
>> - EArmObjSerialPortInfo (for use as generic Serial Ports)
>>
>> The Serial Port for use by SPCR is selected by parsing the Device
>> Tree for the '/chosen' node with the 'stdout-path' property. The
>> next Serial Port is selected for use as the Debug Serial Port and
>> the remaining serial ports are used as generic serial ports.
>>
>> The CM_ARM_SERIAL_PORT_INFO objects are encapsulated in Configuration
>> Manager descriptor objects with the respective IDs and are added to
>> the platform information repository.
>>
>> The platform Configuration Manager can then utilise this information
>> when generating the DBG2, SPCR and the SSDT serial port tables.
>>
>> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
>> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
>> ---
>> .../Serial/ArmSerialPortParser.c | 621 ++++++++++++++++++
>> .../Serial/ArmSerialPortParser.h | 47 ++
>> 2 files changed, 668 insertions(+)
>> create mode 100644 DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/ArmSerialPortParser.c
>> create mode 100644 DynamicTablesPkg/Library/FdtHwInfoParserLib/Serial/ArmSerialPortParser.h
[snip]
>> +
>> + SerialPortInfo->Interrupt = FdtGetInterruptId ((CONST UINT32*)Data);
>> +
>> + // Note: clock-frequency is optional for SBSA UART.
>> + Data = fdt_getprop (Fdt, SerialPortNode, "clock-frequency", &DataSize);
>> + if (Data != NULL) {
>> + if (DataSize < sizeof (UINT32)) {
>> + // If error or not enough space.
>> + ASSERT (0);
>> + return EFI_ABORTED;
>> + } else if (fdt_node_offset_by_phandle (Fdt, fdt32_to_cpu (*Data)) >= 0) {
>> + // "clock-frequency" can be a "clocks phandle to refer to the clk used".
>> + // This is not supported.
>> + ASSERT (0);
>> + return EFI_UNSUPPORTED;
>> + }
>> + SerialPortInfo->Clock = fdt32_to_cpu (*(UINT32*)Data);
>> + }
>> +
>> + if (FdtNodeIsCompatible (Fdt, SerialPortNode, &Serial16550CompatibleInfo)) {
>> + SerialPortInfo->PortSubtype = EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550;
> [SAMI] I think this needs to be set
> toEFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_16550_WITH_GAS.
[Pierre] From what I can found,the
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_16550_WITH_GAS has only been added
recently in the edk2 and linux. I didn't find to what is correspond. In
the DynamicTablesPkg, we are generating the
EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_FULL_16550 id. So I think we should
keep the non-GAS id.
>> +
>> + /* reg-io-width:
>> + description: |
>> + The size (in bytes) of the IO accesses that should be performed on the
>> + device. There are some systems that require 32-bit accesses to the
>> + UART.
>> + */
>> + Data = fdt_getprop (Fdt, SerialPortNode, "reg-io-width", &DataSize);
>> + if (Data != NULL) {
>> + if (DataSize < sizeof (UINT32)) {
>> + // If error or not enough space.
>> + ASSERT (0);
>> + return EFI_ABORTED;
>> + }
>>
>>
next prev parent reply other threads:[~2021-11-18 10:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-23 12:38 [PATCH v1 00/14] Implement a FdtHwInfoParserLib PierreGondois
2021-06-23 12:38 ` [PATCH v1 01/14] DynamicTablesPkg: Definition for HwInfoParser interface PierreGondois
2021-06-23 12:38 ` [PATCH v1 02/14] DynamicTablesPkg: FdtHwInfoParser: CM Object descriptor helper PierreGondois
2021-11-05 14:27 ` Sami Mujawar
2021-06-23 12:38 ` [PATCH v1 03/14] DynamicTablesPkg: FdtHwInfoParser: Add FDT utility functions PierreGondois
2021-11-05 14:27 ` Sami Mujawar
2021-06-23 12:38 ` [PATCH v1 04/14] DynamicTablesPkg: FdtHwInfoParser: Add Boot Arch parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 05/14] DynamicTablesPkg: FdtHwInfoParser: Generic Timer Parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 06/14] DynamicTablesPkg: FdtHwInfoParser: Add Serial port parser PierreGondois
2021-11-05 14:27 ` Sami Mujawar
2021-11-18 10:11 ` PierreGondois [this message]
2021-06-23 12:38 ` [PATCH v1 07/14] DynamicTablesPkg: FdtHwInfoParser: Add GICC parser PierreGondois
2021-11-05 14:28 ` Sami Mujawar
2021-06-23 12:38 ` [PATCH v1 08/14] DynamicTablesPkg: FdtHwInfoParser: Add GICD parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 09/14] DynamicTablesPkg: FdtHwInfoParser: Add MSI Frame parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 10/14] DynamicTablesPkg: FdtHwInfoParser: Add ITS parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 11/14] DynamicTablesPkg: FdtHwInfoParser: Add GICR parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 12/14] DynamicTablesPkg: FdtHwInfoParser: Add GIC dispatcher PierreGondois
2021-06-23 12:38 ` [PATCH v1 13/14] DynamicTablesPkg: FdtHwInfoParser: Add PCI config parser PierreGondois
2021-06-23 12:38 ` [PATCH v1 14/14] DynamicTablesPkg: Add FdtHwInfoParser library PierreGondois
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=149839da-fb4f-3004-92d4-1122e64bce7b@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox