genapic.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ifndef _ASM_GENAPIC_H
  2. #define _ASM_GENAPIC_H 1
  3. /*
  4. * Generic APIC driver interface.
  5. *
  6. * An straight forward mapping of the APIC related parts of the
  7. * x86 subarchitecture interface to a dynamic object.
  8. *
  9. * This is used by the "generic" x86 subarchitecture.
  10. *
  11. * Copyright 2003 Andi Kleen, SuSE Labs.
  12. */
  13. struct mpc_config_translation;
  14. struct mpc_config_bus;
  15. struct mp_config_table;
  16. struct mpc_config_processor;
  17. struct genapic {
  18. char *name;
  19. int (*probe)(void);
  20. int (*apic_id_registered)(void);
  21. cpumask_t (*target_cpus)(void);
  22. int int_delivery_mode;
  23. int int_dest_mode;
  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 (*init_apic_ldr)(void);
  31. physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
  32. void (*clustered_apic_check)(void);
  33. int (*multi_timer_check)(int apic, int irq);
  34. int (*apicid_to_node)(int logical_apicid);
  35. int (*cpu_to_logical_apicid)(int cpu);
  36. int (*cpu_present_to_apicid)(int mps_cpu);
  37. physid_mask_t (*apicid_to_cpu_present)(int phys_apicid);
  38. int (*mpc_apic_id)(struct mpc_config_processor *m,
  39. struct mpc_config_translation *t);
  40. void (*setup_portio_remap)(void);
  41. int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
  42. void (*enable_apic_mode)(void);
  43. u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
  44. /* mpparse */
  45. void (*mpc_oem_bus_info)(struct mpc_config_bus *, char *,
  46. struct mpc_config_translation *);
  47. void (*mpc_oem_pci_bus)(struct mpc_config_bus *,
  48. struct mpc_config_translation *);
  49. /* When one of the next two hooks returns 1 the genapic
  50. is switched to this. Essentially they are additional probe
  51. functions. */
  52. int (*mps_oem_check)(struct mp_config_table *mpc, char *oem,
  53. char *productid);
  54. int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
  55. unsigned (*get_apic_id)(unsigned long x);
  56. unsigned long apic_id_mask;
  57. unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
  58. /* ipi */
  59. void (*send_IPI_mask)(cpumask_t mask, int vector);
  60. void (*send_IPI_allbutself)(int vector);
  61. void (*send_IPI_all)(int vector);
  62. };
  63. #define APICFUNC(x) .x = x
  64. #define APIC_INIT(aname, aprobe) { \
  65. .name = aname, \
  66. .probe = aprobe, \
  67. .int_delivery_mode = INT_DELIVERY_MODE, \
  68. .int_dest_mode = INT_DEST_MODE, \
  69. .no_balance_irq = NO_BALANCE_IRQ, \
  70. .ESR_DISABLE = esr_disable, \
  71. .apic_destination_logical = APIC_DEST_LOGICAL, \
  72. APICFUNC(apic_id_registered), \
  73. APICFUNC(target_cpus), \
  74. APICFUNC(check_apicid_used), \
  75. APICFUNC(check_apicid_present), \
  76. APICFUNC(init_apic_ldr), \
  77. APICFUNC(ioapic_phys_id_map), \
  78. APICFUNC(clustered_apic_check), \
  79. APICFUNC(multi_timer_check), \
  80. APICFUNC(apicid_to_node), \
  81. APICFUNC(cpu_to_logical_apicid), \
  82. APICFUNC(cpu_present_to_apicid), \
  83. APICFUNC(apicid_to_cpu_present), \
  84. APICFUNC(mpc_apic_id), \
  85. APICFUNC(setup_portio_remap), \
  86. APICFUNC(check_phys_apicid_present), \
  87. APICFUNC(mpc_oem_bus_info), \
  88. APICFUNC(mpc_oem_pci_bus), \
  89. APICFUNC(mps_oem_check), \
  90. APICFUNC(get_apic_id), \
  91. .apic_id_mask = APIC_ID_MASK, \
  92. APICFUNC(cpu_mask_to_apicid), \
  93. APICFUNC(acpi_madt_oem_check), \
  94. APICFUNC(send_IPI_mask), \
  95. APICFUNC(send_IPI_allbutself), \
  96. APICFUNC(send_IPI_all), \
  97. APICFUNC(enable_apic_mode), \
  98. APICFUNC(phys_pkg_id), \
  99. }
  100. extern struct genapic *genapic;
  101. #endif