summaryrefslogtreecommitdiffstats
path: root/src/build/simics/startup.simics
blob: f7ed4765d94e4b5ff21fb839b632c2d8e4d608f1 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

# Initialize HB search paths.
$sandbox_base = (shell "printenv SANDBOXBASE")
$script_dir = $sandbox_base + "/obj/ppc/simu/scripts"
add-directory $script_dir
$hb_startup_path = (lookup-file hbfw/startup.simics)
$hb_script_location = (python "''.join(map('/'.__add__,\""+$hb_startup_path+"\"[1:].split('/')[0:-1]))")
python "os.environ['HB_TOOLPATH'] = \""+$hb_script_location+"\""

$machine_name = (shell "printenv MACHINE")
$hb_machine = $machine_name

python "os.environ['HB_MACHINE'] = \""+$hb_machine+"\""
echo "HB_MACHINE is: "+$hb_machine

# Setup some common vars to use across machine types
$hb_masterproc = (get-master-proc)
echo "Master Proc is: "+$hb_masterproc
$hb_masterproc_cecchip = (get-master-cec-chip)
echo "Master Proc Cec-Chip is: "+$hb_masterproc_cecchip
#New Simics flow can simply get the string from get-master-pnor command
$hb_pnor = ""
$hb_pnor = (get-master-pnor)

if ($hb_pnor == NIL) {
    try {
        @simenv.hb_pnor = quiet_run_command("get-master-pnor")[0]
        @SIM_get_object(simenv.hb_pnor[0])
    } except {
        # Default to Nimbus name
        foreach $pnor in (get-object-list -all BmcCmp) {
            $hb_pnor = ($pnor)
        }
        $hb_pnor = $hb_pnor+".sfc_master_mem"
    }
}
echo "Master PNOR is: "+$hb_pnor

$hb_mode = 1  #Old Mode -- No simics internals changed
$runsim_lookup = (lookup-file -query "%simics%/runsim")
if ($runsim_lookup) {
    $hb_mode = 0 #New Mode -- Some simics internal changes
}

# Choose a default core to start with
$hb_cpu = "system_cmp0.cpu0_0_00_0"
echo "Defaulting to CPU "+$hb_cpu+" for Hostboot tools"

# Prevent SBE Updates from happening on an IPL
echo "Altering SBE SEEPROM Versions to disable Update in IPL"
foreach $cc in (get-object-list p9_proc) {
    ($cc).seeprom1.seeprom1_image.set 0x3FED9 0x5A5A5A5A 8 -l
    ($cc).seeprom3.seeprom3_image.set 0x3FED9 0x5A5A5A5A 8 -l
}

# Load HB debug tools.
try {
    run-python-file (lookup-file hbfw/simics-debug-framework.py)
}   except { echo "ERROR: Failed to load Simics debug framework (simics-debug-framework.py)" }
try {
    run-python-file (lookup-file hbfw/hb-simdebug.py)
} except { echo "ERROR: Failed to load Hostboot debug tools (hb-simdebug.py)" }

# Determine security state
$hw_security=(shell "echo $SECURITY_HW_POLICY")
if($hw_security == "") {
    # Assume default (no HW security) if not specified
    $hw_security = "0"
}

if(($hw_security != "1") and ($hw_security != "0")) {
    # Emit warning and assume default
    echo ("SECURITY: WARNING! Bad value "+
        $hw_security+" for HW security policy, defaulting to 0")
    $hw_security = "0"
}
echo "SECURITY: HW security policy set to "+$hw_security

# Translate security state to SIMICS jumper state
$jumperApplied=TRUE
if($hw_security == "1") {
    $jumperApplied=FALSE
}

# Load jumper state to each processor
foreach $procX in (get-object-list p9_proc) {

    # Set logical jumper state in SIMICS based on HW policy
    #     "TRUE"=jumper applied(security disabled, default)
    #     "FALSE"=jumper removed(security enabled)
    (($procX)->secure_jumper=$jumperApplied)
}

if ($hb_mode == 0) {
    run-command-file (lookup-file hbfw/standalone.simics)
}

########################### WORKAROUNDS ####################################
# Setup the mailbox.
# for mbox on core 0 use:
# proc_venicechip_cmp0.psi_hb->psihb_xivr_fsi=0x0140000000     #02010917
# for mbox on core 5 use:
#proc_venicechip_cmp0.psi_hb->psihb_xivr_fsi=0x0000A00140000000   #02010917
#proc_venicechip_cmp0.psi_hb->psihb_irsn=0x00030003FFFF0000 #0201091b
OpenPOWER on IntegriCloud