| 1 |
;============================================================================ |
| 2 |
;## SPDX-License-Identifier: GPL-2.0-only |
| 3 |
;============================================================================ |
| 4 |
; Name: |
| 5 |
; debug_cb_common.cmm |
| 6 |
; |
| 7 |
; Description: |
| 8 |
; Debug coreboot Environment |
| 9 |
;============================================================================ |
| 10 |
|
| 11 |
;============================================================================ |
| 12 |
; CMM script variables |
| 13 |
;============================================================================ |
| 14 |
|
| 15 |
LOCAL &BBStage // Bootblock Stage stop? |
| 16 |
LOCAL &VERStage // Verify Stage stop? |
| 17 |
LOCAL &ROMStage // Rom Stage stop? |
| 18 |
LOCAL &QCLStage // QCL Stage stop? |
| 19 |
LOCAL &RAMStage // Ram Stage stop? |
| 20 |
LOCAL &BL31Stage // BL31 Stage stop? |
| 21 |
LOCAL &DCStage // Depthcharge Stage stop? |
| 22 |
|
| 23 |
LOCAL &RAMLoad // T32 Load Code? |
| 24 |
|
| 25 |
;============================================================================ |
| 26 |
|
| 27 |
;--------------------------------------------------- |
| 28 |
; Entry point |
| 29 |
;--------------------------------------------------- |
| 30 |
ENTRY &TargetPkg &srcpath &xblsrcpath &ImageName |
| 31 |
|
| 32 |
// Parse for RAMLoad first |
| 33 |
if (STR.CP("&ImageName","LOAD,*")) |
| 34 |
( |
| 35 |
&RAMLoad=TRUE() |
| 36 |
&ImageName=STR.CUT("&ImageName",5) |
| 37 |
) |
| 38 |
else |
| 39 |
&RAMLoad=FALSE() |
| 40 |
|
| 41 |
// Parse &ImageName the easy way |
| 42 |
if (STR.CP("&ImageName","*ALL*")) |
| 43 |
( |
| 44 |
&BBStage=TRUE() |
| 45 |
&VERStage=TRUE() |
| 46 |
&ROMStage=TRUE() |
| 47 |
&QCLStage=TRUE() |
| 48 |
&RAMStage=TRUE() |
| 49 |
;&BL31Stage=TRUE() |
| 50 |
&DCStage=TRUE() |
| 51 |
) |
| 52 |
else |
| 53 |
( |
| 54 |
&BBStage=STRING.CP("&ImageName","*BB*") |
| 55 |
&VERStage=STRING.CP("&ImageName","*VER*") |
| 56 |
&ROMStage=STRING.CP("&ImageName","*ROM*") |
| 57 |
&QCLStage=STRING.CP("&ImageName","*QCL*") |
| 58 |
&RAMStage=STRING.CP("&ImageName","*RAM*") |
| 59 |
;&BL31Stage=STRING.CP("&ImageName","*BL31*") |
| 60 |
&DCStage=STRING.CP("&ImageName","*DC*") |
| 61 |
) |
| 62 |
|
| 63 |
PRINT %String "Debug Script: debug_cb_common.cmm" |
| 64 |
PRINT %String "Images to debug: &ImageName" |
| 65 |
PRINT %String "RAMLoad Requested: &RAMLoad" |
| 66 |
PRINT %String "BootBlock Entry Addr: &BBEntryAddr" |
| 67 |
PRINT %String "VerStage Entry Addr: &VEREntryAddr" |
| 68 |
PRINT %String "RomStage Entry Addr: &ROMEntryAddr" |
| 69 |
PRINT %String "QCLStage Entry Addr: &QCLEntryAddr" |
| 70 |
PRINT %String "RamStage Entry Addr: &RAMEntryAddr" |
| 71 |
PRINT %String "BL31 Entry Addr: &BL31EntryAddr" |
| 72 |
PRINT %String "DepthCharge Entry Addr: &DCEntryAddr" |
| 73 |
PRINT %String "Kernel Entry Addr: &KernelEntryAddr" |
| 74 |
PRINT %String "PreRamCbfsCache: &PreRamCbfsCache" |
| 75 |
PRINT %String "PreRamConsoleAddr: &PreRamConsoleAddr" |
| 76 |
PRINT %String "VBoot2Work: &VBoot2Work" |
| 77 |
PRINT %String "Stack: &Stack" |
| 78 |
PRINT %String "Ttb: &Ttb" |
| 79 |
PRINT %String "Timestamp &Timestamp" |
| 80 |
PRINT %String "RamConsoleAddr &RamConsoleAddr" |
| 81 |
PRINT %String "CbmemTop &CbmemTop" |
| 82 |
PRINT %String "PostRamCbfsCache &PostRamCbfsCache" |
| 83 |
|
| 84 |
// HW at BB entry, first stop: bootblock |
| 85 |
//////////////////////////////////////// |
| 86 |
|
| 87 |
if &BBStage |
| 88 |
( |
| 89 |
&imgpath="build\cbfs\fallback\bootblock.raw.elf" |
| 90 |
if (&RAMLoad) |
| 91 |
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath |
| 92 |
else |
| 93 |
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath /nocode |
| 94 |
|
| 95 |
d.l |
| 96 |
|
| 97 |
print %String "Now the control is in BootBlock, press enter after debugging to go to next stage" |
| 98 |
print %String "Press enter to go to next stage" |
| 99 |
enter |
| 100 |
) |
| 101 |
|
| 102 |
go &VEREntryAddr |
| 103 |
wait !run() |
| 104 |
|
| 105 |
if &VERStage |
| 106 |
( |
| 107 |
&imgpath="build\cbfs\fallback\verstage.elf" |
| 108 |
if (&RAMLoad) |
| 109 |
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath /noclear |
| 110 |
else |
| 111 |
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath /nocode /noclear |
| 112 |
|
| 113 |
print %String "Now the control is in VERStage, press enter after debugging to go to next stage" |
| 114 |
print %String "Press enter to go to next stage" |
| 115 |
enter |
| 116 |
) |
| 117 |
|
| 118 |
go &ROMEntryAddr |
| 119 |
wait !run() |
| 120 |
|
| 121 |
if &ROMStage |
| 122 |
( |
| 123 |
&imgpath="build\cbfs\fallback\romstage.elf" |
| 124 |
if (&RAMLoad) |
| 125 |
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath |
| 126 |
else |
| 127 |
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath /nocode |
| 128 |
|
| 129 |
print %String "Now the control is in ROMStage, press enter after debugging to go to next stage" |
| 130 |
print %String "Press enter to go to next stage" |
| 131 |
enter |
| 132 |
) |
| 133 |
|
| 134 |
;;;; START OF COMMENTED OUT CODE TO SKIP QCLIB DEBUG |
| 135 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 136 |
|
| 137 |
; go &QCLEntryAddr |
| 138 |
; wait !run() |
| 139 |
|
| 140 |
; if &QCLStage |
| 141 |
; ( |
| 142 |
|
| 143 |
; if (&RAMLoad) |
| 144 |
; d.load ...\QcLib.dll |
| 145 |
; else |
| 146 |
; d.load ...\QcLib.dll |
| 147 |
|
| 148 |
|
| 149 |
; print %String "Now the control is in QCLStage, press enter after debugging to go to next stage" |
| 150 |
; print %String "Press enter to go to next stage" |
| 151 |
; enter |
| 152 |
; ) |
| 153 |
|
| 154 |
;;;; END OF QCLIB COMMENTED OUT CODE |
| 155 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 156 |
|
| 157 |
go &RAMEntryAddr |
| 158 |
wait !run() |
| 159 |
|
| 160 |
if &RAMStage |
| 161 |
( |
| 162 |
&imgpath="build\cbfs\fallback\ramstage.elf" |
| 163 |
if (&RAMLoad) |
| 164 |
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath |
| 165 |
else |
| 166 |
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath /nocode |
| 167 |
print %String "Now the control is in RAMStage, press enter after debugging to go to next stage" |
| 168 |
print %String "Press enter to go to next stage" |
| 169 |
enter |
| 170 |
) |
| 171 |
|
| 172 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 173 |
;;;;; BL31 DEBUG CODE WOULD BE ADDED HERE |
| 174 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 175 |
|
| 176 |
go &DCEntryAddr |
| 177 |
wait !run() |
| 178 |
|
| 179 |
if &DCStage |
| 180 |
( |
| 181 |
&imgpath="payloads\external\depthcharge\depthcharge\build\depthcharge.elf" |
| 182 |
symbol.sourcepath.setbasedir &srcpath\payloads |
| 183 |
y.spath.srd payloads\external\depthcharge\depthcharge\src |
| 184 |
if (&RAMLoad) |
| 185 |
d.load.elf &imgpath /strippart "payloads" /sourcepath &srcpath |
| 186 |
else |
| 187 |
d.load.elf &imgpath /strippart "payloads" /sourcepath &srcpath /nocode |
| 188 |
print %String "Now the control is in depthcharge, end of script" |
| 189 |
d.l |
| 190 |
;b.s main |
| 191 |
;Execute this command in T32 if you start debugging vboot code, e.g. vboot_select_and_load_kernel() |
| 192 |
;y.spath.srd 3rdparty\vboot\firmware |
| 193 |
) |
| 194 |
|
| 195 |
enddo |