Home | History | Annotate | Line # | Download | only in include
cpu.h revision 1.1
      1  1.1  ad /*	$NetBSD: cpu.h,v 1.1 2008/05/11 15:32:20 ad Exp $	*/
      2  1.1  ad 
      3  1.1  ad /*-
      4  1.1  ad  * Copyright (c) 1990 The Regents of the University of California.
      5  1.1  ad  * All rights reserved.
      6  1.1  ad  *
      7  1.1  ad  * This code is derived from software contributed to Berkeley by
      8  1.1  ad  * William Jolitz.
      9  1.1  ad  *
     10  1.1  ad  * Redistribution and use in source and binary forms, with or without
     11  1.1  ad  * modification, are permitted provided that the following conditions
     12  1.1  ad  * are met:
     13  1.1  ad  * 1. Redistributions of source code must retain the above copyright
     14  1.1  ad  *    notice, this list of conditions and the following disclaimer.
     15  1.1  ad  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1  ad  *    notice, this list of conditions and the following disclaimer in the
     17  1.1  ad  *    documentation and/or other materials provided with the distribution.
     18  1.1  ad  * 3. Neither the name of the University nor the names of its contributors
     19  1.1  ad  *    may be used to endorse or promote products derived from this software
     20  1.1  ad  *    without specific prior written permission.
     21  1.1  ad  *
     22  1.1  ad  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23  1.1  ad  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24  1.1  ad  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25  1.1  ad  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26  1.1  ad  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27  1.1  ad  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28  1.1  ad  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  1.1  ad  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  1.1  ad  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  1.1  ad  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  1.1  ad  * SUCH DAMAGE.
     33  1.1  ad  *
     34  1.1  ad  *	@(#)cpu.h	5.4 (Berkeley) 5/9/91
     35  1.1  ad  */
     36  1.1  ad 
     37  1.1  ad #ifndef _X86_CPU_H_
     38  1.1  ad #define _X86_CPU_H_
     39  1.1  ad 
     40  1.1  ad #ifdef _KERNEL
     41  1.1  ad #if defined(_KERNEL_OPT)
     42  1.1  ad #include "opt_xen.h"
     43  1.1  ad #ifdef i386
     44  1.1  ad #include "opt_user_ldt.h"
     45  1.1  ad #include "opt_vm86.h"
     46  1.1  ad #endif
     47  1.1  ad #endif
     48  1.1  ad 
     49  1.1  ad /*
     50  1.1  ad  * Definitions unique to x86 cpu support.
     51  1.1  ad  */
     52  1.1  ad #include <machine/frame.h>
     53  1.1  ad #include <machine/segments.h>
     54  1.1  ad #include <machine/tss.h>
     55  1.1  ad #include <machine/intrdefs.h>
     56  1.1  ad 
     57  1.1  ad #include <x86/cacheinfo.h>
     58  1.1  ad #include <x86/via_padlock.h>
     59  1.1  ad 
     60  1.1  ad #include <sys/cpu_data.h>
     61  1.1  ad 
     62  1.1  ad #include <lib/libkern/libkern.h>	/* offsetof */
     63  1.1  ad 
     64  1.1  ad struct intrsource;
     65  1.1  ad struct pmap;
     66  1.1  ad struct device;
     67  1.1  ad 
     68  1.1  ad #ifdef __x86_64__
     69  1.1  ad #define	i386tss	x86_64_tss
     70  1.1  ad #endif
     71  1.1  ad 
     72  1.1  ad #define	NIOPORTS	1024		/* # of ports we allow to be mapped */
     73  1.1  ad #define	IOMAPSIZE	(NIOPORTS / 8)	/* I/O bitmap size in bytes */
     74  1.1  ad 
     75  1.1  ad /*
     76  1.1  ad  * a bunch of this belongs in cpuvar.h; move it later..
     77  1.1  ad  */
     78  1.1  ad 
     79  1.1  ad struct cpu_info {
     80  1.1  ad 	struct device *ci_dev;		/* pointer to our device */
     81  1.1  ad 	struct cpu_info *ci_self;	/* self-pointer */
     82  1.1  ad 	volatile struct vcpu_info *ci_vcpu; /* for XEN */
     83  1.1  ad 	void	*ci_tlog_base;		/* Trap log base */
     84  1.1  ad 	int32_t ci_tlog_offset;		/* Trap log current offset */
     85  1.1  ad 
     86  1.1  ad 	/*
     87  1.1  ad 	 * Will be accessed by other CPUs.
     88  1.1  ad 	 */
     89  1.1  ad 	struct cpu_info *ci_next;	/* next cpu */
     90  1.1  ad 	struct lwp *ci_curlwp;		/* current owner of the processor */
     91  1.1  ad 	struct pmap_cpu *ci_pmap_cpu;	/* per-CPU pmap data */
     92  1.1  ad 	struct lwp *ci_fpcurlwp;	/* current owner of the FPU */
     93  1.1  ad 	int	ci_fpsaving;		/* save in progress */
     94  1.1  ad 	int	ci_fpused;		/* XEN: FPU was used by curlwp */
     95  1.1  ad 	cpuid_t ci_cpuid;		/* our CPU ID */
     96  1.1  ad 	int	ci_cpumask;		/* (1 << CPU ID) */
     97  1.1  ad 	u_int ci_apicid;		/* our APIC ID */
     98  1.1  ad 	uint8_t ci_initapicid;		/* our intitial APIC ID */
     99  1.1  ad 	uint8_t ci_packageid;
    100  1.1  ad 	uint8_t ci_coreid;
    101  1.1  ad 	uint8_t ci_smtid;
    102  1.1  ad 	struct cpu_data ci_data;	/* MI per-cpu data */
    103  1.1  ad 
    104  1.1  ad 	/*
    105  1.1  ad 	 * Private members.
    106  1.1  ad 	 */
    107  1.1  ad 	struct evcnt ci_tlb_evcnt;	/* tlb shootdown counter */
    108  1.1  ad 	struct pmap *ci_pmap;		/* current pmap */
    109  1.1  ad 	int ci_need_tlbwait;		/* need to wait for TLB invalidations */
    110  1.1  ad 	int ci_want_pmapload;		/* pmap_load() is needed */
    111  1.1  ad 	volatile int ci_tlbstate;	/* one of TLBSTATE_ states. see below */
    112  1.1  ad #define	TLBSTATE_VALID	0	/* all user tlbs are valid */
    113  1.1  ad #define	TLBSTATE_LAZY	1	/* tlbs are valid but won't be kept uptodate */
    114  1.1  ad #define	TLBSTATE_STALE	2	/* we might have stale user tlbs */
    115  1.1  ad 	uint64_t ci_scratch;
    116  1.1  ad 
    117  1.1  ad #ifdef XEN
    118  1.1  ad 	struct iplsource  *ci_isources[NIPL];
    119  1.1  ad #else
    120  1.1  ad 	struct intrsource *ci_isources[MAX_INTR_SOURCES];
    121  1.1  ad #endif
    122  1.1  ad 	volatile int	ci_mtx_count;	/* Negative count of spin mutexes */
    123  1.1  ad 	volatile int	ci_mtx_oldspl;	/* Old SPL at this ci_idepth */
    124  1.1  ad 
    125  1.1  ad 	/* The following must be aligned for cmpxchg8b. */
    126  1.1  ad 	struct {
    127  1.1  ad 		uint32_t	ipending;
    128  1.1  ad 		int		ilevel;
    129  1.1  ad 	} ci_istate __aligned(8);
    130  1.1  ad #define ci_ipending	ci_istate.ipending
    131  1.1  ad #define	ci_ilevel	ci_istate.ilevel
    132  1.1  ad 
    133  1.1  ad 	int		ci_idepth;
    134  1.1  ad 	void *		ci_intrstack;
    135  1.1  ad 	uint32_t	ci_imask[NIPL];
    136  1.1  ad 	uint32_t	ci_iunmask[NIPL];
    137  1.1  ad 
    138  1.1  ad 	uint32_t ci_flags;		/* flags; see below */
    139  1.1  ad 	uint32_t ci_ipis;		/* interprocessor interrupts pending */
    140  1.1  ad 	int sc_apic_version;		/* local APIC version */
    141  1.1  ad 
    142  1.1  ad 	uint32_t	ci_signature;	 /* X86 cpuid type */
    143  1.1  ad 	uint32_t	ci_feature_flags;/* X86 %edx CPUID feature bits */
    144  1.1  ad 	uint32_t	ci_feature2_flags;/* X86 %ecx CPUID feature bits */
    145  1.1  ad 	uint32_t	ci_feature3_flags;/* X86 extended feature bits */
    146  1.1  ad 	uint32_t	ci_padlock_flags;/* VIA PadLock feature bits */
    147  1.1  ad 	uint32_t	ci_vendor[4];	 /* vendor string */
    148  1.1  ad 	uint32_t	ci_cpu_serial[3]; /* PIII serial number */
    149  1.1  ad 	volatile uint32_t	ci_lapic_counter;
    150  1.1  ad 
    151  1.1  ad 	const struct cpu_functions *ci_func;  /* start/stop functions */
    152  1.1  ad 	struct trapframe *ci_ddb_regs;
    153  1.1  ad 
    154  1.1  ad 	u_int ci_cflush_lsize;	/* CFLUSH insn line size */
    155  1.1  ad 	struct x86_cache_info ci_cinfo[CAI_COUNT];
    156  1.1  ad 
    157  1.1  ad 	union descriptor *ci_gdt;
    158  1.1  ad 
    159  1.1  ad #ifdef i386
    160  1.1  ad 	struct i386tss	ci_doubleflt_tss;
    161  1.1  ad 	struct i386tss	ci_ddbipi_tss;
    162  1.1  ad #endif
    163  1.1  ad 	char *ci_doubleflt_stack;
    164  1.1  ad 	char *ci_ddbipi_stack;
    165  1.1  ad 
    166  1.1  ad 	struct evcnt ci_ipi_events[X86_NIPI];
    167  1.1  ad 
    168  1.1  ad 	struct via_padlock	ci_vp;	/* VIA PadLock private storage */
    169  1.1  ad 
    170  1.1  ad 	struct i386tss	ci_tss;		/* Per-cpu TSS; shared among LWPs */
    171  1.1  ad 	char		ci_iomap[IOMAPSIZE]; /* I/O Bitmap */
    172  1.1  ad 	int ci_tss_sel;			/* TSS selector of this cpu */
    173  1.1  ad 
    174  1.1  ad 	/*
    175  1.1  ad 	 * The following two are actually region_descriptors,
    176  1.1  ad 	 * but that would pollute the namespace.
    177  1.1  ad 	 */
    178  1.1  ad 	uintptr_t	ci_suspend_gdt;
    179  1.1  ad 	uint16_t	ci_suspend_gdt_padding;
    180  1.1  ad 	uintptr_t	ci_suspend_idt;
    181  1.1  ad 	uint16_t	ci_suspend_idt_padding;
    182  1.1  ad 
    183  1.1  ad 	uint16_t	ci_suspend_tr;
    184  1.1  ad 	uint16_t	ci_suspend_ldt;
    185  1.1  ad 	uintptr_t	ci_suspend_fs;
    186  1.1  ad 	uintptr_t	ci_suspend_gs;
    187  1.1  ad 	uintptr_t	ci_suspend_kgs;
    188  1.1  ad 	uintptr_t	ci_suspend_efer;
    189  1.1  ad 	uintptr_t	ci_suspend_reg[12];
    190  1.1  ad 	uintptr_t	ci_suspend_cr0;
    191  1.1  ad 	uintptr_t	ci_suspend_cr2;
    192  1.1  ad 	uintptr_t	ci_suspend_cr3;
    193  1.1  ad 	uintptr_t	ci_suspend_cr4;
    194  1.1  ad 	uintptr_t	ci_suspend_cr8;
    195  1.1  ad 
    196  1.1  ad 	/* The following must be in a single cache line. */
    197  1.1  ad 	int		ci_want_resched __aligned(64);
    198  1.1  ad 	int		ci_padout __aligned(64);
    199  1.1  ad };
    200  1.1  ad 
    201  1.1  ad /*
    202  1.1  ad  * Processor flag notes: The "primary" CPU has certain MI-defined
    203  1.1  ad  * roles (mostly relating to hardclock handling); we distinguish
    204  1.1  ad  * betwen the processor which booted us, and the processor currently
    205  1.1  ad  * holding the "primary" role just to give us the flexibility later to
    206  1.1  ad  * change primaries should we be sufficiently twisted.
    207  1.1  ad  */
    208  1.1  ad 
    209  1.1  ad #define	CPUF_BSP	0x0001		/* CPU is the original BSP */
    210  1.1  ad #define	CPUF_AP		0x0002		/* CPU is an AP */
    211  1.1  ad #define	CPUF_SP		0x0004		/* CPU is only processor */
    212  1.1  ad #define	CPUF_PRIMARY	0x0008		/* CPU is active primary processor */
    213  1.1  ad 
    214  1.1  ad #define	CPUF_SYNCTSC	0x0800		/* Synchronize TSC */
    215  1.1  ad #define	CPUF_PRESENT	0x1000		/* CPU is present */
    216  1.1  ad #define	CPUF_RUNNING	0x2000		/* CPU is running */
    217  1.1  ad #define	CPUF_PAUSE	0x4000		/* CPU is paused in DDB */
    218  1.1  ad #define	CPUF_GO		0x8000		/* CPU should start running */
    219  1.1  ad 
    220  1.1  ad /*
    221  1.1  ad  * We statically allocate the CPU info for the primary CPU (or,
    222  1.1  ad  * the only CPU on uniprocessors), and the primary CPU is the
    223  1.1  ad  * first CPU on the CPU info list.
    224  1.1  ad  */
    225  1.1  ad extern struct cpu_info cpu_info_primary;
    226  1.1  ad extern struct cpu_info *cpu_info_list;
    227  1.1  ad 
    228  1.1  ad #define	CPU_INFO_ITERATOR		int
    229  1.1  ad #define	CPU_INFO_FOREACH(cii, ci)	cii = 0, ci = cpu_info_list; \
    230  1.1  ad 					ci != NULL; ci = ci->ci_next
    231  1.1  ad 
    232  1.1  ad #define X86_MAXPROCS		32	/* because we use a bitmask */
    233  1.1  ad 
    234  1.1  ad #define CPU_STARTUP(_ci, _target)	((_ci)->ci_func->start(_ci, _target))
    235  1.1  ad #define CPU_STOP(_ci)	        	((_ci)->ci_func->stop(_ci))
    236  1.1  ad #define CPU_START_CLEANUP(_ci)		((_ci)->ci_func->cleanup(_ci))
    237  1.1  ad 
    238  1.1  ad #if !defined(__GNUC__) || defined(_LKM)
    239  1.1  ad /* For non-GCC and modules */
    240  1.1  ad struct cpu_info	*x86_curcpu(void);
    241  1.1  ad lwp_t	*x86_curlwp(void);
    242  1.1  ad void	cpu_set_curpri(int);
    243  1.1  ad #endif
    244  1.1  ad 
    245  1.1  ad #define cpu_number() 		(curcpu()->ci_cpuid)
    246  1.1  ad 
    247  1.1  ad #define CPU_IS_PRIMARY(ci)	((ci)->ci_flags & CPUF_PRIMARY)
    248  1.1  ad 
    249  1.1  ad #define	X86_AST_GENERIC		0x01
    250  1.1  ad #define	X86_AST_PREEMPT		0x02
    251  1.1  ad 
    252  1.1  ad #define aston(l, why)		((l)->l_md.md_astpending |= (why))
    253  1.1  ad #define	cpu_did_resched(l)	((l)->l_md.md_astpending &= ~X86_AST_PREEMPT)
    254  1.1  ad 
    255  1.1  ad extern	struct cpu_info *cpu_info[X86_MAXPROCS];
    256  1.1  ad 
    257  1.1  ad void cpu_boot_secondary_processors(void);
    258  1.1  ad void cpu_init_idle_lwps(void);
    259  1.1  ad void cpu_init_msrs(struct cpu_info *, bool);
    260  1.1  ad 
    261  1.1  ad extern uint32_t cpus_attached;
    262  1.1  ad #ifndef XEN
    263  1.1  ad #define	curcpu()		x86_curcpu()
    264  1.1  ad #define	curlwp			x86_curlwp()
    265  1.1  ad #else
    266  1.1  ad /* XXX initgdt() calls pmap_kenter_pa() which calls splvm() before %fs is set */
    267  1.1  ad #define curcpu()		(&cpu_info_primary)
    268  1.1  ad #define curlwp			curcpu()->ci_curlwp
    269  1.1  ad #endif
    270  1.1  ad #define	curpcb			(&curlwp->l_addr->u_pcb)
    271  1.1  ad 
    272  1.1  ad /*
    273  1.1  ad  * Arguments to hardclock, softclock and statclock
    274  1.1  ad  * encapsulate the previous machine state in an opaque
    275  1.1  ad  * clockframe; for now, use generic intrframe.
    276  1.1  ad  */
    277  1.1  ad struct clockframe {
    278  1.1  ad 	struct intrframe cf_if;
    279  1.1  ad };
    280  1.1  ad 
    281  1.1  ad /*
    282  1.1  ad  * Give a profiling tick to the current process when the user profiling
    283  1.1  ad  * buffer pages are invalid.  On the i386, request an ast to send us
    284  1.1  ad  * through trap(), marking the proc as needing a profiling tick.
    285  1.1  ad  */
    286  1.1  ad extern void	cpu_need_proftick(struct lwp *l);
    287  1.1  ad 
    288  1.1  ad /*
    289  1.1  ad  * Notify the LWP l that it has a signal pending, process as soon as
    290  1.1  ad  * possible.
    291  1.1  ad  */
    292  1.1  ad extern void	cpu_signotify(struct lwp *);
    293  1.1  ad 
    294  1.1  ad /*
    295  1.1  ad  * We need a machine-independent name for this.
    296  1.1  ad  */
    297  1.1  ad extern void (*delay_func)(unsigned int);
    298  1.1  ad struct timeval;
    299  1.1  ad 
    300  1.1  ad #define	DELAY(x)		(*delay_func)(x)
    301  1.1  ad #define delay(x)		(*delay_func)(x)
    302  1.1  ad 
    303  1.1  ad extern int biosbasemem;
    304  1.1  ad extern int biosextmem;
    305  1.1  ad extern unsigned int cpu_feature;
    306  1.1  ad extern unsigned int cpu_feature2;
    307  1.1  ad extern unsigned int cpu_feature_padlock;
    308  1.1  ad extern int cpu;
    309  1.1  ad extern int cpuid_level;
    310  1.1  ad extern int cpu_class;
    311  1.1  ad extern char cpu_brand_string[];
    312  1.1  ad 
    313  1.1  ad extern int i386_use_fxsave;
    314  1.1  ad extern int i386_has_sse;
    315  1.1  ad extern int i386_has_sse2;
    316  1.1  ad 
    317  1.1  ad extern void (*x86_cpu_idle)(void);
    318  1.1  ad #define	cpu_idle() (*x86_cpu_idle)()
    319  1.1  ad 
    320  1.1  ad /* machdep.c */
    321  1.1  ad void	dumpconf(void);
    322  1.1  ad void	cpu_reset(void);
    323  1.1  ad void	i386_proc0_tss_ldt_init(void);
    324  1.1  ad void	dumpconf(void);
    325  1.1  ad void	cpu_reset(void);
    326  1.1  ad void	x86_64_proc0_tss_ldt_init(void);
    327  1.1  ad void	x86_64_init_pcb_tss_ldt(struct cpu_info *);
    328  1.1  ad 
    329  1.1  ad /* longrun.c */
    330  1.1  ad u_int 	tmx86_get_longrun_mode(void);
    331  1.1  ad void 	tmx86_get_longrun_status(u_int *, u_int *, u_int *);
    332  1.1  ad void 	tmx86_init_longrun(void);
    333  1.1  ad 
    334  1.1  ad /* identcpu.c */
    335  1.1  ad void 	cpu_probe(struct cpu_info *);
    336  1.1  ad void	cpu_identify(struct cpu_info *);
    337  1.1  ad 
    338  1.1  ad /* vm_machdep.c */
    339  1.1  ad void	cpu_proc_fork(struct proc *, struct proc *);
    340  1.1  ad 
    341  1.1  ad /* locore.s */
    342  1.1  ad struct region_descriptor;
    343  1.1  ad void	lgdt(struct region_descriptor *);
    344  1.1  ad #ifdef XEN
    345  1.1  ad void	lgdt_finish(void);
    346  1.1  ad void	i386_switch_context(lwp_t *);
    347  1.1  ad #endif
    348  1.1  ad void	fillw(short, void *, size_t);
    349  1.1  ad 
    350  1.1  ad struct pcb;
    351  1.1  ad void	savectx(struct pcb *);
    352  1.1  ad void	lwp_trampoline(void);
    353  1.1  ad void	child_trampoline(void);
    354  1.1  ad #ifdef XEN
    355  1.1  ad void	startrtclock(void);
    356  1.1  ad void	xen_delay(unsigned int);
    357  1.1  ad void	xen_initclocks(void);
    358  1.1  ad #else
    359  1.1  ad /* clock.c */
    360  1.1  ad void	initrtclock(u_long);
    361  1.1  ad void	startrtclock(void);
    362  1.1  ad void	i8254_delay(unsigned int);
    363  1.1  ad void	i8254_microtime(struct timeval *);
    364  1.1  ad void	i8254_initclocks(void);
    365  1.1  ad #endif
    366  1.1  ad 
    367  1.1  ad /* cpu.c */
    368  1.1  ad 
    369  1.1  ad void	cpu_probe_features(struct cpu_info *);
    370  1.1  ad 
    371  1.1  ad /* npx.c */
    372  1.1  ad void	npxsave_lwp(struct lwp *, bool);
    373  1.1  ad void	npxsave_cpu(bool);
    374  1.1  ad 
    375  1.1  ad /* vm_machdep.c */
    376  1.1  ad int kvtop(void *);
    377  1.1  ad 
    378  1.1  ad #ifdef USER_LDT
    379  1.1  ad /* sys_machdep.h */
    380  1.1  ad int	x86_get_ldt(struct lwp *, void *, register_t *);
    381  1.1  ad int	x86_set_ldt(struct lwp *, void *, register_t *);
    382  1.1  ad #endif
    383  1.1  ad 
    384  1.1  ad /* isa_machdep.c */
    385  1.1  ad void	isa_defaultirq(void);
    386  1.1  ad int	isa_nmi(void);
    387  1.1  ad 
    388  1.1  ad #ifdef VM86
    389  1.1  ad /* vm86.c */
    390  1.1  ad void	vm86_gpfault(struct lwp *, int);
    391  1.1  ad #endif /* VM86 */
    392  1.1  ad 
    393  1.1  ad /* consinit.c */
    394  1.1  ad void kgdb_port_init(void);
    395  1.1  ad 
    396  1.1  ad /* bus_machdep.c */
    397  1.1  ad void x86_bus_space_init(void);
    398  1.1  ad void x86_bus_space_mallocok(void);
    399  1.1  ad 
    400  1.1  ad #include <machine/psl.h>	/* Must be after struct cpu_info declaration */
    401  1.1  ad 
    402  1.1  ad #endif /* _KERNEL */
    403  1.1  ad 
    404  1.1  ad /*
    405  1.1  ad  * CTL_MACHDEP definitions.
    406  1.1  ad  */
    407  1.1  ad #define	CPU_CONSDEV		1	/* dev_t: console terminal device */
    408  1.1  ad #define	CPU_BIOSBASEMEM		2	/* int: bios-reported base mem (K) */
    409  1.1  ad #define	CPU_BIOSEXTMEM		3	/* int: bios-reported ext. mem (K) */
    410  1.1  ad /* 	CPU_NKPDE		4	obsolete: int: number of kernel PDEs */
    411  1.1  ad #define	CPU_BOOTED_KERNEL	5	/* string: booted kernel name */
    412  1.1  ad #define CPU_DISKINFO		6	/* struct disklist *:
    413  1.1  ad 					 * disk geometry information */
    414  1.1  ad #define CPU_FPU_PRESENT		7	/* int: FPU is present */
    415  1.1  ad #define	CPU_OSFXSR		8	/* int: OS uses FXSAVE/FXRSTOR */
    416  1.1  ad #define	CPU_SSE			9	/* int: OS/CPU supports SSE */
    417  1.1  ad #define	CPU_SSE2		10	/* int: OS/CPU supports SSE2 */
    418  1.1  ad #define	CPU_TMLR_MODE		11	/* int: longrun mode
    419  1.1  ad 					 * 0: minimum frequency
    420  1.1  ad 					 * 1: economy
    421  1.1  ad 					 * 2: performance
    422  1.1  ad 					 * 3: maximum frequency
    423  1.1  ad 					 */
    424  1.1  ad #define	CPU_TMLR_FREQUENCY	12	/* int: current frequency */
    425  1.1  ad #define	CPU_TMLR_VOLTAGE	13	/* int: curret voltage */
    426  1.1  ad #define	CPU_TMLR_PERCENTAGE	14	/* int: current clock percentage */
    427  1.1  ad #define	CPU_MAXID		15	/* number of valid machdep ids */
    428  1.1  ad 
    429  1.1  ad /*
    430  1.1  ad  * Structure for CPU_DISKINFO sysctl call.
    431  1.1  ad  * XXX this should be somewhere else.
    432  1.1  ad  */
    433  1.1  ad #define MAX_BIOSDISKS	16
    434  1.1  ad 
    435  1.1  ad struct disklist {
    436  1.1  ad 	int dl_nbiosdisks;			   /* number of bios disks */
    437  1.1  ad 	struct biosdisk_info {
    438  1.1  ad 		int bi_dev;			   /* BIOS device # (0x80 ..) */
    439  1.1  ad 		int bi_cyl;			   /* cylinders on disk */
    440  1.1  ad 		int bi_head;			   /* heads per track */
    441  1.1  ad 		int bi_sec;			   /* sectors per track */
    442  1.1  ad 		uint64_t bi_lbasecs;		   /* total sec. (iff ext13) */
    443  1.1  ad #define BIFLAG_INVALID		0x01
    444  1.1  ad #define BIFLAG_EXTINT13		0x02
    445  1.1  ad 		int bi_flags;
    446  1.1  ad 	} dl_biosdisks[MAX_BIOSDISKS];
    447  1.1  ad 
    448  1.1  ad 	int dl_nnativedisks;			   /* number of native disks */
    449  1.1  ad 	struct nativedisk_info {
    450  1.1  ad 		char ni_devname[16];		   /* native device name */
    451  1.1  ad 		int ni_nmatches; 		   /* # of matches w/ BIOS */
    452  1.1  ad 		int ni_biosmatches[MAX_BIOSDISKS]; /* indices in dl_biosdisks */
    453  1.1  ad 	} dl_nativedisks[1];			   /* actually longer */
    454  1.1  ad };
    455  1.1  ad #endif /* !_X86_CPU_H_ */
    456