| 
									
										
										
										
											2008-06-20 08:18:09 +02:00
										 |  |  | #ifndef ARCH_X86_CPU_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define ARCH_X86_CPU_H
 | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | struct cpu_model_info { | 
					
						
							| 
									
										
										
										
											2009-03-23 02:06:51 +05:30
										 |  |  | 	int		vendor; | 
					
						
							|  |  |  | 	int		family; | 
					
						
							|  |  |  | 	const char	*model_names[16]; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* attempt to consolidate cpu attributes */ | 
					
						
							|  |  |  | struct cpu_dev { | 
					
						
							| 
									
										
										
										
											2009-03-23 02:06:51 +05:30
										 |  |  | 	const char	*c_vendor; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* some have two possibilities for cpuid string */ | 
					
						
							| 
									
										
										
										
											2009-03-23 02:06:51 +05:30
										 |  |  | 	const char	*c_ident[2]; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	struct		cpu_model_info c_models[4]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-23 02:06:51 +05:30
										 |  |  | 	void            (*c_early_init)(struct cpuinfo_x86 *); | 
					
						
							|  |  |  | 	void		(*c_init)(struct cpuinfo_x86 *); | 
					
						
							|  |  |  | 	void		(*c_identify)(struct cpuinfo_x86 *); | 
					
						
							|  |  |  | 	unsigned int	(*c_size_cache)(struct cpuinfo_x86 *, unsigned int); | 
					
						
							|  |  |  | 	int		c_x86_vendor; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-09-04 21:09:45 +02:00
										 |  |  | #define cpu_dev_register(cpu_devX) \
 | 
					
						
							| 
									
										
										
										
											2009-03-12 12:08:49 +00:00
										 |  |  | 	static const struct cpu_dev *const __cpu_dev_##cpu_devX __used \ | 
					
						
							| 
									
										
										
										
											2008-09-04 21:09:45 +02:00
										 |  |  | 	__attribute__((__section__(".x86_cpu_dev.init"))) = \ | 
					
						
							|  |  |  | 	&cpu_devX; | 
					
						
							| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-12 12:08:49 +00:00
										 |  |  | extern const struct cpu_dev *const __x86_cpu_dev_start[], | 
					
						
							|  |  |  | 			    *const __x86_cpu_dev_end[]; | 
					
						
							| 
									
										
											  
											
												x86: use ELF section to list CPU vendor specific code
Replace the hardcoded list of initialization functions for each CPU
vendor by a list in an ELF section, which is read at initialization in
arch/x86/kernel/cpu/cpu.c to fill the cpu_devs[] array. The ELF
section, named .x86cpuvendor.init, is reclaimed after boot, and
contains entries of type "struct cpu_vendor_dev" which associates a
vendor number with a pointer to a "struct cpu_dev" structure.
This first modification allows to remove all the VENDOR_init_cpu()
functions.
This patch also removes the hardcoded calls to early_init_amd() and
early_init_intel(). Instead, we add a "c_early_init" member to the
cpu_dev structure, which is then called if not NULL by the generic CPU
initialization code. Unfortunately, in early_cpu_detect(), this_cpu is
not yet set, so we have to use the cpu_devs[] array directly.
This patch is part of the Linux Tiny project, and is needed for
further patch that will allow to disable compilation of unused CPU
support code.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
											
										 
											2008-02-15 12:00:23 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-21 14:01:45 +01:00
										 |  |  | extern void cpu_detect_cache_sizes(struct cpuinfo_x86 *c); | 
					
						
							| 
									
										
										
										
											2008-06-06 12:01:13 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-20 08:18:09 +02:00
										 |  |  | #endif
 |