x86_init.c 3.6 KB
Newer Older
1 2 3 4 5 6
/*
 * Copyright (C) 2009 Thomas Gleixner <tglx@linutronix.de>
 *
 *  For licencing details see kernel-base/COPYING
 */
#include <linux/init.h>
7
#include <linux/ioport.h>
8
#include <linux/export.h>
S
Stefano Stabellini 已提交
9
#include <linux/pci.h>
10

11
#include <asm/bios_ebda.h>
12
#include <asm/paravirt.h>
13
#include <asm/pci_x86.h>
14
#include <asm/mpspec.h>
15
#include <asm/setup.h>
16
#include <asm/apic.h>
17
#include <asm/e820/api.h>
18
#include <asm/time.h>
19
#include <asm/irq.h>
20
#include <asm/io_apic.h>
21
#include <asm/hpet.h>
22
#include <asm/pat.h>
23
#include <asm/tsc.h>
24
#include <asm/iommu.h>
25
#include <asm/mach_traps.h>
26

27
void x86_init_noop(void) { }
28
void __init x86_init_uint_noop(unsigned int unused) { }
29
int __init iommu_init_noop(void) { return 0; }
30
void iommu_shutdown_noop(void) { }
31 32
bool __init bool_x86_init_noop(void) { return false; }
void x86_op_int_noop(int cpu) { }
33 34 35 36 37

/*
 * The platform setup functions are preset with the default functions
 * for standard PC hardware.
 */
38
struct x86_init_ops x86_init __initdata = {
39 40

	.resources = {
D
Dan Williams 已提交
41
		.probe_roms		= probe_roms,
42
		.reserve_resources	= reserve_standard_io_resources,
43
		.memory_setup		= e820__memory_setup_default,
44
	},
45 46 47

	.mpparse = {
		.mpc_record		= x86_init_uint_noop,
48
		.setup_ioapic_ids	= x86_init_noop,
49
		.mpc_apic_id		= default_mpc_apic_id,
50
		.smp_read_mpc_oem	= default_smp_read_mpc_oem,
51
		.mpc_oem_bus_info	= default_mpc_oem_bus_info,
52 53
		.find_smp_config	= default_find_smp_config,
		.get_smp_config		= default_get_smp_config,
54
	},
55 56 57

	.irqs = {
		.pre_vector_init	= init_ISA_irqs,
58
		.intr_init		= native_init_IRQ,
59
		.trap_init		= x86_init_noop,
60
	},
61 62 63

	.oem = {
		.arch_setup		= x86_init_noop,
64
		.banner			= default_banner,
65
	},
66 67

	.paging = {
68
		.pagetable_init		= native_pagetable_init,
69
	},
70 71 72

	.timers = {
		.setup_percpu_clockev	= setup_boot_APIC_clock,
73
		.timer_init		= hpet_time_init,
74
		.wallclock_init		= x86_init_noop,
75
	},
76 77 78 79

	.iommu = {
		.iommu_init		= iommu_init_noop,
	},
80 81 82

	.pci = {
		.init			= x86_default_pci_init,
83
		.init_irq		= x86_default_pci_init_irq,
84
		.fixup_irqs		= x86_default_pci_fixup_irqs,
85
	},
86 87 88 89 90 91

	.hyper = {
		.init_platform		= x86_init_noop,
		.x2apic_available	= bool_x86_init_noop,
		.init_mem_mapping	= x86_init_noop,
	},
92 93
};

94
struct x86_cpuinit_ops x86_cpuinit = {
95
	.early_percpu_clock_init	= x86_init_noop,
96
	.setup_percpu_clockev		= setup_secondary_APIC_clock,
97
};
98

99 100
static void default_nmi_init(void) { };

101
struct x86_platform_ops x86_platform __ro_after_init = {
102
	.calibrate_cpu			= native_calibrate_cpu,
103
	.calibrate_tsc			= native_calibrate_tsc,
104 105
	.get_wallclock			= mach_get_cmos_time,
	.set_wallclock			= mach_set_rtc_mmss,
106
	.iommu_shutdown			= iommu_shutdown_noop,
107
	.is_untracked_pat_range		= is_ISA_range,
108
	.nmi_init			= default_nmi_init,
109
	.get_nmi_reason			= default_get_nmi_reason,
110 111
	.save_sched_clock_state 	= tsc_save_sched_clock_state,
	.restore_sched_clock_state 	= tsc_restore_sched_clock_state,
112
	.hyper.pin_vcpu			= x86_op_int_noop,
113
};
114 115

EXPORT_SYMBOL_GPL(x86_platform);
116 117

#if defined(CONFIG_PCI_MSI)
118
struct x86_msi_ops x86_msi __ro_after_init = {
119 120 121 122
	.setup_msi_irqs		= native_setup_msi_irqs,
	.teardown_msi_irq	= native_teardown_msi_irq,
	.teardown_msi_irqs	= default_teardown_msi_irqs,
	.restore_msi_irqs	= default_restore_msi_irqs,
S
Stefano Stabellini 已提交
123
};
124

125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
/* MSI arch specific hooks */
int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
{
	return x86_msi.setup_msi_irqs(dev, nvec, type);
}

void arch_teardown_msi_irqs(struct pci_dev *dev)
{
	x86_msi.teardown_msi_irqs(dev);
}

void arch_teardown_msi_irq(unsigned int irq)
{
	x86_msi.teardown_msi_irq(irq);
}

141
void arch_restore_msi_irqs(struct pci_dev *dev)
142
{
143
	x86_msi.restore_msi_irqs(dev);
144 145 146
}
#endif

147
struct x86_io_apic_ops x86_io_apic_ops __ro_after_init = {
148 149
	.read			= native_io_apic_read,
	.disable		= native_disable_io_apic,
150
};