4 Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 - Microsoft Serial Port Console Redirection Table
15 Specification - Version 1.03 - August 10, 2015.
18 #include <IndustryStandard/Acpi.h>
19 #include <IndustryStandard/SerialPortConsoleRedirectionTable.h>
20 #include <Library/UefiLib.h>
21 #include "AcpiParser.h"
22 #include "AcpiTableParser.h"
25 STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo
;
28 This function validates the Interrupt Type.
30 @param [in] Ptr Pointer to the start of the field data.
31 @param [in] Context Pointer to context specific information e.g. this
32 could be a pointer to the ACPI table header.
37 ValidateInterruptType (
43 This function validates the Irq.
45 @param [in] Ptr Pointer to the start of the field data.
46 @param [in] Context Pointer to context specific information e.g. this
47 could be a pointer to the ACPI table header.
58 An ACPI_PARSER array describing the ACPI SPCR Table.
60 STATIC CONST ACPI_PARSER SpcrParser
[] = {
61 PARSE_ACPI_HEADER (&AcpiHdrInfo
),
62 {L
"Interface Type", 1, 36, L
"%d", NULL
, NULL
, NULL
, NULL
},
63 {L
"Reserved", 3, 37, L
"%x %x %x", Dump3Chars
, NULL
, NULL
, NULL
},
64 {L
"Base Address", 12, 40, NULL
, DumpGas
, NULL
, NULL
, NULL
},
65 {L
"Interrupt Type", 1, 52, L
"%d", NULL
, NULL
, ValidateInterruptType
, NULL
},
66 {L
"IRQ", 1, 53, L
"%d", NULL
, NULL
, ValidateIrq
, NULL
},
67 {L
"Global System Interrupt", 4, 54, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
68 {L
"Baud Rate", 1, 58, L
"%d", NULL
, NULL
, NULL
, NULL
},
69 {L
"Parity", 1, 59, L
"%d", NULL
, NULL
, NULL
, NULL
},
70 {L
"Stop Bits", 1, 60, L
"%d", NULL
, NULL
, NULL
, NULL
},
71 {L
"Flow Control", 1, 61, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
72 {L
"Terminal Type", 1, 62, L
"%d", NULL
, NULL
, NULL
, NULL
},
73 {L
"Reserved", 1, 63, L
"%x", NULL
, NULL
, NULL
, NULL
},
75 {L
"PCI Device ID", 2, 64, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
76 {L
"PCI Vendor ID", 2, 66, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
77 {L
"PCI Bus Number", 1, 68, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
78 {L
"PCI Device Number", 1, 69, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
79 {L
"PCI Function Number", 1, 70, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
80 {L
"PCI Flags", 4, 71, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
81 {L
"PCI Segment", 1, 75, L
"0x%x", NULL
, NULL
, NULL
, NULL
},
82 {L
"Reserved", 4, 76, L
"%x", NULL
, NULL
, NULL
, NULL
}
86 This function validates the Interrupt Type.
88 @param [in] Ptr Pointer to the start of the field data.
89 @param [in] Context Pointer to context specific information e.g. this
90 could be a pointer to the ACPI table header.
95 ValidateInterruptType (
100 #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64)
101 UINT8 InterruptType
= *Ptr
;
103 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC
) {
104 IncrementErrorCount ();
106 L
"\nERROR: InterruptType = %d. This must be 8 on ARM Platforms",
114 This function validates the Irq.
116 @param [in] Ptr Pointer to the start of the field data.
117 @param [in] Context Pointer to context specific information e.g. this
118 could be a pointer to the ACPI table header.
128 #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
)