From 509bf08c0a04741dee54c5c9602114c194e01516 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 8 Jun 2026 23:47:19 +0800 Subject: [PATCH] make application slot range explicit also start tracking application slot usage in dabao target --- libs/bao1x-api/src/offsets/baosec.rs | 1 + libs/bao1x-api/src/offsets/common.rs | 3 +++ libs/bao1x-api/src/offsets/dabao.rs | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/libs/bao1x-api/src/offsets/baosec.rs b/libs/bao1x-api/src/offsets/baosec.rs index c85dd2fd7..e5781e475 100644 --- a/libs/bao1x-api/src/offsets/baosec.rs +++ b/libs/bao1x-api/src/offsets/baosec.rs @@ -134,6 +134,7 @@ pub const THE_FLAG_1: SlotIndex = SlotIndex::Data(260, PartitionAccess::Fw0, RwP // NOTE: COLLATERAL is from 261..265, but it is in the "common" page // [384..=1919] are unused and available for third party use +pub const APPLICATION: SlotIndex = crate::offsets::APPLICATION; pub const NUISANCE_KEYS_1: SlotIndex = SlotIndex::DataRange(1920..2048, PartitionAccess::Fw0, RwPerms::ReadWrite); diff --git a/libs/bao1x-api/src/offsets/common.rs b/libs/bao1x-api/src/offsets/common.rs index 9344e1d2d..5f5bdf3a6 100644 --- a/libs/bao1x-api/src/offsets/common.rs +++ b/libs/bao1x-api/src/offsets/common.rs @@ -300,3 +300,6 @@ pub const CLOCK_SCRAMBLE_PARAMS: SlotIndex = SlotIndex::Data(272, PartitionAcces // - "end" bits [47:40] == 0x08 // // Furthermore, IFR slot 0x14, bits [127:120] should have 0x3a in it to enforce write disable on boot0 + +/// Application slots are available to end users for use, and not reserved for OS or security +pub const APPLICATION: SlotIndex = SlotIndex::DataRange(384..1920, PartitionAccess::Open, RwPerms::ReadWrite); diff --git a/libs/bao1x-api/src/offsets/dabao.rs b/libs/bao1x-api/src/offsets/dabao.rs index 9091fc629..f9f6046b7 100644 --- a/libs/bao1x-api/src/offsets/dabao.rs +++ b/libs/bao1x-api/src/offsets/dabao.rs @@ -54,3 +54,13 @@ pub use crate::baosec::{ pub const KEY_SLOTS: [SlotIndex; 6] = [THE_FLAG_1, ROOT_SEED, RMA_KEY, NUISANCE_KEYS_0, NUISANCE_KEYS_1, CHAFF_KEYS]; + +// [384..=1919] are unused and available for third party use +pub const APPLICATION: SlotIndex = crate::offsets::APPLICATION; + +// offsets into the application slot range for storing BIO config +pub const APP_BIO_CLK_INDEX: usize = 0; +pub const APP_BIO_PINS_INDEX: usize = 1; +pub const APP_BIO_CODE_VALID: usize = 2; +// total length is 0xf00 = 120 slots +pub const APP_BIO_CODE_INDICES: core::ops::Range = 3..123;