path: root/com32/gplinclude
diff options
authorErwan Velu <erwan.velu@free.fr>2009-11-23 13:39:55 +0100
committerErwan Velu <erwan.velu@free.fr>2009-11-23 13:39:55 +0100
commitd7ddef0afcc7224a002a4e9cb3e54a3c216d0f6f (patch)
treec474d25fe1d15d909a218795c5b379d532267f06 /com32/gplinclude
parentae69dd05fc133f67664816db4564a5202d6b2301 (diff)
memory: Adding memory size detection
Impact: allow com32 module to detect the amount of memory installed This commit adds several function: sanitize_e820_map() to generate a new e820 map that doesn't have overlaping memsize_e820() to detect the available memory (in KB) detect_memsize() to detect the amount of memory by using e820/e801/e88. It first try to detect the memory via e820. If it fails, it uses e801 as fallback. If this e801 fails, e88 is used.
Diffstat (limited to 'com32/gplinclude')
1 files changed, 12 insertions, 0 deletions
diff --git a/com32/gplinclude/memory.h b/com32/gplinclude/memory.h
index c9f386d4..9157792f 100644
--- a/com32/gplinclude/memory.h
+++ b/com32/gplinclude/memory.h
@@ -22,6 +22,15 @@
#define _MEMORY_H_
#include <stdint.h>
+#define E820MAX 128
+#define E820_RAM 1
+#define E820_RESERVED 2
+#define E820_ACPI 3 /* usable as RAM once ACPI tables have been read */
+#define E820_NVS 4
+#define RES_START 0xa0000
+#define RES_END 0x100000
struct e820entry {
uint64_t addr; /* start of memory segment */
uint64_t size; /* size of memory segment */
@@ -34,4 +43,7 @@ void get_type(int, char*, int);
void detect_memory_e820(struct e820entry *desc, int size_map, int *size_found);
int detect_memory_e801(int*, int*);
int detect_memory_88(int*);
+unsigned long memsize_e820(struct e820entry *e820, int e820_nr);
+int sanitize_e820_map(struct e820entry *orig_map, struct e820entry *new_bios, short old_nr);
+unsigned long detect_memsize(void);