diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2022-12-06 23:18:55 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2022-12-06 23:18:55 +0000 |
commit | 0958e9fc8102842b458ddf4e73e184edd65ff0ed (patch) | |
tree | 415eeb51c683c406c1e67c2a9eb11d2048717871 | |
parent | 85f2531ab6a40c4191078d4973fd30b12fc2c15d (diff) |
Add support for additional RTKit endpoint advertised by NVMe firmware that
comes with newer macOS releases.
ok patrick@
-rw-r--r-- | sys/arch/arm64/dev/rtkit.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/sys/arch/arm64/dev/rtkit.c b/sys/arch/arm64/dev/rtkit.c index 96741760d56..682dfa15a6f 100644 --- a/sys/arch/arm64/dev/rtkit.c +++ b/sys/arch/arm64/dev/rtkit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtkit.c,v 1.10 2022/12/03 13:42:23 kettenis Exp $ */ +/* $OpenBSD: rtkit.c,v 1.11 2022/12/06 23:18:54 kettenis Exp $ */ /* * Copyright (c) 2021 Mark Kettenis <kettenis@openbsd.org> * @@ -35,6 +35,8 @@ #define RTKIT_EP_SYSLOG 2 #define RTKIT_EP_DEBUG 3 #define RTKIT_EP_IOREPORT 4 +#define RTKIT_EP_OSLOG 8 +#define RTKIT_EP_UNKNOWN 10 #define RTKIT_MGMT_TYPE(x) (((x) >> 52) & 0xff) #define RTKIT_MGMT_TYPE_SHIFT 52 @@ -74,6 +76,11 @@ #define RTKIT_IOREPORT_UNKNOWN1 8 #define RTKIT_IOREPORT_UNKNOWN2 12 +#define RTKIT_OSLOG_TYPE(x) (((x) >> 56) & 0xff) +#define RTKIT_OSLOG_TYPE_SHIFT 56 +#define RTKIT_OSLOG_INIT 1ULL +#define RTKIT_OSLOG_ACK 3ULL + /* Versions we support. */ #define RTKIT_MINVER 11 #define RTKIT_MAXVER 12 @@ -228,10 +235,13 @@ rtkit_handle_mgmt(struct rtkit_state *state, struct aplmbox_msg *msg) case RTKIT_EP_SYSLOG: case RTKIT_EP_DEBUG: case RTKIT_EP_IOREPORT: + case RTKIT_EP_OSLOG: error = rtkit_start(state, endpoint); if (error) return error; break; + case RTKIT_EP_UNKNOWN: + break; default: printf("%s: skipping endpoint %d\n", __func__, endpoint); @@ -374,6 +384,28 @@ rtkit_handle_ioreport(struct rtkit_state *state, struct aplmbox_msg *msg) } int +rtkit_handle_oslog(struct rtkit_state *state, struct aplmbox_msg *msg) +{ + struct mbox_channel *mc = state->mc; + int error; + + switch (RTKIT_OSLOG_TYPE(msg->data0)) { + case RTKIT_OSLOG_INIT: + error = rtkit_send(mc, RTKIT_EP_OSLOG, + 0, RTKIT_OSLOG_ACK << RTKIT_OSLOG_TYPE_SHIFT); + if (error) + return error; + break; + default: + printf("%s: unhandled oslog event 0x%016llx\n", + __func__, msg->data0); + return EIO; + } + + return 0; +} + +int rtkit_poll(struct rtkit_state *state) { struct mbox_channel *mc = state->mc; @@ -409,6 +441,11 @@ rtkit_poll(struct rtkit_state *state) if (error) return error; break; + case RTKIT_EP_OSLOG: + error = rtkit_handle_oslog(state, &msg); + if (error) + return error; + break; default: if (endpoint >= 32 && endpoint < 64 && state->callback[endpoint - 32]) { |