xref: /linux/drivers/gpu/nova-core/regs.rs (revision a69a9e23dce95a1b7315f73b29200a58e0f54830)
1 // SPDX-License-Identifier: GPL-2.0
2 // SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 
4 use kernel::{
5     io::{
6         register,
7         register::WithBase,
8         Io, //
9     },
10     prelude::*,
11     sizes::SizeConstants,
12     time, //
13 };
14 
15 use crate::{
16     driver::Bar0,
17     falcon::{
18         DmaTrfCmdSize,
19         FalconCoreRev,
20         FalconCoreRevSubversion,
21         FalconEngine,
22         FalconFbifMemType,
23         FalconFbifTarget,
24         FalconMem,
25         FalconModSelAlgo,
26         FalconSecurityModel,
27         PFalcon2Base,
28         PFalconBase,
29         PeregrineCoreSelect, //
30     },
31     gpu::{
32         Architecture,
33         Chipset, //
34     },
35 };
36 
37 // PMC
38 
39 register! {
40     /// Basic revision information about the GPU.
41     pub(crate) NV_PMC_BOOT_0(u32) @ 0x00000000 {
42         /// Lower bits of the architecture.
43         28:24   architecture_0;
44         /// Implementation version of the architecture.
45         23:20   implementation;
46         /// MSB of the architecture.
47         8:8     architecture_1;
48         /// Major revision of the chip.
49         7:4     major_revision;
50         /// Minor revision of the chip.
51         3:0     minor_revision;
52     }
53 
54     /// Extended architecture information.
55     pub(crate) NV_PMC_BOOT_42(u32) @ 0x00000a00 {
56         /// Architecture value.
57         29:24   architecture ?=> Architecture;
58         /// Implementation version of the architecture.
59         23:20   implementation;
60         /// Major revision of the chip.
61         19:16   major_revision;
62         /// Minor revision of the chip.
63         15:12   minor_revision;
64     }
65 }
66 
67 impl NV_PMC_BOOT_0 {
68     pub(crate) fn is_older_than_fermi(self) -> bool {
69         // From https://github.com/NVIDIA/open-gpu-doc/tree/master/manuals :
70         const NV_PMC_BOOT_0_ARCHITECTURE_GF100: u32 = 0xc;
71 
72         // Older chips left arch1 zeroed out. That, combined with an arch0 value that is less than
73         // GF100, means "older than Fermi".
74         self.architecture_1() == 0 && self.architecture_0() < NV_PMC_BOOT_0_ARCHITECTURE_GF100
75     }
76 }
77 
78 impl NV_PMC_BOOT_42 {
79     /// Combines `architecture` and `implementation` to obtain a code unique to the chipset.
80     pub(crate) fn chipset(self) -> Result<Chipset> {
81         self.architecture()
82             .map(|arch| {
83                 ((arch as u32) << Self::IMPLEMENTATION_RANGE.len())
84                     | u32::from(self.implementation())
85             })
86             .and_then(Chipset::try_from)
87     }
88 
89     /// Returns the raw architecture value from the register.
90     fn architecture_raw(self) -> u8 {
91         ((self.into_raw() >> Self::ARCHITECTURE_RANGE.start())
92             & ((1 << Self::ARCHITECTURE_RANGE.len()) - 1)) as u8
93     }
94 }
95 
96 impl kernel::fmt::Display for NV_PMC_BOOT_42 {
97     fn fmt(&self, f: &mut kernel::fmt::Formatter<'_>) -> kernel::fmt::Result {
98         write!(
99             f,
100             "boot42 = 0x{:08x} (architecture 0x{:x}, implementation 0x{:x})",
101             self.inner,
102             self.architecture_raw(),
103             self.implementation()
104         )
105     }
106 }
107 
108 // PBUS
109 
110 register! {
111     pub(crate) NV_PBUS_SW_SCRATCH(u32)[64] @ 0x00001400 {}
112 
113     /// Scratch register 0xe used as FRTS firmware error code.
114     pub(crate) NV_PBUS_SW_SCRATCH_0E_FRTS_ERR(u32) => NV_PBUS_SW_SCRATCH[0xe] {
115         31:16   frts_err_code;
116     }
117 }
118 
119 // PFB
120 
121 register! {
122     /// Low bits of the physical system memory address used by the GPU to perform sysmembar
123     /// operations (see [`crate::fb::SysmemFlush`]).
124     pub(crate) NV_PFB_NISO_FLUSH_SYSMEM_ADDR(u32) @ 0x00100c10 {
125         31:0    adr_39_08;
126     }
127 
128     /// High bits of the physical system memory address used by the GPU to perform sysmembar
129     /// operations (see [`crate::fb::SysmemFlush`]).
130     pub(crate) NV_PFB_NISO_FLUSH_SYSMEM_ADDR_HI(u32) @ 0x00100c40 {
131         23:0    adr_63_40;
132     }
133 
134     pub(crate) NV_PFB_PRI_MMU_LOCAL_MEMORY_RANGE(u32) @ 0x00100ce0 {
135         30:30   ecc_mode_enabled => bool;
136         9:4     lower_mag;
137         3:0     lower_scale;
138     }
139 
140     pub(crate) NV_PFB_PRI_MMU_WPR2_ADDR_LO(u32) @ 0x001fa824 {
141         /// Bits 12..40 of the lower (inclusive) bound of the WPR2 region.
142         31:4    lo_val;
143     }
144 
145     pub(crate) NV_PFB_PRI_MMU_WPR2_ADDR_HI(u32) @ 0x001fa828 {
146         /// Bits 12..40 of the higher (exclusive) bound of the WPR2 region.
147         31:4    hi_val;
148     }
149 }
150 
151 /// Base of the GB10x HSHUB0 register window (`NV_HSHUB0_PRIV_BASE` in Open RM).
152 ///
153 /// The base is provided by the GB10x framebuffer HAL.
154 pub(crate) struct Hshub0Base(());
155 
156 /// Base of the GB20x FBHUB0 register window (`NV_FBHUB0_PRI_BASE` in Open RM).
157 ///
158 /// The base is provided by the GB20x framebuffer HAL.
159 pub(crate) struct Fbhub0Base(());
160 
161 register! {
162     // GB10x sysmem flush registers, relative to the HSHUB0 base. GB10x routes sysmembar
163     // through a primary and an EG (egress) pair that must both be programmed to the same
164     // address. Hardware ignores bits 7:0 of each LO register. The boot path uses a fixed
165     // HSHUB0 base, so the multiple runtime-discovered HSHUB bases are not needed here.
166     pub(crate) NV_PFB_HSHUB_PCIE_FLUSH_SYSMEM_ADDR_LO(u32) @ Hshub0Base + 0x00000e50 {
167         31:0    adr => u32;
168     }
169 
170     pub(crate) NV_PFB_HSHUB_PCIE_FLUSH_SYSMEM_ADDR_HI(u32) @ Hshub0Base + 0x00000e54 {
171         19:0    adr;
172     }
173 
174     pub(crate) NV_PFB_HSHUB_EG_PCIE_FLUSH_SYSMEM_ADDR_LO(u32) @ Hshub0Base + 0x000006c0 {
175         31:0    adr => u32;
176     }
177 
178     pub(crate) NV_PFB_HSHUB_EG_PCIE_FLUSH_SYSMEM_ADDR_HI(u32) @ Hshub0Base + 0x000006c4 {
179         19:0    adr;
180     }
181 
182     // GB20x sysmem flush registers, relative to the FBHUB0 base. Unlike the older
183     // NV_PFB_NISO_FLUSH_SYSMEM_ADDR registers which encode the address with an 8-bit
184     // right-shift, these take the raw address split into lower and upper halves. Hardware
185     // ignores bits 7:0 of the LO register.
186     pub(crate) NV_PFB_FBHUB_PCIE_FLUSH_SYSMEM_ADDR_LO(u32) @ Fbhub0Base + 0x00001d58 {
187         31:0    adr => u32;
188     }
189 
190     pub(crate) NV_PFB_FBHUB_PCIE_FLUSH_SYSMEM_ADDR_HI(u32) @ Fbhub0Base + 0x00001d5c {
191         19:0    adr;
192     }
193 }
194 
195 impl NV_PFB_PRI_MMU_LOCAL_MEMORY_RANGE {
196     /// Returns the usable framebuffer size, in bytes.
197     pub(crate) fn usable_fb_size(self) -> u64 {
198         let size = (u64::from(self.lower_mag()) << u64::from(self.lower_scale())) * u64::SZ_1M;
199 
200         if self.ecc_mode_enabled() {
201             // Remove the amount of memory reserved for ECC (one per 16 units).
202             size / 16 * 15
203         } else {
204             size
205         }
206     }
207 }
208 
209 impl NV_PFB_PRI_MMU_WPR2_ADDR_LO {
210     /// Returns the lower (inclusive) bound of the WPR2 region.
211     pub(crate) fn lower_bound(self) -> u64 {
212         u64::from(self.lo_val()) << 12
213     }
214 }
215 
216 impl NV_PFB_PRI_MMU_WPR2_ADDR_HI {
217     /// Returns the higher (exclusive) bound of the WPR2 region.
218     ///
219     /// A value of zero means the WPR2 region is not set.
220     pub(crate) fn higher_bound(self) -> u64 {
221         u64::from(self.hi_val()) << 12
222     }
223 
224     /// Returns whether the WPR2 region is currently set.
225     pub(crate) fn is_wpr2_set(self) -> bool {
226         self.hi_val() != 0
227     }
228 }
229 
230 // PGSP
231 
232 register! {
233     pub(crate) NV_PGSP_QUEUE_HEAD(u32) @ 0x00110c00 {
234         31:0    address;
235     }
236 }
237 
238 // PGC6 register space.
239 //
240 // `GC6` is a GPU low-power state where VRAM is in self-refresh and the GPU is powered down (except
241 // for power rails needed to keep self-refresh working and important registers and hardware
242 // blocks).
243 //
244 // These scratch registers remain powered on even in a low-power state and have a designated group
245 // number.
246 
247 register! {
248     /// Boot Sequence Interface (BSI) register used to determine
249     /// if GSP reload/resume has completed during the boot process.
250     pub(crate) NV_PGC6_BSI_SECURE_SCRATCH_14(u32) @ 0x001180f8 {
251         26:26   boot_stage_3_handoff => bool;
252     }
253 
254     /// Privilege level mask register. It dictates whether the host CPU has privilege to access the
255     /// `PGC6_AON_SECURE_SCRATCH_GROUP_05` register (which it needs to read GFW_BOOT).
256     pub(crate) NV_PGC6_AON_SECURE_SCRATCH_GROUP_05_PRIV_LEVEL_MASK(u32) @ 0x00118128 {
257         /// Set after FWSEC lowers its protection level.
258         0:0     read_protection_level0 => bool;
259     }
260 
261     /// OpenRM defines this as a register array, but doesn't specify its size and only uses its
262     /// first element. Be conservative until we know the actual size or need to use more registers.
263     pub(crate) NV_PGC6_AON_SECURE_SCRATCH_GROUP_05(u32)[1] @ 0x00118234 {}
264 
265     /// Scratch group 05 register 0 used as GFW boot progress indicator.
266     pub(crate) NV_PGC6_AON_SECURE_SCRATCH_GROUP_05_0_GFW_BOOT(u32)
267         => NV_PGC6_AON_SECURE_SCRATCH_GROUP_05[0] {
268         /// Progress of GFW boot (0xff means completed).
269         7:0    progress;
270     }
271 
272     pub(crate) NV_PGC6_AON_SECURE_SCRATCH_GROUP_42(u32) @ 0x001183a4 {
273         31:0    value;
274     }
275 
276     /// Scratch group 42 register used as framebuffer size.
277     pub(crate) NV_USABLE_FB_SIZE_IN_MB(u32) => NV_PGC6_AON_SECURE_SCRATCH_GROUP_42 {
278         /// Usable framebuffer size, in megabytes.
279         31:0    value;
280     }
281 }
282 
283 impl NV_PGC6_AON_SECURE_SCRATCH_GROUP_05_0_GFW_BOOT {
284     /// Returns `true` if GFW boot is completed.
285     pub(crate) fn completed(self) -> bool {
286         self.progress() == 0xff
287     }
288 }
289 
290 impl NV_USABLE_FB_SIZE_IN_MB {
291     /// Returns the usable framebuffer size, in bytes.
292     pub(crate) fn usable_fb_size(self) -> u64 {
293         u64::from(self.value()) * u64::SZ_1M
294     }
295 }
296 
297 // PDISP
298 
299 register! {
300     pub(crate) NV_PDISP_VGA_WORKSPACE_BASE(u32) @ 0x00625f04 {
301         /// VGA workspace base address divided by 0x10000.
302         31:8    addr;
303         /// Set if the `addr` field is valid.
304         3:3     status_valid => bool;
305     }
306 }
307 
308 impl NV_PDISP_VGA_WORKSPACE_BASE {
309     /// Returns the base address of the VGA workspace, or `None` if none exists.
310     pub(crate) fn vga_workspace_addr(self) -> Option<u64> {
311         if self.status_valid() {
312             Some(u64::from(self.addr()) << 16)
313         } else {
314             None
315         }
316     }
317 }
318 
319 // FUSE
320 
321 pub(crate) const NV_FUSE_OPT_FPF_SIZE: usize = 16;
322 
323 register! {
324     pub(crate) NV_FUSE_OPT_FPF_NVDEC_UCODE1_VERSION(u32)[NV_FUSE_OPT_FPF_SIZE] @ 0x00824100 {
325         15:0    data => u16;
326     }
327 
328     pub(crate) NV_FUSE_OPT_FPF_SEC2_UCODE1_VERSION(u32)[NV_FUSE_OPT_FPF_SIZE] @ 0x00824140 {
329         15:0    data => u16;
330     }
331 
332     pub(crate) NV_FUSE_OPT_FPF_GSP_UCODE1_VERSION(u32)[NV_FUSE_OPT_FPF_SIZE] @ 0x008241c0 {
333         15:0    data => u16;
334     }
335 }
336 
337 // PFALCON
338 
339 register! {
340     pub(crate) NV_PFALCON_FALCON_IRQSCLR(u32) @ PFalconBase + 0x00000004 {
341         6:6     swgen0 => bool;
342         4:4     halt => bool;
343     }
344 
345     pub(crate) NV_PFALCON_FALCON_MAILBOX0(u32) @ PFalconBase + 0x00000040 {
346         31:0    value => u32;
347     }
348 
349     pub(crate) NV_PFALCON_FALCON_MAILBOX1(u32) @ PFalconBase + 0x00000044 {
350         31:0    value => u32;
351     }
352 
353     /// Used to store version information about the firmware running
354     /// on the Falcon processor.
355     pub(crate) NV_PFALCON_FALCON_OS(u32) @ PFalconBase + 0x00000080 {
356         31:0    value => u32;
357     }
358 
359     pub(crate) NV_PFALCON_FALCON_RM(u32) @ PFalconBase + 0x00000084 {
360         31:0    value => u32;
361     }
362 
363     pub(crate) NV_PFALCON_FALCON_HWCFG2(u32) @ PFalconBase + 0x000000f4 {
364         /// Signal indicating that reset is completed (GA102+).
365         31:31   reset_ready => bool;
366         /// RISC-V branch privilege lockdown bit.
367         13:13   riscv_br_priv_lockdown => bool;
368         /// Set to 0 after memory scrubbing is completed.
369         12:12   mem_scrubbing => bool;
370         10:10   riscv => bool;
371     }
372 
373     pub(crate) NV_PFALCON_FALCON_CPUCTL(u32) @ PFalconBase + 0x00000100 {
374         6:6     alias_en => bool;
375         4:4     halted => bool;
376         1:1     startcpu => bool;
377     }
378 
379     pub(crate) NV_PFALCON_FALCON_BOOTVEC(u32) @ PFalconBase + 0x00000104 {
380         31:0    value => u32;
381     }
382 
383     pub(crate) NV_PFALCON_FALCON_DMACTL(u32) @ PFalconBase + 0x0000010c {
384         7:7     secure_stat => bool;
385         6:3     dmaq_num;
386         2:2     imem_scrubbing => bool;
387         1:1     dmem_scrubbing => bool;
388         0:0     require_ctx => bool;
389     }
390 
391     pub(crate) NV_PFALCON_FALCON_DMATRFBASE(u32) @ PFalconBase + 0x00000110 {
392         31:0    base => u32;
393     }
394 
395     pub(crate) NV_PFALCON_FALCON_DMATRFMOFFS(u32) @ PFalconBase + 0x00000114 {
396         23:0    offs;
397     }
398 
399     pub(crate) NV_PFALCON_FALCON_DMATRFCMD(u32) @ PFalconBase + 0x00000118 {
400         16:16   set_dmtag;
401         14:12   ctxdma;
402         10:8    size ?=> DmaTrfCmdSize;
403         5:5     is_write => bool;
404         4:4     imem => bool;
405         3:2     sec;
406         1:1     idle => bool;
407         0:0     full => bool;
408     }
409 
410     pub(crate) NV_PFALCON_FALCON_DMATRFFBOFFS(u32) @ PFalconBase + 0x0000011c {
411         31:0    offs => u32;
412     }
413 
414     pub(crate) NV_PFALCON_FALCON_DMATRFBASE1(u32) @ PFalconBase + 0x00000128 {
415         8:0     base;
416     }
417 
418     pub(crate) NV_PFALCON_FALCON_HWCFG1(u32) @ PFalconBase + 0x0000012c {
419         /// Core revision subversion.
420         7:6     core_rev_subversion => FalconCoreRevSubversion;
421         /// Security model.
422         5:4     security_model ?=> FalconSecurityModel;
423         /// Core revision.
424         3:0     core_rev ?=> FalconCoreRev;
425     }
426 
427     pub(crate) NV_PFALCON_FALCON_CPUCTL_ALIAS(u32) @ PFalconBase + 0x00000130 {
428         1:1     startcpu => bool;
429     }
430 
431     /// IMEM access control register. Up to 4 ports are available for IMEM access.
432     pub(crate) NV_PFALCON_FALCON_IMEMC(u32)[4, stride = 16] @ PFalconBase + 0x00000180 {
433         /// Access secure IMEM.
434         28:28     secure => bool;
435         /// Auto-increment on write.
436         24:24     aincw => bool;
437         /// IMEM block and word offset.
438         15:0      offs;
439     }
440 
441     /// IMEM data register. Reading/writing this register accesses IMEM at the address
442     /// specified by the corresponding IMEMC register.
443     pub(crate) NV_PFALCON_FALCON_IMEMD(u32)[4, stride = 16] @ PFalconBase + 0x00000184 {
444         31:0      data;
445     }
446 
447     /// IMEM tag register. Used to set the tag for the current IMEM block.
448     pub(crate) NV_PFALCON_FALCON_IMEMT(u32)[4, stride = 16] @ PFalconBase + 0x00000188 {
449         15:0      tag;
450     }
451 
452     /// DMEM access control register. Up to 8 ports are available for DMEM access.
453     pub(crate) NV_PFALCON_FALCON_DMEMC(u32)[8, stride = 8] @ PFalconBase + 0x000001c0 {
454         /// Auto-increment on write.
455         24:24     aincw => bool;
456         /// DMEM block and word offset.
457         15:0      offs;
458     }
459 
460     /// DMEM data register. Reading/writing this register accesses DMEM at the address
461     /// specified by the corresponding DMEMC register.
462     pub(crate) NV_PFALCON_FALCON_DMEMD(u32)[8, stride = 8] @ PFalconBase + 0x000001c4 {
463         31:0      data;
464     }
465 
466     /// Actually known as `NV_PSEC_FALCON_ENGINE` and `NV_PGSP_FALCON_ENGINE` depending on the
467     /// falcon instance.
468     pub(crate) NV_PFALCON_FALCON_ENGINE(u32) @ PFalconBase + 0x000003c0 {
469         0:0     reset => bool;
470     }
471 
472     pub(crate) NV_PFALCON_FBIF_TRANSCFG(u32)[8] @ PFalconBase + 0x00000600 {
473         2:2     mem_type => FalconFbifMemType;
474         1:0     target ?=> FalconFbifTarget;
475     }
476 
477     pub(crate) NV_PFALCON_FBIF_CTL(u32) @ PFalconBase + 0x00000624 {
478         7:7     allow_phys_no_ctx => bool;
479     }
480 
481     // Falcon EMEM PIO registers (used by FSP on Hopper/Blackwell).
482     // These provide the falcon external memory communication interface.
483 
484     pub(crate) NV_PFALCON_FALCON_EMEMC(u32) @ PFalconBase + 0x00000ac0 {
485         /// EMEM byte offset (4-byte aligned) within the block.
486         7:2     offs;
487         /// EMEM block to access.
488         15:8    blk;
489         /// Auto-increment the offset after each write.
490         24:24   aincw => bool;
491         /// Auto-increment the offset after each read.
492         25:25   aincr => bool;
493     }
494 
495     pub(crate) NV_PFALCON_FALCON_EMEMD(u32) @ PFalconBase + 0x00000ac4 {
496         31:0    data => u32;
497     }
498 }
499 
500 impl NV_PFALCON_FALCON_DMACTL {
501     /// Returns `true` if memory scrubbing is completed.
502     pub(crate) fn mem_scrubbing_done(self) -> bool {
503         !self.dmem_scrubbing() && !self.imem_scrubbing()
504     }
505 }
506 
507 impl NV_PFALCON_FALCON_DMATRFCMD {
508     /// Programs the `imem` and `sec` fields for the given FalconMem
509     pub(crate) fn with_falcon_mem(self, mem: FalconMem) -> Self {
510         let this = self.with_imem(mem != FalconMem::Dmem);
511 
512         match mem {
513             FalconMem::ImemSecure => this.with_const_sec::<1>(),
514             _ => this.with_const_sec::<0>(),
515         }
516     }
517 }
518 
519 impl NV_PFALCON_FALCON_ENGINE {
520     /// Resets the falcon
521     pub(crate) fn reset_engine<E: FalconEngine>(bar: &Bar0) {
522         bar.update(Self::of::<E>(), |r| r.with_reset(true));
523 
524         // TIMEOUT: falcon engine should not take more than 10us to reset.
525         time::delay::fsleep(time::Delta::from_micros(10));
526 
527         bar.update(Self::of::<E>(), |r| r.with_reset(false));
528     }
529 }
530 
531 impl NV_PFALCON_FALCON_HWCFG2 {
532     /// Returns `true` if memory scrubbing is completed.
533     pub(crate) fn mem_scrubbing_done(self) -> bool {
534         !self.mem_scrubbing()
535     }
536 }
537 
538 /* PFALCON2 */
539 
540 register! {
541     pub(crate) NV_PFALCON2_FALCON_MOD_SEL(u32) @ PFalcon2Base + 0x00000180 {
542         7:0     algo ?=> FalconModSelAlgo;
543     }
544 
545     pub(crate) NV_PFALCON2_FALCON_BROM_CURR_UCODE_ID(u32) @ PFalcon2Base + 0x00000198 {
546         7:0    ucode_id => u8;
547     }
548 
549     pub(crate) NV_PFALCON2_FALCON_BROM_ENGIDMASK(u32) @ PFalcon2Base + 0x0000019c {
550         31:0    value => u32;
551     }
552 
553     /// OpenRM defines this as a register array, but doesn't specify its size and only uses its
554     /// first element. Be conservative until we know the actual size or need to use more registers.
555     pub(crate) NV_PFALCON2_FALCON_BROM_PARAADDR(u32)[1] @ PFalcon2Base + 0x00000210 {
556         31:0    value => u32;
557     }
558 }
559 
560 // PRISCV
561 
562 register! {
563     /// RISC-V status register for debug (Turing and GA100 only).
564     /// Reflects current RISC-V core status.
565     pub(crate) NV_PRISCV_RISCV_CORE_SWITCH_RISCV_STATUS(u32) @ PFalcon2Base + 0x00000240 {
566         /// RISC-V core active/inactive status.
567         0:0     active_stat => bool;
568     }
569 
570     /// GA102 and later.
571     pub(crate) NV_PRISCV_RISCV_CPUCTL(u32) @ PFalcon2Base + 0x00000388 {
572         7:7     active_stat => bool;
573         0:0     halted => bool;
574     }
575 
576     /// GA102 and later.
577     pub(crate) NV_PRISCV_RISCV_BCR_CTRL(u32) @ PFalcon2Base + 0x00000668 {
578         8:8     br_fetch => bool;
579         4:4     core_select => PeregrineCoreSelect;
580         0:0     valid => bool;
581     }
582 }
583 
584 // FSP (Foundation Security Processor) queue registers for Hopper/Blackwell Chain of Trust.
585 // These registers manage falcon EMEM communication queues.
586 
587 register! {
588     pub(crate) NV_PFSP_QUEUE_HEAD(u32)[8] @ 0x008f2c00 {
589         31:0    address => u32;
590     }
591 
592     pub(crate) NV_PFSP_QUEUE_TAIL(u32)[8] @ 0x008f2c04 {
593         31:0    address => u32;
594     }
595 
596     pub(crate) NV_PFSP_MSGQ_HEAD(u32)[8] @ 0x008f2c80 {
597         31:0    val => u32;
598     }
599 
600     pub(crate) NV_PFSP_MSGQ_TAIL(u32)[8] @ 0x008f2c84 {
601         31:0    val => u32;
602     }
603 }
604 
605 // The modules below provide registers that are not identical on all supported chips. They should
606 // only be used in HAL modules.
607 
608 pub(crate) mod gm107 {
609     use kernel::io::register;
610 
611     // FUSE
612 
613     register! {
614         pub(crate) NV_FUSE_STATUS_OPT_DISPLAY(u32) @ 0x00021c04 {
615             0:0     display_disabled => bool;
616         }
617     }
618 }
619 
620 pub(crate) mod ga100 {
621     use kernel::io::register;
622 
623     // FUSE
624 
625     register! {
626         pub(crate) NV_FUSE_STATUS_OPT_DISPLAY(u32) @ 0x00820c04 {
627             0:0     display_disabled => bool;
628         }
629     }
630 }
631 
632 pub(crate) const NV_THERM_I2CS_SCRATCH_FSP_BOOT_COMPLETE_STATUS_SUCCESS: u32 = 0xff;
633 
634 pub(crate) mod gh100 {
635     use kernel::io::register;
636 
637     // PTHERM
638 
639     register! {
640         pub(crate) NV_THERM_I2CS_SCRATCH(u32) @ 0x000200bc {
641             31:0    data;
642         }
643 
644         // Alias to `NV_THERM_I2CS_SCRATCH` when used to check for FSP boot completion.
645         pub(crate) NV_THERM_I2CS_SCRATCH_FSP_BOOT_COMPLETE(u32) => NV_THERM_I2CS_SCRATCH {
646             31:0    fsp_boot_complete;
647         }
648     }
649 }
650 
651 pub(crate) mod gb202 {
652     use kernel::io::register;
653 
654     // PTHERM
655 
656     register! {
657         pub(crate) NV_THERM_I2CS_SCRATCH(u32) @ 0x00ad00bc {
658             31:0    data;
659         }
660 
661         // Alias to `NV_THERM_I2CS_SCRATCH` when used to check for FSP boot completion.
662         pub(crate) NV_THERM_I2CS_SCRATCH_FSP_BOOT_COMPLETE(u32) => NV_THERM_I2CS_SCRATCH {
663             31:0    fsp_boot_complete;
664         }
665     }
666 }
667