summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/cpu/board-dt-2nd.c72
-rw-r--r--arch/sandbox/board/hostfile.c17
-rw-r--r--arch/sandbox/configs/sandbox_defconfig1
-rw-r--r--arch/sandbox/mach-sandbox/include/mach/linux.h2
-rw-r--r--arch/sandbox/os/Makefile2
-rw-r--r--arch/sandbox/os/common.c2
7 files changed, 15 insertions, 83 deletions
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 96613cc5ba..9dc0897e58 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -54,7 +54,7 @@ ifeq ($(CONFIG_CPU_V8), y)
CFLAGS_ABI :=-mabi=lp64
else
ifeq ($(CONFIG_AEABI),y)
-CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork
+CFLAGS_ABI :=-mabi=aapcs-linux
else
CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
endif
diff --git a/arch/arm/cpu/board-dt-2nd.c b/arch/arm/cpu/board-dt-2nd.c
index 4e7d575e8a..bb13180785 100644
--- a/arch/arm/cpu/board-dt-2nd.c
+++ b/arch/arm/cpu/board-dt-2nd.c
@@ -8,73 +8,7 @@
#include <debug_ll.h>
#include <asm/cache.h>
#include <asm/sections.h>
-#include <linux/libfdt.h>
-
-static void of_find_mem(void *fdt, unsigned long *membase, unsigned long *memsize)
-{
- const __be32 *nap, *nsp, *reg;
- uint32_t na, ns;
- uint64_t memsize64, membase64;
- int node, size, i;
-
- /* Make sure FDT blob is sane */
- if (fdt_check_header(fdt) != 0) {
- pr_err("Invalid device tree blob\n");
- goto err;
- }
-
- /* Find the #address-cells and #size-cells properties */
- node = fdt_path_offset(fdt, "/");
- if (node < 0) {
- pr_err("Cannot find root node\n");
- goto err;
- }
-
- nap = fdt_getprop(fdt, node, "#address-cells", &size);
- if (!nap || (size != 4)) {
- pr_err("Cannot find #address-cells property");
- goto err;
- }
- na = fdt32_to_cpu(*nap);
-
- nsp = fdt_getprop(fdt, node, "#size-cells", &size);
- if (!nsp || (size != 4)) {
- pr_err("Cannot find #size-cells property");
- goto err;
- }
- ns = fdt32_to_cpu(*nap);
-
- /* Find the memory range */
- node = fdt_node_offset_by_prop_value(fdt, -1, "device_type",
- "memory", sizeof("memory"));
- if (node < 0) {
- pr_err("Cannot find memory node\n");
- goto err;
- }
-
- reg = fdt_getprop(fdt, node, "reg", &size);
- if (size < (na + ns) * sizeof(u32)) {
- pr_err("cannot get memory range\n");
- goto err;
- }
-
- membase64 = 0;
- for (i = 0; i < na; i++)
- membase64 = (membase64 << 32) | fdt32_to_cpu(*reg++);
-
- /* get the memsize and truncate it to under 4G on 32 bit machines */
- memsize64 = 0;
- for (i = 0; i < ns; i++)
- memsize64 = (memsize64 << 32) | fdt32_to_cpu(*reg++);
-
- *membase = membase64;
- *memsize = memsize64;
-
- return;
-err:
- pr_err("No memory, cannot continue\n");
- while (1);
-}
+#include <pbl.h>
#ifdef CONFIG_CPU_V8
@@ -85,7 +19,7 @@ static noinline void dt_2nd_continue_aarch64(void *fdt)
if (!fdt)
hang();
- of_find_mem(fdt, &membase, &memsize);
+ fdt_find_mem(fdt, &membase, &memsize);
barebox_arm_entry(membase, memsize, fdt);
}
@@ -114,7 +48,7 @@ static noinline void dt_2nd_continue(void *fdt)
if (!fdt)
hang();
- of_find_mem(fdt, &membase, &memsize);
+ fdt_find_mem(fdt, &membase, &memsize);
barebox_arm_entry(membase, memsize, fdt);
}
diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c
index d63f51eb23..4fdf2b317d 100644
--- a/arch/sandbox/board/hostfile.c
+++ b/arch/sandbox/board/hostfile.c
@@ -102,21 +102,18 @@ static int hf_probe(struct device_d *dev)
{
struct device_node *np = dev->device_node;
struct hf_priv *priv = xzalloc(sizeof(*priv));
- struct resource *res;
struct cdev *cdev;
bool is_blockdev;
- resource_size_t size;
+ u64 reg[2];
int err;
- res = dev_get_resource(dev, IORESOURCE_MEM, 0);
- if (IS_ERR(res))
- return PTR_ERR(res);
-
- size = resource_size(res);
-
if (!np)
return -ENODEV;
+ err = of_property_read_u64_array(np, "reg", reg, ARRAY_SIZE(reg));
+ if (err)
+ return err;
+
of_property_read_u32(np, "barebox,fd", &priv->fd);
err = of_property_read_string(np, "barebox,filename",
@@ -141,7 +138,7 @@ static int hf_probe(struct device_d *dev)
priv->blk.dev = dev;
priv->blk.ops = &hf_blk_ops;
priv->blk.blockbits = SECTOR_SHIFT;
- priv->blk.num_blocks = size / SECTOR_SIZE;
+ priv->blk.num_blocks = reg[1] / SECTOR_SIZE;
err = blockdevice_register(&priv->blk);
if (err)
@@ -156,7 +153,7 @@ static int hf_probe(struct device_d *dev)
cdev->name = np->name;
cdev->dev = dev;
cdev->ops = &hf_cdev_ops;
- cdev->size = size;
+ cdev->size = reg[1];
cdev->priv = priv;
err = devfs_create(cdev);
diff --git a/arch/sandbox/configs/sandbox_defconfig b/arch/sandbox/configs/sandbox_defconfig
index ca24d81aca..dcd0557326 100644
--- a/arch/sandbox/configs/sandbox_defconfig
+++ b/arch/sandbox/configs/sandbox_defconfig
@@ -1,3 +1,4 @@
+CONFIG_MALLOC_SIZE=0x1000000
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
diff --git a/arch/sandbox/mach-sandbox/include/mach/linux.h b/arch/sandbox/mach-sandbox/include/mach/linux.h
index b26bfc24a2..f047c83e17 100644
--- a/arch/sandbox/mach-sandbox/include/mach/linux.h
+++ b/arch/sandbox/mach-sandbox/include/mach/linux.h
@@ -17,7 +17,7 @@ int linux_open_hostfile(struct hf_info *hf);
int linux_read(int fd, void *buf, size_t count);
int linux_read_nonblock(int fd, void *buf, size_t count);
ssize_t linux_write(int fd, const void *buf, size_t count);
-off_t linux_lseek(int fildes, off_t offset);
+loff_t linux_lseek(int fildes, loff_t offset);
int linux_tstc(int fd);
void __attribute__((noreturn)) linux_exit(void);
void linux_hang(void);
diff --git a/arch/sandbox/os/Makefile b/arch/sandbox/os/Makefile
index 15d688bfdd..9a264ca314 100644
--- a/arch/sandbox/os/Makefile
+++ b/arch/sandbox/os/Makefile
@@ -4,7 +4,7 @@ machdirs := $(patsubst %,arch/sandbox/mach-%/,$(machine-y))
KBUILD_CPPFLAGS = $(patsubst %,-I$(srctree)/%include,$(machdirs))
-KBUILD_CPPFLAGS += -DCONFIG_MALLOC_SIZE=$(CONFIG_MALLOC_SIZE)
+KBUILD_CPPFLAGS += -DCONFIG_MALLOC_SIZE=$(CONFIG_MALLOC_SIZE) -D_FILE_OFFSET_BITS=64
KBUILD_CFLAGS := -Wall
diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c
index 56c2d05193..f6b352f2d6 100644
--- a/arch/sandbox/os/common.c
+++ b/arch/sandbox/os/common.c
@@ -220,7 +220,7 @@ ssize_t linux_write(int fd, const void *buf, size_t count)
return write(fd, buf, count);
}
-off_t linux_lseek(int fd, off_t offset)
+loff_t linux_lseek(int fd, loff_t offset)
{
return lseek(fd, offset, SEEK_SET);
}