From: Ben Gras Date: Tue, 18 Sep 2012 11:17:47 +0000 (+0200) Subject: VM: remove unused dma memory support functions from vm X-Git-Tag: v3.2.1~328 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.dnssec-dsfromkey.html?a=commitdiff_plain;h=2cb560297c4fd07dfc43bb8b987be7b1b396b6c4;p=minix.git VM: remove unused dma memory support functions from vm . unused calls / data structures --- diff --git a/drivers/amddev/amddev.c b/drivers/amddev/amddev.c index 4115d1e80..8db57527f 100644 --- a/drivers/amddev/amddev.c +++ b/drivers/amddev/amddev.c @@ -55,13 +55,15 @@ static void init_domain(int index); static void init_map(unsigned int ix); static int do_add4pci(const message *m); static void add_range(phys_bytes busaddr, phys_bytes size); +#if 0 static void del_range(phys_bytes busaddr, phys_bytes size); +static void sef_cb_signal_handler(int signo); +#endif static void report_exceptions(void); /* SEF functions and variables. */ static void sef_local_startup(void); static int sef_cb_init_fresh(int type, sef_init_info_t *info); -static void sef_cb_signal_handler(int signo); int main(void) { @@ -103,8 +105,10 @@ static void sef_local_startup() sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_standard); +#if 0 /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); +#endif /* Let SEF perform startup. */ sef_startup(); @@ -154,6 +158,7 @@ static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) } +#if 0 /*===========================================================================* * sef_cb_signal_handler * *===========================================================================*/ @@ -193,6 +198,7 @@ static void sef_cb_signal_handler(int signo) } } } +#endif /* Returns 0 if no device found, or 1 if a device is found. */ static int find_dev(devindp, capaddrp) @@ -411,6 +417,7 @@ static int do_add4pci(const message *m) return r; } +#if 0 r= vm_adddma(proc, start, size); if (r != 0) { @@ -419,6 +426,7 @@ static int do_add4pci(const message *m) "proc %d: %d\n", size, start, proc, r); return r; } +#endif add_range(busaddr, size); @@ -441,6 +449,7 @@ static void add_range(phys_bytes busaddr, phys_bytes size) } } +#if 0 static void del_range(phys_bytes busaddr, phys_bytes size) { phys_bytes o; @@ -455,6 +464,7 @@ static void del_range(phys_bytes busaddr, phys_bytes size) table[bit/8] |= (1 << (bit % 8)); } } +#endif static void report_exceptions(void) { diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index 881596a5e..ff8693eca 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -76,7 +76,6 @@ SRCS= \ tickdelay.c \ timers.c \ vm_brk.c \ - vm_dmacalls.c \ vm_exit.c \ vm_fork.c \ vm_info.c \ diff --git a/lib/libsys/vm_dmacalls.c b/lib/libsys/vm_dmacalls.c deleted file mode 100644 index bd7bf2dc3..000000000 --- a/lib/libsys/vm_dmacalls.c +++ /dev/null @@ -1,52 +0,0 @@ - -#include -#include -#include -#include - -int vm_adddma(proc_e, start, size) -endpoint_t proc_e; -phys_bytes start; -phys_bytes size; -{ - message m; - - m.VMAD_EP= proc_e; - m.VMAD_START= start; - m.VMAD_SIZE= size; - - return _syscall(VM_PROC_NR, VM_ADDDMA, &m); -} - -int vm_deldma(proc_e, start, size) -endpoint_t proc_e; -phys_bytes start; -phys_bytes size; -{ - message m; - - m.VMDD_EP= proc_e; - m.VMDD_START= start; - m.VMDD_SIZE= size; - - return _syscall(VM_PROC_NR, VM_DELDMA, &m); -} - -int vm_getdma(procp, basep, sizep) -endpoint_t *procp; -phys_bytes *basep; -phys_bytes *sizep; -{ - int r; - message m; - - r= _syscall(VM_PROC_NR, VM_GETDMA, &m); - if (r == 0) - { - *procp= m.VMGD_PROCP; - *basep= m.VMGD_BASEP; - *sizep= m.VMGD_SIZEP; - } - return r; -} - diff --git a/servers/vm/alloc.c b/servers/vm/alloc.c index 3175ba994..fceedfb7d 100644 --- a/servers/vm/alloc.c +++ b/servers/vm/alloc.c @@ -381,195 +381,6 @@ static void free_pages(phys_bytes pageno, int npages) #endif } -#define NR_DMA 16 - -static struct dmatab -{ - int dt_flags; - endpoint_t dt_proc; - phys_bytes dt_base; - phys_bytes dt_size; - phys_clicks dt_seg_base; - phys_clicks dt_seg_size; -} dmatab[NR_DMA]; - -#define DTF_INUSE 1 -#define DTF_RELEASE_DMA 2 -#define DTF_RELEASE_SEG 4 - -/*===========================================================================* - * do_adddma * - *===========================================================================*/ -int do_adddma(message *msg) -{ - endpoint_t target_proc_e; - int i, proc_n; - phys_bytes base, size; - struct vmproc *vmp; - - target_proc_e= msg->VMAD_EP; - base= msg->VMAD_START; - size= msg->VMAD_SIZE; - - /* Find empty slot */ - for (i= 0; i= NR_DMA) - { - printf("vm:do_adddma: dma table full\n"); - for (i= 0; ivm_flags |= VMF_HAS_DMA; - - dmatab[i].dt_flags= DTF_INUSE; - dmatab[i].dt_proc= target_proc_e; - dmatab[i].dt_base= base; - dmatab[i].dt_size= size; - - return OK; -} - -/*===========================================================================* - * do_deldma * - *===========================================================================*/ -int do_deldma(message *msg) -{ - endpoint_t target_proc_e; - int i, j; - phys_bytes base, size; - - target_proc_e= msg->VMDD_EP; - base= msg->VMDD_START; - size= msg->VMDD_SIZE; - - /* Find slot */ - for (i= 0; i= NR_DMA) - { - printf("vm:do_deldma: slot not found\n"); - return ESRCH; - } - - if (dmatab[i].dt_flags & DTF_RELEASE_SEG) - { - /* Check if we have to release the segment */ - for (j= 0; j= NR_DMA) - { - /* Last segment */ - free_mem(dmatab[i].dt_seg_base, - dmatab[i].dt_seg_size); - } - } - - dmatab[i].dt_flags &= ~DTF_INUSE; - - return OK; -} - -/*===========================================================================* - * do_getdma * - *===========================================================================*/ -int do_getdma(message *msg) -{ - int i; - - /* Find slot to report */ - for (i= 0; iVMGD_PROCP= dmatab[i].dt_proc; - msg->VMGD_BASEP= dmatab[i].dt_base; - msg->VMGD_SIZEP= dmatab[i].dt_size; - - return OK; - } - - /* Nothing */ - return EAGAIN; -} - - - -/*===========================================================================* - * release_dma * - *===========================================================================*/ -void release_dma(struct vmproc *vmp) -{ -#if 0 - int i, found_one; - - found_one= FALSE; - for (i= 0; ivm_endpoint) - continue; - dmatab[i].dt_flags |= DTF_RELEASE_DMA | DTF_RELEASE_SEG; - dmatab[i].dt_seg_base= base; - dmatab[i].dt_seg_size= size; - found_one= TRUE; - } - - if (!found_one) - free_mem(base, size); - - msg->VMRD_FOUND = found_one; -#else - panic("release_dma not done"); -#endif - - return; -} - /*===========================================================================* * printmemstats * *===========================================================================*/ diff --git a/servers/vm/exit.c b/servers/vm/exit.c index afb6993dc..894a13193 100644 --- a/servers/vm/exit.c +++ b/servers/vm/exit.c @@ -67,9 +67,7 @@ SANITYCHECK(SCL_FUNCTIONS); return EINVAL; } - if(vmp->vm_flags & VMF_HAS_DMA) { - release_dma(vmp); - } else { + { /* Free pagetable and pages allocated by pt code. */ SANITYCHECK(SCL_DETAIL); free_proc(vmp); diff --git a/servers/vm/fork.c b/servers/vm/fork.c index d42a27c8a..16e4dd116 100644 --- a/servers/vm/fork.c +++ b/servers/vm/fork.c @@ -58,11 +58,6 @@ int do_fork(message *msg) vmc = &vmproc[childproc]; /* child */ assert(vmc->vm_slot == childproc); - if(vmp->vm_flags & VMF_HAS_DMA) { - printf("VM: %d has DMA memory and may not fork\n", msg->VMF_ENDPOINT); - return EINVAL; - } - /* The child is basically a copy of the parent. */ origpt = vmc->vm_pt; *vmc = *vmp; diff --git a/servers/vm/main.c b/servers/vm/main.c index 7eb00c74c..ecf24db85 100644 --- a/servers/vm/main.c +++ b/servers/vm/main.c @@ -391,9 +391,6 @@ void init_vm(void) CALLMAP(VM_FORK, do_fork); CALLMAP(VM_BRK, do_brk); CALLMAP(VM_WILLEXIT, do_willexit); - CALLMAP(VM_ADDDMA, do_adddma); - CALLMAP(VM_DELDMA, do_deldma); - CALLMAP(VM_GETDMA, do_getdma); CALLMAP(VM_NOTIFY_SIG, do_notify_sig); /* Calls from RS */ diff --git a/servers/vm/proto.h b/servers/vm/proto.h index 7bec490aa..eee62dc7c 100644 --- a/servers/vm/proto.h +++ b/servers/vm/proto.h @@ -21,10 +21,6 @@ struct phys_region; void mem_sanitycheck(char *file, int line); phys_clicks alloc_mem(phys_clicks clicks, u32_t flags); struct memlist *alloc_mem_in_list(phys_bytes bytes, u32_t flags); -int do_adddma(message *msg); -int do_deldma(message *msg); -int do_getdma(message *msg); -void release_dma(struct vmproc *vmp); void memstats(int *nodes, int *pages, int *largest); void printmemstats(void); void usedpages_reset(void); diff --git a/servers/vm/vmproc.h b/servers/vm/vmproc.h index b2ee8fd6f..8cb00e155 100644 --- a/servers/vm/vmproc.h +++ b/servers/vm/vmproc.h @@ -49,9 +49,6 @@ struct vmproc { /* Bits for vm_flags */ #define VMF_INUSE 0x001 /* slot contains a process */ #define VMF_EXITING 0x002 /* PM is cleaning up this process */ -#define VMF_HAS_DMA 0x004 /* Process directly or indirectly granted - * DMA buffers. - */ #define VMF_WATCHEXIT 0x008 /* Store in queryexit table */ #endif