From 2bf3cb13b329e7d7ecf14b6d86d147c6f659f8b4 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 25 Oct 2022 13:18:35 -0700 Subject: [PATCH] Fixed Intel AMT boot to BIOS. --- amtmanager.js | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/amtmanager.js b/amtmanager.js index 85a55ea8..d690a9ae 100644 --- a/amtmanager.js +++ b/amtmanager.js @@ -975,20 +975,43 @@ module.exports.CreateAmtManager = function (parent) { if (obj.amtDevices[dev.nodeid] == null) return; // Device no longer exists, ignore this response. if (status != 200) return; if ((responses['AMT_BootSettingData'] == null) || (responses['AMT_BootSettingData'].response == null)) return; - var bootSettingData = responses['AMT_BootSettingData'].response; + + // Clean up parameters + bootSettingData['ConfigurationDataReset'] = false; + delete bootSettingData['WinREBootEnabled']; + delete bootSettingData['UEFILocalPBABootEnabled']; + delete bootSettingData['UEFIHTTPSBootEnabled']; + delete bootSettingData['SecureBootControlEnabled']; + delete bootSettingData['BootguardStatus']; + delete bootSettingData['OptionsCleared']; + delete bootSettingData['BIOSLastStatus']; + delete bootSettingData['UefiBootParametersArray']; + delete bootSettingData['RPEEnabled']; + delete bootSettingData['RSEPassword'] + + // Ready boot parameters bootSettingData['BIOSSetup'] = ((action >= 11) && (action <= 14)); bootSettingData['UseSOL'] = ((action >= 13) && (action <= 14)); if ((action == 11) || (action == 13)) { dev.powerAction = 2; } // Power on if ((action == 12) || (action == 14)) { dev.powerAction = 10; } // Reset - dev.amtstack.Put('AMT_BootSettingData', bootSettingData, function performAdvancedPowerActionResponseEx(stack, name, response, status, tag) { + // Set boot parameters + dev.amtstack.Put('AMT_BootSettingData', bootSettingData, function (stack, name, response, status, tag) { const dev = stack.dev; - const action = dev.powerAction; - delete dev.powerAction; - if (obj.amtDevices[dev.nodeid] == null) return; // Device no longer exists, ignore this response. - if (status != 200) return; - try { dev.amtstack.RequestPowerStateChange(action, performPowerActionResponse); } catch (ex) { } + if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error + // Set boot config + dev.amtstack.SetBootConfigRole(1, function (stack, name, response, status, tag) { + const dev = stack.dev; + if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error + // Set boot order + dev.amtstack.CIM_BootConfigSetting_ChangeBootOrder(null, function (stack, name, response, status) { + const dev = stack.dev; + if ((obj.amtDevices[dev.nodeid] == null) || (status != 200)) return; // Device no longer exists or error + // Perform power action + try { dev.amtstack.RequestPowerStateChange(dev.powerAction, performPowerActionResponse); } catch (ex) { } + }, 0, 1); + }, 0, 1); }, 0, 1); }