On Wed, Oct 27, 2021 at 03:07:24PM +0800, Chen Yu wrote: > Platform Firmware Runtime Update image starts with UEFI headers, and the > headers are defined in UEFI specification, but some of them have not been > defined in the kernel yet. > > For example, the header layout of a capsule file looks like this: > > EFI_CAPSULE_HEADER > EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER > EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER > EFI_FIRMWARE_IMAGE_AUTHENTICATION > > These structures would be used by the Platform Firmware Runtime Update > driver to parse the format of capsule file to verify if the corresponding > version number is valid. The EFI_CAPSULE_HEADER has been defined in the > kernel, however the rest are not, thus introduce corresponding UEFI > structures accordingly. Besides, EFI_FIRMWARE_MANAGEMENT_CAPSULE_HEADER > and EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER are required to be packed > in the uefi specification. And Ard has pointed out that, the __packed > attribute does indicate to the compiler that the entire thing can appear > misaligned in memory. So if one follows the other in the capsule header, > the __packed attribute may be appropriate to ensure that the second one > is not accessed using misaligned loads and stores. ... > +/* EFI_FIRMWARE_MANAGEMENT_CAPSULE_IMAGE_HEADER */ > +struct efi_manage_capsule_image_header { > + u32 ver; > + guid_t image_type_id; Shouldn't it be efi_guid_t ? > + u8 image_index; > + u8 reserved_bytes[3]; > + u32 image_size; > + u32 vendor_code_size; > + /* ver = 2. */ > + u64 hw_ins; > + /* ver = v3. */ > + u64 capsule_support; > +} __packed; ... > +/* WIN_CERTIFICATE_UEFI_GUID */ > +struct win_cert_uefi_guid { > + struct win_cert hdr; > + guid_t cert_type; Ditto. > + u8 cert_data[]; > +}; -- With Best Regards, Andy Shevchenko