hc
2024-03-26 e0728245c89800c2038c23308f2d88969d5b41c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/** @file
  Phytium ACPI ASL Sources.
 
  Copyright (C) 2020, Phytium Technology Co Ltd. All rights reserved.<BR>
 
  SPDX-License-Identifier: BSD-2-Clause-Patent
 
**/
 
#include <IndustryStandard/Acpi.h>
#include <IndustryStandard/SerialPortConsoleRedirectionTable.h>
#include <Library/AcpiLib.h>
#include <Library/ArmLib.h>
#include <Library/PcdLib.h>
#include <Platform.h>
 
///
/// SPCR Flow Control
///
#define SPCR_FLOW_CONTROL_NONE           0
 
 
STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE Spcr = {
  PHYTIUM_ACPI_HEADER (EFI_ACPI_5_1_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
                     EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE,
                     EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION),
  // UINT8                                   InterfaceType;
  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART,
  // UINT8                                   Reserved1[3];
  {
    EFI_ACPI_RESERVED_BYTE,
    EFI_ACPI_RESERVED_BYTE,
    EFI_ACPI_RESERVED_BYTE
  },
  // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE  BaseAddress;
  ARM_GAS32 (FixedPcdGet64 (PcdSerialRegisterBase)),
  // UINT8                                   InterruptType;
  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC,
  // UINT8                                   Irq;
  0,                                         // Not used on ARM
  // UINT32                                  GlobalSystemInterrupt;
  FixedPcdGet32 (PL011UartInterrupt),
  // UINT8                                   BaudRate;
  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200,
  // UINT8                                   Parity;
  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY,
  // UINT8                                   StopBits;
  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1,
  // UINT8                                   FlowControl;
  SPCR_FLOW_CONTROL_NONE,
  // UINT8                                   TerminalType;
  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_ANSI,
  // UINT8                                   Reserved2;
  EFI_ACPI_RESERVED_BYTE,
  // UINT16                                  PciDeviceId;
  0xFFFF,
  // UINT16                                  PciVendorId;
  0xFFFF,
  // UINT8                                   PciBusNumber;
  0x00,
  // UINT8                                   PciDeviceNumber;
  0x00,
  // UINT8                                   PciFunctionNumber;
  0x00,
  // UINT32                                  PciFlags;
  0x00000000,
  // UINT8                                   PciSegment;
  0x00,
  // UINT32                                  Reserved3;
  EFI_ACPI_RESERVED_DWORD
};
 
VOID * CONST ReferenceAcpiTable = &Spcr;