blob: f02e8b02fba5a90b58eef19f83c7cad53a73b592 [file] [log] [blame]
Sridhar Parasuram58b1f382015-02-05 09:55:37 -08001/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of The Linux Fundation, Inc. nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30#ifndef __RPM_IPC_H
31#define __RPM_IPC_H
32
33#include <arch/defines.h>
34#include <stdint.h>
35#include <sys/types.h>
36
37#define RPM_REQ_MAGIC 0x00716572
38#define RPM_CMD_MAGIC 0x00646d63
39#define REQ_MSG_LENGTH 0x14
40#define CMD_MSG_LENGTH 0x08
41#define ACK_MSG_LENGTH 0x0C
42
43typedef enum
44{
45 RPM_REQUEST_TYPE,
46 RPM_CMD_TYPE,
47 RPM_SUCCESS_REQ_ACK,
48 RPM_SUCCESS_CMD_ACK,
49 RPM_ERROR_ACK,
50}msg_type;
51
52enum
53{
54 RESOURCETYPE,
55 RESOURCEID,
56 KVP_KEY,
57 KVP_LENGTH,
58 KVP_VALUE,
59};
60
61typedef struct
62{
63 uint32_t type;
64 uint32_t len;
65} rpm_gen_hdr;
66
67typedef struct
68{
69 uint32_t key;
70 uint32_t len;
71 uint32_t val;
72} kvp_data;
73
74typedef struct
75{
76 uint32_t id;
77 uint32_t set;
78 uint32_t resourceType;
79 uint32_t resourceId;
80 uint32_t dataLength;
81}rpm_req_hdr;
82
83typedef struct
84{
85 rpm_gen_hdr hdr;
86 rpm_req_hdr req_hdr;
87 kvp_data *data;
88} rpm_req;
89
90typedef struct
91{
92 rpm_gen_hdr hdr;
93 kvp_data *data;
94} rpm_cmd;
95
96typedef rpm_cmd rpm_ack_msg;
97int rpm_send_data(uint32_t *data, uint32_t len, msg_type type);
98void rpm_clk_enable(uint32_t *data, uint32_t len);
99
100void fill_kvp_object(kvp_data **kdata, uint32_t *data, uint32_t len);
101void free_kvp_object(kvp_data **kdata);
102#endif