1 /* Copyright(c) 2022 Intel Corporation. All rights reserved. 2 * SPDX-License-Identifier: Apache-2.0 3 */ 4 5 #include <zephyr/arch/xtensa/arch.h> 6 #include <zephyr/device.h> 7 #include <zephyr/devicetree.h> 8 #include <zephyr/init.h> 9 #include <errno.h> 10 #include <zephyr/cache.h> 11 12 #include <mem_window.h> 13 boot_complete(void)14int boot_complete(void) 15 { 16 uint32_t *win; 17 const struct mem_win_config *config; 18 const struct device *dev = DEVICE_DT_GET(DT_NODELABEL(mem_window0)); 19 20 if (!device_is_ready(dev)) { 21 return -ENODEV; 22 } 23 config = dev->config; 24 25 win = sys_cache_uncached_ptr_get((__sparse_force void __sparse_cache *)config->mem_base); 26 /* Software protocol: "firmware entered" has the value 5 */ 27 win[0] = 5; 28 29 return 0; 30 } 31 32 SYS_INIT(boot_complete, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); 33