This is my pascal code for UEFI capsule update:
procedure efi_update_firmware(systemTable:Pefi_system_table);cdecl;[public,alias:'EFI_UPDATE_FIRMWARE'];
var ch:array[1..3] of efi_capsule_header;
Mchs:qword;
est:efi_reset_type;
begin
ch[1].CapsuleGuid:=efi_simple_file_system_protocol_guid; ch[1].HeaderSize:=sizeof(efi_capsule_header);
ch[1].Flags:=0; ch[1].CapsuleImageSize:=sizeof(efi_capsule_header);
ch[2].CapsuleGuid:=efi_disk_io_protocol_guid; ch[2].HeaderSize:=sizeof(efi_capsule_header);
ch[2].Flags:=0; ch[2].CapsuleImageSize:=sizeof(efi_capsule_header);
ch[3].CapsuleGuid:=efi_block_io_protocol_guid; ch[3].HeaderSize:=sizeof(efi_capsule_header);
ch[3].Flags:=0; ch[3].CapsuleImageSize:=sizeof(efi_capsule_header);
SystemTable^.RuntimeServices^.QueryCapsuleCapabilities(@ch,3,Mchs,est);
//efi_console_output_string(systemtable:Pefi_systemtable;outputstring:PWideChar);
efi_console_output_string(systemtable,UIntToPWChar(Mchs));
efi_console_output_string(systemtable,#13#10);
if(est=efiResetCold) then efi_console_output_string(systemtable,'1'#13#10)
else if(est=efiResetWarm) then efi_console_output_string(systemtable,'2'#13#10)
else if(est=efiResetShutdown) then efi_console_output_string(systemtable,'3'#13#10)
else if(est=efiResetPlatformSpecific) then efi_console_output_string(systemtable,'4'#13#10);
SystemTable^.RuntimeServices^.UpdateCapsule(@ch,3,0);
end;
This function is used in my simple pascal code part however it is stuck in this function but I don’t know why:
efi_update_firmware(systemtable);
All of code is written with UEFI Specification 2.10.If you want to know the Specification you should search for it.However,these code testing in Virtual Machine(QEMU in UEFI mode) stuck in there what I shows,so does anyone have the idea to solve the UEFI stuck in capsule update?
I want an solution to completely execute the UEFI capsule update without any stuck.