]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/IdeBus/Dxe/ide.c
Enable Idebus to use the Atapi.h defined in MdePkg/Include/IndustryStandard
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / IdeBus / Dxe / ide.c
index 4b4a8ef0a355cfe798d31b2dfba5eba993bd3f28..a69c72e9e4870d717a6a51ff7561702cad2bf183 100644 (file)
@@ -315,8 +315,8 @@ GetIdeRegistersBaseAddr (
     //\r
     // The BARs should be of IO type\r
     //\r
-    if ((PciData.Device.Bar[0] & bit0) == 0 ||\r
-        (PciData.Device.Bar[1] & bit0) == 0) {\r
+    if ((PciData.Device.Bar[0] & BIT0) == 0 ||\r
+        (PciData.Device.Bar[1] & BIT0) == 0) {\r
       return EFI_UNSUPPORTED;\r
     }\r
 \r
@@ -337,8 +337,8 @@ GetIdeRegistersBaseAddr (
     //\r
     // The BARs should be of IO type\r
     //\r
-    if ((PciData.Device.Bar[2] & bit0) == 0 ||\r
-        (PciData.Device.Bar[3] & bit0) == 0) {\r
+    if ((PciData.Device.Bar[2] & BIT0) == 0 ||\r
+        (PciData.Device.Bar[3] & BIT0) == 0) {\r
       return EFI_UNSUPPORTED;\r
     }\r
 \r
@@ -709,8 +709,8 @@ DetectIDEController (
   // NOTE: This workaround doesn't apply to ATAPI.\r
   //\r
   if (MasterDeviceExist && SlaveDeviceExist &&\r
-      (StatusReg & DRDY) == 0               &&\r
-      (InitStatusReg & DRDY) == 0           &&\r
+      (StatusReg & ATA_STSREG_DRDY) == 0               &&\r
+      (InitStatusReg & ATA_STSREG_DRDY) == 0           &&\r
       MasterDeviceType == SlaveDeviceType   &&\r
       SlaveDeviceType != ATAPI_DEVICE_TYPE) {\r
     SlaveDeviceExist = FALSE;\r
@@ -768,14 +768,14 @@ DRQClear (
     //\r
     // wait for BSY == 0 and DRQ == 0\r
     //\r
-    if ((StatusRegister & (DRQ | BSY)) == 0) {\r
+    if ((StatusRegister & (ATA_STSREG_DRQ | ATA_STSREG_BSY)) == 0) {\r
       break;\r
     }\r
 \r
-    if ((StatusRegister & (BSY | ERR)) == ERR) {\r
+    if ((StatusRegister & (ATA_STSREG_BSY | ATA_STSREG_ERR)) == ATA_STSREG_ERR) {\r
 \r
       ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);\r
-      if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {\r
+      if ((ErrorRegister & ATA_ERRREG_ABRT) == ATA_ERRREG_ABRT) {\r
         return EFI_ABORTED;\r
       }\r
     }\r
@@ -842,14 +842,14 @@ DRQClear2 (
     //\r
     //  wait for BSY == 0 and DRQ == 0\r
     //\r
-    if ((AltRegister & (DRQ | BSY)) == 0) {\r
+    if ((AltRegister & (ATA_STSREG_DRQ | ATA_STSREG_BSY)) == 0) {\r
       break;\r
     }\r
 \r
-    if ((AltRegister & (BSY | ERR)) == ERR) {\r
+    if ((AltRegister & (ATA_STSREG_BSY | ATA_STSREG_ERR)) == ATA_STSREG_ERR) {\r
 \r
       ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);\r
-      if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {\r
+      if ((ErrorRegister & ATA_ERRREG_ABRT) == ATA_ERRREG_ABRT) {\r
         return EFI_ABORTED;\r
       }\r
     }\r
@@ -921,14 +921,14 @@ DRQReady (
     //\r
     //  BSY==0,DRQ==1\r
     //\r
-    if ((StatusRegister & (BSY | DRQ)) == DRQ) {\r
+    if ((StatusRegister & (ATA_STSREG_BSY | ATA_STSREG_DRQ)) == ATA_STSREG_DRQ) {\r
       break;\r
     }\r
 \r
-    if ((StatusRegister & (BSY | ERR)) == ERR) {\r
+    if ((StatusRegister & (ATA_STSREG_BSY | ATA_STSREG_ERR)) == ATA_STSREG_ERR) {\r
 \r
       ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);\r
-      if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {\r
+      if ((ErrorRegister & ATA_ERRREG_ABRT) == ATA_ERRREG_ABRT) {\r
         return EFI_ABORTED;\r
       }\r
     }\r
@@ -998,14 +998,14 @@ DRQReady2 (
     //\r
     // BSY == 0 , DRQ == 1\r
     //\r
-    if ((AltRegister & (BSY | DRQ)) == DRQ) {\r
+    if ((AltRegister & (ATA_STSREG_BSY | ATA_STSREG_DRQ)) == ATA_STSREG_DRQ) {\r
       break;\r
     }\r
 \r
-    if ((AltRegister & (BSY | ERR)) == ERR) {\r
+    if ((AltRegister & (ATA_STSREG_BSY | ATA_STSREG_ERR)) == ATA_STSREG_ERR) {\r
 \r
       ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);\r
-      if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {\r
+      if ((ErrorRegister & ATA_ERRREG_ABRT) == ATA_ERRREG_ABRT) {\r
         return EFI_ABORTED;\r
       }\r
     }\r
@@ -1064,7 +1064,7 @@ WaitForBSYClear (
   do {\r
 \r
     StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);\r
-    if ((StatusRegister & BSY) == 0x00) {\r
+    if ((StatusRegister & ATA_STSREG_BSY) == 0x00) {\r
       break;\r
     }\r
 \r
@@ -1124,7 +1124,7 @@ WaitForBSYClear2 (
   Delay = (UINT32) (((TimeoutInMilliSeconds * STALL_1_MILLI_SECOND) / 30) + 1);\r
   do {\r
     AltRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Alt.AltStatus);\r
-    if ((AltRegister & BSY) == 0x00) {\r
+    if ((AltRegister & ATA_STSREG_BSY) == 0x00) {\r
       break;\r
     }\r
 \r
@@ -1188,14 +1188,14 @@ DRDYReady (
     //\r
     //  BSY == 0 , DRDY == 1\r
     //\r
-    if ((StatusRegister & (DRDY | BSY)) == DRDY) {\r
+    if ((StatusRegister & (ATA_STSREG_DRDY | ATA_STSREG_BSY)) == ATA_STSREG_DRDY) {\r
       break;\r
     }\r
 \r
-    if ((StatusRegister & (BSY | ERR)) == ERR) {\r
+    if ((StatusRegister & (ATA_STSREG_BSY | ATA_STSREG_ERR)) == ATA_STSREG_ERR) {\r
 \r
       ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);\r
-      if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {\r
+      if ((ErrorRegister & ATA_ERRREG_ABRT) == ATA_ERRREG_ABRT) {\r
         return EFI_ABORTED;\r
       }\r
     }\r
@@ -1259,14 +1259,14 @@ DRDYReady2 (
     //\r
     //  BSY == 0 , DRDY == 1\r
     //\r
-    if ((AltRegister & (DRDY | BSY)) == DRDY) {\r
+    if ((AltRegister & (ATA_STSREG_DRDY | ATA_STSREG_BSY)) == ATA_STSREG_DRDY) {\r
       break;\r
     }\r
 \r
-    if ((AltRegister & (BSY | ERR)) == ERR) {\r
+    if ((AltRegister & (ATA_STSREG_BSY | ATA_STSREG_ERR)) == ATA_STSREG_ERR) {\r
 \r
       ErrorRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg1.Error);\r
-      if ((ErrorRegister & ABRT_ERR) == ABRT_ERR) {\r
+      if ((ErrorRegister & ATA_ERRREG_ABRT) == ATA_ERRREG_ABRT) {\r
         return EFI_ABORTED;\r
       }\r
     }\r
@@ -1293,7 +1293,7 @@ DRDYReady2 (
   name by sending ATA command called ATA Identify Command or ATAPI\r
   Identify Command to the specified IDE device. The module name returned\r
   is a string of ASCII characters: the first character is bit8--bit15\r
-  of the first word, the second character is bit0--bit7 of the first word\r
+  of the first word, the second character is BIT0--bit7 of the first word\r
   and so on. Thus the string can not be print directly before it is\r
   preprocessed by this func to change the order of characters in\r
   each word in the string.\r
@@ -1424,7 +1424,7 @@ SetDeviceTransferMode (
   //\r
   Status = AtaNonDataCommandIn (\r
             IdeDev,\r
-            SET_FEATURES_CMD,\r
+            ATA_CMD_SET_FEATURES,\r
             DeviceSelect,\r
             0x03,\r
             SectorCount,\r
@@ -1507,10 +1507,10 @@ AtaNonDataCommandIn (
 \r
   //\r
   // Wait for command completion\r
-  // For ATA_SMART_CMD, we may need more timeout to let device\r
+  // For ATAPI_SMART_CMD, we may need more timeout to let device\r
   // adjust internal states.\r
   //\r
-  if (AtaCommand == ATA_SMART_CMD) {\r
+  if (AtaCommand == ATA_CMD_SMART) {\r
     Status = WaitForBSYClear (IdeDev, ATASMARTTIMEOUT);\r
   } else {\r
     Status = WaitForBSYClear (IdeDev, ATATIMEOUT);\r
@@ -1520,7 +1520,7 @@ AtaNonDataCommandIn (
   }\r
 \r
   StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);\r
-  if ((StatusRegister & ERR) == ERR) {\r
+  if ((StatusRegister & ATA_STSREG_ERR) == ATA_STSREG_ERR) {\r
     //\r
     // Failed to execute command, abort operation\r
     //\r
@@ -1639,7 +1639,7 @@ AtaNonDataCommandInExt (
   }\r
 \r
   StatusRegister = IDEReadPortB (IdeDev->PciIo, IdeDev->IoPort->Reg.Status);\r
-  if ((StatusRegister & ERR) == ERR) {\r
+  if ((StatusRegister & ATA_STSREG_ERR) == ATA_STSREG_ERR) {\r
     //\r
     // Failed to execute command, abort operation\r
     //\r
@@ -1678,7 +1678,7 @@ SetDriveParameters (
   //\r
   Status = AtaNonDataCommandIn (\r
             IdeDev,\r
-            INIT_DRIVE_PARAM_CMD,\r
+            ATA_CMD_INIT_DRIVE_PARAM,\r
             (UINT8) (DeviceSelect + DriveParameters->Heads),\r
             0,\r
             DriveParameters->Sector,\r
@@ -1692,7 +1692,7 @@ SetDriveParameters (
   //\r
   Status = AtaNonDataCommandIn (\r
             IdeDev,\r
-            SET_MULTIPLE_MODE_CMD,\r
+            ATA_CMD_SET_MULTIPLE_MODE,\r
             DeviceSelect,\r
             0,\r
             DriveParameters->MultipleSector,\r