Revision: 16432
          http://sourceforge.net/p/edk2/code/16432
Author:   vanjeff
Date:     2014-11-25 07:25:08 +0000 (Tue, 25 Nov 2014)
Log Message:
-----------
Sync patch r16278 from main trunk.

Fix a bug introuduced by r16104, not all NIC device implement both memory and 
IO bar.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <[email protected]>
Reviewed-by: Ye Ting <[email protected]>
Reviewed-by: Wu Jiaxin <[email protected]>

(cherry picked from commit eb0d6c6d909b00861845607750db35e4fa905121)

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/16278
    http://sourceforge.net/p/edk2/code/16104

Modified Paths:
--------------
    branches/UDK2014.SP1/MdeModulePkg/Universal/Network/SnpDxe/Snp.c

Modified: branches/UDK2014.SP1/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
===================================================================
--- branches/UDK2014.SP1/MdeModulePkg/Universal/Network/SnpDxe/Snp.c    
2014-11-25 07:12:28 UTC (rev 16431)
+++ branches/UDK2014.SP1/MdeModulePkg/Universal/Network/SnpDxe/Snp.c    
2014-11-25 07:25:08 UTC (rev 16432)
@@ -455,10 +455,14 @@
   Snp->Db   = (VOID *) ((UINTN) Address + 2048);
 
   //
-  // Find the correct memory and io bar.
+  // Find the correct BAR to do IO.
   //
-  Snp->MemoryBarIndex = PCI_MAX_BAR;
-  Snp->IoBarIndex     = PCI_MAX_BAR;
+  // Enumerate through the PCI BARs for the device to determine which one is
+  // the IO BAR.  Save the index of the BAR into the adapter info structure.
+  // for regular 32bit BARs, 0 is memory mapped, 1 is io mapped
+  //
+  Snp->MemoryBarIndex = 0;
+  Snp->IoBarIndex     = 1;
   for (BarIndex = 0; BarIndex < PCI_MAX_BAR; BarIndex++) {
     Status = PciIo->GetBarAttributes (
                       PciIo,
@@ -480,9 +484,6 @@
 
     FreePool (BarDesc);
   }
-  if ((Snp->MemoryBarIndex == PCI_MAX_BAR) || (Snp->IoBarIndex == 
PCI_MAX_BAR)) {
-    goto Error_DeleteSNP;
-  }
 
   Status = PxeStart (Snp);
 


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to