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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
;============================================================================
;##
;## This file is part of the coreboot project.
;##
;## This program is free software; you can redistribute it and/or modify
;## it under the terms of the GNU General Public License version 2 and
;## only version 2 as published by the Free Software Foundation.
;##
;## This program is distributed in the hope that it will be useful,
;## but WITHOUT ANY WARRANTY; without even the implied warranty of
;## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;## GNU General Public License for more details.
;##
;============================================================================
; Name:
; debug_cb_common.cmm
;
; Description:
; Debug coreboot Environment
;============================================================================
;============================================================================
; CMM script variables
;============================================================================
LOCAL &BBStage // Bootblock Stage stop?
LOCAL &VERStage // Verify Stage stop?
LOCAL &ROMStage // Rom Stage stop?
LOCAL &QCLStage // QCL Stage stop?
LOCAL &RAMStage // Ram Stage stop?
LOCAL &BL31Stage // BL31 Stage stop?
LOCAL &DCStage // Depthcharge Stage stop?
LOCAL &RAMLoad // T32 Load Code?
;============================================================================
;---------------------------------------------------
; Entry point
;---------------------------------------------------
ENTRY &TargetPkg &srcpath &xblsrcpath &ImageName
// Parse for RAMLoad first
if (STR.CP("&ImageName","LOAD,*"))
(
&RAMLoad=TRUE()
&ImageName=STR.CUT("&ImageName",5)
)
else
&RAMLoad=FALSE()
// Parse &ImageName the easy way
if (STR.CP("&ImageName","*ALL*"))
(
&BBStage=TRUE()
&VERStage=TRUE()
&ROMStage=TRUE()
&QCLStage=TRUE()
&RAMStage=TRUE()
;&BL31Stage=TRUE()
&DCStage=TRUE()
)
else
(
&BBStage=STRING.CP("&ImageName","*BB*")
&VERStage=STRING.CP("&ImageName","*VER*")
&ROMStage=STRING.CP("&ImageName","*ROM*")
&QCLStage=STRING.CP("&ImageName","*QCL*")
&RAMStage=STRING.CP("&ImageName","*RAM*")
;&BL31Stage=STRING.CP("&ImageName","*BL31*")
&DCStage=STRING.CP("&ImageName","*DC*")
)
PRINT %String "Debug Script: debug_cb_common.cmm"
PRINT %String "Images to debug: &ImageName"
PRINT %String "RAMLoad Requested: &RAMLoad"
PRINT %String "BootBlock Entry Addr: &BBEntryAddr"
PRINT %String "VerStage Entry Addr: &VEREntryAddr"
PRINT %String "RomStage Entry Addr: &ROMEntryAddr"
PRINT %String "QCLStage Entry Addr: &QCLEntryAddr"
PRINT %String "RamStage Entry Addr: &RAMEntryAddr"
PRINT %String "BL31 Entry Addr: &BL31EntryAddr"
PRINT %String "DepthCharge Entry Addr: &DCEntryAddr"
PRINT %String "Kernel Entry Addr: &KernelEntryAddr"
PRINT %String "PreRamCbfsCache: &PreRamCbfsCache"
PRINT %String "PreRamConsoleAddr: &PreRamConsoleAddr"
PRINT %String "VBoot2Work: &VBoot2Work"
PRINT %String "Stack: &Stack"
PRINT %String "Ttb: &Ttb"
PRINT %String "Timestamp &Timestamp"
PRINT %String "RamConsoleAddr &RamConsoleAddr"
PRINT %String "CbmemTop &CbmemTop"
PRINT %String "PostRamCbfsCache &PostRamCbfsCache"
// HW at BB entry, first stop: bootblock
////////////////////////////////////////
if &BBStage
(
&imgpath="build\cbfs\fallback\bootblock.raw.elf"
if (&RAMLoad)
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath
else
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath /nocode
d.l
print %String "Now the control is in BootBlock, press enter after debugging to go to next stage"
print %String "Press enter to go to next stage"
enter
)
go &VEREntryAddr
wait !run()
if &VERStage
(
&imgpath="build\cbfs\fallback\verstage.elf"
if (&RAMLoad)
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath /noclear
else
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath /nocode /noclear
print %String "Now the control is in VERStage, press enter after debugging to go to next stage"
print %String "Press enter to go to next stage"
enter
)
go &ROMEntryAddr
wait !run()
if &ROMStage
(
&imgpath="build\cbfs\fallback\romstage.elf"
if (&RAMLoad)
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath
else
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath /nocode
print %String "Now the control is in ROMStage, press enter after debugging to go to next stage"
print %String "Press enter to go to next stage"
enter
)
;;;; START OF COMMENTED OUT CODE TO SKIP QCLIB DEBUG
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; go &QCLEntryAddr
; wait !run()
; if &QCLStage
; (
; if (&RAMLoad)
; d.load ...\QcLib.dll
; else
; d.load ...\QcLib.dll
; print %String "Now the control is in QCLStage, press enter after debugging to go to next stage"
; print %String "Press enter to go to next stage"
; enter
; )
;;;; END OF QCLIB COMMENTED OUT CODE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
go &RAMEntryAddr
wait !run()
if &RAMStage
(
&imgpath="build\cbfs\fallback\ramstage.elf"
if (&RAMLoad)
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath
else
d.load.elf &imgpath /strippart "coreboot" /sourcepath &srcpath /nocode
print %String "Now the control is in RAMStage, press enter after debugging to go to next stage"
print %String "Press enter to go to next stage"
enter
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;; BL31 DEBUG CODE WOULD BE ADDED HERE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
go &DCEntryAddr
wait !run()
if &DCStage
(
&imgpath="payloads\external\depthcharge\depthcharge\build\depthcharge.elf"
symbol.sourcepath.setbasedir &srcpath\payloads
y.spath.srd payloads\external\depthcharge\depthcharge\src
if (&RAMLoad)
d.load.elf &imgpath /strippart "payloads" /sourcepath &srcpath
else
d.load.elf &imgpath /strippart "payloads" /sourcepath &srcpath /nocode
print %String "Now the control is in depthcharge, end of script"
d.l
;b.s main
;Execute this command in T32 if you start debugging vboot code, e.g. vboot_select_and_load_kernel()
;y.spath.srd 3rdparty\vboot\firmware
)
enddo
|