123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- /** @file
- *
- * Debug Port Table (DBG2)
- *
- * Copyright (c) 2019, Pete Batard <pete@akeo.ie>
- * Copyright (c) 2012-2021, ARM Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-2-Clause-Patent
- *
- **/
- #include <IndustryStandard/Acpi.h>
- #include <IndustryStandard/Bcm2836.h>
- #include <IndustryStandard/RpiDebugPort2Table.h>
- #include <Library/AcpiLib.h>
- #include <Library/PcdLib.h>
- #include "AcpiTables.h"
- #pragma pack(1)
- #define RPI_UART_INTERFACE_TYPE EFI_ACPI_DBG2_PORT_SUBTYPE_SERIAL_BCM2835_UART
- #define RPI_UART_BASE_ADDRESS BCM2836_MINI_UART_BASE_ADDRESS
- #define RPI_UART_LENGTH BCM2836_MINI_UART_LENGTH
- //
- // RPI_UART_STR should match the value used Uart.asl
- //
- #define RPI_UART_STR { '\\', '_', 'S', 'B', '.', 'G', 'D', 'V', '0', '.', 'U', 'R', 'T', 'M', 0x00 }
- #define DBG2_DEBUG_PORT_DDI(NumReg, SubType, UartBase, UartAddrLen, UartNameStr) { \
- { \
- EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION, /* UINT8 Revision */ \
- sizeof (DBG2_DEBUG_DEVICE_INFORMATION), /* UINT16 Length */ \
- NumReg, /* UINT8 NumberofGenericAddressRegisters */ \
- RPI_DBG2_NAMESPACESTRING_FIELD_SIZE, /* UINT16 NameSpaceStringLength */ \
- OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, NameSpaceString), /* UINT16 NameSpaceStringOffset */ \
- 0, /* UINT16 OemDataLength */ \
- 0, /* UINT16 OemDataOffset */ \
- EFI_ACPI_DBG2_PORT_TYPE_SERIAL, /* UINT16 Port Type */ \
- SubType, /* UINT16 Port Subtype */ \
- {EFI_ACPI_RESERVED_BYTE, EFI_ACPI_RESERVED_BYTE}, /* UINT8 Reserved[2] */ \
- OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, BaseAddressRegister), /* UINT16 BaseAddressRegister Offset */ \
- OFFSET_OF (DBG2_DEBUG_DEVICE_INFORMATION, AddressSize) /* UINT16 AddressSize Offset */ \
- }, \
- ARM_GAS32 (UartBase), /* EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE BaseAddressRegister */ \
- UartAddrLen, /* UINT32 AddressSize */ \
- UartNameStr /* UINT8 NameSpaceString[MAX_DBG2_NAME_LEN] */ \
- }
- STATIC DBG2_TABLE Dbg2 = {
- {
- ACPI_HEADER (
- EFI_ACPI_6_3_DEBUG_PORT_2_TABLE_SIGNATURE,
- DBG2_TABLE,
- EFI_ACPI_DBG2_DEBUG_DEVICE_INFORMATION_STRUCT_REVISION
- ),
- OFFSET_OF (DBG2_TABLE, Dbg2DeviceInfo),
- RPI_DBG2_NUM_DEBUG_PORTS /* UINT32 NumberDbgDeviceInfo */
- },
- {
- /*
- * Kernel Debug Port
- */
- DBG2_DEBUG_PORT_DDI (
- RPI_DBG2_NUMBER_OF_GENERIC_ADDRESS_REGISTERS,
- RPI_UART_INTERFACE_TYPE,
- RPI_UART_BASE_ADDRESS,
- RPI_UART_LENGTH,
- RPI_UART_STR
- ),
- }
- };
- #pragma pack()
- //
- // Reference the table being generated to prevent the optimizer from removing
- // the data structure from the executable
- //
- VOID* CONST ReferenceAcpiTable = &Dbg2;
|