Skip to content

Commit

Permalink
Reserve a portion of DCCM for future changes to PersistentData.
Browse files Browse the repository at this point in the history
* Reserved 44K.
* Left 32K for BSS. Current BSS size is 16K.

This resolves chipsalliance#1662.
  • Loading branch information
clundin25 committed Oct 28, 2024
1 parent f102017 commit 8a54c60
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions drivers/src/memory_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ pub const FUSE_LOG_ORG: u32 = 0x50005000;
pub const DPE_ORG: u32 = 0x50005400;
pub const PCR_RESET_COUNTER_ORG: u32 = 0x50006800;
pub const AUTH_MAN_IMAGE_METADATA_LIST_ORG: u32 = 0x50006C00;
pub const DATA_ORG: u32 = 0x50007000;
pub const RESERVED_MEMORY_ORG: u32 = 0x50007000;
pub const DATA_ORG: u32 = 0x50011000;

pub const STACK_ORG: u32 = 0x5001A000;
pub const ROM_STACK_ORG: u32 = 0x5001C000;
Expand Down Expand Up @@ -72,7 +73,8 @@ pub const FUSE_LOG_SIZE: u32 = 1024;
pub const DPE_SIZE: u32 = 5 * 1024;
pub const PCR_RESET_COUNTER_SIZE: u32 = 1024;
pub const AUTH_MAN_IMAGE_METADATA_LIST_MAX_SIZE: u32 = 1024;
pub const DATA_SIZE: u32 = 76 * 1024;
pub const RESERVED_MEMORY_SIZE: u32 = 40 * 1024;
pub const DATA_SIZE: u32 = 36 * 1024;
pub const STACK_SIZE: u32 = 22 * 1024;
pub const ROM_STACK_SIZE: u32 = 14 * 1024;
pub const ESTACK_SIZE: u32 = 1024;
Expand Down
12 changes: 10 additions & 2 deletions drivers/src/persistent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ pub struct PersistentData {
#[cfg(not(feature = "runtime"))]
pub auth_manifest_image_metadata_col:
[u8; memory_layout::AUTH_MAN_IMAGE_METADATA_LIST_MAX_SIZE as usize],

// Reserved memory for future objects.
// New objects should always source memory from this range.
// Taking memory from this reserve does NOT break hitless updates.
pub reserved_memory: [u8; memory_layout::RESERVED_MEMORY_SIZE as usize],
}
impl PersistentData {
pub fn assert_matches_layout() {
Expand Down Expand Up @@ -128,10 +133,13 @@ impl PersistentData {
addr_of!((*P).auth_manifest_image_metadata_col) as u32,
memory_layout::AUTH_MAN_IMAGE_METADATA_LIST_ORG
);
assert_eq!(
addr_of!((*P).reserved_memory) as u32,
memory_layout::RESERVED_MEMORY_ORG
);
assert_eq!(
P.add(1) as u32,
memory_layout::AUTH_MAN_IMAGE_METADATA_LIST_ORG
+ memory_layout::AUTH_MAN_IMAGE_METADATA_LIST_MAX_SIZE
memory_layout::RESERVED_MEMORY_ORG + memory_layout::RESERVED_MEMORY_SIZE
);
}
}
Expand Down

0 comments on commit 8a54c60

Please sign in to comment.