On Sat Nov 15, 2025 at 8:30 AM JST, Timur Tabi wrote:
<snip>
> @@ -290,6 +291,15 @@ pub(crate) fn mem_scrubbing_done(self) -> bool {
>      16:16   set_dmtag as u8;
>  });
>  
> +impl NV_PFALCON_FALCON_DMATRFCMD {
> +    /// Programs the 'imem' and 'sec' fields for the given FalconMem
> +    pub(crate) fn with_falcon_mem(self, mem: FalconMem) -> Self {
> +        self
> +            .set_imem(mem != FalconMem::Dmem)
> +            .set_sec(if mem == FalconMem::ImemSec { 1 } else { 0 })
> +    }
> +}
> +

After merging `ImemSec` and `ImemNs` into a single enum, you can change
this code into:

    self.set_imem(matches!(mem, FalconMem::Imem { .. }))
        .set_sec(if matches!(mem, FalconMem::Imem { secure: true }) {
            1
        } else {
            0
        })

Reply via email to