/home/lenb/src/to-linus-stable branch 'acpi-2.6.12'
[sfrench/cifs-2.6.git] / arch / i386 / mach-visws / mpparse.c
1
2 #include <linux/config.h>
3 #include <linux/init.h>
4 #include <linux/smp.h>
5
6 #include <asm/smp.h>
7 #include <asm/io.h>
8
9 #include "cobalt.h"
10 #include "mach_apic.h"
11
12 /* Have we found an MP table */
13 int smp_found_config;
14
15 /*
16  * Various Linux-internal data structures created from the
17  * MP-table.
18  */
19 int apic_version [MAX_APICS];
20
21 int pic_mode;
22 unsigned long mp_lapic_addr;
23
24 /* Processor that is doing the boot up */
25 unsigned int boot_cpu_physical_apicid = -1U;
26
27 /* Bitmask of physically existing CPUs */
28 physid_mask_t phys_cpu_present_map;
29
30 unsigned int __initdata maxcpus = NR_CPUS;
31
32 /*
33  * The Visual Workstation is Intel MP compliant in the hardware
34  * sense, but it doesn't have a BIOS(-configuration table).
35  * No problem for Linux.
36  */
37
38 static void __init MP_processor_info (struct mpc_config_processor *m)
39 {
40         int ver, logical_apicid;
41         physid_mask_t apic_cpus;
42         
43         if (!(m->mpc_cpuflag & CPU_ENABLED))
44                 return;
45
46         logical_apicid = m->mpc_apicid;
47         printk(KERN_INFO "%sCPU #%d %ld:%ld APIC version %d\n",
48                 m->mpc_cpuflag & CPU_BOOTPROCESSOR ? "Bootup " : "",
49                 m->mpc_apicid,
50                 (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
51                 (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
52                 m->mpc_apicver);
53
54         if (m->mpc_cpuflag & CPU_BOOTPROCESSOR)
55                 boot_cpu_physical_apicid = m->mpc_apicid;
56
57         ver = m->mpc_apicver;
58         if ((ver >= 0x14 && m->mpc_apicid >= 0xff) || m->mpc_apicid >= 0xf) {
59                 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
60                         m->mpc_apicid, MAX_APICS);
61                 return;
62         }
63
64         apic_cpus = apicid_to_cpu_present(m->mpc_apicid);
65         physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus);
66         /*
67          * Validate version
68          */
69         if (ver == 0x0) {
70                 printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! "
71                         "fixing up to 0x10. (tell your hw vendor)\n",
72                         m->mpc_apicid);
73                 ver = 0x10;
74         }
75         apic_version[m->mpc_apicid] = ver;
76 }
77
78 void __init find_smp_config(void)
79 {
80         struct mpc_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS);
81         unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS));
82
83         if (ncpus > CO_CPU_MAX) {
84                 printk(KERN_WARNING "find_visws_smp: got cpu count of %d at %p\n",
85                         ncpus, mp);
86
87                 ncpus = CO_CPU_MAX;
88         }
89
90         if (ncpus > maxcpus)
91                 ncpus = maxcpus;
92
93         smp_found_config = 1;
94         while (ncpus--)
95                 MP_processor_info(mp++);
96
97         mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
98 }
99
100 void __init get_smp_config (void)
101 {
102 }