genapic.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #ifndef _ASM_GENAPIC_H
  2. #define _ASM_GENAPIC_H 1
  3. #include <asm/mpspec.h>
  4. /*
  5. * Generic APIC driver interface.
  6. *
  7. * An straight forward mapping of the APIC related parts of the
  8. * x86 subarchitecture interface to a dynamic object.
  9. *
  10. * This is used by the "generic" x86 subarchitecture.
  11. *
  12. * Copyright 2003 Andi Kleen, SuSE Labs.
  13. */
  14. struct mpc_config_translation;
  15. struct mpc_config_bus;
  16. struct mp_config_table;
  17. struct mpc_config_processor;
  18. struct genapic {
  19. char *name;
  20. int (*probe)(void);
  21. int (*apic_id_registered)(void);
  22. cpumask_t (*target_cpus)(void);
  23. int int_delivery_mode;
  24. int int_dest_mode;
  25. int ESR_DISABLE;
  26. int apic_destination_logical;
  27. unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
  28. unsigned long (*check_apicid_present)(int apicid);
  29. int no_balance_irq;
  30. int no_ioapic_check;
  31. void (*init_apic_ldr)(void);
  32. physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
  33. void (*clustered_apic_check)(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. int (*mpc_apic_id)(struct mpc_config_processor *m,
  40. struct mpc_config_translation *t);
  41. void (*setup_portio_remap)(void);
  42. int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
  43. void (*enable_apic_mode)(void);
  44. u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
  45. /* mpparse */
  46. void (*mpc_oem_bus_info)(struct mpc_config_bus *, char *,
  47. struct mpc_config_translation *);
  48. void (*mpc_oem_pci_bus)(struct mpc_config_bus *,
  49. struct mpc_config_translation *);
  50. /* When one of the next two hooks returns 1 the genapic
  51. is switched to this. Essentially they are additional probe
  52. functions. */
  53. int (*mps_oem_check)(struct mp_config_table *mpc, char *oem,
  54. char *productid);
  55. int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
  56. unsigned (*get_apic_id)(unsigned long x);
  57. unsigned long apic_id_mask;
  58. unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
  59. #ifdef CONFIG_SMP
  60. /* ipi */
  61. void (*send_IPI_mask)(cpumask_t mask, int vector);
  62. void (*send_IPI_allbutself)(int vector);
  63. void (*send_IPI_all)(int vector);
  64. #endif
  65. };
  66. #define APICFUNC(x) .x = x,
  67. /* More functions could be probably marked IPIFUNC and save some space
  68. in UP GENERICARCH kernels, but I don't have the nerve right now
  69. to untangle this mess. -AK */
  70. #ifdef CONFIG_SMP
  71. #define IPIFUNC(x) APICFUNC(x)
  72. #else
  73. #define IPIFUNC(x)
  74. #endif
  75. #define APIC_INIT(aname, aprobe) { \
  76. .name = aname, \
  77. .probe = aprobe, \
  78. .int_delivery_mode = INT_DELIVERY_MODE, \
  79. .int_dest_mode = INT_DEST_MODE, \
  80. .no_balance_irq = NO_BALANCE_IRQ, \
  81. .ESR_DISABLE = esr_disable, \
  82. .apic_destination_logical = APIC_DEST_LOGICAL, \
  83. APICFUNC(apic_id_registered) \
  84. APICFUNC(target_cpus) \
  85. APICFUNC(check_apicid_used) \
  86. APICFUNC(check_apicid_present) \
  87. APICFUNC(init_apic_ldr) \
  88. APICFUNC(ioapic_phys_id_map) \
  89. APICFUNC(clustered_apic_check) \
  90. APICFUNC(multi_timer_check) \
  91. APICFUNC(apicid_to_node) \
  92. APICFUNC(cpu_to_logical_apicid) \
  93. APICFUNC(cpu_present_to_apicid) \
  94. APICFUNC(apicid_to_cpu_present) \
  95. APICFUNC(mpc_apic_id) \
  96. APICFUNC(setup_portio_remap) \
  97. APICFUNC(check_phys_apicid_present) \
  98. APICFUNC(mpc_oem_bus_info) \
  99. APICFUNC(mpc_oem_pci_bus) \
  100. APICFUNC(mps_oem_check) \
  101. APICFUNC(get_apic_id) \
  102. .apic_id_mask = APIC_ID_MASK, \
  103. APICFUNC(cpu_mask_to_apicid) \
  104. APICFUNC(acpi_madt_oem_check) \
  105. IPIFUNC(send_IPI_mask) \
  106. IPIFUNC(send_IPI_allbutself) \
  107. IPIFUNC(send_IPI_all) \
  108. APICFUNC(enable_apic_mode) \
  109. APICFUNC(phys_pkg_id) \
  110. }
  111. extern struct genapic *genapic;
  112. #endif