mpparse.c 2.3 KB

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