1 #ifndef _ASM_GENAPIC_H 2 #define _ASM_GENAPIC_H 1 3 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 15 struct mpc_config_translation; 16 struct mpc_config_bus; 17 struct mp_config_table; 18 struct mpc_config_processor; 19 20 struct genapic { 21 const char *name; 22 int (*probe)(void); 23 24 /* When one of the next two hooks returns 1 the genapic 25 is switched to this. Essentially they are additional probe 26 functions. */ 27 int (*mps_oem_check)(struct mp_config_table *mpc, char *oem, 28 char *productid); 29 int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); 30 31 /* Interrupt delivery parameters ('physical' vs. 'logical flat'). */ 32 int int_delivery_mode; 33 int int_dest_mode; 34 void (*init_apic_ldr)(void); 35 void (*clustered_apic_check)(void); 36 const cpumask_t *(*vector_allocation_cpumask)(int cpu); 37 unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask); 38 void (*send_IPI_mask)(const cpumask_t *mask, int vector); 39 void (*send_IPI_self)(uint8_t vector); 40 }; 41 42 #define APICFUNC(x) .x = x 43 44 #define APIC_INIT(aname, aprobe) \ 45 .name = aname, \ 46 .probe = aprobe, \ 47 APICFUNC(mps_oem_check), \ 48 APICFUNC(acpi_madt_oem_check) 49 50 extern struct genapic genapic; 51 extern const struct genapic apic_default; 52 extern const struct genapic apic_bigsmp; 53 54 void send_IPI_self_legacy(uint8_t vector); 55 56 void init_apic_ldr_flat(void); 57 void clustered_apic_check_flat(void); 58 unsigned int cpu_mask_to_apicid_flat(const cpumask_t *cpumask); 59 void send_IPI_mask_flat(const cpumask_t *mask, int vector); 60 const cpumask_t *vector_allocation_cpumask_flat(int cpu); 61 #define GENAPIC_FLAT \ 62 .int_delivery_mode = dest_LowestPrio, \ 63 .int_dest_mode = 1 /* logical delivery */, \ 64 .init_apic_ldr = init_apic_ldr_flat, \ 65 .clustered_apic_check = clustered_apic_check_flat, \ 66 .vector_allocation_cpumask = vector_allocation_cpumask_flat, \ 67 .cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \ 68 .send_IPI_mask = send_IPI_mask_flat, \ 69 .send_IPI_self = send_IPI_self_legacy 70 71 void init_apic_ldr_phys(void); 72 void clustered_apic_check_phys(void); 73 unsigned int cpu_mask_to_apicid_phys(const cpumask_t *cpumask); 74 void send_IPI_mask_phys(const cpumask_t *mask, int vector); 75 const cpumask_t *vector_allocation_cpumask_phys(int cpu); 76 #define GENAPIC_PHYS \ 77 .int_delivery_mode = dest_Fixed, \ 78 .int_dest_mode = 0 /* physical delivery */, \ 79 .init_apic_ldr = init_apic_ldr_phys, \ 80 .clustered_apic_check = clustered_apic_check_phys, \ 81 .vector_allocation_cpumask = vector_allocation_cpumask_phys, \ 82 .cpu_mask_to_apicid = cpu_mask_to_apicid_phys, \ 83 .send_IPI_mask = send_IPI_mask_phys, \ 84 .send_IPI_self = send_IPI_self_legacy 85 86 #endif 87