4 Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
8 - Microsoft Serial Port Console Redirection Table
9 Specification - Version 1.03 - August 10, 2015.
12 #include <IndustryStandard/Acpi.h>
13 #include <IndustryStandard/SerialPortConsoleRedirectionTable.h>
14 #include <Library/UefiLib.h>
15 #include "AcpiParser.h"
16 #include "AcpiTableParser.h"
19 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo
;
22 This function validates the Interrupt Type.
24 @param [in] Ptr Pointer to the start of the field data.
25 @param [in] Context Pointer to context specific information e.g. this
26 could be a pointer to the ACPI table header.
31 ValidateInterruptType (
37 This function validates the Irq.
39 @param [in] Ptr Pointer to the start of the field data.
40 @param [in] Context Pointer to context specific information e.g. this
41 could be a pointer to the ACPI table header.
52 An ACPI_PARSER array describing the ACPI SPCR Table.
54 STATIC CONST ACPI_PARSER SpcrParser
[] = {
55 PARSE_ACPI_HEADER (&AcpiHdrInfo
),
56 {L
"Interface Type", 1, 36, L
"%d", NULL
, NULL
, NULL
, NULL
},
57 {L
"Reserved", 3, 37, L
"%x %x %x", Dump3Chars
, NULL
, NULL
, NULL
},
58 {L
"Base Address", 12, 40, NULL
, DumpGas
, NULL
, NULL
, NULL
},
59 {L
"Interrupt Type", 1, 52, L
"%d", NULL
, NULL
, ValidateInterruptType
, NULL
},
60 {L
"IRQ", 1, 53, L
"%d", NULL
, NULL
, ValidateIrq
, NULL
},
61 {L
"Global System Interrupt", 4, 54, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
62 {L
"Baud Rate", 1, 58, L
"%d", NULL
, NULL
, NULL
, NULL
},
63 {L
"Parity", 1, 59, L
"%d", NULL
, NULL
, NULL
, NULL
},
64 {L
"Stop Bits", 1, 60, L
"%d", NULL
, NULL
, NULL
, NULL
},
65 {L
"Flow Control", 1, 61, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
66 {L
"Terminal Type", 1, 62, L
"%d", NULL
, NULL
, NULL
, NULL
},
67 {L
"Reserved", 1, 63, L
"%x", NULL
, NULL
, NULL
, NULL
},
69 {L
"PCI Device ID", 2, 64, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
70 {L
"PCI Vendor ID", 2, 66, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
71 {L
"PCI Bus Number", 1, 68, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
72 {L
"PCI Device Number", 1, 69, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
73 {L
"PCI Function Number", 1, 70, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
74 {L
"PCI Flags", 4, 71, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
75 {L
"PCI Segment", 1, 75, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
76 {L
"Reserved", 4, 76, L
"%x", NULL
, NULL
, NULL
, NULL
}
80 This function validates the Interrupt Type.
82 @param [in] Ptr Pointer to the start of the field data.
83 @param [in] Context Pointer to context specific information e.g. this
84 could be a pointer to the ACPI table header.
89 ValidateInterruptType (
94 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
100 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC
) {
101 IncrementErrorCount ();
103 L
"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms",
111 This function validates the Irq.
113 @param [in] Ptr Pointer to the start of the field data.
114 @param [in] Context Pointer to context specific information e.g. this
115 could be a pointer to the ACPI table header.
125 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
131 IncrementErrorCount ();
133 L
"\nERROR: Irq = %d. This must be zero on ARM Platforms\n",
141 This function parses the ACPI SPCR table.
142 When trace is enabled this function parses the SPCR table and
143 traces the ACPI table fields.
145 This function also performs validations of the ACPI table fields.
147 @param [in] Trace If TRUE, trace the ACPI fields.
148 @param [in] Ptr Pointer to the start of the buffer.
149 @param [in] AcpiTableLength Length of the ACPI table.
150 @param [in] AcpiTableRevision Revision of the ACPI table.
157 IN UINT32 AcpiTableLength
,
158 IN UINT8 AcpiTableRevision
172 PARSER_PARAMS (SpcrParser
)