echo -off
#
# 81xx Flash Update Tool, Version 2.32
# 2/18/11
#
cls

echo ""
echo "81xx Flash Update Tool"
echo ""
echo "This tool will update the HBA Flash."
echo ""

pause

############################################
# Filenames

# Set Multiboot filename
for %i in q8q*.bin
  set -v MBFILE %i%
endfor

############################################

set -v SUCCESS 0

# Set CPU specific flash tool
set -v EFIUTIL efiutilx64.efi


# Set all flag
set -v ALL_FLAG all81xx


if exist %EFIUTIL% then
  # Update flash
  echo ""
  echo "Updating HBA Flash ..."
  echo ""
  %EFIUTIL%  %ALL_FLAG%  unload  force  efi_write=%MBFILE%

  if %lasterror% == %SUCCESS% then
    echo ""
    echo ""
    echo "HBA Update Complete."
    echo ""
    echo "Please reboot the system for the changes to take effect."
  endif
endif

if not exist %EFIUTIL% then
  # Error
  echo ""
  echo "%EFIUTIL% not found"
  echo "Unable to Update HBA."
  echo ""
endif
