File: getamdgpuids.sh

package info (click to toggle)
radeontop 1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 220 kB
  • sloc: ansic: 1,589; makefile: 107; sh: 24; xml: 16
file content (29 lines) | stat: -rwxr-xr-x 646 bytes parent folder | download | duplicates (3)
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
#!/bin/sh -e
#
#	Extract the amdgpu pci ids from the kernel source.
#	Too bad no more easy libdrm list.
#

quit() {
	echo "Usage: $0 /path/to/kernel/src"
	exit
}

[ "$#" -lt 1 ] && quit
[ ! -d "$1" ] && quit

dir=$1/drivers/gpu/drm/amd/amdgpu

ids=`cpp $dir/amdgpu_drv.c 2>/dev/null | grep 0x1002 | sed -e 's@PCI_AN.*CHIP@CHIP@' \
	-e 's@|.*@@' -e 's@[{,}]@@g' -e 's@^ @@' -e 's@0x1002 @@' -e 's@CHIP_@@'`

fams=`echo "$ids" | awk '{print $2}' | uniq`

# clear previous ones
for i in $fams; do
	sed -i "/$i/d" include/r600_pci_ids.h
done

ids=`echo "$ids" | awk '{print "CHIPSET(" $1 ", " $1 ", " $2 ")"}'`

echo "$ids" >> include/r600_pci_ids.h