Move atags support to be ARM arch-specific
This commit is contained in:
parent
ed52a8af5c
commit
62755b8f38
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <atags.h>
|
||||
#include <mmu.h>
|
||||
|
||||
extern arch_uint_ptr atags_ptr;
|
||||
|
||||
@ -60,3 +61,20 @@ int _atags_mem_region(struct atag **mem_header, int initialize) {
|
||||
return -1;
|
||||
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;
|
||||
}
|
@ -3,7 +3,8 @@ SUBDIRS :=
|
||||
|
||||
include $(BASEDIR)/header.mk
|
||||
|
||||
OBJS_$(d) := $(d)/mmu.o
|
||||
OBJS_$(d) := $(d)/atags.o \
|
||||
$(d)/mmu.o
|
||||
|
||||
KOBJS += $(OBJS_$(d))
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <atags.h>
|
||||
#include <console.h>
|
||||
#include <framebuffer.h>
|
||||
#include <kmalloc.h>
|
||||
@ -94,11 +93,9 @@ void serial_console_init() {
|
||||
//once, and only here
|
||||
void serial_init();
|
||||
void kmalloc_init();
|
||||
int detect_memory();
|
||||
|
||||
int main(void) {
|
||||
char *lower, *upper;
|
||||
struct atag *atags;
|
||||
|
||||
//setup MMU
|
||||
mmu_reinit();
|
||||
|
||||
@ -114,19 +111,11 @@ int main(void) {
|
||||
//setup memory subsystems
|
||||
mm_init();
|
||||
kmalloc_init();
|
||||
|
||||
if (atags_first_mem_region(&atags)) {
|
||||
print("Error: atags must contain at least one memory region\n");
|
||||
if (detect_memory()) {
|
||||
print("Error: Failed to detect memory.\n");
|
||||
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();
|
||||
|
||||
video_console_init();
|
||||
|
@ -3,8 +3,7 @@ SUBDIRS :=
|
||||
|
||||
include $(BASEDIR)/header.mk
|
||||
|
||||
OBJS_$(d) := $(d)/atags.o \
|
||||
$(d)/console.o \
|
||||
OBJS_$(d) := $(d)/console.o \
|
||||
$(d)/font.o \
|
||||
$(d)/framebuffer.o \
|
||||
$(d)/init.o \
|
||||
|
Loading…
Reference in New Issue
Block a user