On 10/29/25 6:54 AM, Alexandre Courbot wrote:
> On Wed Oct 29, 2025 at 8:26 PM JST, Danilo Krummrich wrote:
> <snip>
...
> I don't think this will work because `NV_PMC_BOOT_0` and
> `NV_PMC_BOOT_42` are different types, so we cannot alternate them in the
> same call to `try_from`. But the following should:
>
> let boot0 = regs::NV_PMC_BOOT_0::read(bar);
> ...
>
> if boot0.is_nv04() {
> Err(ENODEV)?
> }
>
> if boot0.is_next_gen() {
> Spec::try_from(regs::NV_PMC_BOOT_42::read(bar))
> } else {
> Spec::try_from(boot0)
> }
>
Done. Final code snippet looks like this:
let boot0 = regs::NV_PMC_BOOT_0::read(bar);
if boot0.use_boot42_instead() {
Spec::try_from(regs::NV_PMC_BOOT_42::read(bar))
} else {
Spec::try_from(boot0)
}
thanks,
--
John Hubbard