xref: /linux/drivers/gpu/nova-core/gsp/commands.rs (revision edcb134264f7db95295a9f0feb7a8b3acde72a08)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 use kernel::{
4     device,
5     pci,
6     prelude::*, //
7 };
8 
9 use crate::gsp::{
10     cmdq::CommandToGsp,
11     fw::{
12         commands::GspSetSystemInfo,
13         MsgFunction, //
14     },
15 };
16 
17 /// The `GspSetSystemInfo` command.
18 pub(crate) struct SetSystemInfo<'a> {
19     pdev: &'a pci::Device<device::Bound>,
20 }
21 
22 impl<'a> SetSystemInfo<'a> {
23     /// Creates a new `GspSetSystemInfo` command using the parameters of `pdev`.
24     pub(crate) fn new(pdev: &'a pci::Device<device::Bound>) -> Self {
25         Self { pdev }
26     }
27 }
28 
29 impl<'a> CommandToGsp for SetSystemInfo<'a> {
30     const FUNCTION: MsgFunction = MsgFunction::GspSetSystemInfo;
31     type Command = GspSetSystemInfo;
32     type InitError = Error;
33 
34     fn init(&self) -> impl Init<Self::Command, Self::InitError> {
35         GspSetSystemInfo::init(self.pdev)
36     }
37 }
38