@echo -off
echo " "
echo "Alder Lake N BIOS updater - EFI Version"
echo " "

echo ...programming new BIOS... DO NOT INTERRUPT OR TURN OFF THE POWER!!!

.\AfuEfix64.efi %1 /EC /ME /PADDING0 /N /NB /OA /TSNMACADDR /TCCCACHECFG /TCCPTCMBINARY /TCCSTREAMCFG /P /AB /FSPS /FSPM /FSPT /B /DATABACKUP /DATA /BB1BACKUP /BB1 /ABU /FSPSU /FSPMU /FSPTU /BBU

if not %lasterror% == 0 then
  echo " "
  echo BIOS update not started
  echo please check that setup option
  echo "Advanced->PCH-FW Configuration->Firmware Update Configuration->Me FW Image Re-Flash"
  echo is enabled
  echo " "
  echo Please reboot the system and change setup configuration before trying again
else
  echo " "
  echo BIOS Update... DONE!
  echo ...updating descriptor area... DO NOT INTERRUPT OR TURN OFF THE POWER!!!
  .\AfuEfix64.efi %1 /DESC
  if not %lasterror% == 0 then
    echo " "
    echo Flash descriptor area locked by user
    echo Descriptor update... skipped!
  else
    echo " "
    echo Descriptor Update... DONE!
  endif
  echo " "
  echo Operation completed successfully!
  echo Please reboot the system to use the new updated BIOS
endif
