2014-06-26 03:41:28 +00:00
|
|
|
/*
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 Embedded Alley Solutions, Inc
|
|
|
|
* Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
|
|
|
|
* Copyright (C) 2009 Jiajie Chen (chenjiajie@cse.buaa.edu.cn)
|
|
|
|
* Copyright (C) 2012 Huacai Chen (chenhc@lemote.com)
|
|
|
|
*/
|
2015-04-21 02:00:35 +00:00
|
|
|
#ifndef __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H
|
|
|
|
#define __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H
|
2014-06-26 03:41:28 +00:00
|
|
|
|
2018-09-05 09:33:01 +00:00
|
|
|
#include <asm/cpu.h>
|
|
|
|
|
2014-06-26 03:41:28 +00:00
|
|
|
/*
|
|
|
|
* Override macros used in arch/mips/kernel/head.S.
|
|
|
|
*/
|
|
|
|
.macro kernel_entry_setup
|
|
|
|
#ifdef CONFIG_CPU_LOONGSON3
|
|
|
|
.set push
|
|
|
|
.set mips64
|
|
|
|
/* Set LPA on LOONGSON3 config3 */
|
2018-04-28 03:21:26 +00:00
|
|
|
mfc0 t0, CP0_CONFIG3
|
2014-06-26 03:41:28 +00:00
|
|
|
or t0, (0x1 << 7)
|
2018-04-28 03:21:26 +00:00
|
|
|
mtc0 t0, CP0_CONFIG3
|
2014-06-26 03:41:28 +00:00
|
|
|
/* Set ELPA on LOONGSON3 pagegrain */
|
2018-04-28 03:21:26 +00:00
|
|
|
mfc0 t0, CP0_PAGEGRAIN
|
2016-03-03 01:45:09 +00:00
|
|
|
or t0, (0x1 << 29)
|
2018-04-28 03:21:26 +00:00
|
|
|
mtc0 t0, CP0_PAGEGRAIN
|
MIPS: Loongson-3: Introduce CONFIG_LOONGSON3_ENHANCEMENT
New Loongson 3 CPU (since Loongson-3A R2, as opposed to Loongson-3A R1,
Loongson-3B R1 and Loongson-3B R2) has many enhancements, such as FTLB,
L1-VCache, EI/DI/Wait/Prefetch instruction, DSP/DSPv2 ASE, User Local
register, Read-Inhibit/Execute-Inhibit, SFB (Store Fill Buffer), Fast
TLB refill support, etc.
This patch introduce a config option, CONFIG_LOONGSON3_ENHANCEMENT, to
enable those enhancements which are not probed at run time. If you want
a generic kernel to run on all Loongson 3 machines, please say 'N'
here. If you want a high-performance kernel to run on new Loongson 3
machines only, please say 'Y' here.
Some additional explanations:
1) SFB locates between core and L1 cache, it causes memory access out
of order, so writel/outl (and other similar functions) need a I/O
reorder barrier.
2) Loongson 3 has a bug that di instruction can not save the irqflag,
so arch_local_irq_save() is modified. Since CPU_MIPSR2 is selected
by CONFIG_LOONGSON3_ENHANCEMENT, generic kernel doesn't use ei/di
at all.
3) CPU_HAS_PREFETCH is selected by CONFIG_LOONGSON3_ENHANCEMENT, so
MIPS_CPU_PREFETCH (used by uasm) probing is also put in this patch.
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Steven J . Hill <sjhill@realitydiluted.com>
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12755/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2016-03-03 01:45:13 +00:00
|
|
|
/* Enable STFill Buffer */
|
2018-09-05 09:33:01 +00:00
|
|
|
mfc0 t0, CP0_PRID
|
|
|
|
andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
|
2018-11-15 07:53:52 +00:00
|
|
|
slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2_0)
|
2018-09-05 09:33:01 +00:00
|
|
|
bnez t0, 1f
|
2018-04-28 03:21:26 +00:00
|
|
|
mfc0 t0, CP0_CONFIG6
|
MIPS: Loongson-3: Introduce CONFIG_LOONGSON3_ENHANCEMENT
New Loongson 3 CPU (since Loongson-3A R2, as opposed to Loongson-3A R1,
Loongson-3B R1 and Loongson-3B R2) has many enhancements, such as FTLB,
L1-VCache, EI/DI/Wait/Prefetch instruction, DSP/DSPv2 ASE, User Local
register, Read-Inhibit/Execute-Inhibit, SFB (Store Fill Buffer), Fast
TLB refill support, etc.
This patch introduce a config option, CONFIG_LOONGSON3_ENHANCEMENT, to
enable those enhancements which are not probed at run time. If you want
a generic kernel to run on all Loongson 3 machines, please say 'N'
here. If you want a high-performance kernel to run on new Loongson 3
machines only, please say 'Y' here.
Some additional explanations:
1) SFB locates between core and L1 cache, it causes memory access out
of order, so writel/outl (and other similar functions) need a I/O
reorder barrier.
2) Loongson 3 has a bug that di instruction can not save the irqflag,
so arch_local_irq_save() is modified. Since CPU_MIPSR2 is selected
by CONFIG_LOONGSON3_ENHANCEMENT, generic kernel doesn't use ei/di
at all.
3) CPU_HAS_PREFETCH is selected by CONFIG_LOONGSON3_ENHANCEMENT, so
MIPS_CPU_PREFETCH (used by uasm) probing is also put in this patch.
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Steven J . Hill <sjhill@realitydiluted.com>
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12755/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2016-03-03 01:45:13 +00:00
|
|
|
or t0, 0x100
|
2018-04-28 03:21:26 +00:00
|
|
|
mtc0 t0, CP0_CONFIG6
|
2018-09-05 09:33:01 +00:00
|
|
|
1:
|
2014-06-26 03:41:28 +00:00
|
|
|
_ehb
|
|
|
|
.set pop
|
|
|
|
#endif
|
|
|
|
.endm
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do SMP slave processor setup.
|
|
|
|
*/
|
|
|
|
.macro smp_slave_setup
|
|
|
|
#ifdef CONFIG_CPU_LOONGSON3
|
|
|
|
.set push
|
|
|
|
.set mips64
|
|
|
|
/* Set LPA on LOONGSON3 config3 */
|
2018-04-28 03:21:26 +00:00
|
|
|
mfc0 t0, CP0_CONFIG3
|
2014-06-26 03:41:28 +00:00
|
|
|
or t0, (0x1 << 7)
|
2018-04-28 03:21:26 +00:00
|
|
|
mtc0 t0, CP0_CONFIG3
|
2014-06-26 03:41:28 +00:00
|
|
|
/* Set ELPA on LOONGSON3 pagegrain */
|
2018-04-28 03:21:26 +00:00
|
|
|
mfc0 t0, CP0_PAGEGRAIN
|
2016-03-03 01:45:09 +00:00
|
|
|
or t0, (0x1 << 29)
|
2018-04-28 03:21:26 +00:00
|
|
|
mtc0 t0, CP0_PAGEGRAIN
|
MIPS: Loongson-3: Introduce CONFIG_LOONGSON3_ENHANCEMENT
New Loongson 3 CPU (since Loongson-3A R2, as opposed to Loongson-3A R1,
Loongson-3B R1 and Loongson-3B R2) has many enhancements, such as FTLB,
L1-VCache, EI/DI/Wait/Prefetch instruction, DSP/DSPv2 ASE, User Local
register, Read-Inhibit/Execute-Inhibit, SFB (Store Fill Buffer), Fast
TLB refill support, etc.
This patch introduce a config option, CONFIG_LOONGSON3_ENHANCEMENT, to
enable those enhancements which are not probed at run time. If you want
a generic kernel to run on all Loongson 3 machines, please say 'N'
here. If you want a high-performance kernel to run on new Loongson 3
machines only, please say 'Y' here.
Some additional explanations:
1) SFB locates between core and L1 cache, it causes memory access out
of order, so writel/outl (and other similar functions) need a I/O
reorder barrier.
2) Loongson 3 has a bug that di instruction can not save the irqflag,
so arch_local_irq_save() is modified. Since CPU_MIPSR2 is selected
by CONFIG_LOONGSON3_ENHANCEMENT, generic kernel doesn't use ei/di
at all.
3) CPU_HAS_PREFETCH is selected by CONFIG_LOONGSON3_ENHANCEMENT, so
MIPS_CPU_PREFETCH (used by uasm) probing is also put in this patch.
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Steven J . Hill <sjhill@realitydiluted.com>
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12755/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2016-03-03 01:45:13 +00:00
|
|
|
/* Enable STFill Buffer */
|
2018-09-05 09:33:01 +00:00
|
|
|
mfc0 t0, CP0_PRID
|
|
|
|
andi t0, (PRID_IMP_MASK | PRID_REV_MASK)
|
2018-11-15 07:53:52 +00:00
|
|
|
slti t0, (PRID_IMP_LOONGSON_64 | PRID_REV_LOONGSON3A_R2_0)
|
2018-09-05 09:33:01 +00:00
|
|
|
bnez t0, 1f
|
2018-04-28 03:21:26 +00:00
|
|
|
mfc0 t0, CP0_CONFIG6
|
MIPS: Loongson-3: Introduce CONFIG_LOONGSON3_ENHANCEMENT
New Loongson 3 CPU (since Loongson-3A R2, as opposed to Loongson-3A R1,
Loongson-3B R1 and Loongson-3B R2) has many enhancements, such as FTLB,
L1-VCache, EI/DI/Wait/Prefetch instruction, DSP/DSPv2 ASE, User Local
register, Read-Inhibit/Execute-Inhibit, SFB (Store Fill Buffer), Fast
TLB refill support, etc.
This patch introduce a config option, CONFIG_LOONGSON3_ENHANCEMENT, to
enable those enhancements which are not probed at run time. If you want
a generic kernel to run on all Loongson 3 machines, please say 'N'
here. If you want a high-performance kernel to run on new Loongson 3
machines only, please say 'Y' here.
Some additional explanations:
1) SFB locates between core and L1 cache, it causes memory access out
of order, so writel/outl (and other similar functions) need a I/O
reorder barrier.
2) Loongson 3 has a bug that di instruction can not save the irqflag,
so arch_local_irq_save() is modified. Since CPU_MIPSR2 is selected
by CONFIG_LOONGSON3_ENHANCEMENT, generic kernel doesn't use ei/di
at all.
3) CPU_HAS_PREFETCH is selected by CONFIG_LOONGSON3_ENHANCEMENT, so
MIPS_CPU_PREFETCH (used by uasm) probing is also put in this patch.
Signed-off-by: Huacai Chen <chenhc@lemote.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Steven J . Hill <sjhill@realitydiluted.com>
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12755/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2016-03-03 01:45:13 +00:00
|
|
|
or t0, 0x100
|
2018-04-28 03:21:26 +00:00
|
|
|
mtc0 t0, CP0_CONFIG6
|
2018-09-05 09:33:01 +00:00
|
|
|
1:
|
2014-06-26 03:41:28 +00:00
|
|
|
_ehb
|
|
|
|
.set pop
|
|
|
|
#endif
|
|
|
|
.endm
|
|
|
|
|
2015-04-21 02:00:35 +00:00
|
|
|
#endif /* __ASM_MACH_LOONGSON64_KERNEL_ENTRY_H */
|