diff options
-rw-r--r-- | drivers/gpu/drm/nova/bios.rs | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/nova/fwsec.rs | 37 | ||||
-rw-r--r-- | drivers/gpu/drm/nova/nova_drv.rs | 1 |
3 files changed, 56 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nova/bios.rs b/drivers/gpu/drm/nova/bios.rs index 30085b9f4273..333d3b8c4e4a 100644 --- a/drivers/gpu/drm/nova/bios.rs +++ b/drivers/gpu/drm/nova/bios.rs @@ -5,6 +5,8 @@ use kernel::prelude::*; use alloc::vec::Vec; use crate::BAR_SIZE; +use crate::fwsec::FalconUCodeDescV3; + use core::ptr::read_unaligned; const PROM_OFFSET: usize = 0x300000; @@ -423,6 +425,22 @@ impl Bios { pr_info!("pmu found idx {}\n", found); } } + + let desc_hdr = self.rd32(pmue.data as isize); + pr_info!("flcn {:#x} {} {}\n", desc_hdr, (desc_hdr & 0xffff0000) >> 16, + (desc_hdr & 0xff00) >> 8); + + let ucode_ptr = self.ptr(pmue.data as isize); + unsafe { + let ucodedesc: *const FalconUCodeDescV3 = ucode_ptr as *const FalconUCodeDescV3; + pr_info!("ucode desc stored {:#x}, imem {:#x} {:#x} {:#x} dmem {:#x} {:#x}\n", + (*ucodedesc).StoredSize, + (*ucodedesc).IMEMPhysBase, + (*ucodedesc).IMEMLoadSize, + (*ucodedesc).IMEMVirtBase, + (*ucodedesc).DMEMPhysBase, + (*ucodedesc).DMEMLoadSize); + } Ok(()) } } diff --git a/drivers/gpu/drm/nova/fwsec.rs b/drivers/gpu/drm/nova/fwsec.rs new file mode 100644 index 000000000000..8fad8355722e --- /dev/null +++ b/drivers/gpu/drm/nova/fwsec.rs @@ -0,0 +1,37 @@ + +#[repr(C)] +pub(crate) struct FalconUCodeDescV2 { + Hdr: u32, + StoredSize: u32, + UncompressedSize: u32, + VirtualEntry: u32, + InterfaceOffset: u32, + IMEMPhysBase: u32, + IMEMLoadSize: u32, + IMEMVirtBase: u32, + IMEMSecBase: u32, + IMEMSecSize: u32, + DMEMOffset: u32, + DMEMLoadSize: u32, + altIMEMLoadSize: u32, + altDMEMLoadSize: u32, +} + +#[repr(C)] +pub(crate) struct FalconUCodeDescV3 { + pub(crate) Hdr: u32, + pub(crate) StoredSize: u32, + PKCDataOffset: u32, + InterfaceOffset: u32, + pub(crate) IMEMPhysBase: u32, + pub(crate) IMEMLoadSize: u32, + pub(crate) IMEMVirtBase: u32, + pub(crate) DMEMPhysBase: u32, + pub(crate) DMEMLoadSize: u32, + EngineIdMask: u16, + UcodeId: u8, + SignatureCount: u8, + SignatureVersions: u16, + Reserved: u16, +} + diff --git a/drivers/gpu/drm/nova/nova_drv.rs b/drivers/gpu/drm/nova/nova_drv.rs index 506ecc9f71e5..14a8b6a592ab 100644 --- a/drivers/gpu/drm/nova/nova_drv.rs +++ b/drivers/gpu/drm/nova/nova_drv.rs @@ -4,6 +4,7 @@ mod gpu; mod bios; +mod fwsec; use crate::gpu::CardType; use alloc::boxed::Box; |