From: Ruiyu Ni <ruiyu.ni@intel.com>
To: edk2-devel@lists.01.org
Cc: Jeff Fan <jeff.fan@intel.com>, Feng Tian <feng.tian@intel.com>
Subject: [PATCH 3/5] MdeModulePkg/PciBus: Accept Spec values as BarIndex and Alignment
Date: Thu, 26 Jan 2017 14:09:25 +0800 [thread overview]
Message-ID: <20170126060927.352436-4-ruiyu.ni@intel.com> (raw)
In-Reply-To: <20170126060927.352436-1-ruiyu.ni@intel.com>
PI spec IncompatiblePciSupport part defines (UINT64) -1 as all BARs
and 0 to use existing alignment. PciBus driver didn't accept these
values. It treated 0xFF as all BARs and 0xFFFFFFFFFFFFFFFFULL to use
existing alignment.
The patch changes the code to still accept old values while also
accept values defined in PI spec. So that the driver can provide
backward compatibility and follow spec.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
---
MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
index ac4d323..4ddec1f 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
@@ -1,7 +1,7 @@
/** @file
PCI emumeration support functions implementation for PCI Bus module.
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -1335,8 +1335,8 @@ UpdatePciInfo (
)
{
EFI_STATUS Status;
- UINTN BarIndex;
- UINTN BarEndIndex;
+ UINT64 BarIndex;
+ UINT64 BarEndIndex;
BOOLEAN SetFlag;
VOID *Configuration;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Ptr;
@@ -1390,18 +1390,19 @@ UpdatePciInfo (
break;
}
- BarIndex = (UINTN) Ptr->AddrTranslationOffset;
+ BarIndex = Ptr->AddrTranslationOffset;
BarEndIndex = BarIndex;
//
// Update all the bars in the device
+ // Compare against PCI_BAR_ALL is to keep backward compatibility.
//
- if (BarIndex == PCI_BAR_ALL) {
+ if ((BarIndex == (UINT64)-1) || (BarIndex == PCI_BAR_ALL)) {
BarIndex = 0;
BarEndIndex = PCI_MAX_BAR - 1;
}
- if (BarIndex > PCI_MAX_BAR) {
+ if (BarIndex >= PCI_MAX_BAR) {
Ptr++;
continue;
}
@@ -1472,7 +1473,7 @@ UpdatePciInfo (
//
// Update the new length for the device
//
- if (Ptr->AddrLen != PCI_BAR_NOCHANGE) {
+ if (Ptr->AddrLen != 0) {
PciIoDevice->PciBar[BarIndex].Length = Ptr->AddrLen;
}
}
@@ -1506,7 +1507,7 @@ SetNewAlign (
// The new alignment is the same as the original,
// so skip it
//
- if (NewAlignment == PCI_BAR_OLD_ALIGN) {
+ if ((NewAlignment == 0) || (NewAlignment == PCI_BAR_OLD_ALIGN)) {
return ;
}
//
--
2.9.0.windows.1
next prev parent reply other threads:[~2017-01-26 6:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-26 6:09 [PATCH 0/5] Fix PciBus to accept Spec values as BarIndex and Alignment Ruiyu Ni
2017-01-26 6:09 ` [PATCH 1/5] MdePkg/Pci22.h: Deprecate out-of-Spec IncompatiblePciDevice macros Ruiyu Ni
2017-02-03 3:38 ` Gao, Liming
2017-02-03 8:13 ` Laszlo Ersek
2017-02-03 8:28 ` Ni, Ruiyu
2017-02-03 8:36 ` Gao, Liming
2017-02-03 9:03 ` Ni, Ruiyu
2017-01-26 6:09 ` [PATCH 2/5] MdeModulePkg/PciSioSerialDxe: Use MAX_UINT8 instead of PCI_BAR_ALL Ruiyu Ni
2017-01-26 6:09 ` Ruiyu Ni [this message]
2017-01-26 6:09 ` [PATCH 4/5] MdeModulePkg/IncompatiblePciDevice: Do not use deprecated macros Ruiyu Ni
2017-01-26 6:09 ` [PATCH 5/5] MdeModulePkg/IncompatiblePci: Use -1 to match any IDs Ruiyu Ni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170126060927.352436-4-ruiyu.ni@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox