Skip to content

Commit 6fda04e

Browse files
Joel FernandesDanilo Krummrich
authored andcommitted
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 <[email protected]> Cc: John Hubbard <[email protected]> Cc: Shirish Baskaran <[email protected]> Cc: Alistair Popple <[email protected]> Cc: Timur Tabi <[email protected]> Cc: Ben Skeggs <[email protected]> [ [email protected]: fix clippy warnings, read_more() function ] Signed-off-by: Alexandre Courbot <[email protected]> Signed-off-by: Joel Fernandes <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Replace extend_with() and copy_from_slice() with extend_from_slice(); re-format and use markdown in comments. - Danilo ] Signed-off-by: Danilo Krummrich <[email protected]>
1 parent d0c167e commit 6fda04e

File tree

4 files changed

+688
-2
lines changed

4 files changed

+688
-2
lines changed

drivers/gpu/nova-core/firmware.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ impl Firmware {
4444
/// Structure used to describe some firmwares, notably FWSEC-FRTS.
4545
#[repr(C)]
4646
#[derive(Debug, Clone)]
47+
#[allow(dead_code)] // Temporary, will be removed in later patch.
4748
pub(crate) struct FalconUCodeDescV3 {
4849
/// Header defined by `NV_BIT_FALCON_UCODE_DESC_HEADER_VDESC*` in OpenRM.
4950
hdr: u32,
@@ -74,10 +75,9 @@ pub(crate) struct FalconUCodeDescV3 {
7475
_reserved: u16,
7576
}
7677

77-
// To be removed once that code is used.
78-
#[expect(dead_code)]
7978
impl FalconUCodeDescV3 {
8079
/// Returns the size in bytes of the header.
80+
#[expect(dead_code)] // Temporary, will be removed in later patch.
8181
pub(crate) fn size(&self) -> usize {
8282
const HDR_SIZE_SHIFT: u32 = 16;
8383
const HDR_SIZE_MASK: u32 = 0xffff0000;

drivers/gpu/nova-core/gpu.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use crate::firmware::{Firmware, FIRMWARE_VERSION};
99
use crate::gfw;
1010
use crate::regs;
1111
use crate::util;
12+
use crate::vbios::Vbios;
1213
use core::fmt;
1314

1415
macro_rules! define_chipset {
@@ -214,6 +215,9 @@ impl Gpu {
214215

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

218+
// Will be used in a later patch when fwsec firmware is needed.
219+
let _bios = Vbios::new(pdev, bar)?;
220+
217221
Ok(pin_init!(Self {
218222
spec,
219223
bar: devres_bar,

drivers/gpu/nova-core/nova_core.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mod gfw;
1111
mod gpu;
1212
mod regs;
1313
mod util;
14+
mod vbios;
1415

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

0 commit comments

Comments
 (0)