changeset 7243: | 34f64dcbbc25 |
parent: | 4c3716f1b2d9 |
author: | cinap_lenrek@felloff.net |
date: | Fri, 17 May 2019 18:14:10 +0200 |
permissions: | -rwxr-xr-x |
description: | 7l: don't hardcode 4k pagesize, use INITRND |
1 #!/bin/rc2 # pci [-bv] - dump pci configuration3 rfork e4 fn verbose {5 if (! test -f /lib/pci)6 echo $0: no /lib/pci >[1=2]7 awk '9 function lower(s) {10 gsub(/A/, "a", s)11 gsub(/B/, "b", s)12 gsub(/C/, "c", s)13 gsub(/D/, "d", s)14 gsub(/E/, "e", s)15 gsub(/F/, "f", s)16 return s17 }18 BEGIN{19 file="/lib/pci"20 FS="\t"21 while(getline <file > 0){22 if(/^[#;]/) continue23 if(/^[0-9A-Fa-f]/){24 vid=$1 #vid=lower($1)25 vendor[vid] = $226 }27 if(/^ [0-9A-Fa-f]/){28 did=$2 #lower($2)29 id[vid "/" did] = $330 }31 }32 FS = " "33 }35 {36 print $037 vid = $438 sub(/\/.*/, "", vid)39 if(vid in vendor){40 s = vendor[vid]41 if($4 in id)42 s = s " " id[$4]43 print "\t" s44 }45 }46 '47 }49 filter=cat50 flagfmt=v,b51 args='[vid/did ...]'52 if(! ifs=() eval `{aux/getflags $*}){53 aux/usage54 exit usage55 }57 if(! ~ $#* 0){58 {59 for(i in `{echo $* | tr 'A-Z' 'a-z'})60 echo '- - -' $i61 } | verbose | sed 's:^- - - ::'62 exit ''63 }65 if(~ $#flagv 1)66 filter=verbose67 builtin cd '#$/pci' && grep . `{ls -n | grep ctl} | {68 if (~ $#flagb 1)69 sed /:06/d70 if not71 cat72 } |73 sed '74 s/ctl:/: /75 t noop76 : noop77 s/: 01/: disk 01/78 s/: 02/: net 02/79 s/: 03/: vid 03/80 s/: 04/: aud 04/81 s/: 05/: mem 05/82 s/: 06/: brg 06/83 s/: 07/: ser 07/84 s/: 08/: base 08/85 s/: 09/: inpt 09/86 s/: 0a/: dock 0a/87 s/: 0b/: proc 0b/88 s/: 0c\.03/: usb 0c.03/89 s/: 0c\.05/: smb 0c.05/90 s/: 0c\.07/: ipmi 0c.07/91 s/: 0d/: rad 0d/92 s/: 0e/: intl 0e/93 s/: 0f/: sat 0f/94 s/: 10/: cryp 10/95 s/: 11/: sigl 11/96 s/: 12/: exl 12/97 t98 s/ / --- /99 ' | $filter