From 93b17b404f7884ee2006a31acd442043a96409ad Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 23 Sep 2009 18:50:15 +0000 Subject: (is_child_of_a_pcie_bridge) introduce it (pci_probe) introdude 'nice_bus' field in order to report if it's a PCIe device (#28479) --- perl-install/detect_devices.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'perl-install/detect_devices.pm') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 974008808..c96b9d1a8 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -805,7 +805,14 @@ sub get_pci_sysfs_path { } -my (@pci, @usb); +my (@pci, @pcie_bridges, @usb); + +sub is_child_of_a_pcie_bridge { + my ($l) = @_; + my $sysfs_device = get_pci_sysfs_path($l); + return 1 if grep { -e "$_->{sysfs_device}/$sysfs_device" } @pcie_bridges; +} + sub pci_probe__real() { add_addons($pcitable_addons, map { my %l; @@ -817,7 +824,13 @@ sub pci_probe__real() { } c::pci_probe()); } sub pci_probe() { - @pci = pci_probe__real() if !@pci; + if (!$done) { + @pci = pci_probe__real() if !@pci; + @pcie_bridges = grep { readlink("$_->{sysfs_device}/driver") =~ /pcieport/ } @pci; + foreach (@pci) { + $_->{nice_bus} = is_child_of_a_pcie_bridge($_) ? "PCI Express" : "PCI"; + } + } @pci; } -- cgit v1.2.1