1 /** @file 2 ACPI Table Protocol Driver 3 4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 // 16 // Includes 17 // 18 #include "AcpiTable.h" 19 20 // 21 // Handle to install ACPI Table Protocol 22 // 23 EFI_HANDLE mHandle = NULL; 24 GLOBAL_REMOVE_IF_UNREFERENCED EFI_ACPI_TABLE_INSTANCE *mPrivateData = NULL; 25 26 /** 27 Entry point of the ACPI table driver. 28 Creates and initializes an instance of the ACPI Table 29 Protocol and installs it on a new handle. 30 31 @param ImageHandle A handle for the image that is initializing this driver. 32 @param SystemTable A pointer to the EFI system table. 33 34 @return EFI_SUCCESS Driver initialized successfully. 35 @return EFI_LOAD_ERROR Failed to Initialize or has been loaded. 36 @return EFI_OUT_OF_RESOURCES Could not allocate needed resources. 37 38 **/ 39 EFI_STATUS 40 EFIAPI 41 InitializeAcpiTableDxe ( 42 IN EFI_HANDLE ImageHandle, 43 IN EFI_SYSTEM_TABLE *SystemTable 44 ) 45 { 46 EFI_STATUS Status; 47 EFI_ACPI_TABLE_INSTANCE *PrivateData; 48 49 // 50 // Initialize our protocol 51 // 52 PrivateData = AllocateZeroPool (sizeof (EFI_ACPI_TABLE_INSTANCE)); 53 ASSERT (PrivateData); 54 PrivateData->Signature = EFI_ACPI_TABLE_SIGNATURE; 55 56 // 57 // Call all constructors per produced protocols 58 // 59 Status = AcpiTableAcpiTableConstructor (PrivateData); 60 if (EFI_ERROR (Status)) { 61 gBS->FreePool (PrivateData); 62 return EFI_LOAD_ERROR; 63 } 64 65 // 66 // Install ACPI Table protocol 67 // 68 if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) { 69 mPrivateData = PrivateData; 70 Status = gBS->InstallMultipleProtocolInterfaces ( 71 &mHandle, 72 &gEfiAcpiTableProtocolGuid, 73 &PrivateData->AcpiTableProtocol, 74 &gEfiAcpiSdtProtocolGuid, 75 &mPrivateData->AcpiSdtProtocol, 76 NULL 77 ); 78 } else { 79 Status = gBS->InstallMultipleProtocolInterfaces ( 80 &mHandle, 81 &gEfiAcpiTableProtocolGuid, 82 &PrivateData->AcpiTableProtocol, 83 NULL 84 ); 85 } 86 ASSERT_EFI_ERROR (Status); 87 88 return Status; 89 } 90 91