diff options
Diffstat (limited to 'drivers/gpu/drm/nova/gpu.rs')
-rw-r--r-- | drivers/gpu/drm/nova/gpu.rs | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nova/gpu.rs b/drivers/gpu/drm/nova/gpu.rs index f3dc126b0b12..e6a282dd2858 100644 --- a/drivers/gpu/drm/nova/gpu.rs +++ b/drivers/gpu/drm/nova/gpu.rs @@ -1,13 +1,21 @@ // SPDX-License-Identifier: GPL-2.0 use kernel::{ - alloc::flags::*, device, devres::Devres, error::code::*, firmware, fmt, pci, prelude::*, - str::CString, sync::Arc, + alloc::flags::*, + device, + devres::Devres, + error::code::*, + firmware, fmt, pci, + prelude::*, + str::CString, + sync::{Arc, Mutex}, }; use crate::driver::Bar0; use core::fmt::Debug; +use crate::bios::*; + /// Enum representing the GPU chipset. #[derive(Debug)] pub(crate) enum Chipset { @@ -66,6 +74,8 @@ pub(crate) struct Gpu { /// MMIO mapping of PCI BAR 0 bar: Devres<Bar0>, fw: Firmware, + #[pin] + bios: Mutex<Bios>, } // TODO replace with something like derive(FromPrimitive) @@ -169,6 +179,23 @@ impl Gpu { spec.boot0 ); - Arc::pin_init(try_pin_init!(Self { spec, bar, fw }), GFP_KERNEL) + Arc::pin_init( + try_pin_init!(Self { + spec, + bar, + fw, + bios <- kernel::new_mutex!(Bios::new()), + }), + GFP_KERNEL, + ) + } + + pub(crate) fn init(&self) -> Result { + let mut bios = self.bios.lock(); + + bios.probe(&self.bar)?; + bios.find_fwsec()?; + + Ok(()) } } |