]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] generalise mptable access
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Thu, 17 Apr 2003 09:28:39 +0000 (02:28 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Thu, 17 Apr 2003 09:28:39 +0000 (02:28 -0700)
arch/i386/kernel/mpparse.c

index 20b3d27cc634df48958ea09ea2bae5e5f1c6d20a..b4f05799e55d23ffb43352b642b1ee0b50af64b0 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <mach_apic.h>
 #include <mach_mpparse.h>
+#include <bios_ebda.h>
 
 /* Have we found an MP table */
 int smp_found_config;
@@ -708,8 +709,23 @@ static int __init smp_scan_config (unsigned long base, unsigned long length)
                        printk(KERN_INFO "found SMP MP-table at %08lx\n",
                                                virt_to_phys(mpf));
                        reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE);
-                       if (mpf->mpf_physptr)
-                               reserve_bootmem(mpf->mpf_physptr, PAGE_SIZE);
+                       if (mpf->mpf_physptr) {
+                               /*
+                                * We cannot access to MPC table to compute
+                                * table size yet, as only few megabytes from
+                                * the bottom is mapped now.
+                                * PC-9800's MPC table places on the very last
+                                * of physical memory; so that simply reserving
+                                * PAGE_SIZE from mpg->mpf_physptr yields BUG()
+                                * in reserve_bootmem.
+                                */
+                               unsigned long size = PAGE_SIZE;
+                               unsigned long end = max_low_pfn * PAGE_SIZE;
+                               if (mpf->mpf_physptr + size > end)
+                                       size = end - mpf->mpf_physptr;
+                               reserve_bootmem(mpf->mpf_physptr, size);
+                       }
+
                        mpf_found = mpf;
                        return 1;
                }
@@ -752,9 +768,9 @@ void __init find_smp_config (void)
         * MP1.4 SPEC states to only scan first 1K of 4K EBDA.
         */
 
-       address = *(unsigned short *)phys_to_virt(0x40E);
-       address <<= 4;
-       smp_scan_config(address, 0x400);
+       address = get_bios_ebda();
+       if (address)
+               smp_scan_config(address, 0x400);
 }