Jonathan Zhang | 6d27778 | 2020-06-09 17:56:53 -0700 | [diff] [blame] | 1 | /** @file |
| 2 | ACPI Serial Port Console Redirection Table as defined by Microsoft in |
| 3 | http://www.microsoft.com/whdc/system/platform/server/spcr.mspx |
| 4 | |
| 5 | Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> |
| 6 | (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> |
| 7 | Copyright (c) 2014 - 2016, ARM Limited. All rights reserved.<BR> |
| 8 | SPDX-License-Identifier: BSD-2-Clause-Patent |
| 9 | **/ |
| 10 | |
| 11 | #ifndef _SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_H_ |
| 12 | #define _SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_H_ |
| 13 | |
| 14 | |
| 15 | #include <IndustryStandard/Acpi.h> |
| 16 | |
| 17 | // |
| 18 | // Ensure proper structure formats |
| 19 | // |
| 20 | #pragma pack(1) |
| 21 | |
| 22 | /// |
| 23 | /// SPCR Revision (defined in spec) |
| 24 | /// |
| 25 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION 0x02 |
| 26 | |
| 27 | /// |
| 28 | /// Serial Port Console Redirection Table Format |
| 29 | /// |
| 30 | typedef struct { |
| 31 | EFI_ACPI_DESCRIPTION_HEADER Header; |
| 32 | UINT8 InterfaceType; |
| 33 | UINT8 Reserved1[3]; |
| 34 | EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE BaseAddress; |
| 35 | UINT8 InterruptType; |
| 36 | UINT8 Irq; |
| 37 | UINT32 GlobalSystemInterrupt; |
| 38 | UINT8 BaudRate; |
| 39 | UINT8 Parity; |
| 40 | UINT8 StopBits; |
| 41 | UINT8 FlowControl; |
| 42 | UINT8 TerminalType; |
| 43 | UINT8 Reserved2; |
| 44 | UINT16 PciDeviceId; |
| 45 | UINT16 PciVendorId; |
| 46 | UINT8 PciBusNumber; |
| 47 | UINT8 PciDeviceNumber; |
| 48 | UINT8 PciFunctionNumber; |
| 49 | UINT32 PciFlags; |
| 50 | UINT8 PciSegment; |
| 51 | UINT32 Reserved3; |
| 52 | } EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE; |
| 53 | |
| 54 | #pragma pack() |
| 55 | |
| 56 | // |
| 57 | // SPCR Definitions |
| 58 | // |
| 59 | |
| 60 | // |
| 61 | // Interface Type |
| 62 | // |
| 63 | |
| 64 | /// |
| 65 | /// Full 16550 interface |
| 66 | /// |
| 67 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_16550 0 |
| 68 | /// |
| 69 | /// Full 16450 interface |
| 70 | /// |
| 71 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_16450 1 |
| 72 | |
| 73 | |
| 74 | // |
| 75 | // The Serial Port Subtypes for ARM are documented in Table 3 of the DBG2 Specification |
| 76 | // |
| 77 | |
| 78 | /// |
| 79 | /// ARM PL011 UART |
| 80 | /// |
| 81 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART 0x03 |
| 82 | |
| 83 | /// |
| 84 | /// ARM SBSA Generic UART (2.x) supporting 32-bit only accesses [deprecated] |
| 85 | /// |
| 86 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_SBSA_GENERIC_UART_2X 0x0d |
| 87 | |
| 88 | /// |
| 89 | /// ARM SBSA Generic UART |
| 90 | /// |
| 91 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_SBSA_GENERIC_UART 0x0e |
| 92 | |
| 93 | /// |
| 94 | /// ARM DCC |
| 95 | /// |
| 96 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_DCC 0x0f |
| 97 | |
| 98 | /// |
| 99 | /// BCM2835 UART |
| 100 | /// |
| 101 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_BCM2835_UART 0x10 |
| 102 | |
| 103 | // |
| 104 | // Interrupt Type |
| 105 | // |
| 106 | |
| 107 | /// |
| 108 | /// PC-AT-compatible dual-8259 IRQ interrupt |
| 109 | /// |
| 110 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_8259 0x1 |
| 111 | /// |
| 112 | /// I/O APIC interrupt (Global System Interrupt) |
| 113 | /// |
| 114 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_APIC 0x2 |
| 115 | /// |
| 116 | /// I/O SAPIC interrupt (Global System Interrupt) |
| 117 | /// |
| 118 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_SAPIC 0x4 |
| 119 | /// |
| 120 | /// ARMH GIC interrupt (Global System Interrupt) |
| 121 | /// |
| 122 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC 0x8 |
| 123 | |
| 124 | // |
| 125 | // Baud Rate |
| 126 | // |
| 127 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_9600 3 |
| 128 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_19200 4 |
| 129 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_57600 6 |
| 130 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200 7 |
| 131 | |
| 132 | // |
| 133 | // Parity |
| 134 | // |
| 135 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY 0 |
| 136 | |
| 137 | // |
| 138 | // Stop Bits |
| 139 | // |
| 140 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1 1 |
| 141 | |
| 142 | // |
| 143 | // Flow Control |
| 144 | // |
| 145 | |
| 146 | /// |
| 147 | /// DCD required for transmit |
| 148 | /// |
| 149 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_FLOW_CONTROL_DCD 0x1 |
| 150 | /// |
| 151 | /// RTS/CTS hardware flow control |
| 152 | /// |
| 153 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_FLOW_CONTROL_RTS_CTS 0x2 |
| 154 | /// |
| 155 | /// XON/XOFF software control |
| 156 | /// |
| 157 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_FLOW_CONTROL_XON_XOFF 0x4 |
| 158 | |
| 159 | // |
| 160 | // Terminal Type |
| 161 | // |
| 162 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_VT100 0 |
| 163 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_VT100_PLUS 1 |
| 164 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_VT_UTF8 2 |
| 165 | #define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_ANSI 3 |
| 166 | |
| 167 | #endif |