1*ae115bc7Smrj /* 2*ae115bc7Smrj * CDDL HEADER START 3*ae115bc7Smrj * 4*ae115bc7Smrj * The contents of this file are subject to the terms of the 5*ae115bc7Smrj * Common Development and Distribution License (the "License"). 6*ae115bc7Smrj * You may not use this file except in compliance with the License. 7*ae115bc7Smrj * 8*ae115bc7Smrj * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*ae115bc7Smrj * or http://www.opensolaris.org/os/licensing. 10*ae115bc7Smrj * See the License for the specific language governing permissions 11*ae115bc7Smrj * and limitations under the License. 12*ae115bc7Smrj * 13*ae115bc7Smrj * When distributing Covered Code, include this CDDL HEADER in each 14*ae115bc7Smrj * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*ae115bc7Smrj * If applicable, add the following below this CDDL HEADER, with the 16*ae115bc7Smrj * fields enclosed by brackets "[]" replaced with your own identifying 17*ae115bc7Smrj * information: Portions Copyright [yyyy] [name of copyright owner] 18*ae115bc7Smrj * 19*ae115bc7Smrj * CDDL HEADER END 20*ae115bc7Smrj */ 21*ae115bc7Smrj /* 22*ae115bc7Smrj * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23*ae115bc7Smrj * Use is subject to license terms. 24*ae115bc7Smrj */ 25*ae115bc7Smrj 26*ae115bc7Smrj #ifndef _SYS_APIC_APIC_H 27*ae115bc7Smrj #define _SYS_APIC_APIC_H 28*ae115bc7Smrj 29*ae115bc7Smrj #pragma ident "%Z%%M% %I% %E% SMI" 30*ae115bc7Smrj 31*ae115bc7Smrj #include <sys/psm_types.h> 32*ae115bc7Smrj 33*ae115bc7Smrj #ifdef __cplusplus 34*ae115bc7Smrj extern "C" { 35*ae115bc7Smrj #endif 36*ae115bc7Smrj 37*ae115bc7Smrj #include <sys/psm_common.h> 38*ae115bc7Smrj 39*ae115bc7Smrj #define APIC_IO_ADDR 0xfec00000 40*ae115bc7Smrj #define APIC_LOCAL_ADDR 0xfee00000 41*ae115bc7Smrj #define APIC_IO_MEMLEN 0xf 42*ae115bc7Smrj #define APIC_LOCAL_MEMLEN 0xfffff 43*ae115bc7Smrj 44*ae115bc7Smrj /* Local Unit ID register */ 45*ae115bc7Smrj #define APIC_LID_REG 0x8 46*ae115bc7Smrj 47*ae115bc7Smrj /* I/o Unit Version Register */ 48*ae115bc7Smrj #define APIC_VERS_REG 0xc 49*ae115bc7Smrj 50*ae115bc7Smrj /* Task Priority register */ 51*ae115bc7Smrj #define APIC_TASK_REG 0x20 52*ae115bc7Smrj 53*ae115bc7Smrj /* EOI register */ 54*ae115bc7Smrj #define APIC_EOI_REG 0x2c 55*ae115bc7Smrj 56*ae115bc7Smrj /* Remote Read register */ 57*ae115bc7Smrj #define APIC_REMOTE_READ 0x30 58*ae115bc7Smrj 59*ae115bc7Smrj /* Logical Destination register */ 60*ae115bc7Smrj #define APIC_DEST_REG 0x34 61*ae115bc7Smrj 62*ae115bc7Smrj /* Destination Format rgister */ 63*ae115bc7Smrj #define APIC_FORMAT_REG 0x38 64*ae115bc7Smrj 65*ae115bc7Smrj /* Spurious Interrupt Vector register */ 66*ae115bc7Smrj #define APIC_SPUR_INT_REG 0x3c 67*ae115bc7Smrj 68*ae115bc7Smrj /* Error Status Register */ 69*ae115bc7Smrj #define APIC_ERROR_STATUS 0xa0 70*ae115bc7Smrj 71*ae115bc7Smrj /* Interrupt Command registers */ 72*ae115bc7Smrj #define APIC_INT_CMD1 0xc0 73*ae115bc7Smrj #define APIC_INT_CMD2 0xc4 74*ae115bc7Smrj 75*ae115bc7Smrj /* Timer Vector Table register */ 76*ae115bc7Smrj #define APIC_LOCAL_TIMER 0xc8 77*ae115bc7Smrj 78*ae115bc7Smrj /* Local Interrupt Vector registers */ 79*ae115bc7Smrj #define APIC_PCINT_VECT 0xd0 80*ae115bc7Smrj #define APIC_INT_VECT0 0xd4 81*ae115bc7Smrj #define APIC_INT_VECT1 0xd8 82*ae115bc7Smrj #define APIC_ERR_VECT 0xdc 83*ae115bc7Smrj 84*ae115bc7Smrj /* IPL for performance counter interrupts */ 85*ae115bc7Smrj #define APIC_PCINT_IPL 0xe 86*ae115bc7Smrj #define APIC_LVT_MASK 0x10000 /* Mask bit (16) in LVT */ 87*ae115bc7Smrj 88*ae115bc7Smrj /* Initial Count register */ 89*ae115bc7Smrj #define APIC_INIT_COUNT 0xe0 90*ae115bc7Smrj 91*ae115bc7Smrj /* Current Count Register */ 92*ae115bc7Smrj #define APIC_CURR_COUNT 0xe4 93*ae115bc7Smrj #define APIC_CURR_ADD 0x39 /* used for remote read command */ 94*ae115bc7Smrj #define CURR_COUNT_OFFSET (sizeof (int32_t) * APIC_CURR_COUNT) 95*ae115bc7Smrj 96*ae115bc7Smrj /* Divider Configuration Register */ 97*ae115bc7Smrj #define APIC_DIVIDE_REG 0xf8 98*ae115bc7Smrj 99*ae115bc7Smrj /* IRR register */ 100*ae115bc7Smrj #define APIC_IRR_REG 0x80 101*ae115bc7Smrj 102*ae115bc7Smrj /* ISR register */ 103*ae115bc7Smrj #define APIC_ISR_REG 0x40 104*ae115bc7Smrj 105*ae115bc7Smrj #define APIC_IO_REG 0x0 106*ae115bc7Smrj #define APIC_IO_DATA 0x4 107*ae115bc7Smrj 108*ae115bc7Smrj /* Bit offset of APIC ID in LID_REG, INT_CMD and in DEST_REG */ 109*ae115bc7Smrj #define APIC_ID_BIT_OFFSET 24 110*ae115bc7Smrj #define APIC_ICR_ID_BIT_OFFSET 24 111*ae115bc7Smrj #define APIC_LDR_ID_BIT_OFFSET 24 112*ae115bc7Smrj 113*ae115bc7Smrj /* 114*ae115bc7Smrj * Choose between flat and clustered models by writing the following to the 115*ae115bc7Smrj * FORMAT_REG. 82489 DX documentation seemed to suggest that writing 0 will 116*ae115bc7Smrj * disable logical destination mode. 117*ae115bc7Smrj * Does not seem to be in the docs for local APICs on the processors. 118*ae115bc7Smrj */ 119*ae115bc7Smrj #define APIC_FLAT_MODEL 0xFFFFFFFFUL 120*ae115bc7Smrj #define APIC_CLUSTER_MODEL 0x0FFFFFFF 121*ae115bc7Smrj 122*ae115bc7Smrj /* 123*ae115bc7Smrj * The commands which follow are window selectors written to APIC_IO_REG 124*ae115bc7Smrj * before data can be read/written from/to APIC_IO_DATA 125*ae115bc7Smrj */ 126*ae115bc7Smrj 127*ae115bc7Smrj #define APIC_ID_CMD 0x0 128*ae115bc7Smrj #define APIC_VERS_CMD 0x1 129*ae115bc7Smrj #define APIC_RDT_CMD 0x10 130*ae115bc7Smrj #define APIC_RDT_CMD2 0x11 131*ae115bc7Smrj 132*ae115bc7Smrj #define APIC_INTEGRATED_VERS 0x10 /* 0x10 & above indicates integrated */ 133*ae115bc7Smrj #define IOAPIC_VER_82489DX 0x01 /* Version ID: 82489DX External APIC */ 134*ae115bc7Smrj 135*ae115bc7Smrj #define APIC_INT_SPURIOUS -1 136*ae115bc7Smrj 137*ae115bc7Smrj #define APIC_IMCR_P1 0x22 /* int mode conf register port 1 */ 138*ae115bc7Smrj #define APIC_IMCR_P2 0x23 /* int mode conf register port 2 */ 139*ae115bc7Smrj #define APIC_IMCR_SELECT 0x70 /* select imcr by writing into P1 */ 140*ae115bc7Smrj #define APIC_IMCR_PIC 0x0 /* selects PIC mode (8259-> BSP) */ 141*ae115bc7Smrj #define APIC_IMCR_APIC 0x1 /* selects APIC mode (8259->APIC) */ 142*ae115bc7Smrj 143*ae115bc7Smrj #define APIC_CT_VECT 0x4ac /* conf table vector */ 144*ae115bc7Smrj #define APIC_CT_SIZE 1024 /* conf table size */ 145*ae115bc7Smrj 146*ae115bc7Smrj #define APIC_ID 'MPAT' /* conf table signature */ 147*ae115bc7Smrj 148*ae115bc7Smrj 149*ae115bc7Smrj /* 150*ae115bc7Smrj * MP floating pointer structure defined in Intel MP Spec 1.1 151*ae115bc7Smrj */ 152*ae115bc7Smrj struct apic_mpfps_hdr { 153*ae115bc7Smrj uint32_t mpfps_sig; /* _MP_ (0x5F4D505F) */ 154*ae115bc7Smrj uint32_t mpfps_mpct_paddr; /* paddr of MP configuration tbl */ 155*ae115bc7Smrj uchar_t mpfps_length; /* in paragraph (16-bytes units) */ 156*ae115bc7Smrj uchar_t mpfps_spec_rev; /* version number of MP spec */ 157*ae115bc7Smrj uchar_t mpfps_checksum; /* checksum of complete structure */ 158*ae115bc7Smrj uchar_t mpfps_featinfo1; /* mp feature info bytes 1 */ 159*ae115bc7Smrj uchar_t mpfps_featinfo2; /* mp feature info bytes 2 */ 160*ae115bc7Smrj uchar_t mpfps_featinfo3; /* mp feature info bytes 3 */ 161*ae115bc7Smrj uchar_t mpfps_featinfo4; /* mp feature info bytes 4 */ 162*ae115bc7Smrj uchar_t mpfps_featinfo5; /* mp feature info bytes 5 */ 163*ae115bc7Smrj }; 164*ae115bc7Smrj 165*ae115bc7Smrj #define MPFPS_FEATINFO2_IMCRP 0x80 /* IMCRP presence bit */ 166*ae115bc7Smrj 167*ae115bc7Smrj #define APIC_MPS_OEM_ID_LEN 8 168*ae115bc7Smrj #define APIC_MPS_PROD_ID_LEN 12 169*ae115bc7Smrj 170*ae115bc7Smrj struct apic_mp_cnf_hdr { 171*ae115bc7Smrj uint_t mpcnf_sig; 172*ae115bc7Smrj 173*ae115bc7Smrj uint_t mpcnf_tbl_length: 16, 174*ae115bc7Smrj mpcnf_spec: 8, 175*ae115bc7Smrj mpcnf_cksum: 8; 176*ae115bc7Smrj 177*ae115bc7Smrj char mpcnf_oem_str[APIC_MPS_OEM_ID_LEN]; 178*ae115bc7Smrj 179*ae115bc7Smrj char mpcnf_prod_str[APIC_MPS_PROD_ID_LEN]; 180*ae115bc7Smrj 181*ae115bc7Smrj uint_t mpcnf_oem_ptr; 182*ae115bc7Smrj 183*ae115bc7Smrj uint_t mpcnf_oem_tbl_size: 16, 184*ae115bc7Smrj mpcnf_entry_cnt: 16; 185*ae115bc7Smrj 186*ae115bc7Smrj uint_t mpcnf_local_apic; 187*ae115bc7Smrj 188*ae115bc7Smrj uint_t mpcnf_resv; 189*ae115bc7Smrj }; 190*ae115bc7Smrj 191*ae115bc7Smrj struct apic_procent { 192*ae115bc7Smrj uint_t proc_entry: 8, 193*ae115bc7Smrj proc_apicid: 8, 194*ae115bc7Smrj proc_version: 8, 195*ae115bc7Smrj proc_cpuflags: 8; 196*ae115bc7Smrj 197*ae115bc7Smrj uint_t proc_stepping: 4, 198*ae115bc7Smrj proc_model: 4, 199*ae115bc7Smrj proc_family: 4, 200*ae115bc7Smrj proc_type: 2, /* undocumented feature */ 201*ae115bc7Smrj proc_resv1: 18; 202*ae115bc7Smrj 203*ae115bc7Smrj uint_t proc_feature; 204*ae115bc7Smrj 205*ae115bc7Smrj uint_t proc_resv2; 206*ae115bc7Smrj 207*ae115bc7Smrj uint_t proc_resv3; 208*ae115bc7Smrj }; 209*ae115bc7Smrj 210*ae115bc7Smrj /* 211*ae115bc7Smrj * proc_cpuflags definitions 212*ae115bc7Smrj */ 213*ae115bc7Smrj #define CPUFLAGS_EN 1 /* if not set, this processor is unusable */ 214*ae115bc7Smrj #define CPUFLAGS_BP 2 /* set if this is the bootstrap processor */ 215*ae115bc7Smrj 216*ae115bc7Smrj 217*ae115bc7Smrj struct apic_bus { 218*ae115bc7Smrj uchar_t bus_entry; 219*ae115bc7Smrj uchar_t bus_id; 220*ae115bc7Smrj ushort_t bus_str1; 221*ae115bc7Smrj uint_t bus_str2; 222*ae115bc7Smrj }; 223*ae115bc7Smrj 224*ae115bc7Smrj struct apic_io_entry { 225*ae115bc7Smrj uint_t io_entry: 8, 226*ae115bc7Smrj io_apicid: 8, 227*ae115bc7Smrj io_version: 8, 228*ae115bc7Smrj io_flags: 8; 229*ae115bc7Smrj 230*ae115bc7Smrj uint_t io_apic_addr; 231*ae115bc7Smrj }; 232*ae115bc7Smrj 233*ae115bc7Smrj #define IOAPIC_FLAGS_EN 0x01 /* this I/O apic is enable or not */ 234*ae115bc7Smrj 235*ae115bc7Smrj #define MAX_IO_APIC 32 /* maximum # of IOAPICs supported */ 236*ae115bc7Smrj 237*ae115bc7Smrj struct apic_io_intr { 238*ae115bc7Smrj uint_t intr_entry: 8, 239*ae115bc7Smrj intr_type: 8, 240*ae115bc7Smrj intr_po: 2, 241*ae115bc7Smrj intr_el: 2, 242*ae115bc7Smrj intr_resv: 12; 243*ae115bc7Smrj 244*ae115bc7Smrj uint_t intr_busid: 8, 245*ae115bc7Smrj intr_irq: 8, 246*ae115bc7Smrj intr_destid: 8, 247*ae115bc7Smrj intr_destintin: 8; 248*ae115bc7Smrj }; 249*ae115bc7Smrj 250*ae115bc7Smrj /* 251*ae115bc7Smrj * intr_type definitions 252*ae115bc7Smrj */ 253*ae115bc7Smrj #define IO_INTR_INT 0x00 254*ae115bc7Smrj #define IO_INTR_NMI 0x01 255*ae115bc7Smrj #define IO_INTR_SMI 0x02 256*ae115bc7Smrj #define IO_INTR_EXTINT 0x03 257*ae115bc7Smrj 258*ae115bc7Smrj /* 259*ae115bc7Smrj * destination APIC ID 260*ae115bc7Smrj */ 261*ae115bc7Smrj #define INTR_ALL_APIC 0xff 262*ae115bc7Smrj 263*ae115bc7Smrj 264*ae115bc7Smrj /* local vector table */ 265*ae115bc7Smrj #define AV_MASK 0x10000 266*ae115bc7Smrj 267*ae115bc7Smrj /* interrupt command register 32-63 */ 268*ae115bc7Smrj #define AV_TOALL 0x7fffffff 269*ae115bc7Smrj #define AV_HIGH_ORDER 0x40000000 270*ae115bc7Smrj #define AV_IM_OFF 0x40000000 271*ae115bc7Smrj 272*ae115bc7Smrj /* interrupt command register 0-31 */ 273*ae115bc7Smrj #define AV_FIXED 0x000 274*ae115bc7Smrj #define AV_LOPRI 0x100 275*ae115bc7Smrj #define AV_REMOTE 0x300 276*ae115bc7Smrj #define AV_NMI 0x400 277*ae115bc7Smrj #define AV_RESET 0x500 278*ae115bc7Smrj #define AV_STARTUP 0x600 279*ae115bc7Smrj #define AV_EXTINT 0x700 280*ae115bc7Smrj 281*ae115bc7Smrj #define AV_PDEST 0x000 282*ae115bc7Smrj #define AV_LDEST 0x800 283*ae115bc7Smrj 284*ae115bc7Smrj /* IO & Local APIC Bit Definitions */ 285*ae115bc7Smrj #define RDT_VECTOR(x) ((uchar_t)((x) & 0xFF)) 286*ae115bc7Smrj #define AV_PENDING 0x1000 287*ae115bc7Smrj #define AV_ACTIVE_LOW 0x2000 /* only for integrated APIC */ 288*ae115bc7Smrj #define AV_REMOTE_IRR 0x4000 /* IOAPIC RDT-specific */ 289*ae115bc7Smrj #define AV_LEVEL 0x8000 290*ae115bc7Smrj #define AV_DEASSERT AV_LEVEL 291*ae115bc7Smrj #define AV_ASSERT 0xc000 292*ae115bc7Smrj 293*ae115bc7Smrj #define AV_READ_PENDING 0x10000 294*ae115bc7Smrj #define AV_REMOTE_STATUS 0x20000 /* 1 = valid, 0 = invalid */ 295*ae115bc7Smrj 296*ae115bc7Smrj #define AV_SH_SELF 0x40000 /* Short hand for self */ 297*ae115bc7Smrj #define AV_SH_ALL_INCSELF 0x80000 /* All processors */ 298*ae115bc7Smrj #define AV_SH_ALL_EXCSELF 0xc0000 /* All excluding self */ 299*ae115bc7Smrj /* spurious interrupt vector register */ 300*ae115bc7Smrj #define AV_UNIT_ENABLE 0x100 301*ae115bc7Smrj 302*ae115bc7Smrj /* timer vector table */ 303*ae115bc7Smrj #define AV_TIME 0x20000 /* Set timer mode to periodic */ 304*ae115bc7Smrj 305*ae115bc7Smrj #define APIC_MAXVAL 0xffffffffUL 306*ae115bc7Smrj #define APIC_TIME_MIN 0x5000 307*ae115bc7Smrj #define APIC_TIME_COUNT 0x4000 308*ae115bc7Smrj 309*ae115bc7Smrj /* 310*ae115bc7Smrj * Range of the low byte value in apic_tick before starting calibration 311*ae115bc7Smrj */ 312*ae115bc7Smrj #define APIC_LB_MIN 0x60 313*ae115bc7Smrj #define APIC_LB_MAX 0xe0 314*ae115bc7Smrj 315*ae115bc7Smrj #define APIC_MAX_VECTOR 255 316*ae115bc7Smrj #define APIC_RESV_VECT 0x00 317*ae115bc7Smrj #define APIC_RESV_IRQ 0xfe 318*ae115bc7Smrj #define APIC_BASE_VECT 0x20 /* This will come in as interrupt 0 */ 319*ae115bc7Smrj #define APIC_AVAIL_VECTOR (APIC_MAX_VECTOR+1-APIC_BASE_VECT) 320*ae115bc7Smrj #define APIC_VECTOR_PER_IPL 0x10 /* # of vectors before PRI changes */ 321*ae115bc7Smrj #define APIC_VECTOR(ipl) (apic_ipltopri[ipl] | APIC_RESV_VECT) 322*ae115bc7Smrj #define APIC_VECTOR_MASK 0x0f 323*ae115bc7Smrj #define APIC_HI_PRI_VECTS 2 /* vects reserved for hi pri reqs */ 324*ae115bc7Smrj #define APIC_IPL_MASK 0xf0 325*ae115bc7Smrj #define APIC_IPL_SHIFT 4 /* >> to get ipl part of vector */ 326*ae115bc7Smrj #define APIC_FIRST_FREE_IRQ 0x10 327*ae115bc7Smrj #define APIC_MAX_ISA_IRQ 15 328*ae115bc7Smrj #define APIC_IPL0 0x0f /* let IDLE_IPL be the lowest */ 329*ae115bc7Smrj #define APIC_IDLE_IPL 0x00 330*ae115bc7Smrj 331*ae115bc7Smrj #define APIC_MASK_ALL 0xf0 /* Mask all interrupts */ 332*ae115bc7Smrj 333*ae115bc7Smrj /* spurious interrupt vector */ 334*ae115bc7Smrj #define APIC_SPUR_INTR 0xFF 335*ae115bc7Smrj 336*ae115bc7Smrj /* special or reserve vectors */ 337*ae115bc7Smrj #define APIC_CHECK_RESERVE_VECTORS(v) \ 338*ae115bc7Smrj ((v == T_FASTTRAP) || (v == APIC_SPUR_INTR) || (v == T_SYSCALLINT) || \ 339*ae115bc7Smrj (v == T_DTRACE_RET) || (v == T_INT80)) 340*ae115bc7Smrj 341*ae115bc7Smrj /* cmos shutdown code for BIOS */ 342*ae115bc7Smrj #define BIOS_SHUTDOWN 0x0a 343*ae115bc7Smrj 344*ae115bc7Smrj /* define the entry types for BIOS information tables as defined in PC+MP */ 345*ae115bc7Smrj #define APIC_CPU_ENTRY 0 346*ae115bc7Smrj #define APIC_BUS_ENTRY 1 347*ae115bc7Smrj #define APIC_IO_ENTRY 2 348*ae115bc7Smrj #define APIC_IO_INTR_ENTRY 3 349*ae115bc7Smrj #define APIC_LOCAL_INTR_ENTRY 4 350*ae115bc7Smrj #define APIC_MPTBL_ADDR (639 * 1024) 351*ae115bc7Smrj /* 352*ae115bc7Smrj * The MP Floating Point structure could be in 1st 1KB of EBDA or last KB 353*ae115bc7Smrj * of system base memory or in ROM between 0xF0000 and 0xFFFFF 354*ae115bc7Smrj */ 355*ae115bc7Smrj #define MPFPS_RAM_WIN_LEN 1024 356*ae115bc7Smrj #define MPFPS_ROM_WIN_START (uint32_t)0xf0000 357*ae115bc7Smrj #define MPFPS_ROM_WIN_LEN 0x10000 358*ae115bc7Smrj 359*ae115bc7Smrj #define EISA_LEVEL_CNTL 0x4D0 360*ae115bc7Smrj 361*ae115bc7Smrj /* definitions for apic_irq_table */ 362*ae115bc7Smrj #define FREE_INDEX (short)-1 /* empty slot */ 363*ae115bc7Smrj #define RESERVE_INDEX (short)-2 /* ipi, softintr, clkintr */ 364*ae115bc7Smrj #define ACPI_INDEX (short)-3 /* ACPI */ 365*ae115bc7Smrj #define MSI_INDEX (short)-4 /* MSI */ 366*ae115bc7Smrj #define MSIX_INDEX (short)-5 /* MSI-X */ 367*ae115bc7Smrj #define DEFAULT_INDEX (short)0x7FFF 368*ae115bc7Smrj /* biggest positive no. to avoid conflict with actual index */ 369*ae115bc7Smrj 370*ae115bc7Smrj #define APIC_IS_MSI_OR_MSIX_INDEX(index) \ 371*ae115bc7Smrj ((index) == MSI_INDEX || (index) == MSIX_INDEX) 372*ae115bc7Smrj 373*ae115bc7Smrj /* 374*ae115bc7Smrj * definitions for MSI Address 375*ae115bc7Smrj */ 376*ae115bc7Smrj #define MSI_ADDR_HDR APIC_LOCAL_ADDR 377*ae115bc7Smrj #define MSI_ADDR_DEST_SHIFT 12 /* Destination CPU's apic id */ 378*ae115bc7Smrj #define MSI_ADDR_RH_FIXED 0x0 /* Redirection Hint Fixed */ 379*ae115bc7Smrj #define MSI_ADDR_RH_LOPRI 0x1 /* Redirection Hint Lowest priority */ 380*ae115bc7Smrj #define MSI_ADDR_RH_SHIFT 3 381*ae115bc7Smrj #define MSI_ADDR_DM_PHYSICAL 0x0 /* Physical Destination Mode */ 382*ae115bc7Smrj #define MSI_ADDR_DM_LOGICAL 0x1 /* Logical Destination Mode */ 383*ae115bc7Smrj #define MSI_ADDR_DM_SHIFT 2 384*ae115bc7Smrj 385*ae115bc7Smrj /* 386*ae115bc7Smrj * definitions for MSI Data 387*ae115bc7Smrj */ 388*ae115bc7Smrj #define MSI_DATA_DELIVERY_FIXED 0x0 /* Fixed delivery */ 389*ae115bc7Smrj #define MSI_DATA_DELIVERY_LOPRI 0x1 /* Lowest priority delivery */ 390*ae115bc7Smrj #define MSI_DATA_DELIVERY_SMI 0x2 391*ae115bc7Smrj #define MSI_DATA_DELIVERY_NMI 0x4 392*ae115bc7Smrj #define MSI_DATA_DELIVERY_INIT 0x5 393*ae115bc7Smrj #define MSI_DATA_DELIVERY_EXTINT 0x7 394*ae115bc7Smrj #define MSI_DATA_DELIVERY_SHIFT 8 395*ae115bc7Smrj #define MSI_DATA_TM_EDGE 0x0 /* MSI is edge sensitive */ 396*ae115bc7Smrj #define MSI_DATA_TM_LEVEL 0x1 /* level sensitive */ 397*ae115bc7Smrj #define MSI_DATA_TM_SHIFT 15 398*ae115bc7Smrj #define MSI_DATA_LEVEL_DEASSERT 0x0 399*ae115bc7Smrj #define MSI_DATA_LEVEL_ASSERT 0x1 /* Edge always assert */ 400*ae115bc7Smrj #define MSI_DATA_LEVEL_SHIFT 14 401*ae115bc7Smrj 402*ae115bc7Smrj /* 403*ae115bc7Smrj * use to define each irq setup by the apic 404*ae115bc7Smrj */ 405*ae115bc7Smrj typedef struct apic_irq { 406*ae115bc7Smrj short airq_mps_intr_index; /* index into mps interrupt entries */ 407*ae115bc7Smrj /* table */ 408*ae115bc7Smrj uchar_t airq_intin_no; 409*ae115bc7Smrj uchar_t airq_ioapicindex; 410*ae115bc7Smrj dev_info_t *airq_dip; /* device corresponding to this interrupt */ 411*ae115bc7Smrj /* 412*ae115bc7Smrj * IRQ could be shared (in H/W) in which case dip & major will be 413*ae115bc7Smrj * for the one that was last added at this level. We cannot keep a 414*ae115bc7Smrj * linked list as delspl does not tell us which device has just 415*ae115bc7Smrj * been unloaded. For most servers where we are worried about 416*ae115bc7Smrj * performance, interrupt should not be shared & should not be 417*ae115bc7Smrj * a problem. This does not cause any correctness issue - dip is 418*ae115bc7Smrj * used only as an optimisation to avoid going thru all the tables 419*ae115bc7Smrj * in translate IRQ (which is always called twice due to brokenness 420*ae115bc7Smrj * in the way IPLs are determined for devices). major is used only 421*ae115bc7Smrj * to bind interrupts corresponding to the same device on the same 422*ae115bc7Smrj * CPU. Not finding major will just cause it to be potentially bound 423*ae115bc7Smrj * to another CPU. 424*ae115bc7Smrj */ 425*ae115bc7Smrj major_t airq_major; /* major number corresponding to the device */ 426*ae115bc7Smrj ushort_t airq_rdt_entry; /* level, polarity & trig mode */ 427*ae115bc7Smrj uchar_t airq_cpu; /* Which CPU are we bound to ? */ 428*ae115bc7Smrj uchar_t airq_temp_cpu; /* Could be diff from cpu due to disable_intr */ 429*ae115bc7Smrj uchar_t airq_vector; /* Vector chosen for this irq */ 430*ae115bc7Smrj uchar_t airq_share; /* number of interrupts at this irq */ 431*ae115bc7Smrj uchar_t airq_share_id; /* id to identify source from irqno */ 432*ae115bc7Smrj uchar_t airq_ipl; /* The ipl at which this is handled */ 433*ae115bc7Smrj iflag_t airq_iflag; /* interrupt flag */ 434*ae115bc7Smrj uchar_t airq_origirq; /* original irq passed in */ 435*ae115bc7Smrj uint_t airq_busy; /* How frequently did clock find */ 436*ae115bc7Smrj /* us in this */ 437*ae115bc7Smrj struct apic_irq *airq_next; /* chain of shared intpts */ 438*ae115bc7Smrj } apic_irq_t; 439*ae115bc7Smrj 440*ae115bc7Smrj #define IRQ_USER_BOUND 0x80 /* user requested bind if set in airq_cpu */ 441*ae115bc7Smrj #define IRQ_UNBOUND (uchar_t)-1 /* set in airq_cpu and airq_temp_cpu */ 442*ae115bc7Smrj #define IRQ_UNINIT (uchar_t)-2 /* in airq_temp_cpu till addspl called */ 443*ae115bc7Smrj 444*ae115bc7Smrj /* Macros to help deal with shared interrupts */ 445*ae115bc7Smrj #define VIRTIRQ(irqno, share_id) ((irqno) | ((share_id) << 8)) 446*ae115bc7Smrj #define IRQINDEX(irq) ((irq) & 0xFF) /* Mask to get irq from virtual irq */ 447*ae115bc7Smrj 448*ae115bc7Smrj typedef struct apic_cpus_info { 449*ae115bc7Smrj uchar_t aci_local_id; 450*ae115bc7Smrj uchar_t aci_local_ver; 451*ae115bc7Smrj uchar_t aci_status; 452*ae115bc7Smrj uchar_t aci_redistribute; /* Selected for redistribution */ 453*ae115bc7Smrj uint_t aci_busy; /* Number of ticks we were in ISR */ 454*ae115bc7Smrj uint_t aci_spur_cnt; /* # of spurious intpts on this cpu */ 455*ae115bc7Smrj uint_t aci_ISR_in_progress; /* big enough to hold 1 << MAXIPL */ 456*ae115bc7Smrj uchar_t aci_curipl; /* IPL of current ISR */ 457*ae115bc7Smrj uchar_t aci_current[MAXIPL]; /* Current IRQ at each IPL */ 458*ae115bc7Smrj uint32_t aci_bound; /* # of user requested binds ? */ 459*ae115bc7Smrj uint32_t aci_temp_bound; /* # of non user IRQ binds */ 460*ae115bc7Smrj uchar_t aci_idle; /* The CPU is idle */ 461*ae115bc7Smrj /* 462*ae115bc7Smrj * fill to make sure each struct is in seperate cache line. 463*ae115bc7Smrj * Or atleast that ISR_in_progress/curipl is not shared with something 464*ae115bc7Smrj * that is read/written heavily by another CPU. 465*ae115bc7Smrj * Given kmem_alloc guarantees alignment to 8 bytes, having 8 466*ae115bc7Smrj * bytes on each side will isolate us in a 16 byte cache line. 467*ae115bc7Smrj */ 468*ae115bc7Smrj } apic_cpus_info_t; 469*ae115bc7Smrj 470*ae115bc7Smrj #define APIC_CPU_ONLINE 1 471*ae115bc7Smrj #define APIC_CPU_INTR_ENABLE 2 472*ae115bc7Smrj 473*ae115bc7Smrj /* 474*ae115bc7Smrj * Various poweroff methods and ports & bits for them 475*ae115bc7Smrj */ 476*ae115bc7Smrj #define APIC_POWEROFF_NONE 0 477*ae115bc7Smrj #define APIC_POWEROFF_VIA_RTC 1 478*ae115bc7Smrj #define APIC_POWEROFF_VIA_ASPEN_BMC 2 479*ae115bc7Smrj #define APIC_POWEROFF_VIA_SITKA_BMC 3 480*ae115bc7Smrj 481*ae115bc7Smrj /* For RTC */ 482*ae115bc7Smrj #define RTC_REGA 0x0a 483*ae115bc7Smrj #define PFR_REG 0x4a /* extended control register */ 484*ae115bc7Smrj #define PAB_CBIT 0x08 485*ae115bc7Smrj #define WF_FLAG 0x02 486*ae115bc7Smrj #define KS_FLAG 0x01 487*ae115bc7Smrj #define EXT_BANK 0x10 488*ae115bc7Smrj 489*ae115bc7Smrj /* For Aspen/Drake BMC */ 490*ae115bc7Smrj 491*ae115bc7Smrj #define CC_SMS_GET_STATUS 0x40 492*ae115bc7Smrj #define CC_SMS_WR_START 0x41 493*ae115bc7Smrj #define CC_SMS_WR_NEXT 0x42 494*ae115bc7Smrj #define CC_SMS_WR_END 0x43 495*ae115bc7Smrj 496*ae115bc7Smrj #define MISMIC_DATA_REGISTER 0x0ca9 497*ae115bc7Smrj #define MISMIC_CNTL_REGISTER 0x0caa 498*ae115bc7Smrj #define MISMIC_FLAG_REGISTER 0x0cab 499*ae115bc7Smrj 500*ae115bc7Smrj #define MISMIC_BUSY_MASK 0x01 501*ae115bc7Smrj 502*ae115bc7Smrj /* For Sitka/Cabrillo BMC */ 503*ae115bc7Smrj 504*ae115bc7Smrj #define SMS_GET_STATUS 0x60 505*ae115bc7Smrj #define SMS_WRITE_START 0x61 506*ae115bc7Smrj #define SMS_WRITE_END 0x62 507*ae115bc7Smrj 508*ae115bc7Smrj #define SMS_DATA_REGISTER 0x0ca2 509*ae115bc7Smrj #define SMS_STATUS_REGISTER 0x0ca3 510*ae115bc7Smrj #define SMS_COMMAND_REGISTER 0x0ca3 511*ae115bc7Smrj 512*ae115bc7Smrj #define SMS_IBF_MASK 0x02 513*ae115bc7Smrj #define SMS_STATE_MASK 0xc0 514*ae115bc7Smrj 515*ae115bc7Smrj #define SMS_IDLE_STATE 0x00 516*ae115bc7Smrj #define SMS_READ_STATE 0x40 517*ae115bc7Smrj #define SMS_WRITE_STATE 0x80 518*ae115bc7Smrj #define SMS_ERROR_STATE 0xc0 519*ae115bc7Smrj 520*ae115bc7Smrj extern uint32_t ioapic_read(int ioapic_ix, uint32_t reg); 521*ae115bc7Smrj extern void ioapic_write(int ioapic_ix, uint32_t reg, uint32_t value); 522*ae115bc7Smrj 523*ae115bc7Smrj /* Macros for reading/writing the IOAPIC RDT entries */ 524*ae115bc7Smrj #define READ_IOAPIC_RDT_ENTRY_LOW_DWORD(ioapic_ix, ipin) \ 525*ae115bc7Smrj ioapic_read(ioapic_ix, APIC_RDT_CMD + (2 * (ipin))) 526*ae115bc7Smrj 527*ae115bc7Smrj #define READ_IOAPIC_RDT_ENTRY_HIGH_DWORD(ioapic_ix, ipin) \ 528*ae115bc7Smrj ioapic_read(ioapic_ix, APIC_RDT_CMD2 + (2 * (ipin))) 529*ae115bc7Smrj 530*ae115bc7Smrj #define WRITE_IOAPIC_RDT_ENTRY_LOW_DWORD(ioapic_ix, ipin, value) \ 531*ae115bc7Smrj ioapic_write(ioapic_ix, APIC_RDT_CMD + (2 * (ipin)), value) 532*ae115bc7Smrj 533*ae115bc7Smrj #define WRITE_IOAPIC_RDT_ENTRY_HIGH_DWORD(ioapic_ix, ipin, value) \ 534*ae115bc7Smrj ioapic_write(ioapic_ix, APIC_RDT_CMD2 + (2 * (ipin)), value) 535*ae115bc7Smrj 536*ae115bc7Smrj /* Used by PSM_INTR_OP_GET_INTR to return device information. */ 537*ae115bc7Smrj typedef struct { 538*ae115bc7Smrj uint16_t avgi_req_flags; /* request flags - to kernel */ 539*ae115bc7Smrj uint8_t avgi_num_devs; /* # devs on this ino - from kernel */ 540*ae115bc7Smrj uint8_t avgi_vector; /* vector */ 541*ae115bc7Smrj uint32_t avgi_cpu_id; /* cpu of interrupt - from kernel */ 542*ae115bc7Smrj dev_info_t **avgi_dip_list; /* kmem_alloc'ed list of dev_infos. */ 543*ae115bc7Smrj /* Contains num_devs elements. */ 544*ae115bc7Smrj } apic_get_intr_t; 545*ae115bc7Smrj 546*ae115bc7Smrj /* Masks for avgi_req_flags. */ 547*ae115bc7Smrj #define PSMGI_REQ_CPUID 0x1 /* Request CPU ID */ 548*ae115bc7Smrj #define PSMGI_REQ_NUM_DEVS 0x2 /* Request num of devices on vector */ 549*ae115bc7Smrj #define PSMGI_REQ_VECTOR 0x4 550*ae115bc7Smrj #define PSMGI_REQ_GET_DEVS 0x8 /* Request device list */ 551*ae115bc7Smrj #define PSMGI_REQ_ALL 0xf /* Request everything */ 552*ae115bc7Smrj 553*ae115bc7Smrj /* Other flags */ 554*ae115bc7Smrj #define PSMGI_INTRBY_VEC 0 /* Vec passed. xlate to IRQ needed */ 555*ae115bc7Smrj #define PSMGI_INTRBY_IRQ 0x8000 /* IRQ passed. no xlate needed */ 556*ae115bc7Smrj #define PSMGI_INTRBY_FLAGS 0x8000 /* Mask for this flag */ 557*ae115bc7Smrj 558*ae115bc7Smrj /* 559*ae115bc7Smrj * Use scaled-fixed-point arithmetic to calculate apic ticks. 560*ae115bc7Smrj * Round when dividing (by adding half of divisor to dividend) 561*ae115bc7Smrj * for one extra bit of precision. 562*ae115bc7Smrj */ 563*ae115bc7Smrj 564*ae115bc7Smrj #define SF (1ULL<<20) /* Scaling Factor: scale by 2^20 */ 565*ae115bc7Smrj #define APIC_TICKS_TO_NSECS(ticks) ((((int64_t)(ticks) * SF) + \ 566*ae115bc7Smrj apic_ticks_per_SFnsecs / 2) / \ 567*ae115bc7Smrj apic_ticks_per_SFnsecs); 568*ae115bc7Smrj #define APIC_NSECS_TO_TICKS(nsecs) (((int64_t)(nsecs) * \ 569*ae115bc7Smrj apic_ticks_per_SFnsecs + (SF/2)) / SF) 570*ae115bc7Smrj 571*ae115bc7Smrj extern int apic_verbose; 572*ae115bc7Smrj 573*ae115bc7Smrj /* Flag definitions for apic_verbose */ 574*ae115bc7Smrj #define APIC_VERBOSE_IOAPIC_FLAG 0x00000001 575*ae115bc7Smrj #define APIC_VERBOSE_IRQ_FLAG 0x00000002 576*ae115bc7Smrj #define APIC_VERBOSE_POWEROFF_FLAG 0x00000004 577*ae115bc7Smrj #define APIC_VERBOSE_POWEROFF_PAUSE_FLAG 0x00000008 578*ae115bc7Smrj 579*ae115bc7Smrj 580*ae115bc7Smrj #define APIC_VERBOSE_IOAPIC(fmt) \ 581*ae115bc7Smrj if (apic_verbose & APIC_VERBOSE_IOAPIC_FLAG) \ 582*ae115bc7Smrj cmn_err fmt; 583*ae115bc7Smrj 584*ae115bc7Smrj #define APIC_VERBOSE_IRQ(fmt) \ 585*ae115bc7Smrj if (apic_verbose & APIC_VERBOSE_IRQ_FLAG) \ 586*ae115bc7Smrj cmn_err fmt; 587*ae115bc7Smrj 588*ae115bc7Smrj #define APIC_VERBOSE_POWEROFF(fmt) \ 589*ae115bc7Smrj if (apic_verbose & APIC_VERBOSE_POWEROFF_FLAG) \ 590*ae115bc7Smrj prom_printf fmt; 591*ae115bc7Smrj 592*ae115bc7Smrj #ifdef DEBUG 593*ae115bc7Smrj #define DENT 0x0001 594*ae115bc7Smrj extern int apic_debug; 595*ae115bc7Smrj /* 596*ae115bc7Smrj * set apic_restrict_vector to the # of vectors we want to allow per range 597*ae115bc7Smrj * useful in testing shared interrupt logic by setting it to 2 or 3 598*ae115bc7Smrj */ 599*ae115bc7Smrj extern int apic_restrict_vector; 600*ae115bc7Smrj 601*ae115bc7Smrj #define APIC_DEBUG_MSGBUFSIZE 2048 602*ae115bc7Smrj extern int apic_debug_msgbuf[]; 603*ae115bc7Smrj extern int apic_debug_msgbufindex; 604*ae115bc7Smrj 605*ae115bc7Smrj /* 606*ae115bc7Smrj * Put "int" info into debug buffer. No MP consistency, but light weight. 607*ae115bc7Smrj * Good enough for most debugging. 608*ae115bc7Smrj */ 609*ae115bc7Smrj #define APIC_DEBUG_BUF_PUT(x) \ 610*ae115bc7Smrj apic_debug_msgbuf[apic_debug_msgbufindex++] = x; \ 611*ae115bc7Smrj if (apic_debug_msgbufindex >= (APIC_DEBUG_MSGBUFSIZE - NCPU)) \ 612*ae115bc7Smrj apic_debug_msgbufindex = 0; 613*ae115bc7Smrj 614*ae115bc7Smrj #endif /* DEBUG */ 615*ae115bc7Smrj 616*ae115bc7Smrj extern int apic_error; 617*ae115bc7Smrj /* values which apic_error can take. Not catastrophic, but may help debug */ 618*ae115bc7Smrj #define APIC_ERR_BOOT_EOI 0x1 619*ae115bc7Smrj #define APIC_ERR_GET_IPIVECT_FAIL 0x2 620*ae115bc7Smrj #define APIC_ERR_INVALID_INDEX 0x4 621*ae115bc7Smrj #define APIC_ERR_MARK_VECTOR_FAIL 0x8 622*ae115bc7Smrj #define APIC_ERR_APIC_ERROR 0x40000000 623*ae115bc7Smrj #define APIC_ERR_NMI 0x80000000 624*ae115bc7Smrj 625*ae115bc7Smrj /* 626*ae115bc7Smrj * ACPI definitions 627*ae115bc7Smrj */ 628*ae115bc7Smrj /* _PIC method arguments */ 629*ae115bc7Smrj #define ACPI_PIC_MODE 0 630*ae115bc7Smrj #define ACPI_APIC_MODE 1 631*ae115bc7Smrj 632*ae115bc7Smrj /* APIC error flags we care about */ 633*ae115bc7Smrj #define APIC_SEND_CS_ERROR 0x01 634*ae115bc7Smrj #define APIC_RECV_CS_ERROR 0x02 635*ae115bc7Smrj #define APIC_CS_ERRORS (APIC_SEND_CS_ERROR|APIC_RECV_CS_ERROR) 636*ae115bc7Smrj 637*ae115bc7Smrj /* Maximum number of times to retry reprogramming at apic_intr_exit time */ 638*ae115bc7Smrj #define APIC_REPROGRAM_MAX_TRIES 10000 639*ae115bc7Smrj 640*ae115bc7Smrj /* Parameter to ioapic_init_intr(): Should ioapic ints be masked? */ 641*ae115bc7Smrj #define IOAPIC_MASK 1 642*ae115bc7Smrj #define IOAPIC_NOMASK 0 643*ae115bc7Smrj 644*ae115bc7Smrj #define INTR_ROUND_ROBIN_WITH_AFFINITY 0 645*ae115bc7Smrj #define INTR_ROUND_ROBIN 1 646*ae115bc7Smrj #define INTR_LOWEST_PRIORITY 2 647*ae115bc7Smrj 648*ae115bc7Smrj 649*ae115bc7Smrj 650*ae115bc7Smrj struct ioapic_reprogram_data { 651*ae115bc7Smrj boolean_t done; 652*ae115bc7Smrj apic_irq_t *irqp; 653*ae115bc7Smrj /* The CPU to which the int will be bound */ 654*ae115bc7Smrj int bindcpu; 655*ae115bc7Smrj /* # times the reprogram timeout was called */ 656*ae115bc7Smrj unsigned tries; 657*ae115bc7Smrj }; 658*ae115bc7Smrj 659*ae115bc7Smrj /* The irq # is implicit in the array index: */ 660*ae115bc7Smrj extern struct ioapic_reprogram_data apic_reprogram_info[]; 661*ae115bc7Smrj 662*ae115bc7Smrj extern void apic_intr_exit(int ipl, int irq); 663*ae115bc7Smrj extern int apic_probe_common(); 664*ae115bc7Smrj extern void apic_init_common(); 665*ae115bc7Smrj extern void ioapic_init_intr(); 666*ae115bc7Smrj extern void ioapic_disable_redirection(); 667*ae115bc7Smrj extern int apic_addspl_common(int irqno, int ipl, int min_ipl, int max_ipl); 668*ae115bc7Smrj extern int apic_delspl_common(int irqno, int ipl, int min_ipl, int max_ipl); 669*ae115bc7Smrj extern void apic_cleanup_busy(); 670*ae115bc7Smrj extern void apic_intr_redistribute(); 671*ae115bc7Smrj extern uchar_t apic_xlate_vector(uchar_t vector); 672*ae115bc7Smrj extern uchar_t apic_allocate_vector(int ipl, int irq, int pri); 673*ae115bc7Smrj extern void apic_free_vector(uchar_t vector); 674*ae115bc7Smrj extern int apic_allocate_irq(int irq); 675*ae115bc7Smrj extern uchar_t apic_bind_intr(dev_info_t *dip, int irq, uchar_t ioapicid, 676*ae115bc7Smrj uchar_t intin); 677*ae115bc7Smrj extern int apic_rebind(apic_irq_t *irq_ptr, int bind_cpu, 678*ae115bc7Smrj struct ioapic_reprogram_data *drep); 679*ae115bc7Smrj extern int apic_rebind_all(apic_irq_t *irq_ptr, int bind_cpu); 680*ae115bc7Smrj extern int apic_introp_xlate(dev_info_t *dip, struct intrspec *ispec, int type); 681*ae115bc7Smrj extern int apic_intr_ops(dev_info_t *dip, ddi_intr_handle_impl_t *hdlp, 682*ae115bc7Smrj psm_intr_op_t intr_op, int *result); 683*ae115bc7Smrj extern boolean_t apic_cpu_in_range(int cpu); 684*ae115bc7Smrj extern int apic_check_msi_support(); 685*ae115bc7Smrj extern apic_irq_t *apic_find_irq(dev_info_t *dip, struct intrspec *ispec, 686*ae115bc7Smrj int type); 687*ae115bc7Smrj extern int apic_navail_vector(dev_info_t *dip, int pri); 688*ae115bc7Smrj extern int apic_alloc_vectors(dev_info_t *dip, int inum, int count, int pri, 689*ae115bc7Smrj int type, int behavior); 690*ae115bc7Smrj extern void apic_free_vectors(dev_info_t *dip, int inum, int count, int pri, 691*ae115bc7Smrj int type); 692*ae115bc7Smrj extern int apic_get_vector_intr_info(int vecirq, 693*ae115bc7Smrj apic_get_intr_t *intr_params_p); 694*ae115bc7Smrj extern uchar_t apic_find_multi_vectors(int pri, int count); 695*ae115bc7Smrj extern int apic_setup_io_intr(void *p, int irq, boolean_t deferred); 696*ae115bc7Smrj extern uint32_t *mapin_apic(uint32_t addr, size_t len, int flags); 697*ae115bc7Smrj extern uint32_t *mapin_ioapic(uint32_t addr, size_t len, int flags); 698*ae115bc7Smrj extern void mapout_apic(caddr_t addr, size_t len); 699*ae115bc7Smrj extern void mapout_ioapic(caddr_t addr, size_t len); 700*ae115bc7Smrj extern uchar_t apic_modify_vector(uchar_t vector, int irq); 701*ae115bc7Smrj extern int apic_pci_msi_unconfigure(dev_info_t *rdip, int type, int inum); 702*ae115bc7Smrj extern int apic_pci_msi_disable_mode(dev_info_t *rdip, int type, int inum); 703*ae115bc7Smrj extern int apic_pci_msi_enable_mode(dev_info_t *rdip, int type, int inum); 704*ae115bc7Smrj 705*ae115bc7Smrj extern volatile uint32_t *apicadr; /* virtual addr of local APIC */ 706*ae115bc7Smrj extern int apic_forceload; 707*ae115bc7Smrj extern apic_cpus_info_t *apic_cpus; 708*ae115bc7Smrj extern cpuset_t apic_cpumask; 709*ae115bc7Smrj extern uint_t apic_flag; 710*ae115bc7Smrj extern uchar_t apic_ipltopri[MAXIPL+1]; 711*ae115bc7Smrj extern uchar_t apic_vector_to_irq[APIC_MAX_VECTOR+1]; 712*ae115bc7Smrj extern int apic_max_device_irq; 713*ae115bc7Smrj extern int apic_min_device_irq; 714*ae115bc7Smrj extern apic_irq_t *apic_irq_table[APIC_MAX_VECTOR+1]; 715*ae115bc7Smrj extern volatile uint32_t *apicioadr[MAX_IO_APIC]; 716*ae115bc7Smrj extern uchar_t apic_io_id[MAX_IO_APIC]; 717*ae115bc7Smrj extern lock_t apic_ioapic_lock; 718*ae115bc7Smrj extern uint32_t apic_physaddr[MAX_IO_APIC]; 719*ae115bc7Smrj extern kmutex_t airq_mutex; 720*ae115bc7Smrj extern int apic_first_avail_irq; 721*ae115bc7Smrj extern uchar_t apic_vectortoipl[APIC_AVAIL_VECTOR / APIC_VECTOR_PER_IPL]; 722*ae115bc7Smrj extern int apic_imcrp; 723*ae115bc7Smrj extern int apic_revector_pending; 724*ae115bc7Smrj extern char apic_level_intr[APIC_MAX_VECTOR+1]; 725*ae115bc7Smrj extern uchar_t apic_resv_vector[MAXIPL+1]; 726*ae115bc7Smrj extern int apic_sample_factor_redistribution; 727*ae115bc7Smrj extern int apic_int_busy_mark; 728*ae115bc7Smrj extern int apic_int_free_mark; 729*ae115bc7Smrj extern int apic_diff_for_redistribution; 730*ae115bc7Smrj extern int apic_poweroff_method; 731*ae115bc7Smrj extern int apic_enable_acpi; 732*ae115bc7Smrj extern int apic_nproc; 733*ae115bc7Smrj extern int apic_next_bind_cpu; 734*ae115bc7Smrj extern int apic_redistribute_sample_interval; 735*ae115bc7Smrj extern int apic_multi_msi_enable; 736*ae115bc7Smrj extern int apic_multi_msi_max; 737*ae115bc7Smrj extern int apic_sci_vect; 738*ae115bc7Smrj 739*ae115bc7Smrj 740*ae115bc7Smrj 741*ae115bc7Smrj #ifdef __cplusplus 742*ae115bc7Smrj } 743*ae115bc7Smrj #endif 744*ae115bc7Smrj 745*ae115bc7Smrj #endif /* _SYS_APIC_APIC_H */ 746