Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-gpu-driver/blob/main/tests/mmio_trace.om # omega-gpu-driver aien-dev/omega-gpu-driver Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-gpu-driver / tests / mmio_trace.om` 325 lines ยท 4883 bytes Raw Blame History 1 note tests/mmio_trace.om: every register access gspboot and gspnotify make against the simulated SEC2 + GSP 2 note (gsp/sim.om, mode 0) in a fixed list of scenarios, one per line. Port of aien-dev/aienux PR #441 3 note native/kernel/tests/gsp_boot_trace.c: same scenarios, same printf bytes (%d, %u, %#x with 0 as `0`, 4 note %06x, %08x), so tests/mmio_diff.sh can cmp the two outputs. Host only; never touches a device. 5 note Build: cat gsp/mmio.om gsp/sim.om tests/mmio_trace.om | omc 6 const ARGSPA ulong `4886716416` 7 const APPVER ulong 390049 8 text tnames "happy busy3 busy-forever sec2-never mask-never hwcfg2-zero2 args-never lockdown-never fmc-error riscv-dead emem-stuck bad-header odd-7 full-1024 too-long budget0 " 9 text th1 "== " 10 text th2 " rc=" 11 text th3 " stage=" 12 text th4 " polls=" 13 text th5 " dwords=" 14 text th6 " ememc=" 15 text th7 " sec2=" 16 text th8 " hwcfg2=" 17 text th9 " gsp=" 18 text th10 " cpuctl=" 19 text th11 " nlog=" 20 text th12 " violations=" 21 text th13 " phase=" 22 global tob uchar 262144 23 global tpos ulong 1 24 global tdig uchar 24 25 fn tflush to void 26 n = get tpos 0 27 if gt n 0 28 r = write 1 tob 0 n 29 if ne r long n 30 exit 1 31 end 32 end 33 put tpos 0 0 34 end 35 fn tch c uchar to void 36 p = get tpos 0 37 put tob p c 38 put tpos 0 add p 1 39 if ge add p 1 262000 40 tflush 41 end 42 end 43 fn ttext k ulong to void 44 if eq k 1 45 for i ulong len th1 46 tch get th1 i 47 end 48 end 49 if eq k 2 50 for i ulong len th2 51 tch get th2 i 52 end 53 end 54 if eq k 3 55 for i ulong len th3 56 tch get th3 i 57 end 58 end 59 if eq k 4 60 for i ulong len th4 61 tch get th4 i 62 end 63 end 64 if eq k 5 65 for i ulong len th5 66 tch get th5 i 67 end 68 end 69 if eq k 6 70 for i ulong len th6 71 tch get th6 i 72 end 73 end 74 if eq k 7 75 for i ulong len th7 76 tch get th7 i 77 end 78 end 79 if eq k 8 80 for i ulong len th8 81 tch get th8 i 82 end 83 end 84 if eq k 9 85 for i ulong len th9 86 tch get th9 i 87 end 88 end 89 if eq k 10 90 for i ulong len th10 91 tch get th10 i 92 end 93 end 94 if eq k 11 95 for i ulong len th11 96 tch get th11 i 97 end 98 end 99 if eq k 12 100 for i ulong len th12 101 tch get th12 i 102 end 103 end 104 if eq k 13 105 for i ulong len th13 106 tch get th13 i 107 end 108 end 109 end 110 note the k-th space-separated name of tnames 111 fn tname k ulong to void 112 w = ulong 0 113 for i ulong len tnames 114 c = get tnames i 115 if eq c 32 116 w = add w 1 117 else 118 if eq w k 119 tch c 120 end 121 end 122 end 123 end 124 note %u 125 fn tdec v ulong to void 126 n = ulong 0 127 x = v 128 while true bound 24 129 put tdig n uchar add rem x 10 48 130 n = add n 1 131 x = div x 10 132 if eq x 0 133 break 134 end 135 end 136 for i ulong n 137 tch get tdig sub sub n 1 i 138 end 139 end 140 note %d 141 fn tsdec v long to void 142 if lt v 0 143 tch 45 144 tdec ulong neg v 145 ret 146 end 147 tdec ulong v 148 end 149 note lowercase hex, at least w digits, zero-padded (%0Nx) 150 fn thex v ulong w ulong to void 151 n = ulong 0 152 x = v 153 while true bound 24 154 d = uchar rem x 16 155 if lt d 10 156 put tdig n add d 48 157 else 158 put tdig n add d 87 159 end 160 n = add n 1 161 x = div x 16 162 if eq x 0 163 break 164 end 165 end 166 while lt n w bound 24 167 put tdig n 48 168 n = add n 1 169 end 170 for i ulong n 171 tch get tdig sub sub n 1 i 172 end 173 end 174 note %#x: 0 alone, otherwise 0x and the digits 175 fn talt v ulong to void 176 if eq v 0 177 tch 48 178 ret 179 end 180 tch 48 181 tch 120 182 thex v 1 183 end 184 fn tbase to void 185 put scfg 0 0 186 put scfg 1 3 187 put scfg 2 4 188 put scfg 3 2 189 put scfg 4 5 190 put scfg 5 0 191 put scfg 6 0 192 put scfg 7 0 193 put scfg 8 ARGSPA 194 put scfg 9 0 195 end 196 fn tput32 o ulong v ulong to void 197 put gpkt o uchar and v 255 198 put gpkt add o 1 uchar and shr v 8 255 199 put gpkt add o 2 uchar and shr v 16 255 200 put gpkt add o 3 uchar and shr v 24 255 201 end 202 fn thead k ulong rc long to void 203 ttext 1 204 tname k 205 ttext 2 206 tsdec rc 207 ttext 3 208 tsdec get gstage 0 209 ttext 4 210 tdec get gout 0 211 tch 44 212 tdec get gout 1 213 tch 44 214 tdec get gout 2 215 tch 44 216 tdec get gout 3 217 ttext 5 218 tdec get gout 4 219 ttext 6 220 talt get gout 5 221 ttext 7 222 talt get gout 6 223 tch 44 224 talt get gout 7 225 ttext 8 226 talt get gout 8 227 ttext 9 228 talt get gout 9 229 tch 44 230 talt get gout 10 231 ttext 10 232 talt get gout 11 233 ttext 11 234 tdec get ss SNLOG 235 ttext 12 236 tdec get ss SVIOL 237 ttext 13 238 tdec get ss SPHASE 239 tch 10 240 end 241 note one scenario: the caller has set scfg; k names it 242 fn tscen k ulong ln ulong budget ulong hdrok bool to void 243 for i ulong 1024 244 put gpkt i uchar and add mul i 13 5 255 245 end 246 if hdrok 247 tput32 0 1 248 tput32 4 `336649854` 249 tput32 8 `56360961` 250 end 251 put gin 0 ln 252 put gin 1 ARGSPA 253 put gin 2 APPVER 254 for j ulong 4 255 put gin add 3 j budget 256 end 257 put gspmode 0 0 258 siminit 259 rc = gspboot 260 if eq rc 0 261 gspnotify 262 end 263 thead k rc 264 n = get ss SNLOG 265 for e ulong n 266 if lt e LOGMAX 267 if eq get slogw e 1 268 tch 87 269 else 270 tch 82 271 end 272 tch 32 273 thex get slogo e 6 274 tch 32 275 thex get slogv e 8 276 tch 10 277 end 278 end 279 end 280 fn main to int 281 tbase 282 tscen 0 868 100 true 283 tbase 284 put scfg 0 3 285 tscen 1 868 100 true 286 tbase 287 put scfg 0 NOEND 288 tscen 2 868 5 true 289 tbase 290 put scfg 1 NOEND 291 tscen 3 868 5 true 292 tbase 293 put scfg 2 NOEND 294 tscen 4 868 5 true 295 tbase 296 put scfg 9 2 297 tscen 5 868 100 true 298 tbase 299 put scfg 3 NOEND 300 tscen 6 868 6 true 301 tbase 302 put scfg 4 NOEND 303 tscen 7 868 6 true 304 tbase 305 put scfg 5 35 306 tscen 8 868 100 true 307 tbase 308 put scfg 6 1 309 tscen 9 868 100 true 310 tbase 311 put scfg 7 1 312 tscen 10 868 100 true 313 tbase 314 tscen 11 868 3 false 315 tbase 316 tscen 12 7 3 true 317 tbase 318 tscen 13 1024 3 true 319 tbase 320 tscen 14 1025 3 true 321 tbase 322 tscen 15 868 0 true 323 tflush 324 ret 0 325 end