1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 #include <intelblocks/msr.h>
5 #include <program_loading.h>
9 * This file supports the necessary hoops one needs to jump through since
10 * early FSP component and early stages are running from cache-as-ram.
13 static inline int is_car_addr(uintptr_t addr
)
15 return ((addr
>= CONFIG_DCACHE_RAM_BASE
) &&
16 (addr
< (CONFIG_DCACHE_RAM_BASE
+ CONFIG_DCACHE_RAM_SIZE
)));
19 void platform_segment_loaded(uintptr_t start
, size_t size
, int flags
)
21 /* Bail out if this is not the final segment. */
22 if (!(flags
& SEG_FINAL
))
25 char start_car_check
= is_car_addr(start
);
26 char end_car_check
= is_car_addr(start
+ size
- 1);
28 /* Bail out if loaded program segment does not lie in CAR region. */
29 if (!start_car_check
&& !end_car_check
)
32 /* Loaded program segment should lie entirely within CAR region. */
33 assert(start_car_check
&& end_car_check
);