diff options
Diffstat (limited to 'usr/src/uts/i86pc/sys')
-rw-r--r-- | usr/src/uts/i86pc/sys/apic.h | 1 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/cpr_impl.h | 72 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/cpr_wakecode.h | 153 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/machclock.h | 18 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/machsystm.h | 2 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/psm_common.h | 2 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/psm_types.h | 47 | ||||
-rw-r--r-- | usr/src/uts/i86pc/sys/smp_impldefs.h | 2 |
8 files changed, 285 insertions, 12 deletions
diff --git a/usr/src/uts/i86pc/sys/apic.h b/usr/src/uts/i86pc/sys/apic.h index 0e692d954b..f4f57e1059 100644 --- a/usr/src/uts/i86pc/sys/apic.h +++ b/usr/src/uts/i86pc/sys/apic.h @@ -699,6 +699,7 @@ extern int apic_rebind_all(apic_irq_t *irq_ptr, int bind_cpu); extern int apic_introp_xlate(dev_info_t *dip, struct intrspec *ispec, int type); extern int apic_intr_ops(dev_info_t *dip, ddi_intr_handle_impl_t *hdlp, psm_intr_op_t intr_op, int *result); +extern int apic_state(psm_state_request_t *); extern boolean_t apic_cpu_in_range(int cpu); extern int apic_check_msi_support(); extern apic_irq_t *apic_find_irq(dev_info_t *dip, struct intrspec *ispec, diff --git a/usr/src/uts/i86pc/sys/cpr_impl.h b/usr/src/uts/i86pc/sys/cpr_impl.h new file mode 100644 index 0000000000..72b76f42d4 --- /dev/null +++ b/usr/src/uts/i86pc/sys/cpr_impl.h @@ -0,0 +1,72 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _SYS_CPR_IMPL_H +#define _SYS_CPR_IMPL_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifndef _ASM + +#include <sys/processor.h> +#include <sys/machparam.h> +#include <sys/vnode.h> +#include <sys/pte.h> + +/* + * This file contains machine dependent information for CPR + */ +#define CPR_MACHTYPE_X86 0x5856 /* 'X'0t86 */ +typedef uint64_t cpr_ptr; +typedef uint64_t cpr_ext; + + +/* + * processor info + */ +struct i86pc_cpu_info { + pnode_t node; + processorid_t cpu_id; +}; + +extern void i_cpr_machdep_setup(void); +extern void i_cpr_enable_intr(void); +extern void i_cpr_stop_intr(void); +extern void i_cpr_handle_xc(int); +extern int i_cpr_check_cprinfo(void); +extern int i_cpr_reusable_supported(void); + +#endif /* _ASM */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SYS_CPR_IMPL_H */ diff --git a/usr/src/uts/i86pc/sys/cpr_wakecode.h b/usr/src/uts/i86pc/sys/cpr_wakecode.h new file mode 100644 index 0000000000..7f55c9dcd6 --- /dev/null +++ b/usr/src/uts/i86pc/sys/cpr_wakecode.h @@ -0,0 +1,153 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef _CPR_WC_H +#define _CPR_WC_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#ifdef __cplusplus +extern "C" { +#endif + +#define WC_CODESIZE 0x400 + +#if ! defined(_ASM) + +#include <sys/rm_platter.h> +#include <sys/psm_types.h> + +typedef struct wc_cpu { + uint64_t wc_retaddr; + uint64_t wc_virtaddr; + uint64_t wc_cr0; + uint64_t wc_cr3; + uint64_t wc_cr4; + uint64_t wc_cr8; + uint64_t wc_fs; + uint64_t wc_fsbase; + uint64_t wc_gs; + uint64_t wc_gsbase; + uint64_t wc_kgsbase; + uint64_t wc_r8; + uint64_t wc_r9; + uint64_t wc_r10; + uint64_t wc_r11; + uint64_t wc_r12; + uint64_t wc_r13; + uint64_t wc_r14; + uint64_t wc_r15; + uint64_t wc_rax; + uint64_t wc_rbp; + uint64_t wc_rbx; + uint64_t wc_rcx; + uint64_t wc_rdi; + uint64_t wc_rdx; + uint64_t wc_rsi; + uint64_t wc_rsp; + +#if defined(__amd64) + /* + * The compiler will want to 64-bit align the 64-bit rm_gdt_base + * pointer, so we need to add an extra four bytes of padding here to + * make sure rm_gdt_lim and rm_gdt_base will align to create a proper + * ten byte GDT pseudo-descriptor. + */ +uint32_t wc_gdt_pad1; +#endif + ushort_t wc_gdt_pad2; + ushort_t wc_gdt_limit; + user_desc_t *wc_gdt_base; + +#if defined(__amd64) + /* + * The compiler will want to 64-bit align the 64-bit rm_idt_base + * pointer, so we need to add an extra four bytes of padding here to + * make sure rm_idt_lim and rm_idt_base will align to create a proper + * ten byte IDT pseudo-descriptor. + */ +uint32_t wc_idt_pad1; +#endif + ushort_t wc_idt_pad2; + ushort_t wc_idt_limit; + user_desc_t *wc_idt_base; + +#if defined(__amd64) + uint64_t wc_tr; + uint64_t wc_ldt; + uint64_t wc_eflags; +#else + uint32_t wc_tr; + uint32_t wc_ldt; + uint32_t wc_eflags; +#endif + + uint32_t wc_ebx; + uint32_t wc_edi; + uint32_t wc_esi; + uint32_t wc_ebp; + uint32_t wc_esp; + uint16_t wc_ss; + uint16_t wc_cs; + uint16_t wc_ds; + uint16_t wc_es; + char wc_stack[400]; + psm_state_request_t wc_apic_state; + + + /* temp stack grows down to here */ +} wc_cpu_t; + +typedef struct wc_wakecode { + rm_platter_t wc_platter; + wc_cpu_t wc_cpu; + + /* temp stack grows down to here */ +} wakecode_t; + +/* + * this is NOT correctly aligned, see description of idt & gdt, limit and + * base in wc_cpu_t above + */ +typedef struct wc_desctbr { + ushort_t limit; + void *base; +} wc_desctbr_t; + +extern int wc_save_context(wc_cpu_t *); +extern void wc_rm_start(void); +extern void wc_rm_end(void); +extern void (*cpr_start_cpu_func)(void); + +#endif /* ! defined(_ASM) */ + +#define WC_STKSTART 0x7fc /* end of rm_platter page */ + +#ifdef __cplusplus +} +#endif + +#endif /* _CPR_WC_H */ diff --git a/usr/src/uts/i86pc/sys/machclock.h b/usr/src/uts/i86pc/sys/machclock.h index 6b3686b95c..a214ada1bc 100644 --- a/usr/src/uts/i86pc/sys/machclock.h +++ b/usr/src/uts/i86pc/sys/machclock.h @@ -40,14 +40,20 @@ extern "C" { struct tod_ops; typedef struct tod_ops tod_ops_t; +/* + * TOD Ops. + * The only functions that _must_ be defined are the tod_get() and + * tod_set() functions. All others may be unused, and need to be + * checked for NULL before using. + */ struct tod_ops { int tod_version; timestruc_t (*tod_get)(tod_ops_t *); void (*tod_set)(tod_ops_t *, timestruc_t); - /* - * On SPARC, additional operations include setting - * and clearing a watchdog timer, as well as power alarms. - */ + uint_t (*tod_set_watchdog_timer)(tod_ops_t *, int); + uint_t (*tod_clear_watchdog_timer)(tod_ops_t *); + void (*tod_set_wake_alarm)(tod_ops_t *, int); + void (*tod_clear_wake_alarm)(tod_ops_t *); struct tod_ops *tod_next; }; @@ -58,6 +64,10 @@ extern char *tod_module_name; #define TODOP_GET(top) ((top)->tod_get(top)) #define TODOP_SET(top, ts) ((top)->tod_set(top, ts)) +#define TODOP_SETWD(top, nsec) ((top)->tod_set_watchdog_timer(top, nsec)) +#define TODOP_CLRWD(top) ((top)->tod_clear_watchdog_timer(top)) +#define TODOP_SETWAKE(top, nsec) ((top)->tod_set_wake_alarm(top, nsec)) +#define TODOP_CLRWAKE(top) ((top)->tod_clear_wake_alarm(top)) #ifdef __cplusplus } diff --git a/usr/src/uts/i86pc/sys/machsystm.h b/usr/src/uts/i86pc/sys/machsystm.h index fdaa21d218..7f5cb22437 100644 --- a/usr/src/uts/i86pc/sys/machsystm.h +++ b/usr/src/uts/i86pc/sys/machsystm.h @@ -56,6 +56,7 @@ extern "C" { extern void mach_cpu_idle(void); extern void mach_cpu_halt(char *); extern int mach_cpu_start(cpu_t *, void *); +extern int mach_cpuid_start(processorid_t, void *); extern int Cpudelay; extern void setcpudelay(void); @@ -116,6 +117,7 @@ extern int mach_cpucontext_init(void); extern void mach_cpucontext_fini(void); extern void *mach_cpucontext_alloc(struct cpu *); extern void mach_cpucontext_free(struct cpu *, void *, int); +extern void rmp_gdt_init(rm_platter_t *); extern uintptr_t hole_start, hole_end; diff --git a/usr/src/uts/i86pc/sys/psm_common.h b/usr/src/uts/i86pc/sys/psm_common.h index ef68cb9f07..b244f186c5 100644 --- a/usr/src/uts/i86pc/sys/psm_common.h +++ b/usr/src/uts/i86pc/sys/psm_common.h @@ -135,6 +135,8 @@ extern void acpi_new_irq_cache_ent(int bus, int dev, int ipin, int pci_irq, extern int acpi_get_irq_cache_ent(uchar_t bus, uchar_t dev, int ipin, int *pci_irqp, iflag_t *intr_flagp); +extern void acpi_restore_link_devices(void); + extern int acpi_poweroff(void); extern void psm_set_elcr(int vecno, int val); diff --git a/usr/src/uts/i86pc/sys/psm_types.h b/usr/src/uts/i86pc/sys/psm_types.h index 70b49ed3dc..17e9db17b1 100644 --- a/usr/src/uts/i86pc/sys/psm_types.h +++ b/usr/src/uts/i86pc/sys/psm_types.h @@ -63,7 +63,32 @@ typedef enum psm_intr_op_e { PSM_INTR_OP_APIC_TYPE /* 15. Returns APIC type */ } psm_intr_op_t; -struct psm_ops { +/* + * PSM_STATE definitions + */ +typedef enum psm_state_op_e { + PSM_STATE_ALLOC = 1, + PSM_STATE_FREE, + PSM_STATE_SAVE, + PSM_STATE_RESTORE +} psm_state_op_t; + +typedef struct psm_state_req { + psm_state_op_t psr_cmd; + union psm_req { + /* + * PSM_STATE_ALLOC, PSM_STATE_FREE, PSM_STATE_SAVE, + * PSM_STATE_RESTORE all use the same struct, + * but union for later expansion + */ + struct { + void *psr_state; + size_t psr_state_size; + } psm_state_req; + } req; +} psm_state_request_t; + +struct psm_ops { int (*psm_probe)(void); void (*psm_softinit)(void); @@ -80,7 +105,8 @@ struct psm_ops { void (*psm_set_idlecpu)(processorid_t cpun); void (*psm_unset_idlecpu)(processorid_t cpun); -#if defined(PSMI_1_3) || defined(PSMI_1_4) || defined(PSMI_1_5) +#if defined(PSMI_1_3) || defined(PSMI_1_4) || defined(PSMI_1_5) || \ + defined(PSMI_1_6) int (*psm_clkinit)(int hertz); #else void (*psm_clkinit)(int hertz); @@ -91,14 +117,14 @@ struct psm_ops { hrtime_t (*psm_gethrtime)(void); processorid_t (*psm_get_next_processorid)(processorid_t cpu_id); -#if defined(PSMI_1_5) +#if defined(PSMI_1_5) || defined(PSMI_1_6) int (*psm_cpu_start)(processorid_t cpun, caddr_t ctxt); #else void (*psm_cpu_start)(processorid_t cpun, caddr_t rm_code); #endif int (*psm_post_cpu_start)(void); #if defined(PSMI_1_2) || defined(PSMI_1_3) || defined(PSMI_1_4) || \ - defined(PSMI_1_5) + defined(PSMI_1_5) || defined(PSMI_1_6) void (*psm_shutdown)(int cmd, int fcn); #else void (*psm_shutdown)(void); @@ -114,22 +140,26 @@ struct psm_ops { #endif void (*psm_notify_error)(int level, char *errmsg); #if defined(PSMI_1_2) || defined(PSMI_1_3) || defined(PSMI_1_4) || \ - defined(PSMI_1_5) + defined(PSMI_1_5) || defined(PSMI_1_6) void (*psm_notify_func)(int msg); #endif -#if defined(PSMI_1_3) || defined(PSMI_1_4) || defined(PSMI_1_5) +#if defined(PSMI_1_3) || defined(PSMI_1_4) || defined(PSMI_1_5) || \ + defined(PSMI_1_6) void (*psm_timer_reprogram)(hrtime_t time); void (*psm_timer_enable)(void); void (*psm_timer_disable)(void); void (*psm_post_cyclic_setup)(void *arg); #endif -#if defined(PSMI_1_4) || defined(PSMI_1_5) +#if defined(PSMI_1_4) || defined(PSMI_1_5) || defined(PSMI_1_6) void (*psm_preshutdown)(int cmd, int fcn); #endif -#if defined(PSMI_1_5) +#if defined(PSMI_1_5) || defined(PSMI_1_6) int (*psm_intr_ops)(dev_info_t *dip, ddi_intr_handle_impl_t *handle, psm_intr_op_t op, int *result); #endif +#if defined(PSMI_1_6) + int (*psm_state)(psm_state_request_t *request); +#endif }; @@ -153,6 +183,7 @@ struct psm_info { #define PSM_INFO_VER01_3 0x8604 #define PSM_INFO_VER01_4 0x8605 #define PSM_INFO_VER01_5 0x8606 +#define PSM_INFO_VER01_6 0x8706 #define PSM_INFO_VER01_X (PSM_INFO_VER01_1 & 0xFFF0) /* ver 1.X */ /* diff --git a/usr/src/uts/i86pc/sys/smp_impldefs.h b/usr/src/uts/i86pc/sys/smp_impldefs.h index 266c0e43a1..6c45d46072 100644 --- a/usr/src/uts/i86pc/sys/smp_impldefs.h +++ b/usr/src/uts/i86pc/sys/smp_impldefs.h @@ -35,6 +35,7 @@ #include <sys/avintr.h> #include <sys/pic.h> #include <sys/xc_levels.h> +#include <sys/psm_types.h> #ifdef __cplusplus extern "C" { @@ -70,6 +71,7 @@ extern void (*psm_timer_reprogram)(hrtime_t); /* timer reprogram */ extern void (*psm_timer_enable)(void); /* timer enable */ extern void (*psm_timer_disable)(void); /* timer disable */ extern void (*psm_post_cyclic_setup)(void *arg); /* psm cyclic setup */ +extern int (*psm_state)(psm_state_request_t *); /* psm state save/restore */ extern int (*slvltovect)(int); /* ipl interrupt priority level */ extern int (*setlvl)(int, int *); /* set intr pri represented by vect */ |