1 /*
2  * Copyright (c) 2019, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef RPI3_MBOX_H
8 #define RPI3_MBOX_H
9 
10 #include <stdint.h>
11 
12 /* This struct must be aligned to 16 bytes */
13 typedef struct __packed __aligned(16) rpi3_mbox_request {
14 	uint32_t	size; /* Buffer size in bytes */
15 	uint32_t	code; /* Request/response code */
16 	uint32_t	tags[0];
17 } rpi3_mbox_request_t;
18 
19 #define RPI3_MBOX_BUFFER_SIZE		U(256)
20 
21 /* Constants to perform a request/check the status of a request. */
22 #define RPI3_MBOX_PROCESS_REQUEST	U(0x00000000)
23 #define RPI3_MBOX_REQUEST_SUCCESSFUL	U(0x80000000)
24 #define RPI3_MBOX_REQUEST_ERROR		U(0x80000001)
25 
26 /* Command constants */
27 #define RPI3_TAG_HARDWARE_GET_BOARD_REVISION	U(0x00010002)
28 #define RPI3_TAG_END				U(0x00000000)
29 
30 #define RPI3_TAG_REQUEST		U(0x00000000)
31 #define RPI3_TAG_IS_RESPONSE		U(0x80000000) /* Set if response */
32 #define RPI3_TAG_RESPONSE_LENGTH_MASK	U(0x7FFFFFFF)
33 
34 #define RPI3_CHANNEL_ARM_TO_VC		U(0x8)
35 #define RPI3_CHANNEL_MASK		U(0xF)
36 
37 void rpi3_vc_mailbox_request_send(rpi3_mbox_request_t *req, int req_size);
38 
39 #endif
40