]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/IntelFrameworkModulePkg ACPI: Follow the new UEFI 2.4a spec to return...
authorStar Zeng <star.zeng@intel.com>
Tue, 6 May 2014 02:11:23 +0000 (02:11 +0000)
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 6 May 2014 02:11:23 +0000 (02:11 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15496 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupportAcpiSupportProtocol.c
MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
MdePkg/Include/Protocol/AcpiTable.h

index 3bcff22dcff6e45d8b355064aa7882511befc362..6443c3acd0e9de7feec8c324f11faa7b38f8bed4 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   ACPI Support 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
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -375,6 +375,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
@@ -410,13 +413,13 @@ InstallAcpiTable (
   //\r
   AcpiTableBufferConst = AllocateCopyPool (AcpiTableBufferSize, AcpiTableBuffer);\r
   *TableKey = 0;\r
-  Status = AcpiSupport->SetAcpiTable (\r
-                          AcpiSupport,\r
-                          AcpiTableBufferConst,\r
-                          TRUE,\r
-                          EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,\r
-                          TableKey\r
-                          );\r
+  Status = AddTableToList (\r
+             AcpiSupportInstance,\r
+             AcpiTableBufferConst,\r
+             TRUE,\r
+             EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,\r
+             TableKey\r
+             );\r
   if (!EFI_ERROR (Status)) {\r
     Status = AcpiSupport->PublishTables (\r
                             AcpiSupport,\r
@@ -457,13 +460,11 @@ UninstallAcpiTable (
   //\r
   // Uninstall the ACPI table by using ACPI support protocol\r
   //\r
-  Status = AcpiSupport->SetAcpiTable (\r
-                          AcpiSupport,\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
-                          );\r
+  Status = RemoveTableFromList (\r
+             AcpiSupportInstance,\r
+             EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0,\r
+             TableKey\r
+             );\r
   if (!EFI_ERROR (Status)) {\r
     Status = AcpiSupport->PublishTables (\r
                             AcpiSupport,\r
@@ -588,8 +589,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
 EFI_STATUS\r
 AddTableToList (\r
@@ -724,7 +726,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
@@ -865,7 +867,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
@@ -949,7 +951,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
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
index 13a39d89c1f0b42b9e8e1b8919507e2e962b84d4..6149b7e4533584b7ee259001582db5eafe9b4169 100644 (file)
@@ -2,7 +2,7 @@
   The file provides the protocol to install or remove an ACPI\r
   table from a platform. \r
   \r
-  Copyright (c) 2006 - 2011, 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
@@ -31,7 +31,12 @@ typedef struct _EFI_ACPI_TABLE_PROTOCOL EFI_ACPI_TABLE_PROTOCOL;
   copy into the RSDT/XSDT. InstallAcpiTable() must insert the new   \r
   table at the end of the RSDT/XSDT. To prevent namespace   \r
   collision, ACPI tables may be created using UEFI ACPI table   \r
-  format. On successful output, TableKey is   \r
+  format. If this protocol is used to install a table with a\r
+  signature already present in the system, the new table will not\r
+  replace the existing table. It is a platform implementation\r
+  decision to add a new table with a signature matching an\r
+  existing table or disallow duplicate table signatures and\r
+  return EFI_ACCESS_DENIED. On successful output, TableKey is   \r
   initialized with a unique key. Its value may be used in a   \r
   subsequent call to UninstallAcpiTable to remove an ACPI table.   \r
   If an EFI application is running at the time of this call, the   \r
@@ -61,7 +66,10 @@ typedef struct _EFI_ACPI_TABLE_PROTOCOL EFI_ACPI_TABLE_PROTOCOL;
   \r
   @retval EFI_OUT_OF_RESOURCES  Insufficient resources exist to\r
                                 complete the request.\r
-  \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
 typedef\r
 EFI_STATUS\r