]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.c
Update the structure of EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL, PXE_HW_UNDI, PXE_S...
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / DiskIoDxe / DiskIo.c
index 8f50ec859df5227befd773b5af843e7d680f4c4c..0175465ade735e015cab64b064f1d57c2bf5ca02 100644 (file)
@@ -1,27 +1,30 @@
 /** @file\r
-  DiskIo driver that layers it's self on every Block IO protocol in the system.\r
+  DiskIo driver that lays on every BlockIo protocol in the system.\r
   DiskIo converts a block oriented device to a byte oriented device.\r
 \r
-  ReadDisk may have to do reads that are not aligned on sector boundaries.\r
+  Disk access may have to handle unaligned request about sector boundaries.\r
   There are three cases:\r
     UnderRun - The first byte is not on a sector boundary or the read request is\r
                less than a sector in length.\r
     Aligned  - A read of N contiguous sectors.\r
     OverRun  - The last byte is not on a sector boundary.\r
 \r
-  Copyright (c) 2006 - 2007, Intel Corporation                                              \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
-  http://opensource.org/licenses/bsd-license.php                                            \r
+Copyright (c) 2006 - 2008, 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
+http://opensource.org/licenses/bsd-license.php\r
 \r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
 #include "DiskIo.h"\r
 \r
+//\r
+// Driver binding protocol implementation for DiskIo driver.\r
+//\r
 EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {\r
   DiskIoDriverBindingSupported,\r
   DiskIoDriverBindingStart,\r
@@ -31,6 +34,10 @@ EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding = {
   NULL\r
 };\r
 \r
+//\r
+// Template for DiskIo private data structure.\r
+// The pointer to BlockIo protocol interface is assigned dynamically.\r
+//\r
 DISK_IO_PRIVATE_DATA        gDiskIoPrivateDataTemplate = {\r
   DISK_IO_PRIVATE_DATA_SIGNATURE,\r
   {\r
@@ -118,7 +125,9 @@ DiskIoDriverBindingStart (
 {\r
   EFI_STATUS            Status;\r
   DISK_IO_PRIVATE_DATA  *Private;\r
+  EFI_TPL               OldTpl;\r
 \r
+  OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
   Private = NULL;\r
 \r
   //\r
@@ -133,7 +142,7 @@ DiskIoDriverBindingStart (
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    return Status;\r
+    goto ErrorExit1;\r
   }\r
   \r
   //\r
@@ -170,6 +179,8 @@ ErrorExit:
           );\r
   }\r
 \r
+ErrorExit1:\r
+  gBS->RestoreTPL (OldTpl);\r
   return Status;\r
 }\r
 \r
@@ -224,7 +235,6 @@ DiskIoDriverBindingStop (
                   &Private->DiskIo\r
                   );\r
   if (!EFI_ERROR (Status)) {\r
-\r
     Status = gBS->CloseProtocol (\r
                     ControllerHandle,\r
                     &gEfiBlockIoProtocolGuid,\r
@@ -459,7 +469,7 @@ Done:
 \r
 \r
 /**\r
-  Read BufferSize bytes from Offset into Buffer.\r
+  Writes BufferSize bytes from Buffer into Offset.\r
   Writes may require a read modify write to support writes that are not\r
   aligned on sector boundaries. There are three cases:\r
     UnderRun - The first byte is not on a sector boundary or the write request\r