]> Pileus Git - ~andy/linux/blob - arch/x86/include/asm/x86_init.h
Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~andy/linux] / arch / x86 / include / asm / x86_init.h
1 #ifndef _ASM_X86_PLATFORM_H
2 #define _ASM_X86_PLATFORM_H
3
4 #include <asm/pgtable_types.h>
5 #include <asm/bootparam.h>
6
7 struct mpc_bus;
8 struct mpc_cpu;
9 struct mpc_table;
10 struct cpuinfo_x86;
11
12 /**
13  * struct x86_init_mpparse - platform specific mpparse ops
14  * @mpc_record:                 platform specific mpc record accounting
15  * @setup_ioapic_ids:           platform specific ioapic id override
16  * @mpc_apic_id:                platform specific mpc apic id assignment
17  * @smp_read_mpc_oem:           platform specific oem mpc table setup
18  * @mpc_oem_pci_bus:            platform specific pci bus setup (default NULL)
19  * @mpc_oem_bus_info:           platform specific mpc bus info
20  * @find_smp_config:            find the smp configuration
21  * @get_smp_config:             get the smp configuration
22  */
23 struct x86_init_mpparse {
24         void (*mpc_record)(unsigned int mode);
25         void (*setup_ioapic_ids)(void);
26         int (*mpc_apic_id)(struct mpc_cpu *m);
27         void (*smp_read_mpc_oem)(struct mpc_table *mpc);
28         void (*mpc_oem_pci_bus)(struct mpc_bus *m);
29         void (*mpc_oem_bus_info)(struct mpc_bus *m, char *name);
30         void (*find_smp_config)(void);
31         void (*get_smp_config)(unsigned int early);
32 };
33
34 /**
35  * struct x86_init_resources - platform specific resource related ops
36  * @probe_roms:                 probe BIOS roms
37  * @reserve_resources:          reserve the standard resources for the
38  *                              platform
39  * @memory_setup:               platform specific memory setup
40  *
41  */
42 struct x86_init_resources {
43         void (*probe_roms)(void);
44         void (*reserve_resources)(void);
45         char *(*memory_setup)(void);
46 };
47
48 /**
49  * struct x86_init_irqs - platform specific interrupt setup
50  * @pre_vector_init:            init code to run before interrupt vectors
51  *                              are set up.
52  * @intr_init:                  interrupt init code
53  * @trap_init:                  platform specific trap setup
54  */
55 struct x86_init_irqs {
56         void (*pre_vector_init)(void);
57         void (*intr_init)(void);
58         void (*trap_init)(void);
59 };
60
61 /**
62  * struct x86_init_oem - oem platform specific customizing functions
63  * @arch_setup:                 platform specific architecure setup
64  * @banner:                     print a platform specific banner
65  */
66 struct x86_init_oem {
67         void (*arch_setup)(void);
68         void (*banner)(void);
69 };
70
71 /**
72  * struct x86_init_paging - platform specific paging functions
73  * @pagetable_init:     platform specific paging initialization call to setup
74  *                      the kernel pagetables and prepare accessors functions.
75  *                      Callback must call paging_init(). Called once after the
76  *                      direct mapping for phys memory is available.
77  */
78 struct x86_init_paging {
79         void (*pagetable_init)(void);
80 };
81
82 /**
83  * struct x86_init_timers - platform specific timer setup
84  * @setup_perpcu_clockev:       set up the per cpu clock event device for the
85  *                              boot cpu
86  * @tsc_pre_init:               platform function called before TSC init
87  * @timer_init:                 initialize the platform timer (default PIT/HPET)
88  * @wallclock_init:             init the wallclock device
89  */
90 struct x86_init_timers {
91         void (*setup_percpu_clockev)(void);
92         void (*tsc_pre_init)(void);
93         void (*timer_init)(void);
94         void (*wallclock_init)(void);
95 };
96
97 /**
98  * struct x86_init_iommu - platform specific iommu setup
99  * @iommu_init:                 platform specific iommu setup
100  */
101 struct x86_init_iommu {
102         int (*iommu_init)(void);
103 };
104
105 /**
106  * struct x86_init_pci - platform specific pci init functions
107  * @arch_init:                  platform specific pci arch init call
108  * @init:                       platform specific pci subsystem init
109  * @init_irq:                   platform specific pci irq init
110  * @fixup_irqs:                 platform specific pci irq fixup
111  */
112 struct x86_init_pci {
113         int (*arch_init)(void);
114         int (*init)(void);
115         void (*init_irq)(void);
116         void (*fixup_irqs)(void);
117 };
118
119 /**
120  * struct x86_init_ops - functions for platform specific setup
121  *
122  */
123 struct x86_init_ops {
124         struct x86_init_resources       resources;
125         struct x86_init_mpparse         mpparse;
126         struct x86_init_irqs            irqs;
127         struct x86_init_oem             oem;
128         struct x86_init_paging          paging;
129         struct x86_init_timers          timers;
130         struct x86_init_iommu           iommu;
131         struct x86_init_pci             pci;
132 };
133
134 /**
135  * struct x86_cpuinit_ops - platform specific cpu hotplug setups
136  * @setup_percpu_clockev:       set up the per cpu clock event device
137  * @early_percpu_clock_init:    early init of the per cpu clock event device
138  */
139 struct x86_cpuinit_ops {
140         void (*setup_percpu_clockev)(void);
141         void (*early_percpu_clock_init)(void);
142         void (*fixup_cpu_id)(struct cpuinfo_x86 *c, int node);
143 };
144
145 /**
146  * struct x86_platform_ops - platform specific runtime functions
147  * @calibrate_tsc:              calibrate TSC
148  * @get_wallclock:              get time from HW clock like RTC etc.
149  * @set_wallclock:              set time back to HW clock
150  * @is_untracked_pat_range      exclude from PAT logic
151  * @nmi_init                    enable NMI on cpus
152  * @i8042_detect                pre-detect if i8042 controller exists
153  * @save_sched_clock_state:     save state for sched_clock() on suspend
154  * @restore_sched_clock_state:  restore state for sched_clock() on resume
155  * @apic_post_init:             adjust apic if neeeded
156  */
157 struct x86_platform_ops {
158         unsigned long (*calibrate_tsc)(void);
159         unsigned long (*get_wallclock)(void);
160         int (*set_wallclock)(unsigned long nowtime);
161         void (*iommu_shutdown)(void);
162         bool (*is_untracked_pat_range)(u64 start, u64 end);
163         void (*nmi_init)(void);
164         unsigned char (*get_nmi_reason)(void);
165         int (*i8042_detect)(void);
166         void (*save_sched_clock_state)(void);
167         void (*restore_sched_clock_state)(void);
168         void (*apic_post_init)(void);
169 };
170
171 struct pci_dev;
172 struct msi_msg;
173
174 struct x86_msi_ops {
175         int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type);
176         void (*compose_msi_msg)(struct pci_dev *dev, unsigned int irq,
177                                 unsigned int dest, struct msi_msg *msg,
178                                u8 hpet_id);
179         void (*teardown_msi_irq)(unsigned int irq);
180         void (*teardown_msi_irqs)(struct pci_dev *dev);
181         void (*restore_msi_irqs)(struct pci_dev *dev, int irq);
182         int  (*setup_hpet_msi)(unsigned int irq, unsigned int id);
183 };
184
185 struct IO_APIC_route_entry;
186 struct io_apic_irq_attr;
187 struct irq_data;
188 struct cpumask;
189
190 struct x86_io_apic_ops {
191         void            (*init)   (void);
192         unsigned int    (*read)   (unsigned int apic, unsigned int reg);
193         void            (*write)  (unsigned int apic, unsigned int reg, unsigned int value);
194         void            (*modify) (unsigned int apic, unsigned int reg, unsigned int value);
195         void            (*disable)(void);
196         void            (*print_entries)(unsigned int apic, unsigned int nr_entries);
197         int             (*set_affinity)(struct irq_data *data,
198                                         const struct cpumask *mask,
199                                         bool force);
200         int             (*setup_entry)(int irq, struct IO_APIC_route_entry *entry,
201                                        unsigned int destination, int vector,
202                                        struct io_apic_irq_attr *attr);
203         void            (*eoi_ioapic_pin)(int apic, int pin, int vector);
204 };
205
206 extern struct x86_init_ops x86_init;
207 extern struct x86_cpuinit_ops x86_cpuinit;
208 extern struct x86_platform_ops x86_platform;
209 extern struct x86_msi_ops x86_msi;
210 extern struct x86_io_apic_ops x86_io_apic_ops;
211 extern void x86_init_noop(void);
212 extern void x86_init_uint_noop(unsigned int unused);
213
214 #endif