MIPS: OCTEON: watchdog: don't jump to bootloader without entry address
If CONFIG_HOTPLUG_CPU is set, the driver thinks bootloader entry address is configured and we should jump there. However, this is not necessarily true if the kernel is booted on a system with older/incompatible bootloader. Add dynamic checks for the bootloader entry address. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Cc: linux-watchdog@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: David Daney <ddaney.cavm@gmail.com> Cc: linux-watchdog@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/7201/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
committed by
Ralf Baechle
parent
0953609f29
commit
f64988f13e
@@ -145,13 +145,16 @@ static void __init octeon_wdt_build_stage1(void)
|
|||||||
|
|
||||||
uasm_i_mfc0(&p, K0, C0_STATUS);
|
uasm_i_mfc0(&p, K0, C0_STATUS);
|
||||||
#ifdef CONFIG_HOTPLUG_CPU
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
uasm_il_bbit0(&p, &r, K0, ilog2(ST0_NMI), label_enter_bootloader);
|
if (octeon_bootloader_entry_addr)
|
||||||
|
uasm_il_bbit0(&p, &r, K0, ilog2(ST0_NMI),
|
||||||
|
label_enter_bootloader);
|
||||||
#endif
|
#endif
|
||||||
/* Force 64-bit addressing enabled */
|
/* Force 64-bit addressing enabled */
|
||||||
uasm_i_ori(&p, K0, K0, ST0_UX | ST0_SX | ST0_KX);
|
uasm_i_ori(&p, K0, K0, ST0_UX | ST0_SX | ST0_KX);
|
||||||
uasm_i_mtc0(&p, K0, C0_STATUS);
|
uasm_i_mtc0(&p, K0, C0_STATUS);
|
||||||
|
|
||||||
#ifdef CONFIG_HOTPLUG_CPU
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
|
if (octeon_bootloader_entry_addr) {
|
||||||
uasm_i_mfc0(&p, K0, C0_EBASE);
|
uasm_i_mfc0(&p, K0, C0_EBASE);
|
||||||
/* Coreid number in K0 */
|
/* Coreid number in K0 */
|
||||||
uasm_i_andi(&p, K0, K0, 0xf);
|
uasm_i_andi(&p, K0, K0, 0xf);
|
||||||
@@ -174,6 +177,7 @@ static void __init octeon_wdt_build_stage1(void)
|
|||||||
*/
|
*/
|
||||||
uasm_il_bbit0(&p, &r, K0, 1, label_enter_bootloader);
|
uasm_il_bbit0(&p, &r, K0, 1, label_enter_bootloader);
|
||||||
uasm_i_nop(&p);
|
uasm_i_nop(&p);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Clear Dcache so cvmseg works right. */
|
/* Clear Dcache so cvmseg works right. */
|
||||||
@@ -194,11 +198,13 @@ static void __init octeon_wdt_build_stage1(void)
|
|||||||
uasm_i_dmfc0(&p, K0, C0_DESAVE);
|
uasm_i_dmfc0(&p, K0, C0_DESAVE);
|
||||||
|
|
||||||
#ifdef CONFIG_HOTPLUG_CPU
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
|
if (octeon_bootloader_entry_addr) {
|
||||||
uasm_build_label(&l, p, label_enter_bootloader);
|
uasm_build_label(&l, p, label_enter_bootloader);
|
||||||
/* Jump to the bootloader and restore K0 */
|
/* Jump to the bootloader and restore K0 */
|
||||||
UASM_i_LA(&p, K0, (long)octeon_bootloader_entry_addr);
|
UASM_i_LA(&p, K0, (long)octeon_bootloader_entry_addr);
|
||||||
uasm_i_jr(&p, K0);
|
uasm_i_jr(&p, K0);
|
||||||
uasm_i_dmfc0(&p, K0, C0_DESAVE);
|
uasm_i_dmfc0(&p, K0, C0_DESAVE);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
uasm_resolve_relocs(relocs, labels);
|
uasm_resolve_relocs(relocs, labels);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user