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 *(*target_cpus)(void); 37 const cpumask_t *(*vector_allocation_cpumask)(int cpu); 38 unsigned int (*cpu_mask_to_apicid)(const cpumask_t *cpumask); 39 void (*send_IPI_mask)(const cpumask_t *mask, int vector); 40 void (*send_IPI_self)(uint8_t vector); 41 }; 42 43 #define APICFUNC(x) .x = x 44 45 #define APIC_INIT(aname, aprobe) \ 46 .name = aname, \ 47 .probe = aprobe, \ 48 APICFUNC(mps_oem_check), \ 49 APICFUNC(acpi_madt_oem_check) 50 51 extern const struct genapic *genapic; 52 extern const struct genapic apic_default; 53 54 const cpumask_t *target_cpus_all(void); 55 void send_IPI_self_legacy(uint8_t vector); 56 57 void init_apic_ldr_flat(void); 58 void clustered_apic_check_flat(void); 59 unsigned int cpu_mask_to_apicid_flat(const cpumask_t *cpumask); 60 void send_IPI_mask_flat(const cpumask_t *mask, int vector); 61 const cpumask_t *vector_allocation_cpumask_flat(int cpu); 62 #define GENAPIC_FLAT \ 63 .int_delivery_mode = dest_LowestPrio, \ 64 .int_dest_mode = 1 /* logical delivery */, \ 65 .init_apic_ldr = init_apic_ldr_flat, \ 66 .clustered_apic_check = clustered_apic_check_flat, \ 67 .target_cpus = target_cpus_all, \ 68 .vector_allocation_cpumask = vector_allocation_cpumask_flat, \ 69 .cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \ 70 .send_IPI_mask = send_IPI_mask_flat, \ 71 .send_IPI_self = send_IPI_self_legacy 72 73 void init_apic_ldr_phys(void); 74 void clustered_apic_check_phys(void); 75 unsigned int cpu_mask_to_apicid_phys(const cpumask_t *cpumask); 76 void send_IPI_mask_phys(const cpumask_t *mask, int vector); 77 const cpumask_t *vector_allocation_cpumask_phys(int cpu); 78 #define GENAPIC_PHYS \ 79 .int_delivery_mode = dest_Fixed, \ 80 .int_dest_mode = 0 /* physical delivery */, \ 81 .init_apic_ldr = init_apic_ldr_phys, \ 82 .clustered_apic_check = clustered_apic_check_phys, \ 83 .target_cpus = target_cpus_all, \ 84 .vector_allocation_cpumask = vector_allocation_cpumask_phys, \ 85 .cpu_mask_to_apicid = cpu_mask_to_apicid_phys, \ 86 .send_IPI_mask = send_IPI_mask_phys, \ 87 .send_IPI_self = send_IPI_self_legacy 88 89 #endif 90