1/* 2 * Copyright 2014, General Dynamics C4 Systems 3 * 4 * This software may be distributed and modified according to the terms of 5 * the GNU General Public License version 2. Note that NO WARRANTY is provided. 6 * See "LICENSE_GPLv2.txt" for details. 7 * 8 * @TAG(GD_GPL) 9 */ 10 11#ifndef __ARCH_OBJECT_IOSPACE_H 12#define __ARCH_OBJECT_IOSPACE_H 13 14#include <config.h> 15 16#ifdef CONFIG_IOMMU 17 18#include <types.h> 19#include <api/failures.h> 20#include <object/structures.h> 21#include <plat_mode/machine/hardware_gen.h> 22#include <plat/machine/pci.h> 23 24static inline int vtd_get_root_index(dev_id_t dev) 25{ 26 return get_pci_bus(dev); 27} 28 29static inline int vtd_get_context_index(dev_id_t dev) 30{ 31 return dev & 0xff; 32} 33 34struct lookupIOPTSlot_ret { 35 exception_t status; 36 vtd_pte_t* ioptSlot; 37 int level; 38}; 39typedef struct lookupIOPTSlot_ret lookupIOPTSlot_ret_t; 40 41cap_t master_iospace_cap(void); 42exception_t decodeX86IOPTInvocation(word_t invLabel, word_t length, cte_t* slot, cap_t cap, extra_caps_t excaps, word_t* buffer); 43exception_t decodeX86IOMapInvocation(word_t length, cte_t* slot, cap_t cap, extra_caps_t excaps, word_t* buffer); 44exception_t decodeX86IOSpaceInvocation(word_t invLabel, cap_t cap); 45exception_t performX86IOUnMapInvocation(cap_t cap, cte_t *ctSlot); 46void unmapIOPage(cap_t cap); 47void deleteIOPageTable(cap_t cap); 48void unmapVTDContextEntry(cap_t cap); 49 50#endif /* CONFIG_IOMMU */ 51 52#endif 53