Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
97 changes: 97 additions & 0 deletions arch/arm64/boot/dts/apple/t8142-j813.dts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@
aliases {
wifi0 = &n1_alpha;
bluetooth0 = &n1_beta;
/*
* The loader finds the SEP through this alias: it reserves SEPFW
* and copies the boot's local-policy and iBoot manifests onto
* the node.
*/
sep = &sep;
};
};

Expand Down Expand Up @@ -171,3 +177,94 @@
};

/* Unexposed chassis port instances remain described and disabled. */

/*
* Secure Enclave and the Touch ID sensor. All values are from the J813 ADT
* (macOS 27.0) and are the same as J815's:
* - sep: iop-sep,ascwrap-v6 at 0x30a600000 (0x88000), sepfw-booted, so
* apple_sep warm-attaches; ASC mailbox at +0x8000, AIC 445-448.
* - dart-sep: t8110 at 0x308b80000, irq 455; vm-base-0 0x10000004000,
* vm-size-0 0xffff0000.
* - spi2 at 0x3a5108000, irq 1241; PMGR device SPI2 at +0x440, parent SPI_P.
* - mesa: "biosensor,mesa", sensor-id 0x3356, 8 MHz, CS0; power
* function-mesa_pwr = NUB GPIO pin 36; data-ready interrupt on AP GPIO
* pin 200.
* The SEP and its DART stay disabled here: apple_sep enables them at module
* init (drivers/soc/apple/dt.rs).
*/
&pmgr {
ps_spi2: power-controller@440 {
compatible = "apple,t8142-pmgr-pwrstate", "apple,t8103-pmgr-pwrstate";
reg = <0x440 4>;
#power-domain-cells = <0>;
#reset-cells = <0>;
power-domains = <&ps_spi_p>;
label = "spi2";
};
};

&{/soc} {
sep: sep@30a600000 {
compatible = "apple,sep";
reg = <0x3 0x0a600000 0x0 0x88000>;
mboxes = <&sep_mbox>;
mbox-names = "mbox";
iommus = <&sep_dart 0>;
status = "disabled";
};

sep_mbox: mbox@30a608000 {
compatible = "apple,t8142-asc-mailbox", "apple,asc-mailbox-v4";
reg = <0x3 0x0a608000 0x0 0x4000>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 445 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 446 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 447 IRQ_TYPE_LEVEL_HIGH>,
<AIC_IRQ 448 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "send-empty", "send-not-empty",
"recv-empty", "recv-not-empty";
#mbox-cells = <0>;
status = "okay";
};

spi2: spi@3a5108000 {
compatible = "apple,t8142-spi", "apple,t8103-spi";
reg = <0x3 0xa5108000 0x0 0x4000>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 1241 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clkref>;
power-domains = <&ps_spi2>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

mesa: fingerprint@0 {
compatible = "apple,mesa-fingerprint";
reg = <0>;
spi-max-frequency = <8000000>;
spi-cpol;
spi-cs-setup-delay-ns = <20>;
spi-cs-hold-delay-ns = <20>;
enable-gpios = <&pinctrl_nub 36 GPIO_ACTIVE_HIGH>;
interrupt-parent = <&pinctrl_ap>;
interrupts = <200 IRQ_TYPE_EDGE_RISING>;
/* Per-device files, built from the Mac's own factory records. */
firmware-name = "apple/mesacal-j813.bin", "apple/msrk-j813.bin";
status = "okay";
};
};
};

&sep_dart {
apple,dma-range = /bits/ 64 <0x10000004000 0xffff0000>;
apple,dma-offset = /bits/ 64 <0x0>;
};

/* Expose the sensor's two pins next to the ones sound uses. */
&pinctrl_ap {
gpio-reserved-ranges = <0 100>, <101 49>, <152 48>, <201 23>;
};

&pinctrl_nub {
gpio-reserved-ranges = <0 18>, <19 17>, <37 3>;
};
27 changes: 25 additions & 2 deletions drivers/soc/apple/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,9 @@ fn select(
if has(b"apple,t8132") && (has(b"apple,j713") || has(b"apple,j715")) {
return Ok(&T8132);
}
// Only the J815, whose ADT was read; the J813's sensor bus is unchecked.
if has(b"apple,t8142") && has(b"apple,j815") {
// The J815 and the J813, whose ADTs were read (macOS 27.0 stub firmware):
// the J813's SEP, its DART, spi2 and the Mesa node carry the J815's values.
if has(b"apple,t8142") && (has(b"apple,j815") || has(b"apple,j813")) {
return Ok(&T8142);
}
Err(ENODEV)
Expand All @@ -722,6 +723,28 @@ fn select(
mod tests {
use super::*;

#[test]
fn t8142_sensor_boards_require_the_matching_soc() {
let cases: [(&[u8], &[u8], bool); 7] = [
(b"apple,t8142", b"apple,j813", true),
(b"apple,t8142", b"apple,j815", true),
(b"apple,t8142", b"apple,j814", false),
(b"apple,t8142", b"", false),
(b"", b"apple,j813", false),
(b"apple,t8132", b"apple,j813", false),
(b"apple,t6050", b"apple,j815", false),
];
for (soc, board, admitted) in cases {
let has = |c: &[u8]| c == soc || c == board;
let selected = select(&has, &|| &T6020);
if admitted {
assert!(matches!(selected, Ok(profile) if core::ptr::eq(profile, &T8142)));
} else {
assert!(selected.is_err());
}
}
}

#[test]
fn old_firmware_uses_the_legacy_key_store() {
assert!(t6020_uses_sepos13(Some(b"iBoot-13822.79.1\0")));
Expand Down
Loading