blob: 4b11e2a72dc1b5b4d113dda53586c2606581cb66 [file] [log] [blame]
Mark Kettenis72d73012022-01-22 20:38:14 +01001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2021 Mark Kettenis <kettenis@openbsd.org>
4 */
5
6#define APPLE_RTKIT_PWR_STATE_SLEEP 0x01
7#define APPLE_RTKIT_PWR_STATE_QUIESCED 0x10
8#define APPLE_RTKIT_PWR_STATE_ON 0x20
9
Janne Grunaue3a438f2022-06-14 09:09:07 +020010struct apple_rtkit_buffer {
11 void *buffer;
12 u64 dva;
13 size_t size;
14 bool is_mapped;
Hector Martin45a648b2025-04-20 13:58:07 +020015 int endpoint;
Janne Grunaue3a438f2022-06-14 09:09:07 +020016};
17
18typedef int (*apple_rtkit_shmem_setup)(void *cookie,
19 struct apple_rtkit_buffer *buf);
20typedef void (*apple_rtkit_shmem_destroy)(void *cookie,
21 struct apple_rtkit_buffer *buf);
22
23struct apple_rtkit;
24
25struct apple_rtkit *apple_rtkit_init(struct mbox_chan *chan, void *cookie,
26 apple_rtkit_shmem_setup shmem_setup,
27 apple_rtkit_shmem_destroy shmem_destroy);
28void apple_rtkit_free(struct apple_rtkit *rtk);
29int apple_rtkit_boot(struct apple_rtkit *rtk);
Hector Martinaa4e96b2025-04-20 13:58:03 +020030int apple_rtkit_set_ap_power(struct apple_rtkit *rtk, int pwrstate);
31int apple_rtkit_poll(struct apple_rtkit *rtk, ulong timeout);
Janne Grunaue3a438f2022-06-14 09:09:07 +020032int apple_rtkit_shutdown(struct apple_rtkit *rtk, int pwrstate);
Hector Martin7466b6d2025-04-20 13:58:05 +020033
34int apple_rtkit_helper_poll(struct udevice *dev, ulong timeout);