48#define NAME_STR_SPCR_PORT "COM1"
52#define UID_SPCR_PORT 1
56#define SPCR_FLOW_CONTROL_NONE 0
71 EFI_ACPI_RESERVED_BYTE,
72 EFI_ACPI_RESERVED_BYTE,
73 EFI_ACPI_RESERVED_BYTE
80 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY,
81 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1,
83 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_ANSI,
84 EFI_ACPI_RESERVED_BYTE,
92 EFI_ACPI_RESERVED_DWORD
133 ASSERT (This !=
NULL);
134 ASSERT (AcpiTableInfo !=
NULL);
135 ASSERT (CfgMgrProtocol !=
NULL);
136 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
137 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
139 if ((Table ==
NULL) ||
143 DEBUG ((DEBUG_ERROR,
"ERROR: SPCR: Invalid Table Pointer\n"));
144 return EFI_INVALID_PARAMETER;
149 if ((TableList[1] ==
NULL) ||
150 (TableList[1]->Signature !=
153 DEBUG ((DEBUG_ERROR,
"ERROR: SPCR: Invalid SSDT table pointer.\n"));
154 return EFI_INVALID_PARAMETER;
205 UINT32 SerialPortCount;
208 ASSERT (This !=
NULL);
209 ASSERT (AcpiTableInfo !=
NULL);
210 ASSERT (CfgMgrProtocol !=
NULL);
211 ASSERT (Table !=
NULL);
212 ASSERT (TableCount !=
NULL);
213 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
214 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
216 if ((AcpiTableInfo->AcpiTableRevision < This->MinAcpiTableRevision) ||
217 (AcpiTableInfo->AcpiTableRevision > This->AcpiTableRevision))
221 "ERROR: SPCR: Requested table revision = %d, is not supported."
222 "Supported table revision: Minimum = %d, Maximum = %d\n",
223 AcpiTableInfo->AcpiTableRevision,
224 This->MinAcpiTableRevision,
225 This->AcpiTableRevision
227 return EFI_INVALID_PARAMETER;
232 Status = GetEArchCommonObjConsolePortInfo (
238 if (EFI_ERROR (Status)) {
241 "ERROR: SPCR: Failed to get serial port information. Status = %r\n",
247 if (SerialPortCount == 0) {
250 "ERROR: SPCR: Serial port information not found. Status = %r\n",
253 return EFI_NOT_FOUND;
260 if (EFI_ERROR (Status)) {
263 "ERROR: SPCR: Invalid serial port information. Status = %r\n",
272 if (TableList ==
NULL) {
273 Status = EFI_OUT_OF_RESOURCES;
276 "ERROR: SPCR: Failed to allocate memory for Table List," \
291 if (EFI_ERROR (Status)) {
294 "ERROR: SPCR: Failed to add ACPI header. Status = %r\n",
304 Status = EFI_INVALID_PARAMETER;
307 "ERROR: SPCR: Invalid Port subtype (must be < 256). Status = %r\n",
320 if (SerialPortInfo->
AccessSize >= EFI_ACPI_6_3_QWORD) {
321 Status = EFI_INVALID_PARAMETER;
324 "ERROR: SPCR: Access size must be <= 3 (DWORD). Status = %r\n",
328 }
else if (SerialPortInfo->
AccessSize == EFI_ACPI_6_3_UNDEFINED) {
334 AcpiSpcr.BaseAddress.AccessSize = EFI_ACPI_6_3_DWORD;
345 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_9600;
349 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_19200;
353 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_57600;
357 EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200;
360 Status = EFI_UNSUPPORTED;
363 "ERROR: SPCR: Invalid Baud Rate %ld, Status = %r\n",
380 if (EFI_ERROR (Status)) {
383 "ERROR: SPCR: Failed to build associated SSDT table. Status = %r\n",
395 if (TableList !=
NULL) {
404#define SPCR_GENERATOR_REVISION CREATE_REVISION (1, 0)
414 L
"ACPI.STD.SPCR.GENERATOR",
455 DEBUG ((DEBUG_INFO,
"SPCR: Register Generator. Status = %r\n", Status));
479 DEBUG ((DEBUG_INFO,
"SPCR: Deregister Generator. Status = %r\n", Status));
#define EFI_ACPI_6_2_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE
#define EFI_ACPI_6_3_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE
#define EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
EFI_STATUS EFIAPI RegisterAcpiTableGenerator(IN CONST ACPI_TABLE_GENERATOR *CONST Generator)
EFI_STATUS EFIAPI DeregisterAcpiTableGenerator(IN CONST ACPI_TABLE_GENERATOR *CONST Generator)
#define CREATE_STD_ACPI_TABLE_GEN_ID(TableId)
#define TABLE_GENERATOR_CREATOR_ID
@ EStdAcpiTableIdSpcr
SPCR Generator.
#define ACPI_HEADER(Signature, Type, Revision)
@ EArchCommonObjConsolePortInfo
3 - Serial Console Port Info
#define GET_OBJECT_LIST(CmObjectNameSpace, CmObjectId, Type)
@ EObjNameSpaceArchCommon
Arch Common Objects Namespace.
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC
#define EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION
#define SPCR_GENERATOR_REVISION
STATIC EFI_STATUS EFIAPI BuildSpcrTableEx(IN CONST ACPI_TABLE_GENERATOR *This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, OUT EFI_ACPI_DESCRIPTION_HEADER ***Table, OUT UINTN *CONST TableCount)
STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE AcpiSpcr
EFI_STATUS EFIAPI AcpiSpcrLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
#define NAME_STR_SPCR_PORT
STATIC CONST ACPI_TABLE_GENERATOR SpcrGenerator
#define SPCR_FLOW_CONTROL_NONE
EFI_STATUS EFIAPI AcpiSpcrLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI ValidateSerialPortInfo(IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfoTable, IN UINT32 SerialPortCount)
EFI_STATUS EFIAPI FreeSsdtSerialPortTable(IN EFI_ACPI_DESCRIPTION_HEADER *Table)
EFI_STATUS EFIAPI BuildSsdtSerialPortTable(IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *AcpiTableInfo, IN CONST CM_ARCH_COMMON_SERIAL_PORT_INFO *SerialPortInfo, IN CONST CHAR8 *Name, IN CONST UINT64 Uid, OUT EFI_ACPI_DESCRIPTION_HEADER **Table)
EFI_STATUS EFIAPI AddAcpiHeader(IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CONST ACPI_TABLE_GENERATOR *CONST Generator, IN OUT EFI_ACPI_DESCRIPTION_HEADER *CONST AcpiHeader, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST UINT32 Length)
UINT16 PortSubtype
Serial Port subtype.
UINT8 AccessSize
The access size.
UINT64 BaseAddress
The physical base address for the serial port.
UINT64 BaudRate
The serial port baud rate.