From 96356fb9e2880ee1e5436ef87e9ddd1ced323b06 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 30 Sep 2009 15:33:07 +0000 Subject: (pci_probe) better check for PCI Express capability --- perl-install/NEWS | 1 + perl-install/c/stuff.xs.pl | 4 ++-- perl-install/detect_devices.pm | 13 +++---------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/perl-install/NEWS b/perl-install/NEWS index 1d81844ff..a4b4dd29e 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,4 +1,5 @@ - harddrake: + o better check for PCI Express capability o nicer display of PCI Express name Version 12.55 - 23 September 2009 diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl index 16fdaef80..0f4908d9b 100644 --- a/perl-install/c/stuff.xs.pl +++ b/perl-install/c/stuff.xs.pl @@ -263,8 +263,8 @@ pci_probe() EXTEND(SP, entries.nb); for (i = 0; i < entries.nb; i++) { struct pciusb_entry *e = &entries.entries[i]; - snprintf(buf, sizeof(buf), "%04x\t%04x\t%04x\t%04x\t%d\t%d\t%d\t%d\t%d\t%s\t%s\t%s\t%s", - e->vendor, e->device, e->subvendor, e->subdevice, e->pci_domain, e->pci_bus, e->pci_device, e->pci_function, e->pci_revision, + snprintf(buf, sizeof(buf), "%04x\t%04x\t%04x\t%04x\t%d\t%d\t%d\t%d\t%d\t%d\t%s\t%s\t%s\t%s", + e->vendor, e->device, e->subvendor, e->subdevice, e->pci_domain, e->pci_bus, e->pci_device, e->pci_function, e->pci_revision, e->is_pciexpress, pci_class2text(e->class_id), e->class, e->module ? e->module : "unknown", e->text); PUSHs(sv_2mortal(newSVpv(buf, 0))); } diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index b9fe3ea5e..a8c9d311c 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -806,18 +806,12 @@ sub get_pci_sysfs_path { } -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; -} +my (@pci, @usb); sub pci_probe__real() { add_addons($pcitable_addons, map { my %l; - @l{qw(vendor id subvendor subid pci_domain pci_bus pci_device pci_function pci_revision media_type nice_media_type driver description)} = split "\t"; + @l{qw(vendor id subvendor subid pci_domain pci_bus pci_device pci_function pci_revision is_pciexpress media_type nice_media_type driver description)} = split "\t"; $l{$_} = hex $l{$_} foreach qw(vendor id subvendor subid); $l{bus} = 'PCI'; $l{sysfs_device} = '/sys/bus/pci/devices/' . get_pci_sysfs_path(\%l); @@ -828,9 +822,8 @@ sub pci_probe() { state $done; 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"; + $_->{nice_bus} = $_->{is_pciexpress} ? "PCI Express" : "PCI"; } } @pci; -- cgit v1.2.1