summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-10-07 15:51:00 +0300
committerTom Rini <trini@konsulko.com>2021-10-15 02:45:07 +0300
commite6335d3eaafc60b74bd05761b2bf0e57ad429aa7 (patch)
tree6357cd07a28c01729ffc8aa22b13c7c3341bf894 /cmd
parentc7cd6f734b7cded1e1e1967c2374b08f344a6878 (diff)
downloadu-boot-e6335d3eaafc60b74bd05761b2bf0e57ad429aa7.tar.xz
pci: Fix showing bars
Header type is 7-bit number so properly clear upper 8th bit which indicates multifunction device. And do not try to show bars for unsupported header types. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/pci.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/pci.c b/cmd/pci.c
index cfabdc0f30..4a82854db7 100644
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -71,10 +71,15 @@ static int pci_bar_show(struct udevice *dev)
int prefetchable;
dm_pci_read_config8(dev, PCI_HEADER_TYPE, &header_type);
+ header_type &= 0x7f;
if (header_type == PCI_HEADER_TYPE_CARDBUS) {
printf("CardBus doesn't support BARs\n");
return -ENOSYS;
+ } else if (header_type != PCI_HEADER_TYPE_NORMAL &&
+ header_type != PCI_HEADER_TYPE_BRIDGE) {
+ printf("unknown header type\n");
+ return -ENOSYS;
}
bar_cnt = (header_type == PCI_HEADER_TYPE_NORMAL) ? 6 : 2;