17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5100b72f4Sandrei * Common Development and Distribution License (the "License"). 6100b72f4Sandrei * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22100b72f4Sandrei * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 237c478bd9Sstevel@tonic-gate * Use is subject to license terms. 247c478bd9Sstevel@tonic-gate */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #ifndef _SYS_MACHCPUVAR_H 277c478bd9Sstevel@tonic-gate #define _SYS_MACHCPUVAR_H 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include <sys/intr.h> 327c478bd9Sstevel@tonic-gate #include <sys/clock.h> 337c478bd9Sstevel@tonic-gate #include <sys/machparam.h> 347c478bd9Sstevel@tonic-gate #include <sys/machpcb.h> 357c478bd9Sstevel@tonic-gate #include <sys/privregs.h> 367c478bd9Sstevel@tonic-gate #include <sys/machlock.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 397c478bd9Sstevel@tonic-gate extern "C" { 407c478bd9Sstevel@tonic-gate #endif 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #ifndef _ASM 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #include <sys/obpdefs.h> 457c478bd9Sstevel@tonic-gate #include <sys/async.h> 467c478bd9Sstevel@tonic-gate #include <sys/fm/protocol.h> 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* 497c478bd9Sstevel@tonic-gate * CPU state ptl1_panic save. 507c478bd9Sstevel@tonic-gate */ 517c478bd9Sstevel@tonic-gate typedef struct ptl1_trapregs { 527c478bd9Sstevel@tonic-gate uint32_t ptl1_tl; 537c478bd9Sstevel@tonic-gate uint32_t ptl1_tt; 547c478bd9Sstevel@tonic-gate uint64_t ptl1_tstate; 557c478bd9Sstevel@tonic-gate uint64_t ptl1_tpc; 567c478bd9Sstevel@tonic-gate uint64_t ptl1_tnpc; 577c478bd9Sstevel@tonic-gate } ptl1_trapregs_t; 587c478bd9Sstevel@tonic-gate 5949a230e1Ssvemuri typedef struct ptl1_gregs { 6049a230e1Ssvemuri uint64_t ptl1_gl; 617c478bd9Sstevel@tonic-gate uint64_t ptl1_g1; 627c478bd9Sstevel@tonic-gate uint64_t ptl1_g2; 637c478bd9Sstevel@tonic-gate uint64_t ptl1_g3; 647c478bd9Sstevel@tonic-gate uint64_t ptl1_g4; 657c478bd9Sstevel@tonic-gate uint64_t ptl1_g5; 667c478bd9Sstevel@tonic-gate uint64_t ptl1_g6; 677c478bd9Sstevel@tonic-gate uint64_t ptl1_g7; 6849a230e1Ssvemuri } ptl1_gregs_t; 6949a230e1Ssvemuri 7049a230e1Ssvemuri typedef struct ptl1_regs { 7149a230e1Ssvemuri ptl1_trapregs_t ptl1_trap_regs[PTL1_MAXTL]; 7249a230e1Ssvemuri ptl1_gregs_t ptl1_gregs[PTL1_MAXGL + 1]; 737c478bd9Sstevel@tonic-gate uint64_t ptl1_tick; 7449a230e1Ssvemuri uint64_t ptl1_dmmu_type; 7549a230e1Ssvemuri uint64_t ptl1_dmmu_addr; 7649a230e1Ssvemuri uint64_t ptl1_dmmu_ctx; 7749a230e1Ssvemuri uint64_t ptl1_immu_type; 7849a230e1Ssvemuri uint64_t ptl1_immu_addr; 7949a230e1Ssvemuri uint64_t ptl1_immu_ctx; 807c478bd9Sstevel@tonic-gate struct rwindow ptl1_rwindow[MAXWIN]; 817c478bd9Sstevel@tonic-gate uint32_t ptl1_softint; 827c478bd9Sstevel@tonic-gate uint16_t ptl1_pstate; 837c478bd9Sstevel@tonic-gate uint8_t ptl1_pil; 847c478bd9Sstevel@tonic-gate uint8_t ptl1_cwp; 857c478bd9Sstevel@tonic-gate uint8_t ptl1_wstate; 867c478bd9Sstevel@tonic-gate uint8_t ptl1_otherwin; 877c478bd9Sstevel@tonic-gate uint8_t ptl1_cleanwin; 887c478bd9Sstevel@tonic-gate uint8_t ptl1_cansave; 897c478bd9Sstevel@tonic-gate uint8_t ptl1_canrestore; 907c478bd9Sstevel@tonic-gate } ptl1_regs_t; 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate typedef struct ptl1_state { 937c478bd9Sstevel@tonic-gate ptl1_regs_t ptl1_regs; 947c478bd9Sstevel@tonic-gate uint32_t ptl1_entry_count; 957c478bd9Sstevel@tonic-gate uintptr_t ptl1_stktop; 967c478bd9Sstevel@tonic-gate ulong_t ptl1_stk[1]; 977c478bd9Sstevel@tonic-gate } ptl1_state_t; 987c478bd9Sstevel@tonic-gate 997c478bd9Sstevel@tonic-gate /* 1007c478bd9Sstevel@tonic-gate * Machine specific fields of the cpu struct 1017c478bd9Sstevel@tonic-gate * defined in common/sys/cpuvar.h. 1027c478bd9Sstevel@tonic-gate */ 1037c478bd9Sstevel@tonic-gate struct machcpu { 1047c478bd9Sstevel@tonic-gate struct machpcb *mpcb; 1057c478bd9Sstevel@tonic-gate uint64_t mpcb_pa; 1067c478bd9Sstevel@tonic-gate int mutex_ready; 1077c478bd9Sstevel@tonic-gate int in_prom; 1087c478bd9Sstevel@tonic-gate int tl1_hdlr; 1097c478bd9Sstevel@tonic-gate char cpu_tstat_flags; /* tstat flags */ 1107c478bd9Sstevel@tonic-gate uint16_t divisor; /* Estar %tick clock ratio */ 1117c478bd9Sstevel@tonic-gate uint8_t intrcnt; /* number of back-to-back interrupts */ 1127c478bd9Sstevel@tonic-gate u_longlong_t tmp1; /* per-cpu tmps */ 1137c478bd9Sstevel@tonic-gate u_longlong_t tmp2; /* used in trap processing */ 1147c478bd9Sstevel@tonic-gate 115*b0fc0e77Sgovinda struct intr_vec *intr_head[PIL_LEVELS]; /* intr queue heads per pil */ 116*b0fc0e77Sgovinda struct intr_vec *intr_tail[PIL_LEVELS]; /* intr queue tails per pil */ 1177c478bd9Sstevel@tonic-gate boolean_t poke_cpu_outstanding; 1187c478bd9Sstevel@tonic-gate /* 1197c478bd9Sstevel@tonic-gate * The cpu module allocates a private data structure for the 1207c478bd9Sstevel@tonic-gate * E$ data, which is needed for the specific cpu type. 1217c478bd9Sstevel@tonic-gate */ 1227c478bd9Sstevel@tonic-gate void *cpu_private; /* ptr to cpu private data */ 1231e2e7a75Shuah /* 1241e2e7a75Shuah * per-MMU ctxdom CPU data. 1251e2e7a75Shuah */ 1261e2e7a75Shuah uint_t cpu_mmu_idx; 1271e2e7a75Shuah struct mmu_ctx *cpu_mmu_ctxp; 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gate ptl1_state_t ptl1_state; 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate uint64_t pil_high_start[HIGH_LEVELS]; /* high-level intrs */ 1327c478bd9Sstevel@tonic-gate 1337c478bd9Sstevel@tonic-gate /* 1347c478bd9Sstevel@tonic-gate * intrstat[][] is used to keep track of ticks used at a given pil 1357c478bd9Sstevel@tonic-gate * level. intrstat[pil][0] is cumulative and exported via kstats. 1367c478bd9Sstevel@tonic-gate * intrstat[pil][1] is used in intr_get_time() and is private. 1377c478bd9Sstevel@tonic-gate * 2-dimensional array improves cache locality. 1387c478bd9Sstevel@tonic-gate */ 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate uint64_t intrstat[PIL_MAX+1][2]; 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gate int kwbuf_full; 1437c478bd9Sstevel@tonic-gate caddr_t kwbuf_sp; 1447c478bd9Sstevel@tonic-gate struct rwindow kwbuf; 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate caddr_t cpu_q_va; /* cpu intrq base VA */ 1477c478bd9Sstevel@tonic-gate caddr_t dev_q_va; /* dev intrq base VA */ 1487c478bd9Sstevel@tonic-gate uint64_t cpu_q_base_pa; /* cpu intrq base PA */ 1497c478bd9Sstevel@tonic-gate uint64_t cpu_q_size; 1507c478bd9Sstevel@tonic-gate uint64_t dev_q_base_pa; /* dev intrq base PA */ 1517c478bd9Sstevel@tonic-gate uint64_t dev_q_size; 1527c478bd9Sstevel@tonic-gate caddr_t cpu_rq_va; /* resumable Q base VA */ 1537c478bd9Sstevel@tonic-gate caddr_t cpu_nrq_va; /* nonresumable Q base VA */ 1547c478bd9Sstevel@tonic-gate uint64_t cpu_rq_base_pa; /* resumable Q base PA */ 1557c478bd9Sstevel@tonic-gate uint64_t cpu_rq_size; /* resumable Q size */ 1567c478bd9Sstevel@tonic-gate uint64_t cpu_nrq_base_pa; /* nonresumable Q base PA */ 1577c478bd9Sstevel@tonic-gate uint64_t cpu_nrq_size; /* nonresumable Q size */ 1587c478bd9Sstevel@tonic-gate caddr_t mondo_data; /* send mondo data */ 1597c478bd9Sstevel@tonic-gate uint64_t mondo_data_ra; /* mono data pa */ 1607c478bd9Sstevel@tonic-gate uint16_t *cpu_list; /* uint16_t [NCPU] */ 1617c478bd9Sstevel@tonic-gate uint64_t cpu_list_ra; /* cpu list ra */ 16270f54eadSesaxe id_t cpu_ipipe; /* cpu exec unit id */ 1639d7041eeSandrei kthread_t *startup_thread; 1647c478bd9Sstevel@tonic-gate }; 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate typedef struct machcpu machcpu_t; 1677c478bd9Sstevel@tonic-gate 1689d7041eeSandrei #define cpu_startup_thread cpu_m.startup_thread 1691e2e7a75Shuah #define CPU_MMU_IDX(cp) ((cp)->cpu_m.cpu_mmu_idx) 1701e2e7a75Shuah #define CPU_MMU_CTXP(cp) ((cp)->cpu_m.cpu_mmu_ctxp) 171100b72f4Sandrei #define NINTR_THREADS (LOCK_LEVEL) /* number of interrupt threads */ 1729d7041eeSandrei 1737c478bd9Sstevel@tonic-gate /* 1747c478bd9Sstevel@tonic-gate * Macro to access the "cpu private" data structure. 1757c478bd9Sstevel@tonic-gate */ 1767c478bd9Sstevel@tonic-gate #define CPU_PRIVATE(cp) ((cp)->cpu_m.cpu_private) 1777c478bd9Sstevel@tonic-gate 1787c478bd9Sstevel@tonic-gate /* 1797c478bd9Sstevel@tonic-gate * The OpenBoot Standalone Interface supplies the kernel with 1807c478bd9Sstevel@tonic-gate * implementation dependent parameters through the devinfo/property mechanism 1817c478bd9Sstevel@tonic-gate */ 1827c478bd9Sstevel@tonic-gate #define MAXSYSNAME 20 1837c478bd9Sstevel@tonic-gate 1847c478bd9Sstevel@tonic-gate /* 1857c478bd9Sstevel@tonic-gate * Used to indicate busy/idle state of a cpu. 1867c478bd9Sstevel@tonic-gate * msram field will be set with ECACHE_CPU_MIRROR if we are on 1877c478bd9Sstevel@tonic-gate * mirrored sram module. 1887c478bd9Sstevel@tonic-gate */ 1897c478bd9Sstevel@tonic-gate #define ECACHE_CPU_IDLE 0x0 /* CPU is idle */ 1907c478bd9Sstevel@tonic-gate #define ECACHE_CPU_BUSY 0x1 /* CPU is busy */ 1917c478bd9Sstevel@tonic-gate #define ECACHE_CPU_MIRROR 0x2 /* E$ is mirrored */ 1927c478bd9Sstevel@tonic-gate #define ECACHE_CPU_NON_MIRROR 0x3 /* E$ is not mirrored */ 1937c478bd9Sstevel@tonic-gate 1947c478bd9Sstevel@tonic-gate /* 1957c478bd9Sstevel@tonic-gate * A CPU FRU FMRI string minus the unum component. 1967c478bd9Sstevel@tonic-gate */ 1977c478bd9Sstevel@tonic-gate #define CPU_FRU_FMRI FM_FMRI_SCHEME_HC":///" \ 1987c478bd9Sstevel@tonic-gate FM_FMRI_LEGACY_HC"=" 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate struct cpu_node { 2017c478bd9Sstevel@tonic-gate char name[MAXSYSNAME]; 2027c478bd9Sstevel@tonic-gate char fru_fmri[sizeof (CPU_FRU_FMRI) + UNUM_NAMLEN]; 2037c478bd9Sstevel@tonic-gate int cpuid; 204fa9e4066Sahrens pnode_t nodeid; 2057c478bd9Sstevel@tonic-gate uint64_t clock_freq; 2067c478bd9Sstevel@tonic-gate uint_t tick_nsec_scale; 2077c478bd9Sstevel@tonic-gate union { 2087c478bd9Sstevel@tonic-gate int dummy; 2097c478bd9Sstevel@tonic-gate } u_info; 2107c478bd9Sstevel@tonic-gate int ecache_size; 2117c478bd9Sstevel@tonic-gate int ecache_linesize; 2127c478bd9Sstevel@tonic-gate int ecache_associativity; 2137c478bd9Sstevel@tonic-gate int ecache_setsize; 2147c478bd9Sstevel@tonic-gate uint64_t device_id; 2151ae08745Sheppo id_t exec_unit_mapping; 2167c478bd9Sstevel@tonic-gate }; 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate extern struct cpu_node cpunodes[]; 2197c478bd9Sstevel@tonic-gate 2207c478bd9Sstevel@tonic-gate #endif /* _ASM */ 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2237c478bd9Sstevel@tonic-gate } 2247c478bd9Sstevel@tonic-gate #endif 2257c478bd9Sstevel@tonic-gate 2267c478bd9Sstevel@tonic-gate #endif /* _SYS_MACHCPUVAR_H */ 227