es7000.c 4.2 KB

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