Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | /* Have we found an MP table */ |
| 12 | int smp_found_config; |
| 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | int pic_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
Alexey Starikovskiy | f8dc5a1 | 2008-04-21 13:32:01 +0400 | [diff] [blame^] | 16 | extern unsigned int __cpuinitdata maxcpus; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
| 18 | /* |
| 19 | * The Visual Workstation is Intel MP compliant in the hardware |
| 20 | * sense, but it doesn't have a BIOS(-configuration table). |
| 21 | * No problem for Linux. |
| 22 | */ |
| 23 | |
| 24 | static void __init MP_processor_info (struct mpc_config_processor *m) |
| 25 | { |
Thomas Gleixner | 64883ab | 2008-01-30 13:30:35 +0100 | [diff] [blame] | 26 | int ver, logical_apicid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 27 | physid_mask_t apic_cpus; |
Thomas Gleixner | 64883ab | 2008-01-30 13:30:35 +0100 | [diff] [blame] | 28 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | if (!(m->mpc_cpuflag & CPU_ENABLED)) |
| 30 | return; |
| 31 | |
| 32 | logical_apicid = m->mpc_apicid; |
Thomas Gleixner | 64883ab | 2008-01-30 13:30:35 +0100 | [diff] [blame] | 33 | printk(KERN_INFO "%sCPU #%d %u:%u APIC version %d\n", |
| 34 | m->mpc_cpuflag & CPU_BOOTPROCESSOR ? "Bootup " : "", |
| 35 | m->mpc_apicid, |
| 36 | (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8, |
| 37 | (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4, |
| 38 | m->mpc_apicver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
Adrian Bunk | 9e84d1c | 2005-06-25 14:59:12 -0700 | [diff] [blame] | 40 | if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | boot_cpu_physical_apicid = m->mpc_apicid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | |
| 43 | ver = m->mpc_apicver; |
| 44 | if ((ver >= 0x14 && m->mpc_apicid >= 0xff) || m->mpc_apicid >= 0xf) { |
| 45 | printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", |
| 46 | m->mpc_apicid, MAX_APICS); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | apic_cpus = apicid_to_cpu_present(m->mpc_apicid); |
| 51 | physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus); |
| 52 | /* |
| 53 | * Validate version |
| 54 | */ |
| 55 | if (ver == 0x0) { |
| 56 | printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! " |
| 57 | "fixing up to 0x10. (tell your hw vendor)\n", |
| 58 | m->mpc_apicid); |
| 59 | ver = 0x10; |
| 60 | } |
| 61 | apic_version[m->mpc_apicid] = ver; |
| 62 | } |
| 63 | |
| 64 | void __init find_smp_config(void) |
| 65 | { |
| 66 | struct mpc_config_processor *mp = phys_to_virt(CO_CPU_TAB_PHYS); |
| 67 | unsigned short ncpus = readw(phys_to_virt(CO_CPU_NUM_PHYS)); |
| 68 | |
| 69 | if (ncpus > CO_CPU_MAX) { |
| 70 | printk(KERN_WARNING "find_visws_smp: got cpu count of %d at %p\n", |
| 71 | ncpus, mp); |
| 72 | |
| 73 | ncpus = CO_CPU_MAX; |
| 74 | } |
| 75 | |
| 76 | if (ncpus > maxcpus) |
| 77 | ncpus = maxcpus; |
| 78 | |
| 79 | smp_found_config = 1; |
| 80 | while (ncpus--) |
| 81 | MP_processor_info(mp++); |
| 82 | |
| 83 | mp_lapic_addr = APIC_DEFAULT_PHYS_BASE; |
| 84 | } |
| 85 | |
| 86 | void __init get_smp_config (void) |
| 87 | { |
| 88 | } |