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