force_iommu = 1;
- genapic = apic_x2apic_probe();
- printk("Switched to APIC driver %s.\n", genapic->name);
+ genapic = *apic_x2apic_probe();
+ printk("Switched to APIC driver %s.\n", genapic.name);
if ( !x2apic_enabled )
{
return def_to_bigsmp;
}
-const struct genapic apic_bigsmp = {
+const struct genapic __initconstrel apic_bigsmp = {
APIC_INIT("bigsmp", probe_bigsmp),
GENAPIC_PHYS
};
return 1;
}
-const struct genapic apic_default = {
+const struct genapic __initconstrel apic_default = {
APIC_INIT("default", probe_default),
GENAPIC_FLAT
};
#include <asm/mach-generic/mach_apic.h>
#include <asm/setup.h>
-extern const struct genapic apic_bigsmp;
+struct genapic __read_mostly genapic;
-const struct genapic *__read_mostly genapic;
-
-const struct genapic *apic_probe[] __initdata = {
+const struct genapic *const __initconstrel apic_probe[] = {
&apic_bigsmp,
&apic_default, /* must be last */
NULL,
* - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
*/
- if (!cmdline_apic && genapic == &apic_default)
+ if (!cmdline_apic && genapic.name == apic_default.name)
if (apic_bigsmp.probe()) {
- genapic = &apic_bigsmp;
+ genapic = apic_bigsmp;
printk(KERN_INFO "Overriding APIC driver with %s\n",
- genapic->name);
+ genapic.name);
}
}
for (i = 0; apic_probe[i]; i++)
if (!strcmp(apic_probe[i]->name, str)) {
- genapic = apic_probe[i];
+ genapic = *apic_probe[i];
rc = 0;
}
record_boot_APIC_mode();
check_x2apic_preenabled();
- cmdline_apic = changed = (genapic != NULL);
+ cmdline_apic = changed = !!genapic.name;
for (i = 0; !changed && apic_probe[i]; i++) {
if (apic_probe[i]->probe()) {
changed = 1;
- genapic = apic_probe[i];
+ genapic = *apic_probe[i];
}
}
if (!changed)
- genapic = &apic_default;
+ genapic = apic_default;
- printk(KERN_INFO "Using APIC driver %s\n", genapic->name);
+ printk(KERN_INFO "Using APIC driver %s\n", genapic.name);
}
/* These functions can switch the APIC even after the initial ->probe() */
for (i = 0; apic_probe[i]; ++i) {
if (apic_probe[i]->mps_oem_check(mpc,oem,productid)) {
if (!cmdline_apic) {
- genapic = apic_probe[i];
+ genapic = *apic_probe[i];
printk(KERN_INFO "Switched to APIC driver `%s'.\n",
- genapic->name);
+ genapic.name);
}
return 1;
}
for (i = 0; apic_probe[i]; ++i) {
if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) {
if (!cmdline_apic) {
- genapic = apic_probe[i];
+ genapic = *apic_probe[i];
printk(KERN_INFO "Switched to APIC driver `%s'.\n",
- genapic->name);
+ genapic.name);
}
return 1;
}
local_irq_restore(flags);
}
-static const struct genapic apic_x2apic_phys = {
+static const struct genapic __initconstrel apic_x2apic_phys = {
APIC_INIT("x2apic_phys", NULL),
.int_delivery_mode = dest_Fixed,
.int_dest_mode = 0 /* physical delivery */,
.send_IPI_self = send_IPI_self_x2apic
};
-static const struct genapic apic_x2apic_cluster = {
+static const struct genapic __initconstrel apic_x2apic_cluster = {
APIC_INIT("x2apic_cluster", NULL),
.int_delivery_mode = dest_LowestPrio,
.int_dest_mode = 1 /* logical delivery */,
{
printk("x2APIC mode is already enabled by BIOS.\n");
x2apic_enabled = 1;
- genapic = apic_x2apic_probe();
+ genapic = *apic_x2apic_probe();
}
}
return -ENOSPC;
}
- if (num_processors >= 8 && hotplug && genapic == &apic_default) {
+ if (num_processors >= 8 && hotplug
+ && genapic.name == apic_default.name) {
printk(KERN_WARNING "WARNING: CPUs limit of 8 reached."
" Processor ignored.\n");
return -ENOSPC;
void send_IPI_mask(const cpumask_t *mask, int vector)
{
- genapic->send_IPI_mask(mask, vector);
+ genapic.send_IPI_mask(mask, vector);
}
void send_IPI_self(int vector)
{
- genapic->send_IPI_self(vector);
+ genapic.send_IPI_self(vector);
}
/*
APICFUNC(mps_oem_check), \
APICFUNC(acpi_madt_oem_check)
-extern const struct genapic *genapic;
+extern struct genapic genapic;
extern const struct genapic apic_default;
+extern const struct genapic apic_bigsmp;
void send_IPI_self_legacy(uint8_t vector);
#define esr_disable (0)
/* The following are dependent on APIC delivery mode (logical vs. physical). */
-#define INT_DELIVERY_MODE (genapic->int_delivery_mode)
-#define INT_DEST_MODE (genapic->int_dest_mode)
+#define INT_DELIVERY_MODE (genapic.int_delivery_mode)
+#define INT_DEST_MODE (genapic.int_dest_mode)
#define TARGET_CPUS ((const typeof(cpu_online_map) *)&cpu_online_map)
-#define init_apic_ldr (genapic->init_apic_ldr)
-#define clustered_apic_check (genapic->clustered_apic_check)
-#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
-#define vector_allocation_cpumask(cpu) (genapic->vector_allocation_cpumask(cpu))
+#define init_apic_ldr (genapic.init_apic_ldr)
+#define clustered_apic_check (genapic.clustered_apic_check)
+#define cpu_mask_to_apicid (genapic.cpu_mask_to_apicid)
+#define vector_allocation_cpumask(cpu) (genapic.vector_allocation_cpumask(cpu))
static inline void enable_apic_mode(void)
{