genapic.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. #ifndef _ASM_X86_GENAPIC_H
  2. #define _ASM_X86_GENAPIC_H
  3. #include <linux/cpumask.h>
  4. #include <asm/mpspec.h>
  5. #include <asm/atomic.h>
  6. /*
  7. * Copyright 2004 James Cleverdon, IBM.
  8. * Subject to the GNU Public License, v.2
  9. *
  10. * Generic APIC sub-arch data struct.
  11. *
  12. * Hacked for x86-64 by James Cleverdon from i386 architecture code by
  13. * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
  14. * James Cleverdon.
  15. */
  16. struct genapic {
  17. char *name;
  18. int (*probe)(void);
  19. int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
  20. int (*apic_id_registered)(void);
  21. u32 int_delivery_mode;
  22. u32 int_dest_mode;
  23. const struct cpumask *(*target_cpus)(void);
  24. int ESR_DISABLE;
  25. int apic_destination_logical;
  26. unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
  27. unsigned long (*check_apicid_present)(int apicid);
  28. int no_balance_irq;
  29. int no_ioapic_check;
  30. void (*vector_allocation_domain)(int cpu, struct cpumask *retmask);
  31. void (*init_apic_ldr)(void);
  32. physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
  33. void (*setup_apic_routing)(void);
  34. int (*multi_timer_check)(int apic, int irq);
  35. int (*apicid_to_node)(int logical_apicid);
  36. int (*cpu_to_logical_apicid)(int cpu);
  37. int (*cpu_present_to_apicid)(int mps_cpu);
  38. physid_mask_t (*apicid_to_cpu_present)(int phys_apicid);
  39. void (*setup_portio_remap)(void);
  40. int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
  41. void (*enable_apic_mode)(void);
  42. #ifdef CONFIG_X86_32
  43. u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
  44. #else
  45. unsigned int (*phys_pkg_id)(int index_msb);
  46. #endif
  47. /*
  48. * When one of the next two hooks returns 1 the genapic
  49. * is switched to this. Essentially they are additional
  50. * probe functions:
  51. */
  52. int (*mps_oem_check)(struct mpc_table *mpc, char *oem,
  53. char *productid);
  54. unsigned int (*get_apic_id)(unsigned long x);
  55. unsigned long (*set_apic_id)(unsigned int id);
  56. unsigned long apic_id_mask;
  57. unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask);
  58. unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
  59. const struct cpumask *andmask);
  60. /* ipi */
  61. void (*send_IPI_mask)(const struct cpumask *mask, int vector);
  62. void (*send_IPI_mask_allbutself)(const struct cpumask *mask,
  63. int vector);
  64. void (*send_IPI_allbutself)(int vector);
  65. void (*send_IPI_all)(int vector);
  66. void (*send_IPI_self)(int vector);
  67. /* wakeup_secondary_cpu */
  68. int (*wakeup_cpu)(int apicid, unsigned long start_eip);
  69. int trampoline_phys_low;
  70. int trampoline_phys_high;
  71. void (*wait_for_init_deassert)(atomic_t *deassert);
  72. void (*smp_callin_clear_local_apic)(void);
  73. void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
  74. void (*restore_NMI_vector)(unsigned short *high, unsigned short *low);
  75. void (*inquire_remote_apic)(int apicid);
  76. };
  77. extern struct genapic *genapic;
  78. #ifdef CONFIG_X86_32
  79. #define APICFUNC(x) .x = x,
  80. /* More functions could be probably marked IPIFUNC and save some space
  81. in UP GENERICARCH kernels, but I don't have the nerve right now
  82. to untangle this mess. -AK */
  83. #ifdef CONFIG_SMP
  84. #define IPIFUNC(x) APICFUNC(x)
  85. #else
  86. #define IPIFUNC(x)
  87. #endif
  88. #define APIC_INIT(aname, aprobe) \
  89. { \
  90. .name = aname, \
  91. .probe = aprobe, \
  92. .int_delivery_mode = INT_DELIVERY_MODE, \
  93. .int_dest_mode = INT_DEST_MODE, \
  94. .no_balance_irq = NO_BALANCE_IRQ, \
  95. .ESR_DISABLE = esr_disable, \
  96. .apic_destination_logical = APIC_DEST_LOGICAL, \
  97. APICFUNC(apic_id_registered) \
  98. APICFUNC(target_cpus) \
  99. APICFUNC(check_apicid_used) \
  100. APICFUNC(check_apicid_present) \
  101. APICFUNC(init_apic_ldr) \
  102. APICFUNC(ioapic_phys_id_map) \
  103. APICFUNC(setup_apic_routing) \
  104. APICFUNC(multi_timer_check) \
  105. APICFUNC(apicid_to_node) \
  106. APICFUNC(cpu_to_logical_apicid) \
  107. APICFUNC(cpu_present_to_apicid) \
  108. APICFUNC(apicid_to_cpu_present) \
  109. APICFUNC(setup_portio_remap) \
  110. APICFUNC(check_phys_apicid_present) \
  111. APICFUNC(mps_oem_check) \
  112. APICFUNC(get_apic_id) \
  113. .apic_id_mask = APIC_ID_MASK, \
  114. APICFUNC(cpu_mask_to_apicid) \
  115. APICFUNC(cpu_mask_to_apicid_and) \
  116. APICFUNC(vector_allocation_domain) \
  117. APICFUNC(acpi_madt_oem_check) \
  118. IPIFUNC(send_IPI_mask) \
  119. IPIFUNC(send_IPI_allbutself) \
  120. IPIFUNC(send_IPI_all) \
  121. APICFUNC(enable_apic_mode) \
  122. APICFUNC(phys_pkg_id) \
  123. .trampoline_phys_low = TRAMPOLINE_PHYS_LOW, \
  124. .trampoline_phys_high = TRAMPOLINE_PHYS_HIGH, \
  125. APICFUNC(wait_for_init_deassert) \
  126. APICFUNC(smp_callin_clear_local_apic) \
  127. APICFUNC(store_NMI_vector) \
  128. APICFUNC(restore_NMI_vector) \
  129. APICFUNC(inquire_remote_apic) \
  130. }
  131. extern void es7000_update_genapic_to_cluster(void);
  132. #else /* CONFIG_X86_64: */
  133. extern struct genapic apic_flat;
  134. extern struct genapic apic_physflat;
  135. extern struct genapic apic_x2apic_cluster;
  136. extern struct genapic apic_x2apic_phys;
  137. extern int acpi_madt_oem_check(char *, char *);
  138. extern void apic_send_IPI_self(int vector);
  139. extern struct genapic apic_x2apic_uv_x;
  140. DECLARE_PER_CPU(int, x2apic_extra_bits);
  141. extern void setup_apic_routing(void);
  142. #endif /* CONFIG_X86_64 */
  143. #endif /* _ASM_X86_GENAPIC_64_H */