9
0
Fork 0

Merge branch 'for-next/malloc-all-initcalls'

This commit is contained in:
Sascha Hauer 2013-04-04 14:20:32 +02:00
commit 4856aee6a8
16 changed files with 44 additions and 66 deletions

View File

@ -329,8 +329,8 @@ _clear_bss_skip:
[p0] = r0; [p0] = r0;
#endif #endif
p0.l = _start_barebox; p0.l = _blackfin_start_barebox;
p0.h = _start_barebox; p0.h = _blackfin_start_barebox;
jump (p0); jump (p0);
reset_start: reset_start:

View File

@ -31,15 +31,13 @@
#include <asm/cpu.h> #include <asm/cpu.h>
#include <asm-generic/memory_layout.h> #include <asm-generic/memory_layout.h>
int blackfin_mem_malloc_init(void) void __noreturn blackfin_start_barebox(void)
{ {
mem_malloc_init((void *)(MALLOC_BASE), mem_malloc_init((void *)(MALLOC_BASE),
(void *)(MALLOC_BASE + MALLOC_SIZE - 1)); (void *)(MALLOC_BASE + MALLOC_SIZE - 1));
return 0; start_barebox();
} }
core_initcall(blackfin_mem_malloc_init);
void arch_shutdown(void) void arch_shutdown(void)
{ {
icache_disable(); icache_disable();

View File

@ -18,6 +18,8 @@
#include <common.h> #include <common.h>
#include <string.h> #include <string.h>
#include <memory.h>
#include <asm-generic/memory_layout.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/cpu-features.h> #include <asm/cpu-features.h>
#include <asm/mipsregs.h> #include <asm/mipsregs.h>
@ -90,5 +92,8 @@ void main_entry(void)
trap_init(); trap_init();
mem_malloc_init((void *)MALLOC_BASE,
(void *)(MALLOC_BASE + MALLOC_SIZE - 1));
start_barebox(); start_barebox();
} }

View File

@ -3,7 +3,6 @@ obj-$(CONFIG_CSRC_R4K_LIB) += csrc-r4k.o
obj-y += lshrdi3.o obj-y += lshrdi3.o
obj-y += ashldi3.o obj-y += ashldi3.o
obj-y += ashrdi3.o obj-y += ashrdi3.o
obj-y += memory.o
obj-y += cpu-probe.o obj-y += cpu-probe.o
obj-y += traps.o obj-y += traps.o
obj-y += genex.o obj-y += genex.o

View File

@ -1,29 +0,0 @@
/*
* Copyright (C) 2011 Antony Pavlov <antonynpavlov@gmail.com>
*
* This file is part of barebox.
* 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 <init.h>
#include <memory.h>
#include <asm-generic/memory_layout.h>
static int mips_mem_malloc_init(void)
{
mem_malloc_init((void *)MALLOC_BASE,
(void *)(MALLOC_BASE + MALLOC_SIZE - 1));
return 0;
}
core_initcall(mips_mem_malloc_init);

View File

@ -150,8 +150,8 @@ _reloc:
/* /*
* Call board_init -- never returns * Call board_init -- never returns
*/ */
movhi r4, %hi(start_barebox@h) movhi r4, %hi(nios_start_barebox@h)
ori r4, r4, %lo(start_barebox@h) ori r4, r4, %lo(nios_start_barebox@h)
callr r4 callr r4
/* NEVER RETURNS -- but branch to the _start just /* NEVER RETURNS -- but branch to the _start just

View File

@ -18,23 +18,19 @@
#include <common.h> #include <common.h>
#include <malloc.h> #include <malloc.h>
#include <init.h>
#include <memory.h> #include <memory.h>
#include <asm-generic/memory_layout.h> #include <asm-generic/memory_layout.h>
#include <cache.h> #include <cache.h>
int altera_mem_malloc_init(void) void __noreturn nios_start_barebox(void)
{ {
mem_malloc_init((void *)(NIOS_SOPC_TEXT_BASE - MALLOC_SIZE), mem_malloc_init((void *)(NIOS_SOPC_TEXT_BASE - MALLOC_SIZE),
(void *)(NIOS_SOPC_TEXT_BASE - 1)); (void *)(NIOS_SOPC_TEXT_BASE - 1));
return 0; start_barebox();
} }
core_initcall(altera_mem_malloc_init);
void arch_shutdown(void) void arch_shutdown(void)
{ {
} }

View File

@ -245,7 +245,7 @@ _start:
l.andi r30, r0, 0 l.andi r30, r0, 0
l.andi r31, r0, 0 l.andi r31, r0, 0
l.j start_barebox l.j openrisc_start_barebox
l.nop l.nop
.size _start, .-_start .size _start, .-_start

View File

@ -22,17 +22,14 @@
#include <memory.h> #include <memory.h>
#include <asm-generic/memory_layout.h> #include <asm-generic/memory_layout.h>
int openrisc_mem_malloc_init(void) void __noreturn openrisc_start_barebox(void)
{ {
mem_malloc_init((void *)(OPENRISC_SOPC_TEXT_BASE - MALLOC_SIZE), mem_malloc_init((void *)(OPENRISC_SOPC_TEXT_BASE - MALLOC_SIZE),
(void *)(OPENRISC_SOPC_TEXT_BASE - 1)); (void *)(OPENRISC_SOPC_TEXT_BASE - 1));
return 0; start_barebox();
} }
core_initcall(openrisc_mem_malloc_init);
void arch_shutdown(void) void arch_shutdown(void)
{ {
} }

View File

@ -22,7 +22,7 @@
#include <string.h> #include <string.h>
#include <asm/sections.h> #include <asm/sections.h>
extern void start_barebox(void); extern void x86_start_barebox(void);
/** /**
* Called plainly from assembler that switches from real to flat mode * Called plainly from assembler that switches from real to flat mode
@ -33,5 +33,5 @@ void uboot_entry(void)
{ {
/* clear the BSS first */ /* clear the BSS first */
memset(__bss_start, 0x00, __bss_stop - __bss_start); memset(__bss_start, 0x00, __bss_stop - __bss_start);
start_barebox(); x86_start_barebox();
} }

View File

@ -21,6 +21,7 @@
* @brief Memory management * @brief Memory management
*/ */
#include <common.h>
#include <init.h> #include <init.h>
#include <stdio.h> #include <stdio.h>
#include <memory.h> #include <memory.h>
@ -36,7 +37,7 @@
* - memory above 0x100000 * - memory above 0x100000
*/ */
static int x86_mem_malloc_init(void) int x86_start_barebox(void)
{ {
#ifdef CONFIG_MEMORY_LAYOUT_DEFAULT #ifdef CONFIG_MEMORY_LAYOUT_DEFAULT
unsigned long memory_size; unsigned long memory_size;
@ -57,7 +58,5 @@ static int x86_mem_malloc_init(void)
mem_malloc_init((void *)MALLOC_BASE, mem_malloc_init((void *)MALLOC_BASE,
(void *)(MALLOC_BASE + MALLOC_SIZE - 1)); (void *)(MALLOC_BASE + MALLOC_SIZE - 1));
#endif #endif
return 0; start_barebox();
} }
core_initcall(x86_mem_malloc_init);

View File

@ -30,10 +30,11 @@ int bus_register(struct bus_type *bus)
if (get_bus_by_name(bus->name)) if (get_bus_by_name(bus->name))
return -EEXIST; return -EEXIST;
strcpy(bus->dev.name, bus->name); bus->dev = xzalloc(sizeof(*bus->dev));
bus->dev.id = DEVICE_ID_SINGLE; strcpy(bus->dev->name, bus->name);
bus->dev->id = DEVICE_ID_SINGLE;
ret = register_device(&bus->dev); ret = register_device(bus->dev);
if (ret) if (ret)
return ret; return ret;

View File

@ -135,7 +135,7 @@ int register_device(struct device_d *new_device)
if (new_device->bus) { if (new_device->bus) {
if (!new_device->parent) if (!new_device->parent)
new_device->parent = &new_device->bus->dev; new_device->parent = new_device->bus->dev;
list_add_tail(&new_device->bus_list, &new_device->bus->device_list); list_add_tail(&new_device->bus_list, &new_device->bus->device_list);

View File

@ -1,3 +1,4 @@
#include <init.h>
#include <common.h> #include <common.h>
#include <command.h> #include <command.h>
#include <complete.h> #include <complete.h>
@ -13,7 +14,15 @@ struct gpio_info {
char *label; char *label;
}; };
static struct gpio_info gpio_desc[ARCH_NR_GPIOS]; static struct gpio_info *gpio_desc;
static int gpio_desc_alloc(void)
{
gpio_desc = xzalloc(sizeof(struct gpio_info) * ARCH_NR_GPIOS);
return 0;
}
pure_initcall(gpio_desc_alloc);
static int gpio_ensure_requested(struct gpio_info *gi, int gpio) static int gpio_ensure_requested(struct gpio_info *gi, int gpio)
{ {

11
fs/fs.c
View File

@ -119,14 +119,19 @@ EXPORT_SYMBOL(mkmodestr);
static char *cwd; static char *cwd;
static int init_cwd(void) static FILE *files;
static int init_fs(void)
{ {
cwd = xzalloc(PATH_MAX); cwd = xzalloc(PATH_MAX);
*cwd = '/'; *cwd = '/';
files = xzalloc(sizeof(FILE) * MAX_FILES);
return 0; return 0;
} }
postcore_initcall(init_cwd); postcore_initcall(init_fs);
char *normalise_link(const char *pathname, const char *symlink) char *normalise_link(const char *pathname, const char *symlink)
{ {
@ -268,8 +273,6 @@ char *get_mounted_path(const char *path)
return fdev->path; return fdev->path;
} }
static FILE files[MAX_FILES];
static FILE *get_file(void) static FILE *get_file(void)
{ {
int i; int i;

View File

@ -368,7 +368,7 @@ struct bus_type {
int (*probe)(struct device_d *dev); int (*probe)(struct device_d *dev);
void (*remove)(struct device_d *dev); void (*remove)(struct device_d *dev);
struct device_d dev; struct device_d *dev;
struct list_head list; struct list_head list;
struct list_head device_list; struct list_head device_list;