On Tue Feb 10, 2026 at 3:45 AM CET, John Hubbard wrote:
> +    /// Check if GSP lockdown has been released after FSP Chain of Trust
> +    fn gsp_lockdown_released(
> +        dev: &device::Device,
> +        gsp_falcon: &Falcon<Gsp>,
> +        bar: &Bar0,
> +        fmc_boot_params_addr: u64,
> +        mbox0: &mut u32,
> +    ) -> bool {
> +        // Read GSP falcon mailbox0
> +        *mbox0 = gsp_falcon.read_mailbox0(bar);
> +
> +        // Check 1: If mbox0 has 0xbadf4100 pattern, GSP is still locked down
> +        if *mbox0 != 0 && (*mbox0 & 0xffffff00) == 0xbadf4100 {
> +            return false;
> +        }

Hm...we could create a tiny type wrapper around this value, and do the check
with a method, such as Mbox::is_locked_down(&self).

> +        // Check 2: If mbox0 has a value, check if it's an error
> +        if *mbox0 != 0 {
> +            let mbox1 = gsp_falcon.read_mailbox1(bar);
> +
> +            let combined_addr = (u64::from(mbox1) << 32) | u64::from(*mbox0);

This could also be part of the type.

> +            if combined_addr != fmc_boot_params_addr {
> +                // Address doesn't match - GSP wrote an error code
> +                // Return TRUE (lockdown released) with error
> +                dev_dbg!(
> +                    dev,
> +                    "GSP lockdown error: mbox0={:#x}, combined_addr={:#x}, 
> expected={:#x}\n",
> +                    *mbox0,
> +                    combined_addr,
> +                    fmc_boot_params_addr
> +                );
> +                return true;
> +            }
> +        }
> +
> +        // Check 3: Verify HWCFG2 RISCV_BR_PRIV_LOCKDOWN bit is clear
> +        let hwcfg2 = regs::NV_PFALCON_FALCON_HWCFG2::read(bar, 
> &crate::falcon::gsp::Gsp::ID);
> +        !hwcfg2.riscv_br_priv_lockdown()
> +    }

Reply via email to