/* * Copyright (c) 2012, ARM Limited. All rights reserved. * * Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the * following conditions are met: * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * Redistributions in binary form must reproduce the * above copyright notice, this list of conditions and * the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of ARM nor the names of its * contributors may be used to endorse or promote products * derived from this software without specific prior written * permission. */ #ifndef __VIRTUALISOR_H__ #define __VIRTUALISOR_H__ #include "misc.h" #include "virt_helpers.h" /* * Data structure that holds a copy of the virtualized regs */ typedef struct virt_regs { unsigned cluster_id; unsigned mpidr; unsigned midr; } virt_reg_data; /* * Data structure that holds all the trap registers exported * by the Virtualisation Extensions. */ typedef struct trap_regs { unsigned hcr; unsigned hdcr; unsigned hcptr; unsigned hstr; } reg_trap_data; typedef struct gp_regs { unsigned r[15]; } gp_regs; /* * Descriptor exported by each processor describing * which traps it wants to implement along with * handlers for saving and restoring for each conf- * -igured trap. */ typedef struct virt_desc { /* cpu midr contents */ unsigned cpu_no; /* * Bitmask to inidicate that Virtualisor setup has been * done on both host & target cpus. */ unsigned char init[NUM_CPUS]; unsigned (*trap_setup) (unsigned, unsigned); unsigned (*trap_handle) (gp_regs * regs, unsigned, unsigned); unsigned (*trap_save) (unsigned, unsigned); unsigned (*trap_restore) (unsigned, unsigned); } virt_descriptor; extern void SetupVirtualisor(unsigned); extern void SaveVirtualisor(unsigned); extern void RestoreVirtualisor(unsigned); extern void HandleVirtualisor(gp_regs *); extern void handle_vgic_distif_abort(unsigned, unsigned *, unsigned); extern void handle_kfscb_abort(unsigned, unsigned *, unsigned); extern unsigned find_sibling_cpu(void); extern virt_descriptor virt_desc_section$$Base; extern unsigned virt_desc_section$$Length; extern unsigned host_cluster; extern unsigned switcher; #endif /* __VIRTUALISOR_H__ */