/* SPDX-License-Identifier: GPL-2.0-only */1/*2* PCC (Platform Communications Channel) methods3*/45#ifndef _PCC_H6#define _PCC_H78#include <linux/mailbox_controller.h>9#include <linux/mailbox_client.h>1011struct pcc_mbox_chan {12struct mbox_chan *mchan;13u64 shmem_base_addr;14void __iomem *shmem;15u64 shmem_size;16u32 latency;17u32 max_access_rate;18u16 min_turnaround_time;1920/* Set to true to indicate that the mailbox should manage21* writing the dat to the shared buffer. This differs from22* the case where the drivesr are writing to the buffer and23* using send_data only to ring the doorbell. If this flag24* is set, then the void * data parameter of send_data must25* point to a kernel-memory buffer formatted in accordance with26* the PCC specification.27*28* The active buffer management will include reading the29* notify_on_completion flag, and will then30* call mbox_chan_txdone when the acknowledgment interrupt is31* received.32*/33bool manage_writes;3435/* Optional callback that allows the driver36* to allocate the memory used for receiving37* messages. The return value is the location38* inside the buffer where the mailbox should write the data.39*/40void *(*rx_alloc)(struct mbox_client *cl, int size);41};4243struct pcc_header {44u32 signature;45u32 flags;46u32 length;47u32 command;48};4950/* Generic Communications Channel Shared Memory Region */51#define PCC_SIGNATURE 0x5043430052/* Generic Communications Channel Command Field */53#define PCC_CMD_GENERATE_DB_INTR BIT(15)54/* Generic Communications Channel Status Field */55#define PCC_STATUS_CMD_COMPLETE BIT(0)56#define PCC_STATUS_SCI_DOORBELL BIT(1)57#define PCC_STATUS_ERROR BIT(2)58#define PCC_STATUS_PLATFORM_NOTIFY BIT(3)59/* Initiator Responder Communications Channel Flags */60#define PCC_CMD_COMPLETION_NOTIFY BIT(0)6162#define MAX_PCC_SUBSPACES 2566364#ifdef CONFIG_PCC65extern struct pcc_mbox_chan *66pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id);67extern void pcc_mbox_free_channel(struct pcc_mbox_chan *chan);68#else69static inline struct pcc_mbox_chan *70pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id)71{72return ERR_PTR(-ENODEV);73}74static inline void pcc_mbox_free_channel(struct pcc_mbox_chan *chan) { }75#endif7677#endif /* _PCC_H */787980