xref: /illumos-gate/usr/src/uts/sun4/io/px/px_space.c (revision 26947304)
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
525cf1a30Sjl  * Common Development and Distribution License (the "License").
625cf1a30Sjl  * 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 /*
22*18191143SAlan Adamson, SD OSSD  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate /*
277c478bd9Sstevel@tonic-gate  * PCI Express nexus driver tunables
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #include <sys/types.h>
31bf8fc234Set #include <sys/ddi.h>
32bf8fc234Set #include <sys/sunddi.h>
337c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
347c478bd9Sstevel@tonic-gate #include <sys/time.h>
35bf8fc234Set #include "px_obj.h"
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*LINTLIBRARY*/
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate uint32_t px_spurintr_duration = 60000000; /* One minute */
407c478bd9Sstevel@tonic-gate uint64_t px_spurintr_msgs = PX_SPURINTR_MSG_DEFAULT;
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * The following variable enables a workaround for the following obp bug:
447c478bd9Sstevel@tonic-gate  *
457c478bd9Sstevel@tonic-gate  *	1234181 - obp should set latency timer registers in pci
467c478bd9Sstevel@tonic-gate  *		configuration header
477c478bd9Sstevel@tonic-gate  *
487c478bd9Sstevel@tonic-gate  * Until this bug gets fixed in the obp, the following workaround should
497c478bd9Sstevel@tonic-gate  * be enabled.
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate uint_t px_set_latency_timer_register = 1;
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate /*
547c478bd9Sstevel@tonic-gate  * The following driver parameters are defined as variables to allow
557c478bd9Sstevel@tonic-gate  * patching for debugging and tuning.  Flags that can be set on a per
567c478bd9Sstevel@tonic-gate  * PBM basis are bit fields where the PBM device instance number maps
577c478bd9Sstevel@tonic-gate  * to the bit position.
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate uint_t px_mmu_error_intr_enable = (uint_t)-1;
607c478bd9Sstevel@tonic-gate uint_t px_rerun_disable = 0;
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate uint_t px_error_intr_enable = (uint_t)-1;
637c478bd9Sstevel@tonic-gate uint_t px_dwsync_disable = 0;
647c478bd9Sstevel@tonic-gate uint_t px_intsync_disable = 0;
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate uint_t px_intr_retry_intv = 5;		/* for interrupt retry reg */
677c478bd9Sstevel@tonic-gate uint8_t px_latency_timer = 0x40;	/* for pci latency timer reg */
687c478bd9Sstevel@tonic-gate uint_t px_panic_on_fatal_errors = 1;	/* should be 1 at beta */
697c478bd9Sstevel@tonic-gate uint_t px_thermal_intr_fatal = 1;	/* thermal interrupts fatal */
707c478bd9Sstevel@tonic-gate uint_t px_buserr_interrupt = 1;	/* safari buserr interrupt */
717c478bd9Sstevel@tonic-gate uint_t px_ctx_no_active_flush = 0;	/* cannot handle active ctx flush */
727c478bd9Sstevel@tonic-gate uint_t px_use_contexts = 1;
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate hrtime_t px_intrpend_timeout = 5ull * NANOSEC;	/* 5 seconds in nanoseconds */
757c478bd9Sstevel@tonic-gate 
767c478bd9Sstevel@tonic-gate uint64_t px_perr_fatal = -1ull;
777c478bd9Sstevel@tonic-gate uint64_t px_serr_fatal = -1ull;
787c478bd9Sstevel@tonic-gate uint64_t px_errtrig_pa = 0x0;
797c478bd9Sstevel@tonic-gate 
80bf8fc234Set char px_panic_hb_msg[] = " System bus";
81bf8fc234Set char px_panic_rc_msg[] = " PCIe root complex";
82bf8fc234Set char px_panic_rp_msg[] = " PCIe root port";
83bf8fc234Set char px_panic_fab_msg[] = " PCIe fabric";
84bf8fc234Set 
857c478bd9Sstevel@tonic-gate /*
867c478bd9Sstevel@tonic-gate  * The following flag controls behavior of the ino handler routine
877c478bd9Sstevel@tonic-gate  * when multiple interrupts are attached to a single ino.  Typically
887c478bd9Sstevel@tonic-gate  * this case would occur for the ino's assigned to the PCI bus slots
897c478bd9Sstevel@tonic-gate  * with multi-function devices or bus bridges.
907c478bd9Sstevel@tonic-gate  *
917c478bd9Sstevel@tonic-gate  * Setting the flag to zero causes the ino handler routine to return
927c478bd9Sstevel@tonic-gate  * after finding the first interrupt handler to claim the interrupt.
937c478bd9Sstevel@tonic-gate  *
947c478bd9Sstevel@tonic-gate  * Setting the flag to non-zero causes the ino handler routine to
957c478bd9Sstevel@tonic-gate  * return after making one complete pass through the interrupt
967c478bd9Sstevel@tonic-gate  * handlers.
977c478bd9Sstevel@tonic-gate  */
987c478bd9Sstevel@tonic-gate uint_t px_check_all_handlers = 1;
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  * The following value is the number of consecutive unclaimed interrupts that
1027c478bd9Sstevel@tonic-gate  * will be tolerated for a particular ino_p before the interrupt is deemed to
1037c478bd9Sstevel@tonic-gate  * be jabbering and is blocked.
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate uint_t px_unclaimed_intr_max = 20;
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate /*
1087c478bd9Sstevel@tonic-gate  * The following value will cause the nexus driver to block an ino after
1097c478bd9Sstevel@tonic-gate  * px_unclaimed_intr_max unclaimed interrupts have been seen.  Setting this
1107c478bd9Sstevel@tonic-gate  * value to 0 will cause interrupts to never be blocked, no matter how many
1117c478bd9Sstevel@tonic-gate  * unclaimed interrupts are seen on a particular ino.
1127c478bd9Sstevel@tonic-gate  */
1137c478bd9Sstevel@tonic-gate uint_t px_unclaimed_intr_block = 1;
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate uint_t px_lock_tlb = 0;
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate uint64_t px_dvma_debug_on = 0;
1187c478bd9Sstevel@tonic-gate uint64_t px_dvma_debug_off = 0;
1197c478bd9Sstevel@tonic-gate uint32_t px_dvma_debug_rec = 512;
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /*
1227c478bd9Sstevel@tonic-gate  * dvma address space allocation cache variables
1237c478bd9Sstevel@tonic-gate  */
1247c478bd9Sstevel@tonic-gate uint_t px_dvma_page_cache_entries = 0x200;	/* # of chunks (1 << bits) */
1257c478bd9Sstevel@tonic-gate uint_t px_dvma_page_cache_clustsz = 0x8;	/* # of pages per chunk */
1267c478bd9Sstevel@tonic-gate #ifdef PX_DMA_PROF
1277c478bd9Sstevel@tonic-gate uint_t px_dvmaft_npages = 0;			/* FT fail due npages */
1287c478bd9Sstevel@tonic-gate uint_t px_dvmaft_limit = 0;			/* FT fail due limits */
1297c478bd9Sstevel@tonic-gate uint_t px_dvmaft_free = 0;			/* FT free */
1307c478bd9Sstevel@tonic-gate uint_t px_dvmaft_success = 0;			/* FT success */
1317c478bd9Sstevel@tonic-gate uint_t px_dvmaft_exhaust = 0;			/* FT vmem fallback */
1327c478bd9Sstevel@tonic-gate uint_t px_dvma_vmem_alloc = 0;			/* vmem alloc */
1337c478bd9Sstevel@tonic-gate uint_t px_dvma_vmem_xalloc = 0;		/* vmem xalloc */
1347c478bd9Sstevel@tonic-gate uint_t px_dvma_vmem_xfree = 0;			/* vmem xfree */
1357c478bd9Sstevel@tonic-gate uint_t px_dvma_vmem_free = 0;			/* vmem free */
1367c478bd9Sstevel@tonic-gate #endif
1377c478bd9Sstevel@tonic-gate uint_t px_disable_fdvma = 0;
1387c478bd9Sstevel@tonic-gate uint_t px_mmu_ctx_lock_failure = 0;
1397c478bd9Sstevel@tonic-gate 
140*18191143SAlan Adamson, SD OSSD uint_t px_max_msiq_msgs = 4;
141*18191143SAlan Adamson, SD OSSD uint_t px_min_msiq_msgs = 2;
142*18191143SAlan Adamson, SD OSSD 
1437c478bd9Sstevel@tonic-gate /*
1447c478bd9Sstevel@tonic-gate  * memory callback list id callback list for kmem_alloc failure clients
1457c478bd9Sstevel@tonic-gate  */
1467c478bd9Sstevel@tonic-gate uintptr_t px_kmem_clid = 0;
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate /* timeout in micro seconds for receiving PME_To_ACK */
1497c478bd9Sstevel@tonic-gate uint64_t px_pme_to_ack_timeout	= PX_PME_TO_ACK_TIMEOUT;
1507c478bd9Sstevel@tonic-gate 
1511a887b2eSjchu /* timeout in micro seconds for receiving link up interrupt */
152f9721e07Sjchu uint64_t px_lup_poll_to = PX_LUP_POLL_TO;
153f9721e07Sjchu uint64_t px_lup_poll_interval = PX_LUP_POLL_INTERVAL;
1541a887b2eSjchu 
1557c478bd9Sstevel@tonic-gate /* PIL at which PME_To_ACK message interrupt is handled */
1567c478bd9Sstevel@tonic-gate uint32_t px_pwr_pil		= PX_PWR_PIL;
1571a887b2eSjchu 
1581a887b2eSjchu uint32_t px_max_l1_tries	= PX_MAX_L1_TRIES;
1598bc7d88aSet 
160bf8fc234Set /* Print and Log tunables.  The following variables are booleans */
161bf8fc234Set #ifdef DEBUG
162bf8fc234Set uint32_t px_log = PX_PANIC | PX_NO_PANIC | PX_PROTECTED | PX_HW_RESET;
163bf8fc234Set #else
164bf8fc234Set uint32_t px_log = PX_PANIC;
165bf8fc234Set #endif
166bf8fc234Set uint32_t px_die = PX_PANIC | PX_PROTECTED | PX_HW_RESET;
167