@@ -78,12 +78,13 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
7878 u32 dummy ;
7979
8080 if (c -> x86_vendor != X86_VENDOR_AMD || c -> x86 < 0x10 ) {
81- pr_warning ("microcode: CPU%d: AMD CPU family 0x%x not "
82- "supported\n" , cpu , c -> x86 );
81+ pr_warning ("CPU%d: family %d not supported\n" , cpu , c -> x86 );
8382 return -1 ;
8483 }
84+
8585 rdmsr (MSR_AMD64_PATCH_LEVEL , csig -> rev , dummy );
86- pr_info ("CPU%d: patch_level=0x%x\n" , cpu , csig -> rev );
86+ pr_info ("CPU%d: patch_level=0x%08x\n" , cpu , csig -> rev );
87+
8788 return 0 ;
8889}
8990
@@ -113,7 +114,7 @@ static int get_matching_microcode(int cpu, struct microcode_header_amd *mc_hdr,
113114
114115 /* ucode might be chipset specific -- currently we don't support this */
115116 if (mc_hdr -> nb_dev_id || mc_hdr -> sb_dev_id ) {
116- pr_err ("CPU%d: loading of chipset specific code not yet supported\n" ,
117+ pr_err ("CPU%d: chipset specific code not yet supported\n" ,
117118 cpu );
118119 return 0 ;
119120 }
@@ -143,12 +144,12 @@ static int apply_microcode_amd(int cpu)
143144
144145 /* check current patch id and patch's id for match */
145146 if (rev != mc_amd -> hdr .patch_id ) {
146- pr_err ("CPU%d: update failed ( for patch_level=0x%x) \n" ,
147+ pr_err ("CPU%d: update failed for patch_level=0x%08x \n" ,
147148 cpu , mc_amd -> hdr .patch_id );
148149 return -1 ;
149150 }
150151
151- pr_info ("CPU%d: updated ( new patch_level=0x%x) \n" , cpu , rev );
152+ pr_info ("CPU%d: new patch_level=0x%08x \n" , cpu , rev );
152153 uci -> cpu_sig .rev = rev ;
153154
154155 return 0 ;
@@ -161,14 +162,14 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
161162 unsigned int total_size ;
162163
163164 if (buf [0 ] != UCODE_UCODE_TYPE ) {
164- pr_err ("error: invalid type field in container file section header\n" );
165+ pr_err ("invalid type field in container file section header\n" );
165166 return NULL ;
166167 }
167168
168169 total_size = buf [4 ] + (buf [5 ] << 8 );
169170
170171 if (total_size > size || total_size > UCODE_MAX_SIZE ) {
171- pr_err ("error: size mismatch\n" );
172+ pr_err ("section size mismatch\n" );
172173 return NULL ;
173174 }
174175
@@ -189,7 +190,8 @@ static int install_equiv_cpu_table(const u8 *buf)
189190 unsigned int size = ibuf [2 ];
190191
191192 if (type != UCODE_EQUIV_CPU_TABLE_TYPE || !size ) {
192- pr_err ("error: invalid type field in container file section header\n" );
193+ pr_err ("empty section/"
194+ "invalid type field in container file section header\n" );
193195 return - EINVAL ;
194196 }
195197
@@ -219,7 +221,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
219221 unsigned long offset ;
220222 const u8 * ucode_ptr = data ;
221223 void * new_mc = NULL ;
222- int new_rev = uci -> cpu_sig .rev ;
224+ unsigned int new_rev = uci -> cpu_sig .rev ;
223225 enum ucode_state state = UCODE_OK ;
224226
225227 offset = install_equiv_cpu_table (ucode_ptr );
@@ -255,8 +257,8 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
255257 if (!leftover ) {
256258 vfree (uci -> mc );
257259 uci -> mc = new_mc ;
258- pr_debug ("CPU%d update ucode to version 0x%x (from 0x%x )\n" ,
259- cpu , new_rev , uci -> cpu_sig .rev );
260+ pr_debug ("CPU%d update ucode ( 0x%08x -> 0x%08x )\n" ,
261+ cpu , uci -> cpu_sig .rev , new_rev );
260262 } else {
261263 vfree (new_mc );
262264 state = UCODE_ERROR ;
@@ -275,13 +277,13 @@ static enum ucode_state request_microcode_amd(int cpu, struct device *device)
275277 enum ucode_state ret = UCODE_NFOUND ;
276278
277279 if (request_firmware (& fw , fw_name , device )) {
278- printk ( KERN_ERR "microcode: failed to load file %s\n" , fw_name );
280+ pr_err ( " failed to load file %s\n" , fw_name );
279281 goto out ;
280282 }
281283
282284 ret = UCODE_ERROR ;
283285 if (* (u32 * )fw -> data != UCODE_MAGIC ) {
284- pr_err ("Invalid UCODE_MAGIC (0x%08x)\n" , * (u32 * )fw -> data );
286+ pr_err ("invalid magic value (0x%08x)\n" , * (u32 * )fw -> data );
285287 goto fw_release ;
286288 }
287289
0 commit comments