[AVR32] Enable debugging only when needed

Keep track of processes being debugged (including the kernel itself)
and turn the OCD system on and off as appropriate. Since enabling
debugging turns off some optimizations in the CPU core, this fixes the
issue that enabling KProbes support or simply running a program under
gdbserver will reduce system performance significantly until the next
reboot.

The CPU performance will still be reduced for all processes while a
process is being debugged, but this is a lot better than reducing the
performance forever.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
diff --git a/include/asm-avr32/ocd.h b/include/asm-avr32/ocd.h
index 996405e..6bef094 100644
--- a/include/asm-avr32/ocd.h
+++ b/include/asm-avr32/ocd.h
@@ -533,6 +533,11 @@
 #define ocd_read(reg)			__ocd_read(OCD_##reg)
 #define ocd_write(reg, value)		__ocd_write(OCD_##reg, value)
 
+struct task_struct;
+
+void ocd_enable(struct task_struct *child);
+void ocd_disable(struct task_struct *child);
+
 #endif /* !__ASSEMBLER__ */
 
 #endif /* __ASM_AVR32_OCD_H */