1 // 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 10 struct apple_rtkit_buffer { 11 void *buffer; 12 u64 dva; 13 size_t size; 14 bool is_mapped; 15 int endpoint; 16 }; 17 18 typedef int (*apple_rtkit_shmem_setup)(void *cookie, 19 struct apple_rtkit_buffer *buf); 20 typedef void (*apple_rtkit_shmem_destroy)(void *cookie, 21 struct apple_rtkit_buffer *buf); 22 23 struct apple_rtkit; 24 25 struct 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); 28 void apple_rtkit_free(struct apple_rtkit *rtk); 29 int apple_rtkit_boot(struct apple_rtkit *rtk); 30 int apple_rtkit_set_ap_power(struct apple_rtkit *rtk, int pwrstate); 31 int apple_rtkit_poll(struct apple_rtkit *rtk, ulong timeout); 32 int apple_rtkit_shutdown(struct apple_rtkit *rtk, int pwrstate); 33 34 int apple_rtkit_helper_poll(struct udevice *dev, ulong timeout); 35