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/gsp/sec2.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 / gsp / sec2.om` 172 lines ยท 3275 bytes Raw Blame History 1 note GB20B SEC2 COTv2 exchange, NVIDIA580.173.02@`20e4e6e` kernel_sec2_gb20b.c. 2 note Requires mmio.om, profile.om, sim.om and sec2sim.om. No launcher/admission supplied. 3 note s2cfg: profile,package,secureBootPollBudget,responsePollBudget,silicon,SEC2present,FMCenabled. 4 note Package2 asserts gb20y + GB20B boot/FMC source; not authentication. Warm/resume/CC unsupported. 5 note Vendor secure-boot deadline is max(scaled4s,default); caller supplies bounded polls with its OS timer. 6 note WolframLanguageEvaluator FromDigits /@ {1B,5E0,840C80,840C84,C0000000,1510DE7E} -> {27,1504,`8653952`,`8653956`,`3221225472`,`353427070`}; 2^25 ->`33554432`. 7 const S2SCR ulong 1504 8 const S2MH ulong `8653952` 9 const S2MT ulong `8653956` 10 const S2AINCR ulong `33554432` 11 global s2cfg ulong 7 12 global s2reply uchar 1024 13 global s2out ulong 4 14 fn s2rd off ulong to ulong 15 if eq get gspmode 0 0 16 ret s2simrd off 17 end 18 ret gsprd off 19 end 20 fn s2wr off ulong v ulong to void 21 if eq get gspmode 0 0 22 s2simwr off v 23 ret 24 end 25 gspwr off v 26 end 27 fn s2wait kind ulong budget ulong to bool 28 for i ulong add budget 1 29 if eq kind 0 30 if eq s2rd S2SCR 255 31 put s2out 0 i 32 ret true 33 end 34 else 35 h = s2rd S2MH 36 t = s2rd S2MT 37 if ne h t 38 put s2out 1 i 39 ret true 40 end 41 end 42 if lt i budget 43 gsppause 44 end 45 end 46 ret false 47 end 48 fn s2get o ulong to ulong 49 v = ulong 0 50 for i ulong 4 51 v = or v shl ulong get s2reply add o i mul i 8 52 end 53 ret v 54 end 55 fn s2save o ulong v ulong to void 56 for j ulong 4 57 c = and shr v mul j 8 255 58 put s2reply add o j uchar c 59 end 60 end 61 fn s2response to long 62 h = s2rd S2MH 63 t = s2rd S2MT 64 if or lt t h gt t 1020 65 ret -12 66 end 67 n = add sub t h 4 68 if or lt n 20 ne rem n 4 0 69 ret -12 70 end 71 s2wr S2EMC S2AINCR 72 for i ulong div n 4 73 v = s2rd S2EMD 74 s2save mul i 4 v 75 end 76 e = ememdw s2rd S2EMC 77 note Vendor acknowledges the packet even when its final offset check fails. 78 s2wr S2MT h 79 s2wr S2MH h 80 if ne e div n 4 81 ret -12 82 end 83 note Single-packet response, vendor PCI 10de, SEC2_RESPONSE; payload starts at byte7. 84 if ne and s2get 0 `3221225472` `3221225472` 85 ret -12 86 end 87 if ne s2get 4 `353427070` 88 ret -12 89 end 90 put s2out 2 s2get 8 91 put s2out 3 s2get 16 92 if ne s2get 12 20 93 ret -12 94 end 95 if ne get s2out 3 0 96 ret -13 97 end 98 ret 0 99 end 100 fn s2pkt o ulong to ulong 101 v = ulong 0 102 for i ulong 4 103 v = or v shl ulong get gpkt add o i mul i 8 104 end 105 ret v 106 end 107 fn s2boot boot42 uint to long 108 for i ulong 4 109 put s2out i 0 110 end 111 if or ne gpclass boot42 2 ne get s2cfg 0 2 112 ret gspfail EARG 113 end 114 if ne get s2cfg 1 2 115 ret gspfail EARG 116 end 117 for i ulong 3 118 if ne get s2cfg add i 4 1 119 ret gspfail EARG 120 end 121 end 122 for i ulong 2 123 if gt get s2cfg add i 2 999998 124 ret gspfail EARG 125 end 126 end 127 if ne get gin 0 868 128 ret gspfail EARG 129 end 130 note Check complete profile header before any register effects; COT version2,size860 and no FRTS. 131 if or ne s2pkt 0 `3221225472` ne s2pkt 4 `336649854` 132 ret gspfail EARG 133 end 134 if ne s2pkt 8 `56360962` 135 ret gspfail EARG 136 end 137 for i ulong 6 138 if ne s2pkt add 20 mul i 4 0 139 ret gspfail EARG 140 end 141 end 142 if not gsppm 143 ret gspfail EPM 144 end 145 if not s2wait 0 get s2cfg 2 146 ret gspfail -10 147 end 148 if not pollstep 0 149 ret gspfail EBUSY 150 end 151 s2wr S2EMC AINCW 152 for i ulong 217 153 v = ulong 0 154 for j ulong 4 155 v = or v shl ulong get gpkt add mul i 4 j mul j 8 156 end 157 s2wr S2EMD v 158 end 159 if ne ememdw s2rd S2EMC 217 160 ret gspfail EEMEM 161 end 162 s2wr S2QT 864 163 s2wr S2QH 0 164 if not s2wait 1 get s2cfg 3 165 ret gspfail -11 166 end 167 r = s2response 168 if ne r 0 169 ret gspfail r 170 end 171 ret gspfinish 172 end