xref: /onnv-gate/usr/src/uts/sun4/io/px/px_space.c (revision 118:95b7553159a2)
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
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
230Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /*
300Sstevel@tonic-gate  * PCI Express nexus driver tunables
310Sstevel@tonic-gate  */
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <sys/types.h>
340Sstevel@tonic-gate #include <sys/cmn_err.h>
350Sstevel@tonic-gate #include <sys/time.h>
360Sstevel@tonic-gate #include <sys/pci.h>
370Sstevel@tonic-gate #include "px_space.h"
380Sstevel@tonic-gate 
390Sstevel@tonic-gate /*LINTLIBRARY*/
400Sstevel@tonic-gate 
410Sstevel@tonic-gate uint32_t px_spurintr_duration = 60000000; /* One minute */
420Sstevel@tonic-gate uint64_t px_spurintr_msgs = PX_SPURINTR_MSG_DEFAULT;
430Sstevel@tonic-gate 
440Sstevel@tonic-gate /*
450Sstevel@tonic-gate  * The following variable enables a workaround for the following obp bug:
460Sstevel@tonic-gate  *
470Sstevel@tonic-gate  *	1234181 - obp should set latency timer registers in pci
480Sstevel@tonic-gate  *		configuration header
490Sstevel@tonic-gate  *
500Sstevel@tonic-gate  * Until this bug gets fixed in the obp, the following workaround should
510Sstevel@tonic-gate  * be enabled.
520Sstevel@tonic-gate  */
530Sstevel@tonic-gate uint_t px_set_latency_timer_register = 1;
540Sstevel@tonic-gate 
550Sstevel@tonic-gate /*
560Sstevel@tonic-gate  * The following driver parameters are defined as variables to allow
570Sstevel@tonic-gate  * patching for debugging and tuning.  Flags that can be set on a per
580Sstevel@tonic-gate  * PBM basis are bit fields where the PBM device instance number maps
590Sstevel@tonic-gate  * to the bit position.
600Sstevel@tonic-gate  */
610Sstevel@tonic-gate uint_t px_mmu_error_intr_enable = (uint_t)-1;
620Sstevel@tonic-gate uint_t px_rerun_disable = 0;
630Sstevel@tonic-gate 
640Sstevel@tonic-gate uint_t px_error_intr_enable = (uint_t)-1;
650Sstevel@tonic-gate uint_t px_dwsync_disable = 0;
660Sstevel@tonic-gate uint_t px_intsync_disable = 0;
670Sstevel@tonic-gate 
680Sstevel@tonic-gate uint_t px_intr_retry_intv = 5;		/* for interrupt retry reg */
690Sstevel@tonic-gate uint8_t px_latency_timer = 0x40;	/* for pci latency timer reg */
700Sstevel@tonic-gate uint_t px_panic_on_fatal_errors = 1;	/* should be 1 at beta */
710Sstevel@tonic-gate uint_t px_thermal_intr_fatal = 1;	/* thermal interrupts fatal */
720Sstevel@tonic-gate uint_t px_buserr_interrupt = 1;	/* safari buserr interrupt */
730Sstevel@tonic-gate uint_t px_ctx_no_active_flush = 0;	/* cannot handle active ctx flush */
740Sstevel@tonic-gate uint_t px_use_contexts = 1;
750Sstevel@tonic-gate 
760Sstevel@tonic-gate hrtime_t px_intrpend_timeout = 5ull * NANOSEC;	/* 5 seconds in nanoseconds */
770Sstevel@tonic-gate 
780Sstevel@tonic-gate uint64_t px_perr_fatal = -1ull;
790Sstevel@tonic-gate uint64_t px_serr_fatal = -1ull;
800Sstevel@tonic-gate uint64_t px_errtrig_pa = 0x0;
810Sstevel@tonic-gate 
820Sstevel@tonic-gate /*
830Sstevel@tonic-gate  * The following flag controls behavior of the ino handler routine
840Sstevel@tonic-gate  * when multiple interrupts are attached to a single ino.  Typically
850Sstevel@tonic-gate  * this case would occur for the ino's assigned to the PCI bus slots
860Sstevel@tonic-gate  * with multi-function devices or bus bridges.
870Sstevel@tonic-gate  *
880Sstevel@tonic-gate  * Setting the flag to zero causes the ino handler routine to return
890Sstevel@tonic-gate  * after finding the first interrupt handler to claim the interrupt.
900Sstevel@tonic-gate  *
910Sstevel@tonic-gate  * Setting the flag to non-zero causes the ino handler routine to
920Sstevel@tonic-gate  * return after making one complete pass through the interrupt
930Sstevel@tonic-gate  * handlers.
940Sstevel@tonic-gate  */
950Sstevel@tonic-gate uint_t px_check_all_handlers = 1;
960Sstevel@tonic-gate 
970Sstevel@tonic-gate /*
980Sstevel@tonic-gate  * The following value is the number of consecutive unclaimed interrupts that
990Sstevel@tonic-gate  * will be tolerated for a particular ino_p before the interrupt is deemed to
1000Sstevel@tonic-gate  * be jabbering and is blocked.
1010Sstevel@tonic-gate  */
1020Sstevel@tonic-gate uint_t px_unclaimed_intr_max = 20;
1030Sstevel@tonic-gate 
1040Sstevel@tonic-gate /*
1050Sstevel@tonic-gate  * The following value will cause the nexus driver to block an ino after
1060Sstevel@tonic-gate  * px_unclaimed_intr_max unclaimed interrupts have been seen.  Setting this
1070Sstevel@tonic-gate  * value to 0 will cause interrupts to never be blocked, no matter how many
1080Sstevel@tonic-gate  * unclaimed interrupts are seen on a particular ino.
1090Sstevel@tonic-gate  */
1100Sstevel@tonic-gate uint_t px_unclaimed_intr_block = 1;
1110Sstevel@tonic-gate 
1120Sstevel@tonic-gate uint_t px_lock_tlb = 0;
1130Sstevel@tonic-gate 
1140Sstevel@tonic-gate uint64_t px_dvma_debug_on = 0;
1150Sstevel@tonic-gate uint64_t px_dvma_debug_off = 0;
1160Sstevel@tonic-gate uint32_t px_dvma_debug_rec = 512;
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate /*
1190Sstevel@tonic-gate  * dvma address space allocation cache variables
1200Sstevel@tonic-gate  */
1210Sstevel@tonic-gate uint_t px_dvma_page_cache_entries = 0x200;	/* # of chunks (1 << bits) */
1220Sstevel@tonic-gate uint_t px_dvma_page_cache_clustsz = 0x8;	/* # of pages per chunk */
1230Sstevel@tonic-gate #ifdef PX_DMA_PROF
1240Sstevel@tonic-gate uint_t px_dvmaft_npages = 0;			/* FT fail due npages */
1250Sstevel@tonic-gate uint_t px_dvmaft_limit = 0;			/* FT fail due limits */
1260Sstevel@tonic-gate uint_t px_dvmaft_free = 0;			/* FT free */
1270Sstevel@tonic-gate uint_t px_dvmaft_success = 0;			/* FT success */
1280Sstevel@tonic-gate uint_t px_dvmaft_exhaust = 0;			/* FT vmem fallback */
1290Sstevel@tonic-gate uint_t px_dvma_vmem_alloc = 0;			/* vmem alloc */
1300Sstevel@tonic-gate uint_t px_dvma_vmem_xalloc = 0;		/* vmem xalloc */
1310Sstevel@tonic-gate uint_t px_dvma_vmem_xfree = 0;			/* vmem xfree */
1320Sstevel@tonic-gate uint_t px_dvma_vmem_free = 0;			/* vmem free */
1330Sstevel@tonic-gate #endif
1340Sstevel@tonic-gate uint_t px_disable_fdvma = 0;
1350Sstevel@tonic-gate uint_t px_mmu_ctx_lock_failure = 0;
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate /*
1380Sstevel@tonic-gate  * This flag preserves prom MMU settings by copying prom TSB entries
1390Sstevel@tonic-gate  * to corresponding kernel TSB entry locations. It should be removed
1400Sstevel@tonic-gate  * after the interface properties from obp have become default.
1410Sstevel@tonic-gate  */
1420Sstevel@tonic-gate uint_t px_preserve_mmu_tsb = 1;
1430Sstevel@tonic-gate 
1440Sstevel@tonic-gate /*
1450Sstevel@tonic-gate  * memory callback list id callback list for kmem_alloc failure clients
1460Sstevel@tonic-gate  */
1470Sstevel@tonic-gate uintptr_t px_kmem_clid = 0;
1480Sstevel@tonic-gate 
1490Sstevel@tonic-gate uint_t px_err_log_all = 0;
1500Sstevel@tonic-gate 
1510Sstevel@tonic-gate uint64_t px_tlu_ue_intr_mask	= PX_ERR_EN_ALL;
1520Sstevel@tonic-gate uint64_t px_tlu_ue_log_mask	= PX_ERR_EN_ALL;
1530Sstevel@tonic-gate uint64_t px_tlu_ue_count_mask	= PX_ERR_EN_ALL;
1540Sstevel@tonic-gate 
1550Sstevel@tonic-gate uint64_t px_tlu_ce_intr_mask	= PX_ERR_MASK_NONE;
1560Sstevel@tonic-gate uint64_t px_tlu_ce_log_mask	= PX_ERR_MASK_NONE;
1570Sstevel@tonic-gate uint64_t px_tlu_ce_count_mask	= PX_ERR_MASK_NONE;
1580Sstevel@tonic-gate 
15927Sjchu /*
16027Sjchu  * Do not enable Link Interrupts
16127Sjchu  */
16227Sjchu uint64_t px_tlu_oe_intr_mask	= PX_ERR_EN_ALL & ~0x80000000800;
1630Sstevel@tonic-gate uint64_t px_tlu_oe_log_mask	= PX_ERR_EN_ALL;
1640Sstevel@tonic-gate uint64_t px_tlu_oe_count_mask	= PX_ERR_EN_ALL;
1650Sstevel@tonic-gate 
1660Sstevel@tonic-gate uint64_t px_mmu_intr_mask	= PX_ERR_EN_ALL;
1670Sstevel@tonic-gate uint64_t px_mmu_log_mask	= PX_ERR_EN_ALL;
1680Sstevel@tonic-gate uint64_t px_mmu_count_mask	= PX_ERR_EN_ALL;
1690Sstevel@tonic-gate 
1700Sstevel@tonic-gate uint64_t px_imu_intr_mask	= PX_ERR_EN_ALL;
1710Sstevel@tonic-gate uint64_t px_imu_log_mask	= PX_ERR_EN_ALL;
1720Sstevel@tonic-gate uint64_t px_imu_count_mask	= PX_ERR_EN_ALL;
1730Sstevel@tonic-gate 
17427Sjchu /*
17527Sjchu  * (1ull << ILU_INTERRUPT_ENABLE_IHB_PE_S) |
17627Sjchu  * (1ull << ILU_INTERRUPT_ENABLE_IHB_PE_P);
17727Sjchu  */
17827Sjchu uint64_t px_ilu_intr_mask	= (((uint64_t)0x10 << 32) | 0x10);
17927Sjchu uint64_t px_ilu_log_mask	= 0x10; /* ILU_ERROR_LOG_ENABLE_IHB_PE */
1800Sstevel@tonic-gate uint64_t px_ilu_count_mask	= PX_ERR_EN_ALL;
1810Sstevel@tonic-gate 
1820Sstevel@tonic-gate uint64_t px_cb_intr_mask	= PX_ERR_EN_ALL;
1830Sstevel@tonic-gate uint64_t px_cb_log_mask		= PX_ERR_EN_ALL;
1840Sstevel@tonic-gate uint64_t px_cb_count_mask	= PX_ERR_EN_ALL;
1850Sstevel@tonic-gate 
18627Sjchu /*
18727Sjchu  * LPU Intr Registers are reverse encoding from the registers above.
18827Sjchu  * 1 = disable
18927Sjchu  * 0 = enable
19027Sjchu  *
19127Sjchu  * Log and Count are however still the same.
19227Sjchu  */
19327Sjchu uint64_t px_lpul_intr_mask	= LPU_INTR_DISABLE;
1940Sstevel@tonic-gate uint64_t px_lpul_log_mask	= PX_ERR_EN_ALL;
1950Sstevel@tonic-gate uint64_t px_lpul_count_mask	= PX_ERR_EN_ALL;
1960Sstevel@tonic-gate 
19727Sjchu uint64_t px_lpup_intr_mask	= LPU_INTR_DISABLE;
1980Sstevel@tonic-gate uint64_t px_lpup_log_mask	= PX_ERR_EN_ALL;
1990Sstevel@tonic-gate uint64_t px_lpup_count_mask	= PX_ERR_EN_ALL;
2000Sstevel@tonic-gate 
20127Sjchu uint64_t px_lpur_intr_mask	= LPU_INTR_DISABLE;
2020Sstevel@tonic-gate uint64_t px_lpur_log_mask	= PX_ERR_EN_ALL;
2030Sstevel@tonic-gate uint64_t px_lpur_count_mask	= PX_ERR_EN_ALL;
2040Sstevel@tonic-gate 
20527Sjchu uint64_t px_lpux_intr_mask	= LPU_INTR_DISABLE;
2060Sstevel@tonic-gate uint64_t px_lpux_log_mask	= PX_ERR_EN_ALL;
2070Sstevel@tonic-gate uint64_t px_lpux_count_mask	= PX_ERR_EN_ALL;
2080Sstevel@tonic-gate 
20927Sjchu uint64_t px_lpus_intr_mask	= LPU_INTR_DISABLE;
2100Sstevel@tonic-gate uint64_t px_lpus_log_mask	= PX_ERR_EN_ALL;
2110Sstevel@tonic-gate uint64_t px_lpus_count_mask	= PX_ERR_EN_ALL;
2120Sstevel@tonic-gate 
21327Sjchu uint64_t px_lpug_intr_mask	= LPU_INTR_DISABLE;
2140Sstevel@tonic-gate uint64_t px_lpug_log_mask	= PX_ERR_EN_ALL;
2150Sstevel@tonic-gate uint64_t px_lpug_count_mask	= PX_ERR_EN_ALL;
2160Sstevel@tonic-gate 
2170Sstevel@tonic-gate /* timeout in micro seconds for receiving PME_To_ACK */
2180Sstevel@tonic-gate uint64_t px_pme_to_ack_timeout	= PX_PME_TO_ACK_TIMEOUT;
2190Sstevel@tonic-gate 
220*118Sjchu /* timeout in micro seconds for receiving link up interrupt */
221*118Sjchu uint64_t px_linkup_timeout = PX_LINKUP_TIMEOUT;
222*118Sjchu 
2230Sstevel@tonic-gate /* PIL at which PME_To_ACK message interrupt is handled */
2240Sstevel@tonic-gate uint32_t px_pwr_pil		= PX_PWR_PIL;
225*118Sjchu 
226*118Sjchu uint32_t px_max_l1_tries	= PX_MAX_L1_TRIES;
227