1menu "Kernel hacking"
2
3source "lib/Kconfig.debug"
4
5config DEBUG_STACKOVERFLOW
6	bool "Check for stack overflows"
7	depends on DEBUG_KERNEL
8	help
9	  This option will cause messages to be printed if free stack space
10	  drops below a certain limit.
11
12config DEBUG_VERBOSE
13	bool "Verbose fault messages"
14	default y
15	select PRINTK
16	help
17	  When a program crashes due to an exception, or the kernel detects
18	  an internal error, the kernel can print a not so brief message
19	  explaining what the problem was. This debugging information is
20	  useful to developers and kernel hackers when tracking down problems,
21	  but mostly meaningless to other people. This is always helpful for
22	  debugging but serves no purpose on a production system.
23	  Most people should say N here.
24
25config DEBUG_MMRS
26	tristate "Generate Blackfin MMR tree"
27	select DEBUG_FS
28	help
29	  Create a tree of Blackfin MMRs via the debugfs tree.  If
30	  you enable this, you will find all MMRs laid out in the
31	  /sys/kernel/debug/blackfin/ directory where you can read/write
32	  MMRs directly from userspace.  This is obviously just a debug
33	  feature.
34
35config DEBUG_HWERR
36	bool "Hardware error interrupt debugging"
37	depends on DEBUG_KERNEL
38	help
39	  When enabled, the hardware error interrupt is never disabled, and
40	  will happen immediately when an error condition occurs.  This comes
41	  at a slight cost in code size, but is necessary if you are getting
42	  hardware error interrupts and need to know where they are coming
43	  from.
44
45config EXACT_HWERR
46	bool "Try to make Hardware errors exact"
47	depends on DEBUG_HWERR
48	help
49	  By default, the Blackfin hardware errors are not exact - the error
50          be reported multiple cycles after the error happens. This delay
51	  can cause the wrong application, or even the kernel to receive a
52	  signal to be killed. If you are getting HW errors in your system,
53	  try turning this on to ensure they are at least coming from the
54	  proper thread.
55
56	  On production systems, it is safe (and a small optimization) to say N.
57
58config DEBUG_DOUBLEFAULT
59	bool "Debug Double Faults"
60	default n
61	help
62	  If an exception is caused while executing code within the exception
63	  handler, the NMI handler, the reset vector, or in emulator mode,
64	  a double fault occurs. On the Blackfin, this is a unrecoverable
65	  event. You have two options:
66	  - RESET exactly when double fault occurs. The excepting
67	    instruction address is stored in RETX, where the next kernel
68	    boot will print it out.
69	  - Print debug message. This is much more error prone, although
70	    easier to handle. It is error prone since:
71	    - The excepting instruction is not committed.
72	    - All writebacks from the instruction are prevented.
73	    - The generated exception is not taken.
74	    - The EXCAUSE field is updated with an unrecoverable event
75	    The only way to check this is to see if EXCAUSE contains the
76	    unrecoverable event value at every exception return. By selecting
77	    this option, you are skipping over the faulting instruction, and
78	    hoping things stay together enough to print out a debug message.
79
80	  This does add a little kernel code, but is the only method to debug
81	  double faults - if unsure say "Y"
82
83choice
84	prompt "Double Fault Failure Method"
85	default DEBUG_DOUBLEFAULT_PRINT
86	depends on DEBUG_DOUBLEFAULT
87
88config DEBUG_DOUBLEFAULT_PRINT
89	bool "Print"
90
91config DEBUG_DOUBLEFAULT_RESET
92	bool "Reset"
93
94endchoice
95
96config DEBUG_HUNT_FOR_ZERO
97	bool "Catch NULL pointer reads/writes"
98	default y
99	help
100	  Say Y here to catch reads/writes to anywhere in the memory range
101	  from 0x0000 - 0x0FFF (the first 4k) of memory.  This is useful in
102	  catching common programming errors such as NULL pointer dereferences.
103
104	  Misbehaving applications will be killed (generate a SEGV) while the
105	  kernel will trigger a panic.
106
107	  Enabling this option will take up an extra entry in CPLB table.
108	  Otherwise, there is no extra overhead.
109
110config DEBUG_BFIN_HWTRACE_ON
111	bool "Turn on Blackfin's Hardware Trace"
112	default y
113	help
114	  All Blackfins include a Trace Unit which stores a history of the last
115	  16 changes in program flow taken by the program sequencer. The history
116	  allows the user to recreate the program sequencer’s recent path. This
117	  can be handy when an application dies - we print out the execution
118	  path of how it got to the offending instruction.
119
120	  By turning this off, you may save a tiny amount of power.
121
122choice
123	prompt "Omit loop Tracing"
124	default DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
125	depends on DEBUG_BFIN_HWTRACE_ON
126	help
127	  The trace buffer can be configured to omit recording of changes in
128	  program flow that match either the last entry or one of the last
129	  two entries. Omitting one of these entries from the record prevents
130	  the trace buffer from overflowing because of any sort of loop (for, do
131	  while, etc) in the program.
132
133	  Because zero-overhead Hardware loops are not recorded in the trace buffer,
134	  this feature can be used to prevent trace overflow from loops that
135	  are nested four deep.
136
137config DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
138	bool "Trace all Loops"
139	help
140	  The trace buffer records all changes of flow
141
142config DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
143	bool "Compress single-level loops"
144	help
145	  The trace buffer does not record single loops - helpful if trace
146	  is spinning on a while or do loop.
147
148config DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
149	bool "Compress two-level loops"
150	help
151	  The trace buffer does not record loops two levels deep. Helpful if
152	  the trace is spinning in a nested loop
153
154endchoice
155
156config DEBUG_BFIN_HWTRACE_COMPRESSION
157	int
158	depends on DEBUG_BFIN_HWTRACE_ON
159	default 0 if DEBUG_BFIN_HWTRACE_COMPRESSION_OFF
160	default 1 if DEBUG_BFIN_HWTRACE_COMPRESSION_ONE
161	default 2 if DEBUG_BFIN_HWTRACE_COMPRESSION_TWO
162
163
164config DEBUG_BFIN_HWTRACE_EXPAND
165	bool "Expand Trace Buffer greater than 16 entries"
166	depends on DEBUG_BFIN_HWTRACE_ON
167	default n
168	help
169	  By selecting this option, every time the 16 hardware entries in
170	  the Blackfin's HW Trace buffer are full, the kernel will move them
171	  into a software buffer, for dumping when there is an issue. This
172	  has a great impact on performance, (an interrupt every 16 change of
173	  flows) and should normally be turned off, except in those nasty
174	  debugging sessions
175
176config DEBUG_BFIN_HWTRACE_EXPAND_LEN
177	int "Size of Trace buffer (in power of 2k)"
178	range 0 4
179	depends on DEBUG_BFIN_HWTRACE_EXPAND
180	default 1
181	help
182	  This sets the size of the software buffer that the trace information
183	  is kept in.
184	  0 for (2^0)  1k, or 256 entries,
185	  1 for (2^1)  2k, or 512 entries,
186	  2 for (2^2)  4k, or 1024 entries,
187	  3 for (2^3)  8k, or 2048 entries,
188	  4 for (2^4) 16k, or 4096 entries
189
190config DEBUG_BFIN_NO_KERN_HWTRACE
191	bool "Turn off hwtrace in CPLB handlers"
192	depends on DEBUG_BFIN_HWTRACE_ON
193	default y
194	help
195	  The CPLB error handler contains a lot of flow changes which can
196	  quickly fill up the hardware trace buffer.  When debugging crashes,
197	  the hardware trace may indicate that the problem lies in kernel
198	  space when in reality an application is buggy.
199
200	  Say Y here to disable hardware tracing in some known "jumpy" pieces
201	  of code so that the trace buffer will extend further back.
202
203config EARLY_PRINTK
204	bool "Early printk"
205	default n
206	select SERIAL_CORE_CONSOLE
207	help
208	  This option enables special console drivers which allow the kernel
209	  to print messages very early in the bootup process.
210
211	  This is useful for kernel debugging when your machine crashes very
212	  early before the console code is initialized. After enabling this
213	  feature, you must add "earlyprintk=serial,uart0,57600" to the
214	  command line (bootargs). It is safe to say Y here in all cases, as
215	  all of this lives in the init section and is thrown away after the
216	  kernel boots completely.
217
218config NMI_WATCHDOG
219	bool "Enable NMI watchdog to help debugging lockup on SMP"
220	default n
221	depends on SMP
222	help
223	  If any CPU in the system does not execute the period local timer
224	  interrupt for more than 5 seconds, then the NMI handler dumps debug
225	  information. This information can be used to debug the lockup.
226
227config CPLB_INFO
228	bool "Display the CPLB information"
229	help
230	  Display the CPLB information via /proc/cplbinfo.
231
232config ACCESS_CHECK
233	bool "Check the user pointer address"
234	default y
235	help
236	  Usually the pointer transfer from user space is checked to see if its
237	  address is in the kernel space.
238
239	  Say N here to disable that check to improve the performance.
240
241config BFIN_ISRAM_SELF_TEST
242	bool "isram boot self tests"
243	default n
244	help
245	  Run some self tests of the isram driver code at boot.
246
247config BFIN_PSEUDODBG_INSNS
248	bool "Support pseudo debug instructions"
249	default n
250	help
251	  This option allows the kernel to emulate some pseudo instructions which
252	  allow simulator test cases to be run under Linux with no changes.
253
254	  Most people should say N here.
255
256endmenu
257