Properly detect memory using atags and add it to the memory-management subsystem
This commit is contained in:
48
include/atags.h
Normal file
48
include/atags.h
Normal file
@ -0,0 +1,48 @@
|
||||
#ifndef ATAGS_H
|
||||
#define ATAGS_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
#define ATAG_NONE 0x00000000
|
||||
#define ATAG_CORE 0x54410001
|
||||
#define ATAG_MEM 0x54410002
|
||||
#define ATAG_VIDEOTEXT 0x54410003
|
||||
#define ATAG_RAMDISK 0x54410004
|
||||
#define ATAG_INITRD2 0x54420005
|
||||
#define ATAG_SERIAL 0x54410006
|
||||
#define ATAG_REVISION 0x54410007
|
||||
#define ATAG_VIDEOLFB 0x54410008
|
||||
#define ATAG_CMDLINE 0x54410009
|
||||
|
||||
struct atag_core {
|
||||
uint32 flags; /* bit 0 = read-only */
|
||||
uint32 pagesize; /* systems page size (usually 4k) */
|
||||
uint32 rootdev; /* root device number */
|
||||
};
|
||||
|
||||
struct atag_mem {
|
||||
uint32 size; /* size of the area */
|
||||
uint32 start; /* physical start address */
|
||||
};
|
||||
|
||||
struct atag {
|
||||
uint32 size; /* Size of tag in words (includes entire struct) */
|
||||
uint32 tag;
|
||||
union {
|
||||
struct atag_core core;
|
||||
struct atag_mem mem;
|
||||
// struct atag_videotext videotext;
|
||||
// struct atag_ramdisk ramdisk;
|
||||
// struct atag_initrd2 initrd2;
|
||||
// struct atag_serialnr serialnr;
|
||||
// struct atag_revision revision;
|
||||
// struct atag_videolfb videolfb;
|
||||
// struct atag_cmdline cmdline;
|
||||
} data;
|
||||
};
|
||||
|
||||
#define atags_first_mem_region(atag) _atags_mem_region(atag, 1)
|
||||
#define atags_next_mem_region(atag) _atags_mem_region(atag, 0)
|
||||
int _atags_mem_region(struct atag **mem_header, int initialize);
|
||||
|
||||
#endif /* ATAGS_H */
|
@ -1,8 +1,9 @@
|
||||
#ifndef MMU_H
|
||||
#define MMU_H
|
||||
|
||||
extern unsigned int *kernel_start_phys, *kernel_start_virt, *kernel_end_phys, *kernel_end_virt;
|
||||
#include <types.h>
|
||||
|
||||
void mmu_reinit();
|
||||
void declare_memory_region(void *lower, void *upper);
|
||||
|
||||
#endif /* MMU_H */
|
||||
|
1
include/types.h
Normal file
1
include/types.h
Normal file
@ -0,0 +1 @@
|
||||
typedef unsigned int uint32;
|
Reference in New Issue
Block a user