1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 3 #ifndef __PSP_PLATFORM_ACCESS_H 4 #define __PSP_PLATFORM_ACCESS_H 5 6 #include <linux/psp.h> 7 8 enum psp_platform_access_msg { 9 PSP_CMD_NONE = 0x0, 10 }; 11 12 struct psp_req_buffer_hdr { 13 u32 payload_size; 14 u32 status; 15 } __packed; 16 17 struct psp_request { 18 struct psp_req_buffer_hdr header; 19 void *buf; 20 } __packed; 21 22 /** 23 * psp_send_platform_access_msg() - Send a message to control platform features 24 * 25 * This function is intended to be used by drivers outside of ccp to communicate 26 * with the platform. 27 * 28 * Returns: 29 * 0: success 30 * -%EBUSY: mailbox in recovery or in use 31 * -%ENODEV: driver not bound with PSP device 32 * -%ETIMEDOUT: request timed out 33 * -%EIO: unknown error (see kernel log) 34 */ 35 int psp_send_platform_access_msg(enum psp_platform_access_msg, struct psp_request *req); 36 37 /** 38 * psp_check_platform_access_status() - Checks whether platform features is ready 39 * 40 * This function is intended to be used by drivers outside of ccp to determine 41 * if platform features has initialized. 42 * 43 * Returns: 44 * 0 platform features is ready 45 * -%ENODEV platform features is not ready or present 46 */ 47 int psp_check_platform_access_status(void); 48 49 #endif /* __PSP_PLATFORM_ACCESS_H */ 50