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 BSD 2-Clause license. Note that NO WARRANTY is provided. 8 * See "LICENSE_BSD2.txt" for details. 9 * 10 * @TAG(DATA61_BSD) 11 */ 12 13/* FIXME: This file is symlinked to RISC-V from ARM because they use the same 14 * implementation. This was done because there is a plan to remove this functionality 15 * in favour of a vka RPC client that allows the test process to query for hardware 16 * resources instead of preallocating them. 17 */ 18 19#include "../../test.h" 20 21#include <sel4platsupport/device.h> 22#include <platsupport/plat/serial.h> 23#include <vka/capops.h> 24#include <sel4utils/process.h> 25 26#ifdef CONFIG_TK1_SMMU 27seL4_SlotRegion arch_copy_iospace_caps_to_process(sel4utils_process_t *process, driver_env_t env) 28{ 29 seL4_SlotRegion ret = {0, 0}; 30 int num_iospace_caps = 0; 31 seL4_Error UNUSED error = simple_get_iospace_cap_count(&env->simple, &num_iospace_caps); 32 assert(error == seL4_NoError); 33 for (int i = 0; i < num_iospace_caps; i++) { 34 seL4_CPtr iospace = simple_get_nth_iospace_cap(&env->simple, i); 35 assert(iospace != seL4_CapNull); 36 seL4_CPtr slot = sel4utils_copy_cap_to_process(process, &env->vka, iospace); 37 assert(slot != seL4_CapNull); 38 if (i == 0) { 39 ret.start = slot; 40 } 41 ret.end = slot; 42 } 43 assert((ret.end - ret.start) + 1 == num_iospace_caps); 44 /* the return region is now inclusive */ 45 return ret; 46} 47#endif 48