Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the SPCR table to version 4 and added RISC-V debug subtype to DBG2 #931

Merged
merged 2 commits into from
Mar 26, 2024

Conversation

david-sia
Copy link

Updated the SPCR Table to ver 4 to support:

  • RISC-V SBI
  • Precise Baud Rate
  • NamespaceStringLength
  • NamespaceStringOffset
  • NamespaceString

Additionally, RISC-V debug subtype is added to DBG2 header.

@david-sia
Copy link
Author

Hi @sacdintel,

Could you please help to review this patch?

Thanks,
Jee Heng

@xiaobo55x
Copy link
Contributor

LGTM!

{ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Reserved2), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (ClkFreq), "Uart Clock Freq", 0},
{ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (PreciseBaudrate), "Precise Baud rate", 0},
{ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (NameSpaceLength), "Length of NameSpaceString", 0},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the field name exactly as in the spec? Like NamespaceStringLength instead of "Length of NameSpaceString"?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will follow the field name.

@@ -1896,7 +1896,7 @@ const unsigned char TemplateSlit[] =

const unsigned char TemplateSpcr[] =
{
0x53,0x50,0x43,0x52,0x50,0x00,0x00,0x00, /* 00000000 "SPCRP..." */
0x53,0x50,0x43,0x52,0x5A,0x00,0x00,0x00, /* 00000000 "SPCRZ..." */
0x01,0xE3,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to update the revision and checksum as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted. will do

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vlsunil for the review, I will take a look as well next week once those suggestions have been taken, thanks!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't forget to update the template too once all the changes are made!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @xiaobo55x , @vlsunil , @sacdintel ,

I have updated the code. Please help to review again. Thanks.

Sia Jee Heng added 2 commits March 24, 2024 20:05
The Microsoft Serial Port Console Redirection (SPCR) specification
revision 1.09 comprises additional fields [1]. The newly added fields
are:
- RISC-V SBI
- Precise Baud Rate
- NamespaceStringLength
- NamespaceStringOffset
- NamespaceString

Additionaly, this code will support up to SPCR revision 1.10, as it
includes only minor wording changes.

[1] https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table

Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
Include the RISC-V SBI debugging subtype as documented in DBG2
dated April 10, 2023 [1].

[1] https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debug-port-table

Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
Copy link
Contributor

@vlsunil vlsunil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Thanks,
Reviewed-by: Sunil V L sunilvl@ventanamicro.com

@sacdintel
Copy link
Collaborator

Thanks @vlsunil and @xiaobo55x for the review! LGTM now and thanks for rebasing it on top of the new release as well, great open source software contribution etiquettes!

@sacdintel sacdintel merged commit 47a1c3e into acpica:master Mar 26, 2024
patchew-importer pushed a commit to patchew-project/qemu that referenced this pull request May 2, 2024
Update the virt SPCR golden reference files to accommodate the
SPCR Table version 4 [1], utilizing the iasl binary compiled from the
latest ACPICA repository [2]. The SPCR table has been modified to
adhere to the version 4 format [3].

[1]: https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table
[2]: https://github.com/acpica/acpica
[3]: acpica/acpica#931

Diffs from iasl:
@@ -1,32 +1,32 @@
 /*
  * Intel ACPI Component Architecture
  * AML/ASL+ Disassembler version 20240322 (64-bit version)
  * Copyright (c) 2000 - 2023 Intel Corporation
  *
- * Disassembly of tests/data/acpi/virt/SPCR
+ * Disassembly of /tmp/aml-HJ5IN2
  *
  * ACPI Data Table [SPCR]
  *
  * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue (in hex)
  */

 [000h 0000 004h]                   Signature : "SPCR"    [Serial Port Console Redirection Table]
-[004h 0004 004h]                Table Length : 00000050
-[008h 0008 001h]                    Revision : 02
-[009h 0009 001h]                    Checksum : B1
+[004h 0004 004h]                Table Length : 0000005A
+[008h 0008 001h]                    Revision : 04
+[009h 0009 001h]                    Checksum : 1D
 [00Ah 0010 006h]                      Oem ID : "BOCHS "
 [010h 0016 008h]                Oem Table ID : "BXPC    "
 [018h 0024 004h]                Oem Revision : 00000001
 [01Ch 0028 004h]             Asl Compiler ID : "BXPC"
 [020h 0032 004h]       Asl Compiler Revision : 00000001

 [024h 0036 001h]              Interface Type : 03
 [025h 0037 003h]                    Reserved : 000000

 [028h 0040 00Ch]        Serial Port Register : [Generic Address Structure]
 [028h 0040 001h]                    Space ID : 00 [SystemMemory]
 [029h 0041 001h]                   Bit Width : 20
 [02Ah 0042 001h]                  Bit Offset : 00
 [02Bh 0043 001h]        Encoded Access Width : 03 [DWord Access:32]
 [02Ch 0044 008h]                     Address : 0000000009000000
@@ -34,18 +34,29 @@
 [035h 0053 001h]         PCAT-compatible IRQ : 00
 [036h 0054 004h]                   Interrupt : 00000021
 [03Ah 0058 001h]                   Baud Rate : 03
 [03Bh 0059 001h]                      Parity : 00
 [03Ch 0060 001h]                   Stop Bits : 01
 [03Dh 0061 001h]                Flow Control : 02
 [03Eh 0062 001h]               Terminal Type : 00
 [03Fh 0063 001h]                    Language : 00
 [040h 0064 002h]               PCI Device ID : FFFF
 [042h 0066 002h]               PCI Vendor ID : FFFF
 [044h 0068 001h]                     PCI Bus : 00
 [045h 0069 001h]                  PCI Device : 00
 [046h 0070 001h]                PCI Function : 00
 [047h 0071 004h]                   PCI Flags : 00000000
 [04Bh 0075 001h]                 PCI Segment : 00
 [04Ch 0076 004h]             Uart Clock Freq : 00000000
-/**** ACPI table terminates in the middle of a data structure! (dump table)
-CurrentOffset: 50, TableLength: 50 ***/
\ No newline at end of file
+[050h 0080 004h]           Precise Baud rate : 00000000
+[054h 0084 002h]       NameSpaceStringLength : 0002
+[056h 0086 002h]       NameSpaceStringOffset : 0058
+[058h 0088 002h]             NamespaceString : "."
+
+Raw Table Data: Length 90 (0x5A)
+
+    0000: 53 50 43 52 5A 00 00 00 04 1D 42 4F 43 48 53 20  // SPCRZ.....BOCHS
+    0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43  // BXPC    ....BXPC
+    0020: 01 00 00 00 03 00 00 00 00 20 00 03 00 00 00 09  // ......... ......
+    0030: 00 00 00 00 08 00 21 00 00 00 03 00 01 02 00 00  // ......!.........
+    0040: FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00  // ................
+    0050: 00 00 00 00 02 00 58 00 2E 00                    // ......X...

Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
Message-Id: <20240502051233.50749-2-jeeheng.sia@starfivetech.com>
patchew-importer pushed a commit to patchew-project/qemu that referenced this pull request May 2, 2024
Update the SPCR table to accommodate the SPCR Table version 4 [1].
The SPCR table has been modified to adhere to the version 4 format [2].

[1]: https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table
[2]: acpica/acpica#931

Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
Message-Id: <20240502051233.50749-3-jeeheng.sia@starfivetech.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants