From d45108a6279875d862374d50c7a1d23385226ec2 Mon Sep 17 00:00:00 2001 From: Brent <1550934+brentkearney@users.noreply.github.com> Date: Wed, 2 Sep 2026 20:18:50 -0600 Subject: [PATCH] soc: apple: {sep,aop}: log the endpoints and services the firmware offers Both drivers discard the coprocessor's own description of what it offers, which makes the hardware harder to work with than it needs to be. sep.rs receives two messages per SEPOS endpoint on the discovery endpoint and drops both. Type 0 carries the endpoint's four-character name and number; the dev_info! that would print it in process_discover_msg() is commented out, along with the two constants it needs. Type 1 is what AppleSEPManager calls the "OOL advertisement": the endpoint's out-of-line buffer size bounds, in pages, packed into the data word. The driver has no constant for it, so it would fall through to the (also commented out) "Unknown discovery message type" warning. Nothing else in the driver exposes any of this, so the set of endpoints SEPOS actually starts has never been visible from Linux on any board. aop.rs matches announced EPIC service names against "aop-audio", "las" and "als" and returns silently for anything else, so services with no driver leave no trace either. Enable the SEP log, name and log the OOL advertisement so that the unknown type warning only fires for genuinely unknown messages, and add the AOP log. All of it fires once per boot during probe, alongside the RTKit syslog output these coprocessors already emit at the same level. dev_dbg! would be the tidier choice but is not usable here: Rust's dev_dbg! routes to Device::pr_dbg(), which is gated on cfg!(debug_assertions), so it compiles to nothing unless CONFIG_RUST_DEBUG_ASSERTIONS is set and it does not participate in dynamic debug. On an Apple MacBook Pro (16-inch, 2021), t6000/j316s, the SEP log yields: Got endpoint Ok("hibe") at 20 Endpoint 20 OOL buffer sizes 0x01010101 Got endpoint Ok("stac") at 24 Endpoint 24 OOL buffer sizes 0x02020202 Got endpoint Ok("cntl") at 0 Endpoint 0 OOL buffer sizes 0x00000000 Got endpoint Ok("xarm") at 19 Endpoint 19 OOL buffer sizes 0x02020202 Got endpoint Ok("xars") at 16 Endpoint 16 OOL buffer sizes 0x02020202 Got endpoint Ok("pnon") at 21 Endpoint 21 OOL buffer sizes 0x02020404 Got endpoint Ok("hdcp") at 14 Endpoint 14 OOL buffer sizes 0x01010101 and the AOP log, for a board whose AOP node only binds aop-audio and als: No driver for service Ok("wakehint") on endpoint 37 No driver for service Ok("accel") on endpoint 33 No driver for service Ok("gyro") on endpoint 34 No driver for service Ok("als-temp") on endpoint 43 No driver for service Ok("cma") on endpoint 42 No driver for service Ok("devmotion6") on endpoint 41 No driver for service Ok("SPUApp") on endpoint 32 No driver for service Ok("aop-voicetrigger") on endpoint 40 --- drivers/soc/apple/aop.rs | 6 ++++++ drivers/soc/apple/sep.rs | 23 ++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/soc/apple/aop.rs b/drivers/soc/apple/aop.rs index 972a94e28ed88b..8a53d21005740b 100644 --- a/drivers/soc/apple/aop.rs +++ b/drivers/soc/apple/aop.rs @@ -765,6 +765,12 @@ impl AopData { b"las" => c_str!("las"), b"als" => c_str!("als"), _ => { + dev_info!( + self.dev, + "No driver for service {:?} on endpoint {}", + core::str::from_utf8(name), + ep.index + ); return Ok(()); } }; diff --git a/drivers/soc/apple/sep.rs b/drivers/soc/apple/sep.rs index bcceb7ed4a6c41..94e9acdc99e224 100644 --- a/drivers/soc/apple/sep.rs +++ b/drivers/soc/apple/sep.rs @@ -46,14 +46,15 @@ const MSG_BOOT_TZ0_ACK1: u64 = 0x69; const MSG_BOOT_TZ0_ACK2: u64 = 0xD2; const MSG_BOOT_IMG4_ACK: u64 = 0x6A; const MSG_ADVERTISE_EP: u64 = 0; +const MSG_ADVERTISE_OOL: u64 = 1; const EP_DISCOVER: u64 = 0xFD; const EP_SHMEM: u64 = 0xFE; const EP_BOOT: u64 = 0xFF; const MSG_TYPE_SHIFT: u32 = 16; const MSG_TYPE_MASK: u64 = 0xFF; -//const MSG_PARAM_SHIFT: u32 = 24; -//const MSG_PARAM_MASK: u64 = 0xFF; +const MSG_PARAM_SHIFT: u32 = 24; +const MSG_PARAM_MASK: u64 = 0xFF; const MSG_EP_MASK: u64 = 0xFF; const MSG_DATA_SHIFT: u32 = 32; @@ -257,19 +258,27 @@ impl SepData { } fn process_discover_msg(&self, msg: Message) { let ty = (msg.msg0 >> MSG_TYPE_SHIFT) & MSG_TYPE_MASK; - //let data = (msg.msg0 >> MSG_DATA_SHIFT) as u32; - //let param = (msg.msg0 >> MSG_PARAM_SHIFT) & MSG_PARAM_MASK; + let data = (msg.msg0 >> MSG_DATA_SHIFT) as u32; + let param = (msg.msg0 >> MSG_PARAM_SHIFT) & MSG_PARAM_MASK; match ty { MSG_ADVERTISE_EP => { - /*dev_info!( + dev_info!( self.dev, "Got endpoint {:?} at {}", core::str::from_utf8(&data.to_be_bytes()), param - );*/ + ); + } + MSG_ADVERTISE_OOL => { + dev_info!( + self.dev, + "Endpoint {} OOL buffer sizes {:#010x}", + param, + data + ); } _ => { - //dev_warn!(self.dev, "Unknown discovery message type: {}", ty); + dev_warn!(self.dev, "Unknown discovery message type: {}", ty); } } }