1 /*
2  *  Copyright (C) 2016 Broadcom
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * Common header for Broadcom mailbox messages which is shared across
9  * Broadcom SoCs and Broadcom mailbox client drivers.
10  */
11 
12 #ifndef _LINUX_BRCM_MESSAGE_H_
13 #define _LINUX_BRCM_MESSAGE_H_
14 
15 #include <linux/scatterlist.h>
16 
17 enum brcm_message_type {
18 	BRCM_MESSAGE_UNKNOWN = 0,
19 	BRCM_MESSAGE_SPU,
20 	BRCM_MESSAGE_SBA,
21 	BRCM_MESSAGE_MAX,
22 };
23 
24 struct brcm_sba_command {
25 	u64 cmd;
26 #define BRCM_SBA_CMD_TYPE_A		BIT(0)
27 #define BRCM_SBA_CMD_TYPE_B		BIT(1)
28 #define BRCM_SBA_CMD_TYPE_C		BIT(2)
29 #define BRCM_SBA_CMD_HAS_RESP		BIT(3)
30 #define BRCM_SBA_CMD_HAS_OUTPUT		BIT(4)
31 	u64 flags;
32 	dma_addr_t input;
33 	size_t input_len;
34 	dma_addr_t resp;
35 	size_t resp_len;
36 	dma_addr_t output;
37 	size_t output_len;
38 };
39 
40 struct brcm_message {
41 	enum brcm_message_type type;
42 	union {
43 		struct {
44 			struct scatterlist *src;
45 			struct scatterlist *dst;
46 		} spu;
47 		struct {
48 			struct brcm_sba_command *cmds;
49 			unsigned int cmds_count;
50 		} sba;
51 	};
52 	void *ctx;
53 	int error;
54 };
55 
56 #endif /* _LINUX_BRCM_MESSAGE_H_ */
57