• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/** @file
2*  Serial Port Console Redirection Table (SPCR)
3*
4*  Copyright (c) 2016, Hisilicon Limited. All rights reserved.
5*  Copyright (c) 2016 Linaro Limited. All rights reserved.
6*
7*  This program and the accompanying materials
8*  are licensed and made available under the terms and conditions of the BSD License
9*  which accompanies this distribution.  The full text of the license may be found at
10*  http://opensource.org/licenses/bsd-license.php
11*
12*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14*
15*  Based on the files under ArmPlatformPkg/ArmJunoPkg/AcpiTables/
16*
17**/
18
19#include <Library/AcpiLib.h>
20#include <Library/PcdLib.h>
21#include <IndustryStandard/Acpi.h>
22#include <IndustryStandard/SerialPortConsoleRedirectionTable.h>
23#include "Hi1616Platform.h"
24
25#define SPCR_FLOW_CONTROL_NONE           0
26
27STATIC EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE Spcr = {
28  ARM_ACPI_HEADER (EFI_ACPI_5_1_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_SIGNATURE,
29                     EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE,
30                     EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_REVISION),
31  // UINT8                                   InterfaceType;
32  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERFACE_TYPE_ARM_PL011_UART,
33  // UINT8                                   Reserved1[3];
34  {
35    EFI_ACPI_RESERVED_BYTE,
36    EFI_ACPI_RESERVED_BYTE,
37    EFI_ACPI_RESERVED_BYTE
38  },
39  // EFI_ACPI_5_0_GENERIC_ADDRESS_STRUCTURE  BaseAddress;
40  ARM_GAS32 (FixedPcdGet64 (PcdSerialRegisterBase)),
41  // UINT8                                   InterruptType;
42  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_INTERRUPT_TYPE_GIC,
43  // UINT8                                   Irq;
44  0,                                         // Not used on ARM
45  // UINT32                                  GlobalSystemInterrupt;
46  807,
47  // UINT8                                   BaudRate;
48  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_BAUD_RATE_115200,
49  // UINT8                                   Parity;
50  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_PARITY_NO_PARITY,
51  // UINT8                                   StopBits;
52  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_STOP_BITS_1,
53  // UINT8                                   FlowControl;
54  SPCR_FLOW_CONTROL_NONE,
55  // UINT8                                   TerminalType;
56  EFI_ACPI_SERIAL_PORT_CONSOLE_REDIRECTION_TABLE_TERMINAL_TYPE_ANSI,
57  // UINT8                                   Reserved2;
58  EFI_ACPI_RESERVED_BYTE,
59  // UINT16                                  PciDeviceId;
60  0xFFFF,
61  // UINT16                                  PciVendorId;
62  0xFFFF,
63  // UINT8                                   PciBusNumber;
64  0x00,
65  // UINT8                                   PciDeviceNumber;
66  0x00,
67  // UINT8                                   PciFunctionNumber;
68  0x00,
69  // UINT32                                  PciFlags;
70  0x00000000,
71  // UINT8                                   PciSegment;
72  0x00,
73  // UINT32                                  Reserved3;
74  EFI_ACPI_RESERVED_DWORD
75};
76
77//
78// Reference the table being generated to prevent the optimizer from removing the
79// data structure from the executable
80//
81VOID* CONST ReferenceAcpiTable = &Spcr;
82