diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/pe.h | 3 | ||||
-rw-r--r-- | include/bootcount.h | 50 | ||||
-rw-r--r-- | include/charset.h | 3 | ||||
-rw-r--r-- | include/configs/ls1088a_common.h | 5 | ||||
-rw-r--r-- | include/efi_driver.h | 3 | ||||
-rw-r--r-- | include/efi_loader.h | 3 | ||||
-rw-r--r-- | include/efi_selftest.h | 3 | ||||
-rw-r--r-- | include/fsl-mc/fsl_dpbp.h | 2 | ||||
-rw-r--r-- | include/fsl-mc/fsl_dpio.h | 2 | ||||
-rw-r--r-- | include/fsl-mc/fsl_dpmac.h | 2 | ||||
-rw-r--r-- | include/fsl-mc/fsl_dpni.h | 2 | ||||
-rw-r--r-- | include/fsl-mc/fsl_dprc.h | 2 | ||||
-rw-r--r-- | include/fsl-mc/fsl_mc_cmd.h | 2 | ||||
-rw-r--r-- | include/fsl-mc/fsl_mc_private.h | 2 | ||||
-rw-r--r-- | include/fsl_ifc.h | 4 | ||||
-rw-r--r-- | include/image.h | 3 | ||||
-rw-r--r-- | include/linux/log2.h | 63 | ||||
-rw-r--r-- | include/net.h | 2 | ||||
-rw-r--r-- | include/pe.h | 3 |
19 files changed, 105 insertions, 54 deletions
diff --git a/include/asm-generic/pe.h b/include/asm-generic/pe.h index d1683f238a..9a8b5e82e3 100644 --- a/include/asm-generic/pe.h +++ b/include/asm-generic/pe.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Portable Executable and Common Object Constants * @@ -5,8 +6,6 @@ * * based on the "Microsoft Portable Executable and Common Object File Format * Specification", revision 11, 2017-01-23 - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _ASM_PE_H diff --git a/include/bootcount.h b/include/bootcount.h index 3eb802470a..671adcc410 100644 --- a/include/bootcount.h +++ b/include/bootcount.h @@ -3,11 +3,15 @@ * (C) Copyright 2012 * Stefan Roese, DENX Software Engineering, sr@denx.de. */ +#ifndef _BOOTCOUNT_H__ +#define _BOOTCOUNT_H__ #include <common.h> #include <asm/io.h> #include <asm/byteorder.h> +#if defined(CONFIG_SPL_BOOTCOUNT_LIMIT) || defined(CONFIG_BOOTCOUNT_LIMIT) + #if !defined(CONFIG_SYS_BOOTCOUNT_LE) && !defined(CONFIG_SYS_BOOTCOUNT_BE) # if __BYTE_ORDER == __LITTLE_ENDIAN # define CONFIG_SYS_BOOTCOUNT_LE @@ -37,3 +41,49 @@ static inline u32 raw_bootcount_load(volatile u32 *addr) return in_be32(addr); } #endif + +DECLARE_GLOBAL_DATA_PTR; +static inline int bootcount_error(void) +{ + unsigned long bootcount = bootcount_load(); + unsigned long bootlimit = env_get_ulong("bootlimit", 10, 0); + + if (bootlimit && bootcount > bootlimit) { + printf("Warning: Bootlimit (%lu) exceeded.", bootlimit); + if (!(gd->flags & GD_FLG_SPL_INIT)) + printf(" Using altbootcmd."); + printf("\n"); + + return 1; + } + + return 0; +} + +static inline void bootcount_inc(void) +{ + unsigned long bootcount = bootcount_load(); + + if (gd->flags & GD_FLG_SPL_INIT) { + bootcount_store(++bootcount); + return; + } + +#ifndef CONFIG_SPL_BUILD + /* Only increment bootcount when no bootcount support in SPL */ +#ifndef CONFIG_SPL_BOOTCOUNT_LIMIT + bootcount_store(++bootcount); +#endif + env_set_ulong("bootcount", bootcount); +#endif /* !CONFIG_SPL_BUILD */ +} + +#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_BOOTCOUNT_LIMIT) +void bootcount_store(ulong a) {}; +ulong bootcount_load(void) { return 0; } +#endif /* CONFIG_SPL_BUILD && !CONFIG_SPL_BOOTCOUNT_LIMIT */ +#else +static inline int bootcount_error(void) { return 0; } +static inline void bootcount_inc(void) {} +#endif /* CONFIG_SPL_BOOTCOUNT_LIMIT || CONFIG_BOOTCOUNT_LIMIT */ +#endif /* _BOOTCOUNT_H__ */ diff --git a/include/charset.h b/include/charset.h index 2662c2f7c9..11832cbd12 100644 --- a/include/charset.h +++ b/include/charset.h @@ -1,9 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * charset conversion utils * * Copyright (c) 2017 Rob Clark - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CHARSET_H_ diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h index 0df90161d7..ea48421bbe 100644 --- a/include/configs/ls1088a_common.h +++ b/include/configs/ls1088a_common.h @@ -148,7 +148,6 @@ unsigned long long get_qixis_addr(void); #define CONFIG_SYS_LS_MC_DRAM_BLOCK_MIN_SIZE (512UL * 1024 * 1024) #endif /* Command line configuration */ -#define CONFIG_CMD_GREPENV #define CONFIG_CMD_CACHE /* Miscellaneous configurable options */ @@ -195,10 +194,6 @@ unsigned long long get_qixis_addr(void); "mcinitcmd=fsl_mc start mc 0x580a00000" \ " 0x580e00000 \0" -#define CONFIG_BOOTARGS "console=ttyS0,115200 root=/dev/ram0 " \ - "earlycon=uart8250,mmio,0x21c0500 " \ - "ramdisk_size=0x3000000 default_hugepagesz=2m" \ - " hugepagesz=2m hugepages=256" #if defined(CONFIG_QSPI_BOOT) #define CONFIG_BOOTCOMMAND "sf probe 0:0;" \ "sf read 0x80200000 0xd00000 0x100000;"\ diff --git a/include/efi_driver.h b/include/efi_driver.h index 010e55a473..840483a416 100644 --- a/include/efi_driver.h +++ b/include/efi_driver.h @@ -1,9 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * EFI application loader * * Copyright (c) 2017 Heinrich Schuchardt - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _EFI_DRIVER_H diff --git a/include/efi_loader.h b/include/efi_loader.h index 8d21ba74b1..2868ca25ab 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -1,9 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * EFI application loader * * Copyright (c) 2016 Alexander Graf - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _EFI_LOADER_H diff --git a/include/efi_selftest.h b/include/efi_selftest.h index c23bc24bed..d0a76d70ca 100644 --- a/include/efi_selftest.h +++ b/include/efi_selftest.h @@ -1,9 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * EFI application loader * * Copyright (c) 2017 Heinrich Schuchardt <xypron.glpk@gmx.de> - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _EFI_SELFTEST_H diff --git a/include/fsl-mc/fsl_dpbp.h b/include/fsl-mc/fsl_dpbp.h index 8d7c14d97d..2278ac952e 100644 --- a/include/fsl-mc/fsl_dpbp.h +++ b/include/fsl-mc/fsl_dpbp.h @@ -2,7 +2,7 @@ /* * Freescale Layerscape MC I/O wrapper * - * Copyright (C) 2013-2016 Freescale Semiconductor, Inc. + * Copyright 2013-2016 Freescale Semiconductor, Inc. * Copyright 2017 NXP */ /*! diff --git a/include/fsl-mc/fsl_dpio.h b/include/fsl-mc/fsl_dpio.h index c300c94e20..7788e1962e 100644 --- a/include/fsl-mc/fsl_dpio.h +++ b/include/fsl-mc/fsl_dpio.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Copyright (C) 2013-2016 Freescale Semiconductor + * Copyright 2013-2016 Freescale Semiconductor, Inc. * Copyright 2017 NXP */ diff --git a/include/fsl-mc/fsl_dpmac.h b/include/fsl-mc/fsl_dpmac.h index 66cf3bf6a2..1cea123a31 100644 --- a/include/fsl-mc/fsl_dpmac.h +++ b/include/fsl-mc/fsl_dpmac.h @@ -2,7 +2,7 @@ /* * Freescale Layerscape MC I/O wrapper * - * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. + * Copyright 2015-2016 Freescale Semiconductor, Inc. * Copyright 2017 NXP * Author: Prabhakar Kushwaha <prabhakar@freescale.com> */ diff --git a/include/fsl-mc/fsl_dpni.h b/include/fsl-mc/fsl_dpni.h index 309d323acf..96d81d9934 100644 --- a/include/fsl-mc/fsl_dpni.h +++ b/include/fsl-mc/fsl_dpni.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Copyright (C) 2013-2016 Freescale Semiconductor + * Copyright 2013-2016 Freescale Semiconductor, Inc. * Copyright 2017 NXP */ #ifndef _FSL_DPNI_H diff --git a/include/fsl-mc/fsl_dprc.h b/include/fsl-mc/fsl_dprc.h index 779d6f9567..950ecb0756 100644 --- a/include/fsl-mc/fsl_dprc.h +++ b/include/fsl-mc/fsl_dprc.h @@ -2,7 +2,7 @@ /* * Freescale Layerscape MC I/O wrapper * - * Copyright (C) 2013-2016 Freescale Semiconductor, Inc. + * Copyright 2013-2016 Freescale Semiconductor, Inc. * Copyright 2017 NXP */ #ifndef _FSL_DPRC_H diff --git a/include/fsl-mc/fsl_mc_cmd.h b/include/fsl-mc/fsl_mc_cmd.h index 179f669828..591cda9685 100644 --- a/include/fsl-mc/fsl_mc_cmd.h +++ b/include/fsl-mc/fsl_mc_cmd.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0+ */ -/* Copyright 2013-2016 Freescale Semiconductor Inc. +/* Copyright 2013-2016 Freescale Semiconductor, Inc. * Copyright 2017 NXP */ #ifndef __FSL_MC_CMD_H diff --git a/include/fsl-mc/fsl_mc_private.h b/include/fsl-mc/fsl_mc_private.h index f4b5a99e15..ba0bc379d5 100644 --- a/include/fsl-mc/fsl_mc_private.h +++ b/include/fsl-mc/fsl_mc_private.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Copyright (C) 2014-2016 Freescale Semiconductor + * Copyright 2014-2016 Freescale Semiconductor, Inc. * Copyright 2017 NXP */ diff --git a/include/fsl_ifc.h b/include/fsl_ifc.h index d051e92ce4..8120ca0de8 100644 --- a/include/fsl_ifc.h +++ b/include/fsl_ifc.h @@ -891,8 +891,8 @@ struct fsl_ifc_nand { u32 nand_erattr1; u32 res19[0x10]; u32 nand_fsr; - u32 res20[0x3]; - u32 nand_eccstat[6]; + u32 res20[0x1]; + u32 nand_eccstat[8]; u32 res21[0x1c]; u32 nanndcr; u32 res22[0x2]; diff --git a/include/image.h b/include/image.h index 8fa75a5a5a..df701e3470 100644 --- a/include/image.h +++ b/include/image.h @@ -259,7 +259,7 @@ enum { IH_TYPE_MXSIMAGE, /* Freescale MXSBoot Image */ IH_TYPE_GPIMAGE, /* TI Keystone GPHeader Image */ IH_TYPE_ATMELIMAGE, /* ATMEL ROM bootable Image */ - IH_TYPE_SOCFPGAIMAGE, /* Altera SOCFPGA Preloader */ + IH_TYPE_SOCFPGAIMAGE, /* Altera SOCFPGA CV/AV Preloader */ IH_TYPE_X86_SETUP, /* x86 setup.bin Image */ IH_TYPE_LPC32XXIMAGE, /* x86 setup.bin Image */ IH_TYPE_LOADABLE, /* A list of typeless images */ @@ -275,6 +275,7 @@ enum { IH_TYPE_FIRMWARE_IVT, /* Firmware Image with HABv4 IVT */ IH_TYPE_PMMC, /* TI Power Management Micro-Controller Firmware */ IH_TYPE_STM32IMAGE, /* STMicroelectronics STM32 Image */ + IH_TYPE_SOCFPGAIMAGE_V1, /* Altera SOCFPGA A10 Preloader */ IH_TYPE_COUNT, /* Number of image types */ }; diff --git a/include/linux/log2.h b/include/linux/log2.h index 4ded5ee68a..d4e32ecfc6 100644 --- a/include/linux/log2.h +++ b/include/linux/log2.h @@ -3,6 +3,11 @@ * * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) + * + * This program is free software; you can redistribute it and/or + * modify 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. */ #ifndef _LINUX_LOG2_H @@ -12,12 +17,6 @@ #include <linux/bitops.h> /* - * deal with unrepresentable constant logarithms - */ -extern __attribute__((const, noreturn)) -int ____ilog2_NaN(void); - -/* * non-constant log of base 2 calculators * - the arch may override these in asm/bitops.h if they can be implemented * more efficiently than using fls() and fls64() @@ -39,19 +38,23 @@ int __ilog2_u64(u64 n) } #endif -/* - * Determine whether some value is a power of two, where zero is +/** + * is_power_of_2() - check if a value is a power of two + * @n: the value to check + * + * Determine whether some value is a power of two, where zero is * *not* considered a power of two. + * Return: true if @n is a power of 2, otherwise false. */ - static inline __attribute__((const)) bool is_power_of_2(unsigned long n) { return (n != 0 && ((n & (n - 1)) == 0)); } -/* - * round up to nearest power of two +/** + * __roundup_pow_of_two() - round up to nearest power of two + * @n: value to round up */ static inline __attribute__((const)) unsigned long __roundup_pow_of_two(unsigned long n) @@ -59,8 +62,9 @@ unsigned long __roundup_pow_of_two(unsigned long n) return 1UL << fls_long(n - 1); } -/* - * round down to nearest power of two +/** + * __rounddown_pow_of_two() - round down to nearest power of two + * @n: value to round down */ static inline __attribute__((const)) unsigned long __rounddown_pow_of_two(unsigned long n) @@ -69,19 +73,19 @@ unsigned long __rounddown_pow_of_two(unsigned long n) } /** - * ilog2 - log of base 2 of 32-bit or a 64-bit unsigned value - * @n - parameter + * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value + * @n: parameter * * constant-capable log of base 2 calculation * - this can be used to initialise global variables from constant data, hence - * the massive ternary operator construction + * the massive ternary operator construction * * selects the appropriately-sized optimised version depending on sizeof(n) */ #define ilog2(n) \ ( \ __builtin_constant_p(n) ? ( \ - (n) < 1 ? ____ilog2_NaN() : \ + (n) < 2 ? 0 : \ (n) & (1ULL << 63) ? 63 : \ (n) & (1ULL << 62) ? 62 : \ (n) & (1ULL << 61) ? 61 : \ @@ -144,10 +148,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) (n) & (1ULL << 4) ? 4 : \ (n) & (1ULL << 3) ? 3 : \ (n) & (1ULL << 2) ? 2 : \ - (n) & (1ULL << 1) ? 1 : \ - (n) & (1ULL << 0) ? 0 : \ - ____ilog2_NaN() \ - ) : \ + 1) : \ (sizeof(n) <= 4) ? \ __ilog2_u32(n) : \ __ilog2_u64(n) \ @@ -155,7 +156,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) /** * roundup_pow_of_two - round the given value up to nearest power of two - * @n - parameter + * @n: parameter * * round the given value up to the nearest power of two * - the result is undefined when n == 0 @@ -172,7 +173,7 @@ unsigned long __rounddown_pow_of_two(unsigned long n) /** * rounddown_pow_of_two - round the given value down to nearest power of two - * @n - parameter + * @n: parameter * * round the given value down to the nearest power of two * - the result is undefined when n == 0 @@ -185,6 +186,12 @@ unsigned long __rounddown_pow_of_two(unsigned long n) __rounddown_pow_of_two(n) \ ) +static inline __attribute_const__ +int __order_base_2(unsigned long n) +{ + return n > 1 ? ilog2(n - 1) + 1 : 0; +} + /** * order_base_2 - calculate the (rounded up) base 2 order of the argument * @n: parameter @@ -198,7 +205,11 @@ unsigned long __rounddown_pow_of_two(unsigned long n) * ob2(5) = 3 * ... and so on. */ - -#define order_base_2(n) ilog2(roundup_pow_of_two(n)) - +#define order_base_2(n) \ +( \ + __builtin_constant_p(n) ? ( \ + ((n) == 0 || (n) == 1) ? 0 : \ + ilog2((n) - 1) + 1) : \ + __order_base_2(n) \ +) #endif /* _LINUX_LOG2_H */ diff --git a/include/net.h b/include/net.h index 3469811aa0..65f51d77a5 100644 --- a/include/net.h +++ b/include/net.h @@ -1,9 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * LiMon Monitor (LiMon) - Network. * * Copyright 1994 - 2000 Neil Russell. * (See License) - * SPDX-License-Identifier: GPL-2.0 * * History * 9/16/00 bor adapted to TQM823L/STK8xxL board, RARP/TFTP boot added diff --git a/include/pe.h b/include/pe.h index e7845bb7d2..d73eb142cb 100644 --- a/include/pe.h +++ b/include/pe.h @@ -1,11 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * Portable Executable binary format structures * * Copyright (c) 2016 Alexander Graf * * Based on wine code - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _PE_H |