|
|
@@ -486,6 +486,8 @@ pub struct StationState {
|
|
|
pub latest_mt_report_path: String,
|
|
|
pub uefi_fs_candidates: Vec<String>,
|
|
|
pub resolved_mt_efi_path: Option<String>,
|
|
|
+ pub resolved_grub_tftp_loader: Option<String>,
|
|
|
+ pub pxe_server_ip: String,
|
|
|
pub efi_probe_done: bool,
|
|
|
pub run_started_unix_ms: i64,
|
|
|
pub run_ended_unix_ms: i64,
|
|
|
@@ -500,6 +502,9 @@ pub struct StationState {
|
|
|
pub in_internal_warm_reset: bool,
|
|
|
pub amt_prefers_short_cmd: bool,
|
|
|
pub amt_fallback_attempted: bool,
|
|
|
+ pub dimm_seen_in_boot: [bool; 24],
|
|
|
+ pub had_bmc_sdr: [bool; 24],
|
|
|
+ pub sdr_absent_streak: [u8; 24],
|
|
|
}
|
|
|
|
|
|
impl StationState {
|
|
|
@@ -675,6 +680,8 @@ impl StationState {
|
|
|
latest_mt_report_path: String::new(),
|
|
|
uefi_fs_candidates: Vec::new(),
|
|
|
resolved_mt_efi_path: None,
|
|
|
+ resolved_grub_tftp_loader: None,
|
|
|
+ pxe_server_ip: "192.168.0.10".to_string(),
|
|
|
efi_probe_done: false,
|
|
|
run_started_unix_ms: 0,
|
|
|
run_ended_unix_ms: 0,
|
|
|
@@ -689,6 +696,9 @@ impl StationState {
|
|
|
in_internal_warm_reset: false,
|
|
|
amt_prefers_short_cmd: false,
|
|
|
amt_fallback_attempted: false,
|
|
|
+ dimm_seen_in_boot: [false; 24],
|
|
|
+ had_bmc_sdr: [false; 24],
|
|
|
+ sdr_absent_streak: [0; 24],
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -773,6 +783,122 @@ impl StationState {
|
|
|
self.dimm_soa.reset_stages();
|
|
|
}
|
|
|
|
|
|
+ pub fn reset_dimms_for_new_boot(&mut self) {
|
|
|
+ for idx in 0..24 {
|
|
|
+ self.dimms[idx] = DimmSlot::empty();
|
|
|
+ self.sync_dimm_to_soa(idx);
|
|
|
+ }
|
|
|
+ self.dimm_seen_in_boot = [false; 24];
|
|
|
+ self.had_bmc_sdr = [false; 24];
|
|
|
+ self.sdr_absent_streak = [0; 24];
|
|
|
+ }
|
|
|
+
|
|
|
+ pub fn clear_for_external_restart(
|
|
|
+ &mut self,
|
|
|
+ now: i64,
|
|
|
+ reason_detail: &str,
|
|
|
+ force_new_boot_id: bool,
|
|
|
+ ) {
|
|
|
+ let bp_state_now = self.boot_execution.get_str_or("state", "idle");
|
|
|
+ let had_active_or_finished_run = self.run_ended_unix_ms > 0
|
|
|
+ || self.single_run_started_ms > 0
|
|
|
+ || self.single_run_active
|
|
|
+ || self.is_run_active()
|
|
|
+ || !self.boot_execution.get_str_or("id", "").is_empty();
|
|
|
+ self.awaiting_dimm_replacement = false;
|
|
|
+ self.hot.awaiting_dimm_replacement = false;
|
|
|
+ self.plan_paused = false;
|
|
|
+ self.in_internal_warm_reset = false;
|
|
|
+ self.last_err_stage.clear();
|
|
|
+ for v in self.stage_errors.values_mut() {
|
|
|
+ v.clear();
|
|
|
+ }
|
|
|
+ self.unsupported_commands.clear();
|
|
|
+ if force_new_boot_id || self.boot_id.is_empty() {
|
|
|
+ self.boot_seq += 1;
|
|
|
+ self.hot.boot_seq = self.boot_seq;
|
|
|
+ self.boot_id = format!("B-{}-{}", self.station_id, self.boot_seq);
|
|
|
+ }
|
|
|
+ self.hot.reset_for_new_boot(now);
|
|
|
+ self.reset_dimms_for_new_boot();
|
|
|
+ self.rmt_results.clear();
|
|
|
+ self.amt_results.clear();
|
|
|
+ self.active_amt_cpus.clear();
|
|
|
+ self.amt_fallback_attempted = false;
|
|
|
+ self.mt_result = JsonVal::obj();
|
|
|
+ self.mt_per_test_errs.clear();
|
|
|
+ self.plan_configured.clear();
|
|
|
+ self.plan_done.clear();
|
|
|
+ self.plan_amt_started.clear();
|
|
|
+ self.plan_mt_started = false;
|
|
|
+ self.single_run_active = false;
|
|
|
+ self.single_run_id.clear();
|
|
|
+ self.single_run_started_ms = 0;
|
|
|
+ if had_active_or_finished_run {
|
|
|
+ self.run_started_unix_ms = 0;
|
|
|
+ self.run_ended_unix_ms = 0;
|
|
|
+ }
|
|
|
+ self.mt_started_unix_ms = 0;
|
|
|
+ self.mt_report_sync_pending = false;
|
|
|
+ self.mt_report_fetched_for_boot = false;
|
|
|
+ self.mt_waiting_report_until_ms = 0;
|
|
|
+ self.expected_mt_report_name.clear();
|
|
|
+ self.latest_mt_report_path.clear();
|
|
|
+ self.uefi_fs_candidates.clear();
|
|
|
+ self.resolved_mt_efi_path = None;
|
|
|
+ self.resolved_grub_tftp_loader = None;
|
|
|
+ self.efi_probe_done = false;
|
|
|
+ self.observed_stages.clear();
|
|
|
+ self.stage_step_counts.clear();
|
|
|
+ self.observed_phase = "boot".to_string();
|
|
|
+ self.observed_detail = reason_detail.to_string();
|
|
|
+ self.observed_cpu = None;
|
|
|
+ self.observed_uip_stage = None;
|
|
|
+ self.observed_unix_ms = now;
|
|
|
+ self.prompt_ready = false;
|
|
|
+ self.prompt_kind.clear();
|
|
|
+ self.prompt_cpu = None;
|
|
|
+ self.prompt_uip_stage = None;
|
|
|
+ self.prompt_evidence.clear();
|
|
|
+ self.async_script.clear();
|
|
|
+ self.tx_pacer.clear();
|
|
|
+ self.pending_complete_signal = None;
|
|
|
+ self.task_status = "not_started".to_string();
|
|
|
+ self.stage_intents.clear();
|
|
|
+ self.last_uip_apply = None;
|
|
|
+ self.last_amt_apply = None;
|
|
|
+ self.last_amt_start = None;
|
|
|
+ self.last_phase_action = None;
|
|
|
+ self.command = JsonVal::Null;
|
|
|
+ if bp_state_now != "idle"
|
|
|
+ || !self.boot_execution.get_str_or("id", "").is_empty()
|
|
|
+ || !self.boot_execution.get_str_or("boot_id", "").is_empty()
|
|
|
+ || !self.boot_execution.get_str_or("error", "").is_empty()
|
|
|
+ || !self.boot_execution.get_str_or("current_stage", "").is_empty()
|
|
|
+ || !self.boot_execution.get_str_or("waiting_reason", "").is_empty()
|
|
|
+ || self
|
|
|
+ .boot_execution
|
|
|
+ .get_arr("handled_inputs")
|
|
|
+ .map(|a| !a.is_empty())
|
|
|
+ .unwrap_or(false)
|
|
|
+ || self
|
|
|
+ .boot_execution
|
|
|
+ .get_f64("started_unix_ms")
|
|
|
+ .unwrap_or(0.0)
|
|
|
+ > 0.0
|
|
|
+ {
|
|
|
+ self.boot_execution.set("id", JsonVal::Str(String::new()));
|
|
|
+ self.boot_execution.set("boot_id", JsonVal::Str(String::new()));
|
|
|
+ self.boot_execution.set("state", JsonVal::Str("idle".to_string()));
|
|
|
+ self.boot_execution.set("current_stage", JsonVal::Str(String::new()));
|
|
|
+ self.boot_execution.set("error", JsonVal::Str(String::new()));
|
|
|
+ self.boot_execution.set("waiting_reason", JsonVal::Str(String::new()));
|
|
|
+ self.boot_execution.set("handled_inputs", JsonVal::Arr(Vec::new()));
|
|
|
+ self.boot_execution.set("started_unix_ms", JsonVal::Num(0.0));
|
|
|
+ self.boot_execution.set("updated_unix_ms", JsonVal::Num(now as f64));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
pub fn clear_bmc_sdr_temps(&mut self) {
|
|
|
for idx in 0..24 {
|
|
|
if self.dimms[idx].source == "bmc_sdr" {
|
|
|
@@ -863,10 +989,17 @@ impl StationState {
|
|
|
self.latest_mt_report_path.clear();
|
|
|
self.uefi_fs_candidates.clear();
|
|
|
self.resolved_mt_efi_path = None;
|
|
|
+ self.resolved_grub_tftp_loader = None;
|
|
|
self.efi_probe_done = false;
|
|
|
self.awaiting_dimm_replacement = false;
|
|
|
self.hot.awaiting_dimm_replacement = false;
|
|
|
self.task_status = "not_started".to_string();
|
|
|
+ self.stage_intents.clear();
|
|
|
+ self.last_uip_apply = None;
|
|
|
+ self.last_amt_apply = None;
|
|
|
+ self.last_amt_start = None;
|
|
|
+ self.last_phase_action = None;
|
|
|
+ self.command = JsonVal::Null;
|
|
|
self.rmt_results.clear();
|
|
|
self.amt_results.clear();
|
|
|
self.active_amt_cpus.clear();
|
|
|
@@ -877,10 +1010,9 @@ impl StationState {
|
|
|
for v in self.stage_errors.values_mut() {
|
|
|
v.clear();
|
|
|
}
|
|
|
- for idx in 0..24 {
|
|
|
- self.dimms[idx] = DimmSlot::empty();
|
|
|
- self.sync_dimm_to_soa(idx);
|
|
|
- }
|
|
|
+ self.reset_dimms_for_new_boot();
|
|
|
+ self.boot_execution.set("id", JsonVal::Str(String::new()));
|
|
|
+ self.boot_execution.set("boot_id", JsonVal::Str(String::new()));
|
|
|
self.boot_execution.set("state", JsonVal::Str("idle".to_string()));
|
|
|
self.boot_execution.set("current_stage", JsonVal::Str(String::new()));
|
|
|
self.boot_execution.set("error", JsonVal::Str(String::new()));
|
|
|
@@ -888,6 +1020,8 @@ impl StationState {
|
|
|
"waiting_reason",
|
|
|
JsonVal::Str("测试机未连接或已失联,通道与运行状态已清空".to_string()),
|
|
|
);
|
|
|
+ self.boot_execution.set("handled_inputs", JsonVal::Arr(Vec::new()));
|
|
|
+ self.boot_execution.set("started_unix_ms", JsonVal::Num(0.0));
|
|
|
self.boot_execution.set("updated_unix_ms", JsonVal::Num(now as f64));
|
|
|
if self.task_batch.get_str_or("state", "idle") == "running" {
|
|
|
self.task_batch.set("state", JsonVal::Str("stopped".to_string()));
|
|
|
@@ -933,6 +1067,28 @@ impl StationState {
|
|
|
|| self.task_status == "running"
|
|
|
}
|
|
|
|
|
|
+ #[inline]
|
|
|
+ pub fn has_any_failure_state(&self) -> bool {
|
|
|
+ self.awaiting_dimm_replacement
|
|
|
+ || self.hot.mt_fail_complete
|
|
|
+ || self.mt_result.get_str_or("status", "") == "fail"
|
|
|
+ || self
|
|
|
+ .amt_results
|
|
|
+ .values()
|
|
|
+ .any(|r| r.status == "fail" || r.status == "block")
|
|
|
+ || self.stage_errors.values().any(|v| !v.is_empty())
|
|
|
+ }
|
|
|
+
|
|
|
+ #[inline]
|
|
|
+ pub fn has_entered_ddr_training(&self) -> bool {
|
|
|
+ self.observed_stages.contains("uip")
|
|
|
+ || self.hot.ict_stage1_complete
|
|
|
+ || self.observed_stages.contains("rmt")
|
|
|
+ || self.observed_stages.contains("amt")
|
|
|
+ || self.observed_stages.contains("uefi")
|
|
|
+ || self.observed_stages.contains("mt")
|
|
|
+ }
|
|
|
+
|
|
|
#[inline]
|
|
|
pub fn freeze_run_timing(&mut self, now: i64) {
|
|
|
if self.run_started_unix_ms > 0 && self.run_ended_unix_ms == 0 {
|
|
|
@@ -1063,6 +1219,8 @@ impl StationState {
|
|
|
slot.failed_stage = stage.to_string();
|
|
|
}
|
|
|
}
|
|
|
+ self.dimm_seen_in_boot[idx] = true;
|
|
|
+ self.sdr_absent_streak[idx] = 0;
|
|
|
self.sync_dimm_to_soa(idx);
|
|
|
}
|
|
|
}
|
|
|
@@ -1133,8 +1291,35 @@ impl StationState {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- let cpu = if ev.cpu >= 0 { Some(ev.cpu as i64) } else { None };
|
|
|
- let ch = if ev.channel >= 0 { Some(ev.channel as i64) } else { None };
|
|
|
+ let mut cpu = if ev.cpu >= 0 { Some(ev.cpu as i64) } else { None };
|
|
|
+ let mut ch = if ev.channel >= 0 { Some(ev.channel as i64) } else { None };
|
|
|
+ let mut dimm = if ev.dimm >= 0 { Some(ev.dimm as i64) } else { None };
|
|
|
+ self.resolve_coords_from_sn(line, &mut cpu, &mut ch, &mut dimm);
|
|
|
+ let (prev_msg_snap, prev_cpu_snap) = self
|
|
|
+ .stage_errors
|
|
|
+ .get(stage)
|
|
|
+ .and_then(|v| v.last())
|
|
|
+ .map(|last| (last.get_str_or("message", ""), last.get_i64("cpu")))
|
|
|
+ .unwrap_or_default();
|
|
|
+ if (cpu.is_none() || ch.is_none()) && !prev_msg_snap.is_empty() {
|
|
|
+ self.resolve_coords_from_sn(&prev_msg_snap, &mut cpu, &mut ch, &mut dimm);
|
|
|
+ }
|
|
|
+ if cpu.is_none() {
|
|
|
+ if let Some(c) = ch {
|
|
|
+ if (0..12).contains(&c) {
|
|
|
+ let s0 = self.dimms[c as usize].presence == "present";
|
|
|
+ let s1 = self.dimms[12 + (c as usize)].presence == "present";
|
|
|
+ if s0 && !s1 {
|
|
|
+ cpu = Some(0);
|
|
|
+ } else if s1 && !s0 {
|
|
|
+ cpu = Some(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if cpu.is_none() {
|
|
|
+ cpu = prev_cpu_snap;
|
|
|
+ }
|
|
|
let valid_bank = if (0..32).contains(&ev.bank) {
|
|
|
Some(ev.bank as i64)
|
|
|
} else {
|
|
|
@@ -1156,6 +1341,8 @@ impl StationState {
|
|
|
slot.failed_stage = stage.to_string();
|
|
|
}
|
|
|
}
|
|
|
+ self.dimm_seen_in_boot[idx] = true;
|
|
|
+ self.sdr_absent_streak[idx] = 0;
|
|
|
self.sync_dimm_to_soa(idx);
|
|
|
}
|
|
|
}
|
|
|
@@ -1612,8 +1799,9 @@ impl StationState {
|
|
|
};
|
|
|
self.observed_detail = "confirmed_dimm_replacement".to_string();
|
|
|
self.stage_errors.values_mut().for_each(|v| v.clear());
|
|
|
+ self.last_err_stage.clear();
|
|
|
self.unsupported_commands.clear();
|
|
|
- self.reset_all_dimm_stages();
|
|
|
+ self.reset_dimms_for_new_boot();
|
|
|
self.task_status = "not_started".to_string();
|
|
|
if matches!(
|
|
|
self.boot_execution.get_str_or("state", "").as_str(),
|
|
|
@@ -1793,6 +1981,14 @@ impl StationState {
|
|
|
let low_wr = trimmed.to_ascii_lowercase();
|
|
|
if low_wr.contains("warm reset")
|
|
|
|| low_wr.contains("warmreset")
|
|
|
+ || low_wr.contains("power good reset")
|
|
|
+ || low_wr.contains("post_reset_powergood")
|
|
|
+ || low_wr.contains("reset requested: 2")
|
|
|
+ || low_wr.contains("reset requested: 6")
|
|
|
+ || low_wr.contains("resetrequired: 02")
|
|
|
+ || low_wr.contains("resetrequired: 06")
|
|
|
+ || low_wr.contains("resetrequired: 0x02")
|
|
|
+ || low_wr.contains("resetrequired: 0x06")
|
|
|
|| low_wr.contains("mrc_status_reset_required")
|
|
|
{
|
|
|
self.in_internal_warm_reset = true;
|
|
|
@@ -1812,7 +2008,17 @@ impl StationState {
|
|
|
} else {
|
|
|
self.amt_prefers_short_cmd = false;
|
|
|
}
|
|
|
- if self.in_internal_warm_reset {
|
|
|
+ let bp_state_now = self.boot_execution.get_str_or("state", "idle");
|
|
|
+ let was_blocked_or_terminal = self.has_any_failure_state()
|
|
|
+ || matches!(
|
|
|
+ bp_state_now.as_str(),
|
|
|
+ "blocked" | "failed" | "completed" | "stopped" | "interrupted"
|
|
|
+ )
|
|
|
+ || matches!(
|
|
|
+ self.task_status.as_str(),
|
|
|
+ "failed" | "completed" | "interrupted"
|
|
|
+ );
|
|
|
+ if self.in_internal_warm_reset && !was_blocked_or_terminal {
|
|
|
self.in_internal_warm_reset = false;
|
|
|
self.hot.awaiting_reset_banner = false;
|
|
|
self.hot.stage_rank = 0;
|
|
|
@@ -1826,14 +2032,30 @@ impl StationState {
|
|
|
self.plan_done.retain(|k| !k.contains(":uip1"));
|
|
|
self.observed_phase = "boot".to_string();
|
|
|
self.observed_detail = "internal_warm_reset".to_string();
|
|
|
- self.cleaner.clear_halfline();
|
|
|
self.observed_unix_ms = now;
|
|
|
self.hot.observed_unix_ms = now;
|
|
|
return;
|
|
|
}
|
|
|
self.in_internal_warm_reset = false;
|
|
|
- // Only "[SYS_BIOS]Version:" increments boot_id (never ICT Stage 2 banner!)
|
|
|
- if (!self.hot.awaiting_reset_banner && self.observed_detail != "host_reset")
|
|
|
+ if was_blocked_or_terminal || (!self.is_run_active() && !self.hot.awaiting_reset_banner) {
|
|
|
+ self.clear_for_external_restart(now, "bios_banner", true);
|
|
|
+ self.observed_stages.insert("boot".to_string());
|
|
|
+ *self.stage_step_counts.entry("boot".to_string()).or_insert(0) += 1;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // Only "[SYS_BIOS]Version:" increments boot_id (never ICT Stage 2 banner or pre-ICT1 MRC warm resets!)
|
|
|
+ let pre_uip_active_reset = !was_blocked_or_terminal
|
|
|
+ && self.is_run_active()
|
|
|
+ && self.observed_stages.contains("boot")
|
|
|
+ && !self.observed_stages.contains("uip")
|
|
|
+ && !self.observed_stages.contains("rmt")
|
|
|
+ && !self.observed_stages.contains("amt")
|
|
|
+ && !self.observed_stages.contains("uefi")
|
|
|
+ && !self.observed_stages.contains("mt")
|
|
|
+ && !self.hot.training_complete;
|
|
|
+ if (!self.hot.awaiting_reset_banner
|
|
|
+ && self.observed_detail != "host_reset"
|
|
|
+ && !pre_uip_active_reset)
|
|
|
|| self.boot_id.is_empty()
|
|
|
{
|
|
|
self.boot_seq += 1;
|
|
|
@@ -1841,6 +2063,10 @@ impl StationState {
|
|
|
self.boot_id = format!("B-{}-{}", self.station_id, self.boot_seq);
|
|
|
}
|
|
|
self.hot.reset_for_new_boot(now);
|
|
|
+ self.awaiting_dimm_replacement = false;
|
|
|
+ self.hot.awaiting_dimm_replacement = false;
|
|
|
+ self.plan_paused = false;
|
|
|
+ self.last_err_stage.clear();
|
|
|
if self.run_started_unix_ms == 0 && self.is_run_active() {
|
|
|
self.run_started_unix_ms = now;
|
|
|
self.run_ended_unix_ms = 0;
|
|
|
@@ -1853,6 +2079,7 @@ impl StationState {
|
|
|
self.latest_mt_report_path.clear();
|
|
|
self.uefi_fs_candidates.clear();
|
|
|
self.resolved_mt_efi_path = None;
|
|
|
+ self.resolved_grub_tftp_loader = None;
|
|
|
self.efi_probe_done = false;
|
|
|
self.observed_phase = "boot".to_string();
|
|
|
self.observed_detail = "bios_banner".to_string();
|
|
|
@@ -1877,13 +2104,61 @@ impl StationState {
|
|
|
v.clear();
|
|
|
}
|
|
|
self.unsupported_commands.clear();
|
|
|
- self.reset_all_dimm_stages();
|
|
|
+ self.reset_dimms_for_new_boot();
|
|
|
self.observed_unix_ms = now;
|
|
|
}
|
|
|
+ lib::STL_LK_ICT_BANNER_HOVSEE | lib::STL_LK_ICT_BANNER_CXMT => {
|
|
|
+ let bp_state_now = self.boot_execution.get_str_or("state", "idle");
|
|
|
+ let is_terminal = matches!(
|
|
|
+ bp_state_now.as_str(),
|
|
|
+ "blocked" | "failed" | "completed" | "stopped" | "interrupted"
|
|
|
+ ) || matches!(
|
|
|
+ self.task_status.as_str(),
|
|
|
+ "failed" | "completed" | "interrupted"
|
|
|
+ );
|
|
|
+ // Stage 2 (`Current stage is 2`) emits `STL_LK_ICT_BANNER_HOVSEE / CXMT`
|
|
|
+ // inside the same boot right after Training/RMT/AMT (`started_unix_ms` must stay).
|
|
|
+ // Only clear for external restart after entering Stage 2+ or when already terminal/blocked.
|
|
|
+ if is_terminal
|
|
|
+ || self.awaiting_dimm_replacement
|
|
|
+ || self.hot.ict_stage2_complete
|
|
|
+ || self.hot.uefi_complete
|
|
|
+ || self.hot.mt_banner_seen
|
|
|
+ || self.hot.mt_pass_complete
|
|
|
+ || self.hot.mt_fail_complete
|
|
|
+ || self.observed_stages.contains("uefi")
|
|
|
+ || self.observed_stages.contains("mt")
|
|
|
+ || self.observed_stages.contains("post")
|
|
|
+ {
|
|
|
+ self.clear_for_external_restart(now, "ict_banner_reboot", true);
|
|
|
+ }
|
|
|
+ self.hot.awaiting_reset_banner = false;
|
|
|
+ self.in_internal_warm_reset = false;
|
|
|
+ self.advance_phase("uip", "uip_banner", now);
|
|
|
+ }
|
|
|
lib::STL_LK_ICT_START_STAGE1 | lib::STL_LK_ICT_START_STAGE2 => {
|
|
|
let stg = if ev.kind == lib::STL_LK_ICT_START_STAGE2 { 2i64 } else { 1i64 };
|
|
|
let cpu = if ev.cpu >= 0 { ev.cpu as i64 } else { 0 };
|
|
|
if stg == 1 {
|
|
|
+ let bp_state_now = self.boot_execution.get_str_or("state", "idle");
|
|
|
+ if self.has_any_failure_state()
|
|
|
+ || self.hot.training_complete
|
|
|
+ || self.hot.rmt_complete
|
|
|
+ || self.hot.amt_complete
|
|
|
+ || self.hot.ict_stage2_complete
|
|
|
+ || self.hot.uefi_complete
|
|
|
+ || self.hot.mt_pass_complete
|
|
|
+ || matches!(
|
|
|
+ bp_state_now.as_str(),
|
|
|
+ "blocked" | "failed" | "completed" | "stopped" | "interrupted"
|
|
|
+ )
|
|
|
+ || matches!(
|
|
|
+ self.task_status.as_str(),
|
|
|
+ "failed" | "completed" | "interrupted"
|
|
|
+ )
|
|
|
+ {
|
|
|
+ self.clear_for_external_restart(now, "uip_stage1_reboot", true);
|
|
|
+ }
|
|
|
self.hot.awaiting_reset_banner = false;
|
|
|
self.in_internal_warm_reset = false;
|
|
|
}
|
|
|
@@ -1915,6 +2190,7 @@ impl StationState {
|
|
|
self.hot.ict_stage2_complete = true;
|
|
|
} else if self.observed_cpu == Some((self.cpu_count.saturating_sub(1)) as i64)
|
|
|
|| trimmed.contains("go on training")
|
|
|
+ || self.observed_stages.contains("uip")
|
|
|
{
|
|
|
self.hot.ict_stage1_complete = true;
|
|
|
}
|
|
|
@@ -1925,6 +2201,28 @@ impl StationState {
|
|
|
self.apply_prompt_event(&ev, trimmed_bytes, now);
|
|
|
}
|
|
|
lib::STL_LK_DIMM_INVENTORY => {
|
|
|
+ if ev.val1 == 1 {
|
|
|
+ let bp_state_now = self.boot_execution.get_str_or("state", "idle");
|
|
|
+ let is_terminal = matches!(
|
|
|
+ bp_state_now.as_str(),
|
|
|
+ "blocked" | "failed" | "completed" | "stopped" | "interrupted"
|
|
|
+ ) || matches!(
|
|
|
+ self.task_status.as_str(),
|
|
|
+ "failed" | "completed" | "interrupted"
|
|
|
+ );
|
|
|
+ if self.has_any_failure_state()
|
|
|
+ || is_terminal
|
|
|
+ || self.hot.amt_complete
|
|
|
+ || self.hot.ict_stage2_complete
|
|
|
+ || self.hot.uefi_complete
|
|
|
+ || self.hot.mt_banner_seen
|
|
|
+ || self.observed_stages.contains("amt")
|
|
|
+ || self.observed_stages.contains("uefi")
|
|
|
+ || self.observed_stages.contains("mt")
|
|
|
+ {
|
|
|
+ self.clear_for_external_restart(now, "dram_inventory_reboot", true);
|
|
|
+ }
|
|
|
+ }
|
|
|
if ev.cpu >= 0 && ev.channel >= 0 {
|
|
|
let slot_idx = (ev.cpu as usize) * 12 + (ev.channel as usize);
|
|
|
if slot_idx < 24 {
|
|
|
@@ -1936,8 +2234,11 @@ impl StationState {
|
|
|
|| (trimmed.contains("Error:") && trimmed.contains("disable channel"))
|
|
|
|| self.observed_phase == "training"
|
|
|
|| self.observed_phase == "rmt";
|
|
|
+ let stg = if self.observed_phase == "rmt" { "rmt" } else { "training" };
|
|
|
self.dimms[slot_idx].presence = "present".to_string();
|
|
|
self.dimms[slot_idx].enabled = "disabled".to_string();
|
|
|
+ self.dimm_seen_in_boot[slot_idx] = true;
|
|
|
+ self.sdr_absent_streak[slot_idx] = 0;
|
|
|
if let Some(sn) = extract_sn_after_colon(trimmed) {
|
|
|
let cur = &self.dimms[slot_idx].sn;
|
|
|
let cur_is_hex = cur.len() >= 2 && cur[..2].eq_ignore_ascii_case("0x");
|
|
|
@@ -1947,14 +2248,17 @@ impl StationState {
|
|
|
}
|
|
|
}
|
|
|
if is_explicit_train_fail {
|
|
|
- self.dimms[slot_idx].stage_training = "fail".to_string();
|
|
|
+ if stg == "rmt" {
|
|
|
+ self.dimms[slot_idx].stage_rmt = "fail".to_string();
|
|
|
+ } else {
|
|
|
+ self.dimms[slot_idx].stage_training = "fail".to_string();
|
|
|
+ }
|
|
|
if self.dimms[slot_idx].failed_stage.is_empty() {
|
|
|
- self.dimms[slot_idx].failed_stage = "training".to_string();
|
|
|
+ self.dimms[slot_idx].failed_stage = stg.to_string();
|
|
|
}
|
|
|
}
|
|
|
self.sync_dimm_to_soa(slot_idx);
|
|
|
if is_explicit_train_fail {
|
|
|
- let stg = if self.observed_phase == "rmt" { "rmt" } else { "training" };
|
|
|
self.record_stage_error(
|
|
|
stg,
|
|
|
Some(ev.cpu as i64),
|
|
|
@@ -1964,23 +2268,39 @@ impl StationState {
|
|
|
);
|
|
|
}
|
|
|
} else if ev.subkind == 4 {
|
|
|
- self.dimms[slot_idx].presence = "present".to_string();
|
|
|
- if self.dimms[slot_idx].enabled == "unknown" {
|
|
|
- self.dimms[slot_idx].enabled = "enabled".to_string();
|
|
|
- }
|
|
|
- if let Some(sn) = extract_sn_after_colon(trimmed) {
|
|
|
- let cur = &self.dimms[slot_idx].sn;
|
|
|
- let cur_is_hex = cur.len() >= 2 && cur[..2].eq_ignore_ascii_case("0x");
|
|
|
- let new_is_hex = sn.len() >= 2 && sn[..2].eq_ignore_ascii_case("0x");
|
|
|
- if cur.is_empty() || cur_is_hex || !new_is_hex {
|
|
|
- self.dimms[slot_idx].sn = sn;
|
|
|
+ let low_line = trimmed.to_ascii_lowercase();
|
|
|
+ let sn_opt = extract_sn_after_colon(trimmed);
|
|
|
+ let is_test_no_without_sn = (low_line.contains("test: n")
|
|
|
+ || low_line.contains("test:n"))
|
|
|
+ && sn_opt.is_none();
|
|
|
+ if !is_test_no_without_sn {
|
|
|
+ self.dimms[slot_idx].presence = "present".to_string();
|
|
|
+ self.dimm_seen_in_boot[slot_idx] = true;
|
|
|
+ self.sdr_absent_streak[slot_idx] = 0;
|
|
|
+ if self.dimms[slot_idx].enabled == "unknown" {
|
|
|
+ self.dimms[slot_idx].enabled = "enabled".to_string();
|
|
|
}
|
|
|
+ if let Some(sn) = sn_opt {
|
|
|
+ let cur = &self.dimms[slot_idx].sn;
|
|
|
+ let cur_is_hex = cur.len() >= 2 && cur[..2].eq_ignore_ascii_case("0x");
|
|
|
+ let new_is_hex = sn.len() >= 2 && sn[..2].eq_ignore_ascii_case("0x");
|
|
|
+ if cur.is_empty() || cur_is_hex || !new_is_hex {
|
|
|
+ self.dimms[slot_idx].sn = sn;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ self.backfill_completed_stages_for_slot(slot_idx);
|
|
|
+ self.sync_dimm_to_soa(slot_idx);
|
|
|
}
|
|
|
- self.backfill_completed_stages_for_slot(slot_idx);
|
|
|
- self.sync_dimm_to_soa(slot_idx);
|
|
|
} else if ev.subkind == 0 {
|
|
|
- if self.dimms[slot_idx].presence == "unknown" {
|
|
|
+ let keep_current_fail = self.dimm_seen_in_boot[slot_idx]
|
|
|
+ && !self.dimms[slot_idx].failed_stage.is_empty();
|
|
|
+ if !keep_current_fail {
|
|
|
+ self.dimms[slot_idx] = DimmSlot::empty();
|
|
|
self.dimms[slot_idx].presence = "absent".to_string();
|
|
|
+ self.dimms[slot_idx].quality = "unavailable".to_string();
|
|
|
+ self.dimm_seen_in_boot[slot_idx] = false;
|
|
|
+ self.had_bmc_sdr[slot_idx] = false;
|
|
|
+ self.sdr_absent_streak[slot_idx] = 0;
|
|
|
self.sync_dimm_to_soa(slot_idx);
|
|
|
}
|
|
|
}
|
|
|
@@ -2001,6 +2321,8 @@ impl StationState {
|
|
|
self.dimms[slot_idx].source = "rmt_sensor".to_string();
|
|
|
self.dimms[slot_idx].received_ms = now;
|
|
|
self.dimms[slot_idx].presence = "present".to_string();
|
|
|
+ self.dimm_seen_in_boot[slot_idx] = true;
|
|
|
+ self.sdr_absent_streak[slot_idx] = 0;
|
|
|
if self.dimms[slot_idx].enabled == "unknown" {
|
|
|
self.dimms[slot_idx].enabled = "enabled".to_string();
|
|
|
}
|
|
|
@@ -2010,10 +2332,15 @@ impl StationState {
|
|
|
}
|
|
|
}
|
|
|
lib::STL_LK_MRC_START => {
|
|
|
- self.hot.ict_stage1_complete = true;
|
|
|
self.prompt_ready = false;
|
|
|
self.hot.prompt_ready = false;
|
|
|
+ let real_training = self.has_entered_ddr_training()
|
|
|
+ || trimmed.contains("MemTest")
|
|
|
+ || trimmed.contains("RcdQcaTraining")
|
|
|
+ || trimmed.contains("DDR Training")
|
|
|
+ || trimmed.contains("StartMemTrain");
|
|
|
if trimmed.contains("MemTest") {
|
|
|
+ self.hot.ict_stage1_complete = true;
|
|
|
self.hot.training_complete = true;
|
|
|
if self.observed_stages.contains("rmt")
|
|
|
&& self.rmt_results.values().any(|r| r.measurement_rows > 0)
|
|
|
@@ -2028,15 +2355,31 @@ impl StationState {
|
|
|
}
|
|
|
self.advance_phase("amt", "amt_step", now);
|
|
|
*self.stage_step_counts.entry("amt".to_string()).or_insert(0) += 1;
|
|
|
- } else {
|
|
|
+ } else if real_training {
|
|
|
+ self.hot.ict_stage1_complete = true;
|
|
|
+ self.hot.awaiting_reset_banner = false;
|
|
|
self.advance_phase("training", "training_step", now);
|
|
|
*self.stage_step_counts.entry("training".to_string()).or_insert(0) += 1;
|
|
|
+ } else {
|
|
|
+ self.observed_unix_ms = now;
|
|
|
+ self.hot.observed_unix_ms = now;
|
|
|
}
|
|
|
- if trimmed.contains("DDR Training -- SUCCEEDED") {
|
|
|
+ if real_training && trimmed.contains("DDR Training -- SUCCEEDED") {
|
|
|
self.hot.training_complete = true;
|
|
|
}
|
|
|
}
|
|
|
lib::STL_LK_MRC_DONE => {
|
|
|
+ self.prompt_ready = false;
|
|
|
+ self.hot.prompt_ready = false;
|
|
|
+ let real_training_done = ev.subkind == 4
|
|
|
+ || self.has_entered_ddr_training()
|
|
|
+ || trimmed.contains("EndMemTrain")
|
|
|
+ || trimmed.contains("Memory Training Complete");
|
|
|
+ if !real_training_done {
|
|
|
+ self.observed_unix_ms = now;
|
|
|
+ self.hot.observed_unix_ms = now;
|
|
|
+ return;
|
|
|
+ }
|
|
|
self.hot.ict_stage1_complete = true;
|
|
|
self.hot.training_complete = true;
|
|
|
self.mark_present_channels_training_pass();
|
|
|
@@ -2051,8 +2394,6 @@ impl StationState {
|
|
|
}
|
|
|
self.hot.rmt_complete = true;
|
|
|
}
|
|
|
- self.prompt_ready = false;
|
|
|
- self.hot.prompt_ready = false;
|
|
|
if ev.subkind == 4 {
|
|
|
if self.observed_uip_stage.unwrap_or(1) > 1 {
|
|
|
self.hot.ict_stage2_complete = true;
|
|
|
@@ -2165,6 +2506,8 @@ impl StationState {
|
|
|
self.dimm_soa.rmt_rx_vref_lo[slot_idx] = ev.val2 as i16;
|
|
|
self.dimm_soa.rmt_rx_vref_hi[slot_idx] = ev.val3 as i16;
|
|
|
self.dimms[slot_idx].presence = "present".to_string();
|
|
|
+ self.dimm_seen_in_boot[slot_idx] = true;
|
|
|
+ self.sdr_absent_streak[slot_idx] = 0;
|
|
|
if self.dimms[slot_idx].enabled == "unknown" {
|
|
|
self.dimms[slot_idx].enabled = "enabled".to_string();
|
|
|
}
|
|
|
@@ -2495,6 +2838,19 @@ impl StationState {
|
|
|
let mut ch = if ev.channel >= 0 { Some(ev.channel as i64) } else { None };
|
|
|
let mut dimm = if ev.dimm >= 0 { Some(ev.dimm as i64) } else { None };
|
|
|
self.resolve_coords_from_sn(trimmed, &mut cpu, &mut ch, &mut dimm);
|
|
|
+ if cpu.is_none() {
|
|
|
+ if let Some(c) = ch {
|
|
|
+ if (0..12).contains(&c) {
|
|
|
+ let s0 = self.dimms[c as usize].presence == "present";
|
|
|
+ let s1 = self.dimms[12 + (c as usize)].presence == "present";
|
|
|
+ if s0 && !s1 {
|
|
|
+ cpu = Some(0);
|
|
|
+ } else if s1 && !s0 {
|
|
|
+ cpu = Some(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
self.record_stage_error_coords(
|
|
|
"mt",
|
|
|
cpu,
|
|
|
@@ -2593,6 +2949,37 @@ impl StationState {
|
|
|
}
|
|
|
|
|
|
fn apply_prompt_event(&mut self, ev: &lib::StlRe2cEvent, raw_bytes: &[u8], now: i64) {
|
|
|
+ let bp_state_now = self.boot_execution.get_str_or("state", "idle");
|
|
|
+ let is_terminal = matches!(
|
|
|
+ bp_state_now.as_str(),
|
|
|
+ "blocked" | "failed" | "completed" | "stopped" | "interrupted"
|
|
|
+ ) || matches!(
|
|
|
+ self.task_status.as_str(),
|
|
|
+ "failed" | "completed" | "interrupted"
|
|
|
+ );
|
|
|
+ if ev.kind == lib::STL_LK_ICT_ENTER_HINT
|
|
|
+ && (is_terminal
|
|
|
+ || self.awaiting_dimm_replacement
|
|
|
+ || self.hot.ict_stage2_complete
|
|
|
+ || self.hot.uefi_complete
|
|
|
+ || self.hot.mt_banner_seen
|
|
|
+ || self.hot.mt_pass_complete
|
|
|
+ || self.hot.mt_fail_complete
|
|
|
+ || self.observed_stages.contains("uefi")
|
|
|
+ || self.observed_stages.contains("mt")
|
|
|
+ || self.observed_stages.contains("post"))
|
|
|
+ {
|
|
|
+ self.clear_for_external_restart(now, "uip_enter_reboot", true);
|
|
|
+ } else if ev.kind == lib::STL_LK_ICT_PROMPT
|
|
|
+ && (self.hot.uefi_complete
|
|
|
+ || self.hot.mt_banner_seen
|
|
|
+ || self.hot.mt_pass_complete
|
|
|
+ || self.hot.mt_fail_complete
|
|
|
+ || self.observed_stages.contains("uefi")
|
|
|
+ || self.observed_stages.contains("mt"))
|
|
|
+ {
|
|
|
+ self.clear_for_external_restart(now, "uip_prompt_reboot", true);
|
|
|
+ }
|
|
|
if self.hot.awaiting_reset_banner && self.bmc_enabled && !self.bmc_host.is_empty() {
|
|
|
return;
|
|
|
}
|