diff --git a/.mailmap b/.mailmap index 09ecaeb..82631b2 100644 --- a/.mailmap +++ b/.mailmap @@ -13,6 +13,11 @@ Franck Jullien Jin Zhengxiong Juergen Borleis +Juergen Borleis +Juergen Borleis +Juergen Borleis +Juergen Borleis +Juergen Borleis Marc Reilly Nishanth Menon Raphaƫl Poggi diff --git a/Documentation/user/booting-linux.rst b/Documentation/user/booting-linux.rst index ac44cba..6e7d155 100644 --- a/Documentation/user/booting-linux.rst +++ b/Documentation/user/booting-linux.rst @@ -55,12 +55,13 @@ Passing Kernel Arguments ^^^^^^^^^^^^^^^^^^^^^^^^ -Depending on the barebox configuration (``CONFIG_FLEXIBLE_BOOTARGS``) there -are to ways to pass bootargs to the Kernel. With ``CONFIG_FLEXIBLE_BOOTARGS`` -disabled the bootm command takes the bootargs from the ``bootargs`` environment -variable. With ``CONFIG_FLEXIBLE_BOOTARGS`` enabled the bootargs are composed -from different :ref:`global_device` variables. All variables beginning with -``global.linux.bootargs.`` will be concatenated to the bootargs: +The simple method to pass bootargs to the kernel is with +``CONFIG_FLEXIBLE_BOOTARGS`` disabled: in this case the bootm command +takes the bootargs from the ``bootargs`` environment variable. + +With ``CONFIG_FLEXIBLE_BOOTARGS`` enabled, the bootargs are composed +from different :ref:`global device` variables. All variables beginning +with ``global.linux.bootargs.`` will be concatenated to the bootargs: .. code-block:: sh diff --git a/arch/arm/mach-tegra/include/mach/lowlevel.h b/arch/arm/mach-tegra/include/mach/lowlevel.h index f1fea86..768b13d 100644 --- a/arch/arm/mach-tegra/include/mach/lowlevel.h +++ b/arch/arm/mach-tegra/include/mach/lowlevel.h @@ -111,9 +111,9 @@ return 0; } - bctptr = cpu_readl(TEGRA_IRAM_BASE + bctptr_offset); + bctptr = __raw_readl(TEGRA_IRAM_BASE + bctptr_offset); - return cpu_readl(bctptr + odmdata_offset); + return __raw_readl(bctptr + odmdata_offset); } static __always_inline diff --git a/arch/mips/include/asm/debug_ll_ns16550.h b/arch/mips/include/asm/debug_ll_ns16550.h index a3e1c52..4a6562f 100644 --- a/arch/mips/include/asm/debug_ll_ns16550.h +++ b/arch/mips/include/asm/debug_ll_ns16550.h @@ -57,7 +57,7 @@ #include -static __inline__ void PUTC_LL(char ch) +static inline void PUTC_LL(char ch) { #ifdef CONFIG_DEBUG_LL while (!(__raw_readb((u8 *)DEBUG_LL_UART_ADDR + UART_LSR) & UART_LSR_THRE)) diff --git a/arch/mips/mach-ath79/include/mach/debug_ll.h b/arch/mips/mach-ath79/include/mach/debug_ll.h index c697318..64db674 100644 --- a/arch/mips/mach-ath79/include/mach/debug_ll.h +++ b/arch/mips/mach-ath79/include/mach/debug_ll.h @@ -41,12 +41,12 @@ static inline void ar933x_debug_ll_writel(u32 b, int offset) { - cpu_writel(b, (u8 *)DEBUG_LL_UART_ADDR + offset); + __raw_writel(b, (u8 *)DEBUG_LL_UART_ADDR + offset); } static inline u32 ar933x_debug_ll_readl(int offset) { - return cpu_readl((u8 *)DEBUG_LL_UART_ADDR + offset); + return __raw_readl((u8 *)DEBUG_LL_UART_ADDR + offset); } static inline void PUTC_LL(int ch) diff --git a/commands/ubiformat.c b/commands/ubiformat.c index df0b801..e63f16e 100644 --- a/commands/ubiformat.c +++ b/commands/ubiformat.c @@ -84,7 +84,7 @@ int key; unsigned long int image_seq; - key = getopt(argc, argv, "nyyqve:x:s:O:f:S:"); + key = getopt(argc, argv, "nyqve:x:s:O:f:S:Q:"); if (key == -1) break; diff --git a/common/console_common.c b/common/console_common.c index 1e362ab..2c82c6f 100644 --- a/common/console_common.c +++ b/common/console_common.c @@ -106,15 +106,23 @@ log_clean(barebox_log_max_messages - 1); if (barebox_log_max_messages >= 0) { - log = xzalloc(sizeof(*log)); - log->msg = xstrdup(str); + log = malloc(sizeof(*log)); + if (!log) + goto nolog; + + log->msg = strdup(str); + if (!log->msg) { + free(log); + goto nolog; + } + log->timestamp = get_time_ns(); log->level = level; list_add_tail(&log->list, &barebox_logbuf); barebox_logbuf_num_messages++; } } - +nolog: if (level > barebox_loglevel) return; diff --git a/common/startup.c b/common/startup.c index e59b06d..6178fc5 100644 --- a/common/startup.c +++ b/common/startup.c @@ -62,6 +62,24 @@ fs_initcall(mount_root); #endif +#ifdef CONFIG_ENV_HANDLING +static int load_environment(void) +{ + const char *default_environment_path; + + default_environment_path = default_environment_path_get(); + + if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT)) + defaultenv_load("/env", 0); + + envfs_load(default_environment_path, "/env", 0); + nvvar_load(); + + return 0; +} +environment_initcall(load_environment); +#endif + int (*barebox_main)(void); void __noreturn start_barebox(void) @@ -84,16 +102,6 @@ pr_debug("initcalls done\n"); - if (IS_ENABLED(CONFIG_ENV_HANDLING)) { - char *default_environment_path = default_environment_path_get(); - - if (IS_ENABLED(CONFIG_DEFAULT_ENVIRONMENT)) - defaultenv_load("/env", 0); - - envfs_load(default_environment_path, "/env", 0); - nvvar_load(); - } - if (IS_ENABLED(CONFIG_COMMAND_SUPPORT)) { pr_info("running /env/bin/init...\n"); diff --git a/common/tlsfbits.h b/common/tlsfbits.h index 93466e4..edbac80 100644 --- a/common/tlsfbits.h +++ b/common/tlsfbits.h @@ -3,6 +3,10 @@ #include +#ifdef CONFIG_64BIT +#define TLSF_64BIT +#endif + /* ** Architecture-specific bit manipulation routines. ** @@ -33,7 +37,7 @@ /* Possibly 64-bit version of tlsf_fls. */ #if defined (TLSF_64BIT) -tlsf_decl int tlsf_fls_sizet(size_t size) +static int tlsf_fls_sizet(size_t size) { int high = (int)(size >> 32); int bits = 0; diff --git a/crypto/crc16.c b/crypto/crc16.c index d22b656..0b08e9c 100644 --- a/crypto/crc16.c +++ b/crypto/crc16.c @@ -90,7 +90,7 @@ }; uint16_t -cyg_crc16(unsigned char *buf, int len) +cyg_crc16(const unsigned char *buf, int len) { int i; uint16_t cksum; diff --git a/crypto/digest.c b/crypto/digest.c index b3f514c..a90e4ff 100644 --- a/crypto/digest.c +++ b/crypto/digest.c @@ -172,7 +172,7 @@ int digest_file_window(struct digest *d, const char *filename, unsigned char *hash, - unsigned char *sig, + const unsigned char *sig, ulong start, ulong size) { ulong len = 0; @@ -249,8 +249,8 @@ EXPORT_SYMBOL_GPL(digest_file_window); int digest_file(struct digest *d, const char *filename, - unsigned char *hash, - unsigned char *sig) + unsigned char *hash, + const unsigned char *sig) { struct stat st; int ret; @@ -265,8 +265,8 @@ EXPORT_SYMBOL_GPL(digest_file); int digest_file_by_name(const char *algo, const char *filename, - unsigned char *hash, - unsigned char *sig) + unsigned char *hash, + const unsigned char *sig) { struct digest *d; int ret; diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c index 7a6bde0..5d0fa06 100644 --- a/drivers/i2c/i2c.c +++ b/drivers/i2c/i2c.c @@ -183,7 +183,7 @@ msg->len = i; status = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg)); - dev_dbg(&client->dev, "%s: %zu@%u --> %d\n", __func__, + dev_dbg(&client->dev, "%s: %u@%u --> %d\n", __func__, count, addr, status); if (status == ARRAY_SIZE(msg)) diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c index 1755e76..681dc93 100644 --- a/drivers/mtd/core.c +++ b/drivers/mtd/core.c @@ -191,7 +191,7 @@ return 0; } -static ssize_t mtd_op_protect(struct cdev *cdev, size_t count, loff_t offset, int prot) +static int mtd_op_protect(struct cdev *cdev, size_t count, loff_t offset, int prot) { struct mtd_info *mtd = cdev->priv; diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c index 539c685..8e4600a 100644 --- a/drivers/mtd/nand/nand-bb.c +++ b/drivers/mtd/nand/nand-bb.c @@ -54,7 +54,7 @@ size_t retlen; int ret, bytes = 0, now; - debug("%s offset: 0x%08llx (raw: 0x%08llx) count: 0x%08x\n", + debug("%s offset: 0x%08llx (raw: 0x%08llx) count: 0x%08zx\n", __func__, offset, bb->offset, count); while (count) { @@ -132,7 +132,7 @@ struct nand_bb *bb = cdev->priv; int bytes = count, now, wroffs, ret; - debug("%s offset: 0x%08llx (raw: 0x%08llx) count: 0x%08x\n", + debug("%s offset: 0x%08llx (raw: 0x%08llx) count: 0x%08zx\n", __func__, offset, bb->offset, count); while (count) { diff --git a/drivers/mtd/nor/cfi_flash.h b/drivers/mtd/nor/cfi_flash.h index 9aad5c4..aeaf751 100644 --- a/drivers/mtd/nor/cfi_flash.h +++ b/drivers/mtd/nor/cfi_flash.h @@ -256,17 +256,17 @@ static inline void flash_write8(u8 value, void *addr) { - cpu_writeb(value, addr); + __raw_writeb(value, addr); } static inline void flash_write16(u16 value, void *addr) { - cpu_writew(value, addr); + __raw_writew(value, addr); } static inline void flash_write32(u32 value, void *addr) { - cpu_writel(value, addr); + __raw_writel(value, addr); } static inline void flash_write64(u64 value, void *addr) @@ -276,17 +276,17 @@ static inline u8 flash_read8(void *addr) { - return cpu_readb(addr); + return __raw_readb(addr); } static inline u16 flash_read16(void *addr) { - return cpu_readw(addr); + return __raw_readw(addr); } static inline u32 flash_read32(void *addr) { - return cpu_readl(addr); + return __raw_readl(addr); } static inline u64 flash_read64(void *addr) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index dfa95c3..88f0523 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -48,7 +48,6 @@ /** * of_unflatten_dtb - unflatten a dtb binary blob - * @root - node in which the fdt blob should be merged into or NULL * @infdt - the fdt blob to unflatten * * Parse a flat device tree binary blob and return a pointer to the diff --git a/drivers/serial/serial_ar933x.c b/drivers/serial/serial_ar933x.c index 51184aa..59bb5b2 100644 --- a/drivers/serial/serial_ar933x.c +++ b/drivers/serial/serial_ar933x.c @@ -40,7 +40,7 @@ { struct ar933x_uart_priv *priv = cdev->dev->priv; - cpu_writel(b, priv->base + offset); + __raw_writel(b, priv->base + offset); } static inline u32 ar933x_serial_readl(struct console_device *cdev, @@ -48,7 +48,7 @@ { struct ar933x_uart_priv *priv = cdev->dev->priv; - return cpu_readl(priv->base + offset); + return __raw_readl(priv->base + offset); } /* diff --git a/drivers/spi/ath79_spi.c b/drivers/spi/ath79_spi.c index 4d71eba..bdb39ef 100644 --- a/drivers/spi/ath79_spi.c +++ b/drivers/spi/ath79_spi.c @@ -48,12 +48,12 @@ static inline u32 ath79_spi_rr(struct ath79_spi *sp, int reg) { - return cpu_readl(sp->regs + reg); + return __raw_readl(sp->regs + reg); } static inline void ath79_spi_wr(struct ath79_spi *sp, u32 val, int reg) { - cpu_writel(val, sp->regs + reg); + __raw_writel(val, sp->regs + reg); } static inline void setbits(struct ath79_spi *sp, int bits, int on) diff --git a/fs/fs.c b/fs/fs.c index 9a79a03..c249f84 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -1564,14 +1564,11 @@ } EXPORT_SYMBOL(rmdir); -static void memcpy_sz(void *_dst, const void *_src, ulong count, ulong rwsize) +static void memcpy_sz(void *dst, const void *src, size_t count, int rwsize) { - ulong dst = (ulong)_dst; - ulong src = (ulong)_src; - /* no rwsize specification given. Do whatever memcpy likes best */ if (!rwsize) { - memcpy(_dst, _src, count); + memcpy(dst, src, count); return; } @@ -1582,13 +1579,13 @@ while (count-- > 0) { switch (rwsize) { case 1: - *((u_char *)dst) = *((u_char *)src); + *((u8 *)dst) = *((u8 *)src); break; case 2: - *((ushort *)dst) = *((ushort *)src); + *((u16 *)dst) = *((u16 *)src); break; case 4: - *((ulong *)dst) = *((ulong *)src); + *((u32 *)dst) = *((u32 *)src); break; case 8: *((u64 *)dst) = *((u64 *)src); diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h index e359187..254397e 100644 --- a/include/asm-generic/barebox.lds.h +++ b/include/asm-generic/barebox.lds.h @@ -34,7 +34,9 @@ KEEP(*(.initcall.9)) \ KEEP(*(.initcall.10)) \ KEEP(*(.initcall.11)) \ - KEEP(*(.initcall.12)) + KEEP(*(.initcall.12)) \ + KEEP(*(.initcall.13)) \ + KEEP(*(.initcall.14)) #define BAREBOX_CMDS KEEP(*(SORT_BY_NAME(.barebox_cmd*))) diff --git a/include/crc.h b/include/crc.h index 10560c9..4290f41 100644 --- a/include/crc.h +++ b/include/crc.h @@ -95,6 +95,6 @@ /* 16 bit CRC with polynomial x^16+x^12+x^5+1 */ -extern uint16_t cyg_crc16(unsigned char *s, int len); +extern uint16_t cyg_crc16(const unsigned char *s, int len); #endif /* _SERVICES_CRC_CRC_H_ */ diff --git a/include/digest.h b/include/digest.h index 7f8d696..7c6711b 100644 --- a/include/digest.h +++ b/include/digest.h @@ -68,14 +68,14 @@ int digest_file_window(struct digest *d, const char *filename, unsigned char *hash, - unsigned char *sig, + const unsigned char *sig, ulong start, ulong size); int digest_file(struct digest *d, const char *filename, - unsigned char *hash, - unsigned char *sig); + unsigned char *hash, + const unsigned char *sig); int digest_file_by_name(const char *algo, const char *filename, - unsigned char *hash, - unsigned char *sig); + unsigned char *hash, + const unsigned char *sig); static inline int digest_init(struct digest *d) { diff --git a/include/init.h b/include/init.h index 37c7eed..f619c95 100644 --- a/include/init.h +++ b/include/init.h @@ -39,6 +39,8 @@ #define device_initcall(fn) __define_initcall("10",fn,10) #define crypto_initcall(fn) __define_initcall("11",fn,11) #define late_initcall(fn) __define_initcall("12",fn,12) +#define environment_initcall(fn) __define_initcall("13",fn,13) +#define postenvironment_initcall(fn) __define_initcall("14",fn,14) /* section for code used very early when * - we're not running from where we linked at diff --git a/include/io.h b/include/io.h index 8d885de..8eb56b0 100644 --- a/include/io.h +++ b/include/io.h @@ -3,12 +3,4 @@ #include -/* cpu_read/cpu_write: cpu native io accessors */ -#define cpu_readb(a) __raw_readb(a) -#define cpu_readw(a) __raw_readw(a) -#define cpu_readl(a) __raw_readl(a) -#define cpu_writeb(v, a) __raw_writeb((v), (a)) -#define cpu_writew(v, a) __raw_writew((v), (a)) -#define cpu_writel(v, a) __raw_writel((v), (a)) - #endif /* __IO_H */ diff --git a/include/watchdog.h b/include/watchdog.h index 3e2d08e..7e37b7c 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -17,8 +17,25 @@ int (*set_timeout)(struct watchdog *, unsigned); }; +#ifdef CONFIG_WATCHDOG int watchdog_register(struct watchdog *); int watchdog_deregister(struct watchdog *); int watchdog_set_timeout(unsigned); +#else +static inline int watchdog_register(struct watchdog *w) +{ + return 0; +} + +int watchdog_deregister(struct watchdog *w) +{ + return 0; +} + +int watchdog_set_timeout(unsigned t) +{ + return 0; +} +#endif #endif /* INCLUDE_WATCHDOG_H */ diff --git a/lib/xfuncs.c b/lib/xfuncs.c index 86d0013..0e78b67 100644 --- a/lib/xfuncs.c +++ b/lib/xfuncs.c @@ -30,8 +30,6 @@ if (!(p = malloc(size))) panic("ERROR: out of memory\n"); - debug("xmalloc %p (size %zu)\n", p, size); - return p; } EXPORT_SYMBOL(xmalloc); @@ -43,8 +41,6 @@ if (!(p = realloc(ptr, size))) panic("ERROR: out of memory\n"); - debug("xrealloc %p -> %p (size %zu)\n", ptr, p, size); - return p; } EXPORT_SYMBOL(xrealloc);