x86, VisWS: turn into generic arch, add early init quirks
[safe/jmp/linux-2.6] / arch / x86 / mach-visws / mpparse.c
1
2 #include <linux/init.h>
3 #include <linux/smp.h>
4
5 #include <asm/smp.h>
6 #include <asm/io.h>
7
8 #include "cobalt.h"
9 #include "mach_apic.h"
10
11 extern unsigned int __cpuinitdata maxcpus;
12
13 /*
14  * The Visual Workstation is Intel MP compliant in the hardware
15  * sense, but it doesn't have a BIOS(-configuration table).
16  * No problem for Linux.
17  */
18
19 static void __init MP_processor_info (struct mpc_config_processor *m)
20 {
21         int ver, logical_apicid;
22         physid_mask_t apic_cpus;
23
24         if (!(m->mpc_cpuflag & CPU_ENABLED))
25                 return;
26
27         logical_apicid = m->mpc_apicid;
28         printk(KERN_INFO "%sCPU #%d %u:%u APIC version %d\n",
29                m->mpc_cpuflag & CPU_BOOTPROCESSOR ? "Bootup " : "",
30                m->mpc_apicid,
31                (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
32                (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
33                m->mpc_apicver);
34
35         if (m->mpc_cpuflag & CPU_BOOTPROCESSOR)
36                 boot_cpu_physical_apicid = m->mpc_apicid;
37
38         ver = m->mpc_apicver;
39         if ((ver >= 0x14 && m->mpc_apicid >= 0xff) || m->mpc_apicid >= 0xf) {
40                 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
41                         m->mpc_apicid, MAX_APICS);
42                 return;
43         }
44
45         apic_cpus = apicid_to_cpu_present(m->mpc_apicid);
46         physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus);
47         /*
48          * Validate version
49          */
50         if (ver == 0x0) {
51                 printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! "
52                         "fixing up to 0x10. (tell your hw vendor)\n",
53                         m->mpc_apicid);
54                 ver = 0x10;
55         }
56         apic_version[m->mpc_apicid] = ver;
57 }
58
59 void __init find_smp_config(void)
60 {
61         struct mpc_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS);
62         unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS));
63
64         if (ncpus > CO_CPU_MAX) {
65                 printk(KERN_WARNING "find_visws_smp: got cpu count of %d at %p\n",
66                         ncpus, mp);
67
68                 ncpus = CO_CPU_MAX;
69         }
70
71         if (ncpus > maxcpus)
72                 ncpus = maxcpus;
73
74 #ifdef CONFIG_X86_LOCAL_APIC
75         smp_found_config = 1;
76 #endif
77         while (ncpus--)
78                 MP_processor_info(mp++);
79
80         mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
81 }
82
83 void __init get_smp_config (void)
84 {
85 }