@@ -36,7 +36,30 @@ def iomap(phys, size, range_size, rw):
3636 IOMapping (), #
3737 IOMapping (), #
3838 ]
39- elif chip_id in (0x6001 , 0x6002 ):
39+ elif chip_id == 0x8112 :
40+ return [
41+ iomap (0x204d00000 , 0x14000 , 0x14000 , 1 ), # Fender
42+ iomap (0x20e100000 , 0x4000 , 0x4000 , 0 ), # AICTimer
43+ iomap (0x23b0c4000 , 0x4000 , 0x4000 , 1 ), # AICSWInt
44+ iomap (0x204000000 , 0x20000 , 0x20000 , 1 ), # RGX
45+ IOMapping (), # UVD
46+ IOMapping (), # unused
47+ IOMapping (), # DisplayUnderrunWA
48+ iomap (0x23b2c0000 , 0x1000 , 0x1000 , 0 ), # AnalogTempSensorControllerRegs
49+ IOMapping (), # PMPDoorbell
50+ iomap (0x204d80000 , 0x8000 , 0x8000 , 1 ), # MetrologySensorRegs
51+ iomap (0x204d61000 , 0x1000 , 0x1000 , 1 ), # GMGIFAFRegs
52+ iomap (0x200000000 , 0xd6400 , 0xd6400 , 1 ), # MCache registers
53+ IOMapping (), # AICBankedRegisters
54+ IOMapping (), # PMGRScratch
55+ IOMapping (), # NIA Special agent idle register die 0
56+ IOMapping (), # NIA Special agent idle register die 1
57+ iomap (0x204e00000 , 0x10000 , 0x10000 , 0 ), # CRE registers
58+ iomap (0x27d050000 , 0x4000 , 0x4000 , 0 ), # Streaming codec registers
59+ iomap (0x23b3d0000 , 0x1000 , 0x1000 , 0 ), #
60+ iomap (0x23b3c0000 , 0x1000 , 0x1000 , 0 ), #
61+ ]
62+ elif chip_id in (0x6000 , 0x6001 , 0x6002 ):
4063 mcc_cnt = {0x6002 : 16 , 0x6001 : 8 , 0x6000 : 4 }
4164 return [
4265 iomap (0x404d00000 , 0x1c000 , 0x1c000 , 1 ), # Fender
@@ -73,23 +96,27 @@ def iomap(phys, size, range_size, rw):
7396 unk_924 = [[0 ] * 8 ] * 8 ,
7497 unk_e48 = [[0 ] * 8 ] * 8 ,
7598 unk_e24 = 112 ,
99+ gpu_fast_die0_sensor_mask64 = 0x12 ,
76100 gpu_fast_die0_sensor_mask64_alt = 0x12 ,
77101 gpu_fast_die0_sensor_present = 0x01 ,
78102 shared1_tab = [
79103 - 1 , 0x7282 , 0x50ea , 0x370a , 0x25be , 0x1c1f , 0x16fb
80- ] + ([- 1 ] * 9 ),
81- shared2_tab = [0x800 , 0x1555 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 ],
104+ ] + ([- 1 ] * 10 ),
105+ shared1_a4 = 0xffff ,
106+ shared2_tab = [0x800 , 0x1555 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 0 , 0 ],
82107 shared2_unk_508 = 0xc0007 ,
83108 unk_3cf4 = [1000.0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
84109 unk_3d14 = [45.0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
85110 unk_118ec = None ,
86111 hwdb_4e0 = 0 ,
87112 hwdb_534 = 0 ,
88113 num_cores = 8 ,
89- hwdb_560 = 11 ,
90- hwdb_564 = 4 ,
114+ gpu_core = 11 ,
115+ gpu_rev = 4 ,
91116 hwdb_ab8 = 0x48 ,
92117 hwdb_abc = 0x8 ,
118+ hwdb_b30 = 0 ,
119+ rel_max_powers = [0 , 19 , 26 , 38 , 60 , 87 , 100 ],
93120 ),
94121 0x6001 : Container (
95122 chip_id = 0x6001 ,
@@ -106,10 +133,12 @@ def iomap(phys, size, range_size, rw):
106133 13 , 13 , 13 , 13 , 0 , 0 , 0 , 0 ,
107134 ]],
108135 unk_e24 = 125 ,
136+ gpu_fast_die0_sensor_mask64 = 0x80808080 ,
109137 gpu_fast_die0_sensor_mask64_alt = 0x90909090 ,
110138 gpu_fast_die0_sensor_present = 0x0f ,
111- shared1_tab = [0 ] + ([0xffff ] * 15 ),
112- shared2_tab = [- 1 , - 1 , - 1 , - 1 , 0x2aa , 0xaaa , - 1 , - 1 ],
139+ shared1_tab = [0 ] + ([0xffff ] * 16 ),
140+ shared1_a4 = 0xffff ,
141+ shared2_tab = [- 1 , - 1 , - 1 , - 1 , 0x2aa , 0xaaa , - 1 , - 1 , 0 , 0 ],
113142 shared2_unk_508 = 0xcc00001 ,
114143 unk_3cf4 = [1314.0 , 1330.0 , 1314.0 , 1288.0 , 0 , 0 , 0 , 0 ],
115144 unk_3d14 = [21.0 , 21.0 , 22.0 , 21.0 , 0 , 0 , 0 , 0 ],
@@ -122,10 +151,12 @@ def iomap(phys, size, range_size, rw):
122151 hwdb_4e0 = 4 ,
123152 hwdb_534 = 1 ,
124153 num_cores = 32 ,
125- hwdb_560 = 13 ,
126- hwdb_564 = 5 ,
154+ gpu_core = 13 ,
155+ gpu_rev = 5 ,
127156 hwdb_ab8 = 0x2084 ,
128157 hwdb_abc = 0x80 ,
158+ hwdb_b30 = 0 ,
159+ rel_max_powers = [0 , 15 , 20 , 27 , 36 , 52 , 100 ],
129160 ),
130161 0x6002 : Container (
131162 chip_id = 0x6002 ,
@@ -143,10 +174,12 @@ def iomap(phys, size, range_size, rw):
143174 13 , 13 , 13 , 13 , 13 , 13 , 13 , 13 ,
144175 ]],
145176 unk_e24 = 125 ,
177+ gpu_fast_die0_sensor_mask64 = 0x8080808080808080 ,
146178 gpu_fast_die0_sensor_mask64_alt = 0x9090909090909090 ,
147179 gpu_fast_die0_sensor_present = 0xff ,
148- shared1_tab = [0 ] + ([0xffff ] * 15 ),
149- shared2_tab = [- 1 , - 1 , - 1 , - 1 , 0x2aa , 0xaaa , - 1 , - 1 ],
180+ shared1_tab = [0 ] + ([0xffff ] * 16 ),
181+ shared1_a4 = 0xffff ,
182+ shared2_tab = [- 1 , - 1 , - 1 , - 1 , 0x2aa , 0xaaa , - 1 , - 1 , 0 , 0 ],
150183 shared2_unk_508 = 0xcc00001 ,
151184 unk_3cf4 = [1244.0 , 1260.0 , 1242.0 , 1214.0 ,
152185 1072.0 , 1066.0 , 1044.0 , 1042.0 ],
@@ -161,10 +194,48 @@ def iomap(phys, size, range_size, rw):
161194 hwdb_4e0 = 4 ,
162195 hwdb_534 = 1 ,
163196 num_cores = 64 ,
164- hwdb_560 = 13 ,
165- hwdb_564 = 5 ,
197+ gpu_core = 13 ,
198+ gpu_rev = 5 ,
166199 hwdb_ab8 = 0x2084 ,
167200 hwdb_abc = 0x80 ,
201+ hwdb_b30 = 0 ,
202+ rel_max_powers = [0 , 15 , 19 , 25 , 34 , 50 , 100 ],
203+ ),
204+ 0x8112 : Container (
205+ chip_id = 0x8112 ,
206+ min_sram_volt = 780 ,
207+ max_power = 22800 ,
208+ max_freq_mhz = 1398 ,
209+ unk_87c = 900 ,
210+ unk_8cc = 11000 ,
211+ unk_924 = [[
212+ 0.0 , 0.0 , 0.0 , 0.0 ,
213+ 5.3 , 0.0 , 5.3 , 6.6 ,
214+ ]] + ([[0 ] * 8 ] * 7 ),
215+ unk_e48 = [[
216+ 0.0 , 0.0 , 0.0 , 0.0 ,
217+ 5.3 , 0.0 , 5.3 , 6.6 ,
218+ ]] + ([[0 ] * 8 ] * 7 ),
219+ unk_e24 = 125 ,
220+ gpu_fast_die0_sensor_mask64 = 0x6800 ,
221+ gpu_fast_die0_sensor_mask64_alt = 0x6800 ,
222+ gpu_fast_die0_sensor_present = 0x02 ,
223+ shared1_tab = [0 ] + ([0xffff ] * 16 ),
224+ shared1_a4 = 0 ,
225+ shared2_tab = [- 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , - 1 , 0xaa5aa , 0 ],
226+ shared2_unk_508 = 0xc00000 ,
227+ unk_3cf4 = [1920.0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
228+ unk_3d14 = [74.0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ],
229+ unk_118ec = None ,
230+ hwdb_4e0 = 4 ,
231+ hwdb_534 = 0 ,
232+ num_cores = 10 ,
233+ gpu_core = 15 ,
234+ gpu_rev = 3 ,
235+ hwdb_ab8 = 0x2048 ,
236+ hwdb_abc = 0x4000 ,
237+ hwdb_b30 = 1 ,
238+ rel_max_powers = [0 , 18 , 27 , 37 , 52 , 66 , 82 , 96 , 100 ],
168239 ),
169240}
170241def build_initdata (agx ):
@@ -191,7 +262,7 @@ def build_initdata(agx):
191262 regionB .stats_cp = agx .kobj .new_buf (0x980 , "RegionB.unkptr_180" ).push ()
192263
193264 # size: 0x3b80, few floats, few ints, needed for init
194- regionB .hwdata_a = agx .kobj .new (AGXHWDataA (sgx , chip_info ), track = False ). push ()
265+ regionB .hwdata_a = agx .kobj .new (AGXHWDataA (sgx , chip_info ), track = False )
195266
196267 # size: 0x80, empty
197268 regionB .unk_190 = agx .kobj .new_buf (0x80 , "RegionB.unkptr_190" ).push ()
@@ -203,11 +274,12 @@ def build_initdata(agx):
203274 hwdata = agx .kobj .new (AGXHWDataB (sgx , chip_info ), track = False )
204275 hwdata .io_mappings = build_iomappings (agx , chosen .chip_id )
205276
206- # how is this computed?
207- perf_levels = [0 , 19 , 26 , 38 , 60 , 87 , 100 ]
208277 k = 1.02 #?
209278 count = sgx .perf_state_count
210279 table_count = sgx .perf_state_table_count
280+ base_pstate = sgx .getprop ("gpu-perf-base-pstate" , 3 )
281+ base_freq = sgx .perf_states [base_pstate ].freq
282+ max_freq = sgx .perf_states [count - 1 ].freq
211283 for i in range (count ):
212284 ps = sgx .perf_states [i ]
213285 hwdata .frequencies [i ] = ps .freq // 1000000
@@ -222,14 +294,10 @@ def build_initdata(agx):
222294
223295 regionB .hwdata_a .unk_74 [i ] = k
224296 hwdata .unk_9b4 [i ] = k
225- hwdata .rel_max_powers [i ] = perf_levels [i ]
297+ hwdata .rel_max_powers [i ] = chip_info .rel_max_powers [i ]
298+ hwdata .rel_boost_freqs [i ] = max (0 , int ((ps .freq - base_freq ) / (max_freq - base_freq ) * 100 ))
226299
227- # Mac Mini t8103
228- #hwdata.rel_unk = [0, 0, 0, 0, 36, 73, 100] + [0]*9
229- # Mac Studio t6002
230- hwdata .rel_unk = [0 , 0 , 0 , 0 , 20 , 50 , 100 ] + [0 ]* 9
231- # Macbook 14" t6001
232- #hwdata.rel_unk = [0, 0, 10, 28, 42, 64, 100] + [0]*9
300+ regionB .hwdata_a .push ()
233301
234302 regionB .hwdata_b = hwdata .push ()
235303 regionB .hwdata_b_addr2 = hwdata ._addr
@@ -315,5 +383,5 @@ def build_initdata(agx):
315383 initdata .regionC .push ()
316384 initdata .push ()
317385
318- print (initdata .val )
386+ # print(InitData.parse_stream(agx.uat.iostream(0, initdata._addr)) )
319387 return initdata
0 commit comments