Merge tag 'perf-tools-for-v6.4-3-2023-05-06' of git://git.kernel.org/pub/scm/linux...
[linux-block.git] / include / linux / psp-platform-access.h
CommitLineData
7ccc4f4e
ML
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
8enum psp_platform_access_msg {
9 PSP_CMD_NONE = 0x0,
440da737 10 PSP_I2C_REQ_BUS_CMD = 0x64,
7ccc4f4e
ML
11};
12
13struct psp_req_buffer_hdr {
14 u32 payload_size;
15 u32 status;
16} __packed;
17
18struct psp_request {
19 struct psp_req_buffer_hdr header;
20 void *buf;
21} __packed;
22
23/**
24 * psp_send_platform_access_msg() - Send a message to control platform features
25 *
26 * This function is intended to be used by drivers outside of ccp to communicate
27 * with the platform.
28 *
29 * Returns:
30 * 0: success
31 * -%EBUSY: mailbox in recovery or in use
32 * -%ENODEV: driver not bound with PSP device
33 * -%ETIMEDOUT: request timed out
34 * -%EIO: unknown error (see kernel log)
35 */
36int psp_send_platform_access_msg(enum psp_platform_access_msg, struct psp_request *req);
37
d5812571
ML
38/**
39 * psp_ring_platform_doorbell() - Ring platform doorbell
40 *
41 * This function is intended to be used by drivers outside of ccp to ring the
42 * platform doorbell with a message.
43 *
44 * Returns:
45 * 0: success
46 * -%EBUSY: mailbox in recovery or in use
47 * -%ENODEV: driver not bound with PSP device
48 * -%ETIMEDOUT: request timed out
a19c61b0 49 * -%EIO: error will be stored in result argument
d5812571 50 */
a19c61b0 51int psp_ring_platform_doorbell(int msg, u32 *result);
d5812571 52
7ccc4f4e
ML
53/**
54 * psp_check_platform_access_status() - Checks whether platform features is ready
55 *
56 * This function is intended to be used by drivers outside of ccp to determine
57 * if platform features has initialized.
58 *
59 * Returns:
60 * 0 platform features is ready
61 * -%ENODEV platform features is not ready or present
62 */
63int psp_check_platform_access_status(void);
64
65#endif /* __PSP_PLATFORM_ACCESS_H */