1 /* SPDX-License-Identifier: GPL-2.0-only OR MIT */ 2 /* 3 * Apple RTKit IPC library 4 * Copyright (C) The Asahi Linux Contributors 5 */ 6 7 #ifndef _APPLE_RTKIT_INTERAL_H 8 #define _APPLE_RTKIT_INTERAL_H 9 10 #include <linux/bitfield.h> 11 #include <linux/bitmap.h> 12 #include <linux/completion.h> 13 #include <linux/dma-mapping.h> 14 #include <linux/io.h> 15 #include <linux/kernel.h> 16 #include <linux/module.h> 17 #include <linux/slab.h> 18 #include <linux/soc/apple/rtkit.h> 19 #include <linux/workqueue.h> 20 #include "mailbox.h" 21 22 #define APPLE_RTKIT_APP_ENDPOINT_START 0x20 23 #define APPLE_RTKIT_MAX_ENDPOINTS 0x100 24 25 struct apple_rtkit { 26 void *cookie; 27 const struct apple_rtkit_ops *ops; 28 struct device *dev; 29 30 struct apple_mbox *mbox; 31 32 struct completion epmap_completion; 33 struct completion iop_pwr_ack_completion; 34 struct completion ap_pwr_ack_completion; 35 36 int boot_result; 37 int version; 38 39 unsigned int iop_power_state; 40 unsigned int ap_power_state; 41 bool crashed; 42 43 DECLARE_BITMAP(endpoints, APPLE_RTKIT_MAX_ENDPOINTS); 44 45 struct apple_rtkit_shmem ioreport_buffer; 46 struct apple_rtkit_shmem crashlog_buffer; 47 48 struct apple_rtkit_shmem syslog_buffer; 49 char *syslog_msg_buffer; 50 size_t syslog_n_entries; 51 size_t syslog_msg_size; 52 53 struct workqueue_struct *wq; 54 }; 55 56 void apple_rtkit_crashlog_dump(struct apple_rtkit *rtk, u8 *bfr, size_t size); 57 58 #endif 59