ARM: adjust arm-smccc code for use in U-Boot

Adjust ARM SMC Calling Convention code for U-Boot:
  - Replace the license block with SPDX
  - Change path to asm-offsets.h
  - Define UNWIND() as no-op
  - Add Kconfig entry
  - Add asm-offsets

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
Masahiro Yamada 2017-04-14 11:10:23 +09:00 committed by Tom Rini
parent c2da86f39e
commit c54bcf6805
10 changed files with 28 additions and 54 deletions

View file

@ -174,6 +174,14 @@ config SYS_CACHELINE_SIZE
default 64 if SYS_CACHE_SHIFT_6 default 64 if SYS_CACHE_SHIFT_6
default 32 if SYS_CACHE_SHIFT_5 default 32 if SYS_CACHE_SHIFT_5
config ARM_SMCCC
bool "Support for ARM SMC Calling Convention (SMCCC)"
depends on CPU_V7 || ARM64
help
Say Y here if you want to enable ARM SMC Calling Convention.
This should be enabled if U-Boot needs to communicate with system
firmware (for example, PSCI) according to SMCCC.
config SEMIHOSTING config SEMIHOSTING
bool "support boot from semihosting" bool "support boot from semihosting"
help help

View file

@ -18,6 +18,7 @@ obj-y += lowlevel_init.o
endif endif
endif endif
obj-$(CONFIG_ARM_SMCCC) += smccc-call.o
obj-$(CONFIG_ARMV7_NONSEC) += nonsec_virt.o virt-v7.o virt-dt.o obj-$(CONFIG_ARMV7_NONSEC) += nonsec_virt.o virt-v7.o virt-dt.o
obj-$(CONFIG_ARMV7_PSCI) += psci.o psci-common.o obj-$(CONFIG_ARMV7_PSCI) += psci.o psci-common.o

View file

@ -1,22 +1,14 @@
/* /*
* Copyright (c) 2015, Linaro Limited * Copyright (c) 2015, Linaro Limited
* *
* This software is licensed under the terms of the GNU General Public * SPDX-License-Identifier: GPL-2.0
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
#include <asm/opcodes-sec.h> #include <asm/opcodes-sec.h>
#include <asm/opcodes-virt.h> #include <asm/opcodes-virt.h>
#include <asm/unwind.h>
#define UNWIND(x...)
/* /*
* Wrap c macros in asm macros to delay expansion until after the * Wrap c macros in asm macros to delay expansion until after the
* SMCCC asm macro is expanded. * SMCCC asm macro is expanded.

View file

@ -16,6 +16,8 @@ obj-y += tlb.o
obj-y += transition.o obj-y += transition.o
obj-y += fwcall.o obj-y += fwcall.o
obj-y += cpu-dt.o obj-y += cpu-dt.o
obj-$(CONFIG_ARM_SMCCC) += smccc-call.o
ifndef CONFIG_SPL_BUILD ifndef CONFIG_SPL_BUILD
obj-$(CONFIG_ARMV8_SPIN_TABLE) += spin_table.o spin_table_v8.o obj-$(CONFIG_ARMV8_SPIN_TABLE) += spin_table.o spin_table_v8.o
endif endif

View file

@ -1,19 +1,11 @@
/* /*
* Copyright (c) 2015, Linaro Limited * Copyright (c) 2015, Linaro Limited
* *
* This program is free software; you can redistribute it and/or modify * SPDX-License-Identifier: GPL-2.0
* it under the terms of the GNU General Public License Version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/ */
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/arm-smccc.h> #include <linux/arm-smccc.h>
#include <asm/asm-offsets.h> #include <generated/asm-offsets.h>
.macro SMCCC instr .macro SMCCC instr
.cfi_startproc .cfi_startproc

View file

@ -1,14 +1,7 @@
/* /*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Copyright (C) 2012 ARM Limited * Copyright (C) 2012 ARM Limited
*
* SPDX-License-Identifier: GPL-2.0
*/ */
#ifndef __ASM_ARM_OPCODES_SEC_H #ifndef __ASM_ARM_OPCODES_SEC_H

View file

@ -2,19 +2,7 @@
* opcodes-virt.h: Opcode definitions for the ARM virtualization extensions * opcodes-virt.h: Opcode definitions for the ARM virtualization extensions
* Copyright (C) 2012 Linaro Limited * Copyright (C) 2012 Linaro Limited
* *
* This program is free software; you can redistribute it and/or modify * SPDX-License-Identifier: GPL-2.0+
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#ifndef __ASM_ARM_OPCODES_VIRT_H #ifndef __ASM_ARM_OPCODES_VIRT_H
#define __ASM_ARM_OPCODES_VIRT_H #define __ASM_ARM_OPCODES_VIRT_H

View file

@ -1,9 +1,7 @@
/* /*
* arch/arm/include/asm/opcodes.h * arch/arm/include/asm/opcodes.h
* *
* This program is free software; you can redistribute it and/or modify * SPDX-License-Identifier: GPL-2.0
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/ */
#ifndef __ASM_ARM_OPCODES_H #ifndef __ASM_ARM_OPCODES_H

View file

@ -14,6 +14,7 @@
#include <common.h> #include <common.h>
#include <linux/kbuild.h> #include <linux/kbuild.h>
#include <linux/arm-smccc.h>
#if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX35) \ #if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX35) \
|| defined(CONFIG_MX51) || defined(CONFIG_MX53) || defined(CONFIG_MX51) || defined(CONFIG_MX53)
@ -198,5 +199,12 @@ int main(void)
DEFINE(PLL_DP_HFS_MFN, offsetof(struct dpll, dp_hfs_mfn)); DEFINE(PLL_DP_HFS_MFN, offsetof(struct dpll, dp_hfs_mfn));
#endif #endif
#ifdef CONFIG_ARM_SMCCC
DEFINE(ARM_SMCCC_RES_X0_OFFS, offsetof(struct arm_smccc_res, a0));
DEFINE(ARM_SMCCC_RES_X2_OFFS, offsetof(struct arm_smccc_res, a2));
DEFINE(ARM_SMCCC_QUIRK_ID_OFFS, offsetof(struct arm_smccc_quirk, id));
DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS, offsetof(struct arm_smccc_quirk, state));
#endif
return 0; return 0;
} }

View file

@ -1,15 +1,7 @@
/* /*
* Copyright (c) 2015, Linaro Limited * Copyright (c) 2015, Linaro Limited
* *
* This software is licensed under the terms of the GNU General Public * SPDX-License-Identifier: GPL-2.0
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/ */
#ifndef __LINUX_ARM_SMCCC_H #ifndef __LINUX_ARM_SMCCC_H
#define __LINUX_ARM_SMCCC_H #define __LINUX_ARM_SMCCC_H