10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*1772Sjl139090 * Common Development and Distribution License (the "License"). 6*1772Sjl139090 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*1772Sjl139090 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 270Sstevel@tonic-gate 280Sstevel@tonic-gate /* 290Sstevel@tonic-gate * PCI Express nexus driver tunables 300Sstevel@tonic-gate */ 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <sys/types.h> 330Sstevel@tonic-gate #include <sys/cmn_err.h> 340Sstevel@tonic-gate #include <sys/time.h> 35383Set142600 #include <sys/pcie.h> 360Sstevel@tonic-gate #include "px_space.h" 370Sstevel@tonic-gate 380Sstevel@tonic-gate /*LINTLIBRARY*/ 390Sstevel@tonic-gate 400Sstevel@tonic-gate uint32_t px_spurintr_duration = 60000000; /* One minute */ 410Sstevel@tonic-gate uint64_t px_spurintr_msgs = PX_SPURINTR_MSG_DEFAULT; 420Sstevel@tonic-gate 430Sstevel@tonic-gate /* 440Sstevel@tonic-gate * The following variable enables a workaround for the following obp bug: 450Sstevel@tonic-gate * 460Sstevel@tonic-gate * 1234181 - obp should set latency timer registers in pci 470Sstevel@tonic-gate * configuration header 480Sstevel@tonic-gate * 490Sstevel@tonic-gate * Until this bug gets fixed in the obp, the following workaround should 500Sstevel@tonic-gate * be enabled. 510Sstevel@tonic-gate */ 520Sstevel@tonic-gate uint_t px_set_latency_timer_register = 1; 530Sstevel@tonic-gate 540Sstevel@tonic-gate /* 550Sstevel@tonic-gate * The following driver parameters are defined as variables to allow 560Sstevel@tonic-gate * patching for debugging and tuning. Flags that can be set on a per 570Sstevel@tonic-gate * PBM basis are bit fields where the PBM device instance number maps 580Sstevel@tonic-gate * to the bit position. 590Sstevel@tonic-gate */ 600Sstevel@tonic-gate uint_t px_mmu_error_intr_enable = (uint_t)-1; 610Sstevel@tonic-gate uint_t px_rerun_disable = 0; 620Sstevel@tonic-gate 630Sstevel@tonic-gate uint_t px_error_intr_enable = (uint_t)-1; 640Sstevel@tonic-gate uint_t px_dwsync_disable = 0; 650Sstevel@tonic-gate uint_t px_intsync_disable = 0; 660Sstevel@tonic-gate 670Sstevel@tonic-gate uint_t px_intr_retry_intv = 5; /* for interrupt retry reg */ 680Sstevel@tonic-gate uint8_t px_latency_timer = 0x40; /* for pci latency timer reg */ 690Sstevel@tonic-gate uint_t px_panic_on_fatal_errors = 1; /* should be 1 at beta */ 700Sstevel@tonic-gate uint_t px_thermal_intr_fatal = 1; /* thermal interrupts fatal */ 710Sstevel@tonic-gate uint_t px_buserr_interrupt = 1; /* safari buserr interrupt */ 720Sstevel@tonic-gate uint_t px_ctx_no_active_flush = 0; /* cannot handle active ctx flush */ 730Sstevel@tonic-gate uint_t px_use_contexts = 1; 740Sstevel@tonic-gate 750Sstevel@tonic-gate hrtime_t px_intrpend_timeout = 5ull * NANOSEC; /* 5 seconds in nanoseconds */ 760Sstevel@tonic-gate 770Sstevel@tonic-gate uint64_t px_perr_fatal = -1ull; 780Sstevel@tonic-gate uint64_t px_serr_fatal = -1ull; 790Sstevel@tonic-gate uint64_t px_errtrig_pa = 0x0; 800Sstevel@tonic-gate 810Sstevel@tonic-gate /* 820Sstevel@tonic-gate * The following flag controls behavior of the ino handler routine 830Sstevel@tonic-gate * when multiple interrupts are attached to a single ino. Typically 840Sstevel@tonic-gate * this case would occur for the ino's assigned to the PCI bus slots 850Sstevel@tonic-gate * with multi-function devices or bus bridges. 860Sstevel@tonic-gate * 870Sstevel@tonic-gate * Setting the flag to zero causes the ino handler routine to return 880Sstevel@tonic-gate * after finding the first interrupt handler to claim the interrupt. 890Sstevel@tonic-gate * 900Sstevel@tonic-gate * Setting the flag to non-zero causes the ino handler routine to 910Sstevel@tonic-gate * return after making one complete pass through the interrupt 920Sstevel@tonic-gate * handlers. 930Sstevel@tonic-gate */ 940Sstevel@tonic-gate uint_t px_check_all_handlers = 1; 950Sstevel@tonic-gate 960Sstevel@tonic-gate /* 970Sstevel@tonic-gate * The following value is the number of consecutive unclaimed interrupts that 980Sstevel@tonic-gate * will be tolerated for a particular ino_p before the interrupt is deemed to 990Sstevel@tonic-gate * be jabbering and is blocked. 1000Sstevel@tonic-gate */ 1010Sstevel@tonic-gate uint_t px_unclaimed_intr_max = 20; 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate /* 1040Sstevel@tonic-gate * The following value will cause the nexus driver to block an ino after 1050Sstevel@tonic-gate * px_unclaimed_intr_max unclaimed interrupts have been seen. Setting this 1060Sstevel@tonic-gate * value to 0 will cause interrupts to never be blocked, no matter how many 1070Sstevel@tonic-gate * unclaimed interrupts are seen on a particular ino. 1080Sstevel@tonic-gate */ 1090Sstevel@tonic-gate uint_t px_unclaimed_intr_block = 1; 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate uint_t px_lock_tlb = 0; 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate uint64_t px_dvma_debug_on = 0; 1140Sstevel@tonic-gate uint64_t px_dvma_debug_off = 0; 1150Sstevel@tonic-gate uint32_t px_dvma_debug_rec = 512; 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate /* 1180Sstevel@tonic-gate * dvma address space allocation cache variables 1190Sstevel@tonic-gate */ 1200Sstevel@tonic-gate uint_t px_dvma_page_cache_entries = 0x200; /* # of chunks (1 << bits) */ 1210Sstevel@tonic-gate uint_t px_dvma_page_cache_clustsz = 0x8; /* # of pages per chunk */ 1220Sstevel@tonic-gate #ifdef PX_DMA_PROF 1230Sstevel@tonic-gate uint_t px_dvmaft_npages = 0; /* FT fail due npages */ 1240Sstevel@tonic-gate uint_t px_dvmaft_limit = 0; /* FT fail due limits */ 1250Sstevel@tonic-gate uint_t px_dvmaft_free = 0; /* FT free */ 1260Sstevel@tonic-gate uint_t px_dvmaft_success = 0; /* FT success */ 1270Sstevel@tonic-gate uint_t px_dvmaft_exhaust = 0; /* FT vmem fallback */ 1280Sstevel@tonic-gate uint_t px_dvma_vmem_alloc = 0; /* vmem alloc */ 1290Sstevel@tonic-gate uint_t px_dvma_vmem_xalloc = 0; /* vmem xalloc */ 1300Sstevel@tonic-gate uint_t px_dvma_vmem_xfree = 0; /* vmem xfree */ 1310Sstevel@tonic-gate uint_t px_dvma_vmem_free = 0; /* vmem free */ 1320Sstevel@tonic-gate #endif 1330Sstevel@tonic-gate uint_t px_disable_fdvma = 0; 1340Sstevel@tonic-gate uint_t px_mmu_ctx_lock_failure = 0; 1350Sstevel@tonic-gate 1360Sstevel@tonic-gate /* 1370Sstevel@tonic-gate * This flag preserves prom MMU settings by copying prom TSB entries 1380Sstevel@tonic-gate * to corresponding kernel TSB entry locations. It should be removed 1390Sstevel@tonic-gate * after the interface properties from obp have become default. 1400Sstevel@tonic-gate */ 1410Sstevel@tonic-gate uint_t px_preserve_mmu_tsb = 1; 1420Sstevel@tonic-gate 1430Sstevel@tonic-gate /* 1440Sstevel@tonic-gate * memory callback list id callback list for kmem_alloc failure clients 1450Sstevel@tonic-gate */ 1460Sstevel@tonic-gate uintptr_t px_kmem_clid = 0; 1470Sstevel@tonic-gate 1480Sstevel@tonic-gate /* timeout in micro seconds for receiving PME_To_ACK */ 1490Sstevel@tonic-gate uint64_t px_pme_to_ack_timeout = PX_PME_TO_ACK_TIMEOUT; 1500Sstevel@tonic-gate 151118Sjchu /* timeout in micro seconds for receiving link up interrupt */ 1521147Sjchu uint64_t px_lup_poll_to = PX_LUP_POLL_TO; 1531147Sjchu uint64_t px_lup_poll_interval = PX_LUP_POLL_INTERVAL; 154118Sjchu 1550Sstevel@tonic-gate /* PIL at which PME_To_ACK message interrupt is handled */ 1560Sstevel@tonic-gate uint32_t px_pwr_pil = PX_PWR_PIL; 157118Sjchu 158118Sjchu uint32_t px_max_l1_tries = PX_MAX_L1_TRIES; 159383Set142600 160383Set142600 /* Fire PCIe Error that should cause panics */ 161383Set142600 uint32_t px_fabric_die = 1; 162383Set142600 163383Set142600 uint32_t px_fabric_die_rc_ce = 0; 164383Set142600 uint32_t px_fabric_die_rc_ue = PCIE_AER_UCE_UR | 165383Set142600 PCIE_AER_UCE_TO | 166383Set142600 PCIE_AER_UCE_RO | 167383Set142600 PCIE_AER_UCE_FCP | 168*1772Sjl139090 PCIE_AER_UCE_DLP | 169*1772Sjl139090 PCIE_AER_UCE_ECRC; 170383Set142600 171383Set142600 /* Fire PCIe Error that should cause panics even under protected access */ 172383Set142600 uint32_t px_fabric_die_rc_ce_gos = 0; 173383Set142600 uint32_t px_fabric_die_rc_ue_gos = PCIE_AER_UCE_RO | 174383Set142600 PCIE_AER_UCE_FCP | 175383Set142600 PCIE_AER_UCE_DLP; 176383Set142600 177383Set142600 /* Fabric Error that should cause panics */ 178383Set142600 uint32_t px_fabric_die_ce = 0; 179383Set142600 uint32_t px_fabric_die_ue = PCIE_AER_UCE_UR | 180383Set142600 PCIE_AER_UCE_UC | 181383Set142600 PCIE_AER_UCE_TO | 182383Set142600 PCIE_AER_UCE_RO | 183383Set142600 PCIE_AER_UCE_FCP | 184383Set142600 PCIE_AER_UCE_DLP | 185383Set142600 PCIE_AER_UCE_TRAINING; 186383Set142600 187383Set142600 /* Fabric Error that should cause panics even under protected access */ 188383Set142600 uint32_t px_fabric_die_ce_gos = 0; 189383Set142600 uint32_t px_fabric_die_ue_gos = PCIE_AER_UCE_UC | 190383Set142600 PCIE_AER_UCE_TO | 191383Set142600 PCIE_AER_UCE_RO | 192383Set142600 PCIE_AER_UCE_FCP | 193383Set142600 PCIE_AER_UCE_DLP | 194383Set142600 PCIE_AER_UCE_TRAINING; 195383Set142600 196383Set142600 /* Fabric Bridge Sec. Error that should cause panics */ 197383Set142600 uint16_t px_fabric_die_bdg_sts = PCI_STAT_S_PERROR | 198383Set142600 PCI_STAT_R_TARG_AB | 199383Set142600 PCI_STAT_R_MAST_AB | 200383Set142600 PCI_STAT_S_SYSERR | 201383Set142600 PCI_STAT_PERROR; 202383Set142600 203383Set142600 /* 204383Set142600 * Fabric Bridge Sec. Error that should cause panics even under 205383Set142600 * protected access 206383Set142600 */ 207383Set142600 uint16_t px_fabric_die_bdg_sts_gos = PCI_STAT_S_PERROR | 208383Set142600 PCI_STAT_PERROR; 209383Set142600 210383Set142600 /* Fabric Switch Sec. Error that should cause panics */ 211383Set142600 uint16_t px_fabric_die_sw_sts = PCI_STAT_R_TARG_AB | 212383Set142600 PCI_STAT_R_MAST_AB | 213383Set142600 PCI_STAT_S_SYSERR; 214383Set142600 215383Set142600 /* 216383Set142600 * Fabric Switch Sec. Error that should cause panics even under 217383Set142600 * protected access 218383Set142600 */ 219383Set142600 uint16_t px_fabric_die_sw_sts_gos = 0; 220383Set142600 221383Set142600 uint32_t px_fabric_die_sue = PCIE_AER_SUCE_TA_ON_SC | 222383Set142600 PCIE_AER_SUCE_MA_ON_SC | 223383Set142600 PCIE_AER_SUCE_RCVD_TA | 224383Set142600 PCIE_AER_SUCE_RCVD_MA | 225383Set142600 PCIE_AER_SUCE_USC_ERR | 226383Set142600 PCIE_AER_SUCE_USC_MSG_DATA_ERR | 227383Set142600 PCIE_AER_SUCE_UC_DATA_ERR | 228383Set142600 PCIE_AER_SUCE_UC_ATTR_ERR | 229383Set142600 PCIE_AER_SUCE_UC_ADDR_ERR | 230383Set142600 PCIE_AER_SUCE_TIMER_EXPIRED | 231383Set142600 PCIE_AER_SUCE_PERR_ASSERT | 232383Set142600 PCIE_AER_SUCE_SERR_ASSERT | 233383Set142600 PCIE_AER_SUCE_INTERNAL_ERR; 234383Set142600 235383Set142600 uint32_t px_fabric_die_sue_gos = PCIE_AER_SUCE_TA_ON_SC | 236383Set142600 PCIE_AER_SUCE_MA_ON_SC | 237383Set142600 PCIE_AER_SUCE_USC_ERR | 238383Set142600 PCIE_AER_SUCE_USC_MSG_DATA_ERR | 239383Set142600 PCIE_AER_SUCE_UC_DATA_ERR | 240383Set142600 PCIE_AER_SUCE_UC_ATTR_ERR | 241383Set142600 PCIE_AER_SUCE_UC_ADDR_ERR | 242383Set142600 PCIE_AER_SUCE_TIMER_EXPIRED | 243383Set142600 PCIE_AER_SUCE_PERR_ASSERT | 244383Set142600 PCIE_AER_SUCE_SERR_ASSERT | 245383Set142600 PCIE_AER_SUCE_INTERNAL_ERR; 246