arch/x86/smbios.c: Factor out switch-case block
Most of `smbios_fill_dimm_manufacturer_from_id()` is noise. Factor the switch into its own function to improve readability. Change-Id: Ia0757c01572709d16589a4ed622ca2d2cb69dda2 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44022 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
parent
3c13da7897
commit
9630ced250
|
@ -157,56 +157,52 @@ static int smbios_processor_name(u8 *start)
|
||||||
return smbios_add_string(start, str);
|
return smbios_add_string(start, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this function will fill the corresponding manufacturer */
|
static const char *get_dimm_manufacturer_name(const uint16_t mod_id)
|
||||||
void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id, struct smbios_type17 *t)
|
|
||||||
{
|
{
|
||||||
switch (mod_id) {
|
switch (mod_id) {
|
||||||
case 0x9b85:
|
case 0x9b85:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Crucial");
|
return "Crucial";
|
||||||
break;
|
|
||||||
case 0x4304:
|
case 0x4304:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Ramaxel");
|
return "Ramaxel";
|
||||||
break;
|
|
||||||
case 0x4f01:
|
case 0x4f01:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Transcend");
|
return "Transcend";
|
||||||
break;
|
|
||||||
case 0x9801:
|
case 0x9801:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Kingston");
|
return "Kingston";
|
||||||
break;
|
|
||||||
case 0x987f:
|
case 0x987f:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Hynix");
|
return "Hynix";
|
||||||
break;
|
|
||||||
case 0x9e02:
|
case 0x9e02:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Corsair");
|
return "Corsair";
|
||||||
break;
|
|
||||||
case 0xb004:
|
case 0xb004:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "OCZ");
|
return "OCZ";
|
||||||
break;
|
|
||||||
case 0xad80:
|
case 0xad80:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Hynix/Hyundai");
|
return "Hynix/Hyundai";
|
||||||
break;
|
|
||||||
case 0x3486:
|
case 0x3486:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Super Talent");
|
return "Super Talent";
|
||||||
break;
|
|
||||||
case 0xcd04:
|
case 0xcd04:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "GSkill");
|
return "GSkill";
|
||||||
break;
|
|
||||||
case 0xce80:
|
case 0xce80:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Samsung");
|
return "Samsung";
|
||||||
break;
|
|
||||||
case 0xfe02:
|
case 0xfe02:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Elpida");
|
return "Elpida";
|
||||||
break;
|
|
||||||
case 0x2c80:
|
case 0x2c80:
|
||||||
t->manufacturer = smbios_add_string(t->eos, "Micron");
|
return "Micron";
|
||||||
break;
|
default:
|
||||||
default: {
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this function will fill the corresponding manufacturer */
|
||||||
|
void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id, struct smbios_type17 *t)
|
||||||
|
{
|
||||||
|
const char *const manufacturer = get_dimm_manufacturer_name(mod_id);
|
||||||
|
|
||||||
|
if (manufacturer) {
|
||||||
|
t->manufacturer = smbios_add_string(t->eos, manufacturer);
|
||||||
|
} else {
|
||||||
char string_buffer[256];
|
char string_buffer[256];
|
||||||
|
|
||||||
snprintf(string_buffer, sizeof(string_buffer), "Unknown (%x)", mod_id);
|
snprintf(string_buffer, sizeof(string_buffer), "Unknown (%x)", mod_id);
|
||||||
t->manufacturer = smbios_add_string(t->eos, string_buffer);
|
t->manufacturer = smbios_add_string(t->eos, string_buffer);
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* this function will fill the corresponding locator */
|
/* this function will fill the corresponding locator */
|
||||||
|
|
Loading…
Reference in New Issue