]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ibft, x86: Change reserve_ibft_region() to find_ibft_region()
authorYinghai Lu <yinghai@kernel.org>
Thu, 1 Apr 2010 21:32:43 +0000 (14:32 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Thu, 1 Apr 2010 23:12:48 +0000 (16:12 -0700)
This allows arch code could decide the way to reserve the ibft.

And we should reserve ibft as early as possible, instead of BOOTMEM
stage, in case the table is in RAM range and is not reserved by BIOS
(this will often be the case.)

Move to just after find_smp_config().

Also when CONFIG_NO_BOOTMEM=y, We will not have reserve_bootmem() anymore.

-v2: fix typo about ibft pointed by Konrad Rzeszutek Wilk <konrad@darnok.org>

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <4BB510FB.80601@kernel.org>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Peter Jones <pjones@redhat.com>
Cc: Konrad Rzeszutek Wilk <konrad@kernel.org>
CC: Jan Beulich <jbeulich@novell.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/kernel/setup.c
drivers/firmware/iscsi_ibft_find.c
include/linux/iscsi_ibft.h

index d76e18570c60ec5b8c7e28685a3fe69751d6c575..580e6b3dbdb8318ab3e51811b58e5bf2e8d98ea1 100644 (file)
@@ -608,6 +608,16 @@ static int __init setup_elfcorehdr(char *arg)
 early_param("elfcorehdr", setup_elfcorehdr);
 #endif
 
+static __init void reserve_ibft_region(void)
+{
+       unsigned long addr, size = 0;
+
+       addr = find_ibft_region(&size);
+
+       if (size)
+               reserve_early_overlap_ok(addr, addr + size, "ibft");
+}
+
 #ifdef CONFIG_X86_RESERVE_LOW_64K
 static int __init dmi_low_memory_corruption(const struct dmi_system_id *d)
 {
@@ -910,6 +920,8 @@ void __init setup_arch(char **cmdline_p)
         */
        find_smp_config();
 
+       reserve_ibft_region();
+
        reserve_trampoline_memory();
 
 #ifdef CONFIG_ACPI_SLEEP
@@ -977,8 +989,6 @@ void __init setup_arch(char **cmdline_p)
 
        dma32_reserve_bootmem();
 
-       reserve_ibft_region();
-
 #ifdef CONFIG_KVM_CLOCK
        kvmclock_init();
 #endif
index dfb15c06c88ff8482de2b03164679633748848b7..8f5d9e258829ca069de386d2ffba7412482a278b 100644 (file)
@@ -52,7 +52,7 @@ EXPORT_SYMBOL_GPL(ibft_addr);
  * Routine used to find the iSCSI Boot Format Table. The logical
  * kernel address is set in the ibft_addr global variable.
  */
-void __init reserve_ibft_region(void)
+unsigned long __init find_ibft_region(unsigned long *sizep)
 {
        unsigned long pos;
        unsigned int len = 0;
@@ -78,6 +78,11 @@ void __init reserve_ibft_region(void)
                        }
                }
        }
-       if (ibft_addr)
-               reserve_bootmem(pos, PAGE_ALIGN(len), BOOTMEM_DEFAULT);
+       if (ibft_addr) {
+               *sizep = PAGE_ALIGN(len);
+               return pos;
+       }
+
+       *sizep = 0;
+       return 0;
 }
index 6092487e2950695b76614701e47a4cb51175a4fb..d2e4042f8f5ed1492d17eaf57729ed1acba510d2 100644 (file)
@@ -42,9 +42,13 @@ extern struct ibft_table_header *ibft_addr;
  * mapped address is set in the ibft_addr variable.
  */
 #ifdef CONFIG_ISCSI_IBFT_FIND
-extern void __init reserve_ibft_region(void);
+unsigned long find_ibft_region(unsigned long *sizep);
 #else
-static inline void reserve_ibft_region(void) { }
+static inline unsigned long find_ibft_region(unsigned long *sizep)
+{
+       *sizep = 0;
+       return 0;
+}
 #endif
 
 #endif /* ISCSI_IBFT_H */