Browse Source

Make the getmemsize() prototype available in memsizes.h, for code that

doesn't want to go to the hassle of processing a full memory map.
tags/v0.9.3
Michael Brown 17 years ago
parent
commit
b9f99858ab

+ 5
- 14
src/arch/i386/firmware/pcbios/memmap.c View File

20
 #include <errno.h>
20
 #include <errno.h>
21
 #include <realmode.h>
21
 #include <realmode.h>
22
 #include <bios.h>
22
 #include <bios.h>
23
+#include <memsizes.h>
23
 #include <gpxe/memmap.h>
24
 #include <gpxe/memmap.h>
24
 
25
 
25
 /**
26
 /**
51
 static struct e820_entry __data16 ( e820buf );
52
 static struct e820_entry __data16 ( e820buf );
52
 #define e820buf __use_data16 ( e820buf )
53
 #define e820buf __use_data16 ( e820buf )
53
 
54
 
54
-/**
55
- * Get size of base memory from BIOS free base memory counter
56
- *
57
- * @ret basemem		Base memory size, in kB
58
- */
59
-static unsigned int basememsize ( void ) {
60
-	uint16_t basemem;
61
-
62
-	get_real ( basemem, BDA_SEG, 0x0013 );
63
-	DBG ( "Base memory size %dkB\n", basemem );
64
-	return basemem;
65
-}
66
-
67
 /**
55
 /**
68
  * Get size of extended memory via INT 15,e801
56
  * Get size of extended memory via INT 15,e801
69
  *
57
  *
120
  * Get size of extended memory
108
  * Get size of extended memory
121
  *
109
  *
122
  * @ret extmem		Extended memory size, in kB
110
  * @ret extmem		Extended memory size, in kB
111
+ *
112
+ * Note that this is only an approximation; for an accurate picture,
113
+ * use the E820 memory map obtained via get_memmap();
123
  */
114
  */
124
-static unsigned int extmemsize ( void ) {
115
+unsigned int extmemsize ( void ) {
125
 	unsigned int extmem;
116
 	unsigned int extmem;
126
 
117
 
127
 	/* Try INT 15,e801 first, then fall back to INT 15,88 */
118
 	/* Try INT 15,e801 first, then fall back to INT 15,88 */

+ 1
- 0
src/arch/i386/image/nbi.c View File

2
 #include <assert.h>
2
 #include <assert.h>
3
 #include <realmode.h>
3
 #include <realmode.h>
4
 #include <gateA20.h>
4
 #include <gateA20.h>
5
+#include <memsizes.h>
5
 #include <gpxe/uaccess.h>
6
 #include <gpxe/uaccess.h>
6
 #include <gpxe/segment.h>
7
 #include <gpxe/segment.h>
7
 #include <gpxe/image.h>
8
 #include <gpxe/image.h>

+ 11
- 30
src/arch/i386/include/memsizes.h View File

1
-#ifndef MEMSIZES_H
2
-#define MEMSIZES_H
1
+#ifndef _MEMSIZES_H
2
+#define _MEMSIZES_H
3
 
3
 
4
-#warning "This header is no longer functional; use memmap.h instead"
4
+#include <basemem.h>
5
 
5
 
6
-/*
7
- * These structures seem to be very i386 (and, in fact, PCBIOS)
8
- * specific, so I've moved them out of etherboot.h.
6
+/**
7
+ * Get size of base memory from BIOS free base memory counter
9
  *
8
  *
9
+ * @ret basemem		Base memory size, in kB
10
  */
10
  */
11
+static inline unsigned int basememsize ( void ) {
12
+	return get_fbms();
13
+}
11
 
14
 
12
-struct e820entry {
13
-	uint64_t addr;
14
-	uint64_t size;
15
-	uint32_t type;
16
-#define E820_RAM	1
17
-#define E820_RESERVED	2
18
-#define E820_ACPI	3 /* usable as RAM once ACPI tables have been read */
19
-#define E820_NVS	4
20
-} __attribute__ (( packed ));
21
-#define E820ENTRY_SIZE 20
22
-#define E820MAX 32
15
+extern unsigned int extmemsize ( void );
23
 
16
 
24
-struct meminfo {
25
-	uint16_t basememsize;
26
-	uint16_t pad;
27
-	uint32_t memsize;
28
-	uint32_t map_count;
29
-	struct e820entry map[E820MAX];
30
-} __attribute__ (( packed ));
31
-
32
-extern struct meminfo meminfo;
33
-
34
-extern void get_memsizes ( void );
35
-
36
-#endif /* MEMSIZES_H */
17
+#endif /* _MEMSIZES_H */

Loading…
Cancel
Save