]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Network/IScsiDxe/IScsiIbft.c
Remove iScsi driver's dependency on IntelFrameworkPkg.
[mirror_edk2.git] / MdeModulePkg / Universal / Network / IScsiDxe / IScsiIbft.c
index 0f92fad1a8c916c25f5fd0ae6888643d46291776..60a11b2e0d6ecd4cb92ddbe1429c8a8a50a42b88 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implementation for iSCSI Boot Firmware Table publication.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation.<BR>\r
+Copyright (c) 2004 - 2009, Intel Corporation.<BR>\r
 All rights reserved. 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
@@ -14,6 +14,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "IScsiImpl.h"\r
 \r
+BOOLEAN mIbftInstalled = FALSE;\r
+UINTN   mTableKey;\r
+\r
 /**\r
   Initialize the header of the iSCSI Boot Firmware Table.\r
   \r
@@ -440,56 +443,28 @@ IScsiPublishIbft (
   )\r
 {\r
   EFI_STATUS                                Status;\r
-  UINTN                                     TableHandle;\r
-  EFI_ACPI_SUPPORT_PROTOCOL                 *AcpiSupport;\r
+  EFI_ACPI_TABLE_PROTOCOL                   *AcpiTableProtocol;\r
   EFI_ACPI_ISCSI_BOOT_FIRMWARE_TABLE_HEADER *Table;\r
   UINTN                                     HandleCount;\r
   EFI_HANDLE                                *HandleBuffer;\r
   UINT8                                     *Heap;\r
-  INTN                                      Index;\r
-  EFI_ACPI_TABLE_VERSION                    Version;\r
-  UINT32                                    Signature;\r
 \r
-  Status = gBS->LocateProtocol (&gEfiAcpiSupportProtocolGuid, NULL, (VOID **)&AcpiSupport);\r
+  Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);\r
   if (EFI_ERROR (Status)) {\r
     return ;\r
   }\r
-  //\r
-  // Try to remove the old iSCSI Boot Firmware Table.\r
-  //\r
-  for (Index = 0;; Index++) {\r
-    Status = AcpiSupport->GetAcpiTable (\r
-                            AcpiSupport,\r
-                            Index,\r
-                            (VOID **)&Table,\r
-                            &Version,\r
-                            &TableHandle\r
-                            );\r
-    if (EFI_ERROR (Status)) {\r
-      break;\r
-    }\r
-\r
-    Signature = Table->Signature;\r
-    gBS->FreePool (Table);\r
-\r
-    if (Signature == EFI_ACPI_3_0_ISCSI_BOOT_FIRMWARE_TABLE_SIGNATURE) {\r
-      //\r
-      // Remove the table.\r
-      //\r
-      Status = AcpiSupport->SetAcpiTable (\r
-                              AcpiSupport,\r
-                              NULL,\r
-                              FALSE,\r
-                              Version,\r
-                              &TableHandle\r
-                              );\r
-      if (EFI_ERROR (Status)) {\r
-        return ;\r
-      }\r
 \r
-      break;\r
+  if (mIbftInstalled) {\r
+    Status = AcpiTableProtocol->UninstallAcpiTable (\r
+                                  AcpiTableProtocol,\r
+                                  mTableKey\r
+                                  );\r
+    if (EFI_ERROR (Status)) {\r
+      return ;\r
     }\r
+    mIbftInstalled = FALSE;\r
   }\r
+\r
   //\r
   // Get all iSCSI private protocols.\r
   //\r
@@ -521,23 +496,21 @@ IScsiPublishIbft (
   IScsiFillInitiatorSection (Table, &Heap, HandleBuffer[0]);\r
   IScsiFillNICAndTargetSections (Table, &Heap, HandleCount, HandleBuffer);\r
 \r
-  gBS->FreePool (HandleBuffer);\r
-\r
-  TableHandle = 0;\r
+  FreePool (HandleBuffer);\r
 \r
   //\r
   // Install or update the iBFT table.\r
   //\r
-  Status = AcpiSupport->SetAcpiTable (\r
-                          AcpiSupport,\r
-                          Table,\r
-                          TRUE,\r
-                          EFI_ACPI_TABLE_VERSION_3_0,\r
-                          &TableHandle\r
-                          );\r
-  if (!EFI_ERROR (Status)) {\r
-    AcpiSupport->PublishTables (AcpiSupport, EFI_ACPI_TABLE_VERSION_3_0);\r
+  Status = AcpiTableProtocol->InstallAcpiTable (\r
+                                AcpiTableProtocol,\r
+                                Table,\r
+                                Table->Length,\r
+                                &mTableKey\r
+                                );\r
+  if (EFI_ERROR(Status)) {\r
+    return;\r
   }\r
 \r
-  gBS->FreePool (Table);\r
+  mIbftInstalled = TRUE;\r
+  FreePool (Table);\r
 }\r