cpu: Add support for microcode version and CPU ID
Some CPUs use microcode and each core can have a different version of microcode loaded. Also some CPUs support the concept of an integer ID used for identification purposes. Add support for these in the CPU uclass. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
		
							parent
							
								
									e23c6c28b0
								
							
						
					
					
						commit
						740d5d34b1
					
				|  | @ -14,6 +14,7 @@ | ||||||
| static const char *cpu_feature_name[CPU_FEAT_COUNT] = { | static const char *cpu_feature_name[CPU_FEAT_COUNT] = { | ||||||
| 	"L1 cache", | 	"L1 cache", | ||||||
| 	"MMU", | 	"MMU", | ||||||
|  | 	"Microcode", | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| static int print_cpu_list(bool detail) | static int print_cpu_list(bool detail) | ||||||
|  | @ -58,6 +59,12 @@ static int print_cpu_list(bool detail) | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 		printf("\n"); | 		printf("\n"); | ||||||
|  | 		if (info.features & (1 << CPU_FEAT_UCODE)) { | ||||||
|  | 			printf("\tMicrocode version %#x\n", | ||||||
|  | 			       plat->ucode_version); | ||||||
|  | 		} | ||||||
|  | 		if (info.features & (1 << CPU_FEAT_DEVICE_ID)) | ||||||
|  | 			printf("\tDevice ID %#lx\n", plat->device_id); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return 0; | 	return 0; | ||||||
|  |  | ||||||
|  | @ -15,15 +15,20 @@ | ||||||
|  * device. |  * device. | ||||||
|  * |  * | ||||||
|  * @cpu_id:	Platform-specific way of identifying the CPU. |  * @cpu_id:	Platform-specific way of identifying the CPU. | ||||||
|  |  * @ucode_version: Microcode version, if CPU_FEAT_UCODE is set | ||||||
|  */ |  */ | ||||||
| struct cpu_platdata { | struct cpu_platdata { | ||||||
| 	int cpu_id; | 	int cpu_id; | ||||||
|  | 	int ucode_version; | ||||||
|  | 	ulong device_id; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /* CPU features - mostly just a placeholder for now */ | /* CPU features - mostly just a placeholder for now */ | ||||||
| enum { | enum { | ||||||
| 	CPU_FEAT_L1_CACHE	= 0,	/* Supports level 1 cache */ | 	CPU_FEAT_L1_CACHE	= 0,	/* Supports level 1 cache */ | ||||||
| 	CPU_FEAT_MMU		= 1,	/* Supports virtual memory */ | 	CPU_FEAT_MMU		= 1,	/* Supports virtual memory */ | ||||||
|  | 	CPU_FEAT_UCODE		= 2,	/* Requires/uses microcode */ | ||||||
|  | 	CPU_FEAT_DEVICE_ID	= 3,	/* Provides a device ID */ | ||||||
| 
 | 
 | ||||||
| 	CPU_FEAT_COUNT, | 	CPU_FEAT_COUNT, | ||||||
| }; | }; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue