• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ----------------------------------------------------------------------- *
2  *
3  *   Copyright 2009 Pierre-Alexandre Meyer
4  *
5  *   Some parts borrowed from meminfo.c32:
6  *
7  *   Copyright 2003-2009 H. Peter Anvin - All Rights Reserved
8  *   Copyright 2009 Intel Corporation; author: H. Peter Anvin
9  *
10  *   Some parts borrowed from Linux:
11  *
12  *   Copyright (C) 1991, 1992 Linus Torvalds
13  *   Copyright 2007 rPath, Inc. - All Rights Reserved
14  *   Copyright 2009 Intel Corporation; author H. Peter Anvin
15  *
16  *   This file is part of Syslinux, and is made available under
17  *   the terms of the GNU General Public License version 2.
18  *
19  * ----------------------------------------------------------------------- */
20 
21 #ifndef _MEMORY_H_
22 #define _MEMORY_H_
23 #include <stdint.h>
24 
25 #define E820MAX 128
26 #define E820_RAM        1
27 #define E820_RESERVED   2
28 #define E820_ACPI       3	/* usable as RAM once ACPI tables have been read */
29 #define E820_NVS        4
30 
31 #define RES_START       0xa0000
32 #define RES_END         0x100000
33 
34 struct e820entry {
35     uint64_t addr;		/* start of memory segment */
36     uint64_t size;		/* size of memory segment */
37     uint64_t type;		/* type of memory segment */
38 } __attribute__ ((packed));
39 
40 const char *const e820_types[5];
41 
42 void get_type(int, char *, int);
43 void detect_memory_e820(struct e820entry *desc, int size_map, int *size_found);
44 int detect_memory_e801(int *, int *);
45 int detect_memory_88(int *);
46 
47 /* The following stuff could be merge once the addr_t will be set to 64bits.
48  * syslinux_scan_memory can be used for that purpose */
49 unsigned long memsize_e820(struct e820entry *e820, int e820_nr);
50 int sanitize_e820_map(struct e820entry *orig_map, struct e820entry *new_bios,
51 		      short old_nr);
52 unsigned long detect_memsize(void);
53 #endif
54