1 /*
2  * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 #include <inttypes.h>
7 #include <stdint.h>
8 
9 #include <common/debug.h>
10 #include <lib/coreboot.h>
11 #include <lib/bl_aux_params/bl_aux_params.h>
12 
bl_aux_params_parse(u_register_t head,bl_aux_param_handler_t handler)13 void bl_aux_params_parse(u_register_t head,
14 			 bl_aux_param_handler_t handler)
15 {
16 	struct bl_aux_param_header *p;
17 
18 	for (p = (void *)head; p; p = (void *)(uintptr_t)p->next) {
19 		if (handler && handler(p))
20 			continue;
21 
22 		switch (p->type) {
23 #if COREBOOT
24 		case BL_AUX_PARAM_COREBOOT_TABLE:
25 			coreboot_table_setup((void *)(uintptr_t)
26 				((struct bl_aux_param_uint64 *)p)->value);
27 			break;
28 #endif
29 		default:
30 			ERROR("Ignoring unknown BL aux parameter: 0x%" PRIx64,
31 			      p->type);
32 			break;
33 		}
34 	}
35 }
36