0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _ASM_VPE_H
0010 #define _ASM_VPE_H
0011
0012 #include <linux/init.h>
0013 #include <linux/list.h>
0014 #include <linux/smp.h>
0015 #include <linux/spinlock.h>
0016
0017 #define VPE_MODULE_NAME "vpe"
0018 #define VPE_MODULE_MINOR 1
0019
0020
0021 #ifdef CONFIG_MIPS_VPE_LOADER_TOM
0022 #define P_SIZE (2 * 1024 * 1024)
0023 #else
0024
0025 #define P_SIZE (256 * 1024)
0026 #endif
0027
0028 #define MAX_VPES 16
0029
0030 static inline int aprp_cpu_index(void)
0031 {
0032 #ifdef CONFIG_MIPS_CMP
0033 return setup_max_cpus;
0034 #else
0035 extern int tclimit;
0036 return tclimit;
0037 #endif
0038 }
0039
0040 enum vpe_state {
0041 VPE_STATE_UNUSED = 0,
0042 VPE_STATE_INUSE,
0043 VPE_STATE_RUNNING
0044 };
0045
0046 enum tc_state {
0047 TC_STATE_UNUSED = 0,
0048 TC_STATE_INUSE,
0049 TC_STATE_RUNNING,
0050 TC_STATE_DYNAMIC
0051 };
0052
0053 struct vpe {
0054 enum vpe_state state;
0055
0056
0057 int minor;
0058
0059
0060 void *load_addr;
0061 unsigned long len;
0062 char *pbuffer;
0063 unsigned long plen;
0064
0065 unsigned long __start;
0066
0067
0068 struct list_head tc;
0069
0070
0071 struct list_head list;
0072
0073
0074 void *shared_ptr;
0075
0076
0077 struct list_head notify;
0078
0079 unsigned int ntcs;
0080 };
0081
0082 struct tc {
0083 enum tc_state state;
0084 int index;
0085
0086 struct vpe *pvpe;
0087 struct list_head tc;
0088 struct list_head list;
0089 };
0090
0091 struct vpe_notifications {
0092 void (*start)(int vpe);
0093 void (*stop)(int vpe);
0094
0095 struct list_head list;
0096 };
0097
0098 struct vpe_control {
0099 spinlock_t vpe_list_lock;
0100 struct list_head vpe_list;
0101 spinlock_t tc_list_lock;
0102 struct list_head tc_list;
0103 };
0104
0105 extern unsigned long physical_memsize;
0106 extern struct vpe_control vpecontrol;
0107 extern const struct file_operations vpe_fops;
0108
0109 int vpe_notify(int index, struct vpe_notifications *notify);
0110
0111 void *vpe_get_shared(int index);
0112
0113 struct vpe *get_vpe(int minor);
0114 struct tc *get_tc(int index);
0115 struct vpe *alloc_vpe(int minor);
0116 struct tc *alloc_tc(int index);
0117 void release_vpe(struct vpe *v);
0118
0119 void *alloc_progmem(unsigned long len);
0120 void release_progmem(void *ptr);
0121
0122 int vpe_run(struct vpe *v);
0123 void cleanup_tc(struct tc *tc);
0124
0125 int __init vpe_module_init(void);
0126 void __exit vpe_module_exit(void);
0127 #endif