2002-12-15 13:14:53

by Osamu Tomita

[permalink] [raw]
Subject: [PATCHSET] PC-9800 addtional for 2.5.50-ac1 (21/21)

diff -urN linux/arch/i386/kernel/mpparse.c linux98/arch/i386/kernel/mpparse.c
--- linux/arch/i386/kernel/mpparse.c 2002-12-10 09:17:48.000000000 +0900
+++ linux98/arch/i386/kernel/mpparse.c 2002-12-10 10:54:09.000000000 +0900
@@ -676,11 +676,14 @@
printk(KERN_DEBUG "Default MP configuration #%d\n", mpf->mpf_feature1);
construct_default_ISA_mptable(mpf->mpf_feature1);
} else if (mpf->mpf_physptr) {
+ extern int pc98;
+
/*
* Read the physical hardware table. Anything here will
* override the defaults.
*/
- if (!smp_read_mpc((void *)mpf->mpf_physptr)) {
+ if (!smp_read_mpc(pc98 ? phys_to_virt(mpf->mpf_physptr)
+ : (void *)mpf->mpf_physptr)) {
smp_found_config = 0;
printk(KERN_ERR "BIOS bug, MP table errors detected!...\n");
printk(KERN_ERR "... disabling SMP support. (tell your hw vendor)\n");
@@ -734,8 +737,30 @@
Dprintk("found SMP MP-table at %08lx\n",
virt_to_phys(mpf));
reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE);
+#ifndef CONFIG_PC9800
if (mpf->mpf_physptr)
reserve_bootmem(mpf->mpf_physptr, PAGE_SIZE);
+#else
+ /*
+ * 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.
+ */
+ 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.
+ */
+ 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);
+ }
+#endif
+
mpf_found = mpf;
return 1;
}
@@ -747,8 +772,6 @@

void __init find_smp_config (void)
{
- unsigned int address;
-
/*
* FIXME: Linux assumes you have 640K of base ram..
* this continues the error...
@@ -778,12 +801,16 @@
* 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);
- /* This has been safe for ages */
- if (smp_found_config)
- Dprintk(KERN_WARNING "WARNING: MP table in the EBDA can be UNSAFE, contact [email protected] if you experience SMP problems!\n");
+#ifndef CONFIG_PC9800 /* PC-9800 has no EBDA area? */
+ {
+ unsigned int address = *(unsigned short *)phys_to_virt(0x40E);
+ address <<= 4;
+ smp_scan_config(address, 0x400);
+ /* This has been safe for ages */
+ if (smp_found_config)
+ Dprintk(KERN_WARNING "WARNING: MP table in the EBDA can be UNSAFE, contact [email protected] if you experience SMP problems!\n");
+ }
+#endif
}


diff -urN linux/arch/i386/kernel/smpboot.c linux98/arch/i386/kernel/smpboot.c
--- linux/arch/i386/kernel/smpboot.c 2002-12-10 09:17:49.000000000 +0900
+++ linux98/arch/i386/kernel/smpboot.c 2002-12-10 10:43:32.000000000 +0900
@@ -856,13 +856,27 @@
nmi_low = *((volatile unsigned short *) TRAMPOLINE_LOW);
}

+#ifndef CONFIG_PC9800
CMOS_WRITE(0xa, 0xf);
+#else
+ /* reset code is stored in 8255 on PC-9800. */
+ outb(0x0e, 0x37); /* SHUT0 = 0 */
+#endif
local_flush_tlb();
Dprintk("1.\n");
*((volatile unsigned short *) TRAMPOLINE_HIGH) = start_eip >> 4;
Dprintk("2.\n");
*((volatile unsigned short *) TRAMPOLINE_LOW) = start_eip & 0xf;
Dprintk("3.\n");
+#ifdef CONFIG_PC9800
+ /*
+ * On PC-9800, continuation on warm reset is done by loading
+ * %ss:%sp from 0x0000:0404 and executing 'lret', so:
+ */
+ /* 0x3f0 is on unused interrupt vector and should be safe... */
+ *((volatile unsigned long *) phys_to_virt(0x404)) = 0x000003f0;
+ Dprintk("4.\n");
+#endif

/*
* Be paranoid about clearing APIC errors.
diff -urN linux/include/asm-i386/smpboot.h linux98/include/asm-i386/smpboot.h
--- linux/include/asm-i386/smpboot.h Sat Oct 12 13:22:19 2002
+++ linux98/include/asm-i386/smpboot.h Sat Oct 12 19:33:46 2002
@@ -13,8 +13,17 @@
#define TRAMPOLINE_LOW phys_to_virt(0x8)
#define TRAMPOLINE_HIGH phys_to_virt(0xa)
#else /* !CONFIG_CLUSTERED_APIC */
+ #ifndef CONFIG_PC9800
#define TRAMPOLINE_LOW phys_to_virt(0x467)
#define TRAMPOLINE_HIGH phys_to_virt(0x469)
+ #else /* CONFIG_PC9800 */
+ /*
+ * On PC-9800, continuation on warm reset is done by loading
+ * %ss:%sp from 0x0000:0404 and executing 'lret', so:
+ */
+ #define TRAMPOLINE_LOW phys_to_virt(0x4fa)
+ #define TRAMPOLINE_HIGH phys_to_virt(0x4fc)
+ #endif /* !CONFIG_PC9800 */
#endif /* CONFIG_CLUSTERED_APIC */

#ifdef CONFIG_CLUSTERED_APIC


Attachments:
smp.patch (4.46 kB)

2002-12-15 13:51:17

by YOSHIFUJI Hideaki

[permalink] [raw]
Subject: Re: [PATCHSET] PC-9800 addtional for 2.5.50-ac1 (21/21)

In article <[email protected]> (at Sun, 15 Dec 2002 22:20:15 +0900), Osamu Tomita <[email protected]> says:

> +#ifndef CONFIG_PC9800
> if (mpf->mpf_physptr)
> reserve_bootmem(mpf->mpf_physptr, PAGE_SIZE);
> +#else
> + /*
> + * 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.
> + */
> + 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.
> + */
> + 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);
> + }
> +#endif
> +

I'm not sure if we need this #ifdef;
it doesn't seem that this #ifdef CONFIG_PC9800 part is harmful
for others at all.

Well, if it is required, I prefer putting #ifdef..#endif inside the
if-clause like this:

if (mpf->mpf_physptr) {
unsigned long size = PAGE_SIZE;
#ifdef CONFIG_PC9800
/*
* 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.
*
* We cannot access to MPC table to compute
* table size yet, as only few megabytes from
* the bottom is mapped now.
*/
unsigned long end = max_low_pfn * PAGE_SIZE;

if (mpf->mpf_physptr + size > end)
size = end - mpf->mpf_physptr;
#endif
reserve_bootmem(mpf->mpf_physptr, size);
}

--
Hideaki YOSHIFUJI @ USAGI Project <[email protected]>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA

2002-12-17 11:31:04

by Osamu Tomita

[permalink] [raw]
Subject: Re: [PATCHSET] PC-9800 addtional for 2.5.50-ac1 (21/21)

diff -Nru linux/arch/i386/kernel/mpparse.c linux98/arch/i386/kernel/mpparse.c
--- linux/arch/i386/kernel/mpparse.c 2002-12-16 09:15:54.000000000 +0900
+++ linux98/arch/i386/kernel/mpparse.c 2002-12-16 17:15:15.000000000 +0900
@@ -73,6 +73,8 @@
int summit_x86 = 0;
u8 raw_phys_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };

+extern int pc98; /* NEC PC-9800 subarchitecture or not */
+
/*
* Intel MP BIOS table parsing routines:
*/
@@ -683,7 +685,8 @@
* Read the physical hardware table. Anything here will
* override the defaults.
*/
- if (!smp_read_mpc((void *)mpf->mpf_physptr)) {
+ if (!smp_read_mpc(pc98 ? phys_to_virt(mpf->mpf_physptr)
+ : (void *)mpf->mpf_physptr)) {
smp_found_config = 0;
printk(KERN_ERR "BIOS bug, MP table errors detected!...\n");
printk(KERN_ERR "... disabling SMP support. (tell your hw vendor)\n");
@@ -737,8 +740,25 @@
printk("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);
+ /*
+ * 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.
+ */
+ 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.
+ */
+ 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;
}
@@ -750,8 +770,6 @@

void __init find_smp_config (void)
{
- unsigned int address;
-
/*
* FIXME: Linux assumes you have 640K of base ram..
* this continues the error...
@@ -781,11 +799,13 @@
* 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);
- if (smp_found_config)
- printk(KERN_WARNING "WARNING: MP table in the EBDA can be UNSAFE, contact [email protected] if you experience SMP problems!\n");
+ if (!pc98) { /* PC-9800 has no EBDA area? */
+ unsigned int address = *(unsigned short *)phys_to_virt(0x40E);
+ address <<= 4;
+ smp_scan_config(address, 0x400);
+ if (smp_found_config)
+ printk(KERN_WARNING "WARNING: MP table in the EBDA can be UNSAFE, contact [email protected] if you experience SMP problems!\n");
+ }
}


diff -Nru linux/arch/i386/kernel/smpboot.c linux98/arch/i386/kernel/smpboot.c
--- linux/arch/i386/kernel/smpboot.c 2002-11-23 06:40:42.000000000 +0900
+++ linux98/arch/i386/kernel/smpboot.c 2002-11-25 11:14:21.000000000 +0900
@@ -823,13 +823,27 @@
nmi_low = *((volatile unsigned short *) TRAMPOLINE_LOW);
}

+#ifndef CONFIG_PC9800
CMOS_WRITE(0xa, 0xf);
+#else
+ /* reset code is stored in 8255 on PC-9800. */
+ outb(0x0e, 0x37); /* SHUT0 = 0 */
+#endif
local_flush_tlb();
Dprintk("1.\n");
*((volatile unsigned short *) TRAMPOLINE_HIGH) = start_eip >> 4;
Dprintk("2.\n");
*((volatile unsigned short *) TRAMPOLINE_LOW) = start_eip & 0xf;
Dprintk("3.\n");
+#ifdef CONFIG_PC9800
+ /*
+ * On PC-9800, continuation on warm reset is done by loading
+ * %ss:%sp from 0x0000:0404 and executing 'lret', so:
+ */
+ /* 0x3f0 is on unused interrupt vector and should be safe... */
+ *((volatile unsigned long *) phys_to_virt(0x404)) = 0x000003f0;
+ Dprintk("4.\n");
+#endif

/*
* Be paranoid about clearing APIC errors.
diff -Nru linux/include/asm-i386/smpboot.h linux98/include/asm-i386/smpboot.h
--- linux/include/asm-i386/smpboot.h 2002-10-12 13:22:19.000000000 +0900
+++ linux98/include/asm-i386/smpboot.h 2002-10-12 19:33:46.000000000 +0900
@@ -13,8 +13,17 @@
#define TRAMPOLINE_LOW phys_to_virt(0x8)
#define TRAMPOLINE_HIGH phys_to_virt(0xa)
#else /* !CONFIG_CLUSTERED_APIC */
+ #ifndef CONFIG_PC9800
#define TRAMPOLINE_LOW phys_to_virt(0x467)
#define TRAMPOLINE_HIGH phys_to_virt(0x469)
+ #else /* CONFIG_PC9800 */
+ /*
+ * On PC-9800, continuation on warm reset is done by loading
+ * %ss:%sp from 0x0000:0404 and executing 'lret', so:
+ */
+ #define TRAMPOLINE_LOW phys_to_virt(0x4fa)
+ #define TRAMPOLINE_HIGH phys_to_virt(0x4fc)
+ #endif /* !CONFIG_PC9800 */
#endif /* CONFIG_CLUSTERED_APIC */

#ifdef CONFIG_CLUSTERED_APIC


Attachments:
smp.patch (4.38 kB)

2002-12-17 14:49:06

by Alan

[permalink] [raw]
Subject: Re: [PATCHSET] PC-9800 addtional for 2.5.50-ac1 (21/21)

Any chance of moving the EBDA to query to be something like

unsigned long get_bios_ebda(void)

and hiding it in the per platform includes (returning 0 for non I guess)

2002-12-17 16:19:30

by Osamu Tomita

[permalink] [raw]
Subject: Re: [PATCHSET] PC-9800 addtional for 2.5.50-ac1 (21/21)

diff -Nru linux/arch/i386/kernel/mpparse.c linux98/arch/i386/kernel/mpparse.c
--- linux/arch/i386/kernel/mpparse.c 2002-12-15 15:16:42.000000000 +0900
+++ linux98/arch/i386/kernel/mpparse.c 2002-12-18 01:07:27.000000000 +0900
@@ -31,9 +31,7 @@
#include <asm/pgalloc.h>
#include <asm/io_apic.h>
#include "mach_apic.h"
-
-/* Have we found an MP table */
-int smp_found_config;
+#include "smp_bios.h"

/*
* Various Linux-internal data structures created from the
@@ -676,11 +674,14 @@
printk(KERN_DEBUG "Default MP configuration #%d\n", mpf->mpf_feature1);
construct_default_ISA_mptable(mpf->mpf_feature1);
} else if (mpf->mpf_physptr) {
+ extern int pc98;
+
/*
* Read the physical hardware table. Anything here will
* override the defaults.
*/
- if (!smp_read_mpc((void *)mpf->mpf_physptr)) {
+ if (!smp_read_mpc(pc98 ? phys_to_virt(mpf->mpf_physptr)
+ : (void *)mpf->mpf_physptr)) {
smp_found_config = 0;
printk(KERN_ERR "BIOS bug, MP table errors detected!...\n");
printk(KERN_ERR "... disabling SMP support. (tell your hw vendor)\n");
@@ -734,8 +735,25 @@
Dprintk("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);
+ /*
+ * 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.
+ */
+ 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.
+ */
+ 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;
}
@@ -747,8 +765,6 @@

void __init find_smp_config (void)
{
- unsigned int address;
-
/*
* FIXME: Linux assumes you have 640K of base ram..
* this continues the error...
@@ -778,12 +794,7 @@
* 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);
- /* This has been safe for ages */
- if (smp_found_config)
- Dprintk(KERN_WARNING "WARNING: MP table in the EBDA can be UNSAFE, contact [email protected] if you experience SMP problems!\n");
+ get_bios_ebda();
}


diff -Nru linux/arch/i386/mach-defaults/smp_bios.h linux98/arch/i386/mach-defaults/smp_bios.h
--- linux/arch/i386/mach-defaults/smp_bios.h 1970-01-01 09:00:00.000000000 +0900
+++ linux98/arch/i386/mach-defaults/smp_bios.h 2002-12-18 00:53:48.000000000 +0900
@@ -0,0 +1,14 @@
+static int __init smp_scan_config (unsigned long base, unsigned long length);
+
+/* Have we found an MP table */
+int smp_found_config;
+
+static inline void get_bios_ebda(void)
+{
+ unsigned int address = *(unsigned short *)phys_to_virt(0x40E);
+ address <<= 4;
+ smp_scan_config(address, 0x400);
+ /* This has been safe for ages */
+ if (smp_found_config)
+ Dprintk(KERN_WARNING "WARNING: MP table in the EBDA can be UNSAFE, contact [email protected] if you experience SMP problems!\n");
+}
diff -Nru linux/arch/i386/mach-pc9800/smp_bios.h linux98/arch/i386/mach-pc9800/smp_bios.h
--- linux/arch/i386/mach-pc9800/smp_bios.h 1970-01-01 09:00:00.000000000 +0900
+++ linux98/arch/i386/mach-pc9800/smp_bios.h 2002-12-18 00:49:50.000000000 +0900
@@ -0,0 +1,7 @@
+/* Have we found an MP table */
+int smp_found_config;
+
+static inline void get_bios_ebda(void)
+{
+ /* PC-9800 has no EBDA */
+}
diff -Nru linux/arch/i386/kernel/smpboot.c linux98/arch/i386/kernel/smpboot.c
--- linux/arch/i386/kernel/smpboot.c 2002-11-23 06:40:42.000000000 +0900
+++ linux98/arch/i386/kernel/smpboot.c 2002-11-25 11:14:21.000000000 +0900
@@ -823,13 +823,27 @@
nmi_low = *((volatile unsigned short *) TRAMPOLINE_LOW);
}

+#ifndef CONFIG_PC9800
CMOS_WRITE(0xa, 0xf);
+#else
+ /* reset code is stored in 8255 on PC-9800. */
+ outb(0x0e, 0x37); /* SHUT0 = 0 */
+#endif
local_flush_tlb();
Dprintk("1.\n");
*((volatile unsigned short *) TRAMPOLINE_HIGH) = start_eip >> 4;
Dprintk("2.\n");
*((volatile unsigned short *) TRAMPOLINE_LOW) = start_eip & 0xf;
Dprintk("3.\n");
+#ifdef CONFIG_PC9800
+ /*
+ * On PC-9800, continuation on warm reset is done by loading
+ * %ss:%sp from 0x0000:0404 and executing 'lret', so:
+ */
+ /* 0x3f0 is on unused interrupt vector and should be safe... */
+ *((volatile unsigned long *) phys_to_virt(0x404)) = 0x000003f0;
+ Dprintk("4.\n");
+#endif

/*
* Be paranoid about clearing APIC errors.
diff -Nru linux/include/asm-i386/smpboot.h linux98/include/asm-i386/smpboot.h
--- linux/include/asm-i386/smpboot.h 2002-10-12 13:22:19.000000000 +0900
+++ linux98/include/asm-i386/smpboot.h 2002-10-12 19:33:46.000000000 +0900
@@ -13,8 +13,17 @@
#define TRAMPOLINE_LOW phys_to_virt(0x8)
#define TRAMPOLINE_HIGH phys_to_virt(0xa)
#else /* !CONFIG_CLUSTERED_APIC */
+ #ifndef CONFIG_PC9800
#define TRAMPOLINE_LOW phys_to_virt(0x467)
#define TRAMPOLINE_HIGH phys_to_virt(0x469)
+ #else /* CONFIG_PC9800 */
+ /*
+ * On PC-9800, continuation on warm reset is done by loading
+ * %ss:%sp from 0x0000:0404 and executing 'lret', so:
+ */
+ #define TRAMPOLINE_LOW phys_to_virt(0x4fa)
+ #define TRAMPOLINE_HIGH phys_to_virt(0x4fc)
+ #endif /* !CONFIG_PC9800 */
#endif /* CONFIG_CLUSTERED_APIC */

#ifdef CONFIG_CLUSTERED_APIC


Attachments:
smp.patch (5.46 kB)

2002-12-17 16:30:02

by Alan

[permalink] [raw]
Subject: Re: [PATCHSET] PC-9800 addtional for 2.5.50-ac1 (21/21)

On Tue, 2002-12-17 at 16:25, Osamu Tomita wrote:
> Thanks for your advice.

Slight misunderstanding: I just meant put the


static inline int get_ebda(void)
{
unsigned int address = *(unsigned short *)phys_to_virt(0x40E);
address <<= 4;
return address; /* 0 means none */
}


then do

addr = get_ebda();
if(addr)
spm_scan_config(...)


Which actually fixes a bug too - the real PC can have no EBDA (EBDA
value of zero) and we shouldnt scan it if so

2002-12-18 14:34:17

by Osamu Tomita

[permalink] [raw]
Subject: Re: [PATCHSET] PC-9800 addtional for 2.5.50-ac1 (21/21)

diff -urN linux/arch/i386/kernel/mpparse.c linux98/arch/i386/kernel/mpparse.c
--- linux/arch/i386/kernel/mpparse.c 2002-12-10 09:17:48.000000000 +0900
+++ linux98/arch/i386/kernel/mpparse.c 2002-12-18 22:22:24.000000000 +0900
@@ -31,6 +31,7 @@
#include <asm/pgalloc.h>
#include <asm/io_apic.h>
#include "mach_apic.h"
+#include "bios_ebda.h"

/* Have we found an MP table */
int smp_found_config;
@@ -676,11 +677,14 @@
printk(KERN_DEBUG "Default MP configuration #%d\n", mpf->mpf_feature1);
construct_default_ISA_mptable(mpf->mpf_feature1);
} else if (mpf->mpf_physptr) {
+ extern int pc98;
+
/*
* Read the physical hardware table. Anything here will
* override the defaults.
*/
- if (!smp_read_mpc((void *)mpf->mpf_physptr)) {
+ if (!smp_read_mpc(pc98 ? phys_to_virt(mpf->mpf_physptr)
+ : (void *)mpf->mpf_physptr)) {
smp_found_config = 0;
printk(KERN_ERR "BIOS bug, MP table errors detected!...\n");
printk(KERN_ERR "... disabling SMP support. (tell your hw vendor)\n");
@@ -734,8 +738,25 @@
Dprintk("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);
+ /*
+ * 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.
+ */
+ 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.
+ */
+ 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;
}
@@ -778,12 +799,14 @@
* 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);
- /* This has been safe for ages */
- if (smp_found_config)
- Dprintk(KERN_WARNING "WARNING: MP table in the EBDA can be UNSAFE, contact [email protected] if you experience SMP problems!\n");
+ address = get_bios_ebda();
+ if (address)
+ {
+ smp_scan_config(address, 0x400);
+ /* This has been safe for ages */
+ if (smp_found_config)
+ Dprintk(KERN_WARNING "WARNING: MP table in the EBDA can be UNSAFE, contact [email protected] if you experience SMP problems!\n");
+ }
}


diff -Nru linux-2.5.50-ac1/arch/i386/mach-defaults/bios_ebda.h linux98-2.5.50-ac1/arch/i386/mach-defaults/bios_ebda.h
--- linux-2.5.50-ac1/arch/i386/mach-defaults/bios_ebda.h 1970-01-01 09:00:00.000000000 +0900
+++ linux98-2.5.50-ac1/arch/i386/mach-defaults/bios_ebda.h 2002-12-18 22:40:38.000000000 +0900
@@ -0,0 +1,15 @@
+#ifndef _MACH_BIOS_EBDA_H
+#define _MACH_BIOS_EBDA_H
+
+/*
+ * there is a real-mode segmented pointer pointing to the
+ * 4K EBDA area at 0x40E.
+ */
+static inline unsigned int get_bios_ebda(void)
+{
+ unsigned int address = *(unsigned short *)phys_to_virt(0x40E);
+ address <<= 4;
+ return address; /* 0 means none */
+}
+
+#endif /* _MACH_BIOS_EBDA_H */
diff -Nru linux-2.5.50-ac1/arch/i386/mach-pc9800/bios_ebda.h linux98-2.5.50-ac1/arch/i386/mach-pc9800/bios_ebda.h
--- linux-2.5.50-ac1/arch/i386/mach-pc9800/bios_ebda.h 1970-01-01 09:00:00.000000000 +0900
+++ linux98-2.5.50-ac1/arch/i386/mach-pc9800/bios_ebda.h 2002-12-18 22:49:59.000000000 +0900
@@ -0,0 +1,14 @@
+#ifndef _MACH_BIOS_EBDA_H
+#define _MACH_BIOS_EBDA_H
+
+/*
+ * PC-9800 has no EBDA.
+ * Its BIOS uses 0x40E for other purpose,
+ * Not pointer to 4K EBDA area.
+ */
+static inline unsigned int get_bios_ebda(void)
+{
+ return 0; /* 0 means none */
+}
+
+#endif /* _MACH_BIOS_EBDA_H */
diff -urN linux/arch/i386/kernel/smpboot.c linux98/arch/i386/kernel/smpboot.c
--- linux/arch/i386/kernel/smpboot.c 2002-12-10 09:17:49.000000000 +0900
+++ linux98/arch/i386/kernel/smpboot.c 2002-12-10 10:43:32.000000000 +0900
@@ -856,13 +856,27 @@
nmi_low = *((volatile unsigned short *) TRAMPOLINE_LOW);
}

+#ifndef CONFIG_PC9800
CMOS_WRITE(0xa, 0xf);
+#else
+ /* reset code is stored in 8255 on PC-9800. */
+ outb(0x0e, 0x37); /* SHUT0 = 0 */
+#endif
local_flush_tlb();
Dprintk("1.\n");
*((volatile unsigned short *) TRAMPOLINE_HIGH) = start_eip >> 4;
Dprintk("2.\n");
*((volatile unsigned short *) TRAMPOLINE_LOW) = start_eip & 0xf;
Dprintk("3.\n");
+#ifdef CONFIG_PC9800
+ /*
+ * On PC-9800, continuation on warm reset is done by loading
+ * %ss:%sp from 0x0000:0404 and executing 'lret', so:
+ */
+ /* 0x3f0 is on unused interrupt vector and should be safe... */
+ *((volatile unsigned long *) phys_to_virt(0x404)) = 0x000003f0;
+ Dprintk("4.\n");
+#endif

/*
* Be paranoid about clearing APIC errors.
diff -urN linux/include/asm-i386/smpboot.h linux98/include/asm-i386/smpboot.h
--- linux/include/asm-i386/smpboot.h Sat Oct 12 13:22:19 2002
+++ linux98/include/asm-i386/smpboot.h Sat Oct 12 19:33:46 2002
@@ -13,8 +13,17 @@
#define TRAMPOLINE_LOW phys_to_virt(0x8)
#define TRAMPOLINE_HIGH phys_to_virt(0xa)
#else /* !CONFIG_CLUSTERED_APIC */
+ #ifndef CONFIG_PC9800
#define TRAMPOLINE_LOW phys_to_virt(0x467)
#define TRAMPOLINE_HIGH phys_to_virt(0x469)
+ #else /* CONFIG_PC9800 */
+ /*
+ * On PC-9800, continuation on warm reset is done by loading
+ * %ss:%sp from 0x0000:0404 and executing 'lret', so:
+ */
+ #define TRAMPOLINE_LOW phys_to_virt(0x4fa)
+ #define TRAMPOLINE_HIGH phys_to_virt(0x4fc)
+ #endif /* !CONFIG_PC9800 */
#endif /* CONFIG_CLUSTERED_APIC */

#ifdef CONFIG_CLUSTERED_APIC


Attachments:
smp.patch (5.57 kB)