summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Universal/Network/SnpDxe/Snp.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
index aa5926a6a..a63dd10b2 100644
--- a/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
+++ b/MdeModulePkg/Universal/Network/SnpDxe/Snp.c
@@ -455,10 +455,14 @@ SimpleNetworkDriverStart (
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 @@ SimpleNetworkDriverStart (
FreePool (BarDesc);
}
- if ((Snp->MemoryBarIndex == PCI_MAX_BAR) || (Snp->IoBarIndex == PCI_MAX_BAR)) {
- goto Error_DeleteSNP;
- }
Status = PxeStart (Snp);