]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/EnhancedFatDxe/Init.c
FatPkg: INF/DEC file updates to EDK II packages
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / Init.c
index a532b56b2935f3cd93c5b3022c72251c89a54826..34a7250453caf0e0cda18cf83d4b8b876b4ae3cd 100644 (file)
@@ -1,7 +1,7 @@
 /*++\r
 \r
-Copyright (c) 2005 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials are licensed and made available\r
+Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available\r
 under the terms and conditions of the BSD License which accompanies this\r
 distribution. The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -26,6 +26,7 @@ EFI_STATUS
 FatAllocateVolume (\r
   IN  EFI_HANDLE                Handle,\r
   IN  EFI_DISK_IO_PROTOCOL      *DiskIo,\r
+  IN  EFI_DISK_IO2_PROTOCOL     *DiskIo2,\r
   IN  EFI_BLOCK_IO_PROTOCOL     *BlockIo\r
   )\r
 /*++\r
@@ -51,8 +52,7 @@ Returns:
 {\r
   EFI_STATUS  Status;\r
   FAT_VOLUME  *Volume;\r
-  BOOLEAN     LockedByMe;\r
-  LockedByMe = FALSE;\r
+\r
   //\r
   // Allocate a volume structure\r
   //\r
@@ -60,20 +60,14 @@ Returns:
   if (Volume == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
-  //\r
-  // Acquire the lock.\r
-  // If caller has already acquired the lock, cannot lock it again.\r
-  //\r
-  if (!FatIsLocked ()) {\r
-    FatAcquireLock ();\r
-    LockedByMe = TRUE;\r
-  }\r
+\r
   //\r
   // Initialize the structure\r
   //\r
   Volume->Signature                   = FAT_VOLUME_SIGNATURE;\r
   Volume->Handle                      = Handle;\r
   Volume->DiskIo                      = DiskIo;\r
+  Volume->DiskIo2                     = DiskIo2;\r
   Volume->BlockIo                     = BlockIo;\r
   Volume->MediaId                     = BlockIo->Media->MediaId;\r
   Volume->ReadOnly                    = BlockIo->Media->ReadOnly;\r
@@ -115,17 +109,10 @@ Returns:
   //\r
   // Volume installed\r
   //\r
-  DEBUG ((EFI_D_INIT, "%HInstalled Fat filesystem on %x%N\n", Handle));\r
+  DEBUG ((EFI_D_INIT, "Installed Fat filesystem on %p\n", Handle));\r
   Volume->Valid = TRUE;\r
 \r
 Done:\r
-  //\r
-  // Unlock if locked by myself.\r
-  //\r
-  if (LockedByMe) {\r
-    FatReleaseLock ();\r
-  }\r
-\r
   if (EFI_ERROR (Status)) {\r
     FatFreeVolume (Volume);\r
   }\r
@@ -180,9 +167,9 @@ Returns:
   // means we are in the process of some Fat operation),\r
   // we can not acquire again.\r
   //\r
-  if (!FatIsLocked ()) {\r
+  Status = FatAcquireLockOrFail ();\r
+  if (!EFI_ERROR (Status)) {\r
     LockedByMe = TRUE;\r
-    FatAcquireLock ();\r
   }\r
   //\r
   // The volume is still being used. Hence, set error flag for all OFiles still in\r
@@ -208,7 +195,7 @@ Returns:
   // FatCleanupVolume do the task.\r
   //\r
   if (LockedByMe) {\r
-    FatCleanupVolume (Volume, NULL, EFI_SUCCESS);\r
+    FatCleanupVolume (Volume, NULL, EFI_SUCCESS, NULL);\r
     FatReleaseLock ();\r
   }\r
 \r
@@ -403,7 +390,7 @@ Returns:
   if (FatType == FAT32) {\r
     Volume->FreeInfoPos = FatBs.FatBse.Fat32Bse.FsInfoSector * BlockSize;\r
     if (FatBs.FatBse.Fat32Bse.FsInfoSector != 0) {\r
-      FatDiskIo (Volume, READ_DISK, Volume->FreeInfoPos, sizeof (FAT_INFO_SECTOR), &Volume->FatInfoSector);\r
+      FatDiskIo (Volume, READ_DISK, Volume->FreeInfoPos, sizeof (FAT_INFO_SECTOR), &Volume->FatInfoSector, NULL);\r
       if (Volume->FatInfoSector.Signature == FAT_INFO_SIGNATURE &&\r
           Volume->FatInfoSector.InfoBeginSignature == FAT_INFO_BEGIN_SIGNATURE &&\r
           Volume->FatInfoSector.InfoEndSignature == FAT_INFO_END_SIGNATURE &&\r