1 /* 2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef __PLAT_PARAMS_H__ 8 #define __PLAT_PARAMS_H__ 9 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 42 #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 52 /* param type */ 53 enum { 54 PARAM_NONE = 0, 55 PARAM_RESET, 56 PARAM_POWEROFF, 57 PARAM_SUSPEND_GPIO, 58 PARAM_SUSPEND_APIO, 59 }; 60 61 struct apio_info { 62 uint8_t apio1 : 1; 63 uint8_t apio2 : 1; 64 uint8_t apio3 : 1; 65 uint8_t apio4 : 1; 66 uint8_t apio5 : 1; 67 }; 68 69 struct gpio_info { 70 uint8_t polarity; 71 uint8_t direction; 72 uint8_t pull_mode; 73 uint32_t index; 74 }; 75 76 /* common header for all plat parameter type */ 77 struct bl31_plat_param { 78 uint64_t type; 79 void *next; 80 }; 81 82 struct bl31_gpio_param { 83 struct bl31_plat_param h; 84 struct gpio_info gpio; 85 }; 86 87 struct bl31_apio_param { 88 struct bl31_plat_param h; 89 struct apio_info apio; 90 }; 91 92 #endif /* __PLAT_PARAMS_H__ */ 93