mach_apic.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef __ASM_MACH_APIC_H
  2. #define __ASM_MACH_APIC_H
  3. #include <mach_apicdef.h>
  4. #include <asm/smp.h>
  5. #define APIC_DFR_VALUE (APIC_DFR_FLAT)
  6. #define no_balance_irq (0)
  7. #define esr_disable (0)
  8. #define NO_IOAPIC_CHECK (0)
  9. #define INT_DELIVERY_MODE dest_LowestPrio
  10. #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */
  11. #ifdef CONFIG_SMP
  12. #define TARGET_CPUS cpu_online_map
  13. #else
  14. #define TARGET_CPUS cpumask_of_cpu(0)
  15. #endif
  16. #define check_apicid_used(bitmap, apicid) physid_isset(apicid, bitmap)
  17. #define check_apicid_present(bit) physid_isset(bit, phys_cpu_present_map)
  18. static inline int apic_id_registered(void)
  19. {
  20. return physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map);
  21. }
  22. /*
  23. * Set up the logical destination ID.
  24. *
  25. * Intel recommends to set DFR, LDR and TPR before enabling
  26. * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
  27. * document number 292116). So here it goes...
  28. */
  29. static inline void init_apic_ldr(void)
  30. {
  31. unsigned long val;
  32. apic_write_around(APIC_DFR, APIC_DFR_VALUE);
  33. val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
  34. val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id());
  35. apic_write_around(APIC_LDR, val);
  36. }
  37. static inline void summit_check(char *oem, char *productid)
  38. {
  39. }
  40. static inline void clustered_apic_check(void)
  41. {
  42. }
  43. /* Mapping from cpu number to logical apicid */
  44. static inline int cpu_to_logical_apicid(int cpu)
  45. {
  46. return 1 << cpu;
  47. }
  48. static inline int cpu_present_to_apicid(int mps_cpu)
  49. {
  50. if (mps_cpu < get_physical_broadcast())
  51. return mps_cpu;
  52. else
  53. return BAD_APICID;
  54. }
  55. static inline physid_mask_t apicid_to_cpu_present(int apicid)
  56. {
  57. return physid_mask_of_physid(apicid);
  58. }
  59. #define WAKE_SECONDARY_VIA_INIT
  60. static inline void setup_portio_remap(void)
  61. {
  62. }
  63. static inline void enable_apic_mode(void)
  64. {
  65. }
  66. static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
  67. {
  68. return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
  69. }
  70. static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
  71. {
  72. return cpus_addr(cpumask)[0];
  73. }
  74. static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
  75. {
  76. return cpuid_apic >> index_msb;
  77. }
  78. #endif /* __ASM_MACH_APIC_H */