es7000.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * APIC driver for the Unisys ES7000 chipset.
  3. */
  4. #define APIC_DEFINITION 1
  5. #include <linux/threads.h>
  6. #include <linux/cpumask.h>
  7. #include <asm/mpspec.h>
  8. #include <asm/genapic.h>
  9. #include <asm/fixmap.h>
  10. #include <asm/apicdef.h>
  11. #include <linux/kernel.h>
  12. #include <linux/string.h>
  13. #include <linux/init.h>
  14. #include <asm/es7000/apicdef.h>
  15. #include <linux/smp.h>
  16. #include <asm/es7000/apic.h>
  17. #include <asm/es7000/ipi.h>
  18. #include <asm/es7000/mpparse.h>
  19. #include <asm/mach-default/mach_wakecpu.h>
  20. void __init es7000_update_genapic_to_cluster(void)
  21. {
  22. apic->target_cpus = target_cpus_cluster;
  23. apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
  24. apic->irq_dest_mode = INT_DEST_MODE_CLUSTER;
  25. apic->init_apic_ldr = es7000_init_apic_ldr_cluster;
  26. apic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster;
  27. }
  28. static int probe_es7000(void)
  29. {
  30. /* probed later in mptable/ACPI hooks */
  31. return 0;
  32. }
  33. extern void es7000_sw_apic(void);
  34. static void __init enable_apic_mode(void)
  35. {
  36. es7000_sw_apic();
  37. return;
  38. }
  39. static __init int
  40. mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
  41. {
  42. if (mpc->oemptr) {
  43. struct mpc_oemtable *oem_table =
  44. (struct mpc_oemtable *)mpc->oemptr;
  45. if (!strncmp(oem, "UNISYS", 6))
  46. return parse_unisys_oem((char *)oem_table);
  47. }
  48. return 0;
  49. }
  50. #ifdef CONFIG_ACPI
  51. /* Hook from generic ACPI tables.c */
  52. static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
  53. {
  54. unsigned long oem_addr = 0;
  55. int check_dsdt;
  56. int ret = 0;
  57. /* check dsdt at first to avoid clear fix_map for oem_addr */
  58. check_dsdt = es7000_check_dsdt();
  59. if (!find_unisys_acpi_oem_table(&oem_addr)) {
  60. if (check_dsdt)
  61. ret = parse_unisys_oem((char *)oem_addr);
  62. else {
  63. setup_unisys();
  64. ret = 1;
  65. }
  66. /*
  67. * we need to unmap it
  68. */
  69. unmap_unisys_acpi_oem_table(oem_addr);
  70. }
  71. return ret;
  72. }
  73. #else
  74. static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
  75. {
  76. return 0;
  77. }
  78. #endif
  79. static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask)
  80. {
  81. /* Careful. Some cpus do not strictly honor the set of cpus
  82. * specified in the interrupt destination when using lowest
  83. * priority interrupt delivery mode.
  84. *
  85. * In particular there was a hyperthreading cpu observed to
  86. * deliver interrupts to the wrong hyperthread when only one
  87. * hyperthread was specified in the interrupt desitination.
  88. */
  89. *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
  90. }
  91. struct genapic apic_es7000 = {
  92. .name = "es7000",
  93. .probe = probe_es7000,
  94. .acpi_madt_oem_check = es7000_acpi_madt_oem_check,
  95. .apic_id_registered = es7000_apic_id_registered,
  96. .irq_delivery_mode = dest_Fixed,
  97. /* phys delivery to target CPUs: */
  98. .irq_dest_mode = 0,
  99. .target_cpus = es7000_target_cpus,
  100. .disable_esr = 1,
  101. .dest_logical = 0,
  102. .check_apicid_used = es7000_check_apicid_used,
  103. .check_apicid_present = es7000_check_apicid_present,
  104. .vector_allocation_domain = es7000_vector_allocation_domain,
  105. .init_apic_ldr = es7000_init_apic_ldr,
  106. .ioapic_phys_id_map = es7000_ioapic_phys_id_map,
  107. .setup_apic_routing = setup_apic_routing,
  108. .multi_timer_check = multi_timer_check,
  109. .apicid_to_node = apicid_to_node,
  110. .cpu_to_logical_apicid = cpu_to_logical_apicid,
  111. .cpu_present_to_apicid = cpu_present_to_apicid,
  112. .apicid_to_cpu_present = apicid_to_cpu_present,
  113. .setup_portio_remap = setup_portio_remap,
  114. .check_phys_apicid_present = check_phys_apicid_present,
  115. .enable_apic_mode = enable_apic_mode,
  116. .phys_pkg_id = phys_pkg_id,
  117. .mps_oem_check = mps_oem_check,
  118. .get_apic_id = get_apic_id,
  119. .set_apic_id = NULL,
  120. .apic_id_mask = APIC_ID_MASK,
  121. .cpu_mask_to_apicid = cpu_mask_to_apicid,
  122. .cpu_mask_to_apicid_and = cpu_mask_to_apicid_and,
  123. .send_IPI_mask = send_IPI_mask,
  124. .send_IPI_mask_allbutself = NULL,
  125. .send_IPI_allbutself = send_IPI_allbutself,
  126. .send_IPI_all = send_IPI_all,
  127. .send_IPI_self = NULL,
  128. .wakeup_cpu = NULL,
  129. .trampoline_phys_low = TRAMPOLINE_PHYS_LOW,
  130. .trampoline_phys_high = TRAMPOLINE_PHYS_HIGH,
  131. .wait_for_init_deassert = wait_for_init_deassert,
  132. .smp_callin_clear_local_apic = smp_callin_clear_local_apic,
  133. .store_NMI_vector = store_NMI_vector,
  134. .restore_NMI_vector = restore_NMI_vector,
  135. .inquire_remote_apic = inquire_remote_apic,
  136. };