Linux Audio

Check our new training course

Loading...
v6.2
  1/*
  2 * This file is subject to the terms and conditions of the GNU General Public
  3 * License.  See the file "COPYING" in the main directory of this archive
  4 * for more details.
  5 *
  6 * Copyright (C) 2005 MIPS Technologies, Inc.  All rights reserved.
  7 * Copyright (C) 2013 Imagination Technologies Ltd.
  8 */
  9#ifndef _ASM_VPE_H
 10#define _ASM_VPE_H
 11
 12#include <linux/init.h>
 13#include <linux/list.h>
 14#include <linux/smp.h>
 15#include <linux/spinlock.h>
 16
 17#define VPE_MODULE_NAME "vpe"
 18#define VPE_MODULE_MINOR 1
 19
 20/* grab the likely amount of memory we will need. */
 21#ifdef CONFIG_MIPS_VPE_LOADER_TOM
 22#define P_SIZE (2 * 1024 * 1024)
 23#else
 24/* add an overhead to the max kmalloc size for non-striped symbols/etc */
 25#define P_SIZE (256 * 1024)
 26#endif
 27
 28#define MAX_VPES 16
 29
 30static inline int aprp_cpu_index(void)
 31{
 32#ifdef CONFIG_MIPS_CMP
 33	return setup_max_cpus;
 34#else
 35	extern int tclimit;
 36	return tclimit;
 37#endif
 38}
 39
 40enum vpe_state {
 41	VPE_STATE_UNUSED = 0,
 42	VPE_STATE_INUSE,
 43	VPE_STATE_RUNNING
 44};
 45
 46enum tc_state {
 47	TC_STATE_UNUSED = 0,
 48	TC_STATE_INUSE,
 49	TC_STATE_RUNNING,
 50	TC_STATE_DYNAMIC
 51};
 52
 53struct vpe {
 54	enum vpe_state state;
 55
 56	/* (device) minor associated with this vpe */
 57	int minor;
 58
 59	/* elfloader stuff */
 60	void *load_addr;
 61	unsigned long len;
 62	char *pbuffer;
 63	unsigned long plen;
 64
 65	unsigned long __start;
 66
 67	/* tc's associated with this vpe */
 68	struct list_head tc;
 69
 70	/* The list of vpe's */
 71	struct list_head list;
 72
 73	/* shared symbol address */
 74	void *shared_ptr;
 75
 76	/* the list of who wants to know when something major happens */
 77	struct list_head notify;
 78
 79	unsigned int ntcs;
 80};
 81
 82struct tc {
 83	enum tc_state state;
 84	int index;
 85
 86	struct vpe *pvpe;	/* parent VPE */
 87	struct list_head tc;	/* The list of TC's with this VPE */
 88	struct list_head list;	/* The global list of tc's */
 89};
 90
 91struct vpe_notifications {
 92	void (*start)(int vpe);
 93	void (*stop)(int vpe);
 94
 95	struct list_head list;
 96};
 97
 98struct vpe_control {
 99	spinlock_t vpe_list_lock;
100	struct list_head vpe_list;      /* Virtual processing elements */
101	spinlock_t tc_list_lock;
102	struct list_head tc_list;       /* Thread contexts */
103};
104
105extern unsigned long physical_memsize;
106extern struct vpe_control vpecontrol;
107extern const struct file_operations vpe_fops;
108
109int vpe_notify(int index, struct vpe_notifications *notify);
110
111void *vpe_get_shared(int index);
112
113struct vpe *get_vpe(int minor);
114struct tc *get_tc(int index);
115struct vpe *alloc_vpe(int minor);
116struct tc *alloc_tc(int index);
117void release_vpe(struct vpe *v);
118
119void *alloc_progmem(unsigned long len);
120void release_progmem(void *ptr);
121
122int vpe_run(struct vpe *v);
123void cleanup_tc(struct tc *tc);
124
125int __init vpe_module_init(void);
126void __exit vpe_module_exit(void);
127#endif /* _ASM_VPE_H */
v6.13.7
  1/*
  2 * This file is subject to the terms and conditions of the GNU General Public
  3 * License.  See the file "COPYING" in the main directory of this archive
  4 * for more details.
  5 *
  6 * Copyright (C) 2005 MIPS Technologies, Inc.  All rights reserved.
  7 * Copyright (C) 2013 Imagination Technologies Ltd.
  8 */
  9#ifndef _ASM_VPE_H
 10#define _ASM_VPE_H
 11
 12#include <linux/init.h>
 13#include <linux/list.h>
 14#include <linux/smp.h>
 15#include <linux/spinlock.h>
 16
 17#define VPE_MODULE_NAME "vpe"
 18#define VPE_MODULE_MINOR 1
 19
 20/* grab the likely amount of memory we will need. */
 21#ifdef CONFIG_MIPS_VPE_LOADER_TOM
 22#define P_SIZE (2 * 1024 * 1024)
 23#else
 24/* add an overhead to the max kmalloc size for non-striped symbols/etc */
 25#define P_SIZE (256 * 1024)
 26#endif
 27
 28#define MAX_VPES 16
 29
 30static inline int aprp_cpu_index(void)
 31{
 
 
 
 32	extern int tclimit;
 33	return tclimit;
 
 34}
 35
 36enum vpe_state {
 37	VPE_STATE_UNUSED = 0,
 38	VPE_STATE_INUSE,
 39	VPE_STATE_RUNNING
 40};
 41
 42enum tc_state {
 43	TC_STATE_UNUSED = 0,
 44	TC_STATE_INUSE,
 45	TC_STATE_RUNNING,
 46	TC_STATE_DYNAMIC
 47};
 48
 49struct vpe {
 50	enum vpe_state state;
 51
 52	/* (device) minor associated with this vpe */
 53	int minor;
 54
 55	/* elfloader stuff */
 56	void *load_addr;
 57	unsigned long len;
 58	char *pbuffer;
 59	unsigned long plen;
 60
 61	unsigned long __start;
 62
 63	/* tc's associated with this vpe */
 64	struct list_head tc;
 65
 66	/* The list of vpe's */
 67	struct list_head list;
 68
 69	/* shared symbol address */
 70	void *shared_ptr;
 71
 72	/* the list of who wants to know when something major happens */
 73	struct list_head notify;
 74
 75	unsigned int ntcs;
 76};
 77
 78struct tc {
 79	enum tc_state state;
 80	int index;
 81
 82	struct vpe *pvpe;	/* parent VPE */
 83	struct list_head tc;	/* The list of TC's with this VPE */
 84	struct list_head list;	/* The global list of tc's */
 85};
 86
 87struct vpe_notifications {
 88	void (*start)(int vpe);
 89	void (*stop)(int vpe);
 90
 91	struct list_head list;
 92};
 93
 94struct vpe_control {
 95	spinlock_t vpe_list_lock;
 96	struct list_head vpe_list;      /* Virtual processing elements */
 97	spinlock_t tc_list_lock;
 98	struct list_head tc_list;       /* Thread contexts */
 99};
100
 
101extern struct vpe_control vpecontrol;
102extern const struct file_operations vpe_fops;
103
104int vpe_notify(int index, struct vpe_notifications *notify);
105
106void *vpe_get_shared(int index);
107
108struct vpe *get_vpe(int minor);
109struct tc *get_tc(int index);
110struct vpe *alloc_vpe(int minor);
111struct tc *alloc_tc(int index);
112void release_vpe(struct vpe *v);
113
114void *alloc_progmem(unsigned long len);
115void release_progmem(void *ptr);
116
117int vpe_run(struct vpe *v);
118void cleanup_tc(struct tc *tc);
119
120int __init vpe_module_init(void);
121void __exit vpe_module_exit(void);
122#endif /* _ASM_VPE_H */