@@ -2722,7 +2722,7 @@ static void dmi_memory_device_width(const char *attr, u16 code)
2722
2722
/*
2723
2723
* If no memory module is present, width may be 0
2724
2724
*/
2725
- if (code == 0xFFFF || code == 0 )
2725
+ if (code == 0xFFFF || ( code == 0 && !( opt . flags & FLAG_NO_QUIRKS )) )
2726
2726
pr_attr (attr , "Unknown" );
2727
2727
else
2728
2728
pr_attr (attr , "%u bits" , code );
@@ -4720,7 +4720,7 @@ static void dmi_decode(const struct dmi_header *h, u16 ver)
4720
4720
dmi_memory_device_type_detail (WORD (data + 0x13 ));
4721
4721
if (h -> length < 0x17 ) break ;
4722
4722
/* If no module is present, the remaining fields are irrelevant */
4723
- if (WORD (data + 0x0C ) == 0 )
4723
+ if (WORD (data + 0x0C ) == 0 && !( opt . flags & FLAG_NO_QUIRKS ) )
4724
4724
break ;
4725
4725
dmi_memory_device_speed ("Speed" , WORD (data + 0x15 ),
4726
4726
h -> length >= 0x5C ?
@@ -5544,7 +5544,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
5544
5544
}
5545
5545
5546
5546
/* Fixup a common mistake */
5547
- if (h .type == 34 )
5547
+ if (h .type == 34 && !( opt . flags & FLAG_NO_QUIRKS ) )
5548
5548
dmi_fixup_type_34 (& h , display );
5549
5549
5550
5550
if (display )
@@ -5735,6 +5735,29 @@ static int smbios3_decode(u8 *buf, const char *devmem, u32 flags)
5735
5735
return 1 ;
5736
5736
}
5737
5737
5738
+ static void dmi_fixup_version (u16 * ver )
5739
+ {
5740
+ /* Some BIOS report weird SMBIOS version, fix that up */
5741
+ switch (* ver )
5742
+ {
5743
+ case 0x021F :
5744
+ case 0x0221 :
5745
+ if (!(opt .flags & FLAG_QUIET ))
5746
+ fprintf (stderr ,
5747
+ "SMBIOS version fixup (2.%d -> 2.%d).\n" ,
5748
+ * ver & 0xFF , 3 );
5749
+ * ver = 0x0203 ;
5750
+ break ;
5751
+ case 0x0233 :
5752
+ if (!(opt .flags & FLAG_QUIET ))
5753
+ fprintf (stderr ,
5754
+ "SMBIOS version fixup (2.%d -> 2.%d).\n" ,
5755
+ 51 , 6 );
5756
+ * ver = 0x0206 ;
5757
+ break ;
5758
+ }
5759
+ }
5760
+
5738
5761
static int smbios_decode (u8 * buf , const char * devmem , u32 flags )
5739
5762
{
5740
5763
u16 ver ;
@@ -5759,25 +5782,8 @@ static int smbios_decode(u8 *buf, const char *devmem, u32 flags)
5759
5782
return 0 ;
5760
5783
5761
5784
ver = (buf [0x06 ] << 8 ) + buf [0x07 ];
5762
- /* Some BIOS report weird SMBIOS version, fix that up */
5763
- switch (ver )
5764
- {
5765
- case 0x021F :
5766
- case 0x0221 :
5767
- if (!(opt .flags & FLAG_QUIET ))
5768
- fprintf (stderr ,
5769
- "SMBIOS version fixup (2.%d -> 2.%d).\n" ,
5770
- ver & 0xFF , 3 );
5771
- ver = 0x0203 ;
5772
- break ;
5773
- case 0x0233 :
5774
- if (!(opt .flags & FLAG_QUIET ))
5775
- fprintf (stderr ,
5776
- "SMBIOS version fixup (2.%d -> 2.%d).\n" ,
5777
- 51 , 6 );
5778
- ver = 0x0206 ;
5779
- break ;
5780
- }
5785
+ if (!(opt .flags & FLAG_NO_QUIRKS ))
5786
+ dmi_fixup_version (& ver );
5781
5787
if (!(opt .flags & FLAG_QUIET ))
5782
5788
pr_info ("SMBIOS %u.%u present." ,
5783
5789
ver >> 8 , ver & 0xFF );
0 commit comments