Fixed Intel AMT boot to BIOS.

Ylian Saint-Hilaire committed Oct 25, 2022 at 13:18 UTC 2bf3cb13b329e7d7ecf14b6d86d147c6f659f8b4
1 file changed +30 -7
amtmanager.js
+30 -7
@@ -975,20 +975,43 @@ module.exports.CreateAmtManager = function (parent) {
975 if (obj.amtDevices[dev.nodeid] == null) return; // Device no longer exists, ignore this response.
976 if (status != 200) return;
977 if ((responses['AMT_BootSettingData'] == null) || (responses['AMT_BootSettingData'].response == null)) return;
978 -
978 var bootSettingData = responses['AMT_BootSettingData'].response;
979 +
980 + // Clean up parameters
981 + bootSettingData['ConfigurationDataReset'] = false;
982 + delete bootSettingData['WinREBootEnabled'];
983 + delete bootSettingData['UEFILocalPBABootEnabled'];
984 + delete bootSettingData['UEFIHTTPSBootEnabled'];
985 + delete bootSettingData['SecureBootControlEnabled'];
986 + delete bootSettingData['BootguardStatus'];
987 + delete bootSettingData['OptionsCleared'];
988 + delete bootSettingData['BIOSLastStatus'];
989 + delete bootSettingData['UefiBootParametersArray'];
990 + delete bootSettingData['RPEEnabled'];
991 + delete bootSettingData['RSEPassword']
992 +
993 + // Ready boot parameters
994 bootSettingData['BIOSSetup'] = ((action >= 11) && (action <= 14));
995 bootSettingData['UseSOL'] = ((action >= 13) && (action <= 14));
996 if ((action == 11) || (action == 13)) { dev.powerAction = 2; } // Power on
997 if ((action == 12) || (action == 14)) { dev.powerAction = 10; } // Reset
998
985 - dev.amtstack.Put('AMT_BootSettingData', bootSettingData, function performAdvancedPowerActionResponseEx(stack, name, response, status, tag) {
999 + // Set boot parameters
1000 + dev.amtstack.Put('AMT_BootSettingData', bootSettingData, function (stack, name, response, status, tag) {
1001 const dev = stack.dev;
987 - const action = dev.powerAction;
988 - delete dev.powerAction;
989 - if (obj.amtDevices[dev.nodeid] == null) return; // Device no longer exists, ignore this response.
990 - if (status != 200) return;
991 - try { dev.amtstack.RequestPowerStateChange(action, performPowerActionResponse); } catch (ex) { }
1002 + if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error
1003 + // Set boot config
1004 + dev.amtstack.SetBootConfigRole(1, function (stack, name, response, status, tag) {
1005 + const dev = stack.dev;
1006 + if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error
1007 + // Set boot order
1008 + dev.amtstack.CIM_BootConfigSetting_ChangeBootOrder(null, function (stack, name, response, status) {
1009 + const dev = stack.dev;
1010 + if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error
1011 + // Perform power action
1012 + try { dev.amtstack.RequestPowerStateChange(dev.powerAction, performPowerActionResponse); } catch (ex) { }
1013 + }, 0, 1);
1014 + }, 0, 1);
1015 }, 0, 1);
1016 }
1017