[BACK]Return to cpu.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / i386 / include

Annotation of src/sys/arch/i386/include/cpu.h, Revision 1.151.4.2

1.151.4.1  bouyer      1: /*     $NetBSD$        */
1.24      cgd         2:
1.1       cgd         3: /*-
                      4:  * Copyright (c) 1990 The Regents of the University of California.
                      5:  * All rights reserved.
                      6:  *
                      7:  * This code is derived from software contributed to Berkeley by
                      8:  * William Jolitz.
                      9:  *
                     10:  * Redistribution and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
1.103     agc        18:  * 3. Neither the name of the University nor the names of its contributors
1.1       cgd        19:  *    may be used to endorse or promote products derived from this software
                     20:  *    without specific prior written permission.
                     21:  *
                     22:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     23:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     24:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     25:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     26:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     27:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     28:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     29:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     30:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     31:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     32:  * SUCH DAMAGE.
                     33:  *
1.24      cgd        34:  *     @(#)cpu.h       5.4 (Berkeley) 5/9/91
1.1       cgd        35:  */
                     36:
1.14      mycroft    37: #ifndef _I386_CPU_H_
                     38: #define _I386_CPU_H_
                     39:
1.108     simonb     40: #ifdef _KERNEL
1.71      mrg        41: #if defined(_KERNEL_OPT)
1.63      thorpej    42: #include "opt_multiprocessor.h"
1.108     simonb     43: #include "opt_math_emulate.h"
                     44: #include "opt_user_ldt.h"
                     45: #include "opt_vm86.h"
1.151.4.2! bouyer     46: #include "opt_xen.h"
1.63      thorpej    47: #endif
                     48:
1.1       cgd        49: /*
                     50:  * Definitions unique to i386 cpu support.
                     51:  */
1.12      mycroft    52: #include <machine/frame.h>
                     53: #include <machine/segments.h>
1.83      fvdl       54: #include <machine/tss.h>
1.89      fvdl       55: #include <machine/intrdefs.h>
1.100     fvdl       56: #include <x86/cacheinfo.h>
1.133     daniel     57: #include <x86/via_padlock.h>
1.63      thorpej    58:
1.82      fvdl       59: #include <sys/device.h>
1.116     yamt       60: #include <sys/cpu_data.h>
                     61: #include <sys/cc_microtime.h>
1.70      thorpej    62:
1.105     yamt       63: #include <lib/libkern/libkern.h>       /* offsetof */
                     64:
1.89      fvdl       65: struct intrsource;
1.113     yamt       66: struct pmap;
1.85      fvdl       67:
1.82      fvdl       68: /*
                     69:  * a bunch of this belongs in cpuvar.h; move it later..
                     70:  */
                     71:
1.63      thorpej    72: struct cpu_info {
1.82      fvdl       73:        struct device *ci_dev;          /* pointer to our device */
                     74:        struct cpu_info *ci_self;       /* self-pointer */
                     75:        void    *ci_tlog_base;          /* Trap log base */
                     76:        int32_t ci_tlog_offset;         /* Trap log current offset */
                     77:
                     78:        /*
1.144     ad         79:         * Will be accessed by other CPUs.
1.82      fvdl       80:         */
1.144     ad         81:        struct cpu_info *ci_next;       /* next cpu */
1.95      thorpej    82:        struct lwp *ci_curlwp;          /* current owner of the processor */
1.144     ad         83:        struct pmap_cpu *ci_pmap_cpu;   /* per-CPU pmap data */
                     84:        struct lwp *ci_fpcurlwp;        /* current owner of the FPU */
                     85:        int     ci_fpsaving;            /* save in progress */
1.82      fvdl       86:        cpuid_t ci_cpuid;               /* our CPU ID */
1.144     ad         87:        int     ci_cpumask;             /* (1 << CPU ID) */
1.90      fvdl       88:        u_int ci_apicid;                /* our APIC ID */
1.151.4.1  bouyer     89:        uint8_t ci_initapicid;          /* our intitial APIC ID */
                     90:        uint8_t ci_packageid;
                     91:        uint8_t ci_coreid;
                     92:        uint8_t ci_smtid;
1.116     yamt       93:        struct cpu_data ci_data;        /* MI per-cpu data */
                     94:        struct cc_microtime_state ci_cc;/* cc_microtime state */
1.82      fvdl       95:
                     96:        /*
                     97:         * Private members.
                     98:         */
1.144     ad         99:        struct evcnt ci_tlb_evcnt;      /* tlb shootdown counter */
1.113     yamt      100:        struct pmap *ci_pmap;           /* current pmap */
1.144     ad        101:        int ci_need_tlbwait;            /* need to wait for TLB invalidations */
1.113     yamt      102:        int ci_want_pmapload;           /* pmap_load() is needed */
1.150     ad        103:        volatile int ci_tlbstate;       /* one of TLBSTATE_ states. see below */
1.113     yamt      104: #define        TLBSTATE_VALID  0       /* all user tlbs are valid */
                    105: #define        TLBSTATE_LAZY   1       /* tlbs are valid but won't be kept uptodate */
                    106: #define        TLBSTATE_STALE  2       /* we might have stale user tlbs */
                    107:
1.151.4.2! bouyer    108: #ifdef XEN
        !           109:        struct iplsource  *ci_isources[NIPL];
        !           110: #else
1.89      fvdl      111:        struct intrsource *ci_isources[MAX_INTR_SOURCES];
1.151.4.2! bouyer    112: #endif
1.131     ad        113:        volatile int    ci_mtx_count;   /* Negative count of spin mutexes */
                    114:        volatile int    ci_mtx_oldspl;  /* Old SPL at this ci_idepth */
                    115:
                    116:        /* The following must be aligned for cmpxchg8b. */
                    117:        struct {
                    118:                uint32_t        ipending;
                    119:                int             ilevel;
                    120:        } ci_istate __aligned(8);
                    121: #define ci_ipending    ci_istate.ipending
                    122: #define        ci_ilevel       ci_istate.ilevel
                    123:
1.89      fvdl      124:        int             ci_idepth;
1.144     ad        125:        void *          ci_intrstack;
1.120     perry     126:        uint32_t        ci_imask[NIPL];
                    127:        uint32_t        ci_iunmask[NIPL];
1.89      fvdl      128:
1.82      fvdl      129:        paddr_t ci_idle_pcb_paddr;      /* PA of idle PCB */
1.120     perry     130:        uint32_t ci_flags;              /* flags; see below */
                    131:        uint32_t ci_ipis;               /* interprocessor interrupts pending */
1.82      fvdl      132:        int sc_apic_version;            /* local APIC version */
                    133:
                    134:        int32_t         ci_cpuid_level;
1.120     perry     135:        uint32_t        ci_signature;    /* X86 cpuid type */
                    136:        uint32_t        ci_feature_flags;/* X86 %edx CPUID feature bits */
                    137:        uint32_t        ci_feature2_flags;/* X86 %ecx CPUID feature bits */
                    138:        uint32_t        ci_feature3_flags;/* X86 extended feature bits */
1.133     daniel    139:        uint32_t        ci_padlock_flags;/* VIA PadLock feature bits */
1.120     perry     140:        uint32_t        ci_cpu_class;    /* CPU class */
                    141:        uint32_t        ci_brand_id;     /* Intel brand id */
                    142:        uint32_t        ci_vendor[4];    /* vendor string */
                    143:        uint32_t        ci_cpu_serial[3]; /* PIII serial number */
                    144:        uint64_t        ci_tsc_freq;     /* cpu cycles/second */
1.151     joerg     145:        volatile uint32_t       ci_lapic_counter;
1.82      fvdl      146:
1.135     drochner  147:        const struct cpu_functions *ci_func;  /* start/stop functions */
1.109     junyoung  148:        void (*cpu_setup)(struct cpu_info *);
1.82      fvdl      149:                                        /* proc-dependant init */
1.109     junyoung  150:        void (*ci_info)(struct cpu_info *);
1.82      fvdl      151:
                    152:        int             ci_want_resched;
                    153:        struct trapframe *ci_ddb_regs;
1.69      thorpej   154:
1.73      thorpej   155:        u_int ci_cflush_lsize;  /* CFLUSH insn line size */
1.100     fvdl      156:        struct x86_cache_info ci_cinfo[CAI_COUNT];
1.82      fvdl      157:
                    158:        union descriptor *ci_gdt;
1.83      fvdl      159:
                    160:        struct i386tss  ci_doubleflt_tss;
                    161:        struct i386tss  ci_ddbipi_tss;
                    162:
                    163:        char *ci_doubleflt_stack;
                    164:        char *ci_ddbipi_stack;
1.89      fvdl      165:
1.97      fvdl      166:        struct evcnt ci_ipi_events[X86_NIPI];
1.133     daniel    167:
                    168:        struct via_padlock      ci_vp;  /* VIA PadLock private storage */
1.151.4.1  bouyer    169:
                    170:        /*
                    171:         * The following two are actually region_descriptors,
                    172:         * but that would pollute the namespace.
                    173:         */
                    174:        uint32_t        ci_suspend_gdt;
                    175:        uint16_t        ci_suspend_gdt_padding;
                    176:        uint32_t        ci_suspend_idt;
                    177:        uint16_t        ci_suspend_idt_padding;
                    178:
                    179:        uint16_t        ci_suspend_tr;
                    180:        uint16_t        ci_suspend_ldt;
                    181:        uint16_t        ci_suspend_fs;
                    182:        uint16_t        ci_suspend_gs;
                    183:        uint32_t        ci_suspend_ebx;
                    184:        uint32_t        ci_suspend_esi;
                    185:        uint32_t        ci_suspend_edi;
                    186:        uint32_t        ci_suspend_ebp;
                    187:        uint32_t        ci_suspend_esp;
                    188:        uint32_t        ci_suspend_efl;
                    189:        uint32_t        ci_suspend_cr0;
                    190:        uint32_t        ci_suspend_cr2;
                    191:        uint32_t        ci_suspend_cr3;
                    192:        uint32_t        ci_suspend_cr4;
1.151.4.2! bouyer    193: #ifdef XEN
        !           194:        int             ci_fpused;      /* FPU was used by curlwp */
        !           195: #endif
1.63      thorpej   196: };
                    197:
1.82      fvdl      198: /*
                    199:  * Processor flag notes: The "primary" CPU has certain MI-defined
                    200:  * roles (mostly relating to hardclock handling); we distinguish
                    201:  * betwen the processor which booted us, and the processor currently
                    202:  * holding the "primary" role just to give us the flexibility later to
                    203:  * change primaries should we be sufficiently twisted.
                    204:  */
                    205:
                    206: #define        CPUF_BSP        0x0001          /* CPU is the original BSP */
                    207: #define        CPUF_AP         0x0002          /* CPU is an AP */
                    208: #define        CPUF_SP         0x0004          /* CPU is only processor */
                    209: #define        CPUF_PRIMARY    0x0008          /* CPU is active primary processor */
                    210:
                    211: #define CPUF_APIC_CD    0x0010         /* CPU has apic configured */
                    212:
                    213: #define        CPUF_PRESENT    0x1000          /* CPU is present */
                    214: #define        CPUF_RUNNING    0x2000          /* CPU is running */
                    215: #define        CPUF_PAUSE      0x4000          /* CPU is paused in DDB */
                    216: #define        CPUF_GO         0x8000          /* CPU should start running */
                    217:
                    218: /*
                    219:  * We statically allocate the CPU info for the primary CPU (or,
                    220:  * the only CPU on uniprocessors), and the primary CPU is the
                    221:  * first CPU on the CPU info list.
                    222:  */
                    223: extern struct cpu_info cpu_info_primary;
                    224: extern struct cpu_info *cpu_info_list;
                    225:
                    226: #define        CPU_INFO_ITERATOR               int
                    227: #define        CPU_INFO_FOREACH(cii, ci)       cii = 0, ci = cpu_info_list; \
                    228:                                        ci != NULL; ci = ci->ci_next
                    229:
1.97      fvdl      230: #define X86_MAXPROCS           32      /* because we use a bitmask */
1.82      fvdl      231:
1.151.4.1  bouyer    232: #define CPU_STARTUP(_ci, _target)      ((_ci)->ci_func->start(_ci, _target))
                    233: #define CPU_STOP(_ci)                  ((_ci)->ci_func->stop(_ci))
                    234: #define CPU_START_CLEANUP(_ci)         ((_ci)->ci_func->cleanup(_ci))
1.82      fvdl      235:
1.146     ad        236: #if defined(__GNUC__) && defined(_KERNEL)
                    237: static struct cpu_info *x86_curcpu(void);
                    238: static lwp_t *x86_curlwp(void);
1.105     yamt      239:
1.151.4.1  bouyer    240: __inline static struct cpu_info * __unused
1.146     ad        241: x86_curcpu(void)
1.105     yamt      242: {
                    243:        struct cpu_info *ci;
                    244:
1.119     perry     245:        __asm volatile("movl %%fs:%1, %0" :
1.105     yamt      246:            "=r" (ci) :
                    247:            "m"
1.115     yamt      248:            (*(struct cpu_info * const *)offsetof(struct cpu_info, ci_self)));
1.105     yamt      249:        return ci;
                    250: }
                    251:
1.151.4.1  bouyer    252: __inline static lwp_t * __unused
1.146     ad        253: x86_curlwp(void)
                    254: {
                    255:        lwp_t *l;
                    256:
                    257:        __asm volatile("movl %%fs:%1, %0" :
                    258:            "=r" (l) :
                    259:            "m"
                    260:            (*(struct cpu_info * const *)offsetof(struct cpu_info, ci_curlwp)));
                    261:        return l;
                    262: }
                    263: #else  /* __GNUC__ && _KERNEL */
                    264: /* For non-GCC and LKMs */
                    265: struct cpu_info        *x86_curcpu(void);
                    266: lwp_t  *x86_curlwp(void);
                    267: #endif /* __GNUC__ && _KERNEL */
                    268:
1.82      fvdl      269: #define cpu_number()           (curcpu()->ci_cpuid)
                    270:
                    271: #define CPU_IS_PRIMARY(ci)     ((ci)->ci_flags & CPUF_PRIMARY)
                    272:
1.131     ad        273: #define aston(l)               ((l)->l_md.md_astpending = 1)
1.82      fvdl      274:
1.97      fvdl      275: extern struct cpu_info *cpu_info[X86_MAXPROCS];
1.82      fvdl      276:
1.109     junyoung  277: void cpu_boot_secondary_processors(void);
1.141     yamt      278: void cpu_init_idle_lwps(void);
1.82      fvdl      279:
1.120     perry     280: extern uint32_t cpus_attached;
1.151.4.2! bouyer    281: #ifndef XEN
1.146     ad        282: #define        curcpu()                x86_curcpu()
                    283: #define        curlwp                  x86_curlwp()
1.151.4.2! bouyer    284: #else
        !           285: /* XXX initgdt() calls pmap_kenter_pa() which calls splvm() before %fs is set */
        !           286: #define curcpu()               (&cpu_info_primary)
        !           287: #define curlwp                 curcpu()->ci_curlwp
        !           288: #endif
1.141     yamt      289: #define        curpcb                  (&curlwp->l_addr->u_pcb)
1.1       cgd       290:
                    291: /*
1.18      mycroft   292:  * Arguments to hardclock, softclock and statclock
1.1       cgd       293:  * encapsulate the previous machine state in an opaque
                    294:  * clockframe; for now, use generic intrframe.
                    295:  */
1.118     cube      296: struct clockframe {
                    297:        struct intrframe cf_if;
                    298: };
1.1       cgd       299:
1.118     cube      300: #define        CLKF_USERMODE(frame)    USERMODE((frame)->cf_if.if_cs, (frame)->cf_if.if_eflags)
                    301: #define        CLKF_PC(frame)          ((frame)->cf_if.if_eip)
1.130     yamt      302: #define        CLKF_INTR(frame)        (curcpu()->ci_idepth > 0)
1.67      mycroft   303:
                    304: /*
                    305:  * This is used during profiling to integrate system time.  It can safely
                    306:  * assume that the process is resident.
                    307:  */
1.95      thorpej   308: #define        LWP_PC(l)               ((l)->l_md.md_regs->tf_eip)
1.12      mycroft   309:
                    310: /*
                    311:  * Give a profiling tick to the current process when the user profiling
                    312:  * buffer pages are invalid.  On the i386, request an ast to send us
                    313:  * through trap(), marking the proc as needing a profiling tick.
1.1       cgd       314:  */
1.131     ad        315: extern void    cpu_need_proftick(struct lwp *l);
1.1       cgd       316:
                    317: /*
1.131     ad        318:  * Notify the LWP l that it has a signal pending, process as soon as
                    319:  * possible.
1.1       cgd       320:  */
1.131     ad        321: extern void    cpu_signotify(struct lwp *);
1.26      mycroft   322:
                    323: /*
                    324:  * We need a machine-independent name for this.
                    325:  */
1.149     joerg     326: extern void (*delay_func)(unsigned int);
1.82      fvdl      327: struct timeval;
                    328:
                    329: #define        DELAY(x)                (*delay_func)(x)
                    330: #define delay(x)               (*delay_func)(x)
1.1       cgd       331:
                    332: /*
1.5       cgd       333:  * pull in #defines for kinds of processors
1.1       cgd       334:  */
1.15      mycroft   335: #include <machine/cputypes.h>
1.2       cgd       336:
1.38      fvdl      337: struct cpu_nocpuid_nameclass {
                    338:        int cpu_vendor;
                    339:        const char *cpu_vendorname;
                    340:        const char *cpu_name;
                    341:        int cpu_class;
1.109     junyoung  342:        void (*cpu_setup)(struct cpu_info *);
                    343:        void (*cpu_cacheinfo)(struct cpu_info *);
                    344:        void (*cpu_info)(struct cpu_info *);
1.38      fvdl      345: };
                    346:
                    347:
                    348: struct cpu_cpuid_nameclass {
                    349:        const char *cpu_id;
                    350:        int cpu_vendor;
                    351:        const char *cpu_vendorname;
                    352:        struct cpu_cpuid_family {
                    353:                int cpu_class;
                    354:                const char *cpu_models[CPU_MAXMODEL+2];
1.109     junyoung  355:                void (*cpu_setup)(struct cpu_info *);
                    356:                void (*cpu_probe)(struct cpu_info *);
                    357:                void (*cpu_info)(struct cpu_info *);
1.38      fvdl      358:        } cpu_family[CPU_MAXFAMILY - CPU_MINFAMILY + 1];
1.6       cgd       359: };
                    360:
1.62      thorpej   361: extern int biosbasemem;
                    362: extern int biosextmem;
1.102     drochner  363: extern unsigned int cpu_feature;
1.114     lukem     364: extern unsigned int cpu_feature2;
1.133     daniel    365: extern unsigned int cpu_feature_padlock;
1.3       cgd       366: extern int cpu;
1.8       cgd       367: extern int cpu_class;
1.114     lukem     368: extern char cpu_brand_string[];
1.66      jdolecek  369: extern const struct cpu_nocpuid_nameclass i386_nocpuid_cpus[];
                    370: extern const struct cpu_cpuid_nameclass i386_cpuid_cpus[];
1.74      thorpej   371:
1.75      thorpej   372: extern int i386_use_fxsave;
                    373: extern int i386_has_sse;
                    374: extern int i386_has_sse2;
1.34      christos  375:
                    376: /* machdep.c */
1.109     junyoung  377: void   dumpconf(void);
                    378: int    cpu_maxproc(void);
                    379: void   cpu_reset(void);
                    380: void   i386_proc0_tss_ldt_init(void);
1.98      fvdl      381:
                    382: extern int tmx86_has_longrun;
                    383: extern u_int crusoe_longrun;
                    384: extern u_int crusoe_frequency;
                    385: extern u_int crusoe_voltage;
                    386: extern u_int crusoe_percentage;
                    387: extern u_int tmx86_set_longrun_mode(u_int);
                    388: void tmx86_get_longrun_status_all(void);
                    389: u_int tmx86_get_longrun_mode(void);
1.109     junyoung  390: void identifycpu(struct cpu_info *);
1.34      christos  391:
1.95      thorpej   392: /* vm_machdep.c */
1.109     junyoung  393: void   cpu_proc_fork(struct proc *, struct proc *);
1.95      thorpej   394:
1.34      christos  395: /* locore.s */
                    396: struct region_descriptor;
1.109     junyoung  397: void   lgdt(struct region_descriptor *);
1.151.4.2! bouyer    398: #ifdef XEN
        !           399: void   lgdt_finish(void);
        !           400: struct pcb;
        !           401: void   i386_switch_context(struct pcb *);
        !           402: #endif
1.109     junyoung  403: void   fillw(short, void *, size_t);
1.34      christos  404:
                    405: struct pcb;
1.109     junyoung  406: void   savectx(struct pcb *);
1.141     yamt      407: void   lwp_trampoline(void);
1.151.4.2! bouyer    408: #ifdef XEN
        !           409: void   startrtclock(void);
        !           410: void   xen_delay(unsigned int);
        !           411: void   xen_initclocks(void);
        !           412: #else
1.34      christos  413: /* clock.c */
1.124     kardel    414: void   initrtclock(u_long);
1.109     junyoung  415: void   startrtclock(void);
1.149     joerg     416: void   i8254_delay(unsigned int);
1.109     junyoung  417: void   i8254_microtime(struct timeval *);
                    418: void   i8254_initclocks(void);
1.151.4.2! bouyer    419: #endif
1.82      fvdl      420:
                    421: /* cpu.c */
                    422:
1.109     junyoung  423: void   cpu_probe_features(struct cpu_info *);
1.34      christos  424:
                    425: /* npx.c */
1.109     junyoung  426: void   npxsave_lwp(struct lwp *, int);
                    427: void   npxsave_cpu(struct cpu_info *, int);
1.36      christos  428:
                    429: /* vm_machdep.c */
1.134     christos  430: int kvtop(void *);
1.34      christos  431:
                    432: #ifdef MATH_EMULATE
                    433: /* math_emulate.c */
1.109     junyoung  434: int    math_emulate(struct trapframe *, ksiginfo_t *);
1.3       cgd       435: #endif
1.34      christos  436:
                    437: #ifdef USER_LDT
                    438: /* sys_machdep.h */
1.140     ad        439: int    x86_get_ldt(struct lwp *, void *, register_t *);
                    440: int    x86_set_ldt(struct lwp *, void *, register_t *);
1.34      christos  441: #endif
                    442:
                    443: /* isa_machdep.c */
1.109     junyoung  444: void   isa_defaultirq(void);
                    445: int    isa_nmi(void);
1.34      christos  446:
                    447: #ifdef VM86
                    448: /* vm86.c */
1.109     junyoung  449: void   vm86_gpfault(struct lwp *, int);
1.34      christos  450: #endif /* VM86 */
1.58      drochner  451:
                    452: /* consinit.c */
1.109     junyoung  453: void kgdb_port_init(void);
1.59      drochner  454:
                    455: /* bus_machdep.c */
1.109     junyoung  456: void x86_bus_space_init(void);
                    457: void x86_bus_space_mallocok(void);
1.34      christos  458:
1.108     simonb    459: #include <machine/psl.h>       /* Must be after struct cpu_info declaration */
                    460:
1.34      christos  461: #endif /* _KERNEL */
1.19      cgd       462:
1.82      fvdl      463: /*
1.19      cgd       464:  * CTL_MACHDEP definitions.
                    465:  */
                    466: #define        CPU_CONSDEV             1       /* dev_t: console terminal device */
1.37      fvdl      467: #define        CPU_BIOSBASEMEM         2       /* int: bios-reported base mem (K) */
                    468: #define        CPU_BIOSEXTMEM          3       /* int: bios-reported ext. mem (K) */
1.148     yamt      469: /*     CPU_NKPDE               4       obsolete: int: number of kernel PDEs */
1.40      drochner  470: #define        CPU_BOOTED_KERNEL       5       /* string: booted kernel name */
1.78      christos  471: #define CPU_DISKINFO           6       /* struct disklist *:
                    472:                                         * disk geometry information */
                    473: #define CPU_FPU_PRESENT                7       /* int: FPU is present */
                    474: #define        CPU_OSFXSR              8       /* int: OS uses FXSAVE/FXRSTOR */
                    475: #define        CPU_SSE                 9       /* int: OS/CPU supports SSE */
                    476: #define        CPU_SSE2                10      /* int: OS/CPU supports SSE2 */
                    477: #define CPU_TMLR_MODE          11      /* int: longrun mode
                    478:                                         * 0: minimum frequency
                    479:                                         * 1: economy
                    480:                                         * 2: performance
                    481:                                         * 3: maximum frequency
                    482:                                         */
                    483: #define CPU_TMLR_FREQUENCY     12      /* int: current frequency */
                    484: #define CPU_TMLR_VOLTAGE       13      /* int: curret voltage */
                    485: #define CPU_TMLR_PERCENTAGE    14      /* int: current clock percentage */
1.76      christos  486: #define        CPU_MAXID               15      /* number of valid machdep ids */
1.19      cgd       487:
                    488: #define        CTL_MACHDEP_NAMES { \
                    489:        { 0, 0 }, \
                    490:        { "console_device", CTLTYPE_STRUCT }, \
1.37      fvdl      491:        { "biosbasemem", CTLTYPE_INT }, \
                    492:        { "biosextmem", CTLTYPE_INT }, \
1.40      drochner  493:        { "booted_kernel", CTLTYPE_STRING }, \
1.52      fvdl      494:        { "diskinfo", CTLTYPE_STRUCT }, \
1.56      fvdl      495:        { "fpu_present", CTLTYPE_INT }, \
1.75      thorpej   496:        { "osfxsr", CTLTYPE_INT }, \
                    497:        { "sse", CTLTYPE_INT }, \
                    498:        { "sse2", CTLTYPE_INT }, \
1.76      christos  499:        { "tm_longrun_mode", CTLTYPE_INT }, \
                    500:        { "tm_longrun_frequency", CTLTYPE_INT }, \
                    501:        { "tm_longrun_voltage", CTLTYPE_INT }, \
                    502:        { "tm_longrun_percentage", CTLTYPE_INT }, \
1.19      cgd       503: }
1.52      fvdl      504:
                    505: /*
                    506:  * Structure for CPU_DISKINFO sysctl call.
                    507:  * XXX this should be somewhere else.
                    508:  */
                    509: #define MAX_BIOSDISKS  16
                    510:
                    511: struct disklist {
                    512:        int dl_nbiosdisks;                         /* number of bios disks */
                    513:        struct biosdisk_info {
                    514:                int bi_dev;                        /* BIOS device # (0x80 ..) */
                    515:                int bi_cyl;                        /* cylinders on disk */
                    516:                int bi_head;                       /* heads per track */
                    517:                int bi_sec;                        /* sectors per track */
1.120     perry     518:                uint64_t bi_lbasecs;               /* total sec. (iff ext13) */
1.52      fvdl      519: #define BIFLAG_INVALID         0x01
                    520: #define BIFLAG_EXTINT13                0x02
                    521:                int bi_flags;
                    522:        } dl_biosdisks[MAX_BIOSDISKS];
                    523:
                    524:        int dl_nnativedisks;                       /* number of native disks */
                    525:        struct nativedisk_info {
                    526:                char ni_devname[16];               /* native device name */
                    527:                int ni_nmatches;                   /* # of matches w/ BIOS */
                    528:                int ni_biosmatches[MAX_BIOSDISKS]; /* indices in dl_biosdisks */
                    529:        } dl_nativedisks[1];                       /* actually longer */
                    530: };
1.14      mycroft   531: #endif /* !_I386_CPU_H_ */

CVSweb <webmaster@jp.NetBSD.org>