mpparse.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. unsigned int boot_cpu_logical_apicid = -1U;
  20. /* Bitmask of physically existing CPUs */
  21. physid_mask_t phys_cpu_present_map;
  22. unsigned int __initdata maxcpus = NR_CPUS;
  23. /*
  24. * The Visual Workstation is Intel MP compliant in the hardware
  25. * sense, but it doesn't have a BIOS(-configuration table).
  26. * No problem for Linux.
  27. */
  28. static void __init MP_processor_info (struct mpc_config_processor *m)
  29. {
  30. int ver, logical_apicid;
  31. physid_mask_t apic_cpus;
  32. if (!(m->mpc_cpuflag & CPU_ENABLED))
  33. return;
  34. logical_apicid = m->mpc_apicid;
  35. printk(KERN_INFO "%sCPU #%d %ld:%ld APIC version %d\n",
  36. m->mpc_cpuflag & CPU_BOOTPROCESSOR ? "Bootup " : "",
  37. m->mpc_apicid,
  38. (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
  39. (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
  40. m->mpc_apicver);
  41. if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) {
  42. boot_cpu_physical_apicid = m->mpc_apicid;
  43. boot_cpu_logical_apicid = logical_apicid;
  44. }
  45. ver = m->mpc_apicver;
  46. if ((ver >= 0x14 && m->mpc_apicid >= 0xff) || m->mpc_apicid >= 0xf) {
  47. printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
  48. m->mpc_apicid, MAX_APICS);
  49. return;
  50. }
  51. apic_cpus = apicid_to_cpu_present(m->mpc_apicid);
  52. physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus);
  53. /*
  54. * Validate version
  55. */
  56. if (ver == 0x0) {
  57. printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! "
  58. "fixing up to 0x10. (tell your hw vendor)\n",
  59. m->mpc_apicid);
  60. ver = 0x10;
  61. }
  62. apic_version[m->mpc_apicid] = ver;
  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. if (ncpus > CO_CPU_MAX) {
  69. printk(KERN_WARNING "find_visws_smp: got cpu count of %d at %p\n",
  70. ncpus, mp);
  71. ncpus = CO_CPU_MAX;
  72. }
  73. if (ncpus > maxcpus)
  74. ncpus = maxcpus;
  75. smp_found_config = 1;
  76. while (ncpus--)
  77. MP_processor_info(mp++);
  78. mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
  79. }
  80. void __init get_smp_config (void)
  81. {
  82. }