9
0
Fork 0

Merge branch 'for-next/misc'

This commit is contained in:
Sascha Hauer 2015-07-03 08:37:40 +02:00
commit f2a2894c27
88 changed files with 323 additions and 276 deletions

View File

@ -9,6 +9,7 @@ CONFIG_THUMB2_BAREBOX=y
# CONFIG_MEMINFO is not set
CONFIG_MMU=y
CONFIG_TEXT_BASE=0x0
CONFIG_BAREBOX_MAX_PBLX_SIZE=0x1b400
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_RELOCATABLE=y

View File

@ -6,7 +6,6 @@ CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
# CONFIG_BANNER is not set
CONFIG_MMU=y
CONFIG_TEXT_BASE=0xa3d00000
CONFIG_BAREBOX_MAX_BARE_INIT_SIZE=0x80000
CONFIG_MALLOC_SIZE=0x1000000
CONFIG_EXPERIMENTAL=y

View File

@ -1,70 +1,68 @@
CONFIG_ARCH_SOCFPGA=y
CONFIG_ARCH_SOCFPGA_FPGA=y
CONFIG_MACH_SOCFPGA_EBV_SOCRATES=y
CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT=y
CONFIG_THUMB2_BAREBOX=y
CONFIG_CMD_ARM_MMUINFO=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_MMU=y
CONFIG_TEXT_BASE=0x0
CONFIG_MALLOC_SIZE=0x0
CONFIG_MALLOC_TLSF=y
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
CONFIG_LONGHELP=y
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
# CONFIG_TIMESTAMP is not set
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
CONFIG_CMD_EDIT=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_MSLEEP=y
CONFIG_CMD_SAVEENV=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_PRINTENV=y
CONFIG_CMD_READLINE=y
CONFIG_CMD_LET=y
CONFIG_CMD_MENU=y
CONFIG_CMD_MENU_MANAGEMENT=y
CONFIG_CMD_TIME=y
CONFIG_CMD_LN=y
CONFIG_CMD_FILETYPE=y
CONFIG_CMD_ECHO_E=y
CONFIG_CMD_MEMINFO=y
CONFIG_LONGHELP=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_MM=y
CONFIG_CMD_CRC=y
CONFIG_CMD_CRC_CMP=y
CONFIG_CMD_MD5SUM=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_ARM_MMUINFO=y
CONFIG_CMD_BOOTM_SHOW_TYPE=y
CONFIG_CMD_BOOTM_VERBOSE=y
CONFIG_CMD_BOOTM_INITRD=y
CONFIG_CMD_BOOTM_OFTREE=y
CONFIG_CMD_RESET=y
CONFIG_CMD_GO=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_OF_PROPERTY=y
CONFIG_CMD_OF_NODE=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_BAREBOX_UPDATE=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_RESET=y
CONFIG_CMD_PARTITION=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_PRINTENV=y
CONFIG_CMD_MAGICVAR=y
CONFIG_CMD_MAGICVAR_HELP=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_SAVEENV=y
CONFIG_CMD_FILETYPE=y
CONFIG_CMD_LN=y
CONFIG_CMD_MD5SUM=y
CONFIG_CMD_UNCOMPRESS=y
CONFIG_CMD_SPI=y
CONFIG_CMD_LED=y
CONFIG_CMD_LED_TRIGGER=y
CONFIG_CMD_LET=y
CONFIG_CMD_MSLEEP=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_MIITOOL=y
CONFIG_CMD_PING=y
CONFIG_CMD_ECHO_E=y
CONFIG_CMD_EDIT=y
CONFIG_CMD_MENU=y
CONFIG_CMD_MENU_MANAGEMENT=y
CONFIG_CMD_READLINE=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_CRC=y
CONFIG_CMD_CRC_CMP=y
CONFIG_CMD_MEMTEST=y
CONFIG_CMD_MM=y
CONFIG_CMD_CLK=y
CONFIG_CMD_DETECT=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_LED=y
CONFIG_CMD_SPI=y
CONFIG_CMD_LED_TRIGGER=y
CONFIG_CMD_BAREBOX_UPDATE=y
CONFIG_CMD_OF_NODE=y
CONFIG_CMD_OF_PROPERTY=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIME=y
CONFIG_NET=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_PING=y
CONFIG_NET_NETCONSOLE=y
CONFIG_NET_RESOLV=y
CONFIG_OFDEVICE=y

View File

@ -11,7 +11,7 @@
void __noreturn reset_cpu(unsigned long addr)
{
arch_shutdown();
shutdown_barebox();
asm("mov pc, #0");

View File

@ -4,6 +4,7 @@ config ARCH_TEXT_BASE
hex
default 0xa0000000 if MACH_MIOA701
default 0xa3f00000 if MACH_PCM027
default 0xa3d00000 if MACH_LUBBOCK
default 0x83f00000 if MACH_ZYLONITE
# ----------------------------------------------------------

View File

@ -1,5 +1,9 @@
if ARCH_SOCFPGA
config ARCH_TEXT_BASE
hex
default 0x0
config ARCH_SOCFPGA_XLOAD
bool
prompt "Build preloader image"

View File

@ -243,11 +243,20 @@ void tegra_ll_delay_usec(int delay)
while ((int)readl(TEGRA_TMRUS_BASE + TIMER_CNTR_1US) - timeout < 0);
}
/* reset vector for the AVP, to be called from board reset vector */
void tegra_avp_reset_vector(uint32_t boarddata);
/* reset vector for the main CPU complex */
void tegra_maincomplex_entry(void);
static __always_inline
void tegra_cpu_lowlevel_setup(void)
{
uint32_t r;
if (tegra_cpu_is_maincomplex())
tegra_maincomplex_entry();
/* set the cpu to SVC32 mode */
__asm__ __volatile__("mrs %0, cpsr":"=r"(r));
r &= ~0x1f;
@ -258,10 +267,4 @@ void tegra_cpu_lowlevel_setup(void)
tegra_ll_delay_setup();
}
/* reset vector for the AVP, to be called from board reset vector */
void tegra_avp_reset_vector(uint32_t boarddata);
/* reset vector for the main CPU complex */
void tegra_maincomplex_entry(void);
#endif /* __TEGRA_LOWLEVEL_H */

View File

@ -265,9 +265,6 @@ void tegra_avp_reset_vector(uint32_t boarddata)
/* put boarddata in scratch reg, for main CPU to fetch after startup */
writel(boarddata, TEGRA_PMC_BASE + PMC_SCRATCH(10));
if (tegra_cpu_is_maincomplex())
tegra_maincomplex_entry();
/* we want to bring up the high performance CPU complex */
if (tegra_get_chiptype() >= TEGRA30)
tegra_cluster_switch_hp();

View File

@ -90,21 +90,21 @@ extern void *__ioremap(unsigned long physaddr, unsigned long size,
int cacheflag);
extern void __iounmap(void *addr, unsigned long size);
extern inline void *ioremap(unsigned long physaddr, unsigned long size)
static inline void *ioremap(unsigned long physaddr, unsigned long size)
{
return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
}
extern inline void *ioremap_nocache(unsigned long physaddr,
static inline void *ioremap_nocache(unsigned long physaddr,
unsigned long size)
{
return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
}
extern inline void *ioremap_writethrough(unsigned long physaddr,
static inline void *ioremap_writethrough(unsigned long physaddr,
unsigned long size)
{
return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
}
extern inline void *ioremap_fullcache(unsigned long physaddr,
static inline void *ioremap_fullcache(unsigned long physaddr,
unsigned long size)
{
return __ioremap(physaddr, size, IOMAP_FULL_CACHING);

View File

@ -36,7 +36,7 @@
#include <asm/ptrace.h>
#include <asm/current.h>
extern inline unsigned long rdusp(void)
static inline unsigned long rdusp(void)
{
unsigned long usp;
@ -44,7 +44,7 @@ extern inline unsigned long rdusp(void)
return usp;
}
extern inline void wrusp(unsigned long usp)
static inline void wrusp(unsigned long usp)
{
__asm__ __volatile__("usp = %0;\n\t"::"da"(usp));
}
@ -130,7 +130,7 @@ static inline void exit_thread(void)
/*
* Return saved PC of a blocked thread.
*/
extern inline unsigned long thread_saved_pc(struct thread_struct *t)
static inline unsigned long thread_saved_pc(struct thread_struct *t)
{
extern void scheduling_functions_start_here(void);
extern void scheduling_functions_end_here(void);

View File

@ -12,7 +12,7 @@
#ifdef __GNUC__
static __inline__ __attribute_const__ __u32 __arch_swahb32(__u32 xx)
static inline __attribute_const__ __u32 __arch_swahb32(__u32 xx)
{
__u32 tmp;
__asm__("%1 = %0 >> 8 (V);\n\t"
@ -23,7 +23,7 @@ static __inline__ __attribute_const__ __u32 __arch_swahb32(__u32 xx)
}
#define __arch_swahb32 __arch_swahb32
static __inline__ __attribute_const__ __u32 __arch_swahw32(__u32 xx)
static inline __attribute_const__ __u32 __arch_swahw32(__u32 xx)
{
__u32 rv;
__asm__("%0 = PACK(%1.L, %1.H);\n\t": "=d"(rv): "d"(xx));
@ -31,13 +31,13 @@ static __inline__ __attribute_const__ __u32 __arch_swahw32(__u32 xx)
}
#define __arch_swahw32 __arch_swahw32
static __inline__ __attribute_const__ __u32 __arch_swab32(__u32 xx)
static inline __attribute_const__ __u32 __arch_swab32(__u32 xx)
{
return __arch_swahb32(__arch_swahw32(xx));
}
#define __arch_swab32 __arch_swab32
static __inline__ __attribute_const__ __u16 __arch_swab16(__u16 xx)
static inline __attribute_const__ __u16 __arch_swab16(__u16 xx)
{
__u32 xw = xx;
__asm__("%0 <<= 8;\n %0.L = %0.L + %0.H (NS);\n": "+d"(xw));

View File

@ -15,11 +15,6 @@
*
*/
/**
* @file
* @brief Resetting an malta board
*/
#include <common.h>
#include <io.h>
#include <mach/hardware.h>

View File

@ -21,7 +21,7 @@ typedef struct { int counter; } atomic_t;
extern void atomic_clear_mask(unsigned long mask, unsigned long *addr);
extern void atomic_set_mask(unsigned long mask, unsigned long *addr);
extern __inline__ int atomic_add_return(int a, atomic_t *v)
static inline int atomic_add_return(int a, atomic_t *v)
{
int t;
@ -37,7 +37,7 @@ extern __inline__ int atomic_add_return(int a, atomic_t *v)
return t;
}
extern __inline__ int atomic_sub_return(int a, atomic_t *v)
static inline int atomic_sub_return(int a, atomic_t *v)
{
int t;
@ -53,7 +53,7 @@ extern __inline__ int atomic_sub_return(int a, atomic_t *v)
return t;
}
extern __inline__ int atomic_inc_return(atomic_t *v)
static inline int atomic_inc_return(atomic_t *v)
{
int t;
@ -69,7 +69,7 @@ extern __inline__ int atomic_inc_return(atomic_t *v)
return t;
}
extern __inline__ int atomic_dec_return(atomic_t *v)
static inline int atomic_dec_return(atomic_t *v)
{
int t;

View File

@ -28,7 +28,7 @@
* These used to be if'd out here because using : "cc" as a constraint
* resulted in errors from egcs. Things may be OK with gcc-2.95.
*/
extern __inline__ void set_bit(int nr, volatile void * addr)
static inline void set_bit(int nr, volatile void * addr)
{
unsigned long old;
unsigned long mask = 1 << (nr & 0x1f);
@ -45,7 +45,7 @@ extern __inline__ void set_bit(int nr, volatile void * addr)
: "cc" );
}
extern __inline__ void clear_bit(int nr, volatile void *addr)
static inline void clear_bit(int nr, volatile void *addr)
{
unsigned long old;
unsigned long mask = 1 << (nr & 0x1f);
@ -62,7 +62,7 @@ extern __inline__ void clear_bit(int nr, volatile void *addr)
: "cc");
}
extern __inline__ void change_bit(int nr, volatile void *addr)
static inline void change_bit(int nr, volatile void *addr)
{
unsigned long old;
unsigned long mask = 1 << (nr & 0x1f);
@ -79,7 +79,7 @@ extern __inline__ void change_bit(int nr, volatile void *addr)
: "cc");
}
extern __inline__ int test_and_set_bit(int nr, volatile void *addr)
static inline int test_and_set_bit(int nr, volatile void *addr)
{
unsigned int old, t;
unsigned int mask = 1 << (nr & 0x1f);
@ -98,7 +98,7 @@ extern __inline__ int test_and_set_bit(int nr, volatile void *addr)
return (old & mask) != 0;
}
extern __inline__ int test_and_clear_bit(int nr, volatile void *addr)
static inline int test_and_clear_bit(int nr, volatile void *addr)
{
unsigned int old, t;
unsigned int mask = 1 << (nr & 0x1f);
@ -117,7 +117,7 @@ extern __inline__ int test_and_clear_bit(int nr, volatile void *addr)
return (old & mask) != 0;
}
extern __inline__ int test_and_change_bit(int nr, volatile void *addr)
static inline int test_and_change_bit(int nr, volatile void *addr)
{
unsigned int old, t;
unsigned int mask = 1 << (nr & 0x1f);
@ -138,7 +138,7 @@ extern __inline__ int test_and_change_bit(int nr, volatile void *addr)
#endif /* __INLINE_BITOPS */
/* Return the bit position of the most significant 1 bit in a word */
extern __inline__ int __ilog2(unsigned int x)
static inline int __ilog2(unsigned int x)
{
int lz;
@ -146,14 +146,14 @@ extern __inline__ int __ilog2(unsigned int x)
return 31 - lz;
}
extern __inline__ int ffz(unsigned int x)
static inline int ffz(unsigned int x)
{
if ((x = ~x) == 0)
return 32;
return __ilog2(x & -x);
}
static __inline__ int __ffs(unsigned long x)
static inline int __ffs(unsigned long x)
{
return __ilog2(x & -x);
}
@ -177,7 +177,7 @@ static inline int fls(unsigned int x)
* the libc and compiler builtin ffs routines, therefore
* differs in spirit from the above ffz (man ffs).
*/
extern __inline__ int ffs(int x)
static inline int ffs(int x)
{
return __ilog2(x & -x) + 1;
}

View File

@ -136,7 +136,7 @@ static inline void __raw_writel(unsigned int v, volatile void __iomem *addr)
/*
* 8, 16 and 32 bit, big and little endian I/O operations, with barrier.
*/
extern inline u8 in_8(const volatile u8 __iomem *addr)
static inline u8 in_8(const volatile u8 __iomem *addr)
{
u8 ret;
@ -145,12 +145,12 @@ extern inline u8 in_8(const volatile u8 __iomem *addr)
return ret;
}
extern inline void out_8(volatile u8 __iomem *addr, u8 val)
static inline void out_8(volatile u8 __iomem *addr, u8 val)
{
__asm__ __volatile__("sync;stb%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
}
extern inline u16 in_le16(const volatile u16 __iomem *addr)
static inline u16 in_le16(const volatile u16 __iomem *addr)
{
u16 ret;
@ -159,7 +159,7 @@ extern inline u16 in_le16(const volatile u16 __iomem *addr)
return ret;
}
extern inline u16 in_be16(const volatile u16 __iomem *addr)
static inline u16 in_be16(const volatile u16 __iomem *addr)
{
u16 ret;
@ -168,18 +168,18 @@ extern inline u16 in_be16(const volatile u16 __iomem *addr)
return ret;
}
extern inline void out_le16(volatile u16 __iomem *addr, u16 val)
static inline void out_le16(volatile u16 __iomem *addr, u16 val)
{
__asm__ __volatile__("sync; sthbrx %1,0,%2"
: "=m" (*addr) : "r" (val), "r" (addr));
}
extern inline void out_be16(volatile u16 __iomem *addr, u16 val)
static inline void out_be16(volatile u16 __iomem *addr, u16 val)
{
__asm__ __volatile__("sync;sth%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
}
extern inline u32 in_le32(const volatile u32 __iomem *addr)
static inline u32 in_le32(const volatile u32 __iomem *addr)
{
u32 ret;
@ -188,7 +188,7 @@ extern inline u32 in_le32(const volatile u32 __iomem *addr)
return ret;
}
extern inline u32 in_be32(const volatile u32 __iomem *addr)
static inline u32 in_be32(const volatile u32 __iomem *addr)
{
u32 ret;
@ -197,13 +197,13 @@ extern inline u32 in_be32(const volatile u32 __iomem *addr)
return ret;
}
extern inline void out_le32(volatile u32 __iomem *addr, u32 val)
static inline void out_le32(volatile u32 __iomem *addr, u32 val)
{
__asm__ __volatile__("sync; stwbrx %1,0,%2"
: "=m" (*addr) : "r" (val), "r" (addr));
}
extern inline void out_be32(volatile u32 __iomem *addr, u32 val)
static inline void out_be32(volatile u32 __iomem *addr, u32 val)
{
__asm__ __volatile__("sync;stw%U0%X0 %1,%0" : "=m" (*addr) : "r" (val));
}

View File

@ -19,7 +19,7 @@
#ifdef __KERNEL__
static __inline__ __u16 ld_le16(const volatile __u16 *addr)
static inline __u16 ld_le16(const volatile __u16 *addr)
{
__u16 val;
@ -28,7 +28,7 @@ static __inline__ __u16 ld_le16(const volatile __u16 *addr)
}
#define __arch_swab16p ld_le16
static __inline__ void st_le16(volatile __u16 *addr, const __u16 val)
static inline void st_le16(volatile __u16 *addr, const __u16 val)
{
__asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
}
@ -39,7 +39,7 @@ static inline void __arch_swab16s(__u16 *addr)
}
#define __arch_swab16s __arch_swab16s
static __inline__ __u32 ld_le32(const volatile __u32 *addr)
static inline __u32 ld_le32(const volatile __u32 *addr)
{
__u32 val;
@ -48,7 +48,7 @@ static __inline__ __u32 ld_le32(const volatile __u32 *addr)
}
#define __arch_swab32p ld_le32
static __inline__ void st_le32(volatile __u32 *addr, const __u32 val)
static inline void st_le32(volatile __u32 *addr, const __u32 val)
{
__asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
}

View File

@ -1,8 +1,8 @@
#ifndef _I386_BYTEORDER_H
#define _I386_BYTEORDER_H
#ifndef _SANDBOX_BYTEORDER_H
#define _SANDBOX_BYTEORDER_H
#include <asm/types.h>
#include <linux/byteorder/little_endian.h>
#endif /* _I386_BYTEORDER_H */
#endif /* _SANDBOX_BYTEORDER_H */

View File

@ -70,4 +70,3 @@ BAREBOX_CMD_START(automount)
BAREBOX_CMD_GROUP(CMD_GRP_PART)
BAREBOX_CMD_HELP(cmd_automount_help)
BAREBOX_CMD_END

View File

@ -68,7 +68,7 @@ err:
return ret;
}
static void prints_algo_help(void)
static void __maybe_unused prints_algo_help(void)
{
puts("\navailable algo:\n");
digest_algo_prints("\t");

View File

@ -59,4 +59,3 @@ BAREBOX_CMD_START(export)
BAREBOX_CMD_GROUP(CMD_GRP_ENV)
BAREBOX_CMD_HELP(cmd_export_help)
BAREBOX_CMD_END

View File

@ -32,4 +32,3 @@ BAREBOX_CMD_START(false)
BAREBOX_CMD_GROUP(CMD_GRP_SCRIPT)
BAREBOX_CMD_COMPLETE(empty_complete)
BAREBOX_CMD_END

View File

@ -148,4 +148,3 @@ BAREBOX_CMD_START(help)
BAREBOX_CMD_HELP(cmd_help_help)
BAREBOX_CMD_COMPLETE(command_complete)
BAREBOX_CMD_END

View File

@ -64,4 +64,3 @@ BAREBOX_CMD_START(ethact)
BAREBOX_CMD_GROUP(CMD_GRP_NET)
BAREBOX_CMD_COMPLETE(eth_complete)
BAREBOX_CMD_END

View File

@ -53,4 +53,3 @@ BAREBOX_CMD_START(readline)
BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
BAREBOX_CMD_HELP(cmd_readline_help)
BAREBOX_CMD_END

View File

@ -84,4 +84,3 @@ BAREBOX_CMD_START(timeout)
BAREBOX_CMD_GROUP(CMD_GRP_CONSOLE)
BAREBOX_CMD_HELP(cmd_timeout_help)
BAREBOX_CMD_END

View File

@ -105,4 +105,3 @@ BAREBOX_CMD_START(trigger)
BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP)
BAREBOX_CMD_HELP(cmd_trigger_help)
BAREBOX_CMD_END

View File

@ -32,4 +32,3 @@ BAREBOX_CMD_START(true)
BAREBOX_CMD_GROUP(CMD_GRP_SCRIPT)
BAREBOX_CMD_COMPLETE(empty_complete)
BAREBOX_CMD_END

View File

@ -179,4 +179,3 @@ BAREBOX_CMD_START(ubirmvol)
BAREBOX_CMD_GROUP(CMD_GRP_PART)
BAREBOX_CMD_HELP(cmd_ubirmvol_help)
BAREBOX_CMD_END

View File

@ -33,4 +33,3 @@ BAREBOX_CMD_START(version)
BAREBOX_CMD_GROUP(CMD_GRP_INFO)
BAREBOX_CMD_COMPLETE(empty_complete)
BAREBOX_CMD_END

View File

@ -209,6 +209,16 @@ config BAREBOX_MAX_BARE_INIT_SIZE
this will allow your bare_init to fit in SRAM as example
ARCH can overwrite it via ARCH_BAREBOX_MAX_BARE_INIT_SIZE
config BAREBOX_MAX_PBLX_SIZE
depends on PBL_MULTI_IMAGES
depends on IMAGE_COMPRESSION
prompt "Maximum PBLX size"
hex
default 0xffffffff
help
Define the maximum size of the PBLX image.
The pblx is a self extracting barebox binary.
config HAVE_CONFIGURABLE_MEMORY_LAYOUT
bool

View File

@ -466,4 +466,3 @@ int complete(char *instr, char **outstr)
return reprint;
}

View File

@ -212,4 +212,3 @@ int sprint_symbol(char *buffer, unsigned long address)
return len;
}
EXPORT_SYMBOL_GPL(sprint_symbol);

View File

@ -284,4 +284,3 @@ int run_shell(void)
}
return 0;
}

View File

@ -95,7 +95,7 @@ config MCI_OMAP_HSMMC
config MCI_PXA
bool "PXA"
depends on ARCH_PXA
depends on ARCH_PXA2XX
help
Enable this entry to add support to read and write SD cards on a
XScale PXA25x / PXA27x based system.

View File

@ -542,7 +542,7 @@ static int of_mtd_fixup(struct device_node *root, void *ctx)
return 0;
}
int add_mtd_device(struct mtd_info *mtd, char *devname, int device_id)
int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id)
{
struct mtddev_hook *hook;
int ret;

View File

@ -148,14 +148,14 @@ static int m25p80_erase(struct spi_nor *nor, loff_t offset)
{
struct m25p *flash = nor->priv;
dev_dbg(nor->dev, "%dKiB at 0x%08x\n",
flash->mtd.erasesize / 1024, (u32)offset);
dev_dbg(nor->dev, "%dKiB at 0x%08x\n",
flash->mtd.erasesize / 1024, (u32)offset);
/* Set up command buffer. */
flash->command[0] = nor->erase_opcode;
m25p_addr2cmd(nor, offset, flash->command);
/* Set up command buffer. */
flash->command[0] = nor->erase_opcode;
m25p_addr2cmd(nor, offset, flash->command);
spi_write(flash->spi, flash->command, m25p_cmdsz(nor));
spi_write(flash->spi, flash->command, m25p_cmdsz(nor));
return 0;
}
@ -213,11 +213,11 @@ static const struct platform_device_id m25p_ids[] = {
{"w25q128"}, {"w25q256"}, {"cat25c11"},
{"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"},
/*
* Generic support for SPI NOR that can be identified by the JEDEC READ
* ID opcode (0x9F). Use this, if possible.
*/
{"nor-jedec"},
/*
* Generic support for SPI NOR that can be identified by the JEDEC READ
* ID opcode (0x9F). Use this, if possible.
*/
{"nor-jedec"},
{ },
};
@ -233,7 +233,7 @@ static int m25p_probe(struct device_d *dev)
struct m25p *flash;
struct spi_nor *nor;
enum read_mode mode = SPI_NOR_NORMAL;
char *flash_name = NULL;
const char *flash_name = NULL;
int device_id;
int ret;
@ -277,13 +277,10 @@ static int m25p_probe(struct device_d *dev)
return ret;
device_id = DEVICE_ID_SINGLE;
if (dev->device_node) {
const char *alias = of_alias_get(dev->device_node);
if (alias)
flash_name = xstrdup(alias);
} else if (data && data->name) {
if (dev->device_node)
flash_name = of_alias_get(dev->device_node);
else if (data && data->name)
flash_name = data->name;
}
if (!flash_name) {
device_id = DEVICE_ID_DYNAMIC;

View File

@ -25,7 +25,7 @@
*/
struct mtddev_hook {
struct list_head hook;
int (*add_mtd_device)(struct mtd_info *mtd, char *devname, void **priv);
int (*add_mtd_device)(struct mtd_info *mtd, const char *devname, void **priv);
int (*del_mtd_device)(struct mtd_info *mtd, void **priv);
void *priv;
};

View File

@ -69,7 +69,7 @@ static struct file_operations mtd_ops_oob = {
.lseek = dev_lseek_default,
};
static int add_mtdoob_device(struct mtd_info *mtd, char *devname, void **priv)
static int add_mtdoob_device(struct mtd_info *mtd, const char *devname, void **priv)
{
struct mtdoob *mtdoob;

View File

@ -281,7 +281,7 @@ static const struct file_operations mtd_raw_fops = {
.lseek = dev_lseek_default,
};
static int add_mtdraw_device(struct mtd_info *mtd, char *devname, void **priv)
static int add_mtdraw_device(struct mtd_info *mtd, const char *devname, void **priv)
{
struct mtdraw *mtdraw;

View File

@ -231,7 +231,7 @@ static int tse_get_ethaddr(struct eth_device *edev, unsigned char *m)
return 0;
}
static int tse_set_ethaddr(struct eth_device *edev, unsigned char *m)
static int tse_set_ethaddr(struct eth_device *edev, const unsigned char *m)
{
struct altera_tse_priv *priv = edev->priv;
struct alt_tse_mac *mac_dev = priv->tse_regs;

View File

@ -70,7 +70,7 @@ static void ar231x_reset_bit_(struct ar231x_eth_priv *priv,
(*priv->reset_bit)(val, state);
}
static int ar231x_set_ethaddr(struct eth_device *edev, unsigned char *addr);
static int ar231x_set_ethaddr(struct eth_device *edev, const unsigned char *addr);
static void ar231x_reset_regs(struct eth_device *edev)
{
struct ar231x_eth_priv *priv = edev->priv;

View File

@ -332,7 +332,7 @@ static int arc_emac_get_ethaddr(struct eth_device *edev, unsigned char *mac)
return -1;
}
static int arc_emac_set_ethaddr(struct eth_device *edev, unsigned char *mac)
static int arc_emac_set_ethaddr(struct eth_device *edev, const unsigned char *mac)
{
struct arc_emac_priv *priv = edev->priv;
unsigned int addr_low, addr_hi;

View File

@ -261,7 +261,7 @@ static int at91_ether_get_ethaddr(struct eth_device *eth, unsigned char *adr)
return -1;
}
static int at91_ether_set_ethaddr(struct eth_device *eth, unsigned char *adr)
static int at91_ether_set_ethaddr(struct eth_device *eth, const unsigned char *adr)
{
int i;

View File

@ -547,7 +547,7 @@ static int cpsw_get_hwaddr(struct eth_device *edev, unsigned char *mac)
return -1;
}
static int cpsw_set_hwaddr(struct eth_device *edev, unsigned char *mac)
static int cpsw_set_hwaddr(struct eth_device *edev, const unsigned char *mac)
{
struct cpsw_slave *slave = edev->priv;
struct cpsw_priv *priv = slave->cpsw;

View File

@ -341,7 +341,7 @@ static int cs8900_get_ethaddr(struct eth_device *dev, unsigned char *mac)
return 0;
}
static int cs8900_set_ethaddr(struct eth_device *dev, unsigned char *mac)
static int cs8900_set_ethaddr(struct eth_device *dev, const unsigned char *mac)
{
struct cs8900_priv *priv = (struct cs8900_priv *)dev->priv;
int i;

View File

@ -178,7 +178,7 @@ static int davinci_emac_get_ethaddr(struct eth_device *edev, unsigned char *adr)
* This function must be called before emac_open() if you want to override
* the default mac address.
*/
static int davinci_emac_set_ethaddr(struct eth_device *edev, unsigned char *addr)
static int davinci_emac_set_ethaddr(struct eth_device *edev, const unsigned char *addr)
{
struct davinci_emac_priv *priv = edev->priv;
int i;

View File

@ -384,7 +384,7 @@ static int dwc_ether_get_ethaddr(struct eth_device *dev, u8 adr[6])
return -1;
}
static int dwc_ether_set_ethaddr(struct eth_device *dev, u8 adr[6])
static int dwc_ether_set_ethaddr(struct eth_device *dev, const unsigned char *adr)
{
struct dw_eth_dev *priv = dev->priv;
struct eth_mac_regs *mac_p = priv->mac_regs_p;

View File

@ -711,7 +711,7 @@ static int dm9k_get_ethaddr(struct eth_device *edev, unsigned char *adr)
return 0;
}
static int dm9k_set_ethaddr(struct eth_device *edev, unsigned char *adr)
static int dm9k_set_ethaddr(struct eth_device *edev, const unsigned char *adr)
{
struct dm9k *priv = (struct dm9k *)edev->priv;
int i, oft;

View File

@ -466,7 +466,7 @@ static int ep93xx_eth_get_ethaddr(struct eth_device *edev,
}
static int ep93xx_eth_set_ethaddr(struct eth_device *edev,
unsigned char *mac_addr)
const unsigned char *mac_addr)
{
struct mac_regs *regs = ep93xx_get_regs(edev);

View File

@ -435,7 +435,7 @@ static int ethoc_get_ethaddr(struct eth_device *edev, unsigned char *mac)
return 0;
}
static int ethoc_set_ethaddr(struct eth_device *edev, unsigned char *mac)
static int ethoc_set_ethaddr(struct eth_device *edev, const unsigned char *mac)
{
struct ethoc *dev = edev->priv;

View File

@ -249,7 +249,7 @@ static int fec_get_hwaddr(struct eth_device *dev, unsigned char *mac)
return -1;
}
static int fec_set_hwaddr(struct eth_device *dev, unsigned char *mac)
static int fec_set_hwaddr(struct eth_device *dev, const unsigned char *mac)
{
struct fec_priv *fec = (struct fec_priv *)dev->priv;

View File

@ -211,7 +211,7 @@ static int mpc5xxx_fec_get_ethaddr(struct eth_device *dev, unsigned char *mac)
return -1;
}
static int mpc5xxx_fec_set_ethaddr(struct eth_device *dev, unsigned char *mac)
static int mpc5xxx_fec_set_ethaddr(struct eth_device *dev, const unsigned char *mac)
{
mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
uint8_t currByte; /* byte for which to compute the CRC */

View File

@ -233,7 +233,7 @@ static int gfar_get_ethaddr(struct eth_device *edev, unsigned char *mac)
return -ENODEV;
}
static int gfar_set_ethaddr(struct eth_device *edev, unsigned char *mac)
static int gfar_set_ethaddr(struct eth_device *edev, const unsigned char *mac)
{
struct gfar_private *priv = edev->priv;
void __iomem *regs = priv->regs;

View File

@ -571,7 +571,7 @@ static int ks8851_get_ethaddr(struct eth_device *edev, unsigned char *adr)
return 0;
}
static int ks8851_set_ethaddr(struct eth_device *edev, unsigned char *adr)
static int ks8851_set_ethaddr(struct eth_device *edev, const unsigned char *adr)
{
struct ks_net *priv = (struct ks_net *)edev->priv;

View File

@ -493,7 +493,7 @@ static int macb_get_ethaddr(struct eth_device *edev, unsigned char *adr)
return -1;
}
static int macb_set_ethaddr(struct eth_device *edev, unsigned char *adr)
static int macb_set_ethaddr(struct eth_device *edev, const unsigned char *adr)
{
struct macb_device *macb = edev->priv;

View File

@ -486,7 +486,7 @@ recv_err:
return ret;
}
static int mvneta_set_ethaddr(struct eth_device *edev, unsigned char *mac)
static int mvneta_set_ethaddr(struct eth_device *edev, const unsigned char *mac)
{
struct mvneta_port *priv = edev->priv;
u32 mac_h = (mac[0] << 24) | (mac[1] << 16) | (mac[2] << 8) | mac[3];

View File

@ -210,7 +210,7 @@ static int netx_eth_get_ethaddr(struct eth_device *edev, unsigned char *adr)
return -1;
}
static int netx_eth_set_ethaddr(struct eth_device *edev, unsigned char *adr)
static int netx_eth_set_ethaddr(struct eth_device *edev, const unsigned char *adr)
{
struct netx_eth_priv *priv = (struct netx_eth_priv *)edev->priv;
int xcno = priv->xcno;

View File

@ -322,7 +322,7 @@ recv_err:
return ret;
}
static int port_set_ethaddr(struct eth_device *edev, unsigned char *mac)
static int port_set_ethaddr(struct eth_device *edev, const unsigned char *mac)
{
struct port_priv *port = edev->priv;
u32 mac_h = (mac[0] << 24) | (mac[1] << 16) | (mac[2] << 8) | mac[3];

View File

@ -352,7 +352,7 @@ static int rtl8139_get_ethaddr(struct eth_device *edev, unsigned char *m)
}
static int rtl8139_set_ethaddr(struct eth_device *edev,
unsigned char *mac_addr)
const unsigned char *mac_addr)
{
struct rtl8139_priv *priv = edev->priv;
int i;

View File

@ -456,7 +456,7 @@ static int rtl8169_get_ethaddr(struct eth_device *edev, unsigned char *m)
return 0;
}
static int rtl8169_set_ethaddr(struct eth_device *edev, unsigned char *mac_addr)
static int rtl8169_set_ethaddr(struct eth_device *edev, const unsigned char *mac_addr)
{
struct rtl8169_priv *priv = edev->priv;
int i;

View File

@ -1378,7 +1378,7 @@ static int smc91c111_get_ethaddr(struct eth_device *edev, unsigned char *m)
}
static int smc91c111_set_ethaddr(struct eth_device *edev,
unsigned char *mac_addr)
const unsigned char *mac_addr)
{
struct smc91c111_priv *priv = (struct smc91c111_priv *)edev->priv;
unsigned address;

View File

@ -182,7 +182,7 @@ static int smc911x_get_ethaddr(struct eth_device *edev, unsigned char *m)
return 0;
}
static int smc911x_set_ethaddr(struct eth_device *edev, unsigned char *m)
static int smc911x_set_ethaddr(struct eth_device *edev, const unsigned char *m)
{
unsigned long addrh, addrl;
@ -630,8 +630,14 @@ static int smc911x_probe(struct device_d *dev)
return 0;
}
static const struct of_device_id smsc911x_dt_ids[] = {
{ .compatible = "smsc,lan9115", },
{ /* sentinel */ }
};
static struct driver_d smc911x_driver = {
.name = "smc911x",
.probe = smc911x_probe,
.of_compatible = DRV_OF_COMPAT(smsc911x_dt_ids),
};
device_platform_driver(smc911x_driver);

View File

@ -65,7 +65,7 @@ static int tap_get_ethaddr(struct eth_device *edev, unsigned char *adr)
return -1;
}
static int tap_set_ethaddr(struct eth_device *edev, unsigned char *adr)
static int tap_set_ethaddr(struct eth_device *edev, const unsigned char *adr)
{
return 0;
}

View File

@ -403,7 +403,7 @@ static int asix_get_ethaddr(struct eth_device *edev, unsigned char *adr)
return 0;
}
static int asix_set_ethaddr(struct eth_device *edev, unsigned char *adr)
static int asix_set_ethaddr(struct eth_device *edev, const unsigned char *adr)
{
/* not possible? */
return 0;

View File

@ -363,7 +363,7 @@ static int smsc95xx_set_csums(struct usbnet *dev)
return 0;
}
static int smsc95xx_set_ethaddr(struct eth_device *edev, unsigned char *adr)
static int smsc95xx_set_ethaddr(struct eth_device *edev, const unsigned char *adr)
{
struct usbnet *udev = container_of(edev, struct usbnet, edev);

View File

@ -674,7 +674,7 @@ static int xgmac_get_ethaddr(struct eth_device *edev, unsigned char *addr)
return 0;
}
static int xgmac_set_ethaddr(struct eth_device *dev, unsigned char *addr)
static int xgmac_set_ethaddr(struct eth_device *dev, const unsigned char *addr)
{
struct xgmac_priv *priv = dev->priv;
u32 data;

View File

@ -291,6 +291,7 @@ static void ns16550_probe_dt(struct device_d *dev, struct ns16550_priv *priv)
if (!IS_ENABLED(CONFIG_OFDEVICE))
return;
of_property_read_u32(np, "clock-frequency", &priv->plat.clock);
of_property_read_u32(np, "reg-shift", &priv->plat.shift);
}
@ -417,7 +418,7 @@ static int ns16550_probe(struct device_d *dev)
else
ns16550_probe_dt(dev, priv);
if (!plat || !plat->clock) {
if (!priv->plat.clock) {
priv->clk = clk_get(dev, NULL);
if (IS_ERR(priv->clk)) {
ret = PTR_ERR(priv->clk);
@ -427,12 +428,6 @@ static int ns16550_probe(struct device_d *dev)
priv->plat.clock = clk_get_rate(priv->clk);
}
if (priv->plat.clock == 0 && IS_ENABLED(CONFIG_OFDEVICE)) {
struct device_node *np = dev->device_node;
of_property_read_u32(np, "clock-frequency", &priv->plat.clock);
}
if (priv->plat.clock == 0) {
dev_err(dev, "no valid clockrate\n");
ret = -EINVAL;

View File

@ -25,7 +25,7 @@ config USB_GADGET_DRIVER_AT91
config USB_GADGET_DRIVER_PXA27X
bool
prompt "PXA27x gadget driver"
depends on ARCH_PXA
depends on ARCH_PXA27X
default y
select USB_GADGET_DUALSPEED

View File

@ -481,4 +481,3 @@ static int cramfs_init(void)
}
device_initcall(cramfs_init);

View File

@ -434,4 +434,3 @@ static int fat_init(void)
}
coredevice_initcall(fat_init);

View File

@ -644,4 +644,3 @@ static int ramfs_init(void)
}
coredevice_initcall(ramfs_init);

View File

@ -75,6 +75,8 @@ quiet_cmd_pblx ?= PBLX $@
$(obj)/%.pblx: $(obj)/%.pblb $(obj)/barebox.z FORCE
$(call if_changed,pblx,$(@F))
$(call cmd,check_file_size,$@,$(CONFIG_BAREBOX_MAX_PBLX_SIZE))
$(obj)/%.s: $(obj)/% FORCE
$(call if_changed,disasm)

View File

@ -59,6 +59,7 @@ struct digest {
/*
* digest functions
*/
#ifdef CONFIG_DIGEST
int digest_algo_register(struct digest_algo *d);
void digest_algo_unregister(struct digest_algo *d);
void digest_algo_prints(const char *prefix);
@ -76,6 +77,16 @@ int digest_file(struct digest *d, const char *filename,
int digest_file_by_name(const char *algo, const char *filename,
unsigned char *hash,
const unsigned char *sig);
#else
static inline struct digest *digest_alloc(const char *name)
{
return NULL;
}
static inline void digest_free(struct digest *d)
{
}
#endif
static inline int digest_init(struct digest *d)
{

View File

@ -54,7 +54,7 @@ extern unsigned long __sw_hweight64(__u64 w);
(bit) < (size); \
(bit) = find_next_zero_bit((addr), (size), (bit) + 1))
static __inline__ int get_bitmask_order(unsigned int count)
static inline int get_bitmask_order(unsigned int count)
{
int order;
@ -62,7 +62,7 @@ static __inline__ int get_bitmask_order(unsigned int count)
return order; /* We could be slightly more clever with -1 here... */
}
static __inline__ int get_count_order(unsigned int count)
static inline int get_count_order(unsigned int count)
{
int order;

View File

@ -270,7 +270,7 @@ static inline uint32_t mtd_div_by_wb(uint64_t sz, struct mtd_info *mtd)
/* Kernel-side ioctl definitions */
extern int add_mtd_device(struct mtd_info *mtd, char *devname, int device_id);
extern int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id);
extern int del_mtd_device (struct mtd_info *mtd);
extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);

View File

@ -42,7 +42,7 @@ struct eth_device {
int (*recv) (struct eth_device*);
void (*halt) (struct eth_device*);
int (*get_ethaddr) (struct eth_device*, u8 adr[6]);
int (*set_ethaddr) (struct eth_device*, u8 adr[6]);
int (*set_ethaddr) (struct eth_device*, const unsigned char *adr);
struct eth_device *next;
void *priv;
@ -60,6 +60,7 @@ struct eth_device {
IPaddr_t serverip;
IPaddr_t netmask;
IPaddr_t gateway;
char ethaddr_param[6];
char ethaddr[6];
};
@ -67,6 +68,7 @@ struct eth_device {
int eth_register(struct eth_device* dev); /* Register network device */
void eth_unregister(struct eth_device* dev); /* Unregister network device */
int eth_set_ethaddr(struct eth_device *edev, const char *ethaddr);
int eth_send(struct eth_device *edev, void *packet, int length); /* Send a packet */
int eth_rx(void); /* Check for received packets */

View File

@ -218,4 +218,3 @@ int fnmatch(const char *pattern, const char *string, int flags)
# undef FOLD
}

View File

@ -37,10 +37,10 @@ struct image *image_renderer_open(const char* file)
struct image *img;
int ret;
data = read_file(file, &size);
if (!data) {
printf("unable to read %s\n", file);
return ERR_PTR(-ENOMEM);
ret = read_file_2(file, &size, &data, FILESIZE_MAX);
if (ret) {
printf("unable to read %s: %s\n", file, strerror(-ret));
return ERR_PTR(ret);
}
ir = get_renderer(data, size);

View File

@ -184,8 +184,8 @@ again:
if (read_size < s.st_size)
return -EFBIG;
else
return 0;
return 0;
err_out1:
close(fd);

View File

@ -258,4 +258,3 @@ lookbehind_overrun:
}
EXPORT_SYMBOL(lzo1x_decompress_safe);

View File

@ -122,6 +122,14 @@ static const char *param_get_generic(struct device_d *dev, struct param_d *p)
return p->value ? p->value : "";
}
static int compare(struct list_head *a, struct list_head *b)
{
char *na = (char*)list_entry(a, struct param_d, list)->name;
char *nb = (char*)list_entry(b, struct param_d, list)->name;
return strcmp(na, nb);
}
static int __dev_add_param(struct param_d *param, struct device_d *dev, const char *name,
int (*set)(struct device_d *dev, struct param_d *p, const char *val),
const char *(*get)(struct device_d *dev, struct param_d *p),
@ -145,7 +153,7 @@ static int __dev_add_param(struct param_d *param, struct device_d *dev, const ch
param->flags = flags;
param->dev = dev;
list_add_tail(&param->list, &dev->parameters);
list_add_sort(&param->list, &dev->parameters, compare);
return 0;
}
@ -575,7 +583,6 @@ struct param_d *dev_add_param_llint_ro(struct device_d *dev, const char *name,
return &piro->param;
}
#ifdef CONFIG_NET
struct param_ip {
struct param_d param;
IPaddr_t *ip;
@ -739,7 +746,6 @@ struct param_d *dev_add_param_mac(struct device_d *dev, const char *name,
return &pm->param;
}
#endif
/**
* dev_remove_param - remove a parameter from a device and free its

View File

@ -25,4 +25,3 @@ void get_random_bytes(void *_buf, int len)
while (len--)
*buf++ = rand() % 256;
}

View File

@ -65,4 +65,3 @@ unsigned long long simple_strtoull (const char *cp, char **endp, unsigned int ba
return result;
}
EXPORT_SYMBOL(simple_strtoull);

View File

@ -1,3 +1,4 @@
obj-y += lib.o
obj-$(CONFIG_NET) += eth.o
obj-$(CONFIG_NET) += net.o
obj-$(CONFIG_NET_NFS) += nfs.o

View File

@ -42,15 +42,27 @@ struct eth_ethaddr {
static LIST_HEAD(ethaddr_list);
int eth_set_ethaddr(struct eth_device *edev, const char *ethaddr)
{
int ret;
ret = edev->set_ethaddr(edev, ethaddr);
if (ret)
return ret;
memcpy(edev->ethaddr, ethaddr, ETH_ALEN);
return 0;
}
static void register_preset_mac_address(struct eth_device *edev, const char *ethaddr)
{
unsigned char ethaddr_str[sizeof("xx:xx:xx:xx:xx:xx")];
ethaddr_to_string(ethaddr, ethaddr_str);
if (is_valid_ether_addr(ethaddr)) {
ethaddr_to_string(ethaddr, ethaddr_str);
dev_info(&edev->dev, "got preset MAC address: %s\n", ethaddr_str);
dev_set_param(&edev->dev, "ethaddr", ethaddr_str);
eth_set_ethaddr(edev, ethaddr);
}
}
@ -261,13 +273,11 @@ int eth_rx(void)
return 0;
}
static int eth_set_ethaddr(struct param_d *param, void *priv)
static int eth_param_set_ethaddr(struct param_d *param, void *priv)
{
struct eth_device *edev = priv;
edev->set_ethaddr(edev, edev->ethaddr);
return 0;
return eth_set_ethaddr(edev, edev->ethaddr_param);
}
#ifdef CONFIG_OFTREE
@ -350,7 +360,8 @@ int eth_register(struct eth_device *edev)
dev_add_param_ip(dev, "serverip", NULL, NULL, &edev->serverip, edev);
dev_add_param_ip(dev, "gateway", NULL, NULL, &edev->gateway, edev);
dev_add_param_ip(dev, "netmask", NULL, NULL, &edev->netmask, edev);
dev_add_param_mac(dev, "ethaddr", eth_set_ethaddr, NULL, edev->ethaddr, edev);
dev_add_param_mac(dev, "ethaddr", eth_param_set_ethaddr, NULL,
edev->ethaddr_param, edev);
if (edev->init)
edev->init(edev);

109
net/lib.c Normal file
View File

@ -0,0 +1,109 @@
/*
* net.c - barebox networking support
*
* Copyright (c) 2015 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
*
* based on U-Boot (LiMon) code
*
* Copyright 1994 - 2000 Neil Russell.
* Copyright 2000 Roland Borde
* Copyright 2000 Paolo Scaffardi
* Copyright 2000-2002 Wolfgang Denk, wd@denx.de
*
* See file CREDITS for list of people who contributed to this
* project.
*
* 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.
*
*/
#include <common.h>
#include <net.h>
#include <linux/ctype.h>
int string_to_ethaddr(const char *str, u8 enetaddr[6])
{
int reg;
char *e;
if (!str || strlen(str) != 17) {
memset(enetaddr, 0, 6);
return -EINVAL;
}
if (str[2] != ':' || str[5] != ':' || str[8] != ':' ||
str[11] != ':' || str[14] != ':')
return -EINVAL;
for (reg = 0; reg < 6; ++reg) {
enetaddr[reg] = simple_strtoul(str, &e, 16);
str = e + 1;
}
return 0;
}
void ethaddr_to_string(const u8 enetaddr[6], char *str)
{
sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x",
enetaddr[0], enetaddr[1], enetaddr[2], enetaddr[3],
enetaddr[4], enetaddr[5]);
}
void print_IPaddr(IPaddr_t x)
{
puts(ip_to_string(x));
}
char *ip_to_string(IPaddr_t x)
{
static char s[sizeof("xxx.xxx.xxx.xxx")];
x = ntohl(x);
sprintf(s, "%d.%d.%d.%d",
(int) ((x >> 24) & 0xff),
(int) ((x >> 16) & 0xff),
(int) ((x >> 8) & 0xff), (int) ((x >> 0) & 0xff)
);
return s;
}
int string_to_ip(const char *s, IPaddr_t *ip)
{
IPaddr_t addr = 0;
char *e;
int i;
if (!s)
return -EINVAL;
for (i = 0; i < 4; i++) {
unsigned long val;
if (!isdigit(*s))
return -EINVAL;
val = simple_strtoul(s, &e, 10);
if (val > 255)
return -EINVAL;
addr = (addr << 8) | val;
if (*e != '.' && i != 3)
return -EINVAL;
s = e + 1;
}
*ip = htonl(addr);
return 0;
}

View File

@ -62,50 +62,6 @@ uint16_t net_checksum(unsigned char *ptr, int len)
return xsum & 0xffff;
}
char *ip_to_string (IPaddr_t x)
{
static char s[sizeof("xxx.xxx.xxx.xxx")];
x = ntohl (x);
sprintf (s, "%d.%d.%d.%d",
(int) ((x >> 24) & 0xff),
(int) ((x >> 16) & 0xff),
(int) ((x >> 8) & 0xff), (int) ((x >> 0) & 0xff)
);
return s;
}
int string_to_ip(const char *s, IPaddr_t *ip)
{
IPaddr_t addr = 0;
char *e;
int i;
if (!s)
return -EINVAL;
for (i = 0; i < 4; i++) {
unsigned long val;
if (!isdigit(*s))
return -EINVAL;
val = simple_strtoul(s, &e, 10);
if (val > 255)
return -EINVAL;
addr = (addr << 8) | val;
if (*e != '.' && i != 3)
return -EINVAL;
s = e + 1;
}
*ip = htonl(addr);
return 0;
}
IPaddr_t getenv_ip(const char *name)
{
IPaddr_t ip;
@ -131,40 +87,6 @@ int setenv_ip(const char *name, IPaddr_t ip)
return 0;
}
void print_IPaddr (IPaddr_t x)
{
puts(ip_to_string(x));
}
int string_to_ethaddr(const char *str, u8 enetaddr[6])
{
int reg;
char *e;
if (!str || strlen(str) != 17) {
memset(enetaddr, 0, 6);
return -EINVAL;
}
if (str[2] != ':' || str[5] != ':' || str[8] != ':' ||
str[11] != ':' || str[14] != ':')
return -EINVAL;
for (reg = 0; reg < 6; ++reg) {
enetaddr[reg] = simple_strtoul (str, &e, 16);
str = e + 1;
}
return 0;
}
void ethaddr_to_string(const u8 enetaddr[6], char *str)
{
sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x",
enetaddr[0], enetaddr[1], enetaddr[2], enetaddr[3],
enetaddr[4], enetaddr[5]);
}
static unsigned char *arp_ether;
static IPaddr_t arp_wait_ip;
@ -348,7 +270,7 @@ static struct net_connection *net_new(IPaddr_t dest, rx_handler_f *handler,
random_ether_addr(edev->ethaddr);
ethaddr_to_string(edev->ethaddr, str);
printf("warning: No MAC address set. Using random address %s\n", str);
dev_set_param(&edev->dev, "ethaddr", str);
eth_set_ethaddr(edev, edev->ethaddr);
}
/* If we don't have an ip only broadcast is allowed */
@ -667,4 +589,3 @@ static int net_init(void)
}
postcore_initcall(net_init);

View File

@ -731,4 +731,3 @@ BAREBOX_CMD_START(nfs)
BAREBOX_CMD_OPTS("FILE [LOCALFILE]")
BAREBOX_CMD_GROUP(CMD_GRP_NET)
BAREBOX_CMD_END