summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4u/io/pci/pci_space.c
blob: 06ae46448e56a7252a21a5ce7b46b4ecfef9534f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#pragma ident	"%Z%%M%	%I%	%E% SMI"

/*
 * PCI nexus driver tunables
 */

#include <sys/types.h>
#include <sys/cmn_err.h>
#include <sys/time.h>
#include <sys/thread.h>
#include <sys/ksynch.h>
#include <sys/pci.h>
#include <sys/pci/pci_space.h>


/*LINTLIBRARY*/

/*
 * Used to disallow bypass requests for tomatillos ver <= 2.3
 * 0 allow bypass, 1 disallow it. errata #75
 */
uint_t tomatillo_disallow_bypass = 0;

/*
 * The three variables below enable a workround for
 * tomatillo's micro TLB bug. errata #82
 */
uint_t tm_mtlb_maxpgs = 20;
uint_t tm_mtlb_gc = 0; /* for garbage collection */
uint_t tm_mtlb_gc_manual = 0; /* for manual tuning */

/*
 * By initializing pci_interrupt_priorities_property to 1, the priority
 * level of the interrupt handler for a PCI device can be defined via an
 * "interrupt-priorities" property.  This property is an array of integer
 * values that have a one to one mapping the the "interrupts" property.
 * For example, if a device's "interrupts" property was (1, 2) and its
 * "interrupt-priorities" value was (5, 12), the handler for the first
 * interrupt would run at cpu priority 5 and the second at priority 12.
 * This would override the drivers standard mechanism for assigning
 * priorities to interrupt handlers.
 */
uint_t pci_interrupt_priorities_property = 1;

/*
 * By initializing pci_config_space_size_zero to 1, the driver will
 * tolerate mapping requests for configuration space "reg" entries whose
 * size is not zero.
 */
uint_t pci_config_space_size_zero = 1;

int pci_dvma_sync_before_unmap = 0;
int pci_sync_lock = 0;

int tomatillo_store_store_wrka = 0;
uint32_t pci_spurintr_duration = 60000000; /* One minute */
uint64_t pci_spurintr_msgs = PCI_SPURINTR_MSG_DEFAULT;

/*
 * The variable controls the default setting of the command register
 * for pci devices.  See init_child() for details.
 *
 * This flags also controls the setting of bits in the bridge control
 * register pci to pci bridges.  See init_child() for details.
 */
ushort_t pci_command_default = PCI_COMM_SERR_ENABLE |
				PCI_COMM_WAIT_CYC_ENAB |
				PCI_COMM_PARITY_DETECT |
				PCI_COMM_ME |
				PCI_COMM_MAE |
				PCI_COMM_IO;
/*
 * The following variable enables a workaround for the following obp bug:
 *
 *	1234181 - obp should set latency timer registers in pci
 *		configuration header
 *
 * Until this bug gets fixed in the obp, the following workaround should
 * be enabled.
 */
uint_t pci_set_latency_timer_register = 1;

/*
 * The following variable enables a workaround for an obp bug to be
 * submitted.  A bug requesting a workaround fof this problem has
 * been filed:
 *
 *	1235094 - need workarounds on positron nexus drivers to set cache
 *		line size registers
 *
 * Until this bug gets fixed in the obp, the following workaround should
 * be enabled.
 */
uint_t pci_set_cache_line_size_register = 1;

/*
 * The following driver parameters are defined as variables to allow
 * patching for debugging and tuning.  Flags that can be set on a per
 * PBM basis are bit fields where the PBM device instance number maps
 * to the bit position.
 */
#ifdef DEBUG
uint64_t pci_debug_flags = 0;
uint_t pci_warn_pp0 = 0;
#endif
uint_t pci_disable_pass1_workarounds = 0;
uint_t pci_disable_pass2_workarounds = 0;
uint_t pci_disable_pass3_workarounds = 0;
uint_t pci_disable_plus_workarounds = 0;
uint_t pci_disable_default_workarounds = 0;
uint_t ecc_error_intr_enable = 1;
uint_t pci_sbh_error_intr_enable = (uint_t)-1;
uint_t pci_mmu_error_intr_enable = (uint_t)-1;
uint_t pci_stream_buf_enable = (uint_t)-1;
uint_t pci_stream_buf_exists = 1;
uint_t pci_rerun_disable = 0;

uint_t pci_enable_retry_arb = (uint_t)-1;

uint_t pci_bus_parking_enable = (uint_t)-1;
uint_t pci_error_intr_enable = (uint_t)-1;
uint_t pci_retry_disable = 0;
uint_t pci_retry_enable = 0;
uint_t pci_dwsync_disable = 0;
uint_t pci_intsync_disable = 0;
uint_t pci_b_arb_enable = 0xf;
uint_t pci_a_arb_enable = 0xf;
uint_t pci_ecc_afsr_retries = 100;	/* XXX - what's a good value? */

uint_t pci_intr_retry_intv = 5;		/* for interrupt retry reg */
uint8_t pci_latency_timer = 0x40;	/* for pci latency timer reg */
uint_t pci_panic_on_sbh_errors = 0;
uint_t pci_panic_on_fatal_errors = 1;	/* should be 1 at beta */
uint_t pci_thermal_intr_fatal = 1;	/* thermal interrupts fatal */
uint_t pci_buserr_interrupt = 1;	/* safari buserr interrupt */
uint_t pci_set_dto_value = 0;		/* overwrite the prom settings? */
uint_t pci_dto_value = 1;		/* schizo consistent buf timeout PTO */
uint_t pci_lock_sbuf = 0;

uint_t pci_use_contexts = 1;
uint_t pci_sc_use_contexts = 1;
uint_t pci_context_minpages = 2;
uint_t pci_ctx_flush_warn = CE_IGNORE;
uint_t pci_ctx_unsuccess_count = 0;	/* unsuccessful ctx flush count */
uint_t pci_ctx_no_active_flush = 0;	/* cannot handle active ctx flush */
uint_t pci_ctx_no_compat = 0;		/* maintain compatibility */

uint64_t pci_perr_enable = -1ull;
uint64_t pci_serr_enable = -1ull;
uint64_t pci_perr_fatal = -1ull;
uint64_t pci_serr_fatal = -1ull;
hrtime_t pci_intrpend_timeout = 5ll * NANOSEC;	/* 5 seconds in nanoseconds */
hrtime_t pci_sync_buf_timeout = 1ll * NANOSEC;	/* 1 second  in nanoseconds */
hrtime_t pci_cdma_intr_timeout = 1ll * NANOSEC; /* consistent sync trigger */
uint32_t pci_cdma_intr_count = 15; /* num of pci_cdma_intr_timeout cycles */

uint32_t pci_dto_fault_warn = CE_WARN; /* set to CE_IGNORE for no messages */
uint64_t pci_dto_intr_enable = 0;
uint64_t pci_dto_count = 0;
uint64_t pci_errtrig_pa = 0x0;

/*
 * The following flag controls behavior of the ino handler routine
 * when multiple interrupts are attached to a single ino.  Typically
 * this case would occur for the ino's assigned to the PCI bus slots
 * with multi-function devices or bus bridges.
 *
 * Setting the flag to zero causes the ino handler routine to return
 * after finding the first interrupt handler to claim the interrupt.
 *
 * Setting the flag to non-zero causes the ino handler routine to
 * return after making one complete pass through the interrupt
 * handlers.
 */
uint_t pci_check_all_handlers = 1;

/*
 * The following value is the number of consecutive unclaimed interrupts that
 * will be tolerated for a particular ino_p before the interrupt is deemed to
 * be jabbering and is blocked.
 */
uint_t pci_unclaimed_intr_max = 20;

ulong_t pci_iommu_dvma_end = 0xfffffffful;
uint_t pci_lock_tlb = 0;
uint64_t pci_dvma_debug_on = 0;
uint64_t pci_dvma_debug_off = 0;
uint32_t pci_dvma_debug_rec = 512;

/*
 * dvma address space allocation cache variables
 */
uint_t pci_dvma_page_cache_entries = 0x200;	/* # of chunks (1 << bits) */
uint_t pci_dvma_page_cache_clustsz = 0x8;	/* # of pages per chunk */
#ifdef PCI_DMA_PROF
uint_t pci_dvmaft_npages = 0;			/* FT fail due npages */
uint_t pci_dvmaft_limit = 0;			/* FT fail due limits */
uint_t pci_dvmaft_free = 0;			/* FT free */
uint_t pci_dvmaft_success = 0;			/* FT success */
uint_t pci_dvmaft_exhaust = 0;			/* FT vmem fallback */
uint_t pci_dvma_vmem_alloc = 0;			/* vmem alloc */
uint_t pci_dvma_vmem_xalloc = 0;		/* vmem xalloc */
uint_t pci_dvma_vmem_xfree = 0;			/* vmem xfree */
uint_t pci_dvma_vmem_free = 0;			/* vmem free */
#endif
uint_t pci_disable_fdvma = 0;

uint_t pci_iommu_ctx_lock_failure = 0;

/*
 * This flag preserves prom iommu settings by copying prom TSB entries
 * to corresponding kernel TSB entry locations. It should be removed
 * after the interface properties from obp have become default.
 */
uint_t pci_preserve_iommu_tsb = 1;

/*
 * memory callback list id callback list for kmem_alloc failure clients
 */
uintptr_t pci_kmem_clid = 0;

/*
 * Perform a consistent-mode sync/flush during interrupt.
 */
uint_t pci_intr_dma_sync = 0;

/*
 * This flag is used to enable max prefetch streaming cache mode
 * feature of XMITS.
 */
uint_t pci_xmits_sc_max_prf = 0;

/*
 * This flag is used to enable pcix error reporting in XMITS.
 */
uint64_t xmits_error_intr_enable = -1ull;

/*
 * Enable parity error recovery for xmits
 */
uint_t xmits_perr_recov_int_enable = 0;

/*
 * This flag controls whether or not DVMA remap support is
 * enabled (currently, Schizo/XMITS only).
 */
int pci_dvma_remap_enabled = 0;

/*
 * Serialize PCI relocations, since they are time critical.
 */
kthread_t *pci_reloc_thread = NULL;
kmutex_t pci_reloc_mutex;
kcondvar_t pci_reloc_cv;
int pci_reloc_presuspend = 0;
int pci_reloc_suspend = 0;
id_t pci_dvma_cbid;
id_t pci_fast_dvma_cbid;
int pci_dma_panic_on_leak = 0;

/*
 * Set Outstanding Maximum Split Transactions.  Legal settings are:
 * 0 = 1 Outstanding Transacation, 1 = 2, 2 = 3, 3 = 4, 4 = 8, 5 = 12,
 * 6 = 16, 7 = 32.
 */
uint_t xmits_max_transactions = 0;

/*
 * Set Max Memory Read Byte Count. Legal settings are:
 * 0 = 512 Max Memory Read Bytes, 1 = 1024, 2 = 2048, 3 = 4096.
 */
uint_t xmits_max_read_bytes = 0;

/*
 * Bits 15:0 increase the maximum PIO retries allowed by XMITS.
 */
uint_t xmits_upper_retry_counter = 0x3E8;

/*
 * default values for xmits pcix diag BUG_FIX_CNTL bits 47:32
 * depending on mode: pcix or pci.
 */
uint_t xmits_pcix_diag_bugcntl_pcix = 0xA0;
uint_t xmits_pcix_diag_bugcntl_pci =  0xFF;