From f4d38e50c0f24eb78eb003a94f583025621c63db Mon Sep 17 00:00:00 2001 From: Leif Lindholm Date: Thu, 3 Aug 2017 12:24:22 +0100 Subject: Platform,Silicon: import AMD Styx SoC support and platforms Common files for AMD Overdrive, SoftIron Overdrive 1000 and LeMaker Cello, as well as actual platform support. Imported from commit efd798c1eb of https://git.linaro.org/uefi/OpenPlatformPkg.git Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Leif Lindholm --- .../Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c (limited to 'Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c') diff --git a/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c new file mode 100644 index 0000000000..15b38bbf89 --- /dev/null +++ b/Silicon/AMD/Styx/Drivers/AcpiPlatformDxe/AcpiPlatform.c @@ -0,0 +1,114 @@ +/** @file + + Sample ACPI Platform Driver + + Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2016, AMD Inc. All rights reserved.
+ + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ +/** + Derived from: + MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c +**/ + +#include +#include + +#include +#include +#include +#include + +#define MAX_ACPI_TABLES 12 + +EFI_ACPI_DESCRIPTION_HEADER *AcpiTableList[MAX_ACPI_TABLES]; + + +/** + Entrypoint of Acpi Platform driver. + + @param ImageHandle + @param SystemTable + + @return EFI_SUCCESS + @return EFI_LOAD_ERROR + @return EFI_OUT_OF_RESOURCES + +**/ +EFI_STATUS +EFIAPI +AcpiPlatformEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_ACPI_TABLE_PROTOCOL *AcpiTable; + UINTN TableHandle; + UINTN TableIndex; + + ZeroMem(AcpiTableList, sizeof(AcpiTableList)); + + TableIndex = 0; + AcpiTableList[TableIndex++] = FadtTable(); + AcpiTableList[TableIndex++] = DsdtHeader(); + AcpiTableList[TableIndex++] = MadtHeader(); + AcpiTableList[TableIndex++] = GtdtHeader(); + AcpiTableList[TableIndex++] = Dbg2Header(); + AcpiTableList[TableIndex++] = SpcrHeader(); + AcpiTableList[TableIndex++] = McfgHeader(); + AcpiTableList[TableIndex++] = CsrtHeader(); + if (PcdGetBool (PcdEnableSmmus)) { + AcpiTableList[TableIndex++] = IortHeader(); + } + AcpiTableList[TableIndex++] = NULL; + + DEBUG((DEBUG_INFO, "%a(): ACPI Table installer\n", __FUNCTION__)); + + // + // Find the AcpiTable protocol + // + Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID**)&AcpiTable); + if (EFI_ERROR (Status)) { + DEBUG((EFI_D_ERROR, "Failed to locate AcpiTable protocol. Status = %r\n", Status)); + ASSERT_EFI_ERROR(Status); + } + + TableIndex = 0; + while (AcpiTableList[TableIndex] != NULL) { + // + // Install ACPI table + // + DEBUG ((EFI_D_ERROR, "Installing %c%c%c%c Table (Revision %d, Length %d) ...\n", + *((UINT8*)&AcpiTableList[TableIndex]->Signature), + *((UINT8*)&AcpiTableList[TableIndex]->Signature + 1), + *((UINT8*)&AcpiTableList[TableIndex]->Signature + 2), + *((UINT8*)&AcpiTableList[TableIndex]->Signature + 3), + AcpiTableList[TableIndex]->Revision, + AcpiTableList[TableIndex]->Length)); + + Status = AcpiTable->InstallAcpiTable ( + AcpiTable, + AcpiTableList[TableIndex], + (AcpiTableList[TableIndex])->Length, + &TableHandle + ); + if (EFI_ERROR (Status)) { + DEBUG((DEBUG_ERROR,"Error adding ACPI Table. Status = %r\n", Status)); + ASSERT_EFI_ERROR(Status); + } + TableIndex++; + ASSERT( TableIndex < MAX_ACPI_TABLES ); + } + + return EFI_SUCCESS; +} + -- cgit v1.2.3