|
@@ -510,7 +510,27 @@ function Clear-HostAckQueue([System.Collections.Generic.Queue[object]]$AckQueue)
|
|
|
while ($AckQueue.Count -gt 0) {
|
|
while ($AckQueue.Count -gt 0) {
|
|
|
$discarded.Add($AckQueue.Dequeue()) | Out-Null
|
|
$discarded.Add($AckQueue.Dequeue()) | Out-Null
|
|
|
}
|
|
}
|
|
|
- return ,$discarded.ToArray()
|
|
|
|
|
|
|
+ return $discarded.ToArray()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function Unwrap-SingleItemArray($Value, [string]$Context) {
|
|
|
|
|
+ while ($Value -is [array] -and $Value.Count -eq 1) {
|
|
|
|
|
+ $Value = $Value[0]
|
|
|
|
|
+ }
|
|
|
|
|
+ if ($Value -is [array]) {
|
|
|
|
|
+ throw "$Context expected one ack object, got nested array count=$($Value.Count)"
|
|
|
|
|
+ }
|
|
|
|
|
+ return $Value
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function Set-AckMetadata($Ack, [string]$Key, $Value) {
|
|
|
|
|
+ $normalized = Unwrap-SingleItemArray $Ack "Set-AckMetadata"
|
|
|
|
|
+ if ($null -eq $normalized -or -not ($normalized -is [System.Collections.IDictionary])) {
|
|
|
|
|
+ $typeName = if ($null -eq $normalized) { "<null>" } else { $normalized.GetType().FullName }
|
|
|
|
|
+ throw "Set-AckMetadata expected IDictionary ack, got $typeName"
|
|
|
|
|
+ }
|
|
|
|
|
+ $normalized[$Key] = $Value
|
|
|
|
|
+ return $normalized
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function New-StartupPreflightRecord {
|
|
function New-StartupPreflightRecord {
|
|
@@ -644,7 +664,7 @@ function Invoke-StartupPreflight($HostSerial, $DebugSerial, [System.Collections.
|
|
|
|
|
|
|
|
while ($AckQueue.Count -gt 0) {
|
|
while ($AckQueue.Count -gt 0) {
|
|
|
$ack = $AckQueue.Dequeue()
|
|
$ack = $AckQueue.Dequeue()
|
|
|
- $ack["pre_sram_noise"] = $true
|
|
|
|
|
|
|
+ $ack = Set-AckMetadata $ack "pre_sram_noise" $true
|
|
|
Add-PreSramNoise $preflight "ack" $ack
|
|
Add-PreSramNoise $preflight "ack" $ack
|
|
|
$preflight.stale_acks = @($preflight.stale_acks) + $ack
|
|
$preflight.stale_acks = @($preflight.stale_acks) + $ack
|
|
|
}
|
|
}
|
|
@@ -672,7 +692,7 @@ function Invoke-StartupPreflight($HostSerial, $DebugSerial, [System.Collections.
|
|
|
|
|
|
|
|
$moreStale = @(Clear-HostAckQueue $AckQueue)
|
|
$moreStale = @(Clear-HostAckQueue $AckQueue)
|
|
|
foreach ($ack in $moreStale) {
|
|
foreach ($ack in $moreStale) {
|
|
|
- $ack["pre_sram_noise"] = $true
|
|
|
|
|
|
|
+ $ack = Set-AckMetadata $ack "pre_sram_noise" $true
|
|
|
Add-PreSramNoise $preflight "ack" $ack
|
|
Add-PreSramNoise $preflight "ack" $ack
|
|
|
}
|
|
}
|
|
|
if ($moreStale.Count -gt 0) {
|
|
if ($moreStale.Count -gt 0) {
|