]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PciBus: Change local variable AddressSpace to Descriptor
authorRuiyu Ni <ruiyu.ni@intel.com>
Mon, 15 Feb 2016 06:53:05 +0000 (14:53 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Mon, 29 Feb 2016 02:19:57 +0000 (10:19 +0800)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
MdeModulePkg/Bus/Pci/PciBusDxe/PciIo.c

index 416063268f75c3756c3ed4e5844b269ec8e6982c..020048d4ad47f9dc1a34b94ae618deb88d2bc967 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   EFI PCI IO protocol functions implementation for PCI Bus module.\r
 \r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, 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
@@ -1774,9 +1774,8 @@ PciIoGetBarAttributes (
   OUT VOID                           **Resources OPTIONAL\r
   )\r
 {\r
-  UINT8                             *Configuration;\r
   PCI_IO_DEVICE                     *PciIoDevice;\r
-  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *AddressSpace;\r
+  EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;\r
   EFI_ACPI_END_TAG_DESCRIPTOR       *End;\r
 \r
   PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This);\r
@@ -1798,19 +1797,18 @@ PciIoGetBarAttributes (
   }\r
 \r
   if (Resources != NULL) {\r
-    Configuration = AllocateZeroPool (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));\r
-    if (Configuration == NULL) {\r
+    Descriptor = AllocateZeroPool (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR));\r
+    if (Descriptor == NULL) {\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
 \r
-    AddressSpace = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration;\r
+    *Resources   = Descriptor;\r
 \r
-    AddressSpace->Desc         = ACPI_ADDRESS_SPACE_DESCRIPTOR;\r
-    AddressSpace->Len          = (UINT16) (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3);\r
-\r
-    AddressSpace->AddrRangeMin = PciIoDevice->PciBar[BarIndex].BaseAddress;\r
-    AddressSpace->AddrLen      = PciIoDevice->PciBar[BarIndex].Length;\r
-    AddressSpace->AddrRangeMax = PciIoDevice->PciBar[BarIndex].Alignment;\r
+    Descriptor->Desc         = ACPI_ADDRESS_SPACE_DESCRIPTOR;\r
+    Descriptor->Len          = (UINT16) (sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) - 3);\r
+    Descriptor->AddrRangeMin = PciIoDevice->PciBar[BarIndex].BaseAddress;\r
+    Descriptor->AddrLen      = PciIoDevice->PciBar[BarIndex].Length;\r
+    Descriptor->AddrRangeMax = PciIoDevice->PciBar[BarIndex].Alignment;\r
 \r
     switch (PciIoDevice->PciBar[BarIndex].BarType) {\r
     case PciBarTypeIo16:\r
@@ -1818,59 +1816,59 @@ PciIoGetBarAttributes (
       //\r
       // Io\r
       //\r
-      AddressSpace->ResType = ACPI_ADDRESS_SPACE_TYPE_IO;\r
+      Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_IO;\r
       break;\r
 \r
     case PciBarTypeMem32:\r
       //\r
       // Mem\r
       //\r
-      AddressSpace->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;\r
+      Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;\r
       //\r
       // 32 bit\r
       //\r
-      AddressSpace->AddrSpaceGranularity = 32;\r
+      Descriptor->AddrSpaceGranularity = 32;\r
       break;\r
 \r
     case PciBarTypePMem32:\r
       //\r
       // Mem\r
       //\r
-      AddressSpace->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;\r
+      Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;\r
       //\r
       // prefechable\r
       //\r
-      AddressSpace->SpecificFlag = 0x6;\r
+      Descriptor->SpecificFlag = 0x6;\r
       //\r
       // 32 bit\r
       //\r
-      AddressSpace->AddrSpaceGranularity = 32;\r
+      Descriptor->AddrSpaceGranularity = 32;\r
       break;\r
 \r
     case PciBarTypeMem64:\r
       //\r
       // Mem\r
       //\r
-      AddressSpace->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;\r
+      Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;\r
       //\r
       // 64 bit\r
       //\r
-      AddressSpace->AddrSpaceGranularity = 64;\r
+      Descriptor->AddrSpaceGranularity = 64;\r
       break;\r
 \r
     case PciBarTypePMem64:\r
       //\r
       // Mem\r
       //\r
-      AddressSpace->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;\r
+      Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_MEM;\r
       //\r
       // prefechable\r
       //\r
-      AddressSpace->SpecificFlag = 0x6;\r
+      Descriptor->SpecificFlag = 0x6;\r
       //\r
       // 64 bit\r
       //\r
-      AddressSpace->AddrSpaceGranularity = 64;\r
+      Descriptor->AddrSpaceGranularity = 64;\r
       break;\r
 \r
     default:\r
@@ -1880,11 +1878,9 @@ PciIoGetBarAttributes (
     //\r
     // put the checksum\r
     //\r
-    End           = (EFI_ACPI_END_TAG_DESCRIPTOR *) (AddressSpace + 1);\r
+    End           = (EFI_ACPI_END_TAG_DESCRIPTOR *) (Descriptor + 1);\r
     End->Desc     = ACPI_END_TAG_DESCRIPTOR;\r
     End->Checksum = 0;\r
-\r
-    *Resources    = Configuration;\r
   }\r
 \r
   return EFI_SUCCESS;\r