es7000.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. static __init int
  34. mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
  35. {
  36. if (mpc->oemptr) {
  37. struct mpc_oemtable *oem_table =
  38. (struct mpc_oemtable *)mpc->oemptr;
  39. if (!strncmp(oem, "UNISYS", 6))
  40. return parse_unisys_oem((char *)oem_table);
  41. }
  42. return 0;
  43. }
  44. #ifdef CONFIG_ACPI
  45. /* Hook from generic ACPI tables.c */
  46. static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
  47. {
  48. unsigned long oem_addr = 0;
  49. int check_dsdt;
  50. int ret = 0;
  51. /* check dsdt at first to avoid clear fix_map for oem_addr */
  52. check_dsdt = es7000_check_dsdt();
  53. if (!find_unisys_acpi_oem_table(&oem_addr)) {
  54. if (check_dsdt)
  55. ret = parse_unisys_oem((char *)oem_addr);
  56. else {
  57. setup_unisys();
  58. ret = 1;
  59. }
  60. /*
  61. * we need to unmap it
  62. */
  63. unmap_unisys_acpi_oem_table(oem_addr);
  64. }
  65. return ret;
  66. }
  67. #else
  68. static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
  69. {
  70. return 0;
  71. }
  72. #endif
  73. static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask)
  74. {
  75. /* Careful. Some cpus do not strictly honor the set of cpus
  76. * specified in the interrupt destination when using lowest
  77. * priority interrupt delivery mode.
  78. *
  79. * In particular there was a hyperthreading cpu observed to
  80. * deliver interrupts to the wrong hyperthread when only one
  81. * hyperthread was specified in the interrupt desitination.
  82. */
  83. *retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
  84. }
  85. struct genapic apic_es7000 = {
  86. .name = "es7000",
  87. .probe = probe_es7000,
  88. .acpi_madt_oem_check = es7000_acpi_madt_oem_check,
  89. .apic_id_registered = es7000_apic_id_registered,
  90. .irq_delivery_mode = dest_Fixed,
  91. /* phys delivery to target CPUs: */
  92. .irq_dest_mode = 0,
  93. .target_cpus = es7000_target_cpus,
  94. .disable_esr = 1,
  95. .dest_logical = 0,
  96. .check_apicid_used = es7000_check_apicid_used,
  97. .check_apicid_present = es7000_check_apicid_present,
  98. .vector_allocation_domain = es7000_vector_allocation_domain,
  99. .init_apic_ldr = es7000_init_apic_ldr,
  100. .ioapic_phys_id_map = es7000_ioapic_phys_id_map,
  101. .setup_apic_routing = es7000_setup_apic_routing,
  102. .multi_timer_check = NULL,
  103. .apicid_to_node = es7000_apicid_to_node,
  104. .cpu_to_logical_apicid = es7000_cpu_to_logical_apicid,
  105. .cpu_present_to_apicid = es7000_cpu_present_to_apicid,
  106. .apicid_to_cpu_present = es7000_apicid_to_cpu_present,
  107. .setup_portio_remap = NULL,
  108. .check_phys_apicid_present = es7000_check_phys_apicid_present,
  109. .enable_apic_mode = es7000_enable_apic_mode,
  110. .phys_pkg_id = phys_pkg_id,
  111. .mps_oem_check = mps_oem_check,
  112. .get_apic_id = get_apic_id,
  113. .set_apic_id = NULL,
  114. .apic_id_mask = APIC_ID_MASK,
  115. .cpu_mask_to_apicid = cpu_mask_to_apicid,
  116. .cpu_mask_to_apicid_and = cpu_mask_to_apicid_and,
  117. .send_IPI_mask = send_IPI_mask,
  118. .send_IPI_mask_allbutself = NULL,
  119. .send_IPI_allbutself = send_IPI_allbutself,
  120. .send_IPI_all = send_IPI_all,
  121. .send_IPI_self = NULL,
  122. .wakeup_cpu = NULL,
  123. .trampoline_phys_low = TRAMPOLINE_PHYS_LOW,
  124. .trampoline_phys_high = TRAMPOLINE_PHYS_HIGH,
  125. .wait_for_init_deassert = wait_for_init_deassert,
  126. .smp_callin_clear_local_apic = smp_callin_clear_local_apic,
  127. .store_NMI_vector = store_NMI_vector,
  128. .restore_NMI_vector = restore_NMI_vector,
  129. .inquire_remote_apic = inquire_remote_apic,
  130. };