Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions drivers/gpu/drm/asahi/fwid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,25 @@ mod tests {
assert!(measured(build.images, 0x13c000, entropy, digest).is_none());
}
}
// The first 26B123 image is the shipped one, with what iBoot fills zeroed.
let filled = crate::hw::t6041::BOOT_FILLED_26B123;
let shipped = &builds[3].images[0];
assert_eq!(shipped.boot_filled, filled);
assert!(builds[3].images[1..].iter().all(|image| image.boot_filled.is_empty()));
let [gkts, ecap] = shipped.entropy[0];
assert_eq!(filled[..2], [(0x224, 4), (0x23c, 8)]);
// One value per parameter record, each after its 8-byte tag and length, back to back.
let mut next = gkts;
for &(off, len) in &filled[2..filled.len() - 4] {
assert_eq!(off, next + 8);
next = off + len;
}
assert!(filled.contains(&(gkts + 8, 8)) && filled.contains(&(ecap + 8, 8)));
// Then each tunable table's count byte and body.
for (i, table) in [next, next + 0x350].into_iter().enumerate() {
let at = filled.len() - 4 + 2 * i;
assert_eq!(filled[at..at + 2], [(table + 3, 1), (table + 4, 0x34c)]);
}
for image in builds[3].images {
let digest = image.text_sha256;
let found = lookup(builds[3].images, image.text_size, image.data_size, |_| {
Expand Down Expand Up @@ -596,8 +615,11 @@ mod tests {
assert_eq!(g83_32.windows.len(), map.len());
let b123_40 = builds[3].config.unwrap();
assert_eq!(b123_40.core_layout.cores, Some((4, 40)));
// Both restart the GPU after a real sleep; without it every deep sleep is refused.
assert!(b123_40.sleep_restart);
let b123_32 = builds[4].config.unwrap();
assert_eq!(b123_32.core_layout.cores, Some((4, 32)));
assert!(b123_32.sleep_restart);
assert_eq!(b123_32.windows.len(), map.len());
}

Expand Down
82 changes: 78 additions & 4 deletions drivers/gpu/drm/asahi/hw/t6041.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ pub(super) const BASE: Config = Config {
};

/// The 40-core M4 Max. 25F84 runs this configuration; 25G83 runs [`CONFIG_25G83`], 26B123 runs
/// [`BASE`], and a 32-core part runs [`super::t6041_25g83::CONFIG`] on both 25G83 and 26B123.
/// [`CONFIG_26B123`], and a 32-core part runs [`super::t6041_25g83::CONFIG`] on both 25G83 and
/// 26B123.
pub(crate) const CONFIG: Config = Config {
firmware: fw::variant::Firmware::Identified(&BUILDS),
..BASE
Expand All @@ -83,7 +84,7 @@ const BUILDS: [fw::variant::Build; 5] = [
..BUILD_25G83_32CORE
},
fw::variant::Build {
config: Some(&BASE),
config: Some(&CONFIG_26B123),
..BUILD_26B123
},
fw::variant::Build {
Expand All @@ -96,9 +97,23 @@ const BUILDS: [fw::variant::Build; 5] = [
pub(super) const BUILD_26B123: fw::variant::Build = fw::variant::Build {
os_version: [27, 2, 0],
name: "macOS 27.2 (26B123, iBoot mBoot-20457.41.3)",
// iBoot fills part of the loaded TEXT for each Mac, so each admitted image is a
// measurement.
images: &[
// Build b000 (G16C B1) of armfw_g16c.im4p, with every range iBoot fills zeroed
// (`BOOT_FILLED_26B123`): the digest of the shipped image with the same ranges zeroed,
// which any Mac that loads it has.
crate::fwid::FirmwareBuild {
name: "Apple GFX 26B123 for T6041 (build b000, iBoot-filled ranges zeroed)",
text_size: 0x64000,
data_size: 0xcc000,
entropy: &[[0x5d88c, 0x5d96f]],
boot_filled: BOOT_FILLED_26B123,
text_sha256: [
0x9a, 0x56, 0x06, 0x13, 0xa5, 0xc7, 0x4d, 0x8f, 0x0a, 0x54, 0xda, 0x43, 0xce, 0x5e,
0x06, 0x89, 0x68, 0x1d, 0x76, 0xbe, 0x41, 0x18, 0xb3, 0xde, 0x59, 0x12, 0xc3, 0x55,
0x4d, 0x9b, 0xed, 0x6f,
],
},
// The per-Mac measurements below stay until a Mac has booted with only the entry above.
// 40-core J616C.
crate::fwid::FirmwareBuild {
name: "Apple GFX 26B123 for T6041 (normalized loaded image)",
Expand Down Expand Up @@ -135,6 +150,58 @@ pub(super) const BUILD_26B123: fw::variant::Build = fw::variant::Build {
config: None,
};

/// What iBoot writes into the 26B123 build b000 TEXT it loads, in TEXT order: the same header
/// words, 39 boot parameter records and two tunable tables as on T8132
/// (`g16::hw::t8132::BOOT_FILLED_26B123_B000`), the records from 0x5d88c and the tables from
/// 0x5dabd.
pub(crate) const BOOT_FILLED_26B123: &[(u32, u32)] = &[
(0x224, 4),
(0x23c, 8),
(0x5d894, 8),
(0x5d8a4, 8),
(0x5d8b4, 8),
(0x5d8c4, 8),
(0x5d8d4, 8),
(0x5d8e4, 8),
(0x5d8f4, 8),
(0x5d904, 4),
(0x5d910, 1),
(0x5d919, 8),
(0x5d929, 8),
(0x5d939, 4),
(0x5d945, 8),
(0x5d955, 1),
(0x5d95e, 1),
(0x5d967, 8),
(0x5d977, 8),
(0x5d987, 8),
(0x5d997, 8),
(0x5d9a7, 8),
(0x5d9b7, 8),
(0x5d9c7, 8),
(0x5d9d7, 8),
(0x5d9e7, 8),
(0x5d9f7, 8),
(0x5da07, 8),
(0x5da17, 8),
(0x5da27, 4),
(0x5da33, 8),
(0x5da43, 4),
(0x5da4f, 4),
(0x5da5b, 8),
(0x5da6b, 8),
(0x5da7b, 1),
(0x5da84, 8),
(0x5da94, 8),
(0x5daa4, 4),
(0x5dab0, 1),
(0x5dab9, 4),
(0x5dac0, 1),
(0x5dac1, 0x34c),
(0x5de10, 1),
(0x5de11, 0x34c),
];

const BUILD_25F84: fw::variant::Build = fw::variant::Build {
os_version: [26, 5, 2],
name: "macOS 26.5.2 (25F84, iBoot mBoot-18000.121.3)",
Expand Down Expand Up @@ -258,6 +325,13 @@ const CONFIG_25G83: Config = Config {
..BASE
};

/// The 40-core M4 Max on 26B123: the 25F84 configuration.
const CONFIG_26B123: Config = Config {
// The GPU is restarted after a real sleep, as on the 32-core part.
sleep_restart: true,
..BASE
};

pub(crate) const CHIP_ID: u32 = 0x6041;

pub(crate) const REGISTER_WINDOWS: [RegisterWindow; 25] = [
Expand Down
Loading