1/* 2 * Copyright 2017, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the GNU General Public License version 2. Note that NO WARRANTY is provided. 8 * See "LICENSE_GPLv2.txt" for details. 9 * 10 * @TAG(DATA61_GPL) 11 */ 12 13#include <types.h> 14#include <machine/registerset.h> 15#include <arch/machine.h> 16#include <plat/machine/hardware.h> 17 18word_t PURE 19getRestartPC(tcb_t *thread) 20{ 21 return getRegister(thread, FaultInstruction); 22} 23 24void 25setNextPC(tcb_t *thread, word_t v) 26{ 27 setRegister(thread, ELR_EL1, v); 28} 29 30BOOT_CODE int 31get_num_avail_p_regs(void) 32{ 33 return sizeof(avail_p_regs) / sizeof(p_region_t); 34} 35 36BOOT_CODE int 37get_num_dev_p_regs(void) 38{ 39 return sizeof(dev_p_regs) / sizeof(p_region_t); 40} 41 42BOOT_CODE p_region_t get_dev_p_reg(word_t i) 43{ 44 return dev_p_regs[i]; 45} 46 47BOOT_CODE p_region_t get_avail_p_reg(word_t i) 48{ 49 return avail_p_regs[i]; 50} 51 52BOOT_CODE void 53map_kernel_devices(void) 54{ 55 for (int i = 0; i < ARRAY_SIZE(kernel_devices); i++) { 56 map_kernel_frame(kernel_devices[i].paddr, 57 kernel_devices[i].pptr, 58 VMKernelOnly, 59 vm_attributes_new(kernel_devices[i].armExecuteNever, 60 false, false)); 61 } 62} 63