On 10/28/25 4:42 AM, Alexandre Courbot wrote:
On Tue Oct 28, 2025 at 11:39 AM JST, John Hubbard wrote:
<snip>
+        // Now that we know it is something more recent than NV04, use boot42 
if we
+        // previously determined that boot42 was both valid and relevant, and 
boot0
+        // otherwise.
+        let (chipset, major_revision, minor_revision) = if let Some(boot42) = 
boot42 {
+            (
+                boot42.chipset()?,
+                boot42.major_revision(),
+                boot42.minor_revision(),
+            )
+        } else {
+            // Current/older GPU: use BOOT0
+            (
+                boot0.chipset()?,
+                boot0.major_revision(),
+                boot0.minor_revision(),
+            )
+        };
+
          Ok(Self {
-            chipset: boot0.chipset()?,
-            major_revision: boot0.major_revision(),
-            minor_revision: boot0.minor_revision(),
+            chipset,
+            major_revision,
+            minor_revision,
          })

Can we implement `TryFrom<NV_PMC_BOOT_0> for Spec` (and same for
`NV_PMC_BOOT_42`)? That way this code can become:

     boot42.map(Spec::try_from).unwrap_or_else(|| Spec::try_from(boot0))

(untested ; but hopefully not too incorrect)


OK, interesting technique. I'll do that.

thanks,
John Hubbard

Reply via email to