Initial commit
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
From df9fb90120423c4c55b66a5dc09af23f605a406b Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Mon, 1 Dec 2014 21:37:25 +0100
|
||||
Subject: [PATCH] disk/part.c: use unsigned format when printing capacity
|
||||
To: u-boot@lists.denx.de
|
||||
|
||||
Large disks otherwise produce highly unplausible output such as
|
||||
Capacity: 1907729.0 MB = 1863.0 GB (-387938128 x 512)
|
||||
|
||||
As supposedly all size-related decimals are unsigned, use unsigned
|
||||
format in printf statement, resulting in a correct capacity being
|
||||
displayed:
|
||||
Capacity: 1907729.0 MB = 1863.0 GB (3907029168 x 512)
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
---
|
||||
disk/part.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/disk/part.c
|
||||
+++ b/disk/part.c
|
||||
@@ -229,13 +229,13 @@ void dev_print (block_dev_desc_t *dev_de
|
||||
printf (" Supports 48-bit addressing\n");
|
||||
#endif
|
||||
#if defined(CONFIG_SYS_64BIT_LBA)
|
||||
- printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%Ld x %ld)\n",
|
||||
+ printf (" Capacity: %lu.%lu MB = %lu.%lu GB (%Lu x %lu)\n",
|
||||
mb_quot, mb_rem,
|
||||
gb_quot, gb_rem,
|
||||
lba,
|
||||
dev_desc->blksz);
|
||||
#else
|
||||
- printf (" Capacity: %ld.%ld MB = %ld.%ld GB (%ld x %ld)\n",
|
||||
+ printf (" Capacity: %lu.%lu MB = %lu.%lu GB (%lu x %lu)\n",
|
||||
mb_quot, mb_rem,
|
||||
gb_quot, gb_rem,
|
||||
(ulong)lba,
|
||||
@@ -0,0 +1,52 @@
|
||||
--- a/tools/socfpgaimage.c
|
||||
+++ b/tools/socfpgaimage.c
|
||||
@@ -74,12 +74,12 @@ static uint16_t hdr_checksum(struct socf
|
||||
static void build_header(uint8_t *buf, uint8_t version, uint8_t flags,
|
||||
uint16_t length_bytes)
|
||||
{
|
||||
- header.validation = htole32(VALIDATION_WORD);
|
||||
+ header.validation = cpu_to_le32(VALIDATION_WORD);
|
||||
header.version = version;
|
||||
header.flags = flags;
|
||||
- header.length_u32 = htole16(length_bytes/4);
|
||||
+ header.length_u32 = cpu_to_le16(length_bytes/4);
|
||||
header.zero = 0;
|
||||
- header.checksum = htole16(hdr_checksum(&header));
|
||||
+ header.checksum = cpu_to_le16(hdr_checksum(&header));
|
||||
|
||||
memcpy(buf, &header, sizeof(header));
|
||||
}
|
||||
@@ -92,12 +92,12 @@ static int verify_header(const uint8_t *
|
||||
{
|
||||
memcpy(&header, buf, sizeof(header));
|
||||
|
||||
- if (le32toh(header.validation) != VALIDATION_WORD)
|
||||
+ if (le32_to_cpu(header.validation) != VALIDATION_WORD)
|
||||
return -1;
|
||||
- if (le16toh(header.checksum) != hdr_checksum(&header))
|
||||
+ if (le16_to_cpu(header.checksum) != hdr_checksum(&header))
|
||||
return -1;
|
||||
|
||||
- return le16toh(header.length_u32) * 4;
|
||||
+ return le16_to_cpu(header.length_u32) * 4;
|
||||
}
|
||||
|
||||
/* Sign the buffer and return the signed buffer size */
|
||||
@@ -116,7 +116,7 @@ static int sign_buffer(uint8_t *buf,
|
||||
/* Calculate and apply the CRC */
|
||||
calc_crc = ~pbl_crc32(0, (char *)buf, len);
|
||||
|
||||
- *((uint32_t *)(buf + len)) = htole32(calc_crc);
|
||||
+ *((uint32_t *)(buf + len)) = cpu_to_le32(calc_crc);
|
||||
|
||||
if (!pad_64k)
|
||||
return len + 4;
|
||||
@@ -150,7 +150,7 @@ static int verify_buffer(const uint8_t *
|
||||
|
||||
calc_crc = ~pbl_crc32(0, (const char *)buf, len);
|
||||
|
||||
- buf_crc = le32toh(*((uint32_t *)(buf + len)));
|
||||
+ buf_crc = le32_to_cpu(*((uint32_t *)(buf + len)));
|
||||
|
||||
if (buf_crc != calc_crc) {
|
||||
fprintf(stderr, "CRC32 does not match (%08x != %08x)\n",
|
||||
54
package/boot/uboot-oxnas/patches/150-spl-block.patch
Normal file
54
package/boot/uboot-oxnas/patches/150-spl-block.patch
Normal file
@@ -0,0 +1,54 @@
|
||||
--- a/common/spl/Makefile
|
||||
+++ b/common/spl/Makefile
|
||||
@@ -19,4 +19,5 @@ obj-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc
|
||||
obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o
|
||||
obj-$(CONFIG_SPL_FAT_SUPPORT) += spl_fat.o
|
||||
obj-$(CONFIG_SPL_SATA_SUPPORT) += spl_sata.o
|
||||
+obj-$(CONFIG_SPL_BLOCK_SUPPORT) += spl_block.o
|
||||
endif
|
||||
--- a/common/spl/spl.c
|
||||
+++ b/common/spl/spl.c
|
||||
@@ -191,6 +191,14 @@ void board_init_r(gd_t *dummy1, ulong du
|
||||
spl_spi_load_image();
|
||||
break;
|
||||
#endif
|
||||
+#ifdef CONFIG_SPL_BLOCK_SUPPORT
|
||||
+ case BOOT_DEVICE_BLOCK:
|
||||
+ {
|
||||
+ extern void spl_block_load_image(void);
|
||||
+ spl_block_load_image();
|
||||
+ break;
|
||||
+ }
|
||||
+#endif
|
||||
#ifdef CONFIG_SPL_ETH_SUPPORT
|
||||
case BOOT_DEVICE_CPGMAC:
|
||||
#ifdef CONFIG_SPL_ETH_DEVICE
|
||||
--- a/common/cmd_nvedit.c
|
||||
+++ b/common/cmd_nvedit.c
|
||||
@@ -49,6 +49,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||
!defined(CONFIG_ENV_IS_IN_SPI_FLASH) && \
|
||||
!defined(CONFIG_ENV_IS_IN_REMOTE) && \
|
||||
!defined(CONFIG_ENV_IS_IN_UBI) && \
|
||||
+ !defined(CONFIG_ENV_IS_IN_EXT4) && \
|
||||
!defined(CONFIG_ENV_IS_NOWHERE)
|
||||
# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
|
||||
SPI_FLASH|NVRAM|MMC|FAT|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
|
||||
--- a/common/Makefile
|
||||
+++ b/common/Makefile
|
||||
@@ -63,6 +63,7 @@ obj-$(CONFIG_ENV_IS_IN_ONENAND) += env_o
|
||||
obj-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
|
||||
obj-$(CONFIG_ENV_IS_IN_REMOTE) += env_remote.o
|
||||
obj-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o
|
||||
+obj-$(CONFIG_ENV_IS_IN_EXT4) += env_ext4.o
|
||||
obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
|
||||
|
||||
# command
|
||||
@@ -213,6 +214,8 @@ obj-$(CONFIG_UPDATE_TFTP) += update.o
|
||||
obj-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
|
||||
obj-$(CONFIG_CMD_DFU) += cmd_dfu.o
|
||||
obj-$(CONFIG_CMD_GPT) += cmd_gpt.o
|
||||
+else
|
||||
+obj-$(CONFIG_SPL_BLOCK_SUPPORT) += cmd_ide.o
|
||||
endif
|
||||
|
||||
ifdef CONFIG_SPL_BUILD
|
||||
142
package/boot/uboot-oxnas/patches/200-icplus-phy.patch
Normal file
142
package/boot/uboot-oxnas/patches/200-icplus-phy.patch
Normal file
@@ -0,0 +1,142 @@
|
||||
From e719404ee1241af679a51879eaad291bc27e4817 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Tue, 2 Dec 2014 14:46:05 +0100
|
||||
Subject: [PATCH] net/phy: add back icplus driver
|
||||
|
||||
IC+ phy driver was removed due to the lack of users some time ago.
|
||||
Add it back, so we can use it.
|
||||
---
|
||||
drivers/net/phy/Makefile | 1 +
|
||||
drivers/net/phy/icplus.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
drivers/net/phy/phy.c | 3 ++
|
||||
3 files changed, 84 insertions(+)
|
||||
create mode 100644 drivers/net/phy/icplus.c
|
||||
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -15,6 +15,7 @@ obj-$(CONFIG_PHY_ATHEROS) += atheros.o
|
||||
obj-$(CONFIG_PHY_BROADCOM) += broadcom.o
|
||||
obj-$(CONFIG_PHY_DAVICOM) += davicom.o
|
||||
obj-$(CONFIG_PHY_ET1011C) += et1011c.o
|
||||
+obj-$(CONFIG_PHY_ICPLUS) += icplus.o
|
||||
obj-$(CONFIG_PHY_LXT) += lxt.o
|
||||
obj-$(CONFIG_PHY_MARVELL) += marvell.o
|
||||
obj-$(CONFIG_PHY_MICREL) += micrel.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/phy/icplus.c
|
||||
@@ -0,0 +1,93 @@
|
||||
+/*
|
||||
+ * ICPlus PHY drivers
|
||||
+ *
|
||||
+ * SPDX-License-Identifier: GPL-2.0+
|
||||
+ *
|
||||
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
|
||||
+ */
|
||||
+#include <phy.h>
|
||||
+
|
||||
+/* IP101A/G - IP1001 */
|
||||
+#define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */
|
||||
+#define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */
|
||||
+#define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */
|
||||
+#define IP1001_APS_ON 11 /* IP1001 APS Mode bit */
|
||||
+#define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */
|
||||
+#define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */
|
||||
+#define IP101A_G_IRQ_PIN_USED (1<<15) /* INTR pin used */
|
||||
+#define IP101A_G_IRQ_DEFAULT IP101A_G_IRQ_PIN_USED
|
||||
+#define IP1001LF_DRIVE_MASK (15 << 5)
|
||||
+#define IP1001LF_RXCLKDRIVE_HI (2 << 5)
|
||||
+#define IP1001LF_RXDDRIVE_HI (2 << 7)
|
||||
+#define IP1001LF_RXCLKDRIVE_M (1 << 5)
|
||||
+#define IP1001LF_RXDDRIVE_M (1 << 7)
|
||||
+#define IP1001LF_RXCLKDRIVE_L (0 << 5)
|
||||
+#define IP1001LF_RXDDRIVE_L (0 << 7)
|
||||
+#define IP1001LF_RXCLKDRIVE_VL (3 << 5)
|
||||
+#define IP1001LF_RXDDRIVE_VL (3 << 7)
|
||||
+
|
||||
+static int ip1001_config(struct phy_device *phydev)
|
||||
+{
|
||||
+ int c;
|
||||
+
|
||||
+ /* Enable Auto Power Saving mode */
|
||||
+ c = phy_read(phydev, MDIO_DEVAD_NONE, IP1001_SPEC_CTRL_STATUS_2);
|
||||
+ if (c < 0)
|
||||
+ return c;
|
||||
+ c |= IP1001_APS_ON;
|
||||
+ c = phy_write(phydev, MDIO_DEVAD_NONE, IP1001_SPEC_CTRL_STATUS_2, c);
|
||||
+ if (c < 0)
|
||||
+ return c;
|
||||
+
|
||||
+ /* INTR pin used: speed/link/duplex will cause an interrupt */
|
||||
+ c = phy_write(phydev, MDIO_DEVAD_NONE, IP101A_G_IRQ_CONF_STATUS,
|
||||
+ IP101A_G_IRQ_DEFAULT);
|
||||
+ if (c < 0)
|
||||
+ return c;
|
||||
+
|
||||
+ if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
|
||||
+ /*
|
||||
+ * Additional delay (2ns) used to adjust RX clock phase
|
||||
+ * at RGMII interface
|
||||
+ */
|
||||
+ c = phy_read(phydev, MDIO_DEVAD_NONE, IP10XX_SPEC_CTRL_STATUS);
|
||||
+ if (c < 0)
|
||||
+ return c;
|
||||
+
|
||||
+ c |= IP1001_PHASE_SEL_MASK;
|
||||
+ /* adjust digtial drive strength */
|
||||
+ c &= ~IP1001LF_DRIVE_MASK;
|
||||
+ c |= IP1001LF_RXCLKDRIVE_M;
|
||||
+ c |= IP1001LF_RXDDRIVE_M;
|
||||
+ c = phy_write(phydev, MDIO_DEVAD_NONE, IP10XX_SPEC_CTRL_STATUS,
|
||||
+ c);
|
||||
+ if (c < 0)
|
||||
+ return c;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ip1001_startup(struct phy_device *phydev)
|
||||
+{
|
||||
+ genphy_update_link(phydev);
|
||||
+ genphy_parse_link(phydev);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+static struct phy_driver IP1001_driver = {
|
||||
+ .name = "ICPlus IP1001",
|
||||
+ .uid = 0x02430d90,
|
||||
+ .mask = 0x0ffffff0,
|
||||
+ .features = PHY_GBIT_FEATURES,
|
||||
+ .config = &ip1001_config,
|
||||
+ .startup = &ip1001_startup,
|
||||
+ .shutdown = &genphy_shutdown,
|
||||
+};
|
||||
+
|
||||
+int phy_icplus_init(void)
|
||||
+{
|
||||
+ phy_register(&IP1001_driver);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
--- a/drivers/net/phy/phy.c
|
||||
+++ b/drivers/net/phy/phy.c
|
||||
@@ -454,6 +454,9 @@ int phy_init(void)
|
||||
#ifdef CONFIG_PHY_ET1011C
|
||||
phy_et1011c_init();
|
||||
#endif
|
||||
+#ifdef CONFIG_PHY_ICPLUS
|
||||
+ phy_icplus_init();
|
||||
+#endif
|
||||
#ifdef CONFIG_PHY_LXT
|
||||
phy_lxt_init();
|
||||
#endif
|
||||
--- a/include/phy.h
|
||||
+++ b/include/phy.h
|
||||
@@ -225,6 +225,7 @@ int phy_atheros_init(void);
|
||||
int phy_broadcom_init(void);
|
||||
int phy_davicom_init(void);
|
||||
int phy_et1011c_init(void);
|
||||
+int phy_icplus_init(void);
|
||||
int phy_lxt_init(void);
|
||||
int phy_marvell_init(void);
|
||||
int phy_micrel_init(void);
|
||||
101
package/boot/uboot-oxnas/patches/300-oxnas-target.patch
Normal file
101
package/boot/uboot-oxnas/patches/300-oxnas-target.patch
Normal file
@@ -0,0 +1,101 @@
|
||||
--- a/arch/arm/include/asm/mach-types.h
|
||||
+++ b/arch/arm/include/asm/mach-types.h
|
||||
@@ -212,6 +212,7 @@ extern unsigned int __machine_arch_type;
|
||||
#define MACH_TYPE_EDB9307A 1128
|
||||
#define MACH_TYPE_OMAP_3430SDP 1138
|
||||
#define MACH_TYPE_VSTMS 1140
|
||||
+#define MACH_TYPE_OXNAS 1152
|
||||
#define MACH_TYPE_MICRO9M 1169
|
||||
#define MACH_TYPE_BUG 1179
|
||||
#define MACH_TYPE_AT91SAM9263EK 1202
|
||||
--- a/drivers/block/Makefile
|
||||
+++ b/drivers/block/Makefile
|
||||
@@ -21,3 +21,4 @@ obj-$(CONFIG_IDE_SIL680) += sil680.o
|
||||
obj-$(CONFIG_SANDBOX) += sandbox.o
|
||||
obj-$(CONFIG_SCSI_SYM53C8XX) += sym53c8xx.o
|
||||
obj-$(CONFIG_SYSTEMACE) += systemace.o
|
||||
+obj-$(CONFIG_IDE_PLX) += plxsata_ide.o
|
||||
--- a/drivers/usb/host/Makefile
|
||||
+++ b/drivers/usb/host/Makefile
|
||||
@@ -33,6 +33,7 @@ obj-$(CONFIG_USB_EHCI_MX6) += ehci-mx6.o
|
||||
obj-$(CONFIG_USB_EHCI_OMAP) += ehci-omap.o
|
||||
obj-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
|
||||
obj-$(CONFIG_USB_EHCI_MARVELL) += ehci-marvell.o
|
||||
+obj-$(CONFIG_USB_EHCI_OXNAS) += ehci-oxnas.o
|
||||
obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
|
||||
obj-$(CONFIG_USB_EHCI_SPEAR) += ehci-spear.o
|
||||
obj-$(CONFIG_USB_EHCI_SUNXI) += ehci-sunxi.o
|
||||
--- a/tools/.gitignore
|
||||
+++ b/tools/.gitignore
|
||||
@@ -9,6 +9,7 @@
|
||||
/mkenvimage
|
||||
/mkimage
|
||||
/mkexynosspl
|
||||
+/mkox820crc
|
||||
/mpc86x_clk
|
||||
/mxsboot
|
||||
/mksunxiboot
|
||||
--- a/tools/Makefile
|
||||
+++ b/tools/Makefile
|
||||
@@ -143,6 +143,12 @@ hostprogs-$(CONFIG_KIRKWOOD) += kwboot
|
||||
hostprogs-y += proftool
|
||||
hostprogs-$(CONFIG_STATIC_RELA) += relocate-rela
|
||||
|
||||
+
|
||||
+hostprogs-$(CONFIG_OX820) += mkox820crc$(SFX)
|
||||
+
|
||||
+mkox820crc$(SFX)-objs := mkox820crc.o lib/crc32.o
|
||||
+
|
||||
+
|
||||
# We build some files with extra pedantic flags to try to minimize things
|
||||
# that won't build on some weird host compiler -- though there are lots of
|
||||
# exceptions for files that aren't complaint.
|
||||
--- a/drivers/serial/ns16550.c
|
||||
+++ b/drivers/serial/ns16550.c
|
||||
@@ -118,6 +118,14 @@ int ns16550_calc_divisor(NS16550_t port,
|
||||
}
|
||||
port->osc_12m_sel = 0; /* clear if previsouly set */
|
||||
#endif
|
||||
+#ifdef CONFIG_OX820
|
||||
+ {
|
||||
+ /* with additional 3 bit fractional */
|
||||
+ u32 div = (CONFIG_SYS_NS16550_CLK + baudrate) / (baudrate * 2);
|
||||
+ port->reg9 = (div & 7) << 5;
|
||||
+ return (div >> 3);
|
||||
+ }
|
||||
+#endif
|
||||
|
||||
return DIV_ROUND_CLOSEST(clock, mode_x_div * baudrate);
|
||||
}
|
||||
--- a/scripts/Makefile.spl
|
||||
+++ b/scripts/Makefile.spl
|
||||
@@ -202,6 +202,9 @@ OBJCOPYFLAGS_$(SPL_BIN).bin = $(SPL_OBJC
|
||||
|
||||
$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN) FORCE
|
||||
$(call if_changed,objcopy)
|
||||
+ifdef CONFIG_OX820
|
||||
+ $(OBJTREE)/tools/mkox820crc $@
|
||||
+endif
|
||||
|
||||
LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
|
||||
ifneq ($(CONFIG_SPL_TEXT_BASE),)
|
||||
--- a/arch/arm/Kconfig
|
||||
+++ b/arch/arm/Kconfig
|
||||
@@ -488,6 +488,9 @@ config TARGET_BALLOON3
|
||||
config TARGET_H2200
|
||||
bool "Support h2200"
|
||||
|
||||
+config TARGET_OX820
|
||||
+ bool "Support ox820"
|
||||
+
|
||||
config TARGET_PALMLD
|
||||
bool "Support palmld"
|
||||
|
||||
@@ -650,6 +653,7 @@ source "board/logicpd/imx27lite/Kconfig"
|
||||
source "board/logicpd/imx31_litekit/Kconfig"
|
||||
source "board/mpl/vcma9/Kconfig"
|
||||
source "board/olimex/mx23_olinuxino/Kconfig"
|
||||
+source "board/ox820/Kconfig"
|
||||
source "board/palmld/Kconfig"
|
||||
source "board/palmtc/Kconfig"
|
||||
source "board/palmtreo680/Kconfig"
|
||||
87
package/boot/uboot-oxnas/patches/400-gcc-5-compiler.patch
Normal file
87
package/boot/uboot-oxnas/patches/400-gcc-5-compiler.patch
Normal file
@@ -0,0 +1,87 @@
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sat, 7 Feb 2015 21:52:40 +0000 (+0100)
|
||||
Subject: Add linux/compiler-gcc5.h to fix builds with gcc5
|
||||
X-Git-Tag: v2015.04-rc2~31
|
||||
X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=478b02f1a7043b673565075ea5016376f3293b23
|
||||
|
||||
Add linux/compiler-gcc5.h to fix builds with gcc5
|
||||
|
||||
Add linux/compiler-gcc5/h from the kernel sources at:
|
||||
|
||||
commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b
|
||||
Author: Steven Noonan <steven@uplinklabs.net>
|
||||
Date: Sat Oct 25 15:09:42 2014 -0700
|
||||
|
||||
compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
|
||||
--- /dev/null
|
||||
+++ b/include/linux/compiler-gcc5.h
|
||||
@@ -0,0 +1,65 @@
|
||||
+#ifndef __LINUX_COMPILER_H
|
||||
+#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
|
||||
+#endif
|
||||
+
|
||||
+#define __used __attribute__((__used__))
|
||||
+#define __must_check __attribute__((warn_unused_result))
|
||||
+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
|
||||
+
|
||||
+/* Mark functions as cold. gcc will assume any path leading to a call
|
||||
+ to them will be unlikely. This means a lot of manual unlikely()s
|
||||
+ are unnecessary now for any paths leading to the usual suspects
|
||||
+ like BUG(), printk(), panic() etc. [but let's keep them for now for
|
||||
+ older compilers]
|
||||
+
|
||||
+ Early snapshots of gcc 4.3 don't support this and we can't detect this
|
||||
+ in the preprocessor, but we can live with this because they're unreleased.
|
||||
+ Maketime probing would be overkill here.
|
||||
+
|
||||
+ gcc also has a __attribute__((__hot__)) to move hot functions into
|
||||
+ a special section, but I don't see any sense in this right now in
|
||||
+ the kernel context */
|
||||
+#define __cold __attribute__((__cold__))
|
||||
+
|
||||
+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
|
||||
+
|
||||
+#ifndef __CHECKER__
|
||||
+# define __compiletime_warning(message) __attribute__((warning(message)))
|
||||
+# define __compiletime_error(message) __attribute__((error(message)))
|
||||
+#endif /* __CHECKER__ */
|
||||
+
|
||||
+/*
|
||||
+ * Mark a position in code as unreachable. This can be used to
|
||||
+ * suppress control flow warnings after asm blocks that transfer
|
||||
+ * control elsewhere.
|
||||
+ *
|
||||
+ * Early snapshots of gcc 4.5 don't support this and we can't detect
|
||||
+ * this in the preprocessor, but we can live with this because they're
|
||||
+ * unreleased. Really, we need to have autoconf for the kernel.
|
||||
+ */
|
||||
+#define unreachable() __builtin_unreachable()
|
||||
+
|
||||
+/* Mark a function definition as prohibited from being cloned. */
|
||||
+#define __noclone __attribute__((__noclone__))
|
||||
+
|
||||
+/*
|
||||
+ * Tell the optimizer that something else uses this function or variable.
|
||||
+ */
|
||||
+#define __visible __attribute__((externally_visible))
|
||||
+
|
||||
+/*
|
||||
+ * GCC 'asm goto' miscompiles certain code sequences:
|
||||
+ *
|
||||
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
|
||||
+ *
|
||||
+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
|
||||
+ *
|
||||
+ * (asm goto is automatically volatile - the naming reflects this.)
|
||||
+ */
|
||||
+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
|
||||
+
|
||||
+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
|
||||
+#define __HAVE_BUILTIN_BSWAP32__
|
||||
+#define __HAVE_BUILTIN_BSWAP64__
|
||||
+#define __HAVE_BUILTIN_BSWAP16__
|
||||
+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
|
||||
306
package/boot/uboot-oxnas/patches/410-gcc-6-compiler.patch
Normal file
306
package/boot/uboot-oxnas/patches/410-gcc-6-compiler.patch
Normal file
@@ -0,0 +1,306 @@
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Sat, 7 Feb 2015 21:52:40 +0000 (+0100)
|
||||
Subject: Add linux/compiler-gcc6.h to fix builds with gcc6
|
||||
X-Git-Tag: v2015.04-rc2~31
|
||||
X-Git-Url: http://git.denx.de/?p=u-boot.git;a=commitdiff_plain;h=478b02f1a7043b673565075ea5016376f3293b23
|
||||
|
||||
Add linux/compiler-gcc6.h to fix builds with gcc6
|
||||
|
||||
Add linux/compiler-gcc6/h from the kernel sources at:
|
||||
|
||||
commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b
|
||||
Author: Steven Noonan <steven@uplinklabs.net>
|
||||
Date: Sat Oct 25 15:09:42 2014 -0700
|
||||
|
||||
compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles
|
||||
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
|
||||
--- /dev/null
|
||||
+++ b/include/linux/compiler-gcc6.h
|
||||
@@ -0,0 +1,284 @@
|
||||
+#ifndef __LINUX_COMPILER_H
|
||||
+#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * Common definitions for all gcc versions go here.
|
||||
+ */
|
||||
+#define GCC_VERSION (__GNUC__ * 10000 \
|
||||
+ + __GNUC_MINOR__ * 100 \
|
||||
+ + __GNUC_PATCHLEVEL__)
|
||||
+
|
||||
+/* Optimization barrier */
|
||||
+
|
||||
+/* The "volatile" is due to gcc bugs */
|
||||
+#define barrier() __asm__ __volatile__("": : :"memory")
|
||||
+/*
|
||||
+ * This version is i.e. to prevent dead stores elimination on @ptr
|
||||
+ * where gcc and llvm may behave differently when otherwise using
|
||||
+ * normal barrier(): while gcc behavior gets along with a normal
|
||||
+ * barrier(), llvm needs an explicit input variable to be assumed
|
||||
+ * clobbered. The issue is as follows: while the inline asm might
|
||||
+ * access any memory it wants, the compiler could have fit all of
|
||||
+ * @ptr into memory registers instead, and since @ptr never escaped
|
||||
+ * from that, it proofed that the inline asm wasn't touching any of
|
||||
+ * it. This version works well with both compilers, i.e. we're telling
|
||||
+ * the compiler that the inline asm absolutely may see the contents
|
||||
+ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495
|
||||
+ */
|
||||
+#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory")
|
||||
+
|
||||
+/*
|
||||
+ * This macro obfuscates arithmetic on a variable address so that gcc
|
||||
+ * shouldn't recognize the original var, and make assumptions about it.
|
||||
+ *
|
||||
+ * This is needed because the C standard makes it undefined to do
|
||||
+ * pointer arithmetic on "objects" outside their boundaries and the
|
||||
+ * gcc optimizers assume this is the case. In particular they
|
||||
+ * assume such arithmetic does not wrap.
|
||||
+ *
|
||||
+ * A miscompilation has been observed because of this on PPC.
|
||||
+ * To work around it we hide the relationship of the pointer and the object
|
||||
+ * using this macro.
|
||||
+ *
|
||||
+ * Versions of the ppc64 compiler before 4.1 had a bug where use of
|
||||
+ * RELOC_HIDE could trash r30. The bug can be worked around by changing
|
||||
+ * the inline assembly constraint from =g to =r, in this particular
|
||||
+ * case either is valid.
|
||||
+ */
|
||||
+#define RELOC_HIDE(ptr, off) \
|
||||
+({ \
|
||||
+ unsigned long __ptr; \
|
||||
+ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
|
||||
+ (typeof(ptr)) (__ptr + (off)); \
|
||||
+})
|
||||
+
|
||||
+/* Make the optimizer believe the variable can be manipulated arbitrarily. */
|
||||
+#define OPTIMIZER_HIDE_VAR(var) \
|
||||
+ __asm__ ("" : "=r" (var) : "0" (var))
|
||||
+
|
||||
+#ifdef __CHECKER__
|
||||
+#define __must_be_array(a) 0
|
||||
+#else
|
||||
+/* &a[0] degrades to a pointer: a different type from an array */
|
||||
+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * Force always-inline if the user requests it so via the .config,
|
||||
+ * or if gcc is too old:
|
||||
+ */
|
||||
+#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
|
||||
+ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
|
||||
+#define inline inline __attribute__((always_inline)) notrace
|
||||
+#define __inline__ __inline__ __attribute__((always_inline)) notrace
|
||||
+#define __inline __inline __attribute__((always_inline)) notrace
|
||||
+#else
|
||||
+/* A lot of inline functions can cause havoc with function tracing */
|
||||
+#define inline inline notrace
|
||||
+#define __inline__ __inline__ notrace
|
||||
+#define __inline __inline notrace
|
||||
+#endif
|
||||
+
|
||||
+#define __always_inline inline __attribute__((always_inline))
|
||||
+#define noinline __attribute__((noinline))
|
||||
+
|
||||
+#define __deprecated __attribute__((deprecated))
|
||||
+#define __packed __attribute__((packed))
|
||||
+#define __weak __attribute__((weak))
|
||||
+#define __alias(symbol) __attribute__((alias(#symbol)))
|
||||
+
|
||||
+/*
|
||||
+ * it doesn't make sense on ARM (currently the only user of __naked)
|
||||
+ * to trace naked functions because then mcount is called without
|
||||
+ * stack and frame pointer being set up and there is no chance to
|
||||
+ * restore the lr register to the value before mcount was called.
|
||||
+ *
|
||||
+ * The asm() bodies of naked functions often depend on standard calling
|
||||
+ * conventions, therefore they must be noinline and noclone.
|
||||
+ *
|
||||
+ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves.
|
||||
+ * See GCC PR44290.
|
||||
+ */
|
||||
+#define __naked __attribute__((naked)) noinline __noclone notrace
|
||||
+
|
||||
+#define __noreturn __attribute__((noreturn))
|
||||
+
|
||||
+/*
|
||||
+ * From the GCC manual:
|
||||
+ *
|
||||
+ * Many functions have no effects except the return value and their
|
||||
+ * return value depends only on the parameters and/or global
|
||||
+ * variables. Such a function can be subject to common subexpression
|
||||
+ * elimination and loop optimization just as an arithmetic operator
|
||||
+ * would be.
|
||||
+ * [...]
|
||||
+ */
|
||||
+#define __pure __attribute__((pure))
|
||||
+#define __aligned(x) __attribute__((aligned(x)))
|
||||
+#define __printf(a, b) __attribute__((format(printf, a, b)))
|
||||
+#define __scanf(a, b) __attribute__((format(scanf, a, b)))
|
||||
+#define __attribute_const__ __attribute__((__const__))
|
||||
+#define __maybe_unused __attribute__((unused))
|
||||
+#define __always_unused __attribute__((unused))
|
||||
+
|
||||
+/* gcc version specific checks */
|
||||
+
|
||||
+#if GCC_VERSION < 30200
|
||||
+# error Sorry, your compiler is too old - please upgrade it.
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION < 30300
|
||||
+# define __used __attribute__((__unused__))
|
||||
+#else
|
||||
+# define __used __attribute__((__used__))
|
||||
+#endif
|
||||
+
|
||||
+#ifdef CONFIG_GCOV_KERNEL
|
||||
+# if GCC_VERSION < 30400
|
||||
+# error "GCOV profiling support for gcc versions below 3.4 not included"
|
||||
+# endif /* __GNUC_MINOR__ */
|
||||
+#endif /* CONFIG_GCOV_KERNEL */
|
||||
+
|
||||
+#if GCC_VERSION >= 30400
|
||||
+#define __must_check __attribute__((warn_unused_result))
|
||||
+#define __malloc __attribute__((__malloc__))
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40000
|
||||
+
|
||||
+/* GCC 4.1.[01] miscompiles __weak */
|
||||
+#ifdef __KERNEL__
|
||||
+# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101
|
||||
+# error Your version of gcc miscompiles the __weak directive
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#define __used __attribute__((__used__))
|
||||
+#define __compiler_offsetof(a, b) \
|
||||
+ __builtin_offsetof(a, b)
|
||||
+
|
||||
+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
|
||||
+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40300
|
||||
+/* Mark functions as cold. gcc will assume any path leading to a call
|
||||
+ * to them will be unlikely. This means a lot of manual unlikely()s
|
||||
+ * are unnecessary now for any paths leading to the usual suspects
|
||||
+ * like BUG(), printk(), panic() etc. [but let's keep them for now for
|
||||
+ * older compilers]
|
||||
+ *
|
||||
+ * Early snapshots of gcc 4.3 don't support this and we can't detect this
|
||||
+ * in the preprocessor, but we can live with this because they're unreleased.
|
||||
+ * Maketime probing would be overkill here.
|
||||
+ *
|
||||
+ * gcc also has a __attribute__((__hot__)) to move hot functions into
|
||||
+ * a special section, but I don't see any sense in this right now in
|
||||
+ * the kernel context
|
||||
+ */
|
||||
+#define __cold __attribute__((__cold__))
|
||||
+
|
||||
+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
|
||||
+
|
||||
+#ifndef __CHECKER__
|
||||
+# define __compiletime_warning(message) __attribute__((warning(message)))
|
||||
+# define __compiletime_error(message) __attribute__((error(message)))
|
||||
+#endif /* __CHECKER__ */
|
||||
+#endif /* GCC_VERSION >= 40300 */
|
||||
+
|
||||
+#if GCC_VERSION >= 40500
|
||||
+/*
|
||||
+ * Mark a position in code as unreachable. This can be used to
|
||||
+ * suppress control flow warnings after asm blocks that transfer
|
||||
+ * control elsewhere.
|
||||
+ *
|
||||
+ * Early snapshots of gcc 4.5 don't support this and we can't detect
|
||||
+ * this in the preprocessor, but we can live with this because they're
|
||||
+ * unreleased. Really, we need to have autoconf for the kernel.
|
||||
+ */
|
||||
+#define unreachable() __builtin_unreachable()
|
||||
+
|
||||
+/* Mark a function definition as prohibited from being cloned. */
|
||||
+#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))
|
||||
+
|
||||
+#endif /* GCC_VERSION >= 40500 */
|
||||
+
|
||||
+#if GCC_VERSION >= 40600
|
||||
+/*
|
||||
+ * When used with Link Time Optimization, gcc can optimize away C functions or
|
||||
+ * variables which are referenced only from assembly code. __visible tells the
|
||||
+ * optimizer that something else uses this function or variable, thus preventing
|
||||
+ * this.
|
||||
+ */
|
||||
+#define __visible __attribute__((externally_visible))
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
|
||||
+/*
|
||||
+ * __assume_aligned(n, k): Tell the optimizer that the returned
|
||||
+ * pointer can be assumed to be k modulo n. The second argument is
|
||||
+ * optional (default 0), so we use a variadic macro to make the
|
||||
+ * shorthand.
|
||||
+ *
|
||||
+ * Beware: Do not apply this to functions which may return
|
||||
+ * ERR_PTRs. Also, it is probably unwise to apply it to functions
|
||||
+ * returning extra information in the low bits (but in that case the
|
||||
+ * compiler should see some alignment anyway, when the return value is
|
||||
+ * massaged by 'flags = ptr & 3; ptr &= ~3;').
|
||||
+ */
|
||||
+#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * GCC 'asm goto' miscompiles certain code sequences:
|
||||
+ *
|
||||
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
|
||||
+ *
|
||||
+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
|
||||
+ *
|
||||
+ * (asm goto is automatically volatile - the naming reflects this.)
|
||||
+ */
|
||||
+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
|
||||
+
|
||||
+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
|
||||
+#if GCC_VERSION >= 40400
|
||||
+#define __HAVE_BUILTIN_BSWAP32__
|
||||
+#define __HAVE_BUILTIN_BSWAP64__
|
||||
+#endif
|
||||
+#if GCC_VERSION >= 40800
|
||||
+#define __HAVE_BUILTIN_BSWAP16__
|
||||
+#endif
|
||||
+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
|
||||
+
|
||||
+#if GCC_VERSION >= 50000
|
||||
+#define KASAN_ABI_VERSION 4
|
||||
+#elif GCC_VERSION >= 40902
|
||||
+#define KASAN_ABI_VERSION 3
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40902
|
||||
+/*
|
||||
+ * Tell the compiler that address safety instrumentation (KASAN)
|
||||
+ * should not be applied to that function.
|
||||
+ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
|
||||
+ */
|
||||
+#define __no_sanitize_address __attribute__((no_sanitize_address))
|
||||
+#endif
|
||||
+
|
||||
+#endif /* gcc version >= 40000 specific checks */
|
||||
+
|
||||
+#if !defined(__noclone)
|
||||
+#define __noclone /* not needed */
|
||||
+#endif
|
||||
+
|
||||
+#if !defined(__no_sanitize_address)
|
||||
+#define __no_sanitize_address
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * A trick to suppress uninitialized variable warning without generating any
|
||||
+ * code
|
||||
+ */
|
||||
+#define uninitialized_var(x) x = x
|
||||
287
package/boot/uboot-oxnas/patches/420-gcc-7-compiler.patch
Normal file
287
package/boot/uboot-oxnas/patches/420-gcc-7-compiler.patch
Normal file
@@ -0,0 +1,287 @@
|
||||
--- /dev/null
|
||||
+++ b/include/linux/compiler-gcc7.h
|
||||
@@ -0,0 +1,284 @@
|
||||
+#ifndef __LINUX_COMPILER_H
|
||||
+#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * Common definitions for all gcc versions go here.
|
||||
+ */
|
||||
+#define GCC_VERSION (__GNUC__ * 10000 \
|
||||
+ + __GNUC_MINOR__ * 100 \
|
||||
+ + __GNUC_PATCHLEVEL__)
|
||||
+
|
||||
+/* Optimization barrier */
|
||||
+
|
||||
+/* The "volatile" is due to gcc bugs */
|
||||
+#define barrier() __asm__ __volatile__("": : :"memory")
|
||||
+/*
|
||||
+ * This version is i.e. to prevent dead stores elimination on @ptr
|
||||
+ * where gcc and llvm may behave differently when otherwise using
|
||||
+ * normal barrier(): while gcc behavior gets along with a normal
|
||||
+ * barrier(), llvm needs an explicit input variable to be assumed
|
||||
+ * clobbered. The issue is as follows: while the inline asm might
|
||||
+ * access any memory it wants, the compiler could have fit all of
|
||||
+ * @ptr into memory registers instead, and since @ptr never escaped
|
||||
+ * from that, it proofed that the inline asm wasn't touching any of
|
||||
+ * it. This version works well with both compilers, i.e. we're telling
|
||||
+ * the compiler that the inline asm absolutely may see the contents
|
||||
+ * of @ptr. See also: https://llvm.org/bugs/show_bug.cgi?id=15495
|
||||
+ */
|
||||
+#define barrier_data(ptr) __asm__ __volatile__("": :"r"(ptr) :"memory")
|
||||
+
|
||||
+/*
|
||||
+ * This macro obfuscates arithmetic on a variable address so that gcc
|
||||
+ * shouldn't recognize the original var, and make assumptions about it.
|
||||
+ *
|
||||
+ * This is needed because the C standard makes it undefined to do
|
||||
+ * pointer arithmetic on "objects" outside their boundaries and the
|
||||
+ * gcc optimizers assume this is the case. In particular they
|
||||
+ * assume such arithmetic does not wrap.
|
||||
+ *
|
||||
+ * A miscompilation has been observed because of this on PPC.
|
||||
+ * To work around it we hide the relationship of the pointer and the object
|
||||
+ * using this macro.
|
||||
+ *
|
||||
+ * Versions of the ppc64 compiler before 4.1 had a bug where use of
|
||||
+ * RELOC_HIDE could trash r30. The bug can be worked around by changing
|
||||
+ * the inline assembly constraint from =g to =r, in this particular
|
||||
+ * case either is valid.
|
||||
+ */
|
||||
+#define RELOC_HIDE(ptr, off) \
|
||||
+({ \
|
||||
+ unsigned long __ptr; \
|
||||
+ __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \
|
||||
+ (typeof(ptr)) (__ptr + (off)); \
|
||||
+})
|
||||
+
|
||||
+/* Make the optimizer believe the variable can be manipulated arbitrarily. */
|
||||
+#define OPTIMIZER_HIDE_VAR(var) \
|
||||
+ __asm__ ("" : "=r" (var) : "0" (var))
|
||||
+
|
||||
+#ifdef __CHECKER__
|
||||
+#define __must_be_array(a) 0
|
||||
+#else
|
||||
+/* &a[0] degrades to a pointer: a different type from an array */
|
||||
+#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * Force always-inline if the user requests it so via the .config,
|
||||
+ * or if gcc is too old:
|
||||
+ */
|
||||
+#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
|
||||
+ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4)
|
||||
+#define inline inline __attribute__((always_inline)) notrace
|
||||
+#define __inline__ __inline__ __attribute__((always_inline)) notrace
|
||||
+#define __inline __inline __attribute__((always_inline)) notrace
|
||||
+#else
|
||||
+/* A lot of inline functions can cause havoc with function tracing */
|
||||
+#define inline inline notrace
|
||||
+#define __inline__ __inline__ notrace
|
||||
+#define __inline __inline notrace
|
||||
+#endif
|
||||
+
|
||||
+#define __always_inline inline __attribute__((always_inline))
|
||||
+#define noinline __attribute__((noinline))
|
||||
+
|
||||
+#define __deprecated __attribute__((deprecated))
|
||||
+#define __packed __attribute__((packed))
|
||||
+#define __weak __attribute__((weak))
|
||||
+#define __alias(symbol) __attribute__((alias(#symbol)))
|
||||
+
|
||||
+/*
|
||||
+ * it doesn't make sense on ARM (currently the only user of __naked)
|
||||
+ * to trace naked functions because then mcount is called without
|
||||
+ * stack and frame pointer being set up and there is no chance to
|
||||
+ * restore the lr register to the value before mcount was called.
|
||||
+ *
|
||||
+ * The asm() bodies of naked functions often depend on standard calling
|
||||
+ * conventions, therefore they must be noinline and noclone.
|
||||
+ *
|
||||
+ * GCC 4.[56] currently fail to enforce this, so we must do so ourselves.
|
||||
+ * See GCC PR44290.
|
||||
+ */
|
||||
+#define __naked __attribute__((naked)) noinline __noclone notrace
|
||||
+
|
||||
+#define __noreturn __attribute__((noreturn))
|
||||
+
|
||||
+/*
|
||||
+ * From the GCC manual:
|
||||
+ *
|
||||
+ * Many functions have no effects except the return value and their
|
||||
+ * return value depends only on the parameters and/or global
|
||||
+ * variables. Such a function can be subject to common subexpression
|
||||
+ * elimination and loop optimization just as an arithmetic operator
|
||||
+ * would be.
|
||||
+ * [...]
|
||||
+ */
|
||||
+#define __pure __attribute__((pure))
|
||||
+#define __aligned(x) __attribute__((aligned(x)))
|
||||
+#define __printf(a, b) __attribute__((format(printf, a, b)))
|
||||
+#define __scanf(a, b) __attribute__((format(scanf, a, b)))
|
||||
+#define __attribute_const__ __attribute__((__const__))
|
||||
+#define __maybe_unused __attribute__((unused))
|
||||
+#define __always_unused __attribute__((unused))
|
||||
+
|
||||
+/* gcc version specific checks */
|
||||
+
|
||||
+#if GCC_VERSION < 30200
|
||||
+# error Sorry, your compiler is too old - please upgrade it.
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION < 30300
|
||||
+# define __used __attribute__((__unused__))
|
||||
+#else
|
||||
+# define __used __attribute__((__used__))
|
||||
+#endif
|
||||
+
|
||||
+#ifdef CONFIG_GCOV_KERNEL
|
||||
+# if GCC_VERSION < 30400
|
||||
+# error "GCOV profiling support for gcc versions below 3.4 not included"
|
||||
+# endif /* __GNUC_MINOR__ */
|
||||
+#endif /* CONFIG_GCOV_KERNEL */
|
||||
+
|
||||
+#if GCC_VERSION >= 30400
|
||||
+#define __must_check __attribute__((warn_unused_result))
|
||||
+#define __malloc __attribute__((__malloc__))
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40000
|
||||
+
|
||||
+/* GCC 4.1.[01] miscompiles __weak */
|
||||
+#ifdef __KERNEL__
|
||||
+# if GCC_VERSION >= 40100 && GCC_VERSION <= 40101
|
||||
+# error Your version of gcc miscompiles the __weak directive
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+#define __used __attribute__((__used__))
|
||||
+#define __compiler_offsetof(a, b) \
|
||||
+ __builtin_offsetof(a, b)
|
||||
+
|
||||
+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
|
||||
+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40300
|
||||
+/* Mark functions as cold. gcc will assume any path leading to a call
|
||||
+ * to them will be unlikely. This means a lot of manual unlikely()s
|
||||
+ * are unnecessary now for any paths leading to the usual suspects
|
||||
+ * like BUG(), printk(), panic() etc. [but let's keep them for now for
|
||||
+ * older compilers]
|
||||
+ *
|
||||
+ * Early snapshots of gcc 4.3 don't support this and we can't detect this
|
||||
+ * in the preprocessor, but we can live with this because they're unreleased.
|
||||
+ * Maketime probing would be overkill here.
|
||||
+ *
|
||||
+ * gcc also has a __attribute__((__hot__)) to move hot functions into
|
||||
+ * a special section, but I don't see any sense in this right now in
|
||||
+ * the kernel context
|
||||
+ */
|
||||
+#define __cold __attribute__((__cold__))
|
||||
+
|
||||
+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
|
||||
+
|
||||
+#ifndef __CHECKER__
|
||||
+# define __compiletime_warning(message) __attribute__((warning(message)))
|
||||
+# define __compiletime_error(message) __attribute__((error(message)))
|
||||
+#endif /* __CHECKER__ */
|
||||
+#endif /* GCC_VERSION >= 40300 */
|
||||
+
|
||||
+#if GCC_VERSION >= 40500
|
||||
+/*
|
||||
+ * Mark a position in code as unreachable. This can be used to
|
||||
+ * suppress control flow warnings after asm blocks that transfer
|
||||
+ * control elsewhere.
|
||||
+ *
|
||||
+ * Early snapshots of gcc 4.5 don't support this and we can't detect
|
||||
+ * this in the preprocessor, but we can live with this because they're
|
||||
+ * unreleased. Really, we need to have autoconf for the kernel.
|
||||
+ */
|
||||
+#define unreachable() __builtin_unreachable()
|
||||
+
|
||||
+/* Mark a function definition as prohibited from being cloned. */
|
||||
+#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))
|
||||
+
|
||||
+#endif /* GCC_VERSION >= 40500 */
|
||||
+
|
||||
+#if GCC_VERSION >= 40600
|
||||
+/*
|
||||
+ * When used with Link Time Optimization, gcc can optimize away C functions or
|
||||
+ * variables which are referenced only from assembly code. __visible tells the
|
||||
+ * optimizer that something else uses this function or variable, thus preventing
|
||||
+ * this.
|
||||
+ */
|
||||
+#define __visible __attribute__((externally_visible))
|
||||
+#endif
|
||||
+
|
||||
+
|
||||
+#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
|
||||
+/*
|
||||
+ * __assume_aligned(n, k): Tell the optimizer that the returned
|
||||
+ * pointer can be assumed to be k modulo n. The second argument is
|
||||
+ * optional (default 0), so we use a variadic macro to make the
|
||||
+ * shorthand.
|
||||
+ *
|
||||
+ * Beware: Do not apply this to functions which may return
|
||||
+ * ERR_PTRs. Also, it is probably unwise to apply it to functions
|
||||
+ * returning extra information in the low bits (but in that case the
|
||||
+ * compiler should see some alignment anyway, when the return value is
|
||||
+ * massaged by 'flags = ptr & 3; ptr &= ~3;').
|
||||
+ */
|
||||
+#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * GCC 'asm goto' miscompiles certain code sequences:
|
||||
+ *
|
||||
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
|
||||
+ *
|
||||
+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
|
||||
+ *
|
||||
+ * (asm goto is automatically volatile - the naming reflects this.)
|
||||
+ */
|
||||
+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
|
||||
+
|
||||
+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
|
||||
+#if GCC_VERSION >= 40400
|
||||
+#define __HAVE_BUILTIN_BSWAP32__
|
||||
+#define __HAVE_BUILTIN_BSWAP64__
|
||||
+#endif
|
||||
+#if GCC_VERSION >= 40800
|
||||
+#define __HAVE_BUILTIN_BSWAP16__
|
||||
+#endif
|
||||
+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
|
||||
+
|
||||
+#if GCC_VERSION >= 50000
|
||||
+#define KASAN_ABI_VERSION 4
|
||||
+#elif GCC_VERSION >= 40902
|
||||
+#define KASAN_ABI_VERSION 3
|
||||
+#endif
|
||||
+
|
||||
+#if GCC_VERSION >= 40902
|
||||
+/*
|
||||
+ * Tell the compiler that address safety instrumentation (KASAN)
|
||||
+ * should not be applied to that function.
|
||||
+ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
|
||||
+ */
|
||||
+#define __no_sanitize_address __attribute__((no_sanitize_address))
|
||||
+#endif
|
||||
+
|
||||
+#endif /* gcc version >= 40000 specific checks */
|
||||
+
|
||||
+#if !defined(__noclone)
|
||||
+#define __noclone /* not needed */
|
||||
+#endif
|
||||
+
|
||||
+#if !defined(__no_sanitize_address)
|
||||
+#define __no_sanitize_address
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * A trick to suppress uninitialized variable warning without generating any
|
||||
+ * code
|
||||
+ */
|
||||
+#define uninitialized_var(x) x = x
|
||||
@@ -0,0 +1,11 @@
|
||||
--- a/common/cmd_bootm.c
|
||||
+++ b/common/cmd_bootm.c
|
||||
@@ -77,7 +77,7 @@ static int do_bootm_subcommand(cmd_tbl_t
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
|
||||
- if (state != BOOTM_STATE_START && images.state >= state) {
|
||||
+ if (!(state & BOOTM_STATE_START) && images.state >= state) {
|
||||
printf("Trying to execute a command out of order\n");
|
||||
return CMD_RET_USAGE;
|
||||
}
|
||||
Reference in New Issue
Block a user