]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/Ata.c
FatPkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / IdeBusDxe / Ata.c
index 98d9323ea7541612053318e63f23bb36eb5ebe7a..c541eb8991a91e5cd7680567838859b81d6fb9d3 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   This file contains all helper functions on the ATA command \r
   \r
-  Copyright (c) 2006 - 2008, Intel Corporation.<BR>\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2006 - 2010, 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
@@ -75,12 +75,12 @@ AtaAtapi6Identify (
   //\r
   // 48 bit address feature set is supported, get maximum capacity\r
   //\r
-  Capacity = Atapi6IdentifyStruct->AtapiData.max_user_lba_for_48bit_addr[0];\r
+  Capacity = Atapi6IdentifyStruct->AtaData.maximum_lba_for_48bit_addressing[0];\r
   for (Index = 1; Index < 4; Index++) {\r
     //\r
     // Lower byte goes first: word[100] is the lowest word, word[103] is highest\r
     //\r
-    TmpLba = Atapi6IdentifyStruct->AtapiData.max_user_lba_for_48bit_addr[Index];\r
+    TmpLba = Atapi6IdentifyStruct->AtaData.maximum_lba_for_48bit_addressing[Index];\r
     Capacity |= LShiftU64 (TmpLba, 16 * Index);\r
   }\r
 \r
@@ -1281,7 +1281,7 @@ AtaPioDataInExt (
   return CheckErrorStatus (IdeDev);\r
 }\r
 /**\r
-  Send ATA Ext command into device with NON_DATA protocol\r
+  Send ATA Ext command into device with NON_DATA protocol.\r
 \r
   @param  IdeDev Standard IDE device private data structure\r
   @param  AtaCommand The ATA command to be sent\r
@@ -2027,7 +2027,7 @@ AtaReadSectorsExt (
 \r
   @param IdeBlkIoDevice Indicates the calling context.\r
   @param MediaId        The media id that the read request is for.\r
-  @param LBA            The starting logical block address to read from on the device.\r
+  @param Lba            The starting logical block address to read from on the device.\r
   @param BufferSize     The size of the Buffer in bytes. This must be a  multiple\r
                         of the intrinsic block size of the device.\r
 \r
@@ -2052,7 +2052,7 @@ EFI_STATUS
 AtaBlkIoReadBlocks (\r
   IN IDE_BLK_IO_DEV   *IdeBlkIoDevice,\r
   IN UINT32           MediaId,\r
-  IN EFI_LBA          LBA,\r
+  IN EFI_LBA          Lba,\r
   IN UINTN            BufferSize,\r
   OUT VOID            *Buffer\r
   )\r
@@ -2092,11 +2092,11 @@ AtaBlkIoReadBlocks (
     return EFI_NO_MEDIA;\r
   }\r
 \r
-  if (LBA > Media->LastBlock) {\r
+  if (Lba > Media->LastBlock) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {\r
+  if ((Lba + NumberOfBlocks - 1) > Media->LastBlock) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -2110,18 +2110,18 @@ AtaBlkIoReadBlocks (
     // For ATA/ATAPI-6 device(capcity > 120GB), use ATA-6 read block mechanism\r
     //\r
     if (IdeBlkIoDevice->UdmaMode.Valid) {\r
-      Status = AtaUdmaReadExt (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);\r
+      Status = AtaUdmaReadExt (IdeBlkIoDevice, Buffer, Lba, NumberOfBlocks);\r
     } else {\r
-      Status = AtaReadSectorsExt (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);\r
+      Status = AtaReadSectorsExt (IdeBlkIoDevice, Buffer, Lba, NumberOfBlocks);\r
     }\r
   } else {\r
     //\r
     // For ATA-3 compatible device, use ATA-3 read block mechanism\r
     //\r
     if (IdeBlkIoDevice->UdmaMode.Valid) {\r
-      Status = AtaUdmaRead (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);\r
+      Status = AtaUdmaRead (IdeBlkIoDevice, Buffer, Lba, NumberOfBlocks);\r
     } else {\r
-      Status = AtaReadSectors (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);\r
+      Status = AtaReadSectors (IdeBlkIoDevice, Buffer, Lba, NumberOfBlocks);\r
     }\r
   }\r
 \r
@@ -2419,7 +2419,7 @@ AtaWriteSectorsExt (
 \r
   @param IdeBlkIoDevice  Indicates the calling context.\r
   @param MediaId         The media id that the write request is for.\r
-  @param LBA             The starting logical block address to write onto the device.\r
+  @param Lba             The starting logical block address to write onto the device.\r
   @param BufferSize      The size of the Buffer in bytes. This must be a multiple\r
                          of the intrinsic block size of the device.\r
   @param Buffer          A pointer to the source buffer for the data.The caller\r
@@ -2443,7 +2443,7 @@ EFI_STATUS
 AtaBlkIoWriteBlocks (\r
   IN  IDE_BLK_IO_DEV   *IdeBlkIoDevice,\r
   IN  UINT32           MediaId,\r
-  IN  EFI_LBA          LBA,\r
+  IN  EFI_LBA          Lba,\r
   IN  UINTN            BufferSize,\r
   OUT VOID             *Buffer\r
   )\r
@@ -2479,11 +2479,11 @@ AtaBlkIoWriteBlocks (
     return EFI_BAD_BUFFER_SIZE;\r
   }\r
 \r
-  if (LBA > Media->LastBlock) {\r
+  if (Lba > Media->LastBlock) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  if ((LBA + NumberOfBlocks - 1) > Media->LastBlock) {\r
+  if ((Lba + NumberOfBlocks - 1) > Media->LastBlock) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -2497,18 +2497,18 @@ AtaBlkIoWriteBlocks (
     // For ATA/ATAPI-6 device(capcity > 120GB), use ATA-6 write block mechanism\r
     //\r
     if (IdeBlkIoDevice->UdmaMode.Valid) {\r
-      Status = AtaUdmaWriteExt (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);\r
+      Status = AtaUdmaWriteExt (IdeBlkIoDevice, Buffer, Lba, NumberOfBlocks);\r
     } else {\r
-      Status = AtaWriteSectorsExt (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);\r
+      Status = AtaWriteSectorsExt (IdeBlkIoDevice, Buffer, Lba, NumberOfBlocks);\r
     }\r
   } else {\r
     //\r
     // For ATA-3 compatible device, use ATA-3 write block mechanism\r
     //\r
     if (IdeBlkIoDevice->UdmaMode.Valid) {\r
-      Status = AtaUdmaWrite (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);\r
+      Status = AtaUdmaWrite (IdeBlkIoDevice, Buffer, Lba, NumberOfBlocks);\r
     } else {\r
-      Status = AtaWriteSectors (IdeBlkIoDevice, Buffer, LBA, NumberOfBlocks);\r
+      Status = AtaWriteSectors (IdeBlkIoDevice, Buffer, Lba, NumberOfBlocks);\r
     }\r
   }\r
 \r
@@ -2563,7 +2563,8 @@ AtaEnableLongPhysicalSector (
       //\r
       if ((AtaIdentifyData->alignment_logic_in_phy_blocks & 0xc000) == 0x4000) {\r
         IdeDev->BlkIo.Media->LowestAlignedLba =\r
-          (EFI_LBA) (AtaIdentifyData->alignment_logic_in_phy_blocks & 0x3fff);\r
+          (EFI_LBA) ((IdeDev->BlkIo.Media->LogicalBlocksPerPhysicalBlock - ((UINT32)AtaIdentifyData->alignment_logic_in_phy_blocks & 0x3fff)) %\r
+          IdeDev->BlkIo.Media->LogicalBlocksPerPhysicalBlock);\r
       }\r
     }\r
     //\r
@@ -2619,7 +2620,7 @@ AtaNonDataCommandIn (
   }\r
 \r
   //\r
-  // Select device (bit4), set LBA mode(bit6) (use 0xe0 for compatibility)\r
+  // Select device (bit4), set Lba mode(bit6) (use 0xe0 for compatibility)\r
   //\r
   IDEWritePortB (\r
     IdeDev->PciIo,\r