aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2022-01-17 16:38:38 +0100
committerTom Rini <trini@konsulko.com>2022-01-28 17:58:41 -0500
commit39320935cc5a0544768ff6a0e1143313355c6b4d (patch)
tree30b21828f9e037728fa0cc99b3817ead97049b48 /cmd
parent8c303bc6e04166db8dce74dbf6b1e46dd9422c47 (diff)
downloadu-boot-39320935cc5a0544768ff6a0e1143313355c6b4d.zip
u-boot-39320935cc5a0544768ff6a0e1143313355c6b4d.tar.gz
u-boot-39320935cc5a0544768ff6a0e1143313355c6b4d.tar.bz2
pci: Extend 'pci regions' command with bus number
'pci regions' currently prints only region information from bus 0 which belongs to controller 0. Parser for 'pci regions' cmdline currently ignores any additional arguments and so U-Boot always uses bus 0. Regions are stored in controller (not on the bus) and therefore to retrieve controller from the bus, it is needed to call pci_get_controller() which returns root bus. Because bus 0 is root bus, current code worked fine for controller 0. Extend cmdline parser for 'pci regions' to allows specifying bus number, extend pci_show_regions() code to accept also non-zero bus number and print bus ranges for which is regions configuration assigned. 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.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmd/pci.c b/cmd/pci.c
index 389b41c..96e6fbd 100644
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -443,7 +443,7 @@ static const struct pci_flag_info {
static void pci_show_regions(struct udevice *bus)
{
- struct pci_controller *hose = dev_get_uclass_priv(bus);
+ struct pci_controller *hose = dev_get_uclass_priv(pci_get_controller(bus));
const struct pci_region *reg;
int i, j;
@@ -452,6 +452,7 @@ static void pci_show_regions(struct udevice *bus)
return;
}
+ printf("Buses %02x-%02x\n", hose->first_busno, hose->last_busno);
printf("# %-18s %-18s %-18s %s\n", "Bus start", "Phys start", "Size",
"Flags");
for (i = 0, reg = hose->regions; i < hose->region_count; i++, reg++) {
@@ -520,8 +521,9 @@ static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
value = 0;
argc--;
}
- if (argc > 1)
- busnum = hextoul(argv[1], NULL);
+ if (argc > 2 || (argc > 1 && cmd != 'r' && argv[1][0] != 's')) {
+ busnum = hextoul(argv[argc - 1], NULL);
+ }
}
ret = uclass_get_device_by_seq(UCLASS_PCI, busnum, &bus);
if (ret) {
@@ -586,7 +588,7 @@ static char pci_help_text[] =
" - show header of PCI device 'bus.device.function'\n"
"pci bar b.d.f\n"
" - show BARs base and size for device b.d.f'\n"
- "pci regions\n"
+ "pci regions [bus]\n"
" - show PCI regions\n"
"pci display[.b, .w, .l] b.d.f [address] [# of objects]\n"
" - display PCI configuration space (CFG)\n"