blob: 1ec02f55ef629666ce0d516b821d317bdfeb3fd5 [file] [log] [blame]
Caesar Wang3e3c5b02016-05-25 19:03:04 +08001/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Caesar Wang3e3c5b02016-05-25 19:03:04 +08005 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef PLAT_PARAMS_H
8#define PLAT_PARAMS_H
Caesar Wang3e3c5b02016-05-25 19:03:04 +08009
10#include <stdint.h>
11
12/*
13 * We defined several plat parameter structs for BL2 to pass platform related
14 * parameters to Rockchip BL31 platform code. All plat parameters start with
15 * a common header, which has a type field to indicate the parameter type, and
16 * a next pointer points to next parameter. If the parameter is the last one in
17 * the list, next pointer will points to NULL. After the header comes the
18 * variable-sized members that describe the parameter. The picture below shows
19 * how the parameters are kept in memory.
20 *
21 * head of list ---> +----------------+ --+
22 * | type | |
23 * +----------------+ |--> struct bl31_plat_param
24 * +----| next | |
25 * | +----------------+ --+
26 * | | parameter data |
27 * | +----------------+
28 * |
29 * +--> +----------------+ --+
30 * | type | |
31 * +----------------+ |--> struct bl31_plat_param
32 * NULL <---| next | |
33 * +----------------+ --+
34 * | parameter data |
35 * +----------------+
36 *
37 * Note: The SCTLR_EL3.A bit (Alignment fault check enable) of ARM TF is set,
38 * so be sure each parameter struct starts on 64-bit aligned address. If not,
39 * alignment fault will occur during accessing its data member.
40 */
41
Caesar Wangef180072016-09-10 02:43:15 +080042#define BL31_GPIO_DIR_OUT 0
43#define BL31_GPIO_DIR_IN 1
44
45#define BL31_GPIO_LEVEL_LOW 0
46#define BL31_GPIO_LEVEL_HIGH 1
47
48#define BL31_GPIO_PULL_NONE 0
49#define BL31_GPIO_PULL_UP 1
50#define BL31_GPIO_PULL_DOWN 2
51
Caesar Wang3e3c5b02016-05-25 19:03:04 +080052/* param type */
53enum {
54 PARAM_NONE = 0,
55 PARAM_RESET,
56 PARAM_POWEROFF,
Caesar Wangef180072016-09-10 02:43:15 +080057 PARAM_SUSPEND_GPIO,
Caesar Wang5045a1c2016-09-10 02:47:53 +080058 PARAM_SUSPEND_APIO,
Julius Wernerc7087782017-06-09 15:22:44 -070059 PARAM_COREBOOT_TABLE,
Caesar Wang3e3c5b02016-05-25 19:03:04 +080060};
61
Caesar Wang5045a1c2016-09-10 02:47:53 +080062struct apio_info {
63 uint8_t apio1 : 1;
64 uint8_t apio2 : 1;
65 uint8_t apio3 : 1;
66 uint8_t apio4 : 1;
67 uint8_t apio5 : 1;
68};
69
Caesar Wang3e3c5b02016-05-25 19:03:04 +080070struct gpio_info {
71 uint8_t polarity;
72 uint8_t direction;
73 uint8_t pull_mode;
74 uint32_t index;
75};
76
77/* common header for all plat parameter type */
78struct bl31_plat_param {
79 uint64_t type;
80 void *next;
81};
82
83struct bl31_gpio_param {
84 struct bl31_plat_param h;
85 struct gpio_info gpio;
86};
87
Caesar Wang5045a1c2016-09-10 02:47:53 +080088struct bl31_apio_param {
89 struct bl31_plat_param h;
90 struct apio_info apio;
91};
92
Julius Wernerc7087782017-06-09 15:22:44 -070093struct bl31_u64_param {
94 struct bl31_plat_param h;
95 uint64_t value;
96};
97
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000098#endif /* PLAT_PARAMS_H */