3 # PciTab -- encapsulate modules.pcimap
4 # Copyright (C) 2005 Erik van Konijnenburg
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 # # pci module vendor device subvendor subdevice class class_mask driver_data
32 # parport_pc 0x00001106 0x00000686 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
33 # parport_pc 0x00001106 0x00008231 0xffffffff 0xffffffff 0x00000000 0x00000000 0x0
36 if (defined ($pciList)) {
40 my $name = Conf::get('pciMap');
41 if (! open (IN, "<", "$name")) {
42 Base::fatal ("can't open pci module list $name");
44 while (defined (my $line = <IN>)) {
49 next if ($line eq "");
50 my @fields = split (/\s+/, $line, 999);
52 Base::fatal "malformed line in pci module list $name";
54 push @{$pciList}, PciMapEntry->new (
56 vendor => hex ($fields[1]),
57 device => hex ($fields[2]),
58 subvendor => hex ($fields[3]),
59 subdevice => hex ($fields[4]),
60 class => hex ($fields[5]),
61 classmask => hex ($fields[6]),
62 driver_data => hex ($fields[7]),
66 Base::fatal "could not read pci module list $name";
75 # given pathname in devices tree, find module name in PCI map as a list.
79 for my $pme (@{PciTab::all()}) {
80 if ($pme->matches ($dev)) {
81 push @result, $pme->module;