arch/x86/include/asm/bigsmp/apic.h
changeset 2 d1f6d8b6f81c
parent 0 aa628870c1d3
equal deleted inserted replaced
1:0056487c491e 2:d1f6d8b6f81c
     7 static inline int apic_id_registered(void)
     7 static inline int apic_id_registered(void)
     8 {
     8 {
     9 	return (1);
     9 	return (1);
    10 }
    10 }
    11 
    11 
    12 static inline cpumask_t target_cpus(void)
    12 static inline const cpumask_t *target_cpus(void)
    13 {
    13 {
    14 #ifdef CONFIG_SMP
    14 #ifdef CONFIG_SMP
    15         return cpu_online_map;
    15 	return &cpu_online_map;
    16 #else
    16 #else
    17         return cpumask_of_cpu(0);
    17 	return &cpumask_of_cpu(0);
    18 #endif
    18 #endif
    19 }
    19 }
    20 
    20 
    21 #undef APIC_DEST_LOGICAL
    21 #undef APIC_DEST_LOGICAL
    22 #define APIC_DEST_LOGICAL	0
    22 #define APIC_DEST_LOGICAL	0
    23 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
    23 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
    24 #define INT_DELIVERY_MODE	(dest_Fixed)
    24 #define INT_DELIVERY_MODE	(dest_Fixed)
    25 #define INT_DEST_MODE		(0)    /* phys delivery to target proc */
    25 #define INT_DEST_MODE		(0)    /* phys delivery to target proc */
    26 #define NO_BALANCE_IRQ		(0)
    26 #define NO_BALANCE_IRQ		(0)
    27 #define WAKE_SECONDARY_VIA_INIT
       
    28 
       
    29 
    27 
    30 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
    28 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
    31 {
    29 {
    32 	return (0);
    30 	return (0);
    33 }
    31 }
    79 	return apicid_2_node[hard_smp_processor_id()];
    77 	return apicid_2_node[hard_smp_processor_id()];
    80 }
    78 }
    81 
    79 
    82 static inline int cpu_present_to_apicid(int mps_cpu)
    80 static inline int cpu_present_to_apicid(int mps_cpu)
    83 {
    81 {
    84 	if (mps_cpu < NR_CPUS)
    82 	if (mps_cpu < nr_cpu_ids)
    85 		return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
    83 		return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
    86 
    84 
    87 	return BAD_APICID;
    85 	return BAD_APICID;
    88 }
    86 }
    89 
    87 
    94 
    92 
    95 extern u8 cpu_2_logical_apicid[];
    93 extern u8 cpu_2_logical_apicid[];
    96 /* Mapping from cpu number to logical apicid */
    94 /* Mapping from cpu number to logical apicid */
    97 static inline int cpu_to_logical_apicid(int cpu)
    95 static inline int cpu_to_logical_apicid(int cpu)
    98 {
    96 {
    99 	if (cpu >= NR_CPUS)
    97 	if (cpu >= nr_cpu_ids)
   100 		return BAD_APICID;
    98 		return BAD_APICID;
   101 	return cpu_physical_id(cpu);
    99 	return cpu_physical_id(cpu);
   102 }
   100 }
   103 
   101 
   104 static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
   102 static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
   119 {
   117 {
   120 	return (1);
   118 	return (1);
   121 }
   119 }
   122 
   120 
   123 /* As we are using single CPU as destination, pick only one CPU here */
   121 /* As we are using single CPU as destination, pick only one CPU here */
   124 static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
   122 static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
   125 {
   123 {
   126 	int cpu;
   124 	int cpu;
   127 	int apicid;	
   125 	int apicid;	
   128 
   126 
   129 	cpu = first_cpu(cpumask);
   127 	cpu = first_cpu(*cpumask);
   130 	apicid = cpu_to_logical_apicid(cpu);
   128 	apicid = cpu_to_logical_apicid(cpu);
   131 	return apicid;
   129 	return apicid;
       
   130 }
       
   131 
       
   132 static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
       
   133 						  const struct cpumask *andmask)
       
   134 {
       
   135 	int cpu;
       
   136 
       
   137 	/*
       
   138 	 * We're using fixed IRQ delivery, can only return one phys APIC ID.
       
   139 	 * May as well be the first.
       
   140 	 */
       
   141 	for_each_cpu_and(cpu, cpumask, andmask)
       
   142 		if (cpumask_test_cpu(cpu, cpu_online_mask))
       
   143 			break;
       
   144 	if (cpu < nr_cpu_ids)
       
   145 		return cpu_to_logical_apicid(cpu);
       
   146 
       
   147 	return BAD_APICID;
   132 }
   148 }
   133 
   149 
   134 static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
   150 static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
   135 {
   151 {
   136 	return cpuid_apic >> index_msb;
   152 	return cpuid_apic >> index_msb;