diff --git a/drivers/gpu/nova-core/api.rs b/drivers/gpu/nova-core/api.rs index f02c6c7c7e51..29207c4bb743 100644 --- a/drivers/gpu/nova-core/api.rs +++ b/drivers/gpu/nova-core/api.rs @@ -15,8 +15,11 @@ pub use crate::gpu::Spec; -use crate::gpu::Gpu; -use crate::gsp::commands::GetGspStaticInfoReply; +use crate::{ + driver, + gpu::Gpu, + gsp::commands::GetGspStaticInfoReply, // +}; /// API handle for the auxiliary bus child drivers to interact with nova-core. pub struct NovaCoreApi<'bound> { @@ -44,7 +47,9 @@ pub fn spec(&self) -> &Spec { /// Returns the size of the PCIe BAR used for accessing VRAM, typically /// BAR1. pub fn bar1_size(&self) -> Result { - self.pdev.resource_len(1) + let bar1 = driver::bar1_resource_index(self.pdev)?; + + self.pdev.resource_len(bar1) } }