Debian Codegraph @

util/qualcomm/scripts/cmm/debug_chroot_common.cmm

raw
1 ;============================================================================
2 ;## SPDX-License-Identifier: GPL-2.0-only
3 ;============================================================================
4 ; Name:
5 ; debug_chroot_common.cmm
6 ;
7 ; Description:
8 ; Debug chroot 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_chroot_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-trogdor\cbfs\fallback\bootblock.raw.elf"
90 if (&RAMLoad)
91 d.load.elf &imgpath /strippart 9 /sourcepath &srcpath
92 else
93 d.load.elf &imgpath /strippart 9 /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-trogdor\cbfs\fallback\verstage.elf"
108 if (&RAMLoad)
109 d.load.elf &imgpath /strippart 9 /sourcepath &srcpath /noclear
110 else
111 d.load.elf &imgpath /strippart 9 /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-trogdor\cbfs\fallback\romstage.elf"
124 if (&RAMLoad)
125 d.load.elf &imgpath /strippart 9 /sourcepath &srcpath
126 else
127 d.load.elf &imgpath /strippart 9 /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-trogdor\cbfs\fallback\ramstage.elf"
163 if (&RAMLoad)
164 d.load.elf &imgpath /strippart 9 /sourcepath &srcpath
165 else
166 d.load.elf &imgpath /strippart 9 /sourcepath &srcpath /nocode
167
168 print %String "Now the control is in RAMStage, press enter after debugging to go to next stage"
169 print %String "Press enter to go to next stage"
170 enter
171 )
172
173 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
174 ;;;;; BL31 DEBUG CODE WOULD BE ADDED HERE
175 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
176
177 go &DCEntryAddr
178 wait !run()
179
180 if &DCStage
181 (
182 &srcpath="..\..\..\depthcharge-9999\work\depthcharge-9999\src"
183 &imgpath="..\..\..\depthcharge-9999\work\depthcharge-9999\trogdor\depthcharge.elf"
184 symbol.sourcepath.setbasedir &srcpath
185 if (&RAMLoad)
186 d.load.elf &imgpath /strippart 9 /sourcepath &srcpath
187 else
188 d.load.elf &imgpath /strippart 9 /sourcepath &srcpath /nocode
189
190 print %String "Now the control is in depthcharge, end of script"
191 d.l
192 ;b.s main
193 ;Execute this command in T32 if you start debugging vboot code, e.g. vboot_select_and_load_kernel()
194 ;y.spath.sbd 3rdparty\vboot\firmware
195 )
196
197 enddo