1
0

Move atags support to be ARM arch-specific

This commit is contained in:
Aaron Lindsay 2012-12-24 12:40:30 -05:00
parent ed52a8af5c
commit 62755b8f38
5 changed files with 24 additions and 17 deletions

View File

@ -19,6 +19,7 @@
*/ */
#include <atags.h> #include <atags.h>
#include <mmu.h>
extern arch_uint_ptr atags_ptr; extern arch_uint_ptr atags_ptr;
@ -60,3 +61,20 @@ int _atags_mem_region(struct atag **mem_header, int initialize) {
return -1; return -1;
return 0; return 0;
} }
int detect_memory() {
struct atag *atags;
char *lower, *upper;
if (atags_first_mem_region(&atags)) {
return -1;
}
do {
lower = (char *)atags->data.mem.start;
upper = lower + atags->data.mem.size - 1;
declare_memory_region(lower, upper);
} while (!atags_next_mem_region(&atags));
return 0;
}

View File

@ -3,7 +3,8 @@ SUBDIRS :=
include $(BASEDIR)/header.mk include $(BASEDIR)/header.mk
OBJS_$(d) := $(d)/mmu.o OBJS_$(d) := $(d)/atags.o \
$(d)/mmu.o
KOBJS += $(OBJS_$(d)) KOBJS += $(OBJS_$(d))

View File

@ -18,7 +18,6 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <atags.h>
#include <console.h> #include <console.h>
#include <framebuffer.h> #include <framebuffer.h>
#include <kmalloc.h> #include <kmalloc.h>
@ -94,11 +93,9 @@ void serial_console_init() {
//once, and only here //once, and only here
void serial_init(); void serial_init();
void kmalloc_init(); void kmalloc_init();
int detect_memory();
int main(void) { int main(void) {
char *lower, *upper;
struct atag *atags;
//setup MMU //setup MMU
mmu_reinit(); mmu_reinit();
@ -114,19 +111,11 @@ int main(void) {
//setup memory subsystems //setup memory subsystems
mm_init(); mm_init();
kmalloc_init(); kmalloc_init();
if (detect_memory()) {
if (atags_first_mem_region(&atags)) { print("Error: Failed to detect memory.\n");
print("Error: atags must contain at least one memory region\n");
return -1; return -1;
} }
do {
lower = (char *)atags->data.mem.start;
upper = lower + atags->data.mem.size - 1;
print("atags: physical memory at %x-%x\n", lower, upper);
declare_memory_region(lower, upper);
} while (!atags_next_mem_region(&atags));
init_initcalls(); init_initcalls();
video_console_init(); video_console_init();

View File

@ -3,8 +3,7 @@ SUBDIRS :=
include $(BASEDIR)/header.mk include $(BASEDIR)/header.mk
OBJS_$(d) := $(d)/atags.o \ OBJS_$(d) := $(d)/console.o \
$(d)/console.o \
$(d)/font.o \ $(d)/font.o \
$(d)/framebuffer.o \ $(d)/framebuffer.o \
$(d)/init.o \ $(d)/init.o \