Home | History | Annotate | Line # | Download | only in include
cpu.h revision 1.49.4.2
      1  1.49.4.2     rmind /*	$NetBSD: cpu.h,v 1.49.4.2 2011/03/05 20:52:23 rmind Exp $	*/
      2       1.1       oki 
      3       1.1       oki /*
      4  1.49.4.2     rmind  * Copyright (c) 1988 University of Utah.
      5       1.1       oki  * Copyright (c) 1982, 1990, 1993
      6       1.1       oki  *	The Regents of the University of California.  All rights reserved.
      7      1.29       agc  *
      8      1.29       agc  * This code is derived from software contributed to Berkeley by
      9      1.29       agc  * the Systems Programming Group of the University of Utah Computer
     10      1.29       agc  * Science Department.
     11      1.29       agc  *
     12      1.29       agc  * Redistribution and use in source and binary forms, with or without
     13      1.29       agc  * modification, are permitted provided that the following conditions
     14      1.29       agc  * are met:
     15      1.29       agc  * 1. Redistributions of source code must retain the above copyright
     16      1.29       agc  *    notice, this list of conditions and the following disclaimer.
     17      1.29       agc  * 2. Redistributions in binary form must reproduce the above copyright
     18      1.29       agc  *    notice, this list of conditions and the following disclaimer in the
     19      1.29       agc  *    documentation and/or other materials provided with the distribution.
     20      1.29       agc  * 3. Neither the name of the University nor the names of its contributors
     21      1.29       agc  *    may be used to endorse or promote products derived from this software
     22      1.29       agc  *    without specific prior written permission.
     23      1.29       agc  *
     24      1.29       agc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25      1.29       agc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26      1.29       agc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27      1.29       agc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28      1.29       agc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29      1.29       agc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30      1.29       agc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31      1.29       agc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32      1.29       agc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33      1.29       agc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34      1.29       agc  * SUCH DAMAGE.
     35      1.29       agc  *
     36      1.29       agc  * from: Utah $Hdr: cpu.h 1.16 91/03/25$
     37      1.29       agc  *
     38      1.29       agc  *	@(#)cpu.h	8.4 (Berkeley) 1/5/94
     39      1.29       agc  */
     40       1.1       oki 
     41       1.1       oki #ifndef _X68K_CPU_H_
     42       1.1       oki #define	_X68K_CPU_H_
     43       1.1       oki 
     44      1.32      yamt #if defined(_KERNEL)
     45      1.32      yamt 
     46       1.1       oki /*
     47       1.1       oki  * Exported definitions unique to x68k/68k cpu support.
     48       1.1       oki  */
     49      1.21   minoura 
     50      1.26       mrg #if defined(_KERNEL_OPT)
     51  1.49.4.1     rmind #include "opt_m68k_arch.h"
     52      1.23   thorpej #include "opt_lockdebug.h"
     53      1.21   minoura #endif
     54       1.1       oki 
     55       1.1       oki /*
     56       1.3   thorpej  * Get common m68k CPU definitions.
     57       1.3   thorpej  */
     58       1.3   thorpej #include <m68k/cpu.h>
     59       1.3   thorpej #define	M68K_MMU_MOTOROLA
     60       1.3   thorpej 
     61       1.3   thorpej /*
     62      1.13   minoura  * Get interrupt glue.
     63      1.13   minoura  */
     64      1.13   minoura #include <machine/intr.h>
     65      1.13   minoura 
     66       1.1       oki /*
     67       1.1       oki  * Arguments to hardclock and gatherstats encapsulate the previous
     68       1.1       oki  * machine state in an opaque clockframe.  One the x68k, we use
     69       1.1       oki  * what the hardware pushes on an interrupt (frame format 0).
     70       1.1       oki  */
     71       1.1       oki struct clockframe {
     72       1.1       oki 	u_short	sr;		/* sr at time of interrupt */
     73       1.1       oki 	u_long	pc;		/* pc at time of interrupt */
     74       1.1       oki 	u_short	vo;		/* vector offset (4-word frame) */
     75       1.1       oki };
     76       1.1       oki 
     77       1.1       oki #define	CLKF_USERMODE(framep)	(((framep)->sr & PSL_S) == 0)
     78       1.1       oki #define	CLKF_PC(framep)		((framep)->pc)
     79       1.1       oki #if 0
     80       1.1       oki /* We would like to do it this way... */
     81       1.1       oki #define	CLKF_INTR(framep)	(((framep)->sr & PSL_M) == 0)
     82       1.1       oki #else
     83       1.1       oki /* but until we start using PSL_M, we have to do this instead */
     84       1.1       oki #define	CLKF_INTR(framep)	(0)	/* XXX */
     85       1.1       oki #endif
     86       1.1       oki 
     87       1.1       oki 
     88       1.1       oki /*
     89       1.1       oki  * Preempt the current process if in interrupt from user mode,
     90       1.1       oki  * or after the current trap/syscall if in system mode.
     91       1.1       oki  */
     92      1.39     isaki #define	cpu_need_resched(ci, flags)	\
     93      1.39     isaki 	do { (ci)->ci_want_resched = 1; aston(); } while (/* CONSTCOND */ 0)
     94       1.1       oki 
     95       1.1       oki /*
     96       1.1       oki  * Give a profiling tick to the current process when the user profiling
     97       1.1       oki  * buffer pages are invalid.  On the x68k, request an ast to send us
     98       1.1       oki  * through trap, marking the proc as needing a profiling tick.
     99       1.1       oki  */
    100      1.40     isaki #define	cpu_need_proftick(l)	\
    101      1.40     isaki 	do { (l)->l_pflag |= LP_OWEUPC; aston(); } while (/* CONSTCOND */ 0)
    102       1.1       oki 
    103       1.1       oki /*
    104       1.1       oki  * Notify the current process (p) that it has a signal pending,
    105       1.1       oki  * process as soon as possible.
    106       1.1       oki  */
    107      1.36        ad #define	cpu_signotify(l)	aston()
    108       1.1       oki 
    109       1.8    scottr extern int astpending;		/* need to trap before returning to user mode */
    110       1.1       oki #define aston() (astpending++)
    111      1.23   thorpej 
    112      1.23   thorpej #endif /* _KERNEL */
    113       1.1       oki 
    114       1.1       oki /*
    115       1.1       oki  * CTL_MACHDEP definitions.
    116       1.1       oki  */
    117       1.1       oki #define	CPU_CONSDEV		1	/* dev_t: console terminal device */
    118       1.1       oki #define	CPU_MAXID		2	/* number of valid machdep ids */
    119       1.1       oki 
    120       1.1       oki /*
    121      1.13   minoura  * The rest of this should probably be moved to <machine/x68kcpu.h>
    122       1.1       oki  * although some of it could probably be put into generic 68k headers.
    123       1.1       oki  */
    124       1.1       oki 
    125       1.1       oki #ifdef _KERNEL
    126       1.3   thorpej extern int machineid;
    127      1.46     isaki extern char *intiobase;
    128       1.1       oki extern char *intiolimit;
    129       1.2       oki 
    130       1.6       oki /* fpu.c functions */
    131      1.33       chs int	fpu_probe(void);
    132       1.2       oki 
    133       1.6       oki /* machdep.c functions */
    134      1.33       chs void	dumpsys(void);
    135       1.2       oki 
    136       1.6       oki /* locore.s functions */
    137       1.2       oki struct fpframe;
    138      1.38  christos int	suline(void *, void *);
    139      1.33       chs void	loadustp(int);
    140      1.33       chs void	m68881_save(struct fpframe *);
    141      1.33       chs void	m68881_restore(struct fpframe *);
    142      1.17   minoura 
    143      1.17   minoura /* machdep.c functions */
    144      1.34        he int	badaddr(volatile void*);
    145      1.34        he int	badbaddr(volatile void*);
    146       1.2       oki 
    147       1.1       oki #endif
    148       1.1       oki 
    149       1.1       oki /* physical memory sections */
    150       1.1       oki #define INTIOBASE	(0x00C00000)
    151       1.1       oki #define INTIOTOP	(0x01000000)
    152       1.1       oki 
    153       1.1       oki /*
    154       1.1       oki  * Internal IO space:
    155       1.1       oki  *
    156       1.1       oki  * Ranges from 0xC00000 to 0x1000000 (IIOMAPSIZE).
    157       1.1       oki  *
    158       1.1       oki  * Internal IO space is mapped in the kernel from ``IODEVbase'' to
    159       1.1       oki  * ``intiolimit'' (defined in locore.s).  Since it is always mapped,
    160       1.1       oki  * conversion between physical and kernel virtual addresses is easy.
    161       1.1       oki  */
    162      1.47     isaki #define	IIOV(pa)	((u_int)(pa) - INTIOBASE + (u_int)intiobase)
    163      1.47     isaki #define	IIOP(va)	((u_int)(va) - (u_int)intiobase + INTIOBASE)
    164       1.1       oki #define	IIOPOFF(pa)	((int)(pa)-INTIOBASE)
    165       1.1       oki #define	IIOMAPSIZE	btoc(INTIOTOP-INTIOBASE)	/* 4mb */
    166       1.1       oki 
    167       1.1       oki #endif /* _X68K_CPU_H_ */
    168