Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: Kill off legacy UBC wakeup cruft.

This code was added for some ancient SH-4 solution engines with peculiar
boot ROMs that did silly things to the UBC MSTP bits. None of these have
been in the wild for years, and these days the clock framework wraps up
the MSTP bits, meaning that the UBC code is one of the few interfaces
that is stomping MSTP bits underneath the clock framework. At this point
the risks far outweigh any benefit this code provided, so just kill it
off.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

-93
-11
arch/sh/Kconfig
··· 757 757 default "0x00010000" if PAGE_SIZE_64KB 758 758 default "0x00000000" 759 759 760 - config UBC_WAKEUP 761 - bool "Wakeup UBC on startup" 762 - depends on CPU_SH4 && !CPU_SH4A 763 - help 764 - Selecting this option will wakeup the User Break Controller (UBC) on 765 - startup. Although the UBC is left in an awake state when the processor 766 - comes up, some boot loaders misbehave by putting the UBC to sleep in a 767 - power saving state, which causes issues with things like ptrace(). 768 - 769 - If unsure, say N. 770 - 771 760 choice 772 761 prompt "Kernel command line" 773 762 optional
-11
arch/sh/include/asm/ubc.h
··· 60 60 #define BRCR_UBDE (1 << 0) 61 61 #endif 62 62 63 - #ifndef __ASSEMBLY__ 64 - /* arch/sh/kernel/cpu/ubc.S */ 65 - extern void ubc_sleep(void); 66 - 67 - #ifdef CONFIG_UBC_WAKEUP 68 - extern void ubc_wakeup(void); 69 - #else 70 - #define ubc_wakeup() do { } while (0) 71 - #endif 72 - #endif 73 - 74 63 #endif /* __KERNEL__ */ 75 64 #endif /* __ASM_SH_UBC_H */
-1
arch/sh/kernel/cpu/Makefile
··· 15 15 16 16 # Common interfaces. 17 17 18 - obj-$(CONFIG_UBC_WAKEUP) += ubc.o 19 18 obj-$(CONFIG_SH_ADC) += adc.o 20 19 obj-$(CONFIG_SH_CLK_CPG) += clock-cpg.o 21 20
-11
arch/sh/kernel/cpu/init.c
··· 338 338 } 339 339 #endif 340 340 341 - /* 342 - * Some brain-damaged loaders decided it would be a good idea to put 343 - * the UBC to sleep. This causes some issues when it comes to things 344 - * like PTRACE_SINGLESTEP or doing hardware watchpoints in GDB. So .. 345 - * we wake it up and hope that all is well. 346 - */ 347 - #ifdef CONFIG_SUPERH32 348 - if (raw_smp_processor_id() == 0) 349 - ubc_wakeup(); 350 - #endif 351 - 352 341 speculative_execution_init(); 353 342 expmask_init(); 354 343 }
-59
arch/sh/kernel/cpu/ubc.S
··· 1 - /* 2 - * arch/sh/kernel/cpu/ubc.S 3 - * 4 - * Set of management routines for the User Break Controller (UBC) 5 - * 6 - * Copyright (C) 2002 Paul Mundt 7 - * 8 - * This program is free software; you can redistribute it and/or modify it 9 - * under the terms of the GNU General Public License as published by the 10 - * Free Software Foundation; either version 2 of the License, or (at your 11 - * option) any later version. 12 - */ 13 - #include <linux/linkage.h> 14 - #include <asm/ubc.h> 15 - 16 - #define STBCR2 0xffc00010 17 - 18 - ENTRY(ubc_sleep) 19 - mov #0, r0 20 - 21 - mov.l 1f, r1 ! Zero out UBC_BBRA .. 22 - mov.w r0, @r1 23 - 24 - mov.l 2f, r1 ! .. same for BBRB .. 25 - mov.w r0, @r1 26 - 27 - mov.l 3f, r1 ! .. and again for BRCR. 28 - mov.w r0, @r1 29 - 30 - mov.w @r1, r0 ! Dummy read BRCR 31 - 32 - mov.l 4f, r1 ! Set MSTP5 in STBCR2 33 - mov.b @r1, r0 34 - or #0x01, r0 35 - mov.b r0, @r1 36 - 37 - mov.b @r1, r0 ! Two dummy reads .. 38 - mov.b @r1, r0 39 - 40 - rts 41 - nop 42 - 43 - ENTRY(ubc_wakeup) 44 - mov.l 4f, r1 ! Clear MSTP5 45 - mov.b @r1, r0 46 - and #0xfe, r0 47 - mov.b r0, @r1 48 - 49 - mov.b @r1, r0 ! Two more dummy reads .. 50 - mov.b @r1, r0 51 - 52 - rts 53 - nop 54 - 55 - 1: .long UBC_BBRA 56 - 2: .long UBC_BBRB 57 - 3: .long UBC_BRCR 58 - 4: .long STBCR2 59 -