version 1.140.2.3, 2007/10/03 19:23:51 |
version 1.141, 2007/05/17 14:51:22 |
|
|
|
|
#ifdef _KERNEL |
#ifdef _KERNEL |
#if defined(_KERNEL_OPT) |
#if defined(_KERNEL_OPT) |
|
#include "opt_enhanced_speedstep.h" |
#include "opt_multiprocessor.h" |
#include "opt_multiprocessor.h" |
#include "opt_math_emulate.h" |
#include "opt_math_emulate.h" |
#include "opt_user_ldt.h" |
#include "opt_user_ldt.h" |
|
|
#include <x86/via_padlock.h> |
#include <x86/via_padlock.h> |
|
|
#include <sys/device.h> |
#include <sys/device.h> |
|
#include <sys/simplelock.h> /* will also get LOCKDEBUG */ |
#include <sys/cpu_data.h> |
#include <sys/cpu_data.h> |
#include <sys/cc_microtime.h> |
#include <sys/cc_microtime.h> |
|
|
|
|
struct cpu_info { |
struct cpu_info { |
struct device *ci_dev; /* pointer to our device */ |
struct device *ci_dev; /* pointer to our device */ |
struct cpu_info *ci_self; /* self-pointer */ |
struct cpu_info *ci_self; /* self-pointer */ |
|
void *ci_self150; /* self + 0x150, see lock_stubs.S */ |
void *ci_tlog_base; /* Trap log base */ |
void *ci_tlog_base; /* Trap log base */ |
int32_t ci_tlog_offset; /* Trap log current offset */ |
int32_t ci_tlog_offset; /* Trap log current offset */ |
|
struct cpu_info *ci_next; /* next cpu */ |
|
|
/* |
/* |
* Will be accessed by other CPUs. |
* Public members. |
*/ |
*/ |
struct cpu_info *ci_next; /* next cpu */ |
|
struct lwp *ci_curlwp; /* current owner of the processor */ |
struct lwp *ci_curlwp; /* current owner of the processor */ |
struct pmap_cpu *ci_pmap_cpu; /* per-CPU pmap data */ |
struct simplelock ci_slock; /* lock on this data structure */ |
struct lwp *ci_fpcurlwp; /* current owner of the FPU */ |
|
int ci_fpsaving; /* save in progress */ |
|
cpuid_t ci_cpuid; /* our CPU ID */ |
cpuid_t ci_cpuid; /* our CPU ID */ |
int ci_cpumask; /* (1 << CPU ID) */ |
|
u_int ci_apicid; /* our APIC ID */ |
u_int ci_apicid; /* our APIC ID */ |
struct cpu_data ci_data; /* MI per-cpu data */ |
struct cpu_data ci_data; /* MI per-cpu data */ |
struct cc_microtime_state ci_cc;/* cc_microtime state */ |
struct cc_microtime_state ci_cc;/* cc_microtime state */ |
Line 91 struct cpu_info { |
|
Line 91 struct cpu_info { |
|
/* |
/* |
* Private members. |
* Private members. |
*/ |
*/ |
struct evcnt ci_tlb_evcnt; /* tlb shootdown counter */ |
struct lwp *ci_fpcurlwp; /* current owner of the FPU */ |
|
int ci_fpsaving; /* save in progress */ |
|
|
|
volatile uint32_t ci_tlb_ipi_mask; |
|
|
struct pmap *ci_pmap; /* current pmap */ |
struct pmap *ci_pmap; /* current pmap */ |
int ci_need_tlbwait; /* need to wait for TLB invalidations */ |
|
int ci_want_pmapload; /* pmap_load() is needed */ |
int ci_want_pmapload; /* pmap_load() is needed */ |
int ci_tlbstate; /* one of TLBSTATE_ states. see below */ |
int ci_tlbstate; /* one of TLBSTATE_ states. see below */ |
#define TLBSTATE_VALID 0 /* all user tlbs are valid */ |
#define TLBSTATE_VALID 0 /* all user tlbs are valid */ |
Line 113 struct cpu_info { |
|
Line 116 struct cpu_info { |
|
#define ci_ilevel ci_istate.ilevel |
#define ci_ilevel ci_istate.ilevel |
|
|
int ci_idepth; |
int ci_idepth; |
void * ci_intrstack; |
|
uint32_t ci_imask[NIPL]; |
uint32_t ci_imask[NIPL]; |
uint32_t ci_iunmask[NIPL]; |
uint32_t ci_iunmask[NIPL]; |
|
void * ci_intrstack; |
|
|
paddr_t ci_idle_pcb_paddr; /* PA of idle PCB */ |
paddr_t ci_idle_pcb_paddr; /* PA of idle PCB */ |
uint32_t ci_flags; /* flags; see below */ |
uint32_t ci_flags; /* flags; see below */ |
Line 140 struct cpu_info { |
|
Line 143 struct cpu_info { |
|
void (*ci_info)(struct cpu_info *); |
void (*ci_info)(struct cpu_info *); |
|
|
int ci_want_resched; |
int ci_want_resched; |
|
int ci_astpending; |
struct trapframe *ci_ddb_regs; |
struct trapframe *ci_ddb_regs; |
|
|
u_int ci_cflush_lsize; /* CFLUSH insn line size */ |
u_int ci_cflush_lsize; /* CFLUSH insn line size */ |
Line 190 extern struct cpu_info *cpu_info_list; |
|
Line 194 extern struct cpu_info *cpu_info_list; |
|
#define CPU_INFO_FOREACH(cii, ci) cii = 0, ci = cpu_info_list; \ |
#define CPU_INFO_FOREACH(cii, ci) cii = 0, ci = cpu_info_list; \ |
ci != NULL; ci = ci->ci_next |
ci != NULL; ci = ci->ci_next |
|
|
|
#if defined(MULTIPROCESSOR) |
|
|
#define X86_MAXPROCS 32 /* because we use a bitmask */ |
#define X86_MAXPROCS 32 /* because we use a bitmask */ |
|
|
#define CPU_STARTUP(_ci) ((_ci)->ci_func->start(_ci)) |
#define CPU_STARTUP(_ci) ((_ci)->ci_func->start(_ci)) |
#define CPU_STOP(_ci) ((_ci)->ci_func->stop(_ci)) |
#define CPU_STOP(_ci) ((_ci)->ci_func->stop(_ci)) |
#define CPU_START_CLEANUP(_ci) ((_ci)->ci_func->cleanup(_ci)) |
#define CPU_START_CLEANUP(_ci) ((_ci)->ci_func->cleanup(_ci)) |
|
|
#if defined(__GNUC__) && defined(_KERNEL) |
static struct cpu_info *curcpu(void); |
static struct cpu_info *x86_curcpu(void); |
|
static lwp_t *x86_curlwp(void); |
|
|
|
__inline static struct cpu_info * __attribute__((__unused__)) |
__inline static struct cpu_info * __attribute__((__unused__)) |
x86_curcpu(void) |
curcpu() |
{ |
{ |
struct cpu_info *ci; |
struct cpu_info *ci; |
|
|
Line 212 x86_curcpu(void) |
|
Line 216 x86_curcpu(void) |
|
return ci; |
return ci; |
} |
} |
|
|
__inline static lwp_t * __attribute__((__unused__)) |
|
x86_curlwp(void) |
|
{ |
|
lwp_t *l; |
|
|
|
__asm volatile("movl %%fs:%1, %0" : |
|
"=r" (l) : |
|
"m" |
|
(*(struct cpu_info * const *)offsetof(struct cpu_info, ci_curlwp))); |
|
return l; |
|
} |
|
#else /* __GNUC__ && _KERNEL */ |
|
/* For non-GCC and LKMs */ |
|
struct cpu_info *x86_curcpu(void); |
|
lwp_t *x86_curlwp(void); |
|
#endif /* __GNUC__ && _KERNEL */ |
|
|
|
#define cpu_number() (curcpu()->ci_cpuid) |
#define cpu_number() (curcpu()->ci_cpuid) |
|
|
#define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY) |
#define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CPUF_PRIMARY) |
Line 240 extern struct cpu_info *cpu_info[X86_MAX |
|
Line 227 extern struct cpu_info *cpu_info[X86_MAX |
|
void cpu_boot_secondary_processors(void); |
void cpu_boot_secondary_processors(void); |
void cpu_init_idle_lwps(void); |
void cpu_init_idle_lwps(void); |
|
|
|
#else /* !MULTIPROCESSOR */ |
|
|
|
#define X86_MAXPROCS 1 |
|
#define curcpu() (&cpu_info_primary) |
|
|
|
/* |
|
* definitions of cpu-dependent requirements |
|
* referenced in generic code |
|
*/ |
|
#define cpu_number() 0 |
|
#define CPU_IS_PRIMARY(ci) 1 |
|
|
|
#define aston(l) ((l)->l_md.md_astpending = 1) |
|
|
|
#endif /* MULTIPROCESSOR */ |
|
|
extern uint32_t cpus_attached; |
extern uint32_t cpus_attached; |
|
|
#define curcpu() x86_curcpu() |
#define curlwp curcpu()->ci_curlwp |
#define curlwp x86_curlwp() |
|
#define curpcb (&curlwp->l_addr->u_pcb) |
#define curpcb (&curlwp->l_addr->u_pcb) |
|
|
/* |
/* |
Line 337 int cpu_maxproc(void); |
|
Line 339 int cpu_maxproc(void); |
|
void cpu_reset(void); |
void cpu_reset(void); |
void i386_proc0_tss_ldt_init(void); |
void i386_proc0_tss_ldt_init(void); |
|
|
|
/* identcpu.c */ |
|
#ifdef ENHANCED_SPEEDSTEP |
|
extern int bus_clock; |
|
#endif |
extern int tmx86_has_longrun; |
extern int tmx86_has_longrun; |
extern u_int crusoe_longrun; |
extern u_int crusoe_longrun; |
extern u_int crusoe_frequency; |
extern u_int crusoe_frequency; |
Line 406 void x86_bus_space_mallocok(void); |
|
Line 412 void x86_bus_space_mallocok(void); |
|
|
|
#include <machine/psl.h> /* Must be after struct cpu_info declaration */ |
#include <machine/psl.h> /* Must be after struct cpu_info declaration */ |
|
|
|
/* est.c */ |
|
void est_init(int); |
|
|
#endif /* _KERNEL */ |
#endif /* _KERNEL */ |
|
|
/* |
/* |