avionic design with actual uboot and tooling
submodule of avionic design uboot bootloader and with included tools to get you started , read readme.md and readme-tk1-loader.md
This commit is contained in:
138
u-boot/arch/arc/Kconfig
Normal file
138
u-boot/arch/arc/Kconfig
Normal file
@@ -0,0 +1,138 @@
|
||||
menu "ARC architecture"
|
||||
depends on ARC
|
||||
|
||||
config SYS_ARCH
|
||||
default "arc"
|
||||
|
||||
config SYS_CPU
|
||||
default "arcv1" if ISA_ARCOMPACT
|
||||
default "arcv2" if ISA_ARCV2
|
||||
|
||||
choice
|
||||
prompt "ARC Instruction Set"
|
||||
default ISA_ARCOMPACT
|
||||
|
||||
config ISA_ARCOMPACT
|
||||
bool "ARCompact ISA"
|
||||
help
|
||||
The original ARC ISA of ARC600/700 cores
|
||||
|
||||
config ISA_ARCV2
|
||||
bool "ARC ISA v2"
|
||||
help
|
||||
ISA for the Next Generation ARC-HS cores
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "CPU selection"
|
||||
default CPU_ARC770D if ISA_ARCOMPACT
|
||||
default CPU_ARCHS38 if ISA_ARCV2
|
||||
|
||||
config CPU_ARC750D
|
||||
bool "ARC 750D"
|
||||
select ARC_MMU_V2
|
||||
depends on ISA_ARCOMPACT
|
||||
help
|
||||
Choose this option to build an U-Boot for ARC750D CPU.
|
||||
|
||||
config CPU_ARC770D
|
||||
bool "ARC 770D"
|
||||
select ARC_MMU_V3
|
||||
depends on ISA_ARCOMPACT
|
||||
help
|
||||
Choose this option to build an U-Boot for ARC770D CPU.
|
||||
|
||||
config CPU_ARCEM6
|
||||
bool "ARC EM6"
|
||||
select ARC_MMU_ABSENT
|
||||
depends on ISA_ARCV2
|
||||
help
|
||||
Next Generation ARC Core based on ISA-v2 ISA without MMU.
|
||||
|
||||
config CPU_ARCHS36
|
||||
bool "ARC HS36"
|
||||
select ARC_MMU_ABSENT
|
||||
depends on ISA_ARCV2
|
||||
help
|
||||
Next Generation ARC Core based on ISA-v2 ISA without MMU.
|
||||
|
||||
config CPU_ARCHS38
|
||||
bool "ARC HS38"
|
||||
select ARC_MMU_V4
|
||||
depends on ISA_ARCV2
|
||||
help
|
||||
Next Generation ARC Core based on ISA-v2 ISA with MMU.
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "MMU Version"
|
||||
default ARC_MMU_V3 if CPU_ARC770D
|
||||
default ARC_MMU_V2 if CPU_ARC750D
|
||||
default ARC_MMU_ABSENT if CPU_ARCEM6
|
||||
default ARC_MMU_ABSENT if CPU_ARCHS36
|
||||
default ARC_MMU_V4 if CPU_ARCHS38
|
||||
|
||||
config ARC_MMU_ABSENT
|
||||
bool "No MMU"
|
||||
help
|
||||
No MMU
|
||||
|
||||
config ARC_MMU_V2
|
||||
bool "MMU v2"
|
||||
depends on CPU_ARC750D
|
||||
help
|
||||
Fixed the deficiency of v1 - possible thrashing in memcpy sceanrio
|
||||
when 2 D-TLB and 1 I-TLB entries index into same 2way set.
|
||||
|
||||
config ARC_MMU_V3
|
||||
bool "MMU v3"
|
||||
depends on CPU_ARC770D
|
||||
help
|
||||
Introduced with ARC700 4.10: New Features
|
||||
Variable Page size (1k-16k), var JTLB size 128 x (2 or 4)
|
||||
Shared Address Spaces (SASID)
|
||||
|
||||
config ARC_MMU_V4
|
||||
bool "MMU v4"
|
||||
depends on CPU_ARCHS38
|
||||
help
|
||||
Introduced as a part of ARC HS38 release.
|
||||
|
||||
endchoice
|
||||
|
||||
config CPU_BIG_ENDIAN
|
||||
bool "Enable Big Endian Mode"
|
||||
default n
|
||||
help
|
||||
Build kernel for Big Endian Mode of ARC CPU
|
||||
|
||||
config SYS_ICACHE_OFF
|
||||
bool "Do not use Instruction Cache"
|
||||
default n
|
||||
|
||||
config SYS_DCACHE_OFF
|
||||
bool "Do not use Data Cache"
|
||||
default n
|
||||
|
||||
choice
|
||||
prompt "Target select"
|
||||
default TARGET_AXS101
|
||||
|
||||
config TARGET_TB100
|
||||
bool "Support tb100"
|
||||
|
||||
config TARGET_ARCANGEL4
|
||||
bool "Support arcangel4"
|
||||
|
||||
config TARGET_AXS101
|
||||
bool "Support axs101"
|
||||
|
||||
endchoice
|
||||
|
||||
source "board/abilis/tb100/Kconfig"
|
||||
source "board/synopsys/Kconfig"
|
||||
source "board/synopsys/axs101/Kconfig"
|
||||
|
||||
endmenu
|
||||
21
u-boot/arch/arc/Makefile
Normal file
21
u-boot/arch/arc/Makefile
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
libs-y += arch/arc/cpu/$(CPU)/
|
||||
libs-y += arch/arc/lib/
|
||||
|
||||
# MetaWare debugger doesn't support PIE (position-independent executable)
|
||||
# so the only way to load U-Boot in MDB is to fake it by:
|
||||
# 1. Reset PIE flag in ELF header
|
||||
# 2. Strip all debug information from elf
|
||||
ifdef CONFIG_SYS_LITTLE_ENDIAN
|
||||
EXEC_TYPE_OFFSET=16
|
||||
else
|
||||
EXEC_TYPE_OFFSET=17
|
||||
endif
|
||||
|
||||
mdbtrick: u-boot
|
||||
$(Q)printf '\x02' | dd of=u-boot bs=1 seek=$(EXEC_TYPE_OFFSET) count=1 \
|
||||
conv=notrunc &> /dev/null
|
||||
$(Q)$(CROSS_COMPILE)strip -g u-boot
|
||||
59
u-boot/arch/arc/config.mk
Normal file
59
u-boot/arch/arc/config.mk
Normal file
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
ifndef CONFIG_CPU_BIG_ENDIAN
|
||||
CONFIG_SYS_LITTLE_ENDIAN = 1
|
||||
else
|
||||
CONFIG_SYS_BIG_ENDIAN = 1
|
||||
endif
|
||||
|
||||
ifdef CONFIG_SYS_LITTLE_ENDIAN
|
||||
ARC_CROSS_COMPILE := arc-linux-
|
||||
PLATFORM_LDFLAGS += -EL
|
||||
PLATFORM_CPPFLAGS += -mlittle-endian
|
||||
endif
|
||||
|
||||
ifdef CONFIG_SYS_BIG_ENDIAN
|
||||
ARC_CROSS_COMPILE := arceb-linux-
|
||||
PLATFORM_LDFLAGS += -EB
|
||||
PLATFORM_CPPFLAGS += -mbig-endian
|
||||
endif
|
||||
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
CROSS_COMPILE := $(ARC_CROSS_COMPILE)
|
||||
endif
|
||||
|
||||
ifdef CONFIG_ARC_MMU_VER
|
||||
CONFIG_MMU = 1
|
||||
endif
|
||||
|
||||
ifdef CONFIG_CPU_ARC750D
|
||||
PLATFORM_CPPFLAGS += -marc700
|
||||
endif
|
||||
|
||||
ifdef CONFIG_CPU_ARC770D
|
||||
PLATFORM_CPPFLAGS += -marc700 -mlock -mswape
|
||||
endif
|
||||
|
||||
ifdef CONFIG_CPU_ARCEM6
|
||||
PLATFORM_CPPFLAGS += -marcem
|
||||
endif
|
||||
|
||||
ifdef CONFIG_CPU_ARCHS34
|
||||
PLATFORM_CPPFLAGS += -mcpu=archs
|
||||
endif
|
||||
|
||||
ifdef CONFIG_CPU_ARCHS38
|
||||
PLATFORM_CPPFLAGS += -mcpu=archs
|
||||
endif
|
||||
|
||||
PLATFORM_CPPFLAGS += -ffixed-r25 -D__ARC__ -gdwarf-2
|
||||
|
||||
# Needed for relocation
|
||||
LDFLAGS_FINAL += -pie
|
||||
|
||||
# Load address for standalone apps
|
||||
CONFIG_STANDALONE_LOAD_ADDR ?= 0x82000000
|
||||
7
u-boot/arch/arc/cpu/arcv1/Makefile
Normal file
7
u-boot/arch/arc/cpu/arcv1/Makefile
Normal file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y += ivt.o
|
||||
27
u-boot/arch/arc/cpu/arcv1/ivt.S
Normal file
27
u-boot/arch/arc/cpu/arcv1/ivt.S
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
.section .ivt, "ax",@progbits
|
||||
.align 4
|
||||
_ivt:
|
||||
/* Critical system events */
|
||||
j _start /* 0 - 0x000 */
|
||||
j memory_error /* 1 - 0x008 */
|
||||
j instruction_error /* 2 - 0x010 */
|
||||
|
||||
/* Device interrupts */
|
||||
.rept 29
|
||||
j interrupt_handler /* 3:31 - 0x018:0xF8 */
|
||||
.endr
|
||||
/* Exceptions */
|
||||
j EV_MachineCheck /* 0x100, Fatal Machine check (0x20) */
|
||||
j EV_TLBMissI /* 0x108, Intruction TLB miss (0x21) */
|
||||
j EV_TLBMissD /* 0x110, Data TLB miss (0x22) */
|
||||
j EV_TLBProtV /* 0x118, Protection Violation (0x23)
|
||||
or Misaligned Access */
|
||||
j EV_PrivilegeV /* 0x120, Privilege Violation (0x24) */
|
||||
j EV_Trap /* 0x128, Trap exception (0x25) */
|
||||
j EV_Extension /* 0x130, Extn Intruction Excp (0x26) */
|
||||
7
u-boot/arch/arc/cpu/arcv2/Makefile
Normal file
7
u-boot/arch/arc/cpu/arcv2/Makefile
Normal file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y += ivt.o
|
||||
27
u-boot/arch/arc/cpu/arcv2/ivt.S
Normal file
27
u-boot/arch/arc/cpu/arcv2/ivt.S
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
.section .ivt, "a",@progbits
|
||||
.align 4
|
||||
/* Critical system events */
|
||||
.word _start /* 0 - 0x000 */
|
||||
.word memory_error /* 1 - 0x008 */
|
||||
.word instruction_error /* 2 - 0x010 */
|
||||
|
||||
/* Exceptions */
|
||||
.word EV_MachineCheck /* 0x100, Fatal Machine check (0x20) */
|
||||
.word EV_TLBMissI /* 0x108, Intruction TLB miss (0x21) */
|
||||
.word EV_TLBMissD /* 0x110, Data TLB miss (0x22) */
|
||||
.word EV_TLBProtV /* 0x118, Protection Violation (0x23)
|
||||
or Misaligned Access */
|
||||
.word EV_PrivilegeV /* 0x120, Privilege Violation (0x24) */
|
||||
.word EV_Trap /* 0x128, Trap exception (0x25) */
|
||||
.word EV_Extension /* 0x130, Extn Intruction Excp (0x26) */
|
||||
|
||||
/* Device interrupts */
|
||||
.rept 29
|
||||
j interrupt_handler /* 3:31 - 0x018:0xF8 */
|
||||
.endr
|
||||
86
u-boot/arch/arc/cpu/u-boot.lds
Normal file
86
u-boot/arch/arc/cpu/u-boot.lds
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
OUTPUT_FORMAT("elf32-littlearc", "elf32-littlearc", "elf32-littlearc")
|
||||
OUTPUT_ARCH(arc)
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
. = ALIGN(4);
|
||||
.text : {
|
||||
*(.__text_start)
|
||||
*(.__image_copy_start)
|
||||
arch/arc/lib/start.o (.text*)
|
||||
*(.text*)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.text_end :
|
||||
{
|
||||
*(.__text_end)
|
||||
}
|
||||
|
||||
. = ALIGN(1024);
|
||||
.ivt_start : {
|
||||
*(.__ivt_start)
|
||||
}
|
||||
|
||||
.ivt :
|
||||
{
|
||||
*(.ivt)
|
||||
}
|
||||
|
||||
.ivt_end : {
|
||||
*(.__ivt_end)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : {
|
||||
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.data : {
|
||||
*(.data*)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.u_boot_list : {
|
||||
KEEP(*(SORT(.u_boot_list*)));
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.rel_dyn_start : {
|
||||
*(.__rel_dyn_start)
|
||||
}
|
||||
|
||||
.rela.dyn : {
|
||||
*(.rela.dyn)
|
||||
}
|
||||
|
||||
.rel_dyn_end : {
|
||||
*(.__rel_dyn_end)
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.bss_start : {
|
||||
*(.__bss_start);
|
||||
}
|
||||
|
||||
.bss : {
|
||||
*(.bss*)
|
||||
}
|
||||
|
||||
.bss_end : {
|
||||
*(.__bss_end);
|
||||
}
|
||||
|
||||
. = ALIGN(4);
|
||||
.image_copy_end : {
|
||||
*(.__image_copy_end)
|
||||
*(.__init_end)
|
||||
}
|
||||
}
|
||||
1
u-boot/arch/arc/dts/.gitignore
vendored
Normal file
1
u-boot/arch/arc/dts/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.dtb
|
||||
17
u-boot/arch/arc/dts/Makefile
Normal file
17
u-boot/arch/arc/dts/Makefile
Normal file
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
dtb-$(CONFIG_TARGET_AXS101) += axs10x.dtb
|
||||
dtb-$(CONFIG_TARGET_ARCANGEL4) += arcangel4.dtb
|
||||
dtb-$(CONFIG_TARGET_TB100) += abilis_tb100.dtb
|
||||
|
||||
targets += $(dtb-y)
|
||||
|
||||
DTC_FLAGS += -R 4 -p 0x1000
|
||||
|
||||
PHONY += dtbs
|
||||
dtbs: $(addprefix $(obj)/, $(dtb-y))
|
||||
@:
|
||||
|
||||
clean-files := *.dtb
|
||||
24
u-boot/arch/arc/dts/abilis_tb100.dts
Normal file
24
u-boot/arch/arc/dts/abilis_tb100.dts
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Synopsys, Inc. (www.synopsys.com)
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
/dts-v1/;
|
||||
|
||||
#include "skeleton.dtsi"
|
||||
|
||||
/ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
aliases {
|
||||
console = &uart0;
|
||||
};
|
||||
|
||||
uart0: serial@ff100000 {
|
||||
compatible = "snps,dw-apb-uart";
|
||||
reg = <0xff100000 0x1000>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
};
|
||||
};
|
||||
24
u-boot/arch/arc/dts/arcangel4.dts
Normal file
24
u-boot/arch/arc/dts/arcangel4.dts
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Synopsys, Inc. (www.synopsys.com)
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
/dts-v1/;
|
||||
|
||||
#include "skeleton.dtsi"
|
||||
|
||||
/ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
aliases {
|
||||
console = &arcuart0;
|
||||
};
|
||||
|
||||
arcuart0: serial@0xc0fc1000 {
|
||||
compatible = "snps,arc-uart";
|
||||
reg = <0xc0fc1000 0x100>;
|
||||
clock-frequency = <80000000>;
|
||||
};
|
||||
|
||||
};
|
||||
57
u-boot/arch/arc/dts/axs10x.dts
Normal file
57
u-boot/arch/arc/dts/axs10x.dts
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
/dts-v1/;
|
||||
|
||||
#include "skeleton.dtsi"
|
||||
|
||||
/ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
aliases {
|
||||
console = &uart0;
|
||||
};
|
||||
|
||||
clocks {
|
||||
apbclk: apbclk {
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <50000000>;
|
||||
#clock-cells = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
uart0: serial0@e0022000 {
|
||||
compatible = "snps,dw-apb-uart";
|
||||
reg = <0xe0022000 0x1000>;
|
||||
reg-shift = <2>;
|
||||
reg-io-width = <4>;
|
||||
};
|
||||
|
||||
ethernet@e0018000 {
|
||||
#interrupt-cells = <1>;
|
||||
compatible = "altr,socfpga-stmmac";
|
||||
reg = < 0xe0018000 0x2000 >;
|
||||
interrupts = < 25 >;
|
||||
interrupt-names = "macirq";
|
||||
phy-mode = "gmii";
|
||||
snps,pbl = < 32 >;
|
||||
clocks = <&apbclk>;
|
||||
clock-names = "stmmaceth";
|
||||
max-speed = <100>;
|
||||
};
|
||||
|
||||
ehci@0xe0040000 {
|
||||
compatible = "generic-ehci";
|
||||
reg = < 0xe0040000 0x100 >;
|
||||
interrupts = < 8 >;
|
||||
};
|
||||
|
||||
ohci@0xe0060000 {
|
||||
compatible = "generic-ohci";
|
||||
reg = < 0xe0060000 0x100 >;
|
||||
interrupts = < 8 >;
|
||||
};
|
||||
};
|
||||
13
u-boot/arch/arc/dts/skeleton.dtsi
Normal file
13
u-boot/arch/arc/dts/skeleton.dtsi
Normal file
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Skeleton device tree; the bare minimum needed to boot; just include and
|
||||
* add a compatible value. The bootloader will typically populate the memory
|
||||
* node.
|
||||
*/
|
||||
|
||||
/ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
chosen { };
|
||||
aliases { };
|
||||
memory { device_type = "memory"; reg = <0 0>; };
|
||||
};
|
||||
73
u-boot/arch/arc/include/asm/arcregs.h
Normal file
73
u-boot/arch/arc/include/asm/arcregs.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _ASM_ARC_ARCREGS_H
|
||||
#define _ASM_ARC_ARCREGS_H
|
||||
|
||||
#include <asm/cache.h>
|
||||
|
||||
/*
|
||||
* ARC architecture has additional address space - auxiliary registers.
|
||||
* These registers are mostly used for configuration purposes.
|
||||
* These registers are not memory mapped and special commands are used for
|
||||
* access: "lr"/"sr".
|
||||
*/
|
||||
|
||||
#define ARC_AUX_IDENTITY 0x04
|
||||
#define ARC_AUX_STATUS32 0x0a
|
||||
|
||||
/* Instruction cache related auxiliary registers */
|
||||
#define ARC_AUX_IC_IVIC 0x10
|
||||
#define ARC_AUX_IC_CTRL 0x11
|
||||
#define ARC_AUX_IC_IVIL 0x19
|
||||
#if (CONFIG_ARC_MMU_VER == 3)
|
||||
#define ARC_AUX_IC_PTAG 0x1E
|
||||
#endif
|
||||
#define ARC_BCR_IC_BUILD 0x77
|
||||
|
||||
/* Timer related auxiliary registers */
|
||||
#define ARC_AUX_TIMER0_CNT 0x21 /* Timer 0 count */
|
||||
#define ARC_AUX_TIMER0_CTRL 0x22 /* Timer 0 control */
|
||||
#define ARC_AUX_TIMER0_LIMIT 0x23 /* Timer 0 limit */
|
||||
|
||||
#define ARC_AUX_INTR_VEC_BASE 0x25
|
||||
|
||||
/* Data cache related auxiliary registers */
|
||||
#define ARC_AUX_DC_IVDC 0x47
|
||||
#define ARC_AUX_DC_CTRL 0x48
|
||||
|
||||
#define ARC_AUX_DC_IVDL 0x4A
|
||||
#define ARC_AUX_DC_FLSH 0x4B
|
||||
#define ARC_AUX_DC_FLDL 0x4C
|
||||
#if (CONFIG_ARC_MMU_VER == 3)
|
||||
#define ARC_AUX_DC_PTAG 0x5C
|
||||
#endif
|
||||
#define ARC_BCR_DC_BUILD 0x72
|
||||
#define ARC_BCR_SLC 0xce
|
||||
#define ARC_AUX_SLC_CONFIG 0x901
|
||||
#define ARC_AUX_SLC_CTRL 0x903
|
||||
#define ARC_AUX_SLC_FLUSH 0x904
|
||||
#define ARC_AUX_SLC_INVALIDATE 0x905
|
||||
#define ARC_AUX_SLC_IVDL 0x910
|
||||
#define ARC_AUX_SLC_FLDL 0x912
|
||||
#define ARC_BCR_CLUSTER 0xcf
|
||||
|
||||
/* IO coherency related auxiliary registers */
|
||||
#define ARC_AUX_IO_COH_ENABLE 0x500
|
||||
#define ARC_AUX_IO_COH_PARTIAL 0x501
|
||||
#define ARC_AUX_IO_COH_AP0_BASE 0x508
|
||||
#define ARC_AUX_IO_COH_AP0_SIZE 0x509
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/* Accessors for auxiliary registers */
|
||||
#define read_aux_reg(reg) __builtin_arc_lr(reg)
|
||||
|
||||
/* gcc builtin sr needs reg param to be long immediate */
|
||||
#define write_aux_reg(reg_immed, val) \
|
||||
__builtin_arc_sr((unsigned int)val, reg_immed)
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* _ASM_ARC_ARCREGS_H */
|
||||
24
u-boot/arch/arc/include/asm/bitops.h
Normal file
24
u-boot/arch/arc/include/asm/bitops.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_BITOPS_H
|
||||
#define __ASM_ARC_BITOPS_H
|
||||
|
||||
/*
|
||||
* hweightN: returns the hamming weight (i.e. the number
|
||||
* of bits set) of a N-bit word
|
||||
*/
|
||||
|
||||
#define hweight32(x) generic_hweight32(x)
|
||||
#define hweight16(x) generic_hweight16(x)
|
||||
#define hweight8(x) generic_hweight8(x)
|
||||
|
||||
#include <asm-generic/bitops/fls.h>
|
||||
#include <asm-generic/bitops/__fls.h>
|
||||
#include <asm-generic/bitops/fls64.h>
|
||||
#include <asm-generic/bitops/__ffs.h>
|
||||
|
||||
#endif /* __ASM_ARC_BITOPS_H */
|
||||
23
u-boot/arch/arc/include/asm/byteorder.h
Normal file
23
u-boot/arch/arc/include/asm/byteorder.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_BYTEORDER_H
|
||||
#define __ASM_ARC_BYTEORDER_H
|
||||
|
||||
#include <asm/types.h>
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
#define __BYTEORDER_HAS_U64__
|
||||
#define __SWAB_64_THRU_32__
|
||||
#endif
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#include <linux/byteorder/little_endian.h>
|
||||
#else
|
||||
#include <linux/byteorder/big_endian.h>
|
||||
#endif /* CONFIG_SYS_BIG_ENDIAN */
|
||||
|
||||
#endif /* ASM_ARC_BYTEORDER_H */
|
||||
36
u-boot/arch/arc/include/asm/cache.h
Normal file
36
u-boot/arch/arc/include/asm/cache.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_CACHE_H
|
||||
#define __ASM_ARC_CACHE_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/*
|
||||
* As of today we may handle any L1 cache line length right in software.
|
||||
* For that essentially cache line length is a variable not constant.
|
||||
* And to satisfy users of ARCH_DMA_MINALIGN we just use largest line length
|
||||
* that may exist in either L1 or L2 (AKA SLC) caches on ARC.
|
||||
*/
|
||||
#define ARCH_DMA_MINALIGN 128
|
||||
|
||||
#if defined(ARC_MMU_ABSENT)
|
||||
#define CONFIG_ARC_MMU_VER 0
|
||||
#elif defined(CONFIG_ARC_MMU_V2)
|
||||
#define CONFIG_ARC_MMU_VER 2
|
||||
#elif defined(CONFIG_ARC_MMU_V3)
|
||||
#define CONFIG_ARC_MMU_VER 3
|
||||
#elif defined(CONFIG_ARC_MMU_V4)
|
||||
#define CONFIG_ARC_MMU_VER 4
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
void cache_init(void);
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __ASM_ARC_CACHE_H */
|
||||
15
u-boot/arch/arc/include/asm/config.h
Normal file
15
u-boot/arch/arc/include/asm/config.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_CONFIG_H_
|
||||
#define __ASM_ARC_CONFIG_H_
|
||||
|
||||
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
|
||||
#define CONFIG_ARCH_EARLY_INIT_R
|
||||
|
||||
#define CONFIG_LMB
|
||||
|
||||
#endif /*__ASM_ARC_CONFIG_H_ */
|
||||
1
u-boot/arch/arc/include/asm/errno.h
Normal file
1
u-boot/arch/arc/include/asm/errno.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <asm-generic/errno.h>
|
||||
20
u-boot/arch/arc/include/asm/global_data.h
Normal file
20
u-boot/arch/arc/include/asm/global_data.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_GLOBAL_DATA_H
|
||||
#define __ASM_ARC_GLOBAL_DATA_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/* Architecture-specific global data */
|
||||
struct arch_global_data {
|
||||
};
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#include <asm-generic/global_data.h>
|
||||
|
||||
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r25")
|
||||
|
||||
#endif /* __ASM_ARC_GLOBAL_DATA_H */
|
||||
12
u-boot/arch/arc/include/asm/init_helpers.h
Normal file
12
u-boot/arch/arc/include/asm/init_helpers.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _ASM_ARC_INIT_HELPERS_H
|
||||
#define _ASM_ARC_INIT_HELPERS_H
|
||||
|
||||
int init_cache_f_r(void);
|
||||
|
||||
#endif /* _ASM_ARC_INIT_HELPERS_H */
|
||||
310
u-boot/arch/arc/include/asm/io.h
Normal file
310
u-boot/arch/arc/include/asm/io.h
Normal file
@@ -0,0 +1,310 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_IO_H
|
||||
#define __ASM_ARC_IO_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
|
||||
/*
|
||||
* ARCv2 based HS38 cores are in-order issue, but still weakly ordered
|
||||
* due to micro-arch buffering/queuing of load/store, cache hit vs. miss ...
|
||||
*
|
||||
* Explicit barrier provided by DMB instruction
|
||||
* - Operand supports fine grained load/store/load+store semantics
|
||||
* - Ensures that selected memory operation issued before it will complete
|
||||
* before any subsequent memory operation of same type
|
||||
* - DMB guarantees SMP as well as local barrier semantics
|
||||
* (asm-generic/barrier.h ensures sane smp_*mb if not defined here, i.e.
|
||||
* UP: barrier(), SMP: smp_*mb == *mb)
|
||||
* - DSYNC provides DMB+completion_of_cache_bpu_maintenance_ops hence not needed
|
||||
* in the general case. Plus it only provides full barrier.
|
||||
*/
|
||||
|
||||
#define mb() asm volatile("dmb 3\n" : : : "memory")
|
||||
#define rmb() asm volatile("dmb 1\n" : : : "memory")
|
||||
#define wmb() asm volatile("dmb 2\n" : : : "memory")
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* ARCompact based cores (ARC700) only have SYNC instruction which is super
|
||||
* heavy weight as it flushes the pipeline as well.
|
||||
* There are no real SMP implementations of such cores.
|
||||
*/
|
||||
|
||||
#define mb() asm volatile("sync\n" : : : "memory")
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
#define __iormb() rmb()
|
||||
#define __iowmb() wmb()
|
||||
#else
|
||||
#define __iormb() do { } while (0)
|
||||
#define __iowmb() do { } while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Given a physical address and a length, return a virtual address
|
||||
* that can be used to access the memory range with the caching
|
||||
* properties specified by "flags".
|
||||
*/
|
||||
#define MAP_NOCACHE (0)
|
||||
#define MAP_WRCOMBINE (0)
|
||||
#define MAP_WRBACK (0)
|
||||
#define MAP_WRTHROUGH (0)
|
||||
|
||||
static inline void *
|
||||
map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
|
||||
{
|
||||
return (void *)((unsigned long)paddr);
|
||||
}
|
||||
|
||||
/*
|
||||
* Take down a mapping set up by map_physmem().
|
||||
*/
|
||||
static inline void unmap_physmem(void *vaddr, unsigned long flags)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static inline void sync(void)
|
||||
{
|
||||
/* Not yet implemented */
|
||||
}
|
||||
|
||||
static inline u8 __raw_readb(const volatile void __iomem *addr)
|
||||
{
|
||||
u8 b;
|
||||
|
||||
__asm__ __volatile__("ldb%U1 %0, %1\n"
|
||||
: "=r" (b)
|
||||
: "m" (*(volatile u8 __force *)addr)
|
||||
: "memory");
|
||||
return b;
|
||||
}
|
||||
|
||||
static inline u16 __raw_readw(const volatile void __iomem *addr)
|
||||
{
|
||||
u16 s;
|
||||
|
||||
__asm__ __volatile__("ldw%U1 %0, %1\n"
|
||||
: "=r" (s)
|
||||
: "m" (*(volatile u16 __force *)addr)
|
||||
: "memory");
|
||||
return s;
|
||||
}
|
||||
|
||||
static inline u32 __raw_readl(const volatile void __iomem *addr)
|
||||
{
|
||||
u32 w;
|
||||
|
||||
__asm__ __volatile__("ld%U1 %0, %1\n"
|
||||
: "=r" (w)
|
||||
: "m" (*(volatile u32 __force *)addr)
|
||||
: "memory");
|
||||
return w;
|
||||
}
|
||||
|
||||
static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
|
||||
{
|
||||
__asm__ __volatile__("stb%U1 %0, %1\n"
|
||||
:
|
||||
: "r" (b), "m" (*(volatile u8 __force *)addr)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static inline void __raw_writew(u16 s, volatile void __iomem *addr)
|
||||
{
|
||||
__asm__ __volatile__("stw%U1 %0, %1\n"
|
||||
:
|
||||
: "r" (s), "m" (*(volatile u16 __force *)addr)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static inline void __raw_writel(u32 w, volatile void __iomem *addr)
|
||||
{
|
||||
__asm__ __volatile__("st%U1 %0, %1\n"
|
||||
:
|
||||
: "r" (w), "m" (*(volatile u32 __force *)addr)
|
||||
: "memory");
|
||||
}
|
||||
|
||||
static inline int __raw_readsb(unsigned int addr, void *data, int bytelen)
|
||||
{
|
||||
__asm__ __volatile__ ("1:ld.di r8, [r0]\n"
|
||||
"sub.f r2, r2, 1\n"
|
||||
"bnz.d 1b\n"
|
||||
"stb.ab r8, [r1, 1]\n"
|
||||
:
|
||||
: "r" (addr), "r" (data), "r" (bytelen)
|
||||
: "r8");
|
||||
return bytelen;
|
||||
}
|
||||
|
||||
static inline int __raw_readsw(unsigned int addr, void *data, int wordlen)
|
||||
{
|
||||
__asm__ __volatile__ ("1:ld.di r8, [r0]\n"
|
||||
"sub.f r2, r2, 1\n"
|
||||
"bnz.d 1b\n"
|
||||
"stw.ab r8, [r1, 2]\n"
|
||||
:
|
||||
: "r" (addr), "r" (data), "r" (wordlen)
|
||||
: "r8");
|
||||
return wordlen;
|
||||
}
|
||||
|
||||
static inline int __raw_readsl(unsigned int addr, void *data, int longlen)
|
||||
{
|
||||
__asm__ __volatile__ ("1:ld.di r8, [r0]\n"
|
||||
"sub.f r2, r2, 1\n"
|
||||
"bnz.d 1b\n"
|
||||
"st.ab r8, [r1, 4]\n"
|
||||
:
|
||||
: "r" (addr), "r" (data), "r" (longlen)
|
||||
: "r8");
|
||||
return longlen;
|
||||
}
|
||||
|
||||
static inline int __raw_writesb(unsigned int addr, void *data, int bytelen)
|
||||
{
|
||||
__asm__ __volatile__ ("1:ldb.ab r8, [r1, 1]\n"
|
||||
"sub.f r2, r2, 1\n"
|
||||
"bnz.d 1b\n"
|
||||
"st.di r8, [r0, 0]\n"
|
||||
:
|
||||
: "r" (addr), "r" (data), "r" (bytelen)
|
||||
: "r8");
|
||||
return bytelen;
|
||||
}
|
||||
|
||||
static inline int __raw_writesw(unsigned int addr, void *data, int wordlen)
|
||||
{
|
||||
__asm__ __volatile__ ("1:ldw.ab r8, [r1, 2]\n"
|
||||
"sub.f r2, r2, 1\n"
|
||||
"bnz.d 1b\n"
|
||||
"st.ab.di r8, [r0, 0]\n"
|
||||
:
|
||||
: "r" (addr), "r" (data), "r" (wordlen)
|
||||
: "r8");
|
||||
return wordlen;
|
||||
}
|
||||
|
||||
static inline int __raw_writesl(unsigned int addr, void *data, int longlen)
|
||||
{
|
||||
__asm__ __volatile__ ("1:ld.ab r8, [r1, 4]\n"
|
||||
"sub.f r2, r2, 1\n"
|
||||
"bnz.d 1b\n"
|
||||
"st.ab.di r8, [r0, 0]\n"
|
||||
:
|
||||
: "r" (addr), "r" (data), "r" (longlen)
|
||||
: "r8");
|
||||
return longlen;
|
||||
}
|
||||
|
||||
/*
|
||||
* MMIO can also get buffered/optimized in micro-arch, so barriers needed
|
||||
* Based on ARM model for the typical use case
|
||||
*
|
||||
* <ST [DMA buffer]>
|
||||
* <writel MMIO "go" reg>
|
||||
* or:
|
||||
* <readl MMIO "status" reg>
|
||||
* <LD [DMA buffer]>
|
||||
*
|
||||
* http://lkml.kernel.org/r/20150622133656.GG1583@arm.com
|
||||
*/
|
||||
#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
|
||||
#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
|
||||
#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
|
||||
|
||||
#define writeb(v,c) ({ __iowmb(); writeb_relaxed(v,c); })
|
||||
#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })
|
||||
#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
|
||||
|
||||
/*
|
||||
* Relaxed API for drivers which can handle barrier ordering themselves
|
||||
*
|
||||
* Also these are defined to perform little endian accesses.
|
||||
* To provide the typical device register semantics of fixed endian,
|
||||
* swap the byte order for Big Endian
|
||||
*
|
||||
* http://lkml.kernel.org/r/201603100845.30602.arnd@arndb.de
|
||||
*/
|
||||
#define readb_relaxed(c) __raw_readb(c)
|
||||
#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \
|
||||
__raw_readw(c)); __r; })
|
||||
#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
|
||||
__raw_readl(c)); __r; })
|
||||
|
||||
#define writeb_relaxed(v,c) __raw_writeb(v,c)
|
||||
#define writew_relaxed(v,c) __raw_writew((__force u16) cpu_to_le16(v),c)
|
||||
#define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c)
|
||||
|
||||
#define out_arch(type, endian, a, v) __raw_write##type(cpu_to_##endian(v), a)
|
||||
#define in_arch(type, endian, a) endian##_to_cpu(__raw_read##type(a))
|
||||
|
||||
#define out_le32(a, v) out_arch(l, le32, a, v)
|
||||
#define out_le16(a, v) out_arch(w, le16, a, v)
|
||||
|
||||
#define in_le32(a) in_arch(l, le32, a)
|
||||
#define in_le16(a) in_arch(w, le16, a)
|
||||
|
||||
#define out_be32(a, v) out_arch(l, be32, a, v)
|
||||
#define out_be16(a, v) out_arch(w, be16, a, v)
|
||||
|
||||
#define in_be32(a) in_arch(l, be32, a)
|
||||
#define in_be16(a) in_arch(w, be16, a)
|
||||
|
||||
#define out_8(a, v) __raw_writeb(v, a)
|
||||
#define in_8(a) __raw_readb(a)
|
||||
|
||||
/*
|
||||
* Clear and set bits in one shot. These macros can be used to clear and
|
||||
* set multiple bits in a register using a single call. These macros can
|
||||
* also be used to set a multiple-bit bit pattern using a mask, by
|
||||
* specifying the mask in the 'clear' parameter and the new bit pattern
|
||||
* in the 'set' parameter.
|
||||
*/
|
||||
|
||||
#define clrbits(type, addr, clear) \
|
||||
out_##type((addr), in_##type(addr) & ~(clear))
|
||||
|
||||
#define setbits(type, addr, set) \
|
||||
out_##type((addr), in_##type(addr) | (set))
|
||||
|
||||
#define clrsetbits(type, addr, clear, set) \
|
||||
out_##type((addr), (in_##type(addr) & ~(clear)) | (set))
|
||||
|
||||
#define clrbits_be32(addr, clear) clrbits(be32, addr, clear)
|
||||
#define setbits_be32(addr, set) setbits(be32, addr, set)
|
||||
#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, set)
|
||||
|
||||
#define clrbits_le32(addr, clear) clrbits(le32, addr, clear)
|
||||
#define setbits_le32(addr, set) setbits(le32, addr, set)
|
||||
#define clrsetbits_le32(addr, clear, set) clrsetbits(le32, addr, clear, set)
|
||||
|
||||
#define clrbits_be16(addr, clear) clrbits(be16, addr, clear)
|
||||
#define setbits_be16(addr, set) setbits(be16, addr, set)
|
||||
#define clrsetbits_be16(addr, clear, set) clrsetbits(be16, addr, clear, set)
|
||||
|
||||
#define clrbits_le16(addr, clear) clrbits(le16, addr, clear)
|
||||
#define setbits_le16(addr, set) setbits(le16, addr, set)
|
||||
#define clrsetbits_le16(addr, clear, set) clrsetbits(le16, addr, clear, set)
|
||||
|
||||
#define clrbits_8(addr, clear) clrbits(8, addr, clear)
|
||||
#define setbits_8(addr, set) setbits(8, addr, set)
|
||||
#define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
|
||||
|
||||
static inline phys_addr_t virt_to_phys(void *vaddr)
|
||||
{
|
||||
return (phys_addr_t)((unsigned long)vaddr);
|
||||
}
|
||||
|
||||
#endif /* __ASM_ARC_IO_H */
|
||||
12
u-boot/arch/arc/include/asm/linkage.h
Normal file
12
u-boot/arch/arc/include/asm/linkage.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2015 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_LINKAGE_H
|
||||
#define __ASM_ARC_LINKAGE_H
|
||||
|
||||
#define ASM_NL ` /* use '`' to mark new line in macro */
|
||||
|
||||
#endif /* __ASM_ARC_LINKAGE_H */
|
||||
43
u-boot/arch/arc/include/asm/posix_types.h
Normal file
43
u-boot/arch/arc/include/asm/posix_types.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_POSIX_TYPES_H
|
||||
#define __ASM_ARC_POSIX_TYPES_H
|
||||
|
||||
typedef unsigned short __kernel_dev_t;
|
||||
typedef unsigned long __kernel_ino_t;
|
||||
typedef unsigned short __kernel_mode_t;
|
||||
typedef unsigned short __kernel_nlink_t;
|
||||
typedef long __kernel_off_t;
|
||||
typedef int __kernel_pid_t;
|
||||
typedef unsigned short __kernel_ipc_pid_t;
|
||||
typedef unsigned short __kernel_uid_t;
|
||||
typedef unsigned short __kernel_gid_t;
|
||||
#ifdef __GNUC__
|
||||
typedef __SIZE_TYPE__ __kernel_size_t;
|
||||
#else
|
||||
typedef unsigned int __kernel_size_t;
|
||||
#endif
|
||||
typedef int __kernel_ssize_t;
|
||||
typedef int __kernel_ptrdiff_t;
|
||||
typedef long __kernel_time_t;
|
||||
typedef long __kernel_suseconds_t;
|
||||
typedef long __kernel_clock_t;
|
||||
typedef int __kernel_daddr_t;
|
||||
typedef char *__kernel_caddr_t;
|
||||
typedef unsigned short __kernel_uid16_t;
|
||||
typedef unsigned short __kernel_gid16_t;
|
||||
typedef unsigned int __kernel_uid32_t;
|
||||
typedef unsigned int __kernel_gid32_t;
|
||||
|
||||
typedef unsigned short __kernel_old_uid_t;
|
||||
typedef unsigned short __kernel_old_gid_t;
|
||||
|
||||
#ifdef __GNUC__
|
||||
typedef long long __kernel_loff_t;
|
||||
#endif
|
||||
|
||||
#endif /* __ASM_ARC_POSIX_TYPES_H */
|
||||
12
u-boot/arch/arc/include/asm/processor.h
Normal file
12
u-boot/arch/arc/include/asm/processor.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _ASM_ARC_PROCESSOR_H
|
||||
#define _ASM_ARC_PROCESSOR_H
|
||||
|
||||
/* This file is required by some generic code like USB etc */
|
||||
|
||||
#endif /* _ASM_ARC_PROCESSOR_H */
|
||||
50
u-boot/arch/arc/include/asm/ptrace.h
Normal file
50
u-boot/arch/arc/include/asm/ptrace.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_PTRACE_H
|
||||
#define __ASM_ARC_PTRACE_H
|
||||
|
||||
struct pt_regs {
|
||||
long bta;
|
||||
long lp_start;
|
||||
long lp_end;
|
||||
long lp_count;
|
||||
long status32;
|
||||
long ret;
|
||||
long blink;
|
||||
long fp;
|
||||
long r26; /* gp */
|
||||
long r25;
|
||||
long r24;
|
||||
long r23;
|
||||
long r22;
|
||||
long r21;
|
||||
long r20;
|
||||
long r19;
|
||||
long r18;
|
||||
long r17;
|
||||
long r16;
|
||||
long r15;
|
||||
long r14;
|
||||
long r13;
|
||||
long r12;
|
||||
long r11;
|
||||
long r10;
|
||||
long r9;
|
||||
long r8;
|
||||
long r7;
|
||||
long r6;
|
||||
long r5;
|
||||
long r4;
|
||||
long r3;
|
||||
long r2;
|
||||
long r1;
|
||||
long r0;
|
||||
long sp;
|
||||
long ecr;
|
||||
};
|
||||
|
||||
#endif /* __ASM_ARC_PTRACE_H */
|
||||
16
u-boot/arch/arc/include/asm/relocate.h
Normal file
16
u-boot/arch/arc/include/asm/relocate.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef _ASM_ARC_RELOCATE_H
|
||||
#define _ASM_ARC_RELOCATE_H
|
||||
|
||||
#include <common.h>
|
||||
|
||||
int copy_uboot_to_ram(void);
|
||||
int clear_bss(void);
|
||||
int do_elf_reloc_fixups(void);
|
||||
|
||||
#endif /* _ASM_ARC_RELOCATE_H */
|
||||
17
u-boot/arch/arc/include/asm/sections.h
Normal file
17
u-boot/arch/arc/include/asm/sections.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_SECTIONS_H
|
||||
#define __ASM_ARC_SECTIONS_H
|
||||
|
||||
#include <asm-generic/sections.h>
|
||||
|
||||
extern ulong __text_end;
|
||||
extern ulong __ivt_start;
|
||||
extern ulong __ivt_end;
|
||||
extern ulong __image_copy_start;
|
||||
|
||||
#endif /* __ASM_ARC_SECTIONS_H */
|
||||
27
u-boot/arch/arc/include/asm/string.h
Normal file
27
u-boot/arch/arc/include/asm/string.h
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_STRING_H
|
||||
#define __ASM_ARC_STRING_H
|
||||
|
||||
#define __HAVE_ARCH_MEMSET
|
||||
#define __HAVE_ARCH_MEMCPY
|
||||
#define __HAVE_ARCH_MEMCMP
|
||||
#define __HAVE_ARCH_STRCHR
|
||||
#define __HAVE_ARCH_STRCPY
|
||||
#define __HAVE_ARCH_STRCMP
|
||||
#define __HAVE_ARCH_STRLEN
|
||||
|
||||
extern void *memset(void *ptr, int, __kernel_size_t);
|
||||
extern void *memcpy(void *, const void *, __kernel_size_t);
|
||||
extern void memzero(void *ptr, __kernel_size_t n);
|
||||
extern int memcmp(const void *, const void *, __kernel_size_t);
|
||||
extern char *strchr(const char *s, int c);
|
||||
extern char *strcpy(char *dest, const char *src);
|
||||
extern int strcmp(const char *cs, const char *ct);
|
||||
extern __kernel_size_t strlen(const char *);
|
||||
|
||||
#endif /* __ASM_ARC_STRING_H */
|
||||
55
u-boot/arch/arc/include/asm/types.h
Normal file
55
u-boot/arch/arc/include/asm/types.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_TYPES_H
|
||||
#define __ASM_ARC_TYPES_H
|
||||
|
||||
typedef unsigned short umode_t;
|
||||
|
||||
/*
|
||||
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
|
||||
* header files exported to user space
|
||||
*/
|
||||
|
||||
typedef __signed__ char __s8;
|
||||
typedef unsigned char __u8;
|
||||
|
||||
typedef __signed__ short __s16;
|
||||
typedef unsigned short __u16;
|
||||
|
||||
typedef __signed__ int __s32;
|
||||
typedef unsigned int __u32;
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
typedef __signed__ long long __s64;
|
||||
typedef unsigned long long __u64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* These aren't exported outside the kernel to avoid name space clashes
|
||||
*/
|
||||
typedef signed char s8;
|
||||
typedef unsigned char u8;
|
||||
|
||||
typedef signed short s16;
|
||||
typedef unsigned short u16;
|
||||
|
||||
typedef signed int s32;
|
||||
typedef unsigned int u32;
|
||||
|
||||
typedef signed long long s64;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
#define BITS_PER_LONG 32
|
||||
|
||||
/* Dma addresses are 32-bits wide. */
|
||||
|
||||
typedef u32 dma_addr_t;
|
||||
|
||||
typedef unsigned long phys_addr_t;
|
||||
typedef unsigned long phys_size_t;
|
||||
|
||||
#endif /* __ASM_ARC_TYPES_H */
|
||||
15
u-boot/arch/arc/include/asm/u-boot-arc.h
Normal file
15
u-boot/arch/arc/include/asm/u-boot-arc.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_U_BOOT_ARC_H__
|
||||
#define __ASM_ARC_U_BOOT_ARC_H__
|
||||
|
||||
int arch_early_init_r(void);
|
||||
|
||||
void board_init_f_r_trampoline(ulong) __attribute__ ((noreturn));
|
||||
void board_init_f_r(void) __attribute__ ((noreturn));
|
||||
|
||||
#endif /* __ASM_ARC_U_BOOT_ARC_H__ */
|
||||
15
u-boot/arch/arc/include/asm/u-boot.h
Normal file
15
u-boot/arch/arc/include/asm/u-boot.h
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_ARC_U_BOOT_H__
|
||||
#define __ASM_ARC_U_BOOT_H__
|
||||
|
||||
#include <asm-generic/u-boot.h>
|
||||
|
||||
/* For image.h:image_check_target_arch() */
|
||||
#define IH_ARCH_DEFAULT IH_ARCH_ARC
|
||||
|
||||
#endif /* __ASM_ARC_U_BOOT_H__ */
|
||||
1
u-boot/arch/arc/include/asm/unaligned.h
Normal file
1
u-boot/arch/arc/include/asm/unaligned.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <asm-generic/unaligned.h>
|
||||
28
u-boot/arch/arc/lib/Makefile
Normal file
28
u-boot/arch/arc/lib/Makefile
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
extra-y = start.o
|
||||
head-y := start.o
|
||||
obj-y += cache.o
|
||||
obj-y += cpu.o
|
||||
obj-y += interrupts.o
|
||||
obj-y += sections.o
|
||||
obj-y += relocate.o
|
||||
obj-y += strchr-700.o
|
||||
obj-y += strcmp.o
|
||||
obj-y += strcpy-700.o
|
||||
obj-y += strlen.o
|
||||
obj-y += memcmp.o
|
||||
obj-y += memcpy-700.o
|
||||
obj-y += memset.o
|
||||
obj-y += reset.o
|
||||
obj-y += timer.o
|
||||
obj-y += ints_low.o
|
||||
obj-y += init_helpers.o
|
||||
|
||||
obj-$(CONFIG_CMD_BOOTM) += bootm.o
|
||||
|
||||
lib-$(CONFIG_USE_PRIVATE_LIBGCC) += _millicodethunk.o libgcc2.o
|
||||
226
u-boot/arch/arc/lib/_millicodethunk.S
Normal file
226
u-boot/arch/arc/lib/_millicodethunk.S
Normal file
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* Copyright (C) 1995, 1997, 2007-2013 Free Software Foundation, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/* ANSI concatenation macros. */
|
||||
|
||||
#define CONCAT1(a, b) CONCAT2(a, b)
|
||||
#define CONCAT2(a, b) a ## b
|
||||
|
||||
/* Use the right prefix for global labels. */
|
||||
|
||||
#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
|
||||
|
||||
#ifndef WORKING_ASSEMBLER
|
||||
#define abs_l abs
|
||||
#define asl_l asl
|
||||
#define mov_l mov
|
||||
#endif
|
||||
|
||||
#define FUNC(X) .type SYM(X),@function
|
||||
#define HIDDEN_FUNC(X) FUNC(X)` .hidden X
|
||||
#define ENDFUNC0(X) .Lfe_##X: .size X,.Lfe_##X-X
|
||||
#define ENDFUNC(X) ENDFUNC0(X)
|
||||
|
||||
.section .text
|
||||
.align 4
|
||||
.global SYM(__st_r13_to_r15)
|
||||
.global SYM(__st_r13_to_r16)
|
||||
.global SYM(__st_r13_to_r17)
|
||||
.global SYM(__st_r13_to_r18)
|
||||
.global SYM(__st_r13_to_r19)
|
||||
.global SYM(__st_r13_to_r20)
|
||||
.global SYM(__st_r13_to_r21)
|
||||
.global SYM(__st_r13_to_r22)
|
||||
.global SYM(__st_r13_to_r23)
|
||||
.global SYM(__st_r13_to_r24)
|
||||
.global SYM(__st_r13_to_r25)
|
||||
HIDDEN_FUNC(__st_r13_to_r15)
|
||||
HIDDEN_FUNC(__st_r13_to_r16)
|
||||
HIDDEN_FUNC(__st_r13_to_r17)
|
||||
HIDDEN_FUNC(__st_r13_to_r18)
|
||||
HIDDEN_FUNC(__st_r13_to_r19)
|
||||
HIDDEN_FUNC(__st_r13_to_r20)
|
||||
HIDDEN_FUNC(__st_r13_to_r21)
|
||||
HIDDEN_FUNC(__st_r13_to_r22)
|
||||
HIDDEN_FUNC(__st_r13_to_r23)
|
||||
HIDDEN_FUNC(__st_r13_to_r24)
|
||||
HIDDEN_FUNC(__st_r13_to_r25)
|
||||
.align 4
|
||||
SYM(__st_r13_to_r25):
|
||||
st r25, [sp,48]
|
||||
SYM(__st_r13_to_r24):
|
||||
st r24, [sp,44]
|
||||
SYM(__st_r13_to_r23):
|
||||
st r23, [sp,40]
|
||||
SYM(__st_r13_to_r22):
|
||||
st r22, [sp,36]
|
||||
SYM(__st_r13_to_r21):
|
||||
st r21, [sp,32]
|
||||
SYM(__st_r13_to_r20):
|
||||
st r20, [sp,28]
|
||||
SYM(__st_r13_to_r19):
|
||||
st r19, [sp,24]
|
||||
SYM(__st_r13_to_r18):
|
||||
st r18, [sp,20]
|
||||
SYM(__st_r13_to_r17):
|
||||
st r17, [sp,16]
|
||||
SYM(__st_r13_to_r16):
|
||||
st r16, [sp,12]
|
||||
SYM(__st_r13_to_r15):
|
||||
#ifdef __ARC700__
|
||||
st r15, [sp,8] ; minimum function size to avoid stall: 6 bytes.
|
||||
#else
|
||||
st_s r15, [sp,8]
|
||||
#endif
|
||||
st_s r14, [sp,4]
|
||||
j_s.d [%blink]
|
||||
st_s r13, [sp,0]
|
||||
ENDFUNC(__st_r13_to_r15)
|
||||
ENDFUNC(__st_r13_to_r16)
|
||||
ENDFUNC(__st_r13_to_r17)
|
||||
ENDFUNC(__st_r13_to_r18)
|
||||
ENDFUNC(__st_r13_to_r19)
|
||||
ENDFUNC(__st_r13_to_r20)
|
||||
ENDFUNC(__st_r13_to_r21)
|
||||
ENDFUNC(__st_r13_to_r22)
|
||||
ENDFUNC(__st_r13_to_r23)
|
||||
ENDFUNC(__st_r13_to_r24)
|
||||
ENDFUNC(__st_r13_to_r25)
|
||||
|
||||
.section .text
|
||||
.align 4
|
||||
; ==================================
|
||||
; the loads
|
||||
|
||||
.global SYM(__ld_r13_to_r15)
|
||||
.global SYM(__ld_r13_to_r16)
|
||||
.global SYM(__ld_r13_to_r17)
|
||||
.global SYM(__ld_r13_to_r18)
|
||||
.global SYM(__ld_r13_to_r19)
|
||||
.global SYM(__ld_r13_to_r20)
|
||||
.global SYM(__ld_r13_to_r21)
|
||||
.global SYM(__ld_r13_to_r22)
|
||||
.global SYM(__ld_r13_to_r23)
|
||||
.global SYM(__ld_r13_to_r24)
|
||||
.global SYM(__ld_r13_to_r25)
|
||||
HIDDEN_FUNC(__ld_r13_to_r15)
|
||||
HIDDEN_FUNC(__ld_r13_to_r16)
|
||||
HIDDEN_FUNC(__ld_r13_to_r17)
|
||||
HIDDEN_FUNC(__ld_r13_to_r18)
|
||||
HIDDEN_FUNC(__ld_r13_to_r19)
|
||||
HIDDEN_FUNC(__ld_r13_to_r20)
|
||||
HIDDEN_FUNC(__ld_r13_to_r21)
|
||||
HIDDEN_FUNC(__ld_r13_to_r22)
|
||||
HIDDEN_FUNC(__ld_r13_to_r23)
|
||||
HIDDEN_FUNC(__ld_r13_to_r24)
|
||||
HIDDEN_FUNC(__ld_r13_to_r25)
|
||||
SYM(__ld_r13_to_r25):
|
||||
ld r25, [sp,48]
|
||||
SYM(__ld_r13_to_r24):
|
||||
ld r24, [sp,44]
|
||||
SYM(__ld_r13_to_r23):
|
||||
ld r23, [sp,40]
|
||||
SYM(__ld_r13_to_r22):
|
||||
ld r22, [sp,36]
|
||||
SYM(__ld_r13_to_r21):
|
||||
ld r21, [sp,32]
|
||||
SYM(__ld_r13_to_r20):
|
||||
ld r20, [sp,28]
|
||||
SYM(__ld_r13_to_r19):
|
||||
ld r19, [sp,24]
|
||||
SYM(__ld_r13_to_r18):
|
||||
ld r18, [sp,20]
|
||||
SYM(__ld_r13_to_r17):
|
||||
ld r17, [sp,16]
|
||||
SYM(__ld_r13_to_r16):
|
||||
ld r16, [sp,12]
|
||||
SYM(__ld_r13_to_r15):
|
||||
#ifdef __ARC700__
|
||||
ld r15, [sp,8] ; minimum function size to avoid stall: 6 bytes.
|
||||
#else
|
||||
ld_s r15, [sp,8]
|
||||
#endif
|
||||
ld_s r14, [sp,4]
|
||||
j_s.d [%blink]
|
||||
ld_s r13, [sp,0]
|
||||
ENDFUNC(__ld_r13_to_r15)
|
||||
ENDFUNC(__ld_r13_to_r16)
|
||||
ENDFUNC(__ld_r13_to_r17)
|
||||
ENDFUNC(__ld_r13_to_r18)
|
||||
ENDFUNC(__ld_r13_to_r19)
|
||||
ENDFUNC(__ld_r13_to_r20)
|
||||
ENDFUNC(__ld_r13_to_r21)
|
||||
ENDFUNC(__ld_r13_to_r22)
|
||||
ENDFUNC(__ld_r13_to_r23)
|
||||
ENDFUNC(__ld_r13_to_r24)
|
||||
ENDFUNC(__ld_r13_to_r25)
|
||||
|
||||
.global SYM(__ld_r13_to_r14_ret)
|
||||
.global SYM(__ld_r13_to_r15_ret)
|
||||
.global SYM(__ld_r13_to_r16_ret)
|
||||
.global SYM(__ld_r13_to_r17_ret)
|
||||
.global SYM(__ld_r13_to_r18_ret)
|
||||
.global SYM(__ld_r13_to_r19_ret)
|
||||
.global SYM(__ld_r13_to_r20_ret)
|
||||
.global SYM(__ld_r13_to_r21_ret)
|
||||
.global SYM(__ld_r13_to_r22_ret)
|
||||
.global SYM(__ld_r13_to_r23_ret)
|
||||
.global SYM(__ld_r13_to_r24_ret)
|
||||
.global SYM(__ld_r13_to_r25_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r14_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r15_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r16_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r17_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r18_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r19_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r20_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r21_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r22_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r23_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r24_ret)
|
||||
HIDDEN_FUNC(__ld_r13_to_r25_ret)
|
||||
.section .text
|
||||
.align 4
|
||||
SYM(__ld_r13_to_r25_ret):
|
||||
ld r25, [sp,48]
|
||||
SYM(__ld_r13_to_r24_ret):
|
||||
ld r24, [sp,44]
|
||||
SYM(__ld_r13_to_r23_ret):
|
||||
ld r23, [sp,40]
|
||||
SYM(__ld_r13_to_r22_ret):
|
||||
ld r22, [sp,36]
|
||||
SYM(__ld_r13_to_r21_ret):
|
||||
ld r21, [sp,32]
|
||||
SYM(__ld_r13_to_r20_ret):
|
||||
ld r20, [sp,28]
|
||||
SYM(__ld_r13_to_r19_ret):
|
||||
ld r19, [sp,24]
|
||||
SYM(__ld_r13_to_r18_ret):
|
||||
ld r18, [sp,20]
|
||||
SYM(__ld_r13_to_r17_ret):
|
||||
ld r17, [sp,16]
|
||||
SYM(__ld_r13_to_r16_ret):
|
||||
ld r16, [sp,12]
|
||||
SYM(__ld_r13_to_r15_ret):
|
||||
ld r15, [sp,8]
|
||||
SYM(__ld_r13_to_r14_ret):
|
||||
ld blink,[sp,r12]
|
||||
ld_s r14, [sp,4]
|
||||
ld.ab r13, [sp,r12]
|
||||
j_s.d [%blink]
|
||||
add_s sp,sp,4
|
||||
ENDFUNC(__ld_r13_to_r14_ret)
|
||||
ENDFUNC(__ld_r13_to_r15_ret)
|
||||
ENDFUNC(__ld_r13_to_r16_ret)
|
||||
ENDFUNC(__ld_r13_to_r17_ret)
|
||||
ENDFUNC(__ld_r13_to_r18_ret)
|
||||
ENDFUNC(__ld_r13_to_r19_ret)
|
||||
ENDFUNC(__ld_r13_to_r20_ret)
|
||||
ENDFUNC(__ld_r13_to_r21_ret)
|
||||
ENDFUNC(__ld_r13_to_r22_ret)
|
||||
ENDFUNC(__ld_r13_to_r23_ret)
|
||||
ENDFUNC(__ld_r13_to_r24_ret)
|
||||
ENDFUNC(__ld_r13_to_r25_ret)
|
||||
112
u-boot/arch/arc/lib/bootm.c
Normal file
112
u-boot/arch/arc/lib/bootm.c
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
static ulong get_sp(void)
|
||||
{
|
||||
ulong ret;
|
||||
|
||||
asm("mov %0, sp" : "=r"(ret) : );
|
||||
return ret;
|
||||
}
|
||||
|
||||
void arch_lmb_reserve(struct lmb *lmb)
|
||||
{
|
||||
ulong sp;
|
||||
|
||||
/*
|
||||
* Booting a (Linux) kernel image
|
||||
*
|
||||
* Allocate space for command line and board info - the
|
||||
* address should be as high as possible within the reach of
|
||||
* the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
|
||||
* memory, which means far enough below the current stack
|
||||
* pointer.
|
||||
*/
|
||||
sp = get_sp();
|
||||
debug("## Current stack ends at 0x%08lx ", sp);
|
||||
|
||||
/* adjust sp by 4K to be safe */
|
||||
sp -= 4096;
|
||||
lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
|
||||
}
|
||||
|
||||
static int cleanup_before_linux(void)
|
||||
{
|
||||
disable_interrupts();
|
||||
flush_dcache_all();
|
||||
invalidate_icache_all();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Subcommand: PREP */
|
||||
static void boot_prep_linux(bootm_headers_t *images)
|
||||
{
|
||||
if (image_setup_linux(images))
|
||||
hang();
|
||||
}
|
||||
|
||||
__weak void smp_set_core_boot_addr(unsigned long addr, int corenr) {}
|
||||
__weak void smp_kick_all_cpus(void) {}
|
||||
|
||||
/* Subcommand: GO */
|
||||
static void boot_jump_linux(bootm_headers_t *images, int flag)
|
||||
{
|
||||
void (*kernel_entry)(int zero, int arch, uint params);
|
||||
unsigned int r0, r2;
|
||||
int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
|
||||
|
||||
kernel_entry = (void (*)(int, int, uint))images->ep;
|
||||
|
||||
debug("## Transferring control to Linux (at address %08lx)...\n",
|
||||
(ulong) kernel_entry);
|
||||
bootstage_mark(BOOTSTAGE_ID_RUN_OS);
|
||||
|
||||
printf("\nStarting kernel ...%s\n\n", fake ?
|
||||
"(fake run for tracing)" : "");
|
||||
bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
|
||||
|
||||
cleanup_before_linux();
|
||||
|
||||
if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) {
|
||||
r0 = 2;
|
||||
r2 = (unsigned int)images->ft_addr;
|
||||
} else {
|
||||
r0 = 1;
|
||||
r2 = (unsigned int)getenv("bootargs");
|
||||
}
|
||||
|
||||
smp_set_core_boot_addr((unsigned long)kernel_entry, -1);
|
||||
smp_kick_all_cpus();
|
||||
|
||||
if (!fake)
|
||||
kernel_entry(r0, 0, r2);
|
||||
}
|
||||
|
||||
int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
|
||||
{
|
||||
/* No need for those on ARC */
|
||||
if ((flag & BOOTM_STATE_OS_BD_T) || (flag & BOOTM_STATE_OS_CMDLINE))
|
||||
return -1;
|
||||
|
||||
if (flag & BOOTM_STATE_OS_PREP) {
|
||||
boot_prep_linux(images);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
|
||||
boot_jump_linux(images, flag);
|
||||
return 0;
|
||||
}
|
||||
|
||||
boot_prep_linux(images);
|
||||
boot_jump_linux(images, flag);
|
||||
return 0;
|
||||
}
|
||||
439
u-boot/arch/arc/lib/cache.c
Normal file
439
u-boot/arch/arc/lib/cache.c
Normal file
@@ -0,0 +1,439 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <common.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <asm/arcregs.h>
|
||||
#include <asm/cache.h>
|
||||
|
||||
/* Bit values in IC_CTRL */
|
||||
#define IC_CTRL_CACHE_DISABLE (1 << 0)
|
||||
|
||||
/* Bit values in DC_CTRL */
|
||||
#define DC_CTRL_CACHE_DISABLE (1 << 0)
|
||||
#define DC_CTRL_INV_MODE_FLUSH (1 << 6)
|
||||
#define DC_CTRL_FLUSH_STATUS (1 << 8)
|
||||
#define CACHE_VER_NUM_MASK 0xF
|
||||
#define SLC_CTRL_SB (1 << 2)
|
||||
|
||||
#define OP_INV 0x1
|
||||
#define OP_FLUSH 0x2
|
||||
#define OP_INV_IC 0x3
|
||||
|
||||
/*
|
||||
* By default that variable will fall into .bss section.
|
||||
* But .bss section is not relocated and so it will be initilized before
|
||||
* relocation but will be used after being zeroed.
|
||||
*/
|
||||
int l1_line_sz __section(".data");
|
||||
int dcache_exists __section(".data");
|
||||
int icache_exists __section(".data");
|
||||
|
||||
#define CACHE_LINE_MASK (~(l1_line_sz - 1))
|
||||
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
int slc_line_sz __section(".data");
|
||||
int slc_exists __section(".data");
|
||||
int ioc_exists __section(".data");
|
||||
|
||||
static unsigned int __before_slc_op(const int op)
|
||||
{
|
||||
unsigned int reg = reg;
|
||||
|
||||
if (op == OP_INV) {
|
||||
/*
|
||||
* IM is set by default and implies Flush-n-inv
|
||||
* Clear it here for vanilla inv
|
||||
*/
|
||||
reg = read_aux_reg(ARC_AUX_SLC_CTRL);
|
||||
write_aux_reg(ARC_AUX_SLC_CTRL, reg & ~DC_CTRL_INV_MODE_FLUSH);
|
||||
}
|
||||
|
||||
return reg;
|
||||
}
|
||||
|
||||
static void __after_slc_op(const int op, unsigned int reg)
|
||||
{
|
||||
if (op & OP_FLUSH) /* flush / flush-n-inv both wait */
|
||||
while (read_aux_reg(ARC_AUX_SLC_CTRL) &
|
||||
DC_CTRL_FLUSH_STATUS)
|
||||
;
|
||||
|
||||
/* Switch back to default Invalidate mode */
|
||||
if (op == OP_INV)
|
||||
write_aux_reg(ARC_AUX_SLC_CTRL, reg | DC_CTRL_INV_MODE_FLUSH);
|
||||
}
|
||||
|
||||
static inline void __slc_line_loop(unsigned long paddr, unsigned long sz,
|
||||
const int op)
|
||||
{
|
||||
unsigned int aux_cmd;
|
||||
int num_lines;
|
||||
|
||||
#define SLC_LINE_MASK (~(slc_line_sz - 1))
|
||||
|
||||
aux_cmd = op & OP_INV ? ARC_AUX_SLC_IVDL : ARC_AUX_SLC_FLDL;
|
||||
|
||||
sz += paddr & ~SLC_LINE_MASK;
|
||||
paddr &= SLC_LINE_MASK;
|
||||
|
||||
num_lines = DIV_ROUND_UP(sz, slc_line_sz);
|
||||
|
||||
while (num_lines-- > 0) {
|
||||
write_aux_reg(aux_cmd, paddr);
|
||||
paddr += slc_line_sz;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void __slc_entire_op(const int cacheop)
|
||||
{
|
||||
int aux;
|
||||
unsigned int ctrl_reg = __before_slc_op(cacheop);
|
||||
|
||||
if (cacheop & OP_INV) /* Inv or flush-n-inv use same cmd reg */
|
||||
aux = ARC_AUX_SLC_INVALIDATE;
|
||||
else
|
||||
aux = ARC_AUX_SLC_FLUSH;
|
||||
|
||||
write_aux_reg(aux, 0x1);
|
||||
|
||||
__after_slc_op(cacheop, ctrl_reg);
|
||||
}
|
||||
|
||||
static inline void __slc_line_op(unsigned long paddr, unsigned long sz,
|
||||
const int cacheop)
|
||||
{
|
||||
unsigned int ctrl_reg = __before_slc_op(cacheop);
|
||||
__slc_line_loop(paddr, sz, cacheop);
|
||||
__after_slc_op(cacheop, ctrl_reg);
|
||||
}
|
||||
#else
|
||||
#define __slc_entire_op(cacheop)
|
||||
#define __slc_line_op(paddr, sz, cacheop)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
static void read_decode_cache_bcr_arcv2(void)
|
||||
{
|
||||
union {
|
||||
struct {
|
||||
#ifdef CONFIG_CPU_BIG_ENDIAN
|
||||
unsigned int pad:24, way:2, lsz:2, sz:4;
|
||||
#else
|
||||
unsigned int sz:4, lsz:2, way:2, pad:24;
|
||||
#endif
|
||||
} fields;
|
||||
unsigned int word;
|
||||
} slc_cfg;
|
||||
|
||||
union {
|
||||
struct {
|
||||
#ifdef CONFIG_CPU_BIG_ENDIAN
|
||||
unsigned int pad:24, ver:8;
|
||||
#else
|
||||
unsigned int ver:8, pad:24;
|
||||
#endif
|
||||
} fields;
|
||||
unsigned int word;
|
||||
} sbcr;
|
||||
|
||||
sbcr.word = read_aux_reg(ARC_BCR_SLC);
|
||||
if (sbcr.fields.ver) {
|
||||
slc_cfg.word = read_aux_reg(ARC_AUX_SLC_CONFIG);
|
||||
slc_exists = 1;
|
||||
slc_line_sz = (slc_cfg.fields.lsz == 0) ? 128 : 64;
|
||||
}
|
||||
|
||||
union {
|
||||
struct bcr_clust_cfg {
|
||||
#ifdef CONFIG_CPU_BIG_ENDIAN
|
||||
unsigned int pad:7, c:1, num_entries:8, num_cores:8, ver:8;
|
||||
#else
|
||||
unsigned int ver:8, num_cores:8, num_entries:8, c:1, pad:7;
|
||||
#endif
|
||||
} fields;
|
||||
unsigned int word;
|
||||
} cbcr;
|
||||
|
||||
cbcr.word = read_aux_reg(ARC_BCR_CLUSTER);
|
||||
if (cbcr.fields.c)
|
||||
ioc_exists = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
void read_decode_cache_bcr(void)
|
||||
{
|
||||
int dc_line_sz = 0, ic_line_sz = 0;
|
||||
|
||||
union {
|
||||
struct {
|
||||
#ifdef CONFIG_CPU_BIG_ENDIAN
|
||||
unsigned int pad:12, line_len:4, sz:4, config:4, ver:8;
|
||||
#else
|
||||
unsigned int ver:8, config:4, sz:4, line_len:4, pad:12;
|
||||
#endif
|
||||
} fields;
|
||||
unsigned int word;
|
||||
} ibcr, dbcr;
|
||||
|
||||
ibcr.word = read_aux_reg(ARC_BCR_IC_BUILD);
|
||||
if (ibcr.fields.ver) {
|
||||
icache_exists = 1;
|
||||
l1_line_sz = ic_line_sz = 8 << ibcr.fields.line_len;
|
||||
if (!ic_line_sz)
|
||||
panic("Instruction exists but line length is 0\n");
|
||||
}
|
||||
|
||||
dbcr.word = read_aux_reg(ARC_BCR_DC_BUILD);
|
||||
if (dbcr.fields.ver){
|
||||
dcache_exists = 1;
|
||||
l1_line_sz = dc_line_sz = 16 << dbcr.fields.line_len;
|
||||
if (!dc_line_sz)
|
||||
panic("Data cache exists but line length is 0\n");
|
||||
}
|
||||
|
||||
if (ic_line_sz && dc_line_sz && (ic_line_sz != dc_line_sz))
|
||||
panic("Instruction and data cache line lengths differ\n");
|
||||
}
|
||||
|
||||
void cache_init(void)
|
||||
{
|
||||
read_decode_cache_bcr();
|
||||
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
read_decode_cache_bcr_arcv2();
|
||||
|
||||
if (ioc_exists) {
|
||||
flush_dcache_all();
|
||||
invalidate_dcache_all();
|
||||
|
||||
/* IO coherency base - 0x8z */
|
||||
write_aux_reg(ARC_AUX_IO_COH_AP0_BASE, 0x80000);
|
||||
/* IO coherency aperture size - 512Mb: 0x8z-0xAz */
|
||||
write_aux_reg(ARC_AUX_IO_COH_AP0_SIZE, 0x11);
|
||||
/* Enable partial writes */
|
||||
write_aux_reg(ARC_AUX_IO_COH_PARTIAL, 1);
|
||||
/* Enable IO coherency */
|
||||
write_aux_reg(ARC_AUX_IO_COH_ENABLE, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int icache_status(void)
|
||||
{
|
||||
if (!icache_exists)
|
||||
return 0;
|
||||
|
||||
if (read_aux_reg(ARC_AUX_IC_CTRL) & IC_CTRL_CACHE_DISABLE)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
void icache_enable(void)
|
||||
{
|
||||
if (icache_exists)
|
||||
write_aux_reg(ARC_AUX_IC_CTRL, read_aux_reg(ARC_AUX_IC_CTRL) &
|
||||
~IC_CTRL_CACHE_DISABLE);
|
||||
}
|
||||
|
||||
void icache_disable(void)
|
||||
{
|
||||
if (icache_exists)
|
||||
write_aux_reg(ARC_AUX_IC_CTRL, read_aux_reg(ARC_AUX_IC_CTRL) |
|
||||
IC_CTRL_CACHE_DISABLE);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SYS_DCACHE_OFF
|
||||
void invalidate_icache_all(void)
|
||||
{
|
||||
/* Any write to IC_IVIC register triggers invalidation of entire I$ */
|
||||
if (icache_status()) {
|
||||
write_aux_reg(ARC_AUX_IC_IVIC, 1);
|
||||
read_aux_reg(ARC_AUX_IC_CTRL); /* blocks */
|
||||
}
|
||||
}
|
||||
#else
|
||||
void invalidate_icache_all(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
int dcache_status(void)
|
||||
{
|
||||
if (!dcache_exists)
|
||||
return 0;
|
||||
|
||||
if (read_aux_reg(ARC_AUX_DC_CTRL) & DC_CTRL_CACHE_DISABLE)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
void dcache_enable(void)
|
||||
{
|
||||
if (!dcache_exists)
|
||||
return;
|
||||
|
||||
write_aux_reg(ARC_AUX_DC_CTRL, read_aux_reg(ARC_AUX_DC_CTRL) &
|
||||
~(DC_CTRL_INV_MODE_FLUSH | DC_CTRL_CACHE_DISABLE));
|
||||
}
|
||||
|
||||
void dcache_disable(void)
|
||||
{
|
||||
if (!dcache_exists)
|
||||
return;
|
||||
|
||||
write_aux_reg(ARC_AUX_DC_CTRL, read_aux_reg(ARC_AUX_DC_CTRL) |
|
||||
DC_CTRL_CACHE_DISABLE);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SYS_DCACHE_OFF
|
||||
/*
|
||||
* Common Helper for Line Operations on {I,D}-Cache
|
||||
*/
|
||||
static inline void __cache_line_loop(unsigned long paddr, unsigned long sz,
|
||||
const int cacheop)
|
||||
{
|
||||
unsigned int aux_cmd;
|
||||
#if (CONFIG_ARC_MMU_VER == 3)
|
||||
unsigned int aux_tag;
|
||||
#endif
|
||||
int num_lines;
|
||||
|
||||
if (cacheop == OP_INV_IC) {
|
||||
aux_cmd = ARC_AUX_IC_IVIL;
|
||||
#if (CONFIG_ARC_MMU_VER == 3)
|
||||
aux_tag = ARC_AUX_IC_PTAG;
|
||||
#endif
|
||||
} else {
|
||||
/* d$ cmd: INV (discard or wback-n-discard) OR FLUSH (wback) */
|
||||
aux_cmd = cacheop & OP_INV ? ARC_AUX_DC_IVDL : ARC_AUX_DC_FLDL;
|
||||
#if (CONFIG_ARC_MMU_VER == 3)
|
||||
aux_tag = ARC_AUX_DC_PTAG;
|
||||
#endif
|
||||
}
|
||||
|
||||
sz += paddr & ~CACHE_LINE_MASK;
|
||||
paddr &= CACHE_LINE_MASK;
|
||||
|
||||
num_lines = DIV_ROUND_UP(sz, l1_line_sz);
|
||||
|
||||
while (num_lines-- > 0) {
|
||||
#if (CONFIG_ARC_MMU_VER == 3)
|
||||
write_aux_reg(aux_tag, paddr);
|
||||
#endif
|
||||
write_aux_reg(aux_cmd, paddr);
|
||||
paddr += l1_line_sz;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int __before_dc_op(const int op)
|
||||
{
|
||||
unsigned int reg;
|
||||
|
||||
if (op == OP_INV) {
|
||||
/*
|
||||
* IM is set by default and implies Flush-n-inv
|
||||
* Clear it here for vanilla inv
|
||||
*/
|
||||
reg = read_aux_reg(ARC_AUX_DC_CTRL);
|
||||
write_aux_reg(ARC_AUX_DC_CTRL, reg & ~DC_CTRL_INV_MODE_FLUSH);
|
||||
}
|
||||
|
||||
return reg;
|
||||
}
|
||||
|
||||
static void __after_dc_op(const int op, unsigned int reg)
|
||||
{
|
||||
if (op & OP_FLUSH) /* flush / flush-n-inv both wait */
|
||||
while (read_aux_reg(ARC_AUX_DC_CTRL) & DC_CTRL_FLUSH_STATUS)
|
||||
;
|
||||
|
||||
/* Switch back to default Invalidate mode */
|
||||
if (op == OP_INV)
|
||||
write_aux_reg(ARC_AUX_DC_CTRL, reg | DC_CTRL_INV_MODE_FLUSH);
|
||||
}
|
||||
|
||||
static inline void __dc_entire_op(const int cacheop)
|
||||
{
|
||||
int aux;
|
||||
unsigned int ctrl_reg = __before_dc_op(cacheop);
|
||||
|
||||
if (cacheop & OP_INV) /* Inv or flush-n-inv use same cmd reg */
|
||||
aux = ARC_AUX_DC_IVDC;
|
||||
else
|
||||
aux = ARC_AUX_DC_FLSH;
|
||||
|
||||
write_aux_reg(aux, 0x1);
|
||||
|
||||
__after_dc_op(cacheop, ctrl_reg);
|
||||
}
|
||||
|
||||
static inline void __dc_line_op(unsigned long paddr, unsigned long sz,
|
||||
const int cacheop)
|
||||
{
|
||||
unsigned int ctrl_reg = __before_dc_op(cacheop);
|
||||
__cache_line_loop(paddr, sz, cacheop);
|
||||
__after_dc_op(cacheop, ctrl_reg);
|
||||
}
|
||||
#else
|
||||
#define __dc_entire_op(cacheop)
|
||||
#define __dc_line_op(paddr, sz, cacheop)
|
||||
#endif /* !CONFIG_SYS_DCACHE_OFF */
|
||||
|
||||
void invalidate_dcache_range(unsigned long start, unsigned long end)
|
||||
{
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
if (!ioc_exists)
|
||||
#endif
|
||||
__dc_line_op(start, end - start, OP_INV);
|
||||
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
if (slc_exists && !ioc_exists)
|
||||
__slc_line_op(start, end - start, OP_INV);
|
||||
#endif
|
||||
}
|
||||
|
||||
void flush_dcache_range(unsigned long start, unsigned long end)
|
||||
{
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
if (!ioc_exists)
|
||||
#endif
|
||||
__dc_line_op(start, end - start, OP_FLUSH);
|
||||
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
if (slc_exists && !ioc_exists)
|
||||
__slc_line_op(start, end - start, OP_FLUSH);
|
||||
#endif
|
||||
}
|
||||
|
||||
void flush_cache(unsigned long start, unsigned long size)
|
||||
{
|
||||
flush_dcache_range(start, start + size);
|
||||
}
|
||||
|
||||
void invalidate_dcache_all(void)
|
||||
{
|
||||
__dc_entire_op(OP_INV);
|
||||
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
if (slc_exists)
|
||||
__slc_entire_op(OP_INV);
|
||||
#endif
|
||||
}
|
||||
|
||||
void flush_dcache_all(void)
|
||||
{
|
||||
__dc_entire_op(OP_FLUSH);
|
||||
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
if (slc_exists)
|
||||
__slc_entire_op(OP_FLUSH);
|
||||
#endif
|
||||
}
|
||||
30
u-boot/arch/arc/lib/cpu.c
Normal file
30
u-boot/arch/arc/lib/cpu.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/arcregs.h>
|
||||
#include <asm/cache.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int arch_cpu_init(void)
|
||||
{
|
||||
timer_init();
|
||||
|
||||
gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
|
||||
gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
|
||||
|
||||
cache_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int arch_early_init_r(void)
|
||||
{
|
||||
gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
|
||||
gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
|
||||
return 0;
|
||||
}
|
||||
17
u-boot/arch/arc/lib/init_helpers.c
Normal file
17
u-boot/arch/arc/lib/init_helpers.c
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int init_cache_f_r(void)
|
||||
{
|
||||
#ifndef CONFIG_SYS_DCACHE_OFF
|
||||
flush_dcache_all();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
143
u-boot/arch/arc/lib/interrupts.c
Normal file
143
u-boot/arch/arc/lib/interrupts.c
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <asm/arcregs.h>
|
||||
#include <asm/ptrace.h>
|
||||
|
||||
/* Bit values in STATUS32 */
|
||||
#define E1_MASK (1 << 1) /* Level 1 interrupts enable */
|
||||
#define E2_MASK (1 << 2) /* Level 2 interrupts enable */
|
||||
|
||||
int interrupt_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* returns true if interrupts had been enabled before we disabled them
|
||||
*/
|
||||
int disable_interrupts(void)
|
||||
{
|
||||
int status = read_aux_reg(ARC_AUX_STATUS32);
|
||||
int state = (status & (E1_MASK | E2_MASK)) ? 1 : 0;
|
||||
|
||||
status &= ~(E1_MASK | E2_MASK);
|
||||
/* STATUS32 register is updated indirectly with "FLAG" instruction */
|
||||
__asm__("flag %0" : : "r" (status));
|
||||
return state;
|
||||
}
|
||||
|
||||
void enable_interrupts(void)
|
||||
{
|
||||
unsigned int status = read_aux_reg(ARC_AUX_STATUS32);
|
||||
|
||||
status |= E1_MASK | E2_MASK;
|
||||
/* STATUS32 register is updated indirectly with "FLAG" instruction */
|
||||
__asm__("flag %0" : : "r" (status));
|
||||
}
|
||||
|
||||
static void print_reg_file(long *reg_rev, int start_num)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* Print 3 registers per line */
|
||||
for (i = start_num; i < start_num + 25; i++) {
|
||||
printf("r%02u: 0x%08lx\t", i, (unsigned long)*reg_rev);
|
||||
if (((i + 1) % 3) == 0)
|
||||
printf("\n");
|
||||
|
||||
/* Because pt_regs has registers reversed */
|
||||
reg_rev--;
|
||||
}
|
||||
|
||||
/* Add new-line if none was inserted in the end of loop above */
|
||||
if (((i + 1) % 3) != 0)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void show_regs(struct pt_regs *regs)
|
||||
{
|
||||
printf("ECR:\t0x%08lx\n", regs->ecr);
|
||||
printf("RET:\t0x%08lx\nBLINK:\t0x%08lx\nSTAT32:\t0x%08lx\n",
|
||||
regs->ret, regs->blink, regs->status32);
|
||||
printf("GP: 0x%08lx\t r25: 0x%08lx\t\n", regs->r26, regs->r25);
|
||||
printf("BTA: 0x%08lx\t SP: 0x%08lx\t FP: 0x%08lx\n", regs->bta,
|
||||
regs->sp, regs->fp);
|
||||
printf("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n", regs->lp_start,
|
||||
regs->lp_end, regs->lp_count);
|
||||
|
||||
print_reg_file(&(regs->r0), 0);
|
||||
}
|
||||
|
||||
void bad_mode(struct pt_regs *regs)
|
||||
{
|
||||
if (regs)
|
||||
show_regs(regs);
|
||||
|
||||
panic("Resetting CPU ...\n");
|
||||
}
|
||||
|
||||
void do_memory_error(unsigned long address, struct pt_regs *regs)
|
||||
{
|
||||
printf("Memory error exception @ 0x%lx\n", address);
|
||||
bad_mode(regs);
|
||||
}
|
||||
|
||||
void do_instruction_error(unsigned long address, struct pt_regs *regs)
|
||||
{
|
||||
printf("Instruction error exception @ 0x%lx\n", address);
|
||||
bad_mode(regs);
|
||||
}
|
||||
|
||||
void do_machine_check_fault(unsigned long address, struct pt_regs *regs)
|
||||
{
|
||||
printf("Machine check exception @ 0x%lx\n", address);
|
||||
bad_mode(regs);
|
||||
}
|
||||
|
||||
void do_interrupt_handler(void)
|
||||
{
|
||||
printf("Interrupt fired\n");
|
||||
bad_mode(0);
|
||||
}
|
||||
|
||||
void do_itlb_miss(struct pt_regs *regs)
|
||||
{
|
||||
printf("I TLB miss exception\n");
|
||||
bad_mode(regs);
|
||||
}
|
||||
|
||||
void do_dtlb_miss(struct pt_regs *regs)
|
||||
{
|
||||
printf("D TLB miss exception\n");
|
||||
bad_mode(regs);
|
||||
}
|
||||
|
||||
void do_tlb_prot_violation(unsigned long address, struct pt_regs *regs)
|
||||
{
|
||||
printf("TLB protection violation or misaligned access @ 0x%lx\n",
|
||||
address);
|
||||
bad_mode(regs);
|
||||
}
|
||||
|
||||
void do_privilege_violation(struct pt_regs *regs)
|
||||
{
|
||||
printf("Privilege violation exception\n");
|
||||
bad_mode(regs);
|
||||
}
|
||||
|
||||
void do_trap(struct pt_regs *regs)
|
||||
{
|
||||
printf("Trap exception\n");
|
||||
bad_mode(regs);
|
||||
}
|
||||
|
||||
void do_extension(struct pt_regs *regs)
|
||||
{
|
||||
printf("Extension instruction exception\n");
|
||||
bad_mode(regs);
|
||||
}
|
||||
151
u-boot/arch/arc/lib/ints_low.S
Normal file
151
u-boot/arch/arc/lib/ints_low.S
Normal file
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <linux/linkage.h>
|
||||
|
||||
/*
|
||||
* Note on the LD/ST addressing modes with address register write-back
|
||||
*
|
||||
* LD.a same as LD.aw
|
||||
*
|
||||
* LD.a reg1, [reg2, x] => Pre Incr
|
||||
* Eff Addr for load = [reg2 + x]
|
||||
*
|
||||
* LD.ab reg1, [reg2, x] => Post Incr
|
||||
* Eff Addr for load = [reg2]
|
||||
*/
|
||||
|
||||
.macro PUSH reg
|
||||
st.a \reg, [%sp, -4]
|
||||
.endm
|
||||
|
||||
.macro PUSHAX aux
|
||||
lr %r9, [\aux]
|
||||
PUSH %r9
|
||||
.endm
|
||||
|
||||
.macro SAVE_R1_TO_R24
|
||||
PUSH %r1
|
||||
PUSH %r2
|
||||
PUSH %r3
|
||||
PUSH %r4
|
||||
PUSH %r5
|
||||
PUSH %r6
|
||||
PUSH %r7
|
||||
PUSH %r8
|
||||
PUSH %r9
|
||||
PUSH %r10
|
||||
PUSH %r11
|
||||
PUSH %r12
|
||||
PUSH %r13
|
||||
PUSH %r14
|
||||
PUSH %r15
|
||||
PUSH %r16
|
||||
PUSH %r17
|
||||
PUSH %r18
|
||||
PUSH %r19
|
||||
PUSH %r20
|
||||
PUSH %r21
|
||||
PUSH %r22
|
||||
PUSH %r23
|
||||
PUSH %r24
|
||||
.endm
|
||||
|
||||
.macro SAVE_ALL_SYS
|
||||
/* saving %r0 to reg->r0 in advance since we read %ecr into it */
|
||||
st %r0, [%sp, -8]
|
||||
lr %r0, [%ecr] /* all stack addressing is manual so far */
|
||||
st %r0, [%sp]
|
||||
st %sp, [%sp, -4]
|
||||
/* now move %sp to reg->r0 position so we can do "push" automatically */
|
||||
sub %sp, %sp, 8
|
||||
|
||||
SAVE_R1_TO_R24
|
||||
PUSH %r25
|
||||
PUSH %gp
|
||||
PUSH %fp
|
||||
PUSH %blink
|
||||
PUSHAX %eret
|
||||
PUSHAX %erstatus
|
||||
PUSH %lp_count
|
||||
PUSHAX %lp_end
|
||||
PUSHAX %lp_start
|
||||
PUSHAX %erbta
|
||||
.endm
|
||||
|
||||
.macro SAVE_EXCEPTION_SOURCE
|
||||
#ifdef CONFIG_MMU
|
||||
/* If MMU exists exception faulting address is loaded in EFA reg */
|
||||
lr %r0, [%efa]
|
||||
#else
|
||||
/* Otherwise in ERET (exception return) reg */
|
||||
lr %r0, [%eret]
|
||||
#endif
|
||||
.endm
|
||||
|
||||
ENTRY(memory_error)
|
||||
SAVE_ALL_SYS
|
||||
SAVE_EXCEPTION_SOURCE
|
||||
mov %r1, %sp
|
||||
j do_memory_error
|
||||
ENDPROC(memory_error)
|
||||
|
||||
ENTRY(instruction_error)
|
||||
SAVE_ALL_SYS
|
||||
SAVE_EXCEPTION_SOURCE
|
||||
mov %r1, %sp
|
||||
j do_instruction_error
|
||||
ENDPROC(instruction_error)
|
||||
|
||||
ENTRY(interrupt_handler)
|
||||
/* Todo - save and restore CPU context when interrupts will be in use */
|
||||
bl do_interrupt_handler
|
||||
rtie
|
||||
ENDPROC(interrupt_handler)
|
||||
|
||||
ENTRY(EV_MachineCheck)
|
||||
SAVE_ALL_SYS
|
||||
SAVE_EXCEPTION_SOURCE
|
||||
mov %r1, %sp
|
||||
j do_machine_check_fault
|
||||
ENDPROC(EV_MachineCheck)
|
||||
|
||||
ENTRY(EV_TLBMissI)
|
||||
SAVE_ALL_SYS
|
||||
mov %r0, %sp
|
||||
j do_itlb_miss
|
||||
ENDPROC(EV_TLBMissI)
|
||||
|
||||
ENTRY(EV_TLBMissD)
|
||||
SAVE_ALL_SYS
|
||||
mov %r0, %sp
|
||||
j do_dtlb_miss
|
||||
ENDPROC(EV_TLBMissD)
|
||||
|
||||
ENTRY(EV_TLBProtV)
|
||||
SAVE_ALL_SYS
|
||||
SAVE_EXCEPTION_SOURCE
|
||||
mov %r1, %sp
|
||||
j do_tlb_prot_violation
|
||||
ENDPROC(EV_TLBProtV)
|
||||
|
||||
ENTRY(EV_PrivilegeV)
|
||||
SAVE_ALL_SYS
|
||||
mov %r0, %sp
|
||||
j do_privilege_violation
|
||||
ENDPROC(EV_PrivilegeV)
|
||||
|
||||
ENTRY(EV_Trap)
|
||||
SAVE_ALL_SYS
|
||||
mov %r0, %sp
|
||||
j do_trap
|
||||
ENDPROC(EV_Trap)
|
||||
|
||||
ENTRY(EV_Extension)
|
||||
SAVE_ALL_SYS
|
||||
mov %r0, %sp
|
||||
j do_extension
|
||||
ENDPROC(EV_Extension)
|
||||
161
u-boot/arch/arc/lib/libgcc2.c
Normal file
161
u-boot/arch/arc/lib/libgcc2.c
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (C) 1989-2013 Free Software Foundation, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include "libgcc2.h"
|
||||
|
||||
DWtype
|
||||
__ashldi3(DWtype u, shift_count_type b)
|
||||
{
|
||||
if (b == 0)
|
||||
return u;
|
||||
|
||||
const DWunion uu = {.ll = u};
|
||||
const shift_count_type bm = W_TYPE_SIZE - b;
|
||||
DWunion w;
|
||||
|
||||
if (bm <= 0) {
|
||||
w.s.low = 0;
|
||||
w.s.high = (UWtype)uu.s.low << -bm;
|
||||
} else {
|
||||
const UWtype carries = (UWtype) uu.s.low >> bm;
|
||||
|
||||
w.s.low = (UWtype)uu.s.low << b;
|
||||
w.s.high = ((UWtype)uu.s.high << b) | carries;
|
||||
}
|
||||
|
||||
return w.ll;
|
||||
}
|
||||
|
||||
DWtype
|
||||
__ashrdi3(DWtype u, shift_count_type b)
|
||||
{
|
||||
if (b == 0)
|
||||
return u;
|
||||
|
||||
const DWunion uu = {.ll = u};
|
||||
const shift_count_type bm = W_TYPE_SIZE - b;
|
||||
DWunion w;
|
||||
|
||||
if (bm <= 0) {
|
||||
/* w.s.high = 1..1 or 0..0 */
|
||||
w.s.high = uu.s.high >> (W_TYPE_SIZE - 1);
|
||||
w.s.low = uu.s.high >> -bm;
|
||||
} else {
|
||||
const UWtype carries = (UWtype) uu.s.high << bm;
|
||||
|
||||
w.s.high = uu.s.high >> b;
|
||||
w.s.low = ((UWtype)uu.s.low >> b) | carries;
|
||||
}
|
||||
|
||||
return w.ll;
|
||||
}
|
||||
|
||||
DWtype
|
||||
__lshrdi3(DWtype u, shift_count_type b)
|
||||
{
|
||||
if (b == 0)
|
||||
return u;
|
||||
|
||||
const DWunion uu = {.ll = u};
|
||||
const shift_count_type bm = W_TYPE_SIZE - b;
|
||||
DWunion w;
|
||||
|
||||
if (bm <= 0) {
|
||||
w.s.high = 0;
|
||||
w.s.low = (UWtype)uu.s.high >> -bm;
|
||||
} else {
|
||||
const UWtype carries = (UWtype)uu.s.high << bm;
|
||||
|
||||
w.s.high = (UWtype)uu.s.high >> b;
|
||||
w.s.low = ((UWtype)uu.s.low >> b) | carries;
|
||||
}
|
||||
|
||||
return w.ll;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
udivmodsi4(unsigned long num, unsigned long den, int modwanted)
|
||||
{
|
||||
unsigned long bit = 1;
|
||||
unsigned long res = 0;
|
||||
|
||||
while (den < num && bit && !(den & (1L<<31))) {
|
||||
den <<= 1;
|
||||
bit <<= 1;
|
||||
}
|
||||
|
||||
while (bit) {
|
||||
if (num >= den) {
|
||||
num -= den;
|
||||
res |= bit;
|
||||
}
|
||||
bit >>= 1;
|
||||
den >>= 1;
|
||||
}
|
||||
|
||||
if (modwanted)
|
||||
return num;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
long
|
||||
__divsi3(long a, long b)
|
||||
{
|
||||
int neg = 0;
|
||||
long res;
|
||||
|
||||
if (a < 0) {
|
||||
a = -a;
|
||||
neg = !neg;
|
||||
}
|
||||
|
||||
if (b < 0) {
|
||||
b = -b;
|
||||
neg = !neg;
|
||||
}
|
||||
|
||||
res = udivmodsi4(a, b, 0);
|
||||
|
||||
if (neg)
|
||||
res = -res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
long
|
||||
__modsi3(long a, long b)
|
||||
{
|
||||
int neg = 0;
|
||||
long res;
|
||||
|
||||
if (a < 0) {
|
||||
a = -a;
|
||||
neg = 1;
|
||||
}
|
||||
|
||||
if (b < 0)
|
||||
b = -b;
|
||||
|
||||
res = udivmodsi4(a, b, 1);
|
||||
|
||||
if (neg)
|
||||
res = -res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
long
|
||||
__udivsi3(long a, long b)
|
||||
{
|
||||
return udivmodsi4(a, b, 0);
|
||||
}
|
||||
|
||||
long
|
||||
__umodsi3(long a, long b)
|
||||
{
|
||||
return udivmodsi4(a, b, 1);
|
||||
}
|
||||
132
u-boot/arch/arc/lib/libgcc2.h
Normal file
132
u-boot/arch/arc/lib/libgcc2.h
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (C) 1989-2013 Free Software Foundation, Inc.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifndef __ASM_LIBGCC_H
|
||||
#define __ASM_LIBGCC_H
|
||||
|
||||
#define UNITS_PER_WORD 4 /* for ARC */
|
||||
#define BITS_PER_UNIT 8 /* for ARC */
|
||||
|
||||
#define W_TYPE_SIZE (4 * BITS_PER_UNIT)
|
||||
|
||||
#define MIN_UNITS_PER_WORD UNITS_PER_WORD
|
||||
|
||||
/* Work out the largest "word" size that we can deal with on this target. */
|
||||
#if MIN_UNITS_PER_WORD > 4
|
||||
# define LIBGCC2_MAX_UNITS_PER_WORD 8
|
||||
#elif (MIN_UNITS_PER_WORD > 2 \
|
||||
|| (MIN_UNITS_PER_WORD > 1 && __SIZEOF_LONG_LONG__ > 4))
|
||||
# define LIBGCC2_MAX_UNITS_PER_WORD 4
|
||||
#else
|
||||
# define LIBGCC2_MAX_UNITS_PER_WORD MIN_UNITS_PER_WORD
|
||||
#endif
|
||||
|
||||
/* Work out what word size we are using for this compilation.
|
||||
The value can be set on the command line. */
|
||||
#ifndef LIBGCC2_UNITS_PER_WORD
|
||||
#define LIBGCC2_UNITS_PER_WORD LIBGCC2_MAX_UNITS_PER_WORD
|
||||
#endif
|
||||
|
||||
typedef int QItype __attribute__ ((mode (QI)));
|
||||
typedef unsigned int UQItype __attribute__ ((mode (QI)));
|
||||
typedef int HItype __attribute__ ((mode (HI)));
|
||||
typedef unsigned int UHItype __attribute__ ((mode (HI)));
|
||||
#if MIN_UNITS_PER_WORD > 1
|
||||
/* These typedefs are usually forbidden on dsp's with UNITS_PER_WORD 1. */
|
||||
typedef int SItype __attribute__ ((mode (SI)));
|
||||
typedef unsigned int USItype __attribute__ ((mode (SI)));
|
||||
#if __SIZEOF_LONG_LONG__ > 4
|
||||
/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 2. */
|
||||
typedef int DItype __attribute__ ((mode (DI)));
|
||||
typedef unsigned int UDItype __attribute__ ((mode (DI)));
|
||||
#if MIN_UNITS_PER_WORD > 4
|
||||
/* These typedefs are usually forbidden on archs with UNITS_PER_WORD 4. */
|
||||
typedef int TItype __attribute__ ((mode (TI)));
|
||||
typedef unsigned int UTItype __attribute__ ((mode (TI)));
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LIBGCC2_UNITS_PER_WORD == 8
|
||||
#define W_TYPE_SIZE (8 * BITS_PER_UNIT)
|
||||
#define Wtype DItype
|
||||
#define UWtype UDItype
|
||||
#define HWtype DItype
|
||||
#define UHWtype UDItype
|
||||
#define DWtype TItype
|
||||
#define UDWtype UTItype
|
||||
#ifdef LIBGCC2_GNU_PREFIX
|
||||
#define __NW(a,b) __gnu_ ## a ## di ## b
|
||||
#define __NDW(a,b) __gnu_ ## a ## ti ## b
|
||||
#else
|
||||
#define __NW(a,b) __ ## a ## di ## b
|
||||
#define __NDW(a,b) __ ## a ## ti ## b
|
||||
#endif
|
||||
#elif LIBGCC2_UNITS_PER_WORD == 4
|
||||
#define W_TYPE_SIZE (4 * BITS_PER_UNIT)
|
||||
#define Wtype SItype
|
||||
#define UWtype USItype
|
||||
#define HWtype SItype
|
||||
#define UHWtype USItype
|
||||
#define DWtype DItype
|
||||
#define UDWtype UDItype
|
||||
#ifdef LIBGCC2_GNU_PREFIX
|
||||
#define __NW(a,b) __gnu_ ## a ## si ## b
|
||||
#define __NDW(a,b) __gnu_ ## a ## di ## b
|
||||
#else
|
||||
#define __NW(a,b) __ ## a ## si ## b
|
||||
#define __NDW(a,b) __ ## a ## di ## b
|
||||
#endif
|
||||
#elif LIBGCC2_UNITS_PER_WORD == 2
|
||||
#define W_TYPE_SIZE (2 * BITS_PER_UNIT)
|
||||
#define Wtype HItype
|
||||
#define UWtype UHItype
|
||||
#define HWtype HItype
|
||||
#define UHWtype UHItype
|
||||
#define DWtype SItype
|
||||
#define UDWtype USItype
|
||||
#ifdef LIBGCC2_GNU_PREFIX
|
||||
#define __NW(a,b) __gnu_ ## a ## hi ## b
|
||||
#define __NDW(a,b) __gnu_ ## a ## si ## b
|
||||
#else
|
||||
#define __NW(a,b) __ ## a ## hi ## b
|
||||
#define __NDW(a,b) __ ## a ## si ## b
|
||||
#endif
|
||||
#else
|
||||
#define W_TYPE_SIZE BITS_PER_UNIT
|
||||
#define Wtype QItype
|
||||
#define UWtype UQItype
|
||||
#define HWtype QItype
|
||||
#define UHWtype UQItype
|
||||
#define DWtype HItype
|
||||
#define UDWtype UHItype
|
||||
#ifdef LIBGCC2_GNU_PREFIX
|
||||
#define __NW(a,b) __gnu_ ## a ## qi ## b
|
||||
#define __NDW(a,b) __gnu_ ## a ## hi ## b
|
||||
#else
|
||||
#define __NW(a,b) __ ## a ## qi ## b
|
||||
#define __NDW(a,b) __ ## a ## hi ## b
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
|
||||
|
||||
#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__
|
||||
struct DWstruct {Wtype high, low;};
|
||||
#else
|
||||
struct DWstruct {Wtype low, high;};
|
||||
#endif
|
||||
|
||||
/* We need this union to unpack/pack DImode values, since we don't have
|
||||
any arithmetic yet. Incoming DImode parameters are stored into the
|
||||
`ll' field, and the unpacked result is read from the struct `s'. */
|
||||
|
||||
typedef union {
|
||||
struct DWstruct s;
|
||||
DWtype ll;
|
||||
} DWunion;
|
||||
|
||||
#endif /* __ASM_LIBGCC_H */
|
||||
123
u-boot/arch/arc/lib/memcmp.S
Normal file
123
u-boot/arch/arc/lib/memcmp.S
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#define WORD2 r2
|
||||
#define SHIFT r3
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
#define WORD2 r3
|
||||
#define SHIFT r2
|
||||
#endif /* _ENDIAN__ */
|
||||
|
||||
.global memcmp
|
||||
.align 4
|
||||
memcmp:
|
||||
or %r12, %r0, %r1
|
||||
asl_s %r12, %r12, 30
|
||||
sub %r3, %r2, 1
|
||||
brls %r2, %r12, .Lbytewise
|
||||
ld %r4, [%r0, 0]
|
||||
ld %r5, [%r1, 0]
|
||||
lsr.f %lp_count, %r3, 3
|
||||
lpne .Loop_end
|
||||
ld_s WORD2, [%r0, 4]
|
||||
ld_s %r12, [%r1, 4]
|
||||
brne %r4, %r5, .Leven
|
||||
ld.a %r4, [%r0, 8]
|
||||
ld.a %r5, [%r1, 8]
|
||||
brne WORD2, %r12, .Lodd
|
||||
nop
|
||||
.Loop_end:
|
||||
asl_s SHIFT, SHIFT, 3
|
||||
bhs_s .Last_cmp
|
||||
brne %r4, %r5, .Leven
|
||||
ld %r4, [%r0, 4]
|
||||
ld %r5, [%r1, 4]
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
nop_s
|
||||
/* one more load latency cycle */
|
||||
.Last_cmp:
|
||||
xor %r0, %r4, %r5
|
||||
bset %r0, %r0, SHIFT
|
||||
sub_s %r1, %r0, 1
|
||||
bic_s %r1, %r1, %r0
|
||||
norm %r1, %r1
|
||||
b.d .Leven_cmp
|
||||
and %r1, %r1, 24
|
||||
.Leven:
|
||||
xor %r0, %r4, %r5
|
||||
sub_s %r1, %r0, 1
|
||||
bic_s %r1, %r1, %r0
|
||||
norm %r1, %r1
|
||||
/* slow track insn */
|
||||
and %r1, %r1, 24
|
||||
.Leven_cmp:
|
||||
asl %r2, %r4, %r1
|
||||
asl %r12, %r5, %r1
|
||||
lsr_s %r2, %r2, 1
|
||||
lsr_s %r12, %r12, 1
|
||||
j_s.d [%blink]
|
||||
sub %r0, %r2, %r12
|
||||
.balign 4
|
||||
.Lodd:
|
||||
xor %r0, WORD2, %r12
|
||||
sub_s %r1, %r0, 1
|
||||
bic_s %r1, %r1, %r0
|
||||
norm %r1, %r1
|
||||
/* slow track insn */
|
||||
and %r1, %r1, 24
|
||||
asl_s %r2, %r2, %r1
|
||||
asl_s %r12, %r12, %r1
|
||||
lsr_s %r2, %r2, 1
|
||||
lsr_s %r12, %r12, 1
|
||||
j_s.d [%blink]
|
||||
sub %r0, %r2, %r12
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
.Last_cmp:
|
||||
neg_s SHIFT, SHIFT
|
||||
lsr %r4, %r4, SHIFT
|
||||
lsr %r5, %r5, SHIFT
|
||||
/* slow track insn */
|
||||
.Leven:
|
||||
sub.f %r0, %r4, %r5
|
||||
mov.ne %r0, 1
|
||||
j_s.d [%blink]
|
||||
bset.cs %r0, %r0, 31
|
||||
.Lodd:
|
||||
cmp_s WORD2, %r12
|
||||
|
||||
mov_s %r0, 1
|
||||
j_s.d [%blink]
|
||||
bset.cs %r0, %r0, 31
|
||||
#endif /* _ENDIAN__ */
|
||||
.balign 4
|
||||
.Lbytewise:
|
||||
breq %r2, 0, .Lnil
|
||||
ldb %r4, [%r0, 0]
|
||||
ldb %r5, [%r1, 0]
|
||||
lsr.f %lp_count, %r3
|
||||
lpne .Lbyte_end
|
||||
ldb_s %r3, [%r0, 1]
|
||||
ldb %r12, [%r1, 1]
|
||||
brne %r4, %r5, .Lbyte_even
|
||||
ldb.a %r4, [%r0, 2]
|
||||
ldb.a %r5, [%r1, 2]
|
||||
brne %r3, %r12, .Lbyte_odd
|
||||
nop
|
||||
.Lbyte_end:
|
||||
bcc .Lbyte_even
|
||||
brne %r4, %r5, .Lbyte_even
|
||||
ldb_s %r3, [%r0, 1]
|
||||
ldb_s %r12, [%r1, 1]
|
||||
.Lbyte_odd:
|
||||
j_s.d [%blink]
|
||||
sub %r0, %r3, %r12
|
||||
.Lbyte_even:
|
||||
j_s.d [%blink]
|
||||
sub %r0, %r4, %r5
|
||||
.Lnil:
|
||||
j_s.d [%blink]
|
||||
mov %r0, 0
|
||||
63
u-boot/arch/arc/lib/memcpy-700.S
Normal file
63
u-boot/arch/arc/lib/memcpy-700.S
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
.global memcpy
|
||||
.align 4
|
||||
memcpy:
|
||||
or %r3, %r0, %r1
|
||||
asl_s %r3, %r3, 30
|
||||
mov_s %r5, %r0
|
||||
brls.d %r2, %r3, .Lcopy_bytewise
|
||||
sub.f %r3, %r2, 1
|
||||
ld_s %r12, [%r1, 0]
|
||||
asr.f %lp_count, %r3, 3
|
||||
bbit0.d %r3, 2, .Lnox4
|
||||
bmsk_s %r2, %r2, 1
|
||||
st.ab %r12, [%r5, 4]
|
||||
ld.a %r12, [%r1, 4]
|
||||
.Lnox4:
|
||||
lppnz .Lendloop
|
||||
ld_s %r3, [%r1, 4]
|
||||
st.ab %r12, [%r5, 4]
|
||||
ld.a %r12, [%r1, 8]
|
||||
st.ab %r3, [%r5, 4]
|
||||
.Lendloop:
|
||||
breq %r2, 0, .Last_store
|
||||
ld %r3, [%r5, 0]
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
add3 %r2, -1, %r2
|
||||
/* uses long immediate */
|
||||
xor_s %r12, %r12, %r3
|
||||
bmsk %r12, %r12, %r2
|
||||
xor_s %r12, %r12, %r3
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
sub3 %r2, 31, %r2
|
||||
/* uses long immediate */
|
||||
xor_s %r3, %r3, %r12
|
||||
bmsk %r3, %r3, %r2
|
||||
xor_s %r12, %r12, %r3
|
||||
#endif /* _ENDIAN__ */
|
||||
.Last_store:
|
||||
j_s.d [%blink]
|
||||
st %r12, [%r5, 0]
|
||||
|
||||
.balign 4
|
||||
.Lcopy_bytewise:
|
||||
jcs [%blink]
|
||||
ldb_s %r12, [%r1, 0]
|
||||
lsr.f %lp_count, %r3
|
||||
bhs_s .Lnox1
|
||||
stb.ab %r12, [%r5, 1]
|
||||
ldb.a %r12, [%r1, 1]
|
||||
.Lnox1:
|
||||
lppnz .Lendbloop
|
||||
ldb_s %r3, [%r1, 1]
|
||||
stb.ab %r12, [%r5, 1]
|
||||
ldb.a %r12, [%r1, 2]
|
||||
stb.ab %r3, [%r5, 1]
|
||||
.Lendbloop:
|
||||
j_s.d [%blink]
|
||||
stb %r12, [%r5, 0]
|
||||
62
u-boot/arch/arc/lib/memset.S
Normal file
62
u-boot/arch/arc/lib/memset.S
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#define SMALL 7 /* Must be at least 6 to deal with alignment/loop issues. */
|
||||
|
||||
.global memset
|
||||
.align 4
|
||||
memset:
|
||||
mov_s %r4, %r0
|
||||
or %r12, %r0, %r2
|
||||
bmsk.f %r12, %r12, 1
|
||||
extb_s %r1, %r1
|
||||
asl %r3, %r1, 8
|
||||
beq.d .Laligned
|
||||
or_s %r1, %r1, %r3
|
||||
brls %r2, SMALL, .Ltiny
|
||||
add %r3, %r2, %r0
|
||||
stb %r1, [%r3, -1]
|
||||
bclr_s %r3, %r3, 0
|
||||
stw %r1, [%r3, -2]
|
||||
bmsk.f %r12, %r0, 1
|
||||
add_s %r2, %r2, %r12
|
||||
sub.ne %r2, %r2, 4
|
||||
stb.ab %r1, [%r4, 1]
|
||||
and %r4, %r4, -2
|
||||
stw.ab %r1, [%r4, 2]
|
||||
and %r4, %r4, -4
|
||||
|
||||
.balign 4
|
||||
.Laligned:
|
||||
asl %r3, %r1, 16
|
||||
lsr.f %lp_count, %r2, 2
|
||||
or_s %r1, %r1, %r3
|
||||
lpne .Loop_end
|
||||
st.ab %r1, [%r4, 4]
|
||||
.Loop_end:
|
||||
j_s [%blink]
|
||||
|
||||
.balign 4
|
||||
.Ltiny:
|
||||
mov.f %lp_count, %r2
|
||||
lpne .Ltiny_end
|
||||
stb.ab %r1, [%r4, 1]
|
||||
.Ltiny_end:
|
||||
j_s [%blink]
|
||||
|
||||
/*
|
||||
* memzero: @r0 = mem, @r1 = size_t
|
||||
* memset: @r0 = mem, @r1 = char, @r2 = size_t
|
||||
*/
|
||||
|
||||
.global memzero
|
||||
.align 4
|
||||
memzero:
|
||||
/* adjust bzero args to memset args */
|
||||
mov %r2, %r1
|
||||
mov %r1, 0
|
||||
/* tail call so need to tinker with blink */
|
||||
b memset
|
||||
88
u-boot/arch/arc/lib/relocate.c
Normal file
88
u-boot/arch/arc/lib/relocate.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <elf.h>
|
||||
#include <asm/sections.h>
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
int copy_uboot_to_ram(void)
|
||||
{
|
||||
size_t len = (size_t)&__image_copy_end - (size_t)&__image_copy_start;
|
||||
|
||||
memcpy((void *)gd->relocaddr, (void *)&__image_copy_start, len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int clear_bss(void)
|
||||
{
|
||||
ulong dst_addr = (ulong)&__bss_start + gd->reloc_off;
|
||||
size_t len = (size_t)&__bss_end - (size_t)&__bss_start;
|
||||
|
||||
memset((void *)dst_addr, 0x00, len);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Base functionality is taken from x86 version with added ARC-specifics
|
||||
*/
|
||||
int do_elf_reloc_fixups(void)
|
||||
{
|
||||
Elf32_Rela *re_src = (Elf32_Rela *)(&__rel_dyn_start);
|
||||
Elf32_Rela *re_end = (Elf32_Rela *)(&__rel_dyn_end);
|
||||
|
||||
Elf32_Addr *offset_ptr_rom, *last_offset = NULL;
|
||||
Elf32_Addr *offset_ptr_ram;
|
||||
|
||||
do {
|
||||
/* Get the location from the relocation entry */
|
||||
offset_ptr_rom = (Elf32_Addr *)re_src->r_offset;
|
||||
|
||||
/* Check that the location of the relocation is in .text */
|
||||
if (offset_ptr_rom >= (Elf32_Addr *)&__image_copy_start &&
|
||||
offset_ptr_rom > last_offset) {
|
||||
unsigned int val;
|
||||
/* Switch to the in-RAM version */
|
||||
offset_ptr_ram = (Elf32_Addr *)((ulong)offset_ptr_rom +
|
||||
gd->reloc_off);
|
||||
|
||||
/*
|
||||
* Use "memcpy" because target location might be
|
||||
* 16-bit aligned on ARC so we may need to read
|
||||
* byte-by-byte. On attempt to read entire word by
|
||||
* CPU throws an exception
|
||||
*/
|
||||
memcpy(&val, offset_ptr_ram, sizeof(int));
|
||||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
/* If location in ".text" section swap value */
|
||||
if ((unsigned int)offset_ptr_rom <
|
||||
(unsigned int)&__ivt_end)
|
||||
val = (val << 16) | (val >> 16);
|
||||
#endif
|
||||
|
||||
/* Check that the target points into executable */
|
||||
if (val >= (unsigned int)&__image_copy_start && val <=
|
||||
(unsigned int)&__image_copy_end) {
|
||||
val += gd->reloc_off;
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
/* If location in ".text" section swap value */
|
||||
if ((unsigned int)offset_ptr_rom <
|
||||
(unsigned int)&__ivt_end)
|
||||
val = (val << 16) | (val >> 16);
|
||||
#endif
|
||||
memcpy(offset_ptr_ram, &val, sizeof(int));
|
||||
}
|
||||
}
|
||||
last_offset = offset_ptr_rom;
|
||||
|
||||
} while (++re_src < re_end);
|
||||
|
||||
return 0;
|
||||
}
|
||||
19
u-boot/arch/arc/lib/reset.c
Normal file
19
u-boot/arch/arc/lib/reset.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <command.h>
|
||||
#include <common.h>
|
||||
|
||||
int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
|
||||
{
|
||||
printf("Put your restart handler here\n");
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Stop debug session here */
|
||||
__asm__("brk");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
23
u-boot/arch/arc/lib/sections.c
Normal file
23
u-boot/arch/arc/lib/sections.c
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/*
|
||||
* For some reason linker sets linker-generated symbols to zero in PIE mode.
|
||||
* A work-around is substitution of linker-generated symbols with
|
||||
* compiler-generated symbols which are properly handled by linker in PAE mode.
|
||||
*/
|
||||
|
||||
char __bss_start[0] __attribute__((section(".__bss_start")));
|
||||
char __bss_end[0] __attribute__((section(".__bss_end")));
|
||||
char __image_copy_start[0] __attribute__((section(".__image_copy_start")));
|
||||
char __image_copy_end[0] __attribute__((section(".__image_copy_end")));
|
||||
char __rel_dyn_start[0] __attribute__((section(".__rel_dyn_start")));
|
||||
char __rel_dyn_end[0] __attribute__((section(".__rel_dyn_end")));
|
||||
char __text_start[0] __attribute__((section(".__text_start")));
|
||||
char __text_end[0] __attribute__((section(".__text_end")));
|
||||
char __init_end[0] __attribute__((section(".__init_end")));
|
||||
char __ivt_start[0] __attribute__((section(".__ivt_start")));
|
||||
char __ivt_end[0] __attribute__((section(".__ivt_end")));
|
||||
93
u-boot/arch/arc/lib/start.S
Normal file
93
u-boot/arch/arc/lib/start.S
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <asm-offsets.h>
|
||||
#include <config.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <asm/arcregs.h>
|
||||
|
||||
ENTRY(_start)
|
||||
/* Setup interrupt vector base that matches "__text_start" */
|
||||
sr __ivt_start, [ARC_AUX_INTR_VEC_BASE]
|
||||
|
||||
; Disable/enable I-cache according to configuration
|
||||
lr r5, [ARC_BCR_IC_BUILD]
|
||||
breq r5, 0, 1f ; I$ doesn't exist
|
||||
lr r5, [ARC_AUX_IC_CTRL]
|
||||
#ifndef CONFIG_SYS_ICACHE_OFF
|
||||
bclr r5, r5, 0 ; 0 - Enable, 1 is Disable
|
||||
#else
|
||||
bset r5, r5, 0 ; I$ exists, but is not used
|
||||
#endif
|
||||
sr r5, [ARC_AUX_IC_CTRL]
|
||||
|
||||
1:
|
||||
; Disable/enable D-cache according to configuration
|
||||
lr r5, [ARC_BCR_DC_BUILD]
|
||||
breq r5, 0, 1f ; D$ doesn't exist
|
||||
lr r5, [ARC_AUX_DC_CTRL]
|
||||
bclr r5, r5, 6 ; Invalidate (discard w/o wback)
|
||||
#ifndef CONFIG_SYS_DCACHE_OFF
|
||||
bclr r5, r5, 0 ; Enable (+Inv)
|
||||
#else
|
||||
bset r5, r5, 0 ; Disable (+Inv)
|
||||
#endif
|
||||
sr r5, [ARC_AUX_DC_CTRL]
|
||||
|
||||
1:
|
||||
#ifdef CONFIG_ISA_ARCV2
|
||||
; Disable System-Level Cache (SLC)
|
||||
lr r5, [ARC_BCR_SLC]
|
||||
breq r5, 0, 1f ; SLC doesn't exist
|
||||
lr r5, [ARC_AUX_SLC_CTRL]
|
||||
bclr r5, r5, 6 ; Invalidate (discard w/o wback)
|
||||
bclr r5, r5, 0 ; Enable (+Inv)
|
||||
sr r5, [ARC_AUX_SLC_CTRL]
|
||||
|
||||
1:
|
||||
#endif
|
||||
|
||||
/* Establish C runtime stack and frame */
|
||||
mov %sp, CONFIG_SYS_INIT_SP_ADDR
|
||||
mov %fp, %sp
|
||||
|
||||
/* Allocate reserved area from current top of stack */
|
||||
mov %r0, %sp
|
||||
bl board_init_f_alloc_reserve
|
||||
/* Set stack below reserved area, adjust frame pointer accordingly */
|
||||
mov %sp, %r0
|
||||
mov %fp, %sp
|
||||
|
||||
/* Initialize reserved area - note: r0 already contains address */
|
||||
bl board_init_f_init_reserve
|
||||
|
||||
/* Zero the one and only argument of "board_init_f" */
|
||||
mov_s %r0, 0
|
||||
j board_init_f
|
||||
ENDPROC(_start)
|
||||
|
||||
/*
|
||||
* void board_init_f_r_trampoline(stack-pointer address)
|
||||
*
|
||||
* This "function" does not return, instead it continues in RAM
|
||||
* after relocating the monitor code.
|
||||
*
|
||||
* r0 = new stack-pointer
|
||||
*/
|
||||
ENTRY(board_init_f_r_trampoline)
|
||||
/* Set up the stack- and frame-pointers */
|
||||
mov %sp, %r0
|
||||
mov %fp, %sp
|
||||
|
||||
/* Update position of intterupt vector table */
|
||||
lr %r0, [ARC_AUX_INTR_VEC_BASE]
|
||||
ld %r1, [%r25, GD_RELOC_OFF]
|
||||
add %r0, %r0, %r1
|
||||
sr %r0, [ARC_AUX_INTR_VEC_BASE]
|
||||
|
||||
/* Re-enter U-Boot by calling board_init_f_r */
|
||||
j board_init_f_r
|
||||
ENDPROC(board_init_f_r_trampoline)
|
||||
141
u-boot/arch/arc/lib/strchr-700.S
Normal file
141
u-boot/arch/arc/lib/strchr-700.S
Normal file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/*
|
||||
* ARC700 has a relatively long pipeline and branch prediction, so we want
|
||||
* to avoid branches that are hard to predict. On the other hand, the
|
||||
* presence of the norm instruction makes it easier to operate on whole
|
||||
* words branch-free.
|
||||
*/
|
||||
|
||||
.global strchr
|
||||
.align 4
|
||||
strchr:
|
||||
extb_s %r1, %r1
|
||||
asl %r5, %r1, 8
|
||||
bmsk %r2, %r0, 1
|
||||
or %r5, %r5, %r1
|
||||
mov_s %r3, 0x01010101
|
||||
breq.d %r2, %r0, .Laligned
|
||||
asl %r4, %r5, 16
|
||||
sub_s %r0, %r0, %r2
|
||||
asl %r7, %r2, 3
|
||||
ld_s %r2, [%r0]
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
asl %r7, %r3, %r7
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
lsr %r7, %r3, %r7
|
||||
#endif /* _ENDIAN__ */
|
||||
or %r5, %r5, %r4
|
||||
ror %r4, %r3
|
||||
sub %r12, %r2, %r7
|
||||
bic_s %r12, %r12, %r2
|
||||
and %r12, %r12, %r4
|
||||
brne.d %r12, 0, .Lfound0_ua
|
||||
xor %r6, %r2, %r5
|
||||
ld.a %r2, [%r0, 4]
|
||||
sub %r12, %r6, %r7
|
||||
bic %r12, %r12, %r6
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
and %r7, %r12, %r4
|
||||
/* For speed, we want this branch to be unaligned. */
|
||||
breq %r7, 0, .Loop
|
||||
/* Likewise this one */
|
||||
b .Lfound_char
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
and %r12, %r12, %r4
|
||||
/* For speed, we want this branch to be unaligned. */
|
||||
breq %r12, 0, .Loop
|
||||
lsr_s %r12, %r12, 7
|
||||
bic %r2, %r7, %r6
|
||||
b.d .Lfound_char_b
|
||||
and_s %r2, %r2, %r12
|
||||
#endif /* _ENDIAN__ */
|
||||
/* We require this code address to be unaligned for speed... */
|
||||
.Laligned:
|
||||
ld_s %r2, [%r0]
|
||||
or %r5, %r5, %r4
|
||||
ror %r4, %r3
|
||||
/* ... so that this code address is aligned, for itself and ... */
|
||||
.Loop:
|
||||
sub %r12, %r2, %r3
|
||||
bic_s %r12, %r12, %r2
|
||||
and %r12, %r12, %r4
|
||||
brne.d %r12, 0, .Lfound0
|
||||
xor %r6, %r2, %r5
|
||||
ld.a %r2, [%r0, 4]
|
||||
sub %r12, %r6, %r3
|
||||
bic %r12, %r12, %r6
|
||||
and %r7, %r12, %r4
|
||||
breq %r7, 0, .Loop
|
||||
/*
|
||||
*... so that this branch is unaligned.
|
||||
* Found searched-for character.
|
||||
* r0 has already advanced to next word.
|
||||
*/
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
/*
|
||||
* We only need the information about the first matching byte
|
||||
* (i.e. the least significant matching byte) to be exact,
|
||||
* hence there is no problem with carry effects.
|
||||
*/
|
||||
.Lfound_char:
|
||||
sub %r3, %r7, 1
|
||||
bic %r3, %r3, %r7
|
||||
norm %r2, %r3
|
||||
sub_s %r0, %r0, 1
|
||||
asr_s %r2, %r2, 3
|
||||
j.d [%blink]
|
||||
sub_s %r0, %r0, %r2
|
||||
|
||||
.balign 4
|
||||
.Lfound0_ua:
|
||||
mov %r3, %r7
|
||||
.Lfound0:
|
||||
sub %r3, %r6, %r3
|
||||
bic %r3, %r3, %r6
|
||||
and %r2, %r3, %r4
|
||||
or_s %r12, %r12, %r2
|
||||
sub_s %r3, %r12, 1
|
||||
bic_s %r3, %r3, %r12
|
||||
norm %r3, %r3
|
||||
add_s %r0, %r0, 3
|
||||
asr_s %r12, %r3, 3
|
||||
asl.f 0, %r2, %r3
|
||||
sub_s %r0, %r0, %r12
|
||||
j_s.d [%blink]
|
||||
mov.pl %r0, 0
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
.Lfound_char:
|
||||
lsr %r7, %r7, 7
|
||||
|
||||
bic %r2, %r7, %r6
|
||||
.Lfound_char_b:
|
||||
norm %r2, %r2
|
||||
sub_s %r0, %r0, 4
|
||||
asr_s %r2, %r2, 3
|
||||
j.d [%blink]
|
||||
add_s %r0, %r0, %r2
|
||||
|
||||
.Lfound0_ua:
|
||||
mov_s %r3, %r7
|
||||
.Lfound0:
|
||||
asl_s %r2, %r2, 7
|
||||
or %r7, %r6, %r4
|
||||
bic_s %r12, %r12, %r2
|
||||
sub %r2, %r7, %r3
|
||||
or %r2, %r2, %r6
|
||||
bic %r12, %r2, %r12
|
||||
bic.f %r3, %r4, %r12
|
||||
norm %r3, %r3
|
||||
|
||||
add.pl %r3, %r3, 1
|
||||
asr_s %r12, %r3, 3
|
||||
asl.f 0, %r2, %r3
|
||||
add_s %r0, %r0, %r12
|
||||
j_s.d [%blink]
|
||||
mov.mi %r0, 0
|
||||
#endif /* _ENDIAN__ */
|
||||
97
u-boot/arch/arc/lib/strcmp.S
Normal file
97
u-boot/arch/arc/lib/strcmp.S
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/*
|
||||
* This is optimized primarily for the ARC700.
|
||||
* It would be possible to speed up the loops by one cycle / word
|
||||
* respective one cycle / byte by forcing double source 1 alignment, unrolling
|
||||
* by a factor of two, and speculatively loading the second word / byte of
|
||||
* source 1; however, that would increase the overhead for loop setup / finish,
|
||||
* and strcmp might often terminate early.
|
||||
*/
|
||||
|
||||
.global strcmp
|
||||
.align 4
|
||||
strcmp:
|
||||
or %r2, %r0, %r1
|
||||
bmsk_s %r2, %r2, 1
|
||||
brne %r2, 0, .Lcharloop
|
||||
mov_s %r12, 0x01010101
|
||||
ror %r5, %r12
|
||||
.Lwordloop:
|
||||
ld.ab %r2, [%r0, 4]
|
||||
ld.ab %r3, [%r1, 4]
|
||||
nop_s
|
||||
sub %r4, %r2, %r12
|
||||
bic %r4, %r4, %r2
|
||||
and %r4, %r4, %r5
|
||||
brne %r4, 0, .Lfound0
|
||||
breq %r2 ,%r3, .Lwordloop
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
xor %r0, %r2, %r3 /* mask for difference */
|
||||
sub_s %r1, %r0, 1
|
||||
bic_s %r0, %r0, %r1 /* mask for least significant difference bit */
|
||||
sub %r1, %r5, %r0
|
||||
xor %r0, %r5, %r1 /* mask for least significant difference byte */
|
||||
and_s %r2, %r2, %r0
|
||||
and_s %r3, %r3, %r0
|
||||
#endif /* _ENDIAN__ */
|
||||
cmp_s %r2, %r3
|
||||
mov_s %r0, 1
|
||||
j_s.d [%blink]
|
||||
bset.lo %r0, %r0, 31
|
||||
|
||||
.balign 4
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
.Lfound0:
|
||||
xor %r0, %r2, %r3 /* mask for difference */
|
||||
or %r0, %r0, %r4 /* or in zero indicator */
|
||||
sub_s %r1, %r0, 1
|
||||
bic_s %r0, %r0, %r1 /* mask for least significant difference bit */
|
||||
sub %r1, %r5, %r0
|
||||
xor %r0, %r5, %r1 /* mask for least significant difference byte */
|
||||
and_s %r2, %r2, %r0
|
||||
and_s %r3, %r3, %r0
|
||||
sub.f %r0, %r2, %r3
|
||||
mov.hi %r0, 1
|
||||
j_s.d [%blink]
|
||||
bset.lo %r0, %r0, 31
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
/*
|
||||
* The zero-detection above can mis-detect 0x01 bytes as zeroes
|
||||
* because of carry-propagateion from a lower significant zero byte.
|
||||
* We can compensate for this by checking that bit0 is zero.
|
||||
* This compensation is not necessary in the step where we
|
||||
* get a low estimate for r2, because in any affected bytes
|
||||
* we already have 0x00 or 0x01, which will remain unchanged
|
||||
* when bit 7 is cleared.
|
||||
*/
|
||||
.balign 4
|
||||
.Lfound0:
|
||||
lsr %r0, %r4, 8
|
||||
lsr_s %r1, %r2
|
||||
bic_s %r2, %r2, %r0 /* get low estimate for r2 and get ... */
|
||||
bic_s %r0, %r0, %r1 /* <this is the adjusted mask for zeros> */
|
||||
or_s %r3, %r3, %r0 /* ... high estimate r3 so that r2 > r3 will */
|
||||
cmp_s %r3, %r2 /* ... be independent of trailing garbage */
|
||||
or_s %r2, %r2, %r0 /* likewise for r3 > r2 */
|
||||
bic_s %r3, %r3, %r0
|
||||
rlc %r0, 0 /* r0 := r2 > r3 ? 1 : 0 */
|
||||
cmp_s %r2, %r3
|
||||
j_s.d [%blink]
|
||||
bset.lo %r0, %r0, 31
|
||||
#endif /* _ENDIAN__ */
|
||||
|
||||
.balign 4
|
||||
.Lcharloop:
|
||||
ldb.ab %r2,[%r0,1]
|
||||
ldb.ab %r3,[%r1,1]
|
||||
nop_s
|
||||
breq %r2, 0, .Lcmpend
|
||||
breq %r2, %r3, .Lcharloop
|
||||
.Lcmpend:
|
||||
j_s.d [%blink]
|
||||
sub %r0, %r2, %r3
|
||||
67
u-boot/arch/arc/lib/strcpy-700.S
Normal file
67
u-boot/arch/arc/lib/strcpy-700.S
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
/*
|
||||
* If dst and src are 4 byte aligned, copy 8 bytes at a time.
|
||||
* If the src is 4, but not 8 byte aligned, we first read 4 bytes to get
|
||||
* it 8 byte aligned. Thus, we can do a little read-ahead, without
|
||||
* dereferencing a cache line that we should not touch.
|
||||
* Note that short and long instructions have been scheduled to avoid
|
||||
* branch stalls.
|
||||
* The beq_s to r3z could be made unaligned & long to avoid a stall
|
||||
* there, but it is not likely to be taken often, and it would also be likely
|
||||
* to cost an unaligned mispredict at the next call.
|
||||
*/
|
||||
|
||||
.global strcpy
|
||||
.align 4
|
||||
strcpy:
|
||||
or %r2, %r0, %r1
|
||||
bmsk_s %r2, %r2, 1
|
||||
brne.d %r2, 0, charloop
|
||||
mov_s %r10, %r0
|
||||
ld_s %r3, [%r1, 0]
|
||||
mov %r8, 0x01010101
|
||||
bbit0.d %r1, 2, loop_start
|
||||
ror %r12, %r8
|
||||
sub %r2, %r3, %r8
|
||||
bic_s %r2, %r2, %r3
|
||||
tst_s %r2,%r12
|
||||
bne r3z
|
||||
mov_s %r4,%r3
|
||||
.balign 4
|
||||
loop:
|
||||
ld.a %r3, [%r1, 4]
|
||||
st.ab %r4, [%r10, 4]
|
||||
loop_start:
|
||||
ld.a %r4, [%r1, 4]
|
||||
sub %r2, %r3, %r8
|
||||
bic_s %r2, %r2, %r3
|
||||
tst_s %r2, %r12
|
||||
bne_s r3z
|
||||
st.ab %r3, [%r10, 4]
|
||||
sub %r2, %r4, %r8
|
||||
bic %r2, %r2, %r4
|
||||
tst %r2, %r12
|
||||
beq loop
|
||||
mov_s %r3, %r4
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
r3z: bmsk.f %r1, %r3, 7
|
||||
lsr_s %r3, %r3, 8
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
r3z: lsr.f %r1, %r3, 24
|
||||
asl_s %r3, %r3, 8
|
||||
#endif /* _ENDIAN__ */
|
||||
bne.d r3z
|
||||
stb.ab %r1, [%r10, 1]
|
||||
j_s [%blink]
|
||||
|
||||
.balign 4
|
||||
charloop:
|
||||
ldb.ab %r3, [%r1, 1]
|
||||
brne.d %r3, 0, charloop
|
||||
stb.ab %r3, [%r10, 1]
|
||||
j [%blink]
|
||||
80
u-boot/arch/arc/lib/strlen.S
Normal file
80
u-boot/arch/arc/lib/strlen.S
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2007-2010, 2011-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
.global strlen
|
||||
.align 4
|
||||
strlen:
|
||||
or %r3, %r0, 7
|
||||
ld %r2, [%r3, -7]
|
||||
ld.a %r6, [%r3, -3]
|
||||
mov %r4, 0x01010101
|
||||
/* uses long immediate */
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
asl_s %r1, %r0, 3
|
||||
btst_s %r0, 2
|
||||
asl %r7, %r4, %r1
|
||||
ror %r5, %r4
|
||||
sub %r1, %r2, %r7
|
||||
bic_s %r1, %r1, %r2
|
||||
mov.eq %r7, %r4
|
||||
sub %r12, %r6, %r7
|
||||
bic %r12, %r12, %r6
|
||||
or.eq %r12, %r12, %r1
|
||||
and %r12, %r12, %r5
|
||||
brne %r12, 0, .Learly_end
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
ror %r5, %r4
|
||||
btst_s %r0, 2
|
||||
mov_s %r1, 31
|
||||
sub3 %r7, %r1, %r0
|
||||
sub %r1, %r2, %r4
|
||||
bic_s %r1, %r1, %r2
|
||||
bmsk %r1, %r1, %r7
|
||||
sub %r12, %r6, %r4
|
||||
bic %r12, %r12, %r6
|
||||
bmsk.ne %r12, %r12, %r7
|
||||
or.eq %r12, %r12, %r1
|
||||
and %r12, %r12, %r5
|
||||
brne %r12, 0, .Learly_end
|
||||
#endif /* _ENDIAN__ */
|
||||
|
||||
.Loop:
|
||||
ld_s %r2, [%r3, 4]
|
||||
ld.a %r6, [%r3, 8]
|
||||
/* stall for load result */
|
||||
sub %r1, %r2, %r4
|
||||
bic_s %r1, %r1, %r2
|
||||
sub %r12, %r6, %r4
|
||||
bic %r12, %r12, %r6
|
||||
or %r12, %r12, %r1
|
||||
and %r12, %r12, %r5
|
||||
breq %r12, 0, .Loop
|
||||
.Lend:
|
||||
and.f %r1, %r1, %r5
|
||||
sub.ne %r3, %r3, 4
|
||||
mov.eq %r1, %r12
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
sub_s %r2, %r1, 1
|
||||
bic_s %r2, %r2, %r1
|
||||
norm %r1, %r2
|
||||
sub_s %r0, %r0, 3
|
||||
lsr_s %r1, %r1, 3
|
||||
sub %r0, %r3, %r0
|
||||
j_s.d [%blink]
|
||||
sub %r0, %r0, %r1
|
||||
#else /* __BIG_ENDIAN__ */
|
||||
lsr_s %r1, %r1, 7
|
||||
mov.eq %r2, %r6
|
||||
bic_s %r1, %r1, %r2
|
||||
norm %r1, %r1
|
||||
sub %r0, %r3, %r0
|
||||
lsr_s %r1, %r1, 3
|
||||
j_s.d [%blink]
|
||||
add %r0, %r0, %r1
|
||||
#endif /* _ENDIAN */
|
||||
.Learly_end:
|
||||
b.d .Lend
|
||||
sub_s.ne %r1, %r1, %r1
|
||||
24
u-boot/arch/arc/lib/timer.c
Normal file
24
u-boot/arch/arc/lib/timer.c
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0+
|
||||
*/
|
||||
|
||||
#include <asm/arcregs.h>
|
||||
|
||||
#define NH_MODE (1 << 1) /* Disable timer if CPU is halted */
|
||||
|
||||
int timer_init(void)
|
||||
{
|
||||
write_aux_reg(ARC_AUX_TIMER0_CTRL, NH_MODE);
|
||||
/* Set max value for counter/timer */
|
||||
write_aux_reg(ARC_AUX_TIMER0_LIMIT, 0xffffffff);
|
||||
/* Set initial count value and restart counter/timer */
|
||||
write_aux_reg(ARC_AUX_TIMER0_CNT, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long timer_read_counter(void)
|
||||
{
|
||||
return read_aux_reg(ARC_AUX_TIMER0_CNT);
|
||||
}
|
||||
Reference in New Issue
Block a user