blob: 95c5eb579070c13cceb3db1c1e6bfdb514521e72 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/usr/bin/perl -w
use strict;
my %map = (
"PCI_ANY_ID" => "0",
);
sub fix_id($) {
my $id = shift;
$id = $map{$id} if defined($map{$id});
$id =~ s/^0x//;
return $id;
}
my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;
while (<>) {
# defines in header file
if (/#define\s+(SAA7164_BOARD_\w+)\s+(\d+)/) {
$data{$1}->{nr} = $2;
next;
}
# saa7164_boards
if (/\[(SAA7164_BOARD_\w+)\]/) {
$id = $1;
$data{$id}->{id} = $id;
# $data{$id}->{nr} = $nr++;
};
next unless defined($id);
if (!defined($data{$id}) || !defined($data{$id}->{name})) {
$data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
}
# saa7164_pci_tbl
$subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+),/);
$subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+),/);
if (/.card\s*=\s*(\w+),/) {
if (defined($data{$1}) &&
defined($subvendor) && $subvendor ne "0" &&
defined($subdevice) && $subdevice ne "0") {
push @{$data{$1}->{subid}}, "$subvendor:$subdevice";
undef $subvendor;
undef $subdevice;
}
}
}
foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
printf("%3d -> %-51s", $data{$item}->{nr}, $data{$item}->{name});
printf(" [%s]",join(",",@{$data{$item}->{subid}}))
if defined($data{$item}->{subid});
print "\n";
}
|