Skip to content

Commit 840e1ed

Browse files
committed
Satisfy updated compiler regarding write to static mut
1 parent 336fc16 commit 840e1ed

File tree

5 files changed

+28
-15
lines changed

5 files changed

+28
-15
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ zip = { version = "0.6", default-features = false, features = ["bzip2", "deflate
146146
# Oxide forks and repos
147147
attest-data = { git = "https://github.com/oxidecomputer/dice-util", default-features = false, version = "0.4.0" }
148148
dice-mfg-msgs = { git = "https://github.com/oxidecomputer/dice-util", default-features = false, version = "0.2.1" }
149-
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", default-features = false, features = ["smoltcp"] }
149+
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", default-features = false, features = ["smoltcp"], rev = "ef7ce28f349dca6774b931bb169690e908e3eecd" }
150150
gateway-ereport-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", default-features = false }
151151
gimlet-inspector-protocol = { git = "https://github.com/oxidecomputer/gimlet-inspector-protocol", version = "0.1.0" }
152152
hif = { git = "https://github.com/oxidecomputer/hif", default-features = false }

drv/lpc55-update-server/src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use core::convert::Infallible;
1313
use core::mem::MaybeUninit;
1414
use core::ops::Range;
15+
use core::ptr;
1516
use drv_lpc55_flash::{BYTES_PER_FLASH_PAGE, BYTES_PER_FLASH_WORD};
1617
use drv_lpc55_update_api::{
1718
Fwid, RawCabooseError, RotBootInfo, RotBootInfoV2, RotComponent, RotPage,
@@ -41,6 +42,9 @@ const PAGE_SIZE: u32 = BYTES_PER_FLASH_PAGE as u32;
4142
#[link_section = ".bootstate"]
4243
static BOOTSTATE: MaybeUninit<[u8; 0x1000]> = MaybeUninit::uninit();
4344

45+
// The TRANSIENT_OVERRIDE field is always initialized.
46+
// It contains either the Bootleby BootDecisionLog or one of our
47+
// settings/clearings of the transient override preference.
4448
#[used]
4549
#[link_section = ".transient_override"]
4650
static mut TRANSIENT_OVERRIDE: MaybeUninit<[u8; 32]> = MaybeUninit::uninit();
@@ -1478,7 +1482,10 @@ fn set_transient_override(preference: [u8; 32]) {
14781482
// Calling this function multiple times is ok.
14791483
// Bootleby is careful to vet contents before acting.
14801484
unsafe {
1481-
TRANSIENT_OVERRIDE.write(preference);
1485+
ptr::write_volatile(
1486+
ptr::addr_of_mut!(TRANSIENT_OVERRIDE),
1487+
MaybeUninit::new(preference),
1488+
);
14821489
}
14831490
}
14841491

drv/update-api/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ pub enum UpdateError {
6767
VersionNotSupported,
6868

6969
InvalidPreferredSlotId,
70-
// AlreadyPending,
71-
// NonePending,
70+
AlreadyPending,
71+
NonePending,
7272
}
7373

7474
impl From<UpdateError> for GwUpdateError {
@@ -108,8 +108,8 @@ impl From<UpdateError> for GwUpdateError {
108108
UpdateError::SignatureNotValidated => Self::SignatureNotValidated,
109109
UpdateError::VersionNotSupported => Self::VersionNotSupported,
110110
UpdateError::InvalidPreferredSlotId => Self::InvalidPreferredSlotId,
111-
// UpdateError::AlreadyPending => Self::AlreadyPending,
112-
// UpdateError::NonePending => Self::NonePending,
111+
UpdateError::AlreadyPending => Self::AlreadyPending,
112+
UpdateError::NonePending => Self::NonePending,
113113
}
114114
}
115115
}

task/control-plane-agent/src/mgs_common.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,12 @@ impl MgsCommon {
708708
HIGHEST_KNOWN_ROT_VERSION
709709
);
710710

711+
// Force update if the MGS and ROT default mapping is not correct.
712+
static_assertions::const_assert_eq!(
713+
GwRotBootInfo::HIGHEST_KNOWN_VERSION - 1,
714+
SpVersionedRotBootInfo::HIGHEST_KNOWN_VERSION,
715+
);
716+
711717
// Map the MGS RotBootInfo 1-based versions to RoT 0-based versions.
712718
let rot_version = match version {
713719
// There is no version -1 in the RoT version number scheme.

0 commit comments

Comments
 (0)