MIPS: Move headfiles to new location below arch/mips/include
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
e8c7c48234
commit
384740dc49
463 changed files with 82 additions and 82 deletions
|
|
@ -170,97 +170,97 @@ libs-$(CONFIG_SIBYTE_CFE) += arch/mips/sibyte/cfe/
|
|||
# Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
|
||||
#
|
||||
core-$(CONFIG_MACH_JAZZ) += arch/mips/jazz/
|
||||
cflags-$(CONFIG_MACH_JAZZ) += -Iinclude/asm-mips/mach-jazz
|
||||
cflags-$(CONFIG_MACH_JAZZ) += -I$(srctree)/arch/mips/include/asm/mach-jazz
|
||||
load-$(CONFIG_MACH_JAZZ) += 0xffffffff80080000
|
||||
|
||||
#
|
||||
# Common Alchemy Au1x00 stuff
|
||||
#
|
||||
core-$(CONFIG_SOC_AU1X00) += arch/mips/alchemy/common/
|
||||
cflags-$(CONFIG_SOC_AU1X00) += -Iinclude/asm-mips/mach-au1x00
|
||||
cflags-$(CONFIG_SOC_AU1X00) += -I$(srctree)/arch/mips/include/asm/mach-au1x00
|
||||
|
||||
#
|
||||
# AMD Alchemy Pb1000 eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_PB1000) += arch/mips/alchemy/pb1000/
|
||||
cflags-$(CONFIG_MIPS_PB1000) += -Iinclude/asm-mips/mach-pb1x00
|
||||
cflags-$(CONFIG_MIPS_PB1000) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
|
||||
load-$(CONFIG_MIPS_PB1000) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Pb1100 eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_PB1100) += arch/mips/alchemy/pb1100/
|
||||
cflags-$(CONFIG_MIPS_PB1100) += -Iinclude/asm-mips/mach-pb1x00
|
||||
cflags-$(CONFIG_MIPS_PB1100) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
|
||||
load-$(CONFIG_MIPS_PB1100) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Pb1500 eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_PB1500) += arch/mips/alchemy/pb1500/
|
||||
cflags-$(CONFIG_MIPS_PB1500) += -Iinclude/asm-mips/mach-pb1x00
|
||||
cflags-$(CONFIG_MIPS_PB1500) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
|
||||
load-$(CONFIG_MIPS_PB1500) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Pb1550 eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_PB1550) += arch/mips/alchemy/pb1550/
|
||||
cflags-$(CONFIG_MIPS_PB1550) += -Iinclude/asm-mips/mach-pb1x00
|
||||
cflags-$(CONFIG_MIPS_PB1550) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
|
||||
load-$(CONFIG_MIPS_PB1550) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Pb1200 eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_PB1200) += arch/mips/alchemy/pb1200/
|
||||
cflags-$(CONFIG_MIPS_PB1200) += -Iinclude/asm-mips/mach-pb1x00
|
||||
cflags-$(CONFIG_MIPS_PB1200) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
|
||||
load-$(CONFIG_MIPS_PB1200) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Db1000 eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_DB1000) += arch/mips/alchemy/db1x00/
|
||||
cflags-$(CONFIG_MIPS_DB1000) += -Iinclude/asm-mips/mach-db1x00
|
||||
cflags-$(CONFIG_MIPS_DB1000) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
|
||||
load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Db1100 eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_DB1100) += arch/mips/alchemy/db1x00/
|
||||
cflags-$(CONFIG_MIPS_DB1100) += -Iinclude/asm-mips/mach-db1x00
|
||||
cflags-$(CONFIG_MIPS_DB1100) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
|
||||
load-$(CONFIG_MIPS_DB1100) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Db1500 eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_DB1500) += arch/mips/alchemy/db1x00/
|
||||
cflags-$(CONFIG_MIPS_DB1500) += -Iinclude/asm-mips/mach-db1x00
|
||||
cflags-$(CONFIG_MIPS_DB1500) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
|
||||
load-$(CONFIG_MIPS_DB1500) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Db1550 eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_DB1550) += arch/mips/alchemy/db1x00/
|
||||
cflags-$(CONFIG_MIPS_DB1550) += -Iinclude/asm-mips/mach-db1x00
|
||||
cflags-$(CONFIG_MIPS_DB1550) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
|
||||
load-$(CONFIG_MIPS_DB1550) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Db1200 eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_DB1200) += arch/mips/alchemy/pb1200/
|
||||
cflags-$(CONFIG_MIPS_DB1200) += -Iinclude/asm-mips/mach-db1x00
|
||||
cflags-$(CONFIG_MIPS_DB1200) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
|
||||
load-$(CONFIG_MIPS_DB1200) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Bosporus eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_BOSPORUS) += arch/mips/alchemy/db1x00/
|
||||
cflags-$(CONFIG_MIPS_BOSPORUS) += -Iinclude/asm-mips/mach-db1x00
|
||||
cflags-$(CONFIG_MIPS_BOSPORUS) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
|
||||
load-$(CONFIG_MIPS_BOSPORUS) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# AMD Alchemy Mirage eval board
|
||||
#
|
||||
libs-$(CONFIG_MIPS_MIRAGE) += arch/mips/alchemy/db1x00/
|
||||
cflags-$(CONFIG_MIPS_MIRAGE) += -Iinclude/asm-mips/mach-db1x00
|
||||
cflags-$(CONFIG_MIPS_MIRAGE) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
|
||||
load-$(CONFIG_MIPS_MIRAGE) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
|
|
@ -279,14 +279,14 @@ load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000
|
|||
# Cobalt Server
|
||||
#
|
||||
core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/
|
||||
cflags-$(CONFIG_MIPS_COBALT) += -Iinclude/asm-mips/mach-cobalt
|
||||
cflags-$(CONFIG_MIPS_COBALT) += -I$(srctree)/arch/mips/include/asm/mach-cobalt
|
||||
load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000
|
||||
|
||||
#
|
||||
# DECstation family
|
||||
#
|
||||
core-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/
|
||||
cflags-$(CONFIG_MACH_DECSTATION)+= -Iinclude/asm-mips/mach-dec
|
||||
cflags-$(CONFIG_MACH_DECSTATION)+= -I$(srctree)/arch/mips/include/asm/mach-dec
|
||||
libs-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/prom/
|
||||
load-$(CONFIG_MACH_DECSTATION) += 0xffffffff80040000
|
||||
|
||||
|
|
@ -294,7 +294,7 @@ load-$(CONFIG_MACH_DECSTATION) += 0xffffffff80040000
|
|||
# Wind River PPMC Board (4KC + GT64120)
|
||||
#
|
||||
core-$(CONFIG_WR_PPMC) += arch/mips/gt64120/wrppmc/
|
||||
cflags-$(CONFIG_WR_PPMC) += -Iinclude/asm-mips/mach-wrppmc
|
||||
cflags-$(CONFIG_WR_PPMC) += -I$(srctree)/arch/mips/include/asm/mach-wrppmc
|
||||
load-$(CONFIG_WR_PPMC) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
|
|
@ -302,13 +302,13 @@ load-$(CONFIG_WR_PPMC) += 0xffffffff80100000
|
|||
#
|
||||
core-$(CONFIG_LEMOTE_FULONG) +=arch/mips/lemote/lm2e/
|
||||
load-$(CONFIG_LEMOTE_FULONG) +=0xffffffff80100000
|
||||
cflags-$(CONFIG_LEMOTE_FULONG) += -Iinclude/asm-mips/mach-lemote
|
||||
cflags-$(CONFIG_LEMOTE_FULONG) += -I$(srctree)/arch/mips/include/asm/mach-lemote
|
||||
|
||||
#
|
||||
# MIPS Malta board
|
||||
#
|
||||
core-$(CONFIG_MIPS_MALTA) += arch/mips/mti-malta/
|
||||
cflags-$(CONFIG_MIPS_MALTA) += -Iinclude/asm-mips/mach-malta
|
||||
cflags-$(CONFIG_MIPS_MALTA) += -I$(srctree)/arch/mips/include/asm/mach-malta
|
||||
load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000
|
||||
all-$(CONFIG_MIPS_MALTA) := vmlinux.bin
|
||||
|
||||
|
|
@ -316,14 +316,14 @@ all-$(CONFIG_MIPS_MALTA) := vmlinux.bin
|
|||
# MIPS SIM
|
||||
#
|
||||
core-$(CONFIG_MIPS_SIM) += arch/mips/mipssim/
|
||||
cflags-$(CONFIG_MIPS_SIM) += -Iinclude/asm-mips/mach-mipssim
|
||||
cflags-$(CONFIG_MIPS_SIM) += -I$(srctree)/arch/mips/include/asm/mach-mipssim
|
||||
load-$(CONFIG_MIPS_SIM) += 0x80100000
|
||||
|
||||
#
|
||||
# PMC-Sierra MSP SOCs
|
||||
#
|
||||
core-$(CONFIG_PMC_MSP) += arch/mips/pmc-sierra/msp71xx/
|
||||
cflags-$(CONFIG_PMC_MSP) += -Iinclude/asm-mips/pmc-sierra/msp71xx \
|
||||
cflags-$(CONFIG_PMC_MSP) += -I$(srctree)/arch/mips/include/asm/pmc-sierra/msp71xx \
|
||||
-mno-branch-likely
|
||||
load-$(CONFIG_PMC_MSP) += 0xffffffff80100000
|
||||
|
||||
|
|
@ -331,28 +331,28 @@ load-$(CONFIG_PMC_MSP) += 0xffffffff80100000
|
|||
# PMC-Sierra Yosemite
|
||||
#
|
||||
core-$(CONFIG_PMC_YOSEMITE) += arch/mips/pmc-sierra/yosemite/
|
||||
cflags-$(CONFIG_PMC_YOSEMITE) += -Iinclude/asm-mips/mach-yosemite
|
||||
cflags-$(CONFIG_PMC_YOSEMITE) += -I$(srctree)/arch/mips/include/asm/mach-yosemite
|
||||
load-$(CONFIG_PMC_YOSEMITE) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
# Basler eXcite
|
||||
#
|
||||
core-$(CONFIG_BASLER_EXCITE) += arch/mips/basler/excite/
|
||||
cflags-$(CONFIG_BASLER_EXCITE) += -Iinclude/asm-mips/mach-excite
|
||||
cflags-$(CONFIG_BASLER_EXCITE) += -I$(srctree)/arch/mips/include/asm/mach-excite
|
||||
load-$(CONFIG_BASLER_EXCITE) += 0x80100000
|
||||
|
||||
#
|
||||
# LASAT platforms
|
||||
#
|
||||
core-$(CONFIG_LASAT) += arch/mips/lasat/
|
||||
cflags-$(CONFIG_LASAT) += -Iinclude/asm-mips/mach-lasat
|
||||
cflags-$(CONFIG_LASAT) += -I$(srctree)/arch/mips/include/asm/mach-lasat
|
||||
load-$(CONFIG_LASAT) += 0xffffffff80000000
|
||||
|
||||
#
|
||||
# Common VR41xx
|
||||
#
|
||||
core-$(CONFIG_MACH_VR41XX) += arch/mips/vr41xx/common/
|
||||
cflags-$(CONFIG_MACH_VR41XX) += -Iinclude/asm-mips/mach-vr41xx
|
||||
cflags-$(CONFIG_MACH_VR41XX) += -I$(srctree)/arch/mips/include/asm/mach-vr41xx
|
||||
|
||||
#
|
||||
# ZAO Networks Capcella (VR4131)
|
||||
|
|
@ -385,13 +385,13 @@ load-$(CONFIG_TANBAC_TB022X) += 0xffffffff80000000
|
|||
# Common NXP PNX8550
|
||||
#
|
||||
core-$(CONFIG_SOC_PNX8550) += arch/mips/nxp/pnx8550/common/
|
||||
cflags-$(CONFIG_SOC_PNX8550) += -Iinclude/asm-mips/mach-pnx8550
|
||||
cflags-$(CONFIG_SOC_PNX8550) += -I$(srctree)/arch/mips/include/asm/mach-pnx8550
|
||||
|
||||
#
|
||||
# NXP PNX8550 JBS board
|
||||
#
|
||||
libs-$(CONFIG_PNX8550_JBS) += arch/mips/nxp/pnx8550/jbs/
|
||||
#cflags-$(CONFIG_PNX8550_JBS) += -Iinclude/asm-mips/mach-pnx8550
|
||||
#cflags-$(CONFIG_PNX8550_JBS) += -I$(srctree)/arch/mips/include/asm/mach-pnx8550
|
||||
load-$(CONFIG_PNX8550_JBS) += 0xffffffff80060000
|
||||
|
||||
# NXP PNX8550 STB810 board
|
||||
|
|
@ -402,7 +402,7 @@ load-$(CONFIG_PNX8550_STB810) += 0xffffffff80060000
|
|||
# NEC EMMA2RH boards
|
||||
#
|
||||
core-$(CONFIG_EMMA2RH) += arch/mips/emma2rh/common/
|
||||
cflags-$(CONFIG_EMMA2RH) += -Iinclude/asm-mips/mach-emma2rh
|
||||
cflags-$(CONFIG_EMMA2RH) += -I$(srctree)/arch/mips/include/asm/mach-emma2rh
|
||||
|
||||
# NEC EMMA2RH Mark-eins
|
||||
core-$(CONFIG_MARKEINS) += arch/mips/emma2rh/markeins/
|
||||
|
|
@ -418,7 +418,7 @@ load-$(CONFIG_MARKEINS) += 0xffffffff88100000
|
|||
# address by 8kb.
|
||||
#
|
||||
core-$(CONFIG_SGI_IP22) += arch/mips/sgi-ip22/
|
||||
cflags-$(CONFIG_SGI_IP22) += -Iinclude/asm-mips/mach-ip22
|
||||
cflags-$(CONFIG_SGI_IP22) += -I$(srctree)/arch/mips/include/asm/mach-ip22
|
||||
ifdef CONFIG_32BIT
|
||||
load-$(CONFIG_SGI_IP22) += 0xffffffff88002000
|
||||
endif
|
||||
|
|
@ -435,7 +435,7 @@ endif
|
|||
#
|
||||
ifdef CONFIG_SGI_IP27
|
||||
core-$(CONFIG_SGI_IP27) += arch/mips/sgi-ip27/
|
||||
cflags-$(CONFIG_SGI_IP27) += -Iinclude/asm-mips/mach-ip27
|
||||
cflags-$(CONFIG_SGI_IP27) += -I$(srctree)/arch/mips/include/asm/mach-ip27
|
||||
ifdef CONFIG_MAPPED_KERNEL
|
||||
load-$(CONFIG_SGI_IP27) += 0xc00000004001c000
|
||||
OBJCOPYFLAGS := --change-addresses=0x3fffffff80000000
|
||||
|
|
@ -460,7 +460,7 @@ ifdef CONFIG_SGI_IP28
|
|||
endif
|
||||
endif
|
||||
core-$(CONFIG_SGI_IP28) += arch/mips/sgi-ip22/
|
||||
cflags-$(CONFIG_SGI_IP28) += -mr10k-cache-barrier=1 -Iinclude/asm-mips/mach-ip28
|
||||
cflags-$(CONFIG_SGI_IP28) += -mr10k-cache-barrier=1 -I$(srctree)/arch/mips/include/asm/mach-ip28
|
||||
load-$(CONFIG_SGI_IP28) += 0xa800000020004000
|
||||
|
||||
#
|
||||
|
|
@ -472,7 +472,7 @@ load-$(CONFIG_SGI_IP28) += 0xa800000020004000
|
|||
# will break.
|
||||
#
|
||||
core-$(CONFIG_SGI_IP32) += arch/mips/sgi-ip32/
|
||||
cflags-$(CONFIG_SGI_IP32) += -Iinclude/asm-mips/mach-ip32
|
||||
cflags-$(CONFIG_SGI_IP32) += -I$(srctree)/arch/mips/include/asm/mach-ip32
|
||||
load-$(CONFIG_SGI_IP32) += 0xffffffff80004000
|
||||
|
||||
#
|
||||
|
|
@ -484,22 +484,22 @@ load-$(CONFIG_SGI_IP32) += 0xffffffff80004000
|
|||
#
|
||||
core-$(CONFIG_SIBYTE_BCM112X) += arch/mips/sibyte/sb1250/
|
||||
core-$(CONFIG_SIBYTE_BCM112X) += arch/mips/sibyte/common/
|
||||
cflags-$(CONFIG_SIBYTE_BCM112X) += -Iinclude/asm-mips/mach-sibyte \
|
||||
cflags-$(CONFIG_SIBYTE_BCM112X) += -I$(srctree)/arch/mips/include/asm/mach-sibyte \
|
||||
-DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
|
||||
|
||||
core-$(CONFIG_SIBYTE_SB1250) += arch/mips/sibyte/sb1250/
|
||||
core-$(CONFIG_SIBYTE_SB1250) += arch/mips/sibyte/common/
|
||||
cflags-$(CONFIG_SIBYTE_SB1250) += -Iinclude/asm-mips/mach-sibyte \
|
||||
cflags-$(CONFIG_SIBYTE_SB1250) += -I$(srctree)/arch/mips/include/asm/mach-sibyte \
|
||||
-DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
|
||||
|
||||
core-$(CONFIG_SIBYTE_BCM1x55) += arch/mips/sibyte/bcm1480/
|
||||
core-$(CONFIG_SIBYTE_BCM1x55) += arch/mips/sibyte/common/
|
||||
cflags-$(CONFIG_SIBYTE_BCM1x55) += -Iinclude/asm-mips/mach-sibyte \
|
||||
cflags-$(CONFIG_SIBYTE_BCM1x55) += -I$(srctree)/arch/mips/include/asm/mach-sibyte \
|
||||
-DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1480_ALL
|
||||
|
||||
core-$(CONFIG_SIBYTE_BCM1x80) += arch/mips/sibyte/bcm1480/
|
||||
core-$(CONFIG_SIBYTE_BCM1x80) += arch/mips/sibyte/common/
|
||||
cflags-$(CONFIG_SIBYTE_BCM1x80) += -Iinclude/asm-mips/mach-sibyte \
|
||||
cflags-$(CONFIG_SIBYTE_BCM1x80) += -I$(srctree)/arch/mips/include/asm/mach-sibyte \
|
||||
-DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1480_ALL
|
||||
|
||||
#
|
||||
|
|
@ -529,14 +529,14 @@ load-$(CONFIG_SIBYTE_BIGSUR) := 0xffffffff80100000
|
|||
# Broadcom BCM47XX boards
|
||||
#
|
||||
core-$(CONFIG_BCM47XX) += arch/mips/bcm47xx/
|
||||
cflags-$(CONFIG_BCM47XX) += -Iinclude/asm-mips/mach-bcm47xx
|
||||
cflags-$(CONFIG_BCM47XX) += -I$(srctree)/arch/mips/include/asm/mach-bcm47xx
|
||||
load-$(CONFIG_BCM47XX) := 0xffffffff80001000
|
||||
|
||||
#
|
||||
# SNI RM
|
||||
#
|
||||
core-$(CONFIG_SNI_RM) += arch/mips/sni/
|
||||
cflags-$(CONFIG_SNI_RM) += -Iinclude/asm-mips/mach-rm
|
||||
cflags-$(CONFIG_SNI_RM) += -I$(srctree)/arch/mips/include/asm/mach-rm
|
||||
ifdef CONFIG_CPU_LITTLE_ENDIAN
|
||||
load-$(CONFIG_SNI_RM) += 0xffffffff80600000
|
||||
else
|
||||
|
|
@ -548,10 +548,10 @@ all-$(CONFIG_SNI_RM) := vmlinux.ecoff
|
|||
# Common TXx9
|
||||
#
|
||||
core-$(CONFIG_MACH_TX39XX) += arch/mips/txx9/generic/
|
||||
cflags-$(CONFIG_MACH_TX39XX) += -Iinclude/asm-mips/mach-tx39xx
|
||||
cflags-$(CONFIG_MACH_TX39XX) += -I$(srctree)/arch/mips/include/asm/mach-tx39xx
|
||||
load-$(CONFIG_MACH_TX39XX) += 0xffffffff80050000
|
||||
core-$(CONFIG_MACH_TX49XX) += arch/mips/txx9/generic/
|
||||
cflags-$(CONFIG_MACH_TX49XX) += -Iinclude/asm-mips/mach-tx49xx
|
||||
cflags-$(CONFIG_MACH_TX49XX) += -I$(srctree)/arch/mips/include/asm/mach-tx49xx
|
||||
load-$(CONFIG_MACH_TX49XX) += 0xffffffff80100000
|
||||
|
||||
#
|
||||
|
|
@ -563,7 +563,7 @@ core-$(CONFIG_TOSHIBA_JMR3927) += arch/mips/txx9/jmr3927/
|
|||
# Routerboard 532 board
|
||||
#
|
||||
core-$(CONFIG_MIKROTIK_RB532) += arch/mips/rb532/
|
||||
cflags-$(CONFIG_MIKROTIK_RB532) += -Iinclude/asm-mips/mach-rc32434
|
||||
cflags-$(CONFIG_MIKROTIK_RB532) += -I$(srctree)/arch/mips/include/asm/mach-rc32434
|
||||
load-$(CONFIG_MIKROTIK_RB532) += 0xffffffff80101000
|
||||
|
||||
#
|
||||
|
|
@ -573,7 +573,7 @@ core-$(CONFIG_TOSHIBA_RBTX4927) += arch/mips/txx9/rbtx4927/
|
|||
core-$(CONFIG_TOSHIBA_RBTX4938) += arch/mips/txx9/rbtx4938/
|
||||
core-$(CONFIG_TOSHIBA_RBTX4939) += arch/mips/txx9/rbtx4939/
|
||||
|
||||
cflags-y += -Iinclude/asm-mips/mach-generic
|
||||
cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
|
||||
drivers-$(CONFIG_PCI) += arch/mips/pci/
|
||||
|
||||
ifdef CONFIG_32BIT
|
||||
|
|
|
|||
3
arch/mips/include/asm/Kbuild
Normal file
3
arch/mips/include/asm/Kbuild
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
include include/asm-generic/Kbuild.asm
|
||||
|
||||
header-y += cachectl.h sgidefs.h sysmips.h
|
||||
35
arch/mips/include/asm/a.out.h
Normal file
35
arch/mips/include/asm/a.out.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* 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) 1994 - 1999, 2003 by Ralf Baechle
|
||||
*/
|
||||
#ifndef _ASM_A_OUT_H
|
||||
#define _ASM_A_OUT_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
struct exec
|
||||
{
|
||||
unsigned long a_info; /* Use macros N_MAGIC, etc for access */
|
||||
unsigned a_text; /* length of text, in bytes */
|
||||
unsigned a_data; /* length of data, in bytes */
|
||||
unsigned a_bss; /* length of uninitialized data area for
|
||||
file, in bytes */
|
||||
unsigned a_syms; /* length of symbol table data in file,
|
||||
in bytes */
|
||||
unsigned a_entry; /* start address */
|
||||
unsigned a_trsize; /* length of relocation info for text, in
|
||||
bytes */
|
||||
unsigned a_drsize; /* length of relocation info for data, in bytes */
|
||||
};
|
||||
|
||||
#define N_TRSIZE(a) ((a).a_trsize)
|
||||
#define N_DRSIZE(a) ((a).a_drsize)
|
||||
#define N_SYMSIZE(a) ((a).a_syms)
|
||||
|
||||
#endif /* _ASM_A_OUT_H */
|
||||
25
arch/mips/include/asm/abi.h
Normal file
25
arch/mips/include/asm/abi.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* 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, 06 by Ralf Baechle (ralf@linux-mips.org)
|
||||
* Copyright (C) 2005 MIPS Technologies, Inc.
|
||||
*/
|
||||
#ifndef _ASM_ABI_H
|
||||
#define _ASM_ABI_H
|
||||
|
||||
#include <asm/signal.h>
|
||||
#include <asm/siginfo.h>
|
||||
|
||||
struct mips_abi {
|
||||
int (* const setup_frame)(struct k_sigaction * ka,
|
||||
struct pt_regs *regs, int signr,
|
||||
sigset_t *set);
|
||||
int (* const setup_rt_frame)(struct k_sigaction * ka,
|
||||
struct pt_regs *regs, int signr,
|
||||
sigset_t *set, siginfo_t *info);
|
||||
const unsigned long restart;
|
||||
};
|
||||
|
||||
#endif /* _ASM_ABI_H */
|
||||
154
arch/mips/include/asm/addrspace.h
Normal file
154
arch/mips/include/asm/addrspace.h
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* 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) 1996, 99 Ralf Baechle
|
||||
* Copyright (C) 2000, 2002 Maciej W. Rozycki
|
||||
* Copyright (C) 1990, 1999 by Silicon Graphics, Inc.
|
||||
*/
|
||||
#ifndef _ASM_ADDRSPACE_H
|
||||
#define _ASM_ADDRSPACE_H
|
||||
|
||||
#include <spaces.h>
|
||||
|
||||
/*
|
||||
* Configure language
|
||||
*/
|
||||
#ifdef __ASSEMBLY__
|
||||
#define _ATYPE_
|
||||
#define _ATYPE32_
|
||||
#define _ATYPE64_
|
||||
#define _CONST64_(x) x
|
||||
#else
|
||||
#define _ATYPE_ __PTRDIFF_TYPE__
|
||||
#define _ATYPE32_ int
|
||||
#define _ATYPE64_ __s64
|
||||
#ifdef CONFIG_64BIT
|
||||
#define _CONST64_(x) x ## L
|
||||
#else
|
||||
#define _CONST64_(x) x ## LL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 32-bit MIPS address spaces
|
||||
*/
|
||||
#ifdef __ASSEMBLY__
|
||||
#define _ACAST32_
|
||||
#define _ACAST64_
|
||||
#else
|
||||
#define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */
|
||||
#define _ACAST64_ (_ATYPE64_) /* do _not_ narrow */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Returns the kernel segment base of a given address
|
||||
*/
|
||||
#define KSEGX(a) ((_ACAST32_ (a)) & 0xe0000000)
|
||||
|
||||
/*
|
||||
* Returns the physical address of a CKSEGx / XKPHYS address
|
||||
*/
|
||||
#define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
|
||||
#define XPHYSADDR(a) ((_ACAST64_(a)) & \
|
||||
_CONST64_(0x000000ffffffffff))
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
|
||||
/*
|
||||
* Memory segments (64bit kernel mode addresses)
|
||||
* The compatibility segments use the full 64-bit sign extended value. Note
|
||||
* the R8000 doesn't have them so don't reference these in generic MIPS code.
|
||||
*/
|
||||
#define XKUSEG _CONST64_(0x0000000000000000)
|
||||
#define XKSSEG _CONST64_(0x4000000000000000)
|
||||
#define XKPHYS _CONST64_(0x8000000000000000)
|
||||
#define XKSEG _CONST64_(0xc000000000000000)
|
||||
#define CKSEG0 _CONST64_(0xffffffff80000000)
|
||||
#define CKSEG1 _CONST64_(0xffffffffa0000000)
|
||||
#define CKSSEG _CONST64_(0xffffffffc0000000)
|
||||
#define CKSEG3 _CONST64_(0xffffffffe0000000)
|
||||
|
||||
#define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0)
|
||||
#define CKSEG1ADDR(a) (CPHYSADDR(a) | CKSEG1)
|
||||
#define CKSEG2ADDR(a) (CPHYSADDR(a) | CKSEG2)
|
||||
#define CKSEG3ADDR(a) (CPHYSADDR(a) | CKSEG3)
|
||||
|
||||
#else
|
||||
|
||||
#define CKSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
|
||||
#define CKSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
|
||||
#define CKSEG2ADDR(a) (CPHYSADDR(a) | KSEG2)
|
||||
#define CKSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
|
||||
|
||||
/*
|
||||
* Map an address to a certain kernel segment
|
||||
*/
|
||||
#define KSEG0ADDR(a) (CPHYSADDR(a) | KSEG0)
|
||||
#define KSEG1ADDR(a) (CPHYSADDR(a) | KSEG1)
|
||||
#define KSEG2ADDR(a) (CPHYSADDR(a) | KSEG2)
|
||||
#define KSEG3ADDR(a) (CPHYSADDR(a) | KSEG3)
|
||||
|
||||
/*
|
||||
* Memory segments (32bit kernel mode addresses)
|
||||
* These are the traditional names used in the 32-bit universe.
|
||||
*/
|
||||
#define KUSEG 0x00000000
|
||||
#define KSEG0 0x80000000
|
||||
#define KSEG1 0xa0000000
|
||||
#define KSEG2 0xc0000000
|
||||
#define KSEG3 0xe0000000
|
||||
|
||||
#define CKUSEG 0x00000000
|
||||
#define CKSEG0 0x80000000
|
||||
#define CKSEG1 0xa0000000
|
||||
#define CKSEG2 0xc0000000
|
||||
#define CKSEG3 0xe0000000
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Cache modes for XKPHYS address conversion macros
|
||||
*/
|
||||
#define K_CALG_COH_EXCL1_NOL2 0
|
||||
#define K_CALG_COH_SHRL1_NOL2 1
|
||||
#define K_CALG_UNCACHED 2
|
||||
#define K_CALG_NONCOHERENT 3
|
||||
#define K_CALG_COH_EXCL 4
|
||||
#define K_CALG_COH_SHAREABLE 5
|
||||
#define K_CALG_NOTUSED 6
|
||||
#define K_CALG_UNCACHED_ACCEL 7
|
||||
|
||||
/*
|
||||
* 64-bit address conversions
|
||||
*/
|
||||
#define PHYS_TO_XKSEG_UNCACHED(p) PHYS_TO_XKPHYS(K_CALG_UNCACHED, (p))
|
||||
#define PHYS_TO_XKSEG_CACHED(p) PHYS_TO_XKPHYS(K_CALG_COH_SHAREABLE, (p))
|
||||
#define XKPHYS_TO_PHYS(p) ((p) & TO_PHYS_MASK)
|
||||
#define PHYS_TO_XKPHYS(cm, a) (_CONST64_(0x8000000000000000) | \
|
||||
(_CONST64_(cm) << 59) | (a))
|
||||
|
||||
/*
|
||||
* The ultimate limited of the 64-bit MIPS architecture: 2 bits for selecting
|
||||
* the region, 3 bits for the CCA mode. This leaves 59 bits of which the
|
||||
* R8000 implements most with its 48-bit physical address space.
|
||||
*/
|
||||
#define TO_PHYS_MASK _CONST64_(0x07ffffffffffffff) /* 2^^59 - 1 */
|
||||
|
||||
#ifndef CONFIG_CPU_R8000
|
||||
|
||||
/*
|
||||
* The R8000 doesn't have the 32-bit compat spaces so we don't define them
|
||||
* in order to catch bugs in the source code.
|
||||
*/
|
||||
|
||||
#define COMPAT_K1BASE32 _CONST64_(0xffffffffa0000000)
|
||||
#define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */
|
||||
|
||||
#endif
|
||||
|
||||
#define KDM_TO_PHYS(x) (_ACAST64_ (x) & TO_PHYS_MASK)
|
||||
#define PHYS_TO_K0(x) (_ACAST64_ (x) | CAC_BASE)
|
||||
|
||||
#endif /* _ASM_ADDRSPACE_H */
|
||||
409
arch/mips/include/asm/asm.h
Normal file
409
arch/mips/include/asm/asm.h
Normal file
|
|
@ -0,0 +1,409 @@
|
|||
/*
|
||||
* 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) 1995, 1996, 1997, 1999, 2001 by Ralf Baechle
|
||||
* Copyright (C) 1999 by Silicon Graphics, Inc.
|
||||
* Copyright (C) 2001 MIPS Technologies, Inc.
|
||||
* Copyright (C) 2002 Maciej W. Rozycki
|
||||
*
|
||||
* Some useful macros for MIPS assembler code
|
||||
*
|
||||
* Some of the routines below contain useless nops that will be optimized
|
||||
* away by gas in -O mode. These nops are however required to fill delay
|
||||
* slots in noreorder mode.
|
||||
*/
|
||||
#ifndef __ASM_ASM_H
|
||||
#define __ASM_ASM_H
|
||||
|
||||
#include <asm/sgidefs.h>
|
||||
|
||||
#ifndef CAT
|
||||
#ifdef __STDC__
|
||||
#define __CAT(str1, str2) str1##str2
|
||||
#else
|
||||
#define __CAT(str1, str2) str1/**/str2
|
||||
#endif
|
||||
#define CAT(str1, str2) __CAT(str1, str2)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* PIC specific declarations
|
||||
* Not used for the kernel but here seems to be the right place.
|
||||
*/
|
||||
#ifdef __PIC__
|
||||
#define CPRESTORE(register) \
|
||||
.cprestore register
|
||||
#define CPADD(register) \
|
||||
.cpadd register
|
||||
#define CPLOAD(register) \
|
||||
.cpload register
|
||||
#else
|
||||
#define CPRESTORE(register)
|
||||
#define CPADD(register)
|
||||
#define CPLOAD(register)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* LEAF - declare leaf routine
|
||||
*/
|
||||
#define LEAF(symbol) \
|
||||
.globl symbol; \
|
||||
.align 2; \
|
||||
.type symbol, @function; \
|
||||
.ent symbol, 0; \
|
||||
symbol: .frame sp, 0, ra
|
||||
|
||||
/*
|
||||
* NESTED - declare nested routine entry point
|
||||
*/
|
||||
#define NESTED(symbol, framesize, rpc) \
|
||||
.globl symbol; \
|
||||
.align 2; \
|
||||
.type symbol, @function; \
|
||||
.ent symbol, 0; \
|
||||
symbol: .frame sp, framesize, rpc
|
||||
|
||||
/*
|
||||
* END - mark end of function
|
||||
*/
|
||||
#define END(function) \
|
||||
.end function; \
|
||||
.size function, .-function
|
||||
|
||||
/*
|
||||
* EXPORT - export definition of symbol
|
||||
*/
|
||||
#define EXPORT(symbol) \
|
||||
.globl symbol; \
|
||||
symbol:
|
||||
|
||||
/*
|
||||
* FEXPORT - export definition of a function symbol
|
||||
*/
|
||||
#define FEXPORT(symbol) \
|
||||
.globl symbol; \
|
||||
.type symbol, @function; \
|
||||
symbol:
|
||||
|
||||
/*
|
||||
* ABS - export absolute symbol
|
||||
*/
|
||||
#define ABS(symbol,value) \
|
||||
.globl symbol; \
|
||||
symbol = value
|
||||
|
||||
#define PANIC(msg) \
|
||||
.set push; \
|
||||
.set reorder; \
|
||||
PTR_LA a0, 8f; \
|
||||
jal panic; \
|
||||
9: b 9b; \
|
||||
.set pop; \
|
||||
TEXT(msg)
|
||||
|
||||
/*
|
||||
* Print formatted string
|
||||
*/
|
||||
#ifdef CONFIG_PRINTK
|
||||
#define PRINT(string) \
|
||||
.set push; \
|
||||
.set reorder; \
|
||||
PTR_LA a0, 8f; \
|
||||
jal printk; \
|
||||
.set pop; \
|
||||
TEXT(string)
|
||||
#else
|
||||
#define PRINT(string)
|
||||
#endif
|
||||
|
||||
#define TEXT(msg) \
|
||||
.pushsection .data; \
|
||||
8: .asciiz msg; \
|
||||
.popsection;
|
||||
|
||||
/*
|
||||
* Build text tables
|
||||
*/
|
||||
#define TTABLE(string) \
|
||||
.pushsection .text; \
|
||||
.word 1f; \
|
||||
.popsection \
|
||||
.pushsection .data; \
|
||||
1: .asciiz string; \
|
||||
.popsection
|
||||
|
||||
/*
|
||||
* MIPS IV pref instruction.
|
||||
* Use with .set noreorder only!
|
||||
*
|
||||
* MIPS IV implementations are free to treat this as a nop. The R5000
|
||||
* is one of them. So we should have an option not to use this instruction.
|
||||
*/
|
||||
#ifdef CONFIG_CPU_HAS_PREFETCH
|
||||
|
||||
#define PREF(hint,addr) \
|
||||
.set push; \
|
||||
.set mips4; \
|
||||
pref hint, addr; \
|
||||
.set pop
|
||||
|
||||
#define PREFX(hint,addr) \
|
||||
.set push; \
|
||||
.set mips4; \
|
||||
prefx hint, addr; \
|
||||
.set pop
|
||||
|
||||
#else /* !CONFIG_CPU_HAS_PREFETCH */
|
||||
|
||||
#define PREF(hint, addr)
|
||||
#define PREFX(hint, addr)
|
||||
|
||||
#endif /* !CONFIG_CPU_HAS_PREFETCH */
|
||||
|
||||
/*
|
||||
* MIPS ISA IV/V movn/movz instructions and equivalents for older CPUs.
|
||||
*/
|
||||
#if (_MIPS_ISA == _MIPS_ISA_MIPS1)
|
||||
#define MOVN(rd, rs, rt) \
|
||||
.set push; \
|
||||
.set reorder; \
|
||||
beqz rt, 9f; \
|
||||
move rd, rs; \
|
||||
.set pop; \
|
||||
9:
|
||||
#define MOVZ(rd, rs, rt) \
|
||||
.set push; \
|
||||
.set reorder; \
|
||||
bnez rt, 9f; \
|
||||
move rd, rs; \
|
||||
.set pop; \
|
||||
9:
|
||||
#endif /* _MIPS_ISA == _MIPS_ISA_MIPS1 */
|
||||
#if (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3)
|
||||
#define MOVN(rd, rs, rt) \
|
||||
.set push; \
|
||||
.set noreorder; \
|
||||
bnezl rt, 9f; \
|
||||
move rd, rs; \
|
||||
.set pop; \
|
||||
9:
|
||||
#define MOVZ(rd, rs, rt) \
|
||||
.set push; \
|
||||
.set noreorder; \
|
||||
beqzl rt, 9f; \
|
||||
move rd, rs; \
|
||||
.set pop; \
|
||||
9:
|
||||
#endif /* (_MIPS_ISA == _MIPS_ISA_MIPS2) || (_MIPS_ISA == _MIPS_ISA_MIPS3) */
|
||||
#if (_MIPS_ISA == _MIPS_ISA_MIPS4 ) || (_MIPS_ISA == _MIPS_ISA_MIPS5) || \
|
||||
(_MIPS_ISA == _MIPS_ISA_MIPS32) || (_MIPS_ISA == _MIPS_ISA_MIPS64)
|
||||
#define MOVN(rd, rs, rt) \
|
||||
movn rd, rs, rt
|
||||
#define MOVZ(rd, rs, rt) \
|
||||
movz rd, rs, rt
|
||||
#endif /* MIPS IV, MIPS V, MIPS32 or MIPS64 */
|
||||
|
||||
/*
|
||||
* Stack alignment
|
||||
*/
|
||||
#if (_MIPS_SIM == _MIPS_SIM_ABI32)
|
||||
#define ALSZ 7
|
||||
#define ALMASK ~7
|
||||
#endif
|
||||
#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
|
||||
#define ALSZ 15
|
||||
#define ALMASK ~15
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macros to handle different pointer/register sizes for 32/64-bit code
|
||||
*/
|
||||
|
||||
/*
|
||||
* Size of a register
|
||||
*/
|
||||
#ifdef __mips64
|
||||
#define SZREG 8
|
||||
#else
|
||||
#define SZREG 4
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use the following macros in assemblercode to load/store registers,
|
||||
* pointers etc.
|
||||
*/
|
||||
#if (_MIPS_SIM == _MIPS_SIM_ABI32)
|
||||
#define REG_S sw
|
||||
#define REG_L lw
|
||||
#define REG_SUBU subu
|
||||
#define REG_ADDU addu
|
||||
#endif
|
||||
#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
|
||||
#define REG_S sd
|
||||
#define REG_L ld
|
||||
#define REG_SUBU dsubu
|
||||
#define REG_ADDU daddu
|
||||
#endif
|
||||
|
||||
/*
|
||||
* How to add/sub/load/store/shift C int variables.
|
||||
*/
|
||||
#if (_MIPS_SZINT == 32)
|
||||
#define INT_ADD add
|
||||
#define INT_ADDU addu
|
||||
#define INT_ADDI addi
|
||||
#define INT_ADDIU addiu
|
||||
#define INT_SUB sub
|
||||
#define INT_SUBU subu
|
||||
#define INT_L lw
|
||||
#define INT_S sw
|
||||
#define INT_SLL sll
|
||||
#define INT_SLLV sllv
|
||||
#define INT_SRL srl
|
||||
#define INT_SRLV srlv
|
||||
#define INT_SRA sra
|
||||
#define INT_SRAV srav
|
||||
#endif
|
||||
|
||||
#if (_MIPS_SZINT == 64)
|
||||
#define INT_ADD dadd
|
||||
#define INT_ADDU daddu
|
||||
#define INT_ADDI daddi
|
||||
#define INT_ADDIU daddiu
|
||||
#define INT_SUB dsub
|
||||
#define INT_SUBU dsubu
|
||||
#define INT_L ld
|
||||
#define INT_S sd
|
||||
#define INT_SLL dsll
|
||||
#define INT_SLLV dsllv
|
||||
#define INT_SRL dsrl
|
||||
#define INT_SRLV dsrlv
|
||||
#define INT_SRA dsra
|
||||
#define INT_SRAV dsrav
|
||||
#endif
|
||||
|
||||
/*
|
||||
* How to add/sub/load/store/shift C long variables.
|
||||
*/
|
||||
#if (_MIPS_SZLONG == 32)
|
||||
#define LONG_ADD add
|
||||
#define LONG_ADDU addu
|
||||
#define LONG_ADDI addi
|
||||
#define LONG_ADDIU addiu
|
||||
#define LONG_SUB sub
|
||||
#define LONG_SUBU subu
|
||||
#define LONG_L lw
|
||||
#define LONG_S sw
|
||||
#define LONG_SLL sll
|
||||
#define LONG_SLLV sllv
|
||||
#define LONG_SRL srl
|
||||
#define LONG_SRLV srlv
|
||||
#define LONG_SRA sra
|
||||
#define LONG_SRAV srav
|
||||
|
||||
#define LONG .word
|
||||
#define LONGSIZE 4
|
||||
#define LONGMASK 3
|
||||
#define LONGLOG 2
|
||||
#endif
|
||||
|
||||
#if (_MIPS_SZLONG == 64)
|
||||
#define LONG_ADD dadd
|
||||
#define LONG_ADDU daddu
|
||||
#define LONG_ADDI daddi
|
||||
#define LONG_ADDIU daddiu
|
||||
#define LONG_SUB dsub
|
||||
#define LONG_SUBU dsubu
|
||||
#define LONG_L ld
|
||||
#define LONG_S sd
|
||||
#define LONG_SLL dsll
|
||||
#define LONG_SLLV dsllv
|
||||
#define LONG_SRL dsrl
|
||||
#define LONG_SRLV dsrlv
|
||||
#define LONG_SRA dsra
|
||||
#define LONG_SRAV dsrav
|
||||
|
||||
#define LONG .dword
|
||||
#define LONGSIZE 8
|
||||
#define LONGMASK 7
|
||||
#define LONGLOG 3
|
||||
#endif
|
||||
|
||||
/*
|
||||
* How to add/sub/load/store/shift pointers.
|
||||
*/
|
||||
#if (_MIPS_SZPTR == 32)
|
||||
#define PTR_ADD add
|
||||
#define PTR_ADDU addu
|
||||
#define PTR_ADDI addi
|
||||
#define PTR_ADDIU addiu
|
||||
#define PTR_SUB sub
|
||||
#define PTR_SUBU subu
|
||||
#define PTR_L lw
|
||||
#define PTR_S sw
|
||||
#define PTR_LA la
|
||||
#define PTR_LI li
|
||||
#define PTR_SLL sll
|
||||
#define PTR_SLLV sllv
|
||||
#define PTR_SRL srl
|
||||
#define PTR_SRLV srlv
|
||||
#define PTR_SRA sra
|
||||
#define PTR_SRAV srav
|
||||
|
||||
#define PTR_SCALESHIFT 2
|
||||
|
||||
#define PTR .word
|
||||
#define PTRSIZE 4
|
||||
#define PTRLOG 2
|
||||
#endif
|
||||
|
||||
#if (_MIPS_SZPTR == 64)
|
||||
#define PTR_ADD dadd
|
||||
#define PTR_ADDU daddu
|
||||
#define PTR_ADDI daddi
|
||||
#define PTR_ADDIU daddiu
|
||||
#define PTR_SUB dsub
|
||||
#define PTR_SUBU dsubu
|
||||
#define PTR_L ld
|
||||
#define PTR_S sd
|
||||
#define PTR_LA dla
|
||||
#define PTR_LI dli
|
||||
#define PTR_SLL dsll
|
||||
#define PTR_SLLV dsllv
|
||||
#define PTR_SRL dsrl
|
||||
#define PTR_SRLV dsrlv
|
||||
#define PTR_SRA dsra
|
||||
#define PTR_SRAV dsrav
|
||||
|
||||
#define PTR_SCALESHIFT 3
|
||||
|
||||
#define PTR .dword
|
||||
#define PTRSIZE 8
|
||||
#define PTRLOG 3
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some cp0 registers were extended to 64bit for MIPS III.
|
||||
*/
|
||||
#if (_MIPS_SIM == _MIPS_SIM_ABI32)
|
||||
#define MFC0 mfc0
|
||||
#define MTC0 mtc0
|
||||
#endif
|
||||
#if (_MIPS_SIM == _MIPS_SIM_NABI32) || (_MIPS_SIM == _MIPS_SIM_ABI64)
|
||||
#define MFC0 dmfc0
|
||||
#define MTC0 dmtc0
|
||||
#endif
|
||||
|
||||
#define SSNOP sll zero, zero, 1
|
||||
|
||||
#ifdef CONFIG_SGI_IP28
|
||||
/* Inhibit speculative stores to volatile (e.g.DMA) or invalid addresses. */
|
||||
#include <asm/cacheops.h>
|
||||
#define R10KCBARRIER(addr) cache Cache_Barrier, addr;
|
||||
#else
|
||||
#define R10KCBARRIER(addr)
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_ASM_H */
|
||||
158
arch/mips/include/asm/asmmacro-32.h
Normal file
158
arch/mips/include/asm/asmmacro-32.h
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
* asmmacro.h: Assembler macros to make things easier to read.
|
||||
*
|
||||
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
|
||||
* Copyright (C) 1998, 1999, 2003 Ralf Baechle
|
||||
*/
|
||||
#ifndef _ASM_ASMMACRO_32_H
|
||||
#define _ASM_ASMMACRO_32_H
|
||||
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/regdef.h>
|
||||
#include <asm/fpregdef.h>
|
||||
#include <asm/mipsregs.h>
|
||||
|
||||
.macro fpu_save_double thread status tmp1=t0
|
||||
cfc1 \tmp1, fcr31
|
||||
sdc1 $f0, THREAD_FPR0(\thread)
|
||||
sdc1 $f2, THREAD_FPR2(\thread)
|
||||
sdc1 $f4, THREAD_FPR4(\thread)
|
||||
sdc1 $f6, THREAD_FPR6(\thread)
|
||||
sdc1 $f8, THREAD_FPR8(\thread)
|
||||
sdc1 $f10, THREAD_FPR10(\thread)
|
||||
sdc1 $f12, THREAD_FPR12(\thread)
|
||||
sdc1 $f14, THREAD_FPR14(\thread)
|
||||
sdc1 $f16, THREAD_FPR16(\thread)
|
||||
sdc1 $f18, THREAD_FPR18(\thread)
|
||||
sdc1 $f20, THREAD_FPR20(\thread)
|
||||
sdc1 $f22, THREAD_FPR22(\thread)
|
||||
sdc1 $f24, THREAD_FPR24(\thread)
|
||||
sdc1 $f26, THREAD_FPR26(\thread)
|
||||
sdc1 $f28, THREAD_FPR28(\thread)
|
||||
sdc1 $f30, THREAD_FPR30(\thread)
|
||||
sw \tmp1, THREAD_FCR31(\thread)
|
||||
.endm
|
||||
|
||||
.macro fpu_save_single thread tmp=t0
|
||||
cfc1 \tmp, fcr31
|
||||
swc1 $f0, THREAD_FPR0(\thread)
|
||||
swc1 $f1, THREAD_FPR1(\thread)
|
||||
swc1 $f2, THREAD_FPR2(\thread)
|
||||
swc1 $f3, THREAD_FPR3(\thread)
|
||||
swc1 $f4, THREAD_FPR4(\thread)
|
||||
swc1 $f5, THREAD_FPR5(\thread)
|
||||
swc1 $f6, THREAD_FPR6(\thread)
|
||||
swc1 $f7, THREAD_FPR7(\thread)
|
||||
swc1 $f8, THREAD_FPR8(\thread)
|
||||
swc1 $f9, THREAD_FPR9(\thread)
|
||||
swc1 $f10, THREAD_FPR10(\thread)
|
||||
swc1 $f11, THREAD_FPR11(\thread)
|
||||
swc1 $f12, THREAD_FPR12(\thread)
|
||||
swc1 $f13, THREAD_FPR13(\thread)
|
||||
swc1 $f14, THREAD_FPR14(\thread)
|
||||
swc1 $f15, THREAD_FPR15(\thread)
|
||||
swc1 $f16, THREAD_FPR16(\thread)
|
||||
swc1 $f17, THREAD_FPR17(\thread)
|
||||
swc1 $f18, THREAD_FPR18(\thread)
|
||||
swc1 $f19, THREAD_FPR19(\thread)
|
||||
swc1 $f20, THREAD_FPR20(\thread)
|
||||
swc1 $f21, THREAD_FPR21(\thread)
|
||||
swc1 $f22, THREAD_FPR22(\thread)
|
||||
swc1 $f23, THREAD_FPR23(\thread)
|
||||
swc1 $f24, THREAD_FPR24(\thread)
|
||||
swc1 $f25, THREAD_FPR25(\thread)
|
||||
swc1 $f26, THREAD_FPR26(\thread)
|
||||
swc1 $f27, THREAD_FPR27(\thread)
|
||||
swc1 $f28, THREAD_FPR28(\thread)
|
||||
swc1 $f29, THREAD_FPR29(\thread)
|
||||
swc1 $f30, THREAD_FPR30(\thread)
|
||||
swc1 $f31, THREAD_FPR31(\thread)
|
||||
sw \tmp, THREAD_FCR31(\thread)
|
||||
.endm
|
||||
|
||||
.macro fpu_restore_double thread status tmp=t0
|
||||
lw \tmp, THREAD_FCR31(\thread)
|
||||
ldc1 $f0, THREAD_FPR0(\thread)
|
||||
ldc1 $f2, THREAD_FPR2(\thread)
|
||||
ldc1 $f4, THREAD_FPR4(\thread)
|
||||
ldc1 $f6, THREAD_FPR6(\thread)
|
||||
ldc1 $f8, THREAD_FPR8(\thread)
|
||||
ldc1 $f10, THREAD_FPR10(\thread)
|
||||
ldc1 $f12, THREAD_FPR12(\thread)
|
||||
ldc1 $f14, THREAD_FPR14(\thread)
|
||||
ldc1 $f16, THREAD_FPR16(\thread)
|
||||
ldc1 $f18, THREAD_FPR18(\thread)
|
||||
ldc1 $f20, THREAD_FPR20(\thread)
|
||||
ldc1 $f22, THREAD_FPR22(\thread)
|
||||
ldc1 $f24, THREAD_FPR24(\thread)
|
||||
ldc1 $f26, THREAD_FPR26(\thread)
|
||||
ldc1 $f28, THREAD_FPR28(\thread)
|
||||
ldc1 $f30, THREAD_FPR30(\thread)
|
||||
ctc1 \tmp, fcr31
|
||||
.endm
|
||||
|
||||
.macro fpu_restore_single thread tmp=t0
|
||||
lw \tmp, THREAD_FCR31(\thread)
|
||||
lwc1 $f0, THREAD_FPR0(\thread)
|
||||
lwc1 $f1, THREAD_FPR1(\thread)
|
||||
lwc1 $f2, THREAD_FPR2(\thread)
|
||||
lwc1 $f3, THREAD_FPR3(\thread)
|
||||
lwc1 $f4, THREAD_FPR4(\thread)
|
||||
lwc1 $f5, THREAD_FPR5(\thread)
|
||||
lwc1 $f6, THREAD_FPR6(\thread)
|
||||
lwc1 $f7, THREAD_FPR7(\thread)
|
||||
lwc1 $f8, THREAD_FPR8(\thread)
|
||||
lwc1 $f9, THREAD_FPR9(\thread)
|
||||
lwc1 $f10, THREAD_FPR10(\thread)
|
||||
lwc1 $f11, THREAD_FPR11(\thread)
|
||||
lwc1 $f12, THREAD_FPR12(\thread)
|
||||
lwc1 $f13, THREAD_FPR13(\thread)
|
||||
lwc1 $f14, THREAD_FPR14(\thread)
|
||||
lwc1 $f15, THREAD_FPR15(\thread)
|
||||
lwc1 $f16, THREAD_FPR16(\thread)
|
||||
lwc1 $f17, THREAD_FPR17(\thread)
|
||||
lwc1 $f18, THREAD_FPR18(\thread)
|
||||
lwc1 $f19, THREAD_FPR19(\thread)
|
||||
lwc1 $f20, THREAD_FPR20(\thread)
|
||||
lwc1 $f21, THREAD_FPR21(\thread)
|
||||
lwc1 $f22, THREAD_FPR22(\thread)
|
||||
lwc1 $f23, THREAD_FPR23(\thread)
|
||||
lwc1 $f24, THREAD_FPR24(\thread)
|
||||
lwc1 $f25, THREAD_FPR25(\thread)
|
||||
lwc1 $f26, THREAD_FPR26(\thread)
|
||||
lwc1 $f27, THREAD_FPR27(\thread)
|
||||
lwc1 $f28, THREAD_FPR28(\thread)
|
||||
lwc1 $f29, THREAD_FPR29(\thread)
|
||||
lwc1 $f30, THREAD_FPR30(\thread)
|
||||
lwc1 $f31, THREAD_FPR31(\thread)
|
||||
ctc1 \tmp, fcr31
|
||||
.endm
|
||||
|
||||
.macro cpu_save_nonscratch thread
|
||||
LONG_S s0, THREAD_REG16(\thread)
|
||||
LONG_S s1, THREAD_REG17(\thread)
|
||||
LONG_S s2, THREAD_REG18(\thread)
|
||||
LONG_S s3, THREAD_REG19(\thread)
|
||||
LONG_S s4, THREAD_REG20(\thread)
|
||||
LONG_S s5, THREAD_REG21(\thread)
|
||||
LONG_S s6, THREAD_REG22(\thread)
|
||||
LONG_S s7, THREAD_REG23(\thread)
|
||||
LONG_S sp, THREAD_REG29(\thread)
|
||||
LONG_S fp, THREAD_REG30(\thread)
|
||||
.endm
|
||||
|
||||
.macro cpu_restore_nonscratch thread
|
||||
LONG_L s0, THREAD_REG16(\thread)
|
||||
LONG_L s1, THREAD_REG17(\thread)
|
||||
LONG_L s2, THREAD_REG18(\thread)
|
||||
LONG_L s3, THREAD_REG19(\thread)
|
||||
LONG_L s4, THREAD_REG20(\thread)
|
||||
LONG_L s5, THREAD_REG21(\thread)
|
||||
LONG_L s6, THREAD_REG22(\thread)
|
||||
LONG_L s7, THREAD_REG23(\thread)
|
||||
LONG_L sp, THREAD_REG29(\thread)
|
||||
LONG_L fp, THREAD_REG30(\thread)
|
||||
LONG_L ra, THREAD_REG31(\thread)
|
||||
.endm
|
||||
|
||||
#endif /* _ASM_ASMMACRO_32_H */
|
||||
139
arch/mips/include/asm/asmmacro-64.h
Normal file
139
arch/mips/include/asm/asmmacro-64.h
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* asmmacro.h: Assembler macros to make things easier to read.
|
||||
*
|
||||
* Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
|
||||
* Copyright (C) 1998, 1999 Ralf Baechle
|
||||
* Copyright (C) 1999 Silicon Graphics, Inc.
|
||||
*/
|
||||
#ifndef _ASM_ASMMACRO_64_H
|
||||
#define _ASM_ASMMACRO_64_H
|
||||
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/regdef.h>
|
||||
#include <asm/fpregdef.h>
|
||||
#include <asm/mipsregs.h>
|
||||
|
||||
.macro fpu_save_16even thread tmp=t0
|
||||
cfc1 \tmp, fcr31
|
||||
sdc1 $f0, THREAD_FPR0(\thread)
|
||||
sdc1 $f2, THREAD_FPR2(\thread)
|
||||
sdc1 $f4, THREAD_FPR4(\thread)
|
||||
sdc1 $f6, THREAD_FPR6(\thread)
|
||||
sdc1 $f8, THREAD_FPR8(\thread)
|
||||
sdc1 $f10, THREAD_FPR10(\thread)
|
||||
sdc1 $f12, THREAD_FPR12(\thread)
|
||||
sdc1 $f14, THREAD_FPR14(\thread)
|
||||
sdc1 $f16, THREAD_FPR16(\thread)
|
||||
sdc1 $f18, THREAD_FPR18(\thread)
|
||||
sdc1 $f20, THREAD_FPR20(\thread)
|
||||
sdc1 $f22, THREAD_FPR22(\thread)
|
||||
sdc1 $f24, THREAD_FPR24(\thread)
|
||||
sdc1 $f26, THREAD_FPR26(\thread)
|
||||
sdc1 $f28, THREAD_FPR28(\thread)
|
||||
sdc1 $f30, THREAD_FPR30(\thread)
|
||||
sw \tmp, THREAD_FCR31(\thread)
|
||||
.endm
|
||||
|
||||
.macro fpu_save_16odd thread
|
||||
sdc1 $f1, THREAD_FPR1(\thread)
|
||||
sdc1 $f3, THREAD_FPR3(\thread)
|
||||
sdc1 $f5, THREAD_FPR5(\thread)
|
||||
sdc1 $f7, THREAD_FPR7(\thread)
|
||||
sdc1 $f9, THREAD_FPR9(\thread)
|
||||
sdc1 $f11, THREAD_FPR11(\thread)
|
||||
sdc1 $f13, THREAD_FPR13(\thread)
|
||||
sdc1 $f15, THREAD_FPR15(\thread)
|
||||
sdc1 $f17, THREAD_FPR17(\thread)
|
||||
sdc1 $f19, THREAD_FPR19(\thread)
|
||||
sdc1 $f21, THREAD_FPR21(\thread)
|
||||
sdc1 $f23, THREAD_FPR23(\thread)
|
||||
sdc1 $f25, THREAD_FPR25(\thread)
|
||||
sdc1 $f27, THREAD_FPR27(\thread)
|
||||
sdc1 $f29, THREAD_FPR29(\thread)
|
||||
sdc1 $f31, THREAD_FPR31(\thread)
|
||||
.endm
|
||||
|
||||
.macro fpu_save_double thread status tmp
|
||||
sll \tmp, \status, 5
|
||||
bgez \tmp, 2f
|
||||
fpu_save_16odd \thread
|
||||
2:
|
||||
fpu_save_16even \thread \tmp
|
||||
.endm
|
||||
|
||||
.macro fpu_restore_16even thread tmp=t0
|
||||
lw \tmp, THREAD_FCR31(\thread)
|
||||
ldc1 $f0, THREAD_FPR0(\thread)
|
||||
ldc1 $f2, THREAD_FPR2(\thread)
|
||||
ldc1 $f4, THREAD_FPR4(\thread)
|
||||
ldc1 $f6, THREAD_FPR6(\thread)
|
||||
ldc1 $f8, THREAD_FPR8(\thread)
|
||||
ldc1 $f10, THREAD_FPR10(\thread)
|
||||
ldc1 $f12, THREAD_FPR12(\thread)
|
||||
ldc1 $f14, THREAD_FPR14(\thread)
|
||||
ldc1 $f16, THREAD_FPR16(\thread)
|
||||
ldc1 $f18, THREAD_FPR18(\thread)
|
||||
ldc1 $f20, THREAD_FPR20(\thread)
|
||||
ldc1 $f22, THREAD_FPR22(\thread)
|
||||
ldc1 $f24, THREAD_FPR24(\thread)
|
||||
ldc1 $f26, THREAD_FPR26(\thread)
|
||||
ldc1 $f28, THREAD_FPR28(\thread)
|
||||
ldc1 $f30, THREAD_FPR30(\thread)
|
||||
ctc1 \tmp, fcr31
|
||||
.endm
|
||||
|
||||
.macro fpu_restore_16odd thread
|
||||
ldc1 $f1, THREAD_FPR1(\thread)
|
||||
ldc1 $f3, THREAD_FPR3(\thread)
|
||||
ldc1 $f5, THREAD_FPR5(\thread)
|
||||
ldc1 $f7, THREAD_FPR7(\thread)
|
||||
ldc1 $f9, THREAD_FPR9(\thread)
|
||||
ldc1 $f11, THREAD_FPR11(\thread)
|
||||
ldc1 $f13, THREAD_FPR13(\thread)
|
||||
ldc1 $f15, THREAD_FPR15(\thread)
|
||||
ldc1 $f17, THREAD_FPR17(\thread)
|
||||
ldc1 $f19, THREAD_FPR19(\thread)
|
||||
ldc1 $f21, THREAD_FPR21(\thread)
|
||||
ldc1 $f23, THREAD_FPR23(\thread)
|
||||
ldc1 $f25, THREAD_FPR25(\thread)
|
||||
ldc1 $f27, THREAD_FPR27(\thread)
|
||||
ldc1 $f29, THREAD_FPR29(\thread)
|
||||
ldc1 $f31, THREAD_FPR31(\thread)
|
||||
.endm
|
||||
|
||||
.macro fpu_restore_double thread status tmp
|
||||
sll \tmp, \status, 5
|
||||
bgez \tmp, 1f # 16 register mode?
|
||||
|
||||
fpu_restore_16odd \thread
|
||||
1: fpu_restore_16even \thread \tmp
|
||||
.endm
|
||||
|
||||
.macro cpu_save_nonscratch thread
|
||||
LONG_S s0, THREAD_REG16(\thread)
|
||||
LONG_S s1, THREAD_REG17(\thread)
|
||||
LONG_S s2, THREAD_REG18(\thread)
|
||||
LONG_S s3, THREAD_REG19(\thread)
|
||||
LONG_S s4, THREAD_REG20(\thread)
|
||||
LONG_S s5, THREAD_REG21(\thread)
|
||||
LONG_S s6, THREAD_REG22(\thread)
|
||||
LONG_S s7, THREAD_REG23(\thread)
|
||||
LONG_S sp, THREAD_REG29(\thread)
|
||||
LONG_S fp, THREAD_REG30(\thread)
|
||||
.endm
|
||||
|
||||
.macro cpu_restore_nonscratch thread
|
||||
LONG_L s0, THREAD_REG16(\thread)
|
||||
LONG_L s1, THREAD_REG17(\thread)
|
||||
LONG_L s2, THREAD_REG18(\thread)
|
||||
LONG_L s3, THREAD_REG19(\thread)
|
||||
LONG_L s4, THREAD_REG20(\thread)
|
||||
LONG_L s5, THREAD_REG21(\thread)
|
||||
LONG_L s6, THREAD_REG22(\thread)
|
||||
LONG_L s7, THREAD_REG23(\thread)
|
||||
LONG_L sp, THREAD_REG29(\thread)
|
||||
LONG_L fp, THREAD_REG30(\thread)
|
||||
LONG_L ra, THREAD_REG31(\thread)
|
||||
.endm
|
||||
|
||||
#endif /* _ASM_ASMMACRO_64_H */
|
||||
82
arch/mips/include/asm/asmmacro.h
Normal file
82
arch/mips/include/asm/asmmacro.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* 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) 2003 Ralf Baechle
|
||||
*/
|
||||
#ifndef _ASM_ASMMACRO_H
|
||||
#define _ASM_ASMMACRO_H
|
||||
|
||||
#include <asm/hazards.h>
|
||||
|
||||
#ifdef CONFIG_32BIT
|
||||
#include <asm/asmmacro-32.h>
|
||||
#endif
|
||||
#ifdef CONFIG_64BIT
|
||||
#include <asm/asmmacro-64.h>
|
||||
#endif
|
||||
#ifdef CONFIG_MIPS_MT_SMTC
|
||||
#include <asm/mipsmtregs.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MIPS_MT_SMTC
|
||||
.macro local_irq_enable reg=t0
|
||||
mfc0 \reg, CP0_TCSTATUS
|
||||
ori \reg, \reg, TCSTATUS_IXMT
|
||||
xori \reg, \reg, TCSTATUS_IXMT
|
||||
mtc0 \reg, CP0_TCSTATUS
|
||||
_ehb
|
||||
.endm
|
||||
|
||||
.macro local_irq_disable reg=t0
|
||||
mfc0 \reg, CP0_TCSTATUS
|
||||
ori \reg, \reg, TCSTATUS_IXMT
|
||||
mtc0 \reg, CP0_TCSTATUS
|
||||
_ehb
|
||||
.endm
|
||||
#else
|
||||
.macro local_irq_enable reg=t0
|
||||
mfc0 \reg, CP0_STATUS
|
||||
ori \reg, \reg, 1
|
||||
mtc0 \reg, CP0_STATUS
|
||||
irq_enable_hazard
|
||||
.endm
|
||||
|
||||
.macro local_irq_disable reg=t0
|
||||
mfc0 \reg, CP0_STATUS
|
||||
ori \reg, \reg, 1
|
||||
xori \reg, \reg, 1
|
||||
mtc0 \reg, CP0_STATUS
|
||||
irq_disable_hazard
|
||||
.endm
|
||||
#endif /* CONFIG_MIPS_MT_SMTC */
|
||||
|
||||
/*
|
||||
* Temporary until all gas have MT ASE support
|
||||
*/
|
||||
.macro DMT reg=0
|
||||
.word 0x41600bc1 | (\reg << 16)
|
||||
.endm
|
||||
|
||||
.macro EMT reg=0
|
||||
.word 0x41600be1 | (\reg << 16)
|
||||
.endm
|
||||
|
||||
.macro DVPE reg=0
|
||||
.word 0x41600001 | (\reg << 16)
|
||||
.endm
|
||||
|
||||
.macro EVPE reg=0
|
||||
.word 0x41600021 | (\reg << 16)
|
||||
.endm
|
||||
|
||||
.macro MFTR rt=0, rd=0, u=0, sel=0
|
||||
.word 0x41000000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel)
|
||||
.endm
|
||||
|
||||
.macro MTTR rt=0, rd=0, u=0, sel=0
|
||||
.word 0x41800000 | (\rt << 16) | (\rd << 11) | (\u << 5) | (\sel)
|
||||
.endm
|
||||
|
||||
#endif /* _ASM_ASMMACRO_H */
|
||||
801
arch/mips/include/asm/atomic.h
Normal file
801
arch/mips/include/asm/atomic.h
Normal file
|
|
@ -0,0 +1,801 @@
|
|||
/*
|
||||
* Atomic operations that C can't guarantee us. Useful for
|
||||
* resource counting etc..
|
||||
*
|
||||
* But use these as seldom as possible since they are much more slower
|
||||
* than regular operations.
|
||||
*
|
||||
* 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) 1996, 97, 99, 2000, 03, 04, 06 by Ralf Baechle
|
||||
*/
|
||||
#ifndef _ASM_ATOMIC_H
|
||||
#define _ASM_ATOMIC_H
|
||||
|
||||
#include <linux/irqflags.h>
|
||||
#include <asm/barrier.h>
|
||||
#include <asm/cpu-features.h>
|
||||
#include <asm/war.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
typedef struct { volatile int counter; } atomic_t;
|
||||
|
||||
#define ATOMIC_INIT(i) { (i) }
|
||||
|
||||
/*
|
||||
* atomic_read - read atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically reads the value of @v.
|
||||
*/
|
||||
#define atomic_read(v) ((v)->counter)
|
||||
|
||||
/*
|
||||
* atomic_set - set atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
* @i: required value
|
||||
*
|
||||
* Atomically sets the value of @v to @i.
|
||||
*/
|
||||
#define atomic_set(v, i) ((v)->counter = (i))
|
||||
|
||||
/*
|
||||
* atomic_add - add integer to atomic variable
|
||||
* @i: integer value to add
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically adds @i to @v.
|
||||
*/
|
||||
static __inline__ void atomic_add(int i, atomic_t * v)
|
||||
{
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: ll %0, %1 # atomic_add \n"
|
||||
" addu %0, %2 \n"
|
||||
" sc %0, %1 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter));
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: ll %0, %1 # atomic_add \n"
|
||||
" addu %0, %2 \n"
|
||||
" sc %0, %1 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter));
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
v->counter += i;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* atomic_sub - subtract the atomic variable
|
||||
* @i: integer value to subtract
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically subtracts @i from @v.
|
||||
*/
|
||||
static __inline__ void atomic_sub(int i, atomic_t * v)
|
||||
{
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: ll %0, %1 # atomic_sub \n"
|
||||
" subu %0, %2 \n"
|
||||
" sc %0, %1 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter));
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: ll %0, %1 # atomic_sub \n"
|
||||
" subu %0, %2 \n"
|
||||
" sc %0, %1 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter));
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
v->counter -= i;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Same as above, but return the result value
|
||||
*/
|
||||
static __inline__ int atomic_add_return(int i, atomic_t * v)
|
||||
{
|
||||
unsigned long result;
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: ll %1, %2 # atomic_add_return \n"
|
||||
" addu %0, %1, %3 \n"
|
||||
" sc %0, %2 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" addu %0, %1, %3 \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: ll %1, %2 # atomic_add_return \n"
|
||||
" addu %0, %1, %3 \n"
|
||||
" sc %0, %2 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" addu %0, %1, %3 \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
result = v->counter;
|
||||
result += i;
|
||||
v->counter = result;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static __inline__ int atomic_sub_return(int i, atomic_t * v)
|
||||
{
|
||||
unsigned long result;
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: ll %1, %2 # atomic_sub_return \n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" sc %0, %2 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: ll %1, %2 # atomic_sub_return \n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" sc %0, %2 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
result = v->counter;
|
||||
result -= i;
|
||||
v->counter = result;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* atomic_sub_if_positive - conditionally subtract integer from atomic variable
|
||||
* @i: integer value to subtract
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically test @v and subtract @i if @v is greater or equal than @i.
|
||||
* The function returns the old value of @v minus @i.
|
||||
*/
|
||||
static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
|
||||
{
|
||||
unsigned long result;
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: ll %1, %2 # atomic_sub_if_positive\n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" bltz %0, 1f \n"
|
||||
" sc %0, %2 \n"
|
||||
" .set noreorder \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" .set reorder \n"
|
||||
"1: \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: ll %1, %2 # atomic_sub_if_positive\n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" bltz %0, 1f \n"
|
||||
" sc %0, %2 \n"
|
||||
" .set noreorder \n"
|
||||
" beqz %0, 2f \n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" .set reorder \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
"1: \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
result = v->counter;
|
||||
result -= i;
|
||||
if (result >= 0)
|
||||
v->counter = result;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#define atomic_cmpxchg(v, o, n) (cmpxchg(&((v)->counter), (o), (n)))
|
||||
#define atomic_xchg(v, new) (xchg(&((v)->counter), (new)))
|
||||
|
||||
/**
|
||||
* atomic_add_unless - add unless the number is a given value
|
||||
* @v: pointer of type atomic_t
|
||||
* @a: the amount to add to v...
|
||||
* @u: ...unless v is equal to u.
|
||||
*
|
||||
* Atomically adds @a to @v, so long as it was not @u.
|
||||
* Returns non-zero if @v was not @u, and zero otherwise.
|
||||
*/
|
||||
static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
|
||||
{
|
||||
int c, old;
|
||||
c = atomic_read(v);
|
||||
for (;;) {
|
||||
if (unlikely(c == (u)))
|
||||
break;
|
||||
old = atomic_cmpxchg((v), c, c + (a));
|
||||
if (likely(old == c))
|
||||
break;
|
||||
c = old;
|
||||
}
|
||||
return c != (u);
|
||||
}
|
||||
#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
|
||||
|
||||
#define atomic_dec_return(v) atomic_sub_return(1, (v))
|
||||
#define atomic_inc_return(v) atomic_add_return(1, (v))
|
||||
|
||||
/*
|
||||
* atomic_sub_and_test - subtract value from variable and test result
|
||||
* @i: integer value to subtract
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically subtracts @i from @v and returns
|
||||
* true if the result is zero, or false for all
|
||||
* other cases.
|
||||
*/
|
||||
#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
|
||||
|
||||
/*
|
||||
* atomic_inc_and_test - increment and test
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically increments @v by 1
|
||||
* and returns true if the result is zero, or false for all
|
||||
* other cases.
|
||||
*/
|
||||
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
|
||||
|
||||
/*
|
||||
* atomic_dec_and_test - decrement by 1 and test
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically decrements @v by 1 and
|
||||
* returns true if the result is 0, or false for all other
|
||||
* cases.
|
||||
*/
|
||||
#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
|
||||
|
||||
/*
|
||||
* atomic_dec_if_positive - decrement by 1 if old value positive
|
||||
* @v: pointer of type atomic_t
|
||||
*/
|
||||
#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v)
|
||||
|
||||
/*
|
||||
* atomic_inc - increment atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically increments @v by 1.
|
||||
*/
|
||||
#define atomic_inc(v) atomic_add(1, (v))
|
||||
|
||||
/*
|
||||
* atomic_dec - decrement and test
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically decrements @v by 1.
|
||||
*/
|
||||
#define atomic_dec(v) atomic_sub(1, (v))
|
||||
|
||||
/*
|
||||
* atomic_add_negative - add and test if negative
|
||||
* @v: pointer of type atomic_t
|
||||
* @i: integer value to add
|
||||
*
|
||||
* Atomically adds @i to @v and returns true
|
||||
* if the result is negative, or false when
|
||||
* result is greater than or equal to zero.
|
||||
*/
|
||||
#define atomic_add_negative(i, v) (atomic_add_return(i, (v)) < 0)
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
|
||||
typedef struct { volatile long counter; } atomic64_t;
|
||||
|
||||
#define ATOMIC64_INIT(i) { (i) }
|
||||
|
||||
/*
|
||||
* atomic64_read - read atomic variable
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
*/
|
||||
#define atomic64_read(v) ((v)->counter)
|
||||
|
||||
/*
|
||||
* atomic64_set - set atomic variable
|
||||
* @v: pointer of type atomic64_t
|
||||
* @i: required value
|
||||
*/
|
||||
#define atomic64_set(v, i) ((v)->counter = (i))
|
||||
|
||||
/*
|
||||
* atomic64_add - add integer to atomic variable
|
||||
* @i: integer value to add
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
* Atomically adds @i to @v.
|
||||
*/
|
||||
static __inline__ void atomic64_add(long i, atomic64_t * v)
|
||||
{
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: lld %0, %1 # atomic64_add \n"
|
||||
" addu %0, %2 \n"
|
||||
" scd %0, %1 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter));
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: lld %0, %1 # atomic64_add \n"
|
||||
" addu %0, %2 \n"
|
||||
" scd %0, %1 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter));
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
v->counter += i;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* atomic64_sub - subtract the atomic variable
|
||||
* @i: integer value to subtract
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
* Atomically subtracts @i from @v.
|
||||
*/
|
||||
static __inline__ void atomic64_sub(long i, atomic64_t * v)
|
||||
{
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: lld %0, %1 # atomic64_sub \n"
|
||||
" subu %0, %2 \n"
|
||||
" scd %0, %1 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter));
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: lld %0, %1 # atomic64_sub \n"
|
||||
" subu %0, %2 \n"
|
||||
" scd %0, %1 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter));
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
v->counter -= i;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Same as above, but return the result value
|
||||
*/
|
||||
static __inline__ long atomic64_add_return(long i, atomic64_t * v)
|
||||
{
|
||||
unsigned long result;
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: lld %1, %2 # atomic64_add_return \n"
|
||||
" addu %0, %1, %3 \n"
|
||||
" scd %0, %2 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" addu %0, %1, %3 \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: lld %1, %2 # atomic64_add_return \n"
|
||||
" addu %0, %1, %3 \n"
|
||||
" scd %0, %2 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" addu %0, %1, %3 \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
result = v->counter;
|
||||
result += i;
|
||||
v->counter = result;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
|
||||
{
|
||||
unsigned long result;
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: lld %1, %2 # atomic64_sub_return \n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" scd %0, %2 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: lld %1, %2 # atomic64_sub_return \n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" scd %0, %2 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" subu %0, %1, %3 \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
result = v->counter;
|
||||
result -= i;
|
||||
v->counter = result;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* atomic64_sub_if_positive - conditionally subtract integer from atomic variable
|
||||
* @i: integer value to subtract
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
* Atomically test @v and subtract @i if @v is greater or equal than @i.
|
||||
* The function returns the old value of @v minus @i.
|
||||
*/
|
||||
static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
|
||||
{
|
||||
unsigned long result;
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: lld %1, %2 # atomic64_sub_if_positive\n"
|
||||
" dsubu %0, %1, %3 \n"
|
||||
" bltz %0, 1f \n"
|
||||
" scd %0, %2 \n"
|
||||
" .set noreorder \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" dsubu %0, %1, %3 \n"
|
||||
" .set reorder \n"
|
||||
"1: \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: lld %1, %2 # atomic64_sub_if_positive\n"
|
||||
" dsubu %0, %1, %3 \n"
|
||||
" bltz %0, 1f \n"
|
||||
" scd %0, %2 \n"
|
||||
" .set noreorder \n"
|
||||
" beqz %0, 2f \n"
|
||||
" dsubu %0, %1, %3 \n"
|
||||
" .set reorder \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
"1: \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
|
||||
: "Ir" (i), "m" (v->counter)
|
||||
: "memory");
|
||||
} else {
|
||||
unsigned long flags;
|
||||
|
||||
raw_local_irq_save(flags);
|
||||
result = v->counter;
|
||||
result -= i;
|
||||
if (result >= 0)
|
||||
v->counter = result;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#define atomic64_cmpxchg(v, o, n) \
|
||||
((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
|
||||
#define atomic64_xchg(v, new) (xchg(&((v)->counter), (new)))
|
||||
|
||||
/**
|
||||
* atomic64_add_unless - add unless the number is a given value
|
||||
* @v: pointer of type atomic64_t
|
||||
* @a: the amount to add to v...
|
||||
* @u: ...unless v is equal to u.
|
||||
*
|
||||
* Atomically adds @a to @v, so long as it was not @u.
|
||||
* Returns non-zero if @v was not @u, and zero otherwise.
|
||||
*/
|
||||
static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
|
||||
{
|
||||
long c, old;
|
||||
c = atomic64_read(v);
|
||||
for (;;) {
|
||||
if (unlikely(c == (u)))
|
||||
break;
|
||||
old = atomic64_cmpxchg((v), c, c + (a));
|
||||
if (likely(old == c))
|
||||
break;
|
||||
c = old;
|
||||
}
|
||||
return c != (u);
|
||||
}
|
||||
|
||||
#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
|
||||
|
||||
#define atomic64_dec_return(v) atomic64_sub_return(1, (v))
|
||||
#define atomic64_inc_return(v) atomic64_add_return(1, (v))
|
||||
|
||||
/*
|
||||
* atomic64_sub_and_test - subtract value from variable and test result
|
||||
* @i: integer value to subtract
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
* Atomically subtracts @i from @v and returns
|
||||
* true if the result is zero, or false for all
|
||||
* other cases.
|
||||
*/
|
||||
#define atomic64_sub_and_test(i, v) (atomic64_sub_return((i), (v)) == 0)
|
||||
|
||||
/*
|
||||
* atomic64_inc_and_test - increment and test
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
* Atomically increments @v by 1
|
||||
* and returns true if the result is zero, or false for all
|
||||
* other cases.
|
||||
*/
|
||||
#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
|
||||
|
||||
/*
|
||||
* atomic64_dec_and_test - decrement by 1 and test
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
* Atomically decrements @v by 1 and
|
||||
* returns true if the result is 0, or false for all other
|
||||
* cases.
|
||||
*/
|
||||
#define atomic64_dec_and_test(v) (atomic64_sub_return(1, (v)) == 0)
|
||||
|
||||
/*
|
||||
* atomic64_dec_if_positive - decrement by 1 if old value positive
|
||||
* @v: pointer of type atomic64_t
|
||||
*/
|
||||
#define atomic64_dec_if_positive(v) atomic64_sub_if_positive(1, v)
|
||||
|
||||
/*
|
||||
* atomic64_inc - increment atomic variable
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
* Atomically increments @v by 1.
|
||||
*/
|
||||
#define atomic64_inc(v) atomic64_add(1, (v))
|
||||
|
||||
/*
|
||||
* atomic64_dec - decrement and test
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
* Atomically decrements @v by 1.
|
||||
*/
|
||||
#define atomic64_dec(v) atomic64_sub(1, (v))
|
||||
|
||||
/*
|
||||
* atomic64_add_negative - add and test if negative
|
||||
* @v: pointer of type atomic64_t
|
||||
* @i: integer value to add
|
||||
*
|
||||
* Atomically adds @i to @v and returns true
|
||||
* if the result is negative, or false when
|
||||
* result is greater than or equal to zero.
|
||||
*/
|
||||
#define atomic64_add_negative(i, v) (atomic64_add_return(i, (v)) < 0)
|
||||
|
||||
#endif /* CONFIG_64BIT */
|
||||
|
||||
/*
|
||||
* atomic*_return operations are serializing but not the non-*_return
|
||||
* versions.
|
||||
*/
|
||||
#define smp_mb__before_atomic_dec() smp_llsc_mb()
|
||||
#define smp_mb__after_atomic_dec() smp_llsc_mb()
|
||||
#define smp_mb__before_atomic_inc() smp_llsc_mb()
|
||||
#define smp_mb__after_atomic_inc() smp_llsc_mb()
|
||||
|
||||
#include <asm-generic/atomic.h>
|
||||
|
||||
#endif /* _ASM_ATOMIC_H */
|
||||
4
arch/mips/include/asm/auxvec.h
Normal file
4
arch/mips/include/asm/auxvec.h
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _ASM_AUXVEC_H
|
||||
#define _ASM_AUXVEC_H
|
||||
|
||||
#endif /* _ASM_AUXVEC_H */
|
||||
155
arch/mips/include/asm/barrier.h
Normal file
155
arch/mips/include/asm/barrier.h
Normal file
|
|
@ -0,0 +1,155 @@
|
|||
/*
|
||||
* 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) 2006 by Ralf Baechle (ralf@linux-mips.org)
|
||||
*/
|
||||
#ifndef __ASM_BARRIER_H
|
||||
#define __ASM_BARRIER_H
|
||||
|
||||
/*
|
||||
* read_barrier_depends - Flush all pending reads that subsequents reads
|
||||
* depend on.
|
||||
*
|
||||
* No data-dependent reads from memory-like regions are ever reordered
|
||||
* over this barrier. All reads preceding this primitive are guaranteed
|
||||
* to access memory (but not necessarily other CPUs' caches) before any
|
||||
* reads following this primitive that depend on the data return by
|
||||
* any of the preceding reads. This primitive is much lighter weight than
|
||||
* rmb() on most CPUs, and is never heavier weight than is
|
||||
* rmb().
|
||||
*
|
||||
* These ordering constraints are respected by both the local CPU
|
||||
* and the compiler.
|
||||
*
|
||||
* Ordering is not guaranteed by anything other than these primitives,
|
||||
* not even by data dependencies. See the documentation for
|
||||
* memory_barrier() for examples and URLs to more information.
|
||||
*
|
||||
* For example, the following code would force ordering (the initial
|
||||
* value of "a" is zero, "b" is one, and "p" is "&a"):
|
||||
*
|
||||
* <programlisting>
|
||||
* CPU 0 CPU 1
|
||||
*
|
||||
* b = 2;
|
||||
* memory_barrier();
|
||||
* p = &b; q = p;
|
||||
* read_barrier_depends();
|
||||
* d = *q;
|
||||
* </programlisting>
|
||||
*
|
||||
* because the read of "*q" depends on the read of "p" and these
|
||||
* two reads are separated by a read_barrier_depends(). However,
|
||||
* the following code, with the same initial values for "a" and "b":
|
||||
*
|
||||
* <programlisting>
|
||||
* CPU 0 CPU 1
|
||||
*
|
||||
* a = 2;
|
||||
* memory_barrier();
|
||||
* b = 3; y = b;
|
||||
* read_barrier_depends();
|
||||
* x = a;
|
||||
* </programlisting>
|
||||
*
|
||||
* does not enforce ordering, since there is no data dependency between
|
||||
* the read of "a" and the read of "b". Therefore, on some CPUs, such
|
||||
* as Alpha, "y" could be set to 3 and "x" to 0. Use rmb()
|
||||
* in cases like this where there are no data dependencies.
|
||||
*/
|
||||
|
||||
#define read_barrier_depends() do { } while(0)
|
||||
#define smp_read_barrier_depends() do { } while(0)
|
||||
|
||||
#ifdef CONFIG_CPU_HAS_SYNC
|
||||
#define __sync() \
|
||||
__asm__ __volatile__( \
|
||||
".set push\n\t" \
|
||||
".set noreorder\n\t" \
|
||||
".set mips2\n\t" \
|
||||
"sync\n\t" \
|
||||
".set pop" \
|
||||
: /* no output */ \
|
||||
: /* no input */ \
|
||||
: "memory")
|
||||
#else
|
||||
#define __sync() do { } while(0)
|
||||
#endif
|
||||
|
||||
#define __fast_iob() \
|
||||
__asm__ __volatile__( \
|
||||
".set push\n\t" \
|
||||
".set noreorder\n\t" \
|
||||
"lw $0,%0\n\t" \
|
||||
"nop\n\t" \
|
||||
".set pop" \
|
||||
: /* no output */ \
|
||||
: "m" (*(int *)CKSEG1) \
|
||||
: "memory")
|
||||
|
||||
#define fast_wmb() __sync()
|
||||
#define fast_rmb() __sync()
|
||||
#define fast_mb() __sync()
|
||||
#ifdef CONFIG_SGI_IP28
|
||||
#define fast_iob() \
|
||||
__asm__ __volatile__( \
|
||||
".set push\n\t" \
|
||||
".set noreorder\n\t" \
|
||||
"lw $0,%0\n\t" \
|
||||
"sync\n\t" \
|
||||
"lw $0,%0\n\t" \
|
||||
".set pop" \
|
||||
: /* no output */ \
|
||||
: "m" (*(int *)CKSEG1ADDR(0x1fa00004)) \
|
||||
: "memory")
|
||||
#else
|
||||
#define fast_iob() \
|
||||
do { \
|
||||
__sync(); \
|
||||
__fast_iob(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CPU_HAS_WB
|
||||
|
||||
#include <asm/wbflush.h>
|
||||
|
||||
#define wmb() fast_wmb()
|
||||
#define rmb() fast_rmb()
|
||||
#define mb() wbflush()
|
||||
#define iob() wbflush()
|
||||
|
||||
#else /* !CONFIG_CPU_HAS_WB */
|
||||
|
||||
#define wmb() fast_wmb()
|
||||
#define rmb() fast_rmb()
|
||||
#define mb() fast_mb()
|
||||
#define iob() fast_iob()
|
||||
|
||||
#endif /* !CONFIG_CPU_HAS_WB */
|
||||
|
||||
#if defined(CONFIG_WEAK_ORDERING) && defined(CONFIG_SMP)
|
||||
#define __WEAK_ORDERING_MB " sync \n"
|
||||
#else
|
||||
#define __WEAK_ORDERING_MB " \n"
|
||||
#endif
|
||||
#if defined(CONFIG_WEAK_REORDERING_BEYOND_LLSC) && defined(CONFIG_SMP)
|
||||
#define __WEAK_LLSC_MB " sync \n"
|
||||
#else
|
||||
#define __WEAK_LLSC_MB " \n"
|
||||
#endif
|
||||
|
||||
#define smp_mb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
|
||||
#define smp_rmb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
|
||||
#define smp_wmb() __asm__ __volatile__(__WEAK_ORDERING_MB : : :"memory")
|
||||
|
||||
#define set_mb(var, value) \
|
||||
do { var = value; smp_mb(); } while (0)
|
||||
|
||||
#define smp_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
|
||||
#define smp_llsc_rmb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
|
||||
#define smp_llsc_wmb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory")
|
||||
|
||||
#endif /* __ASM_BARRIER_H */
|
||||
60
arch/mips/include/asm/bcache.h
Normal file
60
arch/mips/include/asm/bcache.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* 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) 1997, 1999 by Ralf Baechle
|
||||
* Copyright (c) 1999 Silicon Graphics, Inc.
|
||||
*/
|
||||
#ifndef _ASM_BCACHE_H
|
||||
#define _ASM_BCACHE_H
|
||||
|
||||
|
||||
/* Some R4000 / R4400 / R4600 / R5000 machines may have a non-dma-coherent,
|
||||
chipset implemented caches. On machines with other CPUs the CPU does the
|
||||
cache thing itself. */
|
||||
struct bcache_ops {
|
||||
void (*bc_enable)(void);
|
||||
void (*bc_disable)(void);
|
||||
void (*bc_wback_inv)(unsigned long page, unsigned long size);
|
||||
void (*bc_inv)(unsigned long page, unsigned long size);
|
||||
};
|
||||
|
||||
extern void indy_sc_init(void);
|
||||
|
||||
#ifdef CONFIG_BOARD_SCACHE
|
||||
|
||||
extern struct bcache_ops *bcops;
|
||||
|
||||
static inline void bc_enable(void)
|
||||
{
|
||||
bcops->bc_enable();
|
||||
}
|
||||
|
||||
static inline void bc_disable(void)
|
||||
{
|
||||
bcops->bc_disable();
|
||||
}
|
||||
|
||||
static inline void bc_wback_inv(unsigned long page, unsigned long size)
|
||||
{
|
||||
bcops->bc_wback_inv(page, size);
|
||||
}
|
||||
|
||||
static inline void bc_inv(unsigned long page, unsigned long size)
|
||||
{
|
||||
bcops->bc_inv(page, size);
|
||||
}
|
||||
|
||||
#else /* !defined(CONFIG_BOARD_SCACHE) */
|
||||
|
||||
/* Not R4000 / R4400 / R4600 / R5000. */
|
||||
|
||||
#define bc_enable() do { } while (0)
|
||||
#define bc_disable() do { } while (0)
|
||||
#define bc_wback_inv(page, size) do { } while (0)
|
||||
#define bc_inv(page, size) do { } while (0)
|
||||
|
||||
#endif /* !defined(CONFIG_BOARD_SCACHE) */
|
||||
|
||||
#endif /* _ASM_BCACHE_H */
|
||||
672
arch/mips/include/asm/bitops.h
Normal file
672
arch/mips/include/asm/bitops.h
Normal file
|
|
@ -0,0 +1,672 @@
|
|||
/*
|
||||
* 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) 1994 - 1997, 99, 2000, 06, 07 Ralf Baechle (ralf@linux-mips.org)
|
||||
* Copyright (c) 1999, 2000 Silicon Graphics, Inc.
|
||||
*/
|
||||
#ifndef _ASM_BITOPS_H
|
||||
#define _ASM_BITOPS_H
|
||||
|
||||
#ifndef _LINUX_BITOPS_H
|
||||
#error only <linux/bitops.h> can be included directly
|
||||
#endif
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/irqflags.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/barrier.h>
|
||||
#include <asm/bug.h>
|
||||
#include <asm/byteorder.h> /* sigh ... */
|
||||
#include <asm/cpu-features.h>
|
||||
#include <asm/sgidefs.h>
|
||||
#include <asm/war.h>
|
||||
|
||||
#if _MIPS_SZLONG == 32
|
||||
#define SZLONG_LOG 5
|
||||
#define SZLONG_MASK 31UL
|
||||
#define __LL "ll "
|
||||
#define __SC "sc "
|
||||
#define __INS "ins "
|
||||
#define __EXT "ext "
|
||||
#elif _MIPS_SZLONG == 64
|
||||
#define SZLONG_LOG 6
|
||||
#define SZLONG_MASK 63UL
|
||||
#define __LL "lld "
|
||||
#define __SC "scd "
|
||||
#define __INS "dins "
|
||||
#define __EXT "dext "
|
||||
#endif
|
||||
|
||||
/*
|
||||
* clear_bit() doesn't provide any barrier for the compiler.
|
||||
*/
|
||||
#define smp_mb__before_clear_bit() smp_llsc_mb()
|
||||
#define smp_mb__after_clear_bit() smp_llsc_mb()
|
||||
|
||||
/*
|
||||
* set_bit - Atomically set a bit in memory
|
||||
* @nr: the bit to set
|
||||
* @addr: the address to start counting from
|
||||
*
|
||||
* This function is atomic and may not be reordered. See __set_bit()
|
||||
* if you do not require the atomic guarantees.
|
||||
* Note that @nr may be almost arbitrarily large; this function is not
|
||||
* restricted to acting on a single-word quantity.
|
||||
*/
|
||||
static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned short bit = nr & SZLONG_MASK;
|
||||
unsigned long temp;
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # set_bit \n"
|
||||
" or %0, %2 \n"
|
||||
" " __SC "%0, %1 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (*m)
|
||||
: "ir" (1UL << bit), "m" (*m));
|
||||
#ifdef CONFIG_CPU_MIPSR2
|
||||
} else if (__builtin_constant_p(bit)) {
|
||||
__asm__ __volatile__(
|
||||
"1: " __LL "%0, %1 # set_bit \n"
|
||||
" " __INS "%0, %4, %2, 1 \n"
|
||||
" " __SC "%0, %1 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
: "=&r" (temp), "=m" (*m)
|
||||
: "ir" (bit), "m" (*m), "r" (~0));
|
||||
#endif /* CONFIG_CPU_MIPSR2 */
|
||||
} else if (cpu_has_llsc) {
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # set_bit \n"
|
||||
" or %0, %2 \n"
|
||||
" " __SC "%0, %1 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (*m)
|
||||
: "ir" (1UL << bit), "m" (*m));
|
||||
} else {
|
||||
volatile unsigned long *a = addr;
|
||||
unsigned long mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> SZLONG_LOG;
|
||||
mask = 1UL << bit;
|
||||
raw_local_irq_save(flags);
|
||||
*a |= mask;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* clear_bit - Clears a bit in memory
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to start counting from
|
||||
*
|
||||
* clear_bit() is atomic and may not be reordered. However, it does
|
||||
* not contain a memory barrier, so if it is used for locking purposes,
|
||||
* you should call smp_mb__before_clear_bit() and/or smp_mb__after_clear_bit()
|
||||
* in order to ensure changes are visible on other processors.
|
||||
*/
|
||||
static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned short bit = nr & SZLONG_MASK;
|
||||
unsigned long temp;
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # clear_bit \n"
|
||||
" and %0, %2 \n"
|
||||
" " __SC "%0, %1 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (*m)
|
||||
: "ir" (~(1UL << bit)), "m" (*m));
|
||||
#ifdef CONFIG_CPU_MIPSR2
|
||||
} else if (__builtin_constant_p(bit)) {
|
||||
__asm__ __volatile__(
|
||||
"1: " __LL "%0, %1 # clear_bit \n"
|
||||
" " __INS "%0, $0, %2, 1 \n"
|
||||
" " __SC "%0, %1 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
: "=&r" (temp), "=m" (*m)
|
||||
: "ir" (bit), "m" (*m));
|
||||
#endif /* CONFIG_CPU_MIPSR2 */
|
||||
} else if (cpu_has_llsc) {
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # clear_bit \n"
|
||||
" and %0, %2 \n"
|
||||
" " __SC "%0, %1 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (*m)
|
||||
: "ir" (~(1UL << bit)), "m" (*m));
|
||||
} else {
|
||||
volatile unsigned long *a = addr;
|
||||
unsigned long mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> SZLONG_LOG;
|
||||
mask = 1UL << bit;
|
||||
raw_local_irq_save(flags);
|
||||
*a &= ~mask;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* clear_bit_unlock - Clears a bit in memory
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to start counting from
|
||||
*
|
||||
* clear_bit() is atomic and implies release semantics before the memory
|
||||
* operation. It can be used for an unlock.
|
||||
*/
|
||||
static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
smp_mb__before_clear_bit();
|
||||
clear_bit(nr, addr);
|
||||
}
|
||||
|
||||
/*
|
||||
* change_bit - Toggle a bit in memory
|
||||
* @nr: Bit to change
|
||||
* @addr: Address to start counting from
|
||||
*
|
||||
* change_bit() is atomic and may not be reordered.
|
||||
* Note that @nr may be almost arbitrarily large; this function is not
|
||||
* restricted to acting on a single-word quantity.
|
||||
*/
|
||||
static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
unsigned short bit = nr & SZLONG_MASK;
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # change_bit \n"
|
||||
" xor %0, %2 \n"
|
||||
" " __SC "%0, %1 \n"
|
||||
" beqzl %0, 1b \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (*m)
|
||||
: "ir" (1UL << bit), "m" (*m));
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # change_bit \n"
|
||||
" xor %0, %2 \n"
|
||||
" " __SC "%0, %1 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (*m)
|
||||
: "ir" (1UL << bit), "m" (*m));
|
||||
} else {
|
||||
volatile unsigned long *a = addr;
|
||||
unsigned long mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> SZLONG_LOG;
|
||||
mask = 1UL << bit;
|
||||
raw_local_irq_save(flags);
|
||||
*a ^= mask;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* test_and_set_bit - Set a bit and return its old value
|
||||
* @nr: Bit to set
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is atomic and cannot be reordered.
|
||||
* It also implies a memory barrier.
|
||||
*/
|
||||
static inline int test_and_set_bit(unsigned long nr,
|
||||
volatile unsigned long *addr)
|
||||
{
|
||||
unsigned short bit = nr & SZLONG_MASK;
|
||||
unsigned long res;
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # test_and_set_bit \n"
|
||||
" or %2, %0, %3 \n"
|
||||
" " __SC "%2, %1 \n"
|
||||
" beqzl %2, 1b \n"
|
||||
" and %2, %0, %3 \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (*m), "=&r" (res)
|
||||
: "r" (1UL << bit), "m" (*m)
|
||||
: "memory");
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set push \n"
|
||||
" .set noreorder \n"
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # test_and_set_bit \n"
|
||||
" or %2, %0, %3 \n"
|
||||
" " __SC "%2, %1 \n"
|
||||
" beqz %2, 2f \n"
|
||||
" and %2, %0, %3 \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" nop \n"
|
||||
" .previous \n"
|
||||
" .set pop \n"
|
||||
: "=&r" (temp), "=m" (*m), "=&r" (res)
|
||||
: "r" (1UL << bit), "m" (*m)
|
||||
: "memory");
|
||||
} else {
|
||||
volatile unsigned long *a = addr;
|
||||
unsigned long mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> SZLONG_LOG;
|
||||
mask = 1UL << bit;
|
||||
raw_local_irq_save(flags);
|
||||
res = (mask & *a);
|
||||
*a |= mask;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
return res != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* test_and_set_bit_lock - Set a bit and return its old value
|
||||
* @nr: Bit to set
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is atomic and implies acquire ordering semantics
|
||||
* after the memory operation.
|
||||
*/
|
||||
static inline int test_and_set_bit_lock(unsigned long nr,
|
||||
volatile unsigned long *addr)
|
||||
{
|
||||
unsigned short bit = nr & SZLONG_MASK;
|
||||
unsigned long res;
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # test_and_set_bit \n"
|
||||
" or %2, %0, %3 \n"
|
||||
" " __SC "%2, %1 \n"
|
||||
" beqzl %2, 1b \n"
|
||||
" and %2, %0, %3 \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (*m), "=&r" (res)
|
||||
: "r" (1UL << bit), "m" (*m)
|
||||
: "memory");
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set push \n"
|
||||
" .set noreorder \n"
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # test_and_set_bit \n"
|
||||
" or %2, %0, %3 \n"
|
||||
" " __SC "%2, %1 \n"
|
||||
" beqz %2, 2f \n"
|
||||
" and %2, %0, %3 \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" nop \n"
|
||||
" .previous \n"
|
||||
" .set pop \n"
|
||||
: "=&r" (temp), "=m" (*m), "=&r" (res)
|
||||
: "r" (1UL << bit), "m" (*m)
|
||||
: "memory");
|
||||
} else {
|
||||
volatile unsigned long *a = addr;
|
||||
unsigned long mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> SZLONG_LOG;
|
||||
mask = 1UL << bit;
|
||||
raw_local_irq_save(flags);
|
||||
res = (mask & *a);
|
||||
*a |= mask;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
return res != 0;
|
||||
}
|
||||
/*
|
||||
* test_and_clear_bit - Clear a bit and return its old value
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is atomic and cannot be reordered.
|
||||
* It also implies a memory barrier.
|
||||
*/
|
||||
static inline int test_and_clear_bit(unsigned long nr,
|
||||
volatile unsigned long *addr)
|
||||
{
|
||||
unsigned short bit = nr & SZLONG_MASK;
|
||||
unsigned long res;
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # test_and_clear_bit \n"
|
||||
" or %2, %0, %3 \n"
|
||||
" xor %2, %3 \n"
|
||||
" " __SC "%2, %1 \n"
|
||||
" beqzl %2, 1b \n"
|
||||
" and %2, %0, %3 \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (*m), "=&r" (res)
|
||||
: "r" (1UL << bit), "m" (*m)
|
||||
: "memory");
|
||||
#ifdef CONFIG_CPU_MIPSR2
|
||||
} else if (__builtin_constant_p(nr)) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"1: " __LL "%0, %1 # test_and_clear_bit \n"
|
||||
" " __EXT "%2, %0, %3, 1 \n"
|
||||
" " __INS "%0, $0, %3, 1 \n"
|
||||
" " __SC "%0, %1 \n"
|
||||
" beqz %0, 2f \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" .previous \n"
|
||||
: "=&r" (temp), "=m" (*m), "=&r" (res)
|
||||
: "ir" (bit), "m" (*m)
|
||||
: "memory");
|
||||
#endif
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set push \n"
|
||||
" .set noreorder \n"
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # test_and_clear_bit \n"
|
||||
" or %2, %0, %3 \n"
|
||||
" xor %2, %3 \n"
|
||||
" " __SC "%2, %1 \n"
|
||||
" beqz %2, 2f \n"
|
||||
" and %2, %0, %3 \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" nop \n"
|
||||
" .previous \n"
|
||||
" .set pop \n"
|
||||
: "=&r" (temp), "=m" (*m), "=&r" (res)
|
||||
: "r" (1UL << bit), "m" (*m)
|
||||
: "memory");
|
||||
} else {
|
||||
volatile unsigned long *a = addr;
|
||||
unsigned long mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> SZLONG_LOG;
|
||||
mask = 1UL << bit;
|
||||
raw_local_irq_save(flags);
|
||||
res = (mask & *a);
|
||||
*a &= ~mask;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
return res != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* test_and_change_bit - Change a bit and return its old value
|
||||
* @nr: Bit to change
|
||||
* @addr: Address to count from
|
||||
*
|
||||
* This operation is atomic and cannot be reordered.
|
||||
* It also implies a memory barrier.
|
||||
*/
|
||||
static inline int test_and_change_bit(unsigned long nr,
|
||||
volatile unsigned long *addr)
|
||||
{
|
||||
unsigned short bit = nr & SZLONG_MASK;
|
||||
unsigned long res;
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
if (cpu_has_llsc && R10000_LLSC_WAR) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # test_and_change_bit \n"
|
||||
" xor %2, %0, %3 \n"
|
||||
" " __SC "%2, %1 \n"
|
||||
" beqzl %2, 1b \n"
|
||||
" and %2, %0, %3 \n"
|
||||
" .set mips0 \n"
|
||||
: "=&r" (temp), "=m" (*m), "=&r" (res)
|
||||
: "r" (1UL << bit), "m" (*m)
|
||||
: "memory");
|
||||
} else if (cpu_has_llsc) {
|
||||
unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
|
||||
unsigned long temp;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" .set push \n"
|
||||
" .set noreorder \n"
|
||||
" .set mips3 \n"
|
||||
"1: " __LL "%0, %1 # test_and_change_bit \n"
|
||||
" xor %2, %0, %3 \n"
|
||||
" " __SC "\t%2, %1 \n"
|
||||
" beqz %2, 2f \n"
|
||||
" and %2, %0, %3 \n"
|
||||
" .subsection 2 \n"
|
||||
"2: b 1b \n"
|
||||
" nop \n"
|
||||
" .previous \n"
|
||||
" .set pop \n"
|
||||
: "=&r" (temp), "=m" (*m), "=&r" (res)
|
||||
: "r" (1UL << bit), "m" (*m)
|
||||
: "memory");
|
||||
} else {
|
||||
volatile unsigned long *a = addr;
|
||||
unsigned long mask;
|
||||
unsigned long flags;
|
||||
|
||||
a += nr >> SZLONG_LOG;
|
||||
mask = 1UL << bit;
|
||||
raw_local_irq_save(flags);
|
||||
res = (mask & *a);
|
||||
*a ^= mask;
|
||||
raw_local_irq_restore(flags);
|
||||
}
|
||||
|
||||
smp_llsc_mb();
|
||||
|
||||
return res != 0;
|
||||
}
|
||||
|
||||
#include <asm-generic/bitops/non-atomic.h>
|
||||
|
||||
/*
|
||||
* __clear_bit_unlock - Clears a bit in memory
|
||||
* @nr: Bit to clear
|
||||
* @addr: Address to start counting from
|
||||
*
|
||||
* __clear_bit() is non-atomic and implies release semantics before the memory
|
||||
* operation. It can be used for an unlock if no other CPUs can concurrently
|
||||
* modify other bits in the word.
|
||||
*/
|
||||
static inline void __clear_bit_unlock(unsigned long nr, volatile unsigned long *addr)
|
||||
{
|
||||
smp_mb();
|
||||
__clear_bit(nr, addr);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
|
||||
|
||||
/*
|
||||
* Return the bit position (0..63) of the most significant 1 bit in a word
|
||||
* Returns -1 if no 1 bit exists
|
||||
*/
|
||||
static inline unsigned long __fls(unsigned long x)
|
||||
{
|
||||
int lz;
|
||||
|
||||
if (sizeof(x) == 4) {
|
||||
__asm__(
|
||||
" .set push \n"
|
||||
" .set mips32 \n"
|
||||
" clz %0, %1 \n"
|
||||
" .set pop \n"
|
||||
: "=r" (lz)
|
||||
: "r" (x));
|
||||
|
||||
return 31 - lz;
|
||||
}
|
||||
|
||||
BUG_ON(sizeof(x) != 8);
|
||||
|
||||
__asm__(
|
||||
" .set push \n"
|
||||
" .set mips64 \n"
|
||||
" dclz %0, %1 \n"
|
||||
" .set pop \n"
|
||||
: "=r" (lz)
|
||||
: "r" (x));
|
||||
|
||||
return 63 - lz;
|
||||
}
|
||||
|
||||
/*
|
||||
* __ffs - find first bit in word.
|
||||
* @word: The word to search
|
||||
*
|
||||
* Returns 0..SZLONG-1
|
||||
* Undefined if no bit exists, so code should check against 0 first.
|
||||
*/
|
||||
static inline unsigned long __ffs(unsigned long word)
|
||||
{
|
||||
return __fls(word & -word);
|
||||
}
|
||||
|
||||
/*
|
||||
* fls - find last bit set.
|
||||
* @word: The word to search
|
||||
*
|
||||
* This is defined the same way as ffs.
|
||||
* Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
|
||||
*/
|
||||
static inline int fls(int word)
|
||||
{
|
||||
__asm__("clz %0, %1" : "=r" (word) : "r" (word));
|
||||
|
||||
return 32 - word;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_64BIT) && defined(CONFIG_CPU_MIPS64)
|
||||
static inline int fls64(__u64 word)
|
||||
{
|
||||
__asm__("dclz %0, %1" : "=r" (word) : "r" (word));
|
||||
|
||||
return 64 - word;
|
||||
}
|
||||
#else
|
||||
#include <asm-generic/bitops/fls64.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ffs - find first bit set.
|
||||
* @word: The word to search
|
||||
*
|
||||
* This is defined the same way as
|
||||
* the libc and compiler builtin ffs routines, therefore
|
||||
* differs in spirit from the above ffz (man ffs).
|
||||
*/
|
||||
static inline int ffs(int word)
|
||||
{
|
||||
if (!word)
|
||||
return 0;
|
||||
|
||||
return fls(word & -word);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <asm-generic/bitops/__ffs.h>
|
||||
#include <asm-generic/bitops/__fls.h>
|
||||
#include <asm-generic/bitops/ffs.h>
|
||||
#include <asm-generic/bitops/fls.h>
|
||||
#include <asm-generic/bitops/fls64.h>
|
||||
|
||||
#endif /*defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) */
|
||||
|
||||
#include <asm-generic/bitops/ffz.h>
|
||||
#include <asm-generic/bitops/find.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <asm-generic/bitops/sched.h>
|
||||
#include <asm-generic/bitops/hweight.h>
|
||||
#include <asm-generic/bitops/ext2-non-atomic.h>
|
||||
#include <asm-generic/bitops/ext2-atomic.h>
|
||||
#include <asm-generic/bitops/minix.h>
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _ASM_BITOPS_H */
|
||||
110
arch/mips/include/asm/bootinfo.h
Normal file
110
arch/mips/include/asm/bootinfo.h
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* 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) 1995, 1996, 2003 by Ralf Baechle
|
||||
* Copyright (C) 1995, 1996 Andreas Busse
|
||||
* Copyright (C) 1995, 1996 Stoned Elipot
|
||||
* Copyright (C) 1995, 1996 Paul M. Antoine.
|
||||
*/
|
||||
#ifndef _ASM_BOOTINFO_H
|
||||
#define _ASM_BOOTINFO_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <asm/setup.h>
|
||||
|
||||
/*
|
||||
* The MACH_ IDs are sort of equivalent to PCI product IDs. As such the
|
||||
* numbers do not necessarily reflect technical relations or similarities
|
||||
* between systems.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Valid machtype values for group unknown
|
||||
*/
|
||||
#define MACH_UNKNOWN 0 /* whatever... */
|
||||
|
||||
/*
|
||||
* Valid machtype for group DEC
|
||||
*/
|
||||
#define MACH_DSUNKNOWN 0
|
||||
#define MACH_DS23100 1 /* DECstation 2100 or 3100 */
|
||||
#define MACH_DS5100 2 /* DECsystem 5100 */
|
||||
#define MACH_DS5000_200 3 /* DECstation 5000/200 */
|
||||
#define MACH_DS5000_1XX 4 /* DECstation 5000/120, 125, 133, 150 */
|
||||
#define MACH_DS5000_XX 5 /* DECstation 5000/20, 25, 33, 50 */
|
||||
#define MACH_DS5000_2X0 6 /* DECstation 5000/240, 260 */
|
||||
#define MACH_DS5400 7 /* DECsystem 5400 */
|
||||
#define MACH_DS5500 8 /* DECsystem 5500 */
|
||||
#define MACH_DS5800 9 /* DECsystem 5800 */
|
||||
#define MACH_DS5900 10 /* DECsystem 5900 */
|
||||
|
||||
/*
|
||||
* Valid machtype for group PMC-MSP
|
||||
*/
|
||||
#define MACH_MSP4200_EVAL 0 /* PMC-Sierra MSP4200 Evaluation */
|
||||
#define MACH_MSP4200_GW 1 /* PMC-Sierra MSP4200 Gateway demo */
|
||||
#define MACH_MSP4200_FPGA 2 /* PMC-Sierra MSP4200 Emulation */
|
||||
#define MACH_MSP7120_EVAL 3 /* PMC-Sierra MSP7120 Evaluation */
|
||||
#define MACH_MSP7120_GW 4 /* PMC-Sierra MSP7120 Residential GW */
|
||||
#define MACH_MSP7120_FPGA 5 /* PMC-Sierra MSP7120 Emulation */
|
||||
#define MACH_MSP_OTHER 255 /* PMC-Sierra unknown board type */
|
||||
|
||||
/*
|
||||
* Valid machtype for group Mikrotik
|
||||
*/
|
||||
#define MACH_MIKROTIK_RB532 0 /* Mikrotik RouterBoard 532 */
|
||||
#define MACH_MIKROTIK_RB532A 1 /* Mikrotik RouterBoard 532A */
|
||||
|
||||
#define CL_SIZE COMMAND_LINE_SIZE
|
||||
|
||||
extern char *system_type;
|
||||
const char *get_system_type(void);
|
||||
|
||||
extern unsigned long mips_machtype;
|
||||
|
||||
#define BOOT_MEM_MAP_MAX 32
|
||||
#define BOOT_MEM_RAM 1
|
||||
#define BOOT_MEM_ROM_DATA 2
|
||||
#define BOOT_MEM_RESERVED 3
|
||||
|
||||
/*
|
||||
* A memory map that's built upon what was determined
|
||||
* or specified on the command line.
|
||||
*/
|
||||
struct boot_mem_map {
|
||||
int nr_map;
|
||||
struct boot_mem_map_entry {
|
||||
phys_t addr; /* start of memory segment */
|
||||
phys_t size; /* size of memory segment */
|
||||
long type; /* type of memory segment */
|
||||
} map[BOOT_MEM_MAP_MAX];
|
||||
};
|
||||
|
||||
extern struct boot_mem_map boot_mem_map;
|
||||
|
||||
extern void add_memory_region(phys_t start, phys_t size, long type);
|
||||
|
||||
extern void prom_init(void);
|
||||
extern void prom_free_prom_memory(void);
|
||||
|
||||
extern void free_init_pages(const char *what,
|
||||
unsigned long begin, unsigned long end);
|
||||
|
||||
/*
|
||||
* Initial kernel command line, usually setup by prom_init()
|
||||
*/
|
||||
extern char arcs_cmdline[CL_SIZE];
|
||||
|
||||
/*
|
||||
* Registers a0, a1, a3 and a4 as passed to the kernel entry by firmware
|
||||
*/
|
||||
extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
|
||||
|
||||
/*
|
||||
* Platform memory detection hook called by setup_arch
|
||||
*/
|
||||
extern void plat_mem_setup(void);
|
||||
|
||||
#endif /* _ASM_BOOTINFO_H */
|
||||
38
arch/mips/include/asm/branch.h
Normal file
38
arch/mips/include/asm/branch.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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) 1996, 1997, 1998, 2001 by Ralf Baechle
|
||||
*/
|
||||
#ifndef _ASM_BRANCH_H
|
||||
#define _ASM_BRANCH_H
|
||||
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
static inline int delay_slot(struct pt_regs *regs)
|
||||
{
|
||||
return regs->cp0_cause & CAUSEF_BD;
|
||||
}
|
||||
|
||||
static inline unsigned long exception_epc(struct pt_regs *regs)
|
||||
{
|
||||
if (!delay_slot(regs))
|
||||
return regs->cp0_epc;
|
||||
|
||||
return regs->cp0_epc + 4;
|
||||
}
|
||||
|
||||
extern int __compute_return_epc(struct pt_regs *regs);
|
||||
|
||||
static inline int compute_return_epc(struct pt_regs *regs)
|
||||
{
|
||||
if (!delay_slot(regs)) {
|
||||
regs->cp0_epc += 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return __compute_return_epc(regs);
|
||||
}
|
||||
|
||||
#endif /* _ASM_BRANCH_H */
|
||||
34
arch/mips/include/asm/break.h
Normal file
34
arch/mips/include/asm/break.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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) 1995, 2003 by Ralf Baechle
|
||||
* Copyright (C) 1999 Silicon Graphics, Inc.
|
||||
*/
|
||||
#ifndef __ASM_BREAK_H
|
||||
#define __ASM_BREAK_H
|
||||
|
||||
/*
|
||||
* The following break codes are or were in use for specific purposes in
|
||||
* other MIPS operating systems. Linux/MIPS doesn't use all of them. The
|
||||
* unused ones are here as placeholders; we might encounter them in
|
||||
* non-Linux/MIPS object files or make use of them in the future.
|
||||
*/
|
||||
#define BRK_USERBP 0 /* User bp (used by debuggers) */
|
||||
#define BRK_KERNELBP 1 /* Break in the kernel */
|
||||
#define BRK_ABORT 2 /* Sometimes used by abort(3) to SIGIOT */
|
||||
#define BRK_BD_TAKEN 3 /* For bd slot emulation - not implemented */
|
||||
#define BRK_BD_NOTTAKEN 4 /* For bd slot emulation - not implemented */
|
||||
#define BRK_SSTEPBP 5 /* User bp (used by debuggers) */
|
||||
#define BRK_OVERFLOW 6 /* Overflow check */
|
||||
#define BRK_DIVZERO 7 /* Divide by zero check */
|
||||
#define BRK_RANGE 8 /* Range error check */
|
||||
#define BRK_STACKOVERFLOW 9 /* For Ada stackchecking */
|
||||
#define BRK_NORLD 10 /* No rld found - not used by Linux/MIPS */
|
||||
#define _BRK_THREADBP 11 /* For threads, user bp (used by debuggers) */
|
||||
#define BRK_BUG 512 /* Used by BUG() */
|
||||
#define BRK_KDB 513 /* Used in KDB_ENTER() */
|
||||
#define BRK_MULOVF 1023 /* Multiply overflow */
|
||||
|
||||
#endif /* __ASM_BREAK_H */
|
||||
33
arch/mips/include/asm/bug.h
Normal file
33
arch/mips/include/asm/bug.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef __ASM_BUG_H
|
||||
#define __ASM_BUG_H
|
||||
|
||||
#include <asm/sgidefs.h>
|
||||
|
||||
#ifdef CONFIG_BUG
|
||||
|
||||
#include <asm/break.h>
|
||||
|
||||
#define BUG() \
|
||||
do { \
|
||||
__asm__ __volatile__("break %0" : : "i" (BRK_BUG)); \
|
||||
} while (0)
|
||||
|
||||
#define HAVE_ARCH_BUG
|
||||
|
||||
#if (_MIPS_ISA > _MIPS_ISA_MIPS1)
|
||||
|
||||
#define BUG_ON(condition) \
|
||||
do { \
|
||||
__asm__ __volatile__("tne $0, %0, %1" \
|
||||
: : "r" (condition), "i" (BRK_BUG)); \
|
||||
} while (0)
|
||||
|
||||
#define HAVE_ARCH_BUG_ON
|
||||
|
||||
#endif /* _MIPS_ISA > _MIPS_ISA_MIPS1 */
|
||||
|
||||
#endif
|
||||
|
||||
#include <asm-generic/bug.h>
|
||||
|
||||
#endif /* __ASM_BUG_H */
|
||||
53
arch/mips/include/asm/bugs.h
Normal file
53
arch/mips/include/asm/bugs.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* This is included by init/main.c to check for architecture-dependent bugs.
|
||||
*
|
||||
* Copyright (C) 2007 Maciej W. Rozycki
|
||||
*
|
||||
* Needs:
|
||||
* void check_bugs(void);
|
||||
*/
|
||||
#ifndef _ASM_BUGS_H
|
||||
#define _ASM_BUGS_H
|
||||
|
||||
#include <linux/bug.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <asm/cpu.h>
|
||||
#include <asm/cpu-info.h>
|
||||
|
||||
extern int daddiu_bug;
|
||||
|
||||
extern void check_bugs64_early(void);
|
||||
|
||||
extern void check_bugs32(void);
|
||||
extern void check_bugs64(void);
|
||||
|
||||
static inline void check_bugs_early(void)
|
||||
{
|
||||
#ifdef CONFIG_64BIT
|
||||
check_bugs64_early();
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void check_bugs(void)
|
||||
{
|
||||
unsigned int cpu = smp_processor_id();
|
||||
|
||||
cpu_data[cpu].udelay_val = loops_per_jiffy;
|
||||
check_bugs32();
|
||||
#ifdef CONFIG_64BIT
|
||||
check_bugs64();
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int r4k_daddiu_bug(void)
|
||||
{
|
||||
#ifdef CONFIG_64BIT
|
||||
WARN_ON(daddiu_bug < 0);
|
||||
return daddiu_bug != 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* _ASM_BUGS_H */
|
||||
76
arch/mips/include/asm/byteorder.h
Normal file
76
arch/mips/include/asm/byteorder.h
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* 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) 1996, 99, 2003 by Ralf Baechle
|
||||
*/
|
||||
#ifndef _ASM_BYTEORDER_H
|
||||
#define _ASM_BYTEORDER_H
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/types.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#ifdef CONFIG_CPU_MIPSR2
|
||||
|
||||
static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
|
||||
{
|
||||
__asm__(
|
||||
" wsbh %0, %1 \n"
|
||||
: "=r" (x)
|
||||
: "r" (x));
|
||||
|
||||
return x;
|
||||
}
|
||||
#define __arch__swab16(x) ___arch__swab16(x)
|
||||
|
||||
static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
|
||||
{
|
||||
__asm__(
|
||||
" wsbh %0, %1 \n"
|
||||
" rotr %0, %0, 16 \n"
|
||||
: "=r" (x)
|
||||
: "r" (x));
|
||||
|
||||
return x;
|
||||
}
|
||||
#define __arch__swab32(x) ___arch__swab32(x)
|
||||
|
||||
#ifdef CONFIG_CPU_MIPS64_R2
|
||||
|
||||
static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
|
||||
{
|
||||
__asm__(
|
||||
" dsbh %0, %1 \n"
|
||||
" dshd %0, %0 \n"
|
||||
" drotr %0, %0, 32 \n"
|
||||
: "=r" (x)
|
||||
: "r" (x));
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
#define __arch__swab64(x) ___arch__swab64(x)
|
||||
|
||||
#endif /* CONFIG_CPU_MIPS64_R2 */
|
||||
|
||||
#endif /* CONFIG_CPU_MIPSR2 */
|
||||
|
||||
#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
|
||||
# define __BYTEORDER_HAS_U64__
|
||||
# define __SWAB_64_THRU_32__
|
||||
#endif
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#if defined(__MIPSEB__)
|
||||
# include <linux/byteorder/big_endian.h>
|
||||
#elif defined(__MIPSEL__)
|
||||
# include <linux/byteorder/little_endian.h>
|
||||
#else
|
||||
# error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_BYTEORDER_H */
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue