Commit 6fda04e7 authored by Joel Fernandes's avatar Joel Fernandes Committed by Danilo Krummrich
Browse files

gpu: nova-core: vbios: Add base support for VBIOS construction and iteration



Add support for navigating the VBIOS images required for extracting
ucode data for GSP to boot. Later patches will build on this.

Debug log messages will show the BIOS images:

[102141.013287] NovaCore: Found BIOS image at offset 0x0, size: 0xfe00, type: PciAt
[102141.080692] NovaCore: Found BIOS image at offset 0xfe00, size: 0x14800, type: Efi
[102141.098443] NovaCore: Found BIOS image at offset 0x24600, size: 0x5600, type: FwSec
[102141.415095] NovaCore: Found BIOS image at offset 0x29c00, size: 0x60800, type: FwSec

Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Shirish Baskaran <sbaskaran@nvidia.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Timur Tabi <ttabi@nvidia.com>
Cc: Ben Skeggs <bskeggs@nvidia.com>
[ acourbot@nvidia.com: fix clippy warnings, read_more() function ]
Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
Signed-off-by: default avatarJoel Fernandes <joelagnelf@nvidia.com>
Link: https://lore.kernel.org/r/20250619-nova-frts-v6-17-ecf41ef99252@nvidia.com


[ Replace extend_with() and copy_from_slice() with extend_from_slice();
  re-format and use markdown in comments. - Danilo ]
Signed-off-by: default avatarDanilo Krummrich <dakr@kernel.org>
parent d0c167eb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ pub(crate) fn new(dev: &device::Device, chipset: Chipset, ver: &str) -> Result<F
/// Structure used to describe some firmwares, notably FWSEC-FRTS.
#[repr(C)]
#[derive(Debug, Clone)]
#[allow(dead_code)] // Temporary, will be removed in later patch.
pub(crate) struct FalconUCodeDescV3 {
    /// Header defined by `NV_BIT_FALCON_UCODE_DESC_HEADER_VDESC*` in OpenRM.
    hdr: u32,
@@ -74,10 +75,9 @@ pub(crate) struct FalconUCodeDescV3 {
    _reserved: u16,
}

// To be removed once that code is used.
#[expect(dead_code)]
impl FalconUCodeDescV3 {
    /// Returns the size in bytes of the header.
    #[expect(dead_code)] // Temporary, will be removed in later patch.
    pub(crate) fn size(&self) -> usize {
        const HDR_SIZE_SHIFT: u32 = 16;
        const HDR_SIZE_MASK: u32 = 0xffff0000;
+4 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
use crate::gfw;
use crate::regs;
use crate::util;
use crate::vbios::Vbios;
use core::fmt;

macro_rules! define_chipset {
@@ -214,6 +215,9 @@ pub(crate) fn new(

        let _sec2_falcon = Falcon::<Sec2>::new(pdev.as_ref(), spec.chipset, bar, true)?;

        // Will be used in a later patch when fwsec firmware is needed.
        let _bios = Vbios::new(pdev, bar)?;

        Ok(pin_init!(Self {
            spec,
            bar: devres_bar,
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
mod gpu;
mod regs;
mod util;
mod vbios;

pub(crate) const MODULE_NAME: &kernel::str::CStr = <LocalModule as kernel::ModuleMetadata>::NAME;

+681 −0

File added.

Preview size limit exceeded, changes collapsed.