diff options
author | Dave Airlie <airlied@redhat.com> | 2023-11-29 13:57:11 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2023-11-29 13:57:11 +1000 |
commit | 52deb6825ca441a7cddf9d025cabb66e4f47f8f6 (patch) | |
tree | 21752c2dc921cb52fbc6caeb9c2b57228722b9ad | |
parent | fee3fdf9ae8b2f4bb33f4a1556dc5fb14a45a66c (diff) |
simple print out some info about gpu
-rw-r--r-- | drivers/gpu/drm/nova/nova_drv.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nova/nova_drv.rs b/drivers/gpu/drm/nova/nova_drv.rs index 9eeb69cb7e3e..510692ea43d7 100644 --- a/drivers/gpu/drm/nova/nova_drv.rs +++ b/drivers/gpu/drm/nova/nova_drv.rs @@ -37,6 +37,29 @@ impl pci::Driver for NovaDevice { fn probe(_dev: &mut pci::Device, _id_info: Option<&Self::IdInfo>) -> Result { pr_info!("probe()\n"); + _dev.enable_device_mem()?; + _dev.set_master(); + + let bars = _dev.select_bars(bindings::IORESOURCE_MEM.into()); + + let res = _dev.take_resource(0).ok_or(ENXIO)?; + let bar = unsafe { IoMem::<16777216>::try_new(res) }?; + + let boot0 = u64::from_le(bar.readq(0)); + + if (boot0 & 0x1f000000) == 0 { + return Err(ENODEV); + } + pr_info!("nvidia hw rev 0x{:#x}", boot0); + let chipset = (boot0 & 0x1ff00000) >> 20; + let chiprev = (boot0 & 0xff); + + match (chipset & 0x1f0) { + 0x160 => pr_info!("TU100"), + 0x170 => pr_info!("GA100"), + 0x190 => pr_info!("AD100"), + _ => return Err(ENODEV) + } Ok(()) } |