summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-wolfpass/recipes-intel/temporary/set-passthrough/set-passthrough.sh
blob: 3fbe5e7c66c43ecf6460fab3d22798ca15b7ced3 (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
#!/bin/bash

# this script uses devmem to set hardware passthrough
# it is temporary and should be removed in the future

PASSTHROUGH_ENABLE=0x3000

if [[ -z $1 ]]; then
    echo "First Argument Must Be 1 To Enable or 0 To Disable"
    exit 1
fi

if [[ $1 != "0" && $1 != "1" ]]; then
    echo "Arg 1 must be 0 or 1"
    exit 1
fi

# read register
var=$(devmem 0x1e6e208C w)

# convert to int
typeset -i value=$( echo $(( $var )) )

if [[ $1 == "0" ]]; then
    value=$((value & ~PASSTHROUGH_ENABLE))
fi

if [[ $1 == "1" ]]; then
    value=$((value | PASSTHROUGH_ENABLE))
fi

val=$(printf '0x%x\n' $value)

#echo $val

devmem 0x1e6e208C w $val

# devmem 0x1e6e208C w