Browse Source

[ioapi] Move get_memmap() to the I/O API group

pcbios specific get_memmap() is used by the b44 driver making
all-drivers builds fail on other platforms.  Move it to the I/O API
group and provide a dummy implementation on EFI.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Piotr Jaroszyński 14 years ago
parent
commit
5bbad9c8f0

+ 0
- 1
src/arch/i386/core/relocate.c View File

1
 #include <ipxe/io.h>
1
 #include <ipxe/io.h>
2
 #include <registers.h>
2
 #include <registers.h>
3
-#include <ipxe/memmap.h>
4
 
3
 
5
 /*
4
 /*
6
  * Originally by Eric Biederman
5
  * Originally by Eric Biederman

+ 1
- 1
src/arch/i386/firmware/pcbios/hidemem.c View File

23
 #include <basemem.h>
23
 #include <basemem.h>
24
 #include <fakee820.h>
24
 #include <fakee820.h>
25
 #include <ipxe/init.h>
25
 #include <ipxe/init.h>
26
-#include <ipxe/memmap.h>
26
+#include <ipxe/io.h>
27
 #include <ipxe/hidemem.h>
27
 #include <ipxe/hidemem.h>
28
 
28
 
29
 /** Set to true if you want to test a fake E820 map */
29
 /** Set to true if you want to test a fake E820 map */

+ 4
- 2
src/arch/i386/firmware/pcbios/memmap.c View File

23
 #include <realmode.h>
23
 #include <realmode.h>
24
 #include <bios.h>
24
 #include <bios.h>
25
 #include <memsizes.h>
25
 #include <memsizes.h>
26
-#include <ipxe/memmap.h>
26
+#include <ipxe/io.h>
27
 
27
 
28
 /**
28
 /**
29
  * @file
29
  * @file
282
  *
282
  *
283
  * @v memmap		Memory map to fill in
283
  * @v memmap		Memory map to fill in
284
  */
284
  */
285
-void get_memmap ( struct memory_map *memmap ) {
285
+void x86_get_memmap ( struct memory_map *memmap ) {
286
 	unsigned int basemem, extmem;
286
 	unsigned int basemem, extmem;
287
 	int rc;
287
 	int rc;
288
 
288
 
310
 	memmap->regions[1].end = 0x100000 + ( extmem * 1024 );
310
 	memmap->regions[1].end = 0x100000 + ( extmem * 1024 );
311
 	memmap->count = 2;
311
 	memmap->count = 2;
312
 }
312
 }
313
+
314
+PROVIDE_IOAPI ( x86, get_memmap, x86_get_memmap );

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

38
 #include <ipxe/image.h>
38
 #include <ipxe/image.h>
39
 #include <ipxe/segment.h>
39
 #include <ipxe/segment.h>
40
 #include <ipxe/init.h>
40
 #include <ipxe/init.h>
41
-#include <ipxe/memmap.h>
41
+#include <ipxe/io.h>
42
 
42
 
43
 struct image_type com32_image_type __image_type ( PROBE_NORMAL );
43
 struct image_type com32_image_type __image_type ( PROBE_NORMAL );
44
 
44
 

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

33
 #include <ipxe/uaccess.h>
33
 #include <ipxe/uaccess.h>
34
 #include <ipxe/image.h>
34
 #include <ipxe/image.h>
35
 #include <ipxe/segment.h>
35
 #include <ipxe/segment.h>
36
-#include <ipxe/memmap.h>
36
+#include <ipxe/io.h>
37
 #include <ipxe/elf.h>
37
 #include <ipxe/elf.h>
38
 #include <ipxe/init.h>
38
 #include <ipxe/init.h>
39
 #include <ipxe/features.h>
39
 #include <ipxe/features.h>

+ 1
- 1
src/arch/i386/interface/pcbios/int13.c View File

25
 #include <assert.h>
25
 #include <assert.h>
26
 #include <ipxe/list.h>
26
 #include <ipxe/list.h>
27
 #include <ipxe/blockdev.h>
27
 #include <ipxe/blockdev.h>
28
-#include <ipxe/memmap.h>
28
+#include <ipxe/io.h>
29
 #include <realmode.h>
29
 #include <realmode.h>
30
 #include <bios.h>
30
 #include <bios.h>
31
 #include <biosint.h>
31
 #include <biosint.h>

+ 1
- 1
src/arch/i386/interface/pcbios/memtop_umalloc.c View File

29
 #include <errno.h>
29
 #include <errno.h>
30
 #include <ipxe/uaccess.h>
30
 #include <ipxe/uaccess.h>
31
 #include <ipxe/hidemem.h>
31
 #include <ipxe/hidemem.h>
32
-#include <ipxe/memmap.h>
32
+#include <ipxe/io.h>
33
 #include <ipxe/umalloc.h>
33
 #include <ipxe/umalloc.h>
34
 
34
 
35
 /** Alignment of external allocated memory */
35
 /** Alignment of external allocated memory */

+ 2
- 1
src/drivers/net/b44.c View File

43
 #include <ipxe/netdevice.h>
43
 #include <ipxe/netdevice.h>
44
 #include <ipxe/ethernet.h>
44
 #include <ipxe/ethernet.h>
45
 #include <ipxe/if_ether.h>
45
 #include <ipxe/if_ether.h>
46
-#include <ipxe/memmap.h>
47
 #include "b44.h"
46
 #include "b44.h"
48
 
47
 
49
 
48
 
89
 	struct memory_region *highest = NULL;
88
 	struct memory_region *highest = NULL;
90
 	get_memmap(&memmap);
89
 	get_memmap(&memmap);
91
 
90
 
91
+	if (memmap.count == 0)
92
+		return 0;
92
 	highest = &memmap.regions[memmap.count - 1];
93
 	highest = &memmap.regions[memmap.count - 1];
93
 
94
 
94
 	return (highest->end < limit);
95
 	return (highest->end < limit);

+ 1
- 1
src/image/segment.c View File

27
 
27
 
28
 #include <errno.h>
28
 #include <errno.h>
29
 #include <ipxe/uaccess.h>
29
 #include <ipxe/uaccess.h>
30
-#include <ipxe/memmap.h>
30
+#include <ipxe/io.h>
31
 #include <ipxe/errortab.h>
31
 #include <ipxe/errortab.h>
32
 #include <ipxe/segment.h>
32
 #include <ipxe/segment.h>
33
 
33
 

+ 26
- 0
src/include/ipxe/io.h View File

503
 #define rmb()	mb()
503
 #define rmb()	mb()
504
 #define wmb()	mb()
504
 #define wmb()	mb()
505
 
505
 
506
+/** A usable memory region */
507
+struct memory_region {
508
+	/** Physical start address */
509
+	uint64_t start;
510
+	/** Physical end address */
511
+	uint64_t end;
512
+};
513
+
514
+/** Maximum number of memory regions we expect to encounter */
515
+#define MAX_MEMORY_REGIONS 8
516
+
517
+/** A memory map */
518
+struct memory_map {
519
+	/** Memory regions */
520
+	struct memory_region regions[MAX_MEMORY_REGIONS];
521
+	/** Number of used regions */
522
+	unsigned int count;
523
+};
524
+
525
+/**
526
+ * Get memory map
527
+ *
528
+ * @v memmap		Memory map to fill in
529
+ */
530
+void get_memmap ( struct memory_map *memmap );
531
+
506
 #endif /* _IPXE_IO_H */
532
 #endif /* _IPXE_IO_H */

+ 0
- 36
src/include/ipxe/memmap.h View File

1
-#ifndef _IPXE_MEMMAP_H
2
-#define _IPXE_MEMMAP_H
3
-
4
-#include <stdint.h>
5
-
6
-/**
7
- * @file
8
- *
9
- * Memory mapping
10
- *
11
- */
12
-
13
-FILE_LICENCE ( GPL2_OR_LATER );
14
-
15
-/** A usable memory region */
16
-struct memory_region {
17
-	/** Physical start address */
18
-	uint64_t start;
19
-	/** Physical end address */
20
-	uint64_t end;
21
-};
22
-
23
-/** Maximum number of memory regions we expect to encounter */
24
-#define MAX_MEMORY_REGIONS 8
25
-
26
-/** A memory map */
27
-struct memory_map {
28
-	/** Memory regions */
29
-	struct memory_region regions[MAX_MEMORY_REGIONS];
30
-	/** Number of used regions */
31
-	unsigned int count;
32
-};
33
-
34
-extern void get_memmap ( struct memory_map *memmap );
35
-
36
-#endif /* _IPXE_MEMMAP_H */

+ 12
- 0
src/interface/efi/efi_io.c View File

176
 	outb ( 0, 0x80 );
176
 	outb ( 0, 0x80 );
177
 }
177
 }
178
 
178
 
179
+/**
180
+ * Get memory map
181
+ *
182
+ * Can't be done on EFI so return an empty map
183
+ *
184
+ * @v memmap		Memory map to fill in
185
+ */
186
+static void efi_get_memmap ( struct memory_map *memmap ) {
187
+	memmap->count = 0;
188
+}
189
+
179
 PROVIDE_IOAPI_INLINE ( efi, phys_to_bus );
190
 PROVIDE_IOAPI_INLINE ( efi, phys_to_bus );
180
 PROVIDE_IOAPI_INLINE ( efi, bus_to_phys );
191
 PROVIDE_IOAPI_INLINE ( efi, bus_to_phys );
181
 PROVIDE_IOAPI_INLINE ( efi, ioremap );
192
 PROVIDE_IOAPI_INLINE ( efi, ioremap );
203
 PROVIDE_IOAPI_INLINE ( efi, outsl );
214
 PROVIDE_IOAPI_INLINE ( efi, outsl );
204
 PROVIDE_IOAPI ( efi, iodelay, efi_iodelay );
215
 PROVIDE_IOAPI ( efi, iodelay, efi_iodelay );
205
 PROVIDE_IOAPI_INLINE ( efi, mb );
216
 PROVIDE_IOAPI_INLINE ( efi, mb );
217
+PROVIDE_IOAPI ( efi, get_memmap, efi_get_memmap );

+ 1
- 1
src/tests/umalloc_test.c View File

1
 #include <stdio.h>
1
 #include <stdio.h>
2
 #include <ipxe/uaccess.h>
2
 #include <ipxe/uaccess.h>
3
 #include <ipxe/umalloc.h>
3
 #include <ipxe/umalloc.h>
4
-#include <ipxe/memmap.h>
4
+#include <ipxe/io.h>
5
 
5
 
6
 void umalloc_test ( void ) {
6
 void umalloc_test ( void ) {
7
 	struct memory_map memmap;
7
 	struct memory_map memmap;

Loading…
Cancel
Save