]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/PciBusNoEnumerationDxe/PciIo.c
edksetup.sh: Fix typo and return code
[mirror_edk2.git] / DuetPkg / PciBusNoEnumerationDxe / PciIo.c
index 03fc0944a77f1da6bfd9762ed423c90583d844d5..ffaaaf342beece2e5728333c2e13b20b0e6a6501 100644 (file)
@@ -1,7 +1,7 @@
 /*++\r
 \r
-Copyright (c) 2005 - 2007, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Copyright (c) 2005 - 2012, 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
@@ -343,7 +343,7 @@ Returns:
 \r
 --*/\r
 {\r
-  if (Width < 0 || Width >= EfiPciIoWidthMaximum) {\r
+  if ((UINT32)Width >= EfiPciIoWidthMaximum) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -366,11 +366,11 @@ Returns:
   // If Width is EfiPciIoWidthFifoUintX then convert to EfiPciIoWidthUintX\r
   // If Width is EfiPciIoWidthFillUintX then convert to EfiPciIoWidthUintX\r
   //\r
-  if (Width >= EfiPciWidthFifoUint8 && Width <= EfiPciWidthFifoUint64) {\r
+  if (Width >= EfiPciIoWidthFifoUint8 && Width <= EfiPciIoWidthFifoUint64) {\r
     Count = 1;\r
   }\r
 \r
-  Width &= 0x03;\r
+  Width = (EFI_PCI_IO_PROTOCOL_WIDTH) (Width & 0x03);\r
 \r
   if ((*Offset + Count * ((UINTN)1 << Width)) - 1 >= PciIoDevice->PciBar[BarIndex].Length) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -404,7 +404,7 @@ Returns:
 {\r
   UINT64  ExtendOffset;\r
 \r
-  if (Width < 0 || Width >= EfiPciIoWidthMaximum) {\r
+  if ((UINT32)Width >= EfiPciIoWidthMaximum) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -412,7 +412,7 @@ Returns:
   // If Width is EfiPciIoWidthFifoUintX then convert to EfiPciIoWidthUintX\r
   // If Width is EfiPciIoWidthFillUintX then convert to EfiPciIoWidthUintX\r
   //\r
-  Width &= 0x03;\r
+  Width = (EFI_PCI_IO_PROTOCOL_WIDTH) (Width & 0x03);\r
 \r
   if (PciIoDevice->IsPciExp) {\r
     if ((*Offset + Count * ((UINTN)1 << Width)) - 1 >= PCI_EXP_MAX_CONFIG_OFFSET) {\r
@@ -465,7 +465,7 @@ Returns:
 \r
   PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
 \r
-  if (Width < 0 || Width >= EfiPciIoWidthMaximum) {\r
+  if ((UINT32)Width >= EfiPciIoWidthMaximum) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -521,7 +521,7 @@ Returns:
 \r
   PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
 \r
-  if (Width < 0 || Width > EfiPciIoWidthUint64) {\r
+  if ((UINT32)Width > EfiPciIoWidthUint64) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -571,12 +571,12 @@ Returns:
   PCI_IO_DEVICE *PciIoDevice;\r
 \r
   if (Buffer == NULL){\r
-         return EFI_INVALID_PARAMETER;\r
+    return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
 \r
-  if (Width < 0 || Width >= EfiPciIoWidthMaximum) {\r
+  if ((UINT32)Width >= EfiPciIoWidthMaximum) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -624,12 +624,12 @@ Returns:
   PCI_IO_DEVICE *PciIoDevice;\r
 \r
   if (Buffer == NULL){\r
-         return EFI_INVALID_PARAMETER;\r
+    return EFI_INVALID_PARAMETER;\r
   }\r
   \r
   PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
 \r
-  if (Width < 0 || Width >= EfiPciIoWidthMaximum) {\r
+  if ((UINT32)Width >= EfiPciIoWidthMaximum) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -677,12 +677,12 @@ Returns:
   PCI_IO_DEVICE *PciIoDevice;\r
 \r
   if (Buffer == NULL){\r
-         return EFI_INVALID_PARAMETER;\r
+    return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
 \r
-  if (Width < 0 || Width >= EfiPciIoWidthMaximum) {\r
+  if ((UINT32)Width >= EfiPciIoWidthMaximum) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -730,12 +730,12 @@ Returns:
   PCI_IO_DEVICE *PciIoDevice;\r
 \r
   if (Buffer == NULL){\r
-         return EFI_INVALID_PARAMETER;\r
+    return EFI_INVALID_PARAMETER;\r
   }\r
 \r
   PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
 \r
-  if (Width < 0 || Width >= EfiPciIoWidthMaximum) {\r
+  if ((UINT32)Width >= EfiPciIoWidthMaximum) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -877,7 +877,7 @@ Returns:
 \r
   PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
 \r
-  if (Width < 0 || Width >= EfiPciIoWidthMaximum) {\r
+  if ((UINT32)Width >= EfiPciIoWidthMaximum) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -942,7 +942,7 @@ Returns:
 \r
   PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
 \r
-  if (Operation < 0 || Operation >= EfiPciIoOperationMaximum) {\r
+  if ((UINT32)Operation >= EfiPciIoOperationMaximum) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -951,7 +951,7 @@ Returns:
   }\r
 \r
   if (PciIoDevice->Attributes & EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE) {\r
-    Operation = Operation + EfiPciOperationBusMasterRead64;\r
+    Operation = (EFI_PCI_IO_PROTOCOL_OPERATION) (Operation + EfiPciOperationBusMasterRead64);\r
   }\r
 \r
   Status = PciIoDevice->PciRootBridgeIo->Map (\r
@@ -1074,7 +1074,7 @@ Returns:
   PCI_IO_DEVICE *PciIoDevice;\r
   \r
   if( HostAddress == NULL ){\r
-        return EFI_INVALID_PARAMETER;\r
+     return EFI_INVALID_PARAMETER;\r
   } \r
 \r
   PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
@@ -1282,21 +1282,21 @@ Returns:
     return EFI_SUCCESS;\r
 \r
   case EfiPciIoAttributeOperationEnable:\r
-         if(Attributes & ~(PciIoDevice->Supports)) {\r
-                 return EFI_UNSUPPORTED;\r
-         }\r
-         NewAttributes = PciIoDevice->Attributes | Attributes;\r
+    if(Attributes & ~(PciIoDevice->Supports)) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
+    NewAttributes = PciIoDevice->Attributes | Attributes;\r
     break;\r
   case EfiPciIoAttributeOperationDisable:\r
-         if(Attributes & ~(PciIoDevice->Supports)) {\r
-                 return EFI_UNSUPPORTED;\r
-         }\r
+    if(Attributes & ~(PciIoDevice->Supports)) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
     NewAttributes = PciIoDevice->Attributes & (~Attributes);\r
     break;\r
   case EfiPciIoAttributeOperationSet:\r
-         if(Attributes & ~(PciIoDevice->Supports)) {\r
-                 return EFI_UNSUPPORTED;\r
-         }\r
+    if(Attributes & ~(PciIoDevice->Supports)) {\r
+      return EFI_UNSUPPORTED;\r
+    }\r
     NewAttributes = Attributes;\r
     break;\r
   default:\r
@@ -1713,6 +1713,8 @@ Returns:
         //\r
         Ptr->AddrSpaceGranularity = 64;\r
         break;\r
+      default:\r
+        break;\r
       }\r
 \r
       Ptr = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) ((UINT8 *) Ptr + sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR));\r
@@ -1863,5 +1865,5 @@ Returns:
     return TRUE;\r
   }\r
 \r
-  return (PciDeviceExisted (PciDevice1->Parent, PciDevice2)|| PciDeviceExisted (PciDevice2->Parent, PciDevice1));\r
+  return (BOOLEAN) ((PciDeviceExisted (PciDevice1->Parent, PciDevice2)|| PciDeviceExisted (PciDevice2->Parent, PciDevice1)));\r
 }\r