Home | History | Annotate | Line # | Download | only in include
cpu.h revision 1.28.2.6
      1  1.28.2.6    skrll /*	$NetBSD: cpu.h,v 1.28.2.6 2005/01/24 08:35:18 skrll Exp $	*/
      2       1.1      oki 
      3       1.1      oki /*
      4       1.1      oki  * Copyright (c) 1982, 1990, 1993
      5       1.1      oki  *	The Regents of the University of California.  All rights reserved.
      6       1.1      oki  *
      7       1.1      oki  * This code is derived from software contributed to Berkeley by
      8       1.1      oki  * the Systems Programming Group of the University of Utah Computer
      9       1.1      oki  * Science Department.
     10       1.1      oki  *
     11       1.1      oki  * Redistribution and use in source and binary forms, with or without
     12       1.1      oki  * modification, are permitted provided that the following conditions
     13       1.1      oki  * are met:
     14       1.1      oki  * 1. Redistributions of source code must retain the above copyright
     15       1.1      oki  *    notice, this list of conditions and the following disclaimer.
     16       1.1      oki  * 2. Redistributions in binary form must reproduce the above copyright
     17       1.1      oki  *    notice, this list of conditions and the following disclaimer in the
     18       1.1      oki  *    documentation and/or other materials provided with the distribution.
     19  1.28.2.1    skrll  * 3. Neither the name of the University nor the names of its contributors
     20  1.28.2.1    skrll  *    may be used to endorse or promote products derived from this software
     21  1.28.2.1    skrll  *    without specific prior written permission.
     22  1.28.2.1    skrll  *
     23  1.28.2.1    skrll  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     24  1.28.2.1    skrll  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     25  1.28.2.1    skrll  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     26  1.28.2.1    skrll  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     27  1.28.2.1    skrll  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     28  1.28.2.1    skrll  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     29  1.28.2.1    skrll  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     30  1.28.2.1    skrll  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     31  1.28.2.1    skrll  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     32  1.28.2.1    skrll  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     33  1.28.2.1    skrll  * SUCH DAMAGE.
     34  1.28.2.1    skrll  *
     35  1.28.2.1    skrll  * from: Utah $Hdr: cpu.h 1.16 91/03/25$
     36  1.28.2.1    skrll  *
     37  1.28.2.1    skrll  *	@(#)cpu.h	8.4 (Berkeley) 1/5/94
     38  1.28.2.1    skrll  */
     39  1.28.2.1    skrll /*
     40  1.28.2.1    skrll  * Copyright (c) 1988 University of Utah.
     41  1.28.2.1    skrll  *
     42  1.28.2.1    skrll  * This code is derived from software contributed to Berkeley by
     43  1.28.2.1    skrll  * the Systems Programming Group of the University of Utah Computer
     44  1.28.2.1    skrll  * Science Department.
     45  1.28.2.1    skrll  *
     46  1.28.2.1    skrll  * Redistribution and use in source and binary forms, with or without
     47  1.28.2.1    skrll  * modification, are permitted provided that the following conditions
     48  1.28.2.1    skrll  * are met:
     49  1.28.2.1    skrll  * 1. Redistributions of source code must retain the above copyright
     50  1.28.2.1    skrll  *    notice, this list of conditions and the following disclaimer.
     51  1.28.2.1    skrll  * 2. Redistributions in binary form must reproduce the above copyright
     52  1.28.2.1    skrll  *    notice, this list of conditions and the following disclaimer in the
     53  1.28.2.1    skrll  *    documentation and/or other materials provided with the distribution.
     54       1.1      oki  * 3. All advertising materials mentioning features or use of this software
     55       1.1      oki  *    must display the following acknowledgement:
     56       1.1      oki  *	This product includes software developed by the University of
     57       1.1      oki  *	California, Berkeley and its contributors.
     58       1.1      oki  * 4. Neither the name of the University nor the names of its contributors
     59       1.1      oki  *    may be used to endorse or promote products derived from this software
     60       1.1      oki  *    without specific prior written permission.
     61       1.1      oki  *
     62       1.1      oki  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     63       1.1      oki  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     64       1.1      oki  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     65       1.1      oki  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     66       1.1      oki  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     67       1.1      oki  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     68       1.1      oki  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     69       1.1      oki  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     70       1.1      oki  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     71       1.1      oki  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     72       1.1      oki  * SUCH DAMAGE.
     73       1.1      oki  *
     74       1.1      oki  * from: Utah $Hdr: cpu.h 1.16 91/03/25$
     75       1.1      oki  *
     76       1.1      oki  *	@(#)cpu.h	8.4 (Berkeley) 1/5/94
     77       1.1      oki  */
     78       1.1      oki 
     79       1.1      oki #ifndef _X68K_CPU_H_
     80       1.1      oki #define	_X68K_CPU_H_
     81       1.1      oki 
     82  1.28.2.5    skrll #if defined(_KERNEL)
     83  1.28.2.5    skrll 
     84       1.1      oki /*
     85       1.1      oki  * Exported definitions unique to x68k/68k cpu support.
     86       1.1      oki  */
     87      1.21  minoura 
     88      1.26      mrg #if defined(_KERNEL_OPT)
     89      1.21  minoura #include "opt_m680x0.h"
     90      1.23  thorpej #include "opt_lockdebug.h"
     91      1.21  minoura #endif
     92       1.1      oki 
     93       1.1      oki /*
     94       1.3  thorpej  * Get common m68k CPU definitions.
     95       1.3  thorpej  */
     96       1.3  thorpej #include <m68k/cpu.h>
     97       1.3  thorpej #define	M68K_MMU_MOTOROLA
     98       1.3  thorpej 
     99       1.3  thorpej /*
    100      1.13  minoura  * Get interrupt glue.
    101      1.13  minoura  */
    102      1.13  minoura #include <machine/intr.h>
    103      1.13  minoura 
    104  1.28.2.4    skrll #include <sys/cpu_data.h>
    105      1.23  thorpej struct cpu_info {
    106  1.28.2.4    skrll 	struct cpu_data ci_data;	/* MI per-cpu data */
    107      1.23  thorpej };
    108      1.23  thorpej 
    109      1.23  thorpej extern struct cpu_info cpu_info_store;
    110      1.23  thorpej 
    111      1.23  thorpej #define	curcpu()			(&cpu_info_store)
    112      1.23  thorpej 
    113      1.13  minoura /*
    114       1.1      oki  * definitions of cpu-dependent requirements
    115       1.1      oki  * referenced in generic code
    116       1.1      oki  */
    117       1.1      oki #define	cpu_swapin(p)			/* nothing */
    118       1.1      oki #define	cpu_swapout(p)			/* nothing */
    119      1.19  thorpej #define	cpu_number()			0
    120       1.1      oki 
    121      1.28  thorpej void	cpu_proc_fork(struct proc *, struct proc *);
    122      1.28  thorpej 
    123       1.1      oki /*
    124       1.1      oki  * Arguments to hardclock and gatherstats encapsulate the previous
    125       1.1      oki  * machine state in an opaque clockframe.  One the x68k, we use
    126       1.1      oki  * what the hardware pushes on an interrupt (frame format 0).
    127       1.1      oki  */
    128       1.1      oki struct clockframe {
    129       1.1      oki 	u_short	sr;		/* sr at time of interrupt */
    130       1.1      oki 	u_long	pc;		/* pc at time of interrupt */
    131       1.1      oki 	u_short	vo;		/* vector offset (4-word frame) */
    132       1.1      oki };
    133       1.1      oki 
    134       1.1      oki #define	CLKF_USERMODE(framep)	(((framep)->sr & PSL_S) == 0)
    135       1.1      oki #define	CLKF_BASEPRI(framep)	(((framep)->sr & PSL_IPL) == 0)
    136       1.1      oki #define	CLKF_PC(framep)		((framep)->pc)
    137       1.1      oki #if 0
    138       1.1      oki /* We would like to do it this way... */
    139       1.1      oki #define	CLKF_INTR(framep)	(((framep)->sr & PSL_M) == 0)
    140       1.1      oki #else
    141       1.1      oki /* but until we start using PSL_M, we have to do this instead */
    142       1.1      oki #define	CLKF_INTR(framep)	(0)	/* XXX */
    143       1.1      oki #endif
    144       1.1      oki 
    145       1.1      oki 
    146       1.1      oki /*
    147       1.1      oki  * Preempt the current process if in interrupt from user mode,
    148       1.1      oki  * or after the current trap/syscall if in system mode.
    149       1.1      oki  */
    150       1.8   scottr extern int want_resched;	/* resched() was called */
    151      1.24  thorpej #define	need_resched(ci)	{ want_resched++; aston(); }
    152       1.1      oki 
    153       1.1      oki /*
    154       1.1      oki  * Give a profiling tick to the current process when the user profiling
    155       1.1      oki  * buffer pages are invalid.  On the x68k, request an ast to send us
    156       1.1      oki  * through trap, marking the proc as needing a profiling tick.
    157       1.1      oki  */
    158       1.1      oki #define	need_proftick(p)	{ (p)->p_flag |= P_OWEUPC; aston(); }
    159       1.1      oki 
    160       1.1      oki /*
    161       1.1      oki  * Notify the current process (p) that it has a signal pending,
    162       1.1      oki  * process as soon as possible.
    163       1.1      oki  */
    164       1.1      oki #define	signotify(p)	aston()
    165       1.1      oki 
    166       1.8   scottr extern int astpending;		/* need to trap before returning to user mode */
    167       1.1      oki #define aston() (astpending++)
    168      1.23  thorpej 
    169      1.23  thorpej #endif /* _KERNEL */
    170       1.1      oki 
    171       1.1      oki /*
    172       1.1      oki  * CTL_MACHDEP definitions.
    173       1.1      oki  */
    174       1.1      oki #define	CPU_CONSDEV		1	/* dev_t: console terminal device */
    175       1.1      oki #define	CPU_MAXID		2	/* number of valid machdep ids */
    176       1.1      oki 
    177       1.1      oki #define CTL_MACHDEP_NAMES { \
    178       1.1      oki 	{ 0, 0 }, \
    179       1.1      oki 	{ "console_device", CTLTYPE_STRUCT }, \
    180       1.1      oki }
    181       1.1      oki 
    182       1.1      oki /*
    183      1.13  minoura  * The rest of this should probably be moved to <machine/x68kcpu.h>
    184       1.1      oki  * although some of it could probably be put into generic 68k headers.
    185       1.1      oki  */
    186       1.1      oki 
    187       1.1      oki #ifdef _KERNEL
    188       1.3  thorpej extern int machineid;
    189       1.1      oki extern char *intiolimit;
    190       1.2      oki 
    191       1.6      oki /* autoconf.c functions */
    192  1.28.2.6    skrll void	config_console(void);
    193       1.4      oki 
    194       1.6      oki /* fpu.c functions */
    195  1.28.2.6    skrll int	fpu_probe(void);
    196       1.2      oki 
    197       1.6      oki /* machdep.c functions */
    198  1.28.2.6    skrll void	dumpconf(void);
    199  1.28.2.6    skrll void	dumpsys(void);
    200       1.2      oki 
    201       1.6      oki /* locore.s functions */
    202       1.2      oki struct pcb;
    203       1.2      oki struct fpframe;
    204  1.28.2.6    skrll int	suline(caddr_t, caddr_t);
    205  1.28.2.6    skrll void	savectx(struct pcb *);
    206  1.28.2.6    skrll void	switch_exit(struct lwp *);
    207  1.28.2.6    skrll void	switch_lwp_exit(struct lwp *);
    208  1.28.2.6    skrll void	proc_trampoline(void);
    209  1.28.2.6    skrll void	loadustp(int);
    210  1.28.2.6    skrll void	m68881_save(struct fpframe *);
    211  1.28.2.6    skrll void	m68881_restore(struct fpframe *);
    212      1.17  minoura 
    213      1.17  minoura /* machdep.c functions */
    214  1.28.2.6    skrll int	badaddr(caddr_t);
    215  1.28.2.6    skrll int	badbaddr(caddr_t);
    216       1.2      oki 
    217       1.6      oki /* sys_machdep.c functions */
    218  1.28.2.6    skrll int	cachectl1(unsigned long, vaddr_t, size_t, struct proc *);
    219  1.28.2.6    skrll int	dma_cachectl(caddr_t, int);
    220       1.2      oki 
    221       1.6      oki /* vm_machdep.c functions */
    222  1.28.2.6    skrll void	physaccess(caddr_t, caddr_t, int, int);
    223  1.28.2.6    skrll void	physunaccess(caddr_t, int);
    224  1.28.2.6    skrll int	kvtop(caddr_t);
    225       1.2      oki 
    226       1.1      oki #endif
    227       1.1      oki 
    228       1.1      oki /* physical memory sections */
    229       1.1      oki #define INTIOBASE	(0x00C00000)
    230       1.1      oki #define INTIOTOP	(0x01000000)
    231       1.1      oki 
    232       1.1      oki /*
    233       1.1      oki  * Internal IO space:
    234       1.1      oki  *
    235       1.1      oki  * Ranges from 0xC00000 to 0x1000000 (IIOMAPSIZE).
    236       1.1      oki  *
    237       1.1      oki  * Internal IO space is mapped in the kernel from ``IODEVbase'' to
    238       1.1      oki  * ``intiolimit'' (defined in locore.s).  Since it is always mapped,
    239       1.1      oki  * conversion between physical and kernel virtual addresses is easy.
    240       1.1      oki  */
    241       1.1      oki #define	IIOPOFF(pa)	((int)(pa)-INTIOBASE)
    242       1.1      oki #define	IIOMAPSIZE	btoc(INTIOTOP-INTIOBASE)	/* 4mb */
    243       1.1      oki 
    244       1.1      oki #endif /* _X68K_CPU_H_ */
    245