]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
MdeModulePkg/IntelFrameworkModulePkg ACPI: Follow the new UEFI 2.4a spec to return...
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / AcpiTableDxe / AcpiTableProtocol.c
index f8cf99ac2f1039ce12c6bad71423e36109fb1f77..76f2199c9653540f91f90b827abe643320756902 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   ACPI Table Protocol Implementation\r
 \r
-  Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -98,109 +98,6 @@ ChecksumCommonTables (
 // Protocol function implementations.\r
 //\r
 \r
-/**\r
-  This function adds, removes, or updates ACPI tables.  If the address is not\r
-  null and the handle value is null, the table is added.  If both the address and \r
-  handle are not null, the table at handle is updated with the table at address.\r
-  If the address is null and the handle is not, the table at handle is deleted.\r
-\r
-  @param  AcpiTableInstance  Instance of the protocol.\r
-  @param  Table              Pointer to a table.\r
-  @param  Checksum           Boolean indicating if the checksum should be calculated.\r
-  @param  Version            Version(s) to set.\r
-  @param  Handle             Handle of the table.\r
-\r
-  @return EFI_SUCCESS             The function completed successfully.\r
-  @return EFI_INVALID_PARAMETER   Both the Table and *Handle were NULL.\r
-  @return EFI_ABORTED             Could not complete the desired request.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SetAcpiTable (\r
-  IN EFI_ACPI_TABLE_INSTANCE              *AcpiTableInstance,\r
-  IN VOID                                 *Table OPTIONAL,\r
-  IN BOOLEAN                              Checksum,\r
-  IN EFI_ACPI_TABLE_VERSION               Version,\r
-  IN OUT UINTN                            *Handle\r
-  )\r
-{\r
-  UINTN                     SavedHandle;\r
-  EFI_STATUS                Status;\r
-\r
-  //\r
-  // Check for invalid input parameters\r
-  //\r
-  ASSERT (Handle);\r
-\r
-  //\r
-  // Initialize locals\r
-  //\r
-  //\r
-  // Determine desired action\r
-  //\r
-  if (*Handle == 0) {\r
-    if (Table == NULL) {\r
-      //\r
-      // Invalid parameter combination\r
-      //\r
-      return EFI_INVALID_PARAMETER;\r
-    } else {\r
-      //\r
-      // Add table\r
-      //\r
-      Status = AddTableToList (AcpiTableInstance, Table, Checksum, Version, Handle);\r
-    }\r
-  } else {\r
-    if (Table != NULL) {\r
-      //\r
-      // Update table\r
-      //\r
-      //\r
-      // Delete the table list entry\r
-      //\r
-      Status = RemoveTableFromList (AcpiTableInstance, Version, *Handle);\r
-      if (EFI_ERROR (Status)) {\r
-        //\r
-        // Should not get an error here ever, but abort if we do.\r
-        //\r
-        return EFI_ABORTED;\r
-      }\r
-      //\r
-      // Set the handle to replace the table at the same handle\r
-      //\r
-      SavedHandle                         = AcpiTableInstance->CurrentHandle;\r
-      AcpiTableInstance->CurrentHandle  = *Handle;\r
-\r
-      //\r
-      // Add the table\r
-      //\r
-      Status = AddTableToList (AcpiTableInstance, Table, Checksum, Version, Handle);\r
-\r
-      //\r
-      // Restore the saved current handle\r
-      //\r
-      AcpiTableInstance->CurrentHandle = SavedHandle;\r
-    } else {\r
-      //\r
-      // Delete table\r
-      //\r
-      Status = RemoveTableFromList (AcpiTableInstance, Version, *Handle);\r
-    }\r
-  }\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    //\r
-    // Should not get an error here ever, but abort if we do.\r
-    //\r
-    return EFI_ABORTED;\r
-  }\r
-  //\r
-  // Done\r
-  //\r
-  return EFI_SUCCESS;\r
-}\r
-\r
 /**\r
   This function publishes the specified versions of the ACPI tables by\r
   installing EFI configuration table entries for them.  Any combination of\r
@@ -303,6 +200,9 @@ PublishTables (
                                  and the size field embedded in the ACPI table pointed to by AcpiTableBuffer\r
                                  are not in sync.\r
   @return EFI_OUT_OF_RESOURCES   Insufficient resources exist to complete the request.\r
+  @retval EFI_ACCESS_DENIED      The table signature matches a table already\r
+                                 present in the system and platform policy\r
+                                 does not allow duplicate tables of this type.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -336,7 +236,7 @@ InstallAcpiTable (
   //\r
   AcpiTableBufferConst = AllocateCopyPool (AcpiTableBufferSize,AcpiTableBuffer);\r
   *TableKey = 0;\r
-  Status = SetAcpiTable (\r
+  Status = AddTableToList (\r
              AcpiTableInstance,\r
              AcpiTableBufferConst,\r
              TRUE,\r
@@ -396,12 +296,10 @@ UninstallAcpiTable (
   //\r
   // Uninstall the ACPI table\r
   //\r
-  Status = SetAcpiTable (\r
+  Status = RemoveTableFromList (\r
              AcpiTableInstance,\r
-             NULL,\r
-             FALSE,\r
              EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,\r
-             &TableKey\r
+             TableKey\r
              );\r
   if (!EFI_ERROR (Status)) {\r
     Status = PublishTables (\r
@@ -528,8 +426,9 @@ ReallocateAcpiTableBuffer (
 \r
   @return EFI_SUCCESS               The function completed successfully.\r
   @return EFI_OUT_OF_RESOURCES      Could not allocate a required resource.\r
-  @return EFI_ABORTED               The table is a duplicate of a table that is required\r
-                                    to be unique.\r
+  @retval EFI_ACCESS_DENIED         The table signature matches a table already\r
+                                    present in the system and platform policy\r
+                                    does not allow duplicate tables of this type.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -665,7 +564,7 @@ AddTableToList (
         ) {\r
       gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);\r
       gBS->FreePool (CurrentTableList);\r
-      return EFI_ABORTED;\r
+      return EFI_ACCESS_DENIED;\r
     }\r
     //\r
     // Add the table to the appropriate table version\r
@@ -800,7 +699,7 @@ AddTableToList (
         ) {\r
       gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);\r
       gBS->FreePool (CurrentTableList);\r
-      return EFI_ABORTED;\r
+      return EFI_ACCESS_DENIED;\r
     }\r
     //\r
     // FACS is referenced by FADT and is not part of RSDT\r
@@ -884,7 +783,7 @@ AddTableToList (
         ) {\r
       gBS->FreePages (CurrentTableList->PageAddress, CurrentTableList->NumberOfPages);\r
       gBS->FreePool (CurrentTableList);\r
-      return EFI_ABORTED;\r
+      return EFI_ACCESS_DENIED;\r
     }\r
     //\r
     // DSDT is referenced by FADT and is not part of RSDT\r