xref: /linux/drivers/gpu/nova-core/falcon/gsp.rs (revision e54ad0cd3673c93cdafda58505eaa81610fe3aef)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 use crate::{
4     driver::Bar0,
5     falcon::{
6         Falcon,
7         FalconEngine,
8         PFalcon2Base,
9         PFalconBase, //
10     },
11     regs::{
12         self,
13         macros::RegisterBase, //
14     },
15 };
16 
17 /// Type specifying the `Gsp` falcon engine. Cannot be instantiated.
18 pub(crate) struct Gsp(());
19 
20 impl RegisterBase<PFalconBase> for Gsp {
21     const BASE: usize = 0x00110000;
22 }
23 
24 impl RegisterBase<PFalcon2Base> for Gsp {
25     const BASE: usize = 0x00111000;
26 }
27 
28 impl FalconEngine for Gsp {
29     const ID: Self = Gsp(());
30 }
31 
32 impl Falcon<Gsp> {
33     /// Clears the SWGEN0 bit in the Falcon's IRQ status clear register to
34     /// allow GSP to signal CPU for processing new messages in message queue.
35     pub(crate) fn clear_swgen0_intr(&self, bar: &Bar0) {
36         regs::NV_PFALCON_FALCON_IRQSCLR::default()
37             .set_swgen0(true)
38             .write(bar, &Gsp::ID);
39     }
40 }
41