# Under-/overclocking the GMA950 GPU with pciconf?! (setpci works...)



## GrandAdmiralThrawn (Nov 23, 2016)

Hello!

I have a question about under-/overclocking the integrated Intel GMA950 GPU, in my case sitting in an i945GM chipset.

I know it's very old already, but still. I managed to do this with setpci(8) from sysutils/pciutils, but since FreeBSD has its own tool for reading and writing PCI configuration registers, pciconf(8), I'd like to use that instead.

Here's my current script for manipulating my GMA950s' clock rate, based on Thread Intel GMA945 gmabooster.sh.24492 and others on the web:


```
#!/bin/sh

case "$1" in
  200) clockStep=34 ;;
  250) clockStep=31 ;;
  400) clockStep=33 ;;
  *)
    echo "Wrong or no argument specified! You need to specify a GMA clock speed!" >&2
    echo "Usage: $0 [200|250|400]" >&2
    exit 1
  ;;
esac

setpci -s 02.0 F0.B=00,60
setpci -s 02.0 F0.B=$clockStep,05

echo "Clockspeed set to $1MHz!"
```
I verified that it works by benchmarking games/ioquake3. It shows very clear and reproducible performance scaling.

So what is setpci doing? Way I understand it, it's writing single bytes (".B") to device pci0:0:2:0 ("02.0") starting at address 0xF0 ("F0"), right? So it's writing 00 to 0xF0 and 60 to 0xF1, then $clockStep to 0xF0 and 05 to 0xF1, is that correct? It should be, because something like this too, works:

`# setpci -s 02.0 F0.B=00`
`# setpci -s 02.0 F1.B=60`
`# setpci -s 02.0 F0.B=34`
`# setpci -s 02.0 F1.B=05`

Now I tried to do the same thing with pciconf, step by step!

`# pciconf -w -b pci0:0:2:0 0xF0 00`
`# pciconf -w -b pci0:0:2:0 0xF1 60`
`# pciconf -w -b pci0:0:2:0 0xF0 34`
`# pciconf -w -b pci0:0:2:0 0xF1 05`

This locks the machine up at the second command, attemping to write "60" at 0xF1. I just don't get it.

To be sure that I'm not doing it wrong, I rebooted, and tried reading the default PCR values instead:


```
# pciconf -r -b pci0:0:2:0 0xF0
03
# pciconf -r -b pci0:0:2:0 0xF1
00
# setpci -s 02.0 F0.B
03
# setpci -s 02.0 F1.B
00
```
Not conclusive yet... Let's fetch full words out of the registers:


```
# pciconf -r pci0:0:2:0 0xF0
34640003
# setpci -s 02.0 F0.L
34640003
```
Looks as if it should be right? I've definitely got the right PCI device and the byte order is the same too.

So, now my question: What is it, that I'm doing wrong when writing to the PCRs with pciconf?

Thanks!


----------

