Home | History | Annotate | Line # | Download | only in include
cpu.h revision 1.7
      1  1.7     yamt /*	$NetBSD: cpu.h,v 1.7 2007/05/17 14:51:11 yamt Exp $	*/
      2  1.2    bjh21 
      3  1.2    bjh21 /*-
      4  1.2    bjh21  * Copyright (c) 2002 Ben Harris
      5  1.2    bjh21  * All rights reserved.
      6  1.2    bjh21  *
      7  1.2    bjh21  * Redistribution and use in source and binary forms, with or without
      8  1.2    bjh21  * modification, are permitted provided that the following conditions
      9  1.2    bjh21  * are met:
     10  1.2    bjh21  * 1. Redistributions of source code must retain the above copyright
     11  1.2    bjh21  *    notice, this list of conditions and the following disclaimer.
     12  1.2    bjh21  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.2    bjh21  *    notice, this list of conditions and the following disclaimer in the
     14  1.2    bjh21  *    documentation and/or other materials provided with the distribution.
     15  1.2    bjh21  * 3. The name of the author may not be used to endorse or promote products
     16  1.2    bjh21  *    derived from this software without specific prior written permission.
     17  1.2    bjh21  *
     18  1.2    bjh21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19  1.2    bjh21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20  1.2    bjh21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21  1.2    bjh21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22  1.2    bjh21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     23  1.2    bjh21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     24  1.2    bjh21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     25  1.2    bjh21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26  1.2    bjh21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27  1.2    bjh21  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28  1.2    bjh21  */
     29  1.2    bjh21 
     30  1.2    bjh21 #if defined(_KERNEL) && defined(_KERNEL_OPT) && !defined(_LOCORE)
     31  1.2    bjh21 #include "opt_multiprocessor.h"
     32  1.2    bjh21 
     33  1.2    bjh21 #ifdef MULTIPROCESSOR
     34  1.2    bjh21 void	cpu_boot_secondary_processors(void);
     35  1.2    bjh21 
     36  1.2    bjh21 #define MP_CPU_INFO_MEMBERS						\
     37  1.6    bjh21 	cpuid_t ci_cpuid;						\
     38  1.4    bjh21 	struct proc *ci_curproc;					\
     39  1.7     yamt 	struct pcb *ci_curpcb;
     40  1.2    bjh21 
     41  1.3    bjh21 #define CPU_MAXNUM 8
     42  1.3    bjh21 
     43  1.3    bjh21 extern struct cpu_info *cpu_info[];
     44  1.3    bjh21 
     45  1.6    bjh21 #define CPU_IS_PRIMARY(ci)	((ci)->ci_cpuid == 0)
     46  1.2    bjh21 extern cpuid_t cpu_number(void);
     47  1.3    bjh21 #define curcpu()		(cpu_info[cpu_number()])
     48  1.3    bjh21 
     49  1.3    bjh21 extern cpuid_t cpu_next(cpuid_t);
     50  1.3    bjh21 
     51  1.3    bjh21 #define CPU_INFO_ITERATOR cpuid_t
     52  1.3    bjh21 #define CPU_INFO_FOREACH(cii, ci)					\
     53  1.3    bjh21 	cii = 0, ci = cpu_info[0];					\
     54  1.3    bjh21 	cii < CPU_MAXNUM;						\
     55  1.3    bjh21 	cii = cpu_next(cii), ci = cpu_info[cii]
     56  1.2    bjh21 
     57  1.2    bjh21 #endif /* MULTIPROCESSOR */
     58  1.2    bjh21 #endif /* _KERNEL && _KERNEL_OPT && !_LOCORE */
     59  1.1  reinoud 
     60  1.1  reinoud #include <arm/cpu.h>
     61