Re: [13/16] gpu: nova-core: Add support for VBIOS ucode extraction for boot

Joel Fernandes
2025-04-26T23:17:52Z

Hello, Danilo,

On Wed, 23 Apr 2025 16:06:16 +0200, Danilo Krummrich wrote:
> On Sun, Apr 20, 2025 at 09:19:45PM +0900, Alexandre Courbot wrote:

[...]

> > +impl NpdeStruct {
> > + /// Check if this is the last image in the ROM
> > + fn is_last(&self) -> bool {
> > + self.last_image & 0x80 != 0
>
> What's the magic number for?

The NPDE is the NVIDIA PCI Data Extension Structure which is an extension to the
PCI Data Structure.

As per the publicly available PCI Firmware Specification v3.3, in section 5.1 it
says:

"The last image in a ROM has a special encoding in the header to identify it as
the last image."

Then when it describes the PCI data structure, it says for the Last Image
indicator byte:
"Bit 7 in this field tells whether or not this is the last image in the
ROM. A value of 1 indicates “last image;” a value of 0 indicates that
another image follows. Bits 0-6 are reserved."

I will go ahead and a LAST_ROM_IMAGE_MASK and put a comment here where we are
checking the bit, that will clarify it in the code.

thanks,

- Joel