xref: /onnv-gate/usr/src/uts/sun4/io/px/px_space.c (revision 10923:df470fd79c3c)
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
51772Sjl139090  * Common Development and Distribution License (the "License").
61772Sjl139090  * 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*10841SAlan.Adamson@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate /*
270Sstevel@tonic-gate  * PCI Express nexus driver tunables
280Sstevel@tonic-gate  */
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #include <sys/types.h>
313274Set142600 #include <sys/ddi.h>
323274Set142600 #include <sys/sunddi.h>
330Sstevel@tonic-gate #include <sys/cmn_err.h>
340Sstevel@tonic-gate #include <sys/time.h>
353274Set142600 #include "px_obj.h"
360Sstevel@tonic-gate 
370Sstevel@tonic-gate /*LINTLIBRARY*/
380Sstevel@tonic-gate 
390Sstevel@tonic-gate uint32_t px_spurintr_duration = 60000000; /* One minute */
400Sstevel@tonic-gate uint64_t px_spurintr_msgs = PX_SPURINTR_MSG_DEFAULT;
410Sstevel@tonic-gate 
420Sstevel@tonic-gate /*
430Sstevel@tonic-gate  * The following variable enables a workaround for the following obp bug:
440Sstevel@tonic-gate  *
450Sstevel@tonic-gate  *	1234181 - obp should set latency timer registers in pci
460Sstevel@tonic-gate  *		configuration header
470Sstevel@tonic-gate  *
480Sstevel@tonic-gate  * Until this bug gets fixed in the obp, the following workaround should
490Sstevel@tonic-gate  * be enabled.
500Sstevel@tonic-gate  */
510Sstevel@tonic-gate uint_t px_set_latency_timer_register = 1;
520Sstevel@tonic-gate 
530Sstevel@tonic-gate /*
540Sstevel@tonic-gate  * The following driver parameters are defined as variables to allow
550Sstevel@tonic-gate  * patching for debugging and tuning.  Flags that can be set on a per
560Sstevel@tonic-gate  * PBM basis are bit fields where the PBM device instance number maps
570Sstevel@tonic-gate  * to the bit position.
580Sstevel@tonic-gate  */
590Sstevel@tonic-gate uint_t px_mmu_error_intr_enable = (uint_t)-1;
600Sstevel@tonic-gate uint_t px_rerun_disable = 0;
610Sstevel@tonic-gate 
620Sstevel@tonic-gate uint_t px_error_intr_enable = (uint_t)-1;
630Sstevel@tonic-gate uint_t px_dwsync_disable = 0;
640Sstevel@tonic-gate uint_t px_intsync_disable = 0;
650Sstevel@tonic-gate 
660Sstevel@tonic-gate uint_t px_intr_retry_intv = 5;		/* for interrupt retry reg */
670Sstevel@tonic-gate uint8_t px_latency_timer = 0x40;	/* for pci latency timer reg */
680Sstevel@tonic-gate uint_t px_panic_on_fatal_errors = 1;	/* should be 1 at beta */
690Sstevel@tonic-gate uint_t px_thermal_intr_fatal = 1;	/* thermal interrupts fatal */
700Sstevel@tonic-gate uint_t px_buserr_interrupt = 1;	/* safari buserr interrupt */
710Sstevel@tonic-gate uint_t px_ctx_no_active_flush = 0;	/* cannot handle active ctx flush */
720Sstevel@tonic-gate uint_t px_use_contexts = 1;
730Sstevel@tonic-gate 
740Sstevel@tonic-gate hrtime_t px_intrpend_timeout = 5ull * NANOSEC;	/* 5 seconds in nanoseconds */
750Sstevel@tonic-gate 
760Sstevel@tonic-gate uint64_t px_perr_fatal = -1ull;
770Sstevel@tonic-gate uint64_t px_serr_fatal = -1ull;
780Sstevel@tonic-gate uint64_t px_errtrig_pa = 0x0;
790Sstevel@tonic-gate 
803274Set142600 char px_panic_hb_msg[] = " System bus";
813274Set142600 char px_panic_rc_msg[] = " PCIe root complex";
823274Set142600 char px_panic_rp_msg[] = " PCIe root port";
833274Set142600 char px_panic_fab_msg[] = " PCIe fabric";
843274Set142600 
850Sstevel@tonic-gate /*
860Sstevel@tonic-gate  * The following flag controls behavior of the ino handler routine
870Sstevel@tonic-gate  * when multiple interrupts are attached to a single ino.  Typically
880Sstevel@tonic-gate  * this case would occur for the ino's assigned to the PCI bus slots
890Sstevel@tonic-gate  * with multi-function devices or bus bridges.
900Sstevel@tonic-gate  *
910Sstevel@tonic-gate  * Setting the flag to zero causes the ino handler routine to return
920Sstevel@tonic-gate  * after finding the first interrupt handler to claim the interrupt.
930Sstevel@tonic-gate  *
940Sstevel@tonic-gate  * Setting the flag to non-zero causes the ino handler routine to
950Sstevel@tonic-gate  * return after making one complete pass through the interrupt
960Sstevel@tonic-gate  * handlers.
970Sstevel@tonic-gate  */
980Sstevel@tonic-gate uint_t px_check_all_handlers = 1;
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate /*
1010Sstevel@tonic-gate  * The following value is the number of consecutive unclaimed interrupts that
1020Sstevel@tonic-gate  * will be tolerated for a particular ino_p before the interrupt is deemed to
1030Sstevel@tonic-gate  * be jabbering and is blocked.
1040Sstevel@tonic-gate  */
1050Sstevel@tonic-gate uint_t px_unclaimed_intr_max = 20;
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate /*
1080Sstevel@tonic-gate  * The following value will cause the nexus driver to block an ino after
1090Sstevel@tonic-gate  * px_unclaimed_intr_max unclaimed interrupts have been seen.  Setting this
1100Sstevel@tonic-gate  * value to 0 will cause interrupts to never be blocked, no matter how many
1110Sstevel@tonic-gate  * unclaimed interrupts are seen on a particular ino.
1120Sstevel@tonic-gate  */
1130Sstevel@tonic-gate uint_t px_unclaimed_intr_block = 1;
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate uint_t px_lock_tlb = 0;
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate uint64_t px_dvma_debug_on = 0;
1180Sstevel@tonic-gate uint64_t px_dvma_debug_off = 0;
1190Sstevel@tonic-gate uint32_t px_dvma_debug_rec = 512;
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate /*
1220Sstevel@tonic-gate  * dvma address space allocation cache variables
1230Sstevel@tonic-gate  */
1240Sstevel@tonic-gate uint_t px_dvma_page_cache_entries = 0x200;	/* # of chunks (1 << bits) */
1250Sstevel@tonic-gate uint_t px_dvma_page_cache_clustsz = 0x8;	/* # of pages per chunk */
1260Sstevel@tonic-gate #ifdef PX_DMA_PROF
1270Sstevel@tonic-gate uint_t px_dvmaft_npages = 0;			/* FT fail due npages */
1280Sstevel@tonic-gate uint_t px_dvmaft_limit = 0;			/* FT fail due limits */
1290Sstevel@tonic-gate uint_t px_dvmaft_free = 0;			/* FT free */
1300Sstevel@tonic-gate uint_t px_dvmaft_success = 0;			/* FT success */
1310Sstevel@tonic-gate uint_t px_dvmaft_exhaust = 0;			/* FT vmem fallback */
1320Sstevel@tonic-gate uint_t px_dvma_vmem_alloc = 0;			/* vmem alloc */
1330Sstevel@tonic-gate uint_t px_dvma_vmem_xalloc = 0;		/* vmem xalloc */
1340Sstevel@tonic-gate uint_t px_dvma_vmem_xfree = 0;			/* vmem xfree */
1350Sstevel@tonic-gate uint_t px_dvma_vmem_free = 0;			/* vmem free */
1360Sstevel@tonic-gate #endif
1370Sstevel@tonic-gate uint_t px_disable_fdvma = 0;
1380Sstevel@tonic-gate uint_t px_mmu_ctx_lock_failure = 0;
1390Sstevel@tonic-gate 
140*10841SAlan.Adamson@Sun.COM uint_t px_max_msiq_msgs = 4;
141*10841SAlan.Adamson@Sun.COM uint_t px_min_msiq_msgs = 2;
142*10841SAlan.Adamson@Sun.COM 
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 
1603274Set142600 /* Print and Log tunables.  The following variables are booleans */
1613274Set142600 #ifdef DEBUG
1623274Set142600 uint32_t px_log = PX_PANIC | PX_NO_PANIC | PX_PROTECTED | PX_HW_RESET;
1633274Set142600 #else
1643274Set142600 uint32_t px_log = PX_PANIC;
1653274Set142600 #endif
1663274Set142600 uint32_t px_die = PX_PANIC | PX_PROTECTED | PX_HW_RESET;
167