Home | History | Annotate | Line # | Download | only in arm32
sys_machdep.c revision 1.1
      1  1.1  matt /*	$NetBSD: sys_machdep.c,v 1.1 2001/03/04 05:08:43 matt Exp $	*/
      2  1.1  matt 
      3  1.1  matt /*
      4  1.1  matt  * Copyright (c) 1995-1997 Mark Brinicombe.
      5  1.1  matt  * All rights reserved.
      6  1.1  matt  *
      7  1.1  matt  * Redistribution and use in source and binary forms, with or without
      8  1.1  matt  * modification, are permitted provided that the following conditions
      9  1.1  matt  * are met:
     10  1.1  matt  * 1. Redistributions of source code must retain the above copyright
     11  1.1  matt  *    notice, this list of conditions and the following disclaimer.
     12  1.1  matt  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  matt  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  matt  *    documentation and/or other materials provided with the distribution.
     15  1.1  matt  * 3. All advertising materials mentioning features or use of this software
     16  1.1  matt  *    must display the following acknowledgement:
     17  1.1  matt  *	This product includes software developed by Mark Brinicombe
     18  1.1  matt  * 4. The name of the company nor the name of the author may be used to
     19  1.1  matt  *    endorse or promote products derived from this software without specific
     20  1.1  matt  *    prior written permission.
     21  1.1  matt  *
     22  1.1  matt  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
     23  1.1  matt  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     24  1.1  matt  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  1.1  matt  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     26  1.1  matt  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     27  1.1  matt  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     28  1.1  matt  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.1  matt  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.1  matt  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1  matt  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1  matt  * SUCH DAMAGE.
     33  1.1  matt  *
     34  1.1  matt  * RiscBSD kernel project
     35  1.1  matt  *
     36  1.1  matt  * sys_machdep.c
     37  1.1  matt  *
     38  1.1  matt  * Machine dependant syscalls
     39  1.1  matt  *
     40  1.1  matt  * Created      : 10/01/96
     41  1.1  matt  */
     42  1.1  matt 
     43  1.1  matt #include <sys/param.h>
     44  1.1  matt #include <sys/systm.h>
     45  1.1  matt #include <sys/proc.h>
     46  1.1  matt #include <sys/mbuf.h>
     47  1.1  matt #include <sys/mount.h>
     48  1.1  matt #include <uvm/uvm_extern.h>
     49  1.1  matt #include <sys/sysctl.h>
     50  1.1  matt #include <sys/syscallargs.h>
     51  1.1  matt 
     52  1.1  matt #include <machine/sysarch.h>
     53  1.1  matt 
     54  1.1  matt static int
     55  1.1  matt arm32_sync_icache(p, args, retval)
     56  1.1  matt 	struct proc *p;
     57  1.1  matt 	char *args;
     58  1.1  matt 	register_t *retval;
     59  1.1  matt {
     60  1.1  matt 	struct arm32_sync_icache_args ua;
     61  1.1  matt 	int error;
     62  1.1  matt 
     63  1.1  matt 	if ((error = copyin(args, &ua, sizeof(ua))) != 0)
     64  1.1  matt 		return (error);
     65  1.1  matt 
     66  1.1  matt 	cpu_cache_syncI_rng(ua.addr, ua.len);
     67  1.1  matt 
     68  1.1  matt 	*retval = 0;
     69  1.1  matt 	return(0);
     70  1.1  matt }
     71  1.1  matt 
     72  1.1  matt static int
     73  1.1  matt arm32_drain_writebuf(p, args, retval)
     74  1.1  matt 	struct proc *p;
     75  1.1  matt 	char *args;
     76  1.1  matt 	register_t *retval;
     77  1.1  matt {
     78  1.1  matt 	/* No args. */
     79  1.1  matt 
     80  1.1  matt 	cpu_drain_writebuf();
     81  1.1  matt 
     82  1.1  matt 	*retval = 0;
     83  1.1  matt 	return(0);
     84  1.1  matt }
     85  1.1  matt 
     86  1.1  matt int
     87  1.1  matt sys_sysarch(p, v, retval)
     88  1.1  matt 	struct proc *p;
     89  1.1  matt 	void *v;
     90  1.1  matt 	register_t *retval;
     91  1.1  matt {
     92  1.1  matt 	struct sys_sysarch_args /* {
     93  1.1  matt 		syscallarg(int) op;
     94  1.1  matt 		syscallarg(void *) parms;
     95  1.1  matt 	} */ *uap = v;
     96  1.1  matt 	int error = 0;
     97  1.1  matt 
     98  1.1  matt 	switch(SCARG(uap, op)) {
     99  1.1  matt 	case ARM32_SYNC_ICACHE :
    100  1.1  matt 		error = arm32_sync_icache(p, SCARG(uap, parms), retval);
    101  1.1  matt 		break;
    102  1.1  matt 
    103  1.1  matt 	case ARM32_DRAIN_WRITEBUF :
    104  1.1  matt 		error = arm32_drain_writebuf(p, SCARG(uap, parms), retval);
    105  1.1  matt 		break;
    106  1.1  matt 
    107  1.1  matt 	default:
    108  1.1  matt 		error = EINVAL;
    109  1.1  matt 		break;
    110  1.1  matt 	}
    111  1.1  matt 	return (error);
    112  1.1  matt }
    113  1.1  matt 
    114  1.1  matt /* End of sys_machdep.c */
    115