]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[ioapi] Move get_memmap() to the I/O API group
authorPiotr Jaroszyński <p.jaroszynski@gmail.com>
Tue, 27 Jul 2010 18:37:55 +0000 (20:37 +0200)
committerMichael Brown <mcb30@ipxe.org>
Mon, 16 Aug 2010 15:54:03 +0000 (16:54 +0100)
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>
13 files changed:
src/arch/i386/core/relocate.c
src/arch/i386/firmware/pcbios/hidemem.c
src/arch/i386/firmware/pcbios/memmap.c
src/arch/i386/image/com32.c
src/arch/i386/image/multiboot.c
src/arch/i386/interface/pcbios/int13.c
src/arch/i386/interface/pcbios/memtop_umalloc.c
src/drivers/net/b44.c
src/image/segment.c
src/include/ipxe/io.h
src/include/ipxe/memmap.h [deleted file]
src/interface/efi/efi_io.c
src/tests/umalloc_test.c

index e966bbeaa91742f7077601a00c303f42f661c8e8..47450e757725088c1629846884871e497c376eda 100644 (file)
@@ -1,6 +1,5 @@
 #include <ipxe/io.h>
 #include <registers.h>
-#include <ipxe/memmap.h>
 
 /*
  * Originally by Eric Biederman
index 322be9e41bf6cb0b64f96f621e359f950c9fc3b7..cc5fc28f7350129f598c9b3c5ae6a557b5d4fe63 100644 (file)
@@ -23,7 +23,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <basemem.h>
 #include <fakee820.h>
 #include <ipxe/init.h>
-#include <ipxe/memmap.h>
+#include <ipxe/io.h>
 #include <ipxe/hidemem.h>
 
 /** Set to true if you want to test a fake E820 map */
index 8fa1f4c3d82f77287ad2b7ec0052e5d22eb62d9a..01080c7b8e74b87c2ae516cc7cabcae96fb07c37 100644 (file)
@@ -23,7 +23,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <realmode.h>
 #include <bios.h>
 #include <memsizes.h>
-#include <ipxe/memmap.h>
+#include <ipxe/io.h>
 
 /**
  * @file
@@ -282,7 +282,7 @@ static int meme820 ( struct memory_map *memmap ) {
  *
  * @v memmap           Memory map to fill in
  */
-void get_memmap ( struct memory_map *memmap ) {
+void x86_get_memmap ( struct memory_map *memmap ) {
        unsigned int basemem, extmem;
        int rc;
 
@@ -310,3 +310,5 @@ void get_memmap ( struct memory_map *memmap ) {
        memmap->regions[1].end = 0x100000 + ( extmem * 1024 );
        memmap->count = 2;
 }
+
+PROVIDE_IOAPI ( x86, get_memmap, x86_get_memmap );
index 381987ab93acef8cc1e75f5609887743c9516f1a..72e679f16c69da2d3b8a38d8b17989d6b6ec5b7f 100644 (file)
@@ -38,7 +38,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <ipxe/image.h>
 #include <ipxe/segment.h>
 #include <ipxe/init.h>
-#include <ipxe/memmap.h>
+#include <ipxe/io.h>
 
 struct image_type com32_image_type __image_type ( PROBE_NORMAL );
 
index b3c6b8f749d45011a62f52955348d85381f4074f..e2075defe4766d3aa61524be52149d74ed4539c7 100644 (file)
@@ -33,7 +33,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <ipxe/uaccess.h>
 #include <ipxe/image.h>
 #include <ipxe/segment.h>
-#include <ipxe/memmap.h>
+#include <ipxe/io.h>
 #include <ipxe/elf.h>
 #include <ipxe/init.h>
 #include <ipxe/features.h>
index a2cf5e6b933fc40af7153ae2b9afe8ebad5251bc..f72dc5fa9ca60675c5c6e4c0e77fb3ec90ed280b 100644 (file)
@@ -25,7 +25,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <assert.h>
 #include <ipxe/list.h>
 #include <ipxe/blockdev.h>
-#include <ipxe/memmap.h>
+#include <ipxe/io.h>
 #include <realmode.h>
 #include <bios.h>
 #include <biosint.h>
index 51240f2ab69c2de002f25f5b25ff39b9c9834915..16736e194b4d91cf5ba2cd4a886c95419b583f20 100644 (file)
@@ -29,7 +29,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <errno.h>
 #include <ipxe/uaccess.h>
 #include <ipxe/hidemem.h>
-#include <ipxe/memmap.h>
+#include <ipxe/io.h>
 #include <ipxe/umalloc.h>
 
 /** Alignment of external allocated memory */
index 29aa5fa6bfa9a17eb97727e833735e5a2e8835b8..a104652cb37529aa8c726c024413d19c626ce3fd 100644 (file)
@@ -43,7 +43,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #include <ipxe/netdevice.h>
 #include <ipxe/ethernet.h>
 #include <ipxe/if_ether.h>
-#include <ipxe/memmap.h>
 #include "b44.h"
 
 
@@ -89,6 +88,8 @@ int phys_ram_within_limit(u64 limit)
        struct memory_region *highest = NULL;
        get_memmap(&memmap);
 
+       if (memmap.count == 0)
+               return 0;
        highest = &memmap.regions[memmap.count - 1];
 
        return (highest->end < limit);
index c3f0b8d5cc9644ea08a3c43fa45b4b6d85392dc6..97f6a9959454eccd81de7e795c81ee7a70740625 100644 (file)
@@ -27,7 +27,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
 
 #include <errno.h>
 #include <ipxe/uaccess.h>
-#include <ipxe/memmap.h>
+#include <ipxe/io.h>
 #include <ipxe/errortab.h>
 #include <ipxe/segment.h>
 
index 5bfd89987a3c66b541f15e02f3fec372b00d59b8..b4d88fe8948bfefb162602a73fd177727d0302e0 100644 (file)
@@ -503,4 +503,30 @@ void mb ( void );
 #define rmb()  mb()
 #define wmb()  mb()
 
+/** A usable memory region */
+struct memory_region {
+       /** Physical start address */
+       uint64_t start;
+       /** Physical end address */
+       uint64_t end;
+};
+
+/** Maximum number of memory regions we expect to encounter */
+#define MAX_MEMORY_REGIONS 8
+
+/** A memory map */
+struct memory_map {
+       /** Memory regions */
+       struct memory_region regions[MAX_MEMORY_REGIONS];
+       /** Number of used regions */
+       unsigned int count;
+};
+
+/**
+ * Get memory map
+ *
+ * @v memmap           Memory map to fill in
+ */
+void get_memmap ( struct memory_map *memmap );
+
 #endif /* _IPXE_IO_H */
diff --git a/src/include/ipxe/memmap.h b/src/include/ipxe/memmap.h
deleted file mode 100644 (file)
index cfd3fe9..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _IPXE_MEMMAP_H
-#define _IPXE_MEMMAP_H
-
-#include <stdint.h>
-
-/**
- * @file
- *
- * Memory mapping
- *
- */
-
-FILE_LICENCE ( GPL2_OR_LATER );
-
-/** A usable memory region */
-struct memory_region {
-       /** Physical start address */
-       uint64_t start;
-       /** Physical end address */
-       uint64_t end;
-};
-
-/** Maximum number of memory regions we expect to encounter */
-#define MAX_MEMORY_REGIONS 8
-
-/** A memory map */
-struct memory_map {
-       /** Memory regions */
-       struct memory_region regions[MAX_MEMORY_REGIONS];
-       /** Number of used regions */
-       unsigned int count;
-};
-
-extern void get_memmap ( struct memory_map *memmap );
-
-#endif /* _IPXE_MEMMAP_H */
index 13a3e23224420bce10b153874f81b3b065129995..9a9aad31c5acae7f2f2a8a6e329daf1be6bd7bf0 100644 (file)
@@ -176,6 +176,17 @@ static void efi_iodelay ( void ) {
        outb ( 0, 0x80 );
 }
 
+/**
+ * Get memory map
+ *
+ * Can't be done on EFI so return an empty map
+ *
+ * @v memmap           Memory map to fill in
+ */
+static void efi_get_memmap ( struct memory_map *memmap ) {
+       memmap->count = 0;
+}
+
 PROVIDE_IOAPI_INLINE ( efi, phys_to_bus );
 PROVIDE_IOAPI_INLINE ( efi, bus_to_phys );
 PROVIDE_IOAPI_INLINE ( efi, ioremap );
@@ -203,3 +214,4 @@ PROVIDE_IOAPI_INLINE ( efi, outsw );
 PROVIDE_IOAPI_INLINE ( efi, outsl );
 PROVIDE_IOAPI ( efi, iodelay, efi_iodelay );
 PROVIDE_IOAPI_INLINE ( efi, mb );
+PROVIDE_IOAPI ( efi, get_memmap, efi_get_memmap );
index 157835d8d89982647453d68d077b8c44ba174e89..53810833c49c43a460e05bbadef7d7b713a5cead 100644 (file)
@@ -1,7 +1,7 @@
 #include <stdio.h>
 #include <ipxe/uaccess.h>
 #include <ipxe/umalloc.h>
-#include <ipxe/memmap.h>
+#include <ipxe/io.h>
 
 void umalloc_test ( void ) {
        struct memory_map memmap;