Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | /* |
Soby Mathew | 9fe8804 | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 2 | * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved. |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Dan Handley | 2bd4ef2 | 2014-04-09 13:14:54 +0100 | [diff] [blame] | 7 | #include <arch.h> |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 8 | #include <arch_helpers.h> |
Dan Handley | 2bd4ef2 | 2014-04-09 13:14:54 +0100 | [diff] [blame] | 9 | #include <assert.h> |
Juan Castillo | a08a5e7 | 2015-05-19 11:54:12 +0100 | [diff] [blame] | 10 | #include <auth_mod.h> |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 11 | #include <bl_common.h> |
Dan Handley | 714a0d2 | 2014-04-09 13:13:04 +0100 | [diff] [blame] | 12 | #include <debug.h> |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 13 | #include <errno.h> |
Dan Handley | 2bd4ef2 | 2014-04-09 13:14:54 +0100 | [diff] [blame] | 14 | #include <io_storage.h> |
| 15 | #include <platform.h> |
Juan Castillo | 97dbcf1 | 2015-08-17 10:43:27 +0100 | [diff] [blame] | 16 | #include <string.h> |
Sandrine Bailleux | 4ec7e2d | 2016-07-12 09:12:24 +0100 | [diff] [blame] | 17 | #include <utils.h> |
Antonio Nino Diaz | 4ef91f1 | 2017-02-20 14:22:22 +0000 | [diff] [blame] | 18 | #include <xlat_tables_defs.h> |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 19 | |
Soby Mathew | 9fe8804 | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 20 | #if TRUSTED_BOARD_BOOT |
| 21 | # ifdef DYN_DISABLE_AUTH |
| 22 | static int disable_auth; |
| 23 | |
| 24 | /****************************************************************************** |
| 25 | * API to dynamically disable authentication. Only meant for development |
| 26 | * systems. This is only invoked if DYN_DISABLE_AUTH is defined. This |
| 27 | * capability is restricted to LOAD_IMAGE_V2. |
| 28 | *****************************************************************************/ |
| 29 | void dyn_disable_auth(void) |
| 30 | { |
| 31 | INFO("Disabling authentication of images dynamically\n"); |
| 32 | disable_auth = 1; |
| 33 | } |
| 34 | # endif /* DYN_DISABLE_AUTH */ |
| 35 | |
| 36 | /****************************************************************************** |
| 37 | * Function to determine whether the authentication is disabled dynamically. |
| 38 | *****************************************************************************/ |
| 39 | static int dyn_is_auth_disabled(void) |
| 40 | { |
| 41 | # ifdef DYN_DISABLE_AUTH |
| 42 | return disable_auth; |
| 43 | # else |
| 44 | return 0; |
| 45 | # endif |
| 46 | } |
| 47 | #endif /* TRUSTED_BOARD_BOOT */ |
| 48 | |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 49 | uintptr_t page_align(uintptr_t value, unsigned dir) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 50 | { |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 51 | /* Round up the limit to the next page boundary */ |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 52 | if (value & (PAGE_SIZE - 1)) { |
| 53 | value &= ~(PAGE_SIZE - 1); |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 54 | if (dir == UP) |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 55 | value += PAGE_SIZE; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | return value; |
| 59 | } |
| 60 | |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 61 | /****************************************************************************** |
| 62 | * Determine whether the memory region delimited by 'addr' and 'size' is free, |
| 63 | * given the extents of free memory. |
Sandrine Bailleux | 4ec7e2d | 2016-07-12 09:12:24 +0100 | [diff] [blame] | 64 | * Return 1 if it is free, 0 if it is not free or if the input values are |
| 65 | * invalid. |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 66 | *****************************************************************************/ |
Sandrine Bailleux | b0e529b | 2016-11-08 14:27:10 +0000 | [diff] [blame] | 67 | int is_mem_free(uintptr_t free_base, size_t free_size, |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 68 | uintptr_t addr, size_t size) |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 69 | { |
Sandrine Bailleux | 4ec7e2d | 2016-07-12 09:12:24 +0100 | [diff] [blame] | 70 | uintptr_t free_end, requested_end; |
| 71 | |
| 72 | /* |
| 73 | * Handle corner cases first. |
| 74 | * |
| 75 | * The order of the 2 tests is important, because if there's no space |
| 76 | * left (i.e. free_size == 0) but we don't ask for any memory |
| 77 | * (i.e. size == 0) then we should report that the memory is free. |
| 78 | */ |
| 79 | if (size == 0) |
| 80 | return 1; /* A zero-byte region is always free */ |
| 81 | if (free_size == 0) |
| 82 | return 0; |
| 83 | |
| 84 | /* |
| 85 | * Check that the end addresses don't overflow. |
| 86 | * If they do, consider that this memory region is not free, as this |
| 87 | * is an invalid scenario. |
| 88 | */ |
| 89 | if (check_uptr_overflow(free_base, free_size - 1)) |
| 90 | return 0; |
| 91 | free_end = free_base + (free_size - 1); |
| 92 | |
| 93 | if (check_uptr_overflow(addr, size - 1)) |
| 94 | return 0; |
| 95 | requested_end = addr + (size - 1); |
| 96 | |
| 97 | /* |
| 98 | * Finally, check that the requested memory region lies within the free |
| 99 | * region. |
| 100 | */ |
| 101 | return (addr >= free_base) && (requested_end <= free_end); |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 102 | } |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 103 | |
Sandrine Bailleux | b0e529b | 2016-11-08 14:27:10 +0000 | [diff] [blame] | 104 | #if !LOAD_IMAGE_V2 |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 105 | /****************************************************************************** |
| 106 | * Inside a given memory region, determine whether a sub-region of memory is |
| 107 | * closer from the top or the bottom of the encompassing region. Return the |
| 108 | * size of the smallest chunk of free memory surrounding the sub-region in |
| 109 | * 'small_chunk_size'. |
| 110 | *****************************************************************************/ |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 111 | static unsigned int choose_mem_pos(uintptr_t mem_start, uintptr_t mem_end, |
| 112 | uintptr_t submem_start, uintptr_t submem_end, |
| 113 | size_t *small_chunk_size) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 114 | { |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 115 | size_t top_chunk_size, bottom_chunk_size; |
| 116 | |
| 117 | assert(mem_start <= submem_start); |
| 118 | assert(submem_start <= submem_end); |
| 119 | assert(submem_end <= mem_end); |
| 120 | assert(small_chunk_size != NULL); |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 121 | |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 122 | top_chunk_size = mem_end - submem_end; |
| 123 | bottom_chunk_size = submem_start - mem_start; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 124 | |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 125 | if (top_chunk_size < bottom_chunk_size) { |
| 126 | *small_chunk_size = top_chunk_size; |
| 127 | return TOP; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 128 | } else { |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 129 | *small_chunk_size = bottom_chunk_size; |
| 130 | return BOTTOM; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 131 | } |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 132 | } |
| 133 | |
| 134 | /****************************************************************************** |
| 135 | * Reserve the memory region delimited by 'addr' and 'size'. The extents of free |
| 136 | * memory are passed in 'free_base' and 'free_size' and they will be updated to |
| 137 | * reflect the memory usage. |
Sandrine Bailleux | 4ec7e2d | 2016-07-12 09:12:24 +0100 | [diff] [blame] | 138 | * The caller must ensure the memory to reserve is free and that the addresses |
| 139 | * and sizes passed in arguments are sane. |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 140 | *****************************************************************************/ |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 141 | void reserve_mem(uintptr_t *free_base, size_t *free_size, |
| 142 | uintptr_t addr, size_t size) |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 143 | { |
| 144 | size_t discard_size; |
| 145 | size_t reserved_size; |
| 146 | unsigned int pos; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 147 | |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 148 | assert(free_base != NULL); |
| 149 | assert(free_size != NULL); |
| 150 | assert(is_mem_free(*free_base, *free_size, addr, size)); |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 151 | |
Sandrine Bailleux | 4ec7e2d | 2016-07-12 09:12:24 +0100 | [diff] [blame] | 152 | if (size == 0) { |
| 153 | WARN("Nothing to allocate, requested size is zero\n"); |
| 154 | return; |
| 155 | } |
| 156 | |
| 157 | pos = choose_mem_pos(*free_base, *free_base + (*free_size - 1), |
| 158 | addr, addr + (size - 1), |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 159 | &discard_size); |
| 160 | |
| 161 | reserved_size = size + discard_size; |
| 162 | *free_size -= reserved_size; |
| 163 | |
| 164 | if (pos == BOTTOM) |
| 165 | *free_base = addr + size; |
| 166 | |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 167 | VERBOSE("Reserved 0x%zx bytes (discarded 0x%zx bytes %s)\n", |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 168 | reserved_size, discard_size, |
| 169 | pos == TOP ? "above" : "below"); |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 170 | } |
| 171 | |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 172 | static void dump_load_info(uintptr_t image_load_addr, |
| 173 | size_t image_size, |
Dan Handley | e2712bc | 2014-04-10 15:37:22 +0100 | [diff] [blame] | 174 | const meminfo_t *mem_layout) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 175 | { |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 176 | INFO("Trying to load image at address %p, size = 0x%zx\n", |
| 177 | (void *)image_load_addr, image_size); |
Dan Handley | 91b624e | 2014-07-29 17:14:00 +0100 | [diff] [blame] | 178 | INFO("Current memory layout:\n"); |
Sandrine Bailleux | 4ec7e2d | 2016-07-12 09:12:24 +0100 | [diff] [blame] | 179 | INFO(" total region = [base = %p, size = 0x%zx]\n", |
| 180 | (void *) mem_layout->total_base, mem_layout->total_size); |
| 181 | INFO(" free region = [base = %p, size = 0x%zx]\n", |
| 182 | (void *) mem_layout->free_base, mem_layout->free_size); |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 183 | } |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 184 | #endif /* LOAD_IMAGE_V2 */ |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 185 | |
Ryan Harkin | 87274c4 | 2014-02-04 11:43:57 +0000 | [diff] [blame] | 186 | /* Generic function to return the size of an image */ |
Daniel Boulby | 4f3b6ed | 2018-05-04 11:18:26 +0100 | [diff] [blame] | 187 | size_t get_image_size(unsigned int image_id) |
Ryan Harkin | 87274c4 | 2014-02-04 11:43:57 +0000 | [diff] [blame] | 188 | { |
Dan Handley | a4cb68e | 2014-04-23 13:47:06 +0100 | [diff] [blame] | 189 | uintptr_t dev_handle; |
| 190 | uintptr_t image_handle; |
| 191 | uintptr_t image_spec; |
Ryan Harkin | 87274c4 | 2014-02-04 11:43:57 +0000 | [diff] [blame] | 192 | size_t image_size = 0; |
Juan Castillo | 6e76206 | 2015-11-02 10:47:01 +0000 | [diff] [blame] | 193 | int io_result; |
Ryan Harkin | 87274c4 | 2014-02-04 11:43:57 +0000 | [diff] [blame] | 194 | |
Ryan Harkin | 87274c4 | 2014-02-04 11:43:57 +0000 | [diff] [blame] | 195 | /* Obtain a reference to the image by querying the platform layer */ |
Juan Castillo | 3a66aca | 2015-04-13 17:36:19 +0100 | [diff] [blame] | 196 | io_result = plat_get_image_source(image_id, &dev_handle, &image_spec); |
Juan Castillo | 6e76206 | 2015-11-02 10:47:01 +0000 | [diff] [blame] | 197 | if (io_result != 0) { |
Juan Castillo | 3a66aca | 2015-04-13 17:36:19 +0100 | [diff] [blame] | 198 | WARN("Failed to obtain reference to image id=%u (%i)\n", |
| 199 | image_id, io_result); |
Ryan Harkin | 87274c4 | 2014-02-04 11:43:57 +0000 | [diff] [blame] | 200 | return 0; |
| 201 | } |
| 202 | |
| 203 | /* Attempt to access the image */ |
| 204 | io_result = io_open(dev_handle, image_spec, &image_handle); |
Juan Castillo | 6e76206 | 2015-11-02 10:47:01 +0000 | [diff] [blame] | 205 | if (io_result != 0) { |
Juan Castillo | 3a66aca | 2015-04-13 17:36:19 +0100 | [diff] [blame] | 206 | WARN("Failed to access image id=%u (%i)\n", |
| 207 | image_id, io_result); |
Ryan Harkin | 87274c4 | 2014-02-04 11:43:57 +0000 | [diff] [blame] | 208 | return 0; |
| 209 | } |
| 210 | |
| 211 | /* Find the size of the image */ |
| 212 | io_result = io_size(image_handle, &image_size); |
Juan Castillo | 6e76206 | 2015-11-02 10:47:01 +0000 | [diff] [blame] | 213 | if ((io_result != 0) || (image_size == 0)) { |
Juan Castillo | 3a66aca | 2015-04-13 17:36:19 +0100 | [diff] [blame] | 214 | WARN("Failed to determine the size of the image id=%u (%i)\n", |
| 215 | image_id, io_result); |
Ryan Harkin | 87274c4 | 2014-02-04 11:43:57 +0000 | [diff] [blame] | 216 | } |
| 217 | io_result = io_close(image_handle); |
| 218 | /* Ignore improbable/unrecoverable error in 'close' */ |
| 219 | |
| 220 | /* TODO: Consider maintaining open device connection from this |
| 221 | * bootloader stage |
| 222 | */ |
| 223 | io_result = io_dev_close(dev_handle); |
| 224 | /* Ignore improbable/unrecoverable error in 'dev_close' */ |
| 225 | |
| 226 | return image_size; |
| 227 | } |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 228 | |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 229 | #if LOAD_IMAGE_V2 |
| 230 | |
| 231 | /******************************************************************************* |
Soby Mathew | 7c8af06 | 2017-11-10 13:14:40 +0000 | [diff] [blame] | 232 | * Internal function to load an image at a specific address given |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 233 | * an image ID and extents of free memory. |
| 234 | * |
| 235 | * If the load is successful then the image information is updated. |
| 236 | * |
| 237 | * Returns 0 on success, a negative error code otherwise. |
| 238 | ******************************************************************************/ |
Soby Mathew | 7c8af06 | 2017-11-10 13:14:40 +0000 | [diff] [blame] | 239 | static int load_image(unsigned int image_id, image_info_t *image_data) |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 240 | { |
| 241 | uintptr_t dev_handle; |
| 242 | uintptr_t image_handle; |
| 243 | uintptr_t image_spec; |
| 244 | uintptr_t image_base; |
| 245 | size_t image_size; |
| 246 | size_t bytes_read; |
| 247 | int io_result; |
| 248 | |
| 249 | assert(image_data != NULL); |
| 250 | assert(image_data->h.version >= VERSION_2); |
| 251 | |
| 252 | image_base = image_data->image_base; |
| 253 | |
| 254 | /* Obtain a reference to the image by querying the platform layer */ |
| 255 | io_result = plat_get_image_source(image_id, &dev_handle, &image_spec); |
| 256 | if (io_result != 0) { |
| 257 | WARN("Failed to obtain reference to image id=%u (%i)\n", |
| 258 | image_id, io_result); |
| 259 | return io_result; |
| 260 | } |
| 261 | |
| 262 | /* Attempt to access the image */ |
| 263 | io_result = io_open(dev_handle, image_spec, &image_handle); |
| 264 | if (io_result != 0) { |
| 265 | WARN("Failed to access image id=%u (%i)\n", |
| 266 | image_id, io_result); |
| 267 | return io_result; |
| 268 | } |
| 269 | |
| 270 | INFO("Loading image id=%u at address %p\n", image_id, |
| 271 | (void *) image_base); |
| 272 | |
| 273 | /* Find the size of the image */ |
| 274 | io_result = io_size(image_handle, &image_size); |
| 275 | if ((io_result != 0) || (image_size == 0)) { |
| 276 | WARN("Failed to determine the size of the image id=%u (%i)\n", |
| 277 | image_id, io_result); |
| 278 | goto exit; |
| 279 | } |
| 280 | |
| 281 | /* Check that the image size to load is within limit */ |
| 282 | if (image_size > image_data->image_max_size) { |
| 283 | WARN("Image id=%u size out of bounds\n", image_id); |
| 284 | io_result = -EFBIG; |
| 285 | goto exit; |
| 286 | } |
| 287 | |
| 288 | image_data->image_size = image_size; |
| 289 | |
| 290 | /* We have enough space so load the image now */ |
| 291 | /* TODO: Consider whether to try to recover/retry a partially successful read */ |
| 292 | io_result = io_read(image_handle, image_base, image_size, &bytes_read); |
| 293 | if ((io_result != 0) || (bytes_read < image_size)) { |
| 294 | WARN("Failed to load image id=%u (%i)\n", image_id, io_result); |
| 295 | goto exit; |
| 296 | } |
| 297 | |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 298 | INFO("Image id=%u loaded: %p - %p\n", image_id, (void *) image_base, |
| 299 | (void *) (image_base + image_size)); |
| 300 | |
| 301 | exit: |
| 302 | io_close(image_handle); |
| 303 | /* Ignore improbable/unrecoverable error in 'close' */ |
| 304 | |
| 305 | /* TODO: Consider maintaining open device connection from this bootloader stage */ |
| 306 | io_dev_close(dev_handle); |
| 307 | /* Ignore improbable/unrecoverable error in 'dev_close' */ |
| 308 | |
| 309 | return io_result; |
| 310 | } |
| 311 | |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 312 | static int load_auth_image_internal(unsigned int image_id, |
| 313 | image_info_t *image_data, |
| 314 | int is_parent_image) |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 315 | { |
| 316 | int rc; |
| 317 | |
| 318 | #if TRUSTED_BOARD_BOOT |
Soby Mathew | 9fe8804 | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 319 | if (dyn_is_auth_disabled() == 0) { |
| 320 | unsigned int parent_id; |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 321 | |
Soby Mathew | 9fe8804 | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 322 | /* Use recursion to authenticate parent images */ |
| 323 | rc = auth_mod_get_parent_id(image_id, &parent_id); |
| 324 | if (rc == 0) { |
| 325 | rc = load_auth_image_internal(parent_id, image_data, 1); |
| 326 | if (rc != 0) { |
| 327 | return rc; |
| 328 | } |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 329 | } |
| 330 | } |
| 331 | #endif /* TRUSTED_BOARD_BOOT */ |
| 332 | |
| 333 | /* Load the image */ |
| 334 | rc = load_image(image_id, image_data); |
| 335 | if (rc != 0) { |
| 336 | return rc; |
| 337 | } |
| 338 | |
| 339 | #if TRUSTED_BOARD_BOOT |
Soby Mathew | 9fe8804 | 2018-03-26 12:43:37 +0100 | [diff] [blame] | 340 | if (dyn_is_auth_disabled() == 0) { |
| 341 | /* Authenticate it */ |
| 342 | rc = auth_mod_verify_img(image_id, |
| 343 | (void *)image_data->image_base, |
| 344 | image_data->image_size); |
| 345 | if (rc != 0) { |
| 346 | /* Authentication error, zero memory and flush it right away. */ |
| 347 | zero_normalmem((void *)image_data->image_base, |
| 348 | image_data->image_size); |
| 349 | flush_dcache_range(image_data->image_base, |
| 350 | image_data->image_size); |
| 351 | return -EAUTH; |
| 352 | } |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 353 | } |
Soby Mathew | 7c8af06 | 2017-11-10 13:14:40 +0000 | [diff] [blame] | 354 | #endif /* TRUSTED_BOARD_BOOT */ |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 355 | |
| 356 | /* |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 357 | * Flush the image to main memory so that it can be executed later by |
Soby Mathew | 7c8af06 | 2017-11-10 13:14:40 +0000 | [diff] [blame] | 358 | * any CPU, regardless of cache and MMU state. If TBB is enabled, then |
| 359 | * the file has been successfully loaded and authenticated and flush |
| 360 | * only for child images, not for the parents (certificates). |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 361 | */ |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 362 | if (!is_parent_image) { |
| 363 | flush_dcache_range(image_data->image_base, |
| 364 | image_data->image_size); |
| 365 | } |
Soby Mathew | 7c8af06 | 2017-11-10 13:14:40 +0000 | [diff] [blame] | 366 | |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 367 | |
| 368 | return 0; |
| 369 | } |
| 370 | |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 371 | /******************************************************************************* |
| 372 | * Generic function to load and authenticate an image. The image is actually |
| 373 | * loaded by calling the 'load_image()' function. Therefore, it returns the |
| 374 | * same error codes if the loading operation failed, or -EAUTH if the |
| 375 | * authentication failed. In addition, this function uses recursion to |
| 376 | * authenticate the parent images up to the root of trust. |
| 377 | ******************************************************************************/ |
| 378 | int load_auth_image(unsigned int image_id, image_info_t *image_data) |
| 379 | { |
Roberto Vargas | bc1ae1f | 2017-09-26 12:53:01 +0100 | [diff] [blame] | 380 | int err; |
| 381 | |
| 382 | do { |
| 383 | err = load_auth_image_internal(image_id, image_data, 0); |
| 384 | } while (err != 0 && plat_try_next_boot_source()); |
| 385 | |
| 386 | return err; |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 387 | } |
| 388 | |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 389 | #else /* LOAD_IMAGE_V2 */ |
| 390 | |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 391 | /******************************************************************************* |
Sandrine Bailleux | 8eaf46e | 2016-05-27 14:08:10 +0100 | [diff] [blame] | 392 | * Generic function to load an image at a specific address given an image ID and |
| 393 | * extents of free memory. |
| 394 | * |
| 395 | * If the load is successful then the image information is updated. |
| 396 | * |
| 397 | * If the entry_point_info argument is not NULL then this function also updates: |
| 398 | * - the memory layout to mark the memory as reserved; |
| 399 | * - the entry point information. |
| 400 | * |
| 401 | * The caller might pass a NULL pointer for the entry point if they are not |
| 402 | * interested in this information. This is typically the case for non-executable |
| 403 | * images (e.g. certificates) and executable images that won't ever be executed |
| 404 | * on the application processor (e.g. additional microcontroller firmware). |
| 405 | * |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 406 | * Returns 0 on success, a negative error code otherwise. |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 407 | ******************************************************************************/ |
Vikram Kanigiri | da56743 | 2014-04-15 18:08:08 +0100 | [diff] [blame] | 408 | int load_image(meminfo_t *mem_layout, |
Juan Castillo | 3a66aca | 2015-04-13 17:36:19 +0100 | [diff] [blame] | 409 | unsigned int image_id, |
Juan Castillo | a08a5e7 | 2015-05-19 11:54:12 +0100 | [diff] [blame] | 410 | uintptr_t image_base, |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 411 | image_info_t *image_data, |
| 412 | entry_point_info_t *entry_point_info) |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 413 | { |
Dan Handley | a4cb68e | 2014-04-23 13:47:06 +0100 | [diff] [blame] | 414 | uintptr_t dev_handle; |
| 415 | uintptr_t image_handle; |
| 416 | uintptr_t image_spec; |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 417 | size_t image_size; |
| 418 | size_t bytes_read; |
Juan Castillo | ec813f5 | 2015-10-01 18:37:40 +0100 | [diff] [blame] | 419 | int io_result; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 420 | |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 421 | assert(mem_layout != NULL); |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 422 | assert(image_data != NULL); |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 423 | assert(image_data->h.version == VERSION_1); |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 424 | |
| 425 | /* Obtain a reference to the image by querying the platform layer */ |
Juan Castillo | 3a66aca | 2015-04-13 17:36:19 +0100 | [diff] [blame] | 426 | io_result = plat_get_image_source(image_id, &dev_handle, &image_spec); |
Juan Castillo | ec813f5 | 2015-10-01 18:37:40 +0100 | [diff] [blame] | 427 | if (io_result != 0) { |
Juan Castillo | 3a66aca | 2015-04-13 17:36:19 +0100 | [diff] [blame] | 428 | WARN("Failed to obtain reference to image id=%u (%i)\n", |
| 429 | image_id, io_result); |
Vikram Kanigiri | da56743 | 2014-04-15 18:08:08 +0100 | [diff] [blame] | 430 | return io_result; |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 431 | } |
| 432 | |
| 433 | /* Attempt to access the image */ |
| 434 | io_result = io_open(dev_handle, image_spec, &image_handle); |
Juan Castillo | ec813f5 | 2015-10-01 18:37:40 +0100 | [diff] [blame] | 435 | if (io_result != 0) { |
Juan Castillo | 3a66aca | 2015-04-13 17:36:19 +0100 | [diff] [blame] | 436 | WARN("Failed to access image id=%u (%i)\n", |
| 437 | image_id, io_result); |
Vikram Kanigiri | da56743 | 2014-04-15 18:08:08 +0100 | [diff] [blame] | 438 | return io_result; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 439 | } |
| 440 | |
Antonio Nino Diaz | b3a0a7b | 2016-02-02 12:03:38 +0000 | [diff] [blame] | 441 | INFO("Loading image id=%u at address %p\n", image_id, |
| 442 | (void *) image_base); |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 443 | |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 444 | /* Find the size of the image */ |
| 445 | io_result = io_size(image_handle, &image_size); |
Juan Castillo | ec813f5 | 2015-10-01 18:37:40 +0100 | [diff] [blame] | 446 | if ((io_result != 0) || (image_size == 0)) { |
Juan Castillo | 3a66aca | 2015-04-13 17:36:19 +0100 | [diff] [blame] | 447 | WARN("Failed to determine the size of the image id=%u (%i)\n", |
| 448 | image_id, io_result); |
Vikram Kanigiri | da56743 | 2014-04-15 18:08:08 +0100 | [diff] [blame] | 449 | goto exit; |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 450 | } |
| 451 | |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 452 | /* Check that the memory where the image will be loaded is free */ |
| 453 | if (!is_mem_free(mem_layout->free_base, mem_layout->free_size, |
| 454 | image_base, image_size)) { |
Sandrine Bailleux | 4ec7e2d | 2016-07-12 09:12:24 +0100 | [diff] [blame] | 455 | WARN("Failed to reserve region [base = %p, size = 0x%zx]\n", |
| 456 | (void *) image_base, image_size); |
Vikram Kanigiri | da56743 | 2014-04-15 18:08:08 +0100 | [diff] [blame] | 457 | dump_load_info(image_base, image_size, mem_layout); |
| 458 | io_result = -ENOMEM; |
| 459 | goto exit; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 460 | } |
| 461 | |
| 462 | /* We have enough space so load the image now */ |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 463 | /* TODO: Consider whether to try to recover/retry a partially successful read */ |
Dan Handley | a4cb68e | 2014-04-23 13:47:06 +0100 | [diff] [blame] | 464 | io_result = io_read(image_handle, image_base, image_size, &bytes_read); |
Juan Castillo | ec813f5 | 2015-10-01 18:37:40 +0100 | [diff] [blame] | 465 | if ((io_result != 0) || (bytes_read < image_size)) { |
Juan Castillo | 3a66aca | 2015-04-13 17:36:19 +0100 | [diff] [blame] | 466 | WARN("Failed to load image id=%u (%i)\n", image_id, io_result); |
Vikram Kanigiri | da56743 | 2014-04-15 18:08:08 +0100 | [diff] [blame] | 467 | goto exit; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 468 | } |
| 469 | |
Sandrine Bailleux | 8eaf46e | 2016-05-27 14:08:10 +0100 | [diff] [blame] | 470 | image_data->image_base = image_base; |
| 471 | image_data->image_size = image_size; |
| 472 | |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 473 | /* |
| 474 | * Update the memory usage info. |
| 475 | * This is done after the actual loading so that it is not updated when |
| 476 | * the load is unsuccessful. |
Juan Castillo | 09a55a8 | 2015-01-19 16:51:21 +0000 | [diff] [blame] | 477 | * If the caller does not provide an entry point, bypass the memory |
| 478 | * reservation. |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 479 | */ |
Juan Castillo | 09a55a8 | 2015-01-19 16:51:21 +0000 | [diff] [blame] | 480 | if (entry_point_info != NULL) { |
| 481 | reserve_mem(&mem_layout->free_base, &mem_layout->free_size, |
| 482 | image_base, image_size); |
Sandrine Bailleux | 8eaf46e | 2016-05-27 14:08:10 +0100 | [diff] [blame] | 483 | entry_point_info->pc = image_base; |
Juan Castillo | 09a55a8 | 2015-01-19 16:51:21 +0000 | [diff] [blame] | 484 | } else { |
Sandrine Bailleux | 4ec7e2d | 2016-07-12 09:12:24 +0100 | [diff] [blame] | 485 | INFO("Skip reserving region [base = %p, size = 0x%zx]\n", |
| 486 | (void *) image_base, image_size); |
Juan Castillo | 09a55a8 | 2015-01-19 16:51:21 +0000 | [diff] [blame] | 487 | } |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 488 | |
Dan Handley | 9c96ed5 | 2016-07-28 14:38:03 +0100 | [diff] [blame] | 489 | #if !TRUSTED_BOARD_BOOT |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 490 | /* |
Sandrine Bailleux | 467d057 | 2014-06-24 14:02:34 +0100 | [diff] [blame] | 491 | * File has been successfully loaded. |
Dan Handley | 9c96ed5 | 2016-07-28 14:38:03 +0100 | [diff] [blame] | 492 | * Flush the image to main memory so that it can be executed later by |
| 493 | * any CPU, regardless of cache and MMU state. |
| 494 | * When TBB is enabled the image is flushed later, after image |
| 495 | * authentication. |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 496 | */ |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 497 | flush_dcache_range(image_base, image_size); |
Dan Handley | 9c96ed5 | 2016-07-28 14:38:03 +0100 | [diff] [blame] | 498 | #endif /* TRUSTED_BOARD_BOOT */ |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 499 | |
Sandrine Bailleux | 4ec7e2d | 2016-07-12 09:12:24 +0100 | [diff] [blame] | 500 | INFO("Image id=%u loaded at address %p, size = 0x%zx\n", image_id, |
| 501 | (void *) image_base, image_size); |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 502 | |
| 503 | exit: |
Vikram Kanigiri | da56743 | 2014-04-15 18:08:08 +0100 | [diff] [blame] | 504 | io_close(image_handle); |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 505 | /* Ignore improbable/unrecoverable error in 'close' */ |
| 506 | |
| 507 | /* TODO: Consider maintaining open device connection from this bootloader stage */ |
Vikram Kanigiri | da56743 | 2014-04-15 18:08:08 +0100 | [diff] [blame] | 508 | io_dev_close(dev_handle); |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 509 | /* Ignore improbable/unrecoverable error in 'dev_close' */ |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 510 | |
Vikram Kanigiri | da56743 | 2014-04-15 18:08:08 +0100 | [diff] [blame] | 511 | return io_result; |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 512 | } |
Juan Castillo | a08a5e7 | 2015-05-19 11:54:12 +0100 | [diff] [blame] | 513 | |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 514 | static int load_auth_image_internal(meminfo_t *mem_layout, |
| 515 | unsigned int image_id, |
| 516 | uintptr_t image_base, |
| 517 | image_info_t *image_data, |
| 518 | entry_point_info_t *entry_point_info, |
| 519 | int is_parent_image) |
Juan Castillo | a08a5e7 | 2015-05-19 11:54:12 +0100 | [diff] [blame] | 520 | { |
| 521 | int rc; |
| 522 | |
| 523 | #if TRUSTED_BOARD_BOOT |
| 524 | unsigned int parent_id; |
| 525 | |
| 526 | /* Use recursion to authenticate parent images */ |
| 527 | rc = auth_mod_get_parent_id(image_id, &parent_id); |
| 528 | if (rc == 0) { |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 529 | rc = load_auth_image_internal(mem_layout, parent_id, image_base, |
| 530 | image_data, NULL, 1); |
Juan Castillo | ec813f5 | 2015-10-01 18:37:40 +0100 | [diff] [blame] | 531 | if (rc != 0) { |
Juan Castillo | a08a5e7 | 2015-05-19 11:54:12 +0100 | [diff] [blame] | 532 | return rc; |
| 533 | } |
| 534 | } |
| 535 | #endif /* TRUSTED_BOARD_BOOT */ |
| 536 | |
| 537 | /* Load the image */ |
| 538 | rc = load_image(mem_layout, image_id, image_base, image_data, |
| 539 | entry_point_info); |
Juan Castillo | ec813f5 | 2015-10-01 18:37:40 +0100 | [diff] [blame] | 540 | if (rc != 0) { |
| 541 | return rc; |
Juan Castillo | a08a5e7 | 2015-05-19 11:54:12 +0100 | [diff] [blame] | 542 | } |
| 543 | |
| 544 | #if TRUSTED_BOARD_BOOT |
| 545 | /* Authenticate it */ |
| 546 | rc = auth_mod_verify_img(image_id, |
| 547 | (void *)image_data->image_base, |
| 548 | image_data->image_size); |
| 549 | if (rc != 0) { |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 550 | /* Authentication error, zero memory and flush it right away. */ |
Douglas Raillard | 21362a9 | 2016-12-02 13:51:54 +0000 | [diff] [blame] | 551 | zero_normalmem((void *)image_data->image_base, |
Juan Castillo | 97dbcf1 | 2015-08-17 10:43:27 +0100 | [diff] [blame] | 552 | image_data->image_size); |
| 553 | flush_dcache_range(image_data->image_base, |
| 554 | image_data->image_size); |
Juan Castillo | ec813f5 | 2015-10-01 18:37:40 +0100 | [diff] [blame] | 555 | return -EAUTH; |
Juan Castillo | a08a5e7 | 2015-05-19 11:54:12 +0100 | [diff] [blame] | 556 | } |
Dan Handley | 9c96ed5 | 2016-07-28 14:38:03 +0100 | [diff] [blame] | 557 | /* |
| 558 | * File has been successfully loaded and authenticated. |
| 559 | * Flush the image to main memory so that it can be executed later by |
| 560 | * any CPU, regardless of cache and MMU state. |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 561 | * Do it only for child images, not for the parents (certificates). |
Dan Handley | 9c96ed5 | 2016-07-28 14:38:03 +0100 | [diff] [blame] | 562 | */ |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 563 | if (!is_parent_image) { |
| 564 | flush_dcache_range(image_data->image_base, |
| 565 | image_data->image_size); |
| 566 | } |
Juan Castillo | a08a5e7 | 2015-05-19 11:54:12 +0100 | [diff] [blame] | 567 | #endif /* TRUSTED_BOARD_BOOT */ |
| 568 | |
Juan Castillo | ec813f5 | 2015-10-01 18:37:40 +0100 | [diff] [blame] | 569 | return 0; |
Juan Castillo | a08a5e7 | 2015-05-19 11:54:12 +0100 | [diff] [blame] | 570 | } |
Sandrine Bailleux | b2e224c | 2015-09-28 17:03:06 +0100 | [diff] [blame] | 571 | |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 572 | /******************************************************************************* |
| 573 | * Generic function to load and authenticate an image. The image is actually |
| 574 | * loaded by calling the 'load_image()' function. Therefore, it returns the |
| 575 | * same error codes if the loading operation failed, or -EAUTH if the |
| 576 | * authentication failed. In addition, this function uses recursion to |
| 577 | * authenticate the parent images up to the root of trust. |
| 578 | ******************************************************************************/ |
| 579 | int load_auth_image(meminfo_t *mem_layout, |
| 580 | unsigned int image_id, |
| 581 | uintptr_t image_base, |
| 582 | image_info_t *image_data, |
| 583 | entry_point_info_t *entry_point_info) |
| 584 | { |
Roberto Vargas | bc1ae1f | 2017-09-26 12:53:01 +0100 | [diff] [blame] | 585 | int err; |
| 586 | |
| 587 | do { |
| 588 | err = load_auth_image_internal(mem_layout, image_id, image_base, |
| 589 | image_data, entry_point_info, 0); |
| 590 | } while (err != 0 && plat_try_next_boot_source()); |
| 591 | |
| 592 | return err; |
Antonio Nino Diaz | d7db870 | 2016-11-22 10:58:30 +0000 | [diff] [blame] | 593 | } |
| 594 | |
Yatharth Kochar | 3345a8d | 2016-09-12 16:08:41 +0100 | [diff] [blame] | 595 | #endif /* LOAD_IMAGE_V2 */ |
| 596 | |
Sandrine Bailleux | b2e224c | 2015-09-28 17:03:06 +0100 | [diff] [blame] | 597 | /******************************************************************************* |
| 598 | * Print the content of an entry_point_info_t structure. |
| 599 | ******************************************************************************/ |
| 600 | void print_entry_point_info(const entry_point_info_t *ep_info) |
| 601 | { |
Soby Mathew | a0fedc4 | 2016-06-16 14:52:04 +0100 | [diff] [blame] | 602 | INFO("Entry point address = %p\n", (void *)ep_info->pc); |
| 603 | INFO("SPSR = 0x%x\n", ep_info->spsr); |
Sandrine Bailleux | b2e224c | 2015-09-28 17:03:06 +0100 | [diff] [blame] | 604 | |
| 605 | #define PRINT_IMAGE_ARG(n) \ |
| 606 | VERBOSE("Argument #" #n " = 0x%llx\n", \ |
| 607 | (unsigned long long) ep_info->args.arg##n) |
| 608 | |
| 609 | PRINT_IMAGE_ARG(0); |
| 610 | PRINT_IMAGE_ARG(1); |
| 611 | PRINT_IMAGE_ARG(2); |
| 612 | PRINT_IMAGE_ARG(3); |
Soby Mathew | cdf58cb | 2016-08-30 13:07:31 +0100 | [diff] [blame] | 613 | #ifndef AARCH32 |
Sandrine Bailleux | b2e224c | 2015-09-28 17:03:06 +0100 | [diff] [blame] | 614 | PRINT_IMAGE_ARG(4); |
| 615 | PRINT_IMAGE_ARG(5); |
| 616 | PRINT_IMAGE_ARG(6); |
| 617 | PRINT_IMAGE_ARG(7); |
Soby Mathew | cdf58cb | 2016-08-30 13:07:31 +0100 | [diff] [blame] | 618 | #endif |
Sandrine Bailleux | b2e224c | 2015-09-28 17:03:06 +0100 | [diff] [blame] | 619 | #undef PRINT_IMAGE_ARG |
| 620 | } |