arch/x86/smbios.c: Clean up cosmetics
Put `__weak` at the beginning of functions and reflow lines to leverage the increased line width of 96 characters. Tested with BUILD_TIMELESS=1, Asrock B85M Pro4 does not change. Change-Id: I3a5fd2d4344b83e09f89053c083ec80aa297061e Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/44020 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
parent
42609d807b
commit
bf2f91c87c
|
@ -73,7 +73,6 @@ static u8 smbios_get_device_type_from_dev(struct device *dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int smbios_add_string(u8 *start, const char *str)
|
int smbios_add_string(u8 *start, const char *str)
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
@ -159,76 +158,59 @@ static int smbios_processor_name(u8 *start)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this function will fill the corresponding manufacturer */
|
/* this function will fill the corresponding manufacturer */
|
||||||
void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id,
|
void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id, struct smbios_type17 *t)
|
||||||
struct smbios_type17 *t)
|
|
||||||
{
|
{
|
||||||
switch (mod_id) {
|
switch (mod_id) {
|
||||||
case 0x9b85:
|
case 0x9b85:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Crucial");
|
||||||
"Crucial");
|
|
||||||
break;
|
break;
|
||||||
case 0x4304:
|
case 0x4304:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Ramaxel");
|
||||||
"Ramaxel");
|
|
||||||
break;
|
break;
|
||||||
case 0x4f01:
|
case 0x4f01:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Transcend");
|
||||||
"Transcend");
|
|
||||||
break;
|
break;
|
||||||
case 0x9801:
|
case 0x9801:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Kingston");
|
||||||
"Kingston");
|
|
||||||
break;
|
break;
|
||||||
case 0x987f:
|
case 0x987f:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Hynix");
|
||||||
"Hynix");
|
|
||||||
break;
|
break;
|
||||||
case 0x9e02:
|
case 0x9e02:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Corsair");
|
||||||
"Corsair");
|
|
||||||
break;
|
break;
|
||||||
case 0xb004:
|
case 0xb004:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "OCZ");
|
||||||
"OCZ");
|
|
||||||
break;
|
break;
|
||||||
case 0xad80:
|
case 0xad80:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Hynix/Hyundai");
|
||||||
"Hynix/Hyundai");
|
|
||||||
break;
|
break;
|
||||||
case 0x3486:
|
case 0x3486:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Super Talent");
|
||||||
"Super Talent");
|
|
||||||
break;
|
break;
|
||||||
case 0xcd04:
|
case 0xcd04:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "GSkill");
|
||||||
"GSkill");
|
|
||||||
break;
|
break;
|
||||||
case 0xce80:
|
case 0xce80:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Samsung");
|
||||||
"Samsung");
|
|
||||||
break;
|
break;
|
||||||
case 0xfe02:
|
case 0xfe02:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Elpida");
|
||||||
"Elpida");
|
|
||||||
break;
|
break;
|
||||||
case 0x2c80:
|
case 0x2c80:
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, "Micron");
|
||||||
"Micron");
|
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
char string_buffer[256];
|
char string_buffer[256];
|
||||||
|
|
||||||
snprintf(string_buffer, sizeof(string_buffer),
|
snprintf(string_buffer, sizeof(string_buffer), "Unknown (%x)", mod_id);
|
||||||
"Unknown (%x)", mod_id);
|
t->manufacturer = smbios_add_string(t->eos, string_buffer);
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
|
||||||
string_buffer);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* this function will fill the corresponding locator */
|
/* this function will fill the corresponding locator */
|
||||||
void __weak smbios_fill_dimm_locator(const struct dimm_info *dimm,
|
__weak void smbios_fill_dimm_locator(const struct dimm_info *dimm, struct smbios_type17 *t)
|
||||||
struct smbios_type17 *t)
|
|
||||||
{
|
{
|
||||||
char locator[40];
|
char locator[40];
|
||||||
|
|
||||||
|
@ -256,8 +238,7 @@ static void trim_trailing_whitespace(char *buffer, size_t buffer_size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This function will fill the corresponding part number */
|
/** This function will fill the corresponding part number */
|
||||||
static void smbios_fill_dimm_part_number(const char *part_number,
|
static void smbios_fill_dimm_part_number(const char *part_number, struct smbios_type17 *t)
|
||||||
struct smbios_type17 *t)
|
|
||||||
{
|
{
|
||||||
int invalid;
|
int invalid;
|
||||||
size_t i, len;
|
size_t i, len;
|
||||||
|
@ -303,8 +284,7 @@ static void smbios_fill_dimm_serial_number(const struct dimm_info *dimm,
|
||||||
char serial[9];
|
char serial[9];
|
||||||
|
|
||||||
snprintf(serial, sizeof(serial), "%02hhx%02hhx%02hhx%02hhx",
|
snprintf(serial, sizeof(serial), "%02hhx%02hhx%02hhx%02hhx",
|
||||||
dimm->serial[0], dimm->serial[1], dimm->serial[2],
|
dimm->serial[0], dimm->serial[1], dimm->serial[2], dimm->serial[3]);
|
||||||
dimm->serial[3]);
|
|
||||||
|
|
||||||
t->serial_number = smbios_add_string(t->eos, serial);
|
t->serial_number = smbios_add_string(t->eos, serial);
|
||||||
}
|
}
|
||||||
|
@ -428,7 +408,7 @@ static const char *get_bios_version(void)
|
||||||
return coreboot_version;
|
return coreboot_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_mainboard_bios_version(void)
|
__weak const char *smbios_mainboard_bios_version(void)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -457,8 +437,7 @@ static int smbios_write_type0(unsigned long *current, int handle)
|
||||||
t->bios_rom_size = (rom_size / 65535) - 1;
|
t->bios_rom_size = (rom_size / 65535) - 1;
|
||||||
|
|
||||||
if (CONFIG_ROM_SIZE >= 1 * GiB) {
|
if (CONFIG_ROM_SIZE >= 1 * GiB) {
|
||||||
t->extended_bios_rom_size =
|
t->extended_bios_rom_size = DIV_ROUND_UP(CONFIG_ROM_SIZE, GiB) | (1 << 14);
|
||||||
DIV_ROUND_UP(CONFIG_ROM_SIZE, GiB) | (1 << 14);
|
|
||||||
} else {
|
} else {
|
||||||
t->extended_bios_rom_size = DIV_ROUND_UP(CONFIG_ROM_SIZE, MiB);
|
t->extended_bios_rom_size = DIV_ROUND_UP(CONFIG_ROM_SIZE, MiB);
|
||||||
}
|
}
|
||||||
|
@ -483,42 +462,42 @@ static int smbios_write_type0(unsigned long *current, int handle)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_mainboard_serial_number(void)
|
__weak const char *smbios_mainboard_serial_number(void)
|
||||||
{
|
{
|
||||||
return CONFIG_MAINBOARD_SERIAL_NUMBER;
|
return CONFIG_MAINBOARD_SERIAL_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_mainboard_version(void)
|
__weak const char *smbios_mainboard_version(void)
|
||||||
{
|
{
|
||||||
return CONFIG_MAINBOARD_VERSION;
|
return CONFIG_MAINBOARD_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_mainboard_manufacturer(void)
|
__weak const char *smbios_mainboard_manufacturer(void)
|
||||||
{
|
{
|
||||||
return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER;
|
return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_mainboard_product_name(void)
|
__weak const char *smbios_mainboard_product_name(void)
|
||||||
{
|
{
|
||||||
return CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME;
|
return CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_mainboard_asset_tag(void)
|
__weak const char *smbios_mainboard_asset_tag(void)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 __weak smbios_mainboard_feature_flags(void)
|
__weak u8 smbios_mainboard_feature_flags(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_mainboard_location_in_chassis(void)
|
__weak const char *smbios_mainboard_location_in_chassis(void)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
smbios_board_type __weak smbios_mainboard_board_type(void)
|
__weak smbios_board_type smbios_mainboard_board_type(void)
|
||||||
{
|
{
|
||||||
return SMBIOS_BOARD_TYPE_UNKNOWN;
|
return SMBIOS_BOARD_TYPE_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -529,7 +508,7 @@ smbios_board_type __weak smbios_mainboard_board_type(void)
|
||||||
* convertible, or tablet enclosure will be used if the appropriate
|
* convertible, or tablet enclosure will be used if the appropriate
|
||||||
* system type is selected.
|
* system type is selected.
|
||||||
*/
|
*/
|
||||||
smbios_enclosure_type __weak smbios_mainboard_enclosure_type(void)
|
__weak smbios_enclosure_type smbios_mainboard_enclosure_type(void)
|
||||||
{
|
{
|
||||||
if (CONFIG(SYSTEM_TYPE_LAPTOP))
|
if (CONFIG(SYSTEM_TYPE_LAPTOP))
|
||||||
return SMBIOS_ENCLOSURE_LAPTOP;
|
return SMBIOS_ENCLOSURE_LAPTOP;
|
||||||
|
@ -543,57 +522,57 @@ smbios_enclosure_type __weak smbios_mainboard_enclosure_type(void)
|
||||||
return SMBIOS_ENCLOSURE_DESKTOP;
|
return SMBIOS_ENCLOSURE_DESKTOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_system_serial_number(void)
|
__weak const char *smbios_system_serial_number(void)
|
||||||
{
|
{
|
||||||
return smbios_mainboard_serial_number();
|
return smbios_mainboard_serial_number();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_system_version(void)
|
__weak const char *smbios_system_version(void)
|
||||||
{
|
{
|
||||||
return smbios_mainboard_version();
|
return smbios_mainboard_version();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_system_manufacturer(void)
|
__weak const char *smbios_system_manufacturer(void)
|
||||||
{
|
{
|
||||||
return smbios_mainboard_manufacturer();
|
return smbios_mainboard_manufacturer();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_system_product_name(void)
|
__weak const char *smbios_system_product_name(void)
|
||||||
{
|
{
|
||||||
return smbios_mainboard_product_name();
|
return smbios_mainboard_product_name();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __weak smbios_system_set_uuid(u8 *uuid)
|
__weak void smbios_system_set_uuid(u8 *uuid)
|
||||||
{
|
{
|
||||||
/* leave all zero */
|
/* leave all zero */
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int __weak smbios_cpu_get_max_speed_mhz(void)
|
__weak unsigned int smbios_cpu_get_max_speed_mhz(void)
|
||||||
{
|
{
|
||||||
return 0; /* Unknown */
|
return 0; /* Unknown */
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int __weak smbios_cpu_get_current_speed_mhz(void)
|
__weak unsigned int smbios_cpu_get_current_speed_mhz(void)
|
||||||
{
|
{
|
||||||
return 0; /* Unknown */
|
return 0; /* Unknown */
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *__weak smbios_system_sku(void)
|
__weak const char *smbios_system_sku(void)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * __weak smbios_chassis_version(void)
|
__weak const char *smbios_chassis_version(void)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * __weak smbios_chassis_serial_number(void)
|
__weak const char *smbios_chassis_serial_number(void)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * __weak smbios_processor_serial_number(void)
|
__weak const char *smbios_processor_serial_number(void)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -619,12 +598,9 @@ static int smbios_write_type1(unsigned long *current, int handle)
|
||||||
t->type = SMBIOS_SYSTEM_INFORMATION;
|
t->type = SMBIOS_SYSTEM_INFORMATION;
|
||||||
t->handle = handle;
|
t->handle = handle;
|
||||||
t->length = len - 2;
|
t->length = len - 2;
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, smbios_system_manufacturer());
|
||||||
smbios_system_manufacturer());
|
t->product_name = smbios_add_string(t->eos, smbios_system_product_name());
|
||||||
t->product_name = smbios_add_string(t->eos,
|
t->serial_number = smbios_add_string(t->eos, smbios_system_serial_number());
|
||||||
smbios_system_product_name());
|
|
||||||
t->serial_number = smbios_add_string(t->eos,
|
|
||||||
smbios_system_serial_number());
|
|
||||||
t->sku = smbios_add_string(t->eos, smbios_system_sku());
|
t->sku = smbios_add_string(t->eos, smbios_system_sku());
|
||||||
t->version = smbios_add_string(t->eos, smbios_system_version());
|
t->version = smbios_add_string(t->eos, smbios_system_version());
|
||||||
#ifdef CONFIG_MAINBOARD_FAMILY
|
#ifdef CONFIG_MAINBOARD_FAMILY
|
||||||
|
@ -636,8 +612,7 @@ static int smbios_write_type1(unsigned long *current, int handle)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smbios_write_type2(unsigned long *current, int handle,
|
static int smbios_write_type2(unsigned long *current, int handle, const int chassis_handle)
|
||||||
const int chassis_handle)
|
|
||||||
{
|
{
|
||||||
struct smbios_type2 *t = (struct smbios_type2 *)*current;
|
struct smbios_type2 *t = (struct smbios_type2 *)*current;
|
||||||
int len = sizeof(struct smbios_type2);
|
int len = sizeof(struct smbios_type2);
|
||||||
|
@ -646,12 +621,9 @@ static int smbios_write_type2(unsigned long *current, int handle,
|
||||||
t->type = SMBIOS_BOARD_INFORMATION;
|
t->type = SMBIOS_BOARD_INFORMATION;
|
||||||
t->handle = handle;
|
t->handle = handle;
|
||||||
t->length = len - 2;
|
t->length = len - 2;
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, smbios_mainboard_manufacturer());
|
||||||
smbios_mainboard_manufacturer());
|
t->product_name = smbios_add_string(t->eos, smbios_mainboard_product_name());
|
||||||
t->product_name = smbios_add_string(t->eos,
|
t->serial_number = smbios_add_string(t->eos, smbios_mainboard_serial_number());
|
||||||
smbios_mainboard_product_name());
|
|
||||||
t->serial_number = smbios_add_string(t->eos,
|
|
||||||
smbios_mainboard_serial_number());
|
|
||||||
t->version = smbios_add_string(t->eos, smbios_mainboard_version());
|
t->version = smbios_add_string(t->eos, smbios_mainboard_version());
|
||||||
t->asset_tag = smbios_add_string(t->eos, smbios_mainboard_asset_tag());
|
t->asset_tag = smbios_add_string(t->eos, smbios_mainboard_asset_tag());
|
||||||
t->feature_flags = smbios_mainboard_feature_flags();
|
t->feature_flags = smbios_mainboard_feature_flags();
|
||||||
|
@ -673,8 +645,7 @@ static int smbios_write_type3(unsigned long *current, int handle)
|
||||||
t->type = SMBIOS_SYSTEM_ENCLOSURE;
|
t->type = SMBIOS_SYSTEM_ENCLOSURE;
|
||||||
t->handle = handle;
|
t->handle = handle;
|
||||||
t->length = len - 2;
|
t->length = len - 2;
|
||||||
t->manufacturer = smbios_add_string(t->eos,
|
t->manufacturer = smbios_add_string(t->eos, smbios_system_manufacturer());
|
||||||
smbios_system_manufacturer());
|
|
||||||
t->bootup_state = SMBIOS_STATE_SAFE;
|
t->bootup_state = SMBIOS_STATE_SAFE;
|
||||||
t->power_supply_state = SMBIOS_STATE_SAFE;
|
t->power_supply_state = SMBIOS_STATE_SAFE;
|
||||||
t->thermal_state = SMBIOS_STATE_SAFE;
|
t->thermal_state = SMBIOS_STATE_SAFE;
|
||||||
|
@ -742,8 +713,7 @@ static int smbios_write_type4(unsigned long *current, int handle)
|
||||||
t->l2_cache_handle = 0xffff;
|
t->l2_cache_handle = 0xffff;
|
||||||
t->l3_cache_handle = 0xffff;
|
t->l3_cache_handle = 0xffff;
|
||||||
t->serial_number = smbios_add_string(t->eos, smbios_processor_serial_number());
|
t->serial_number = smbios_add_string(t->eos, smbios_processor_serial_number());
|
||||||
t->status = SMBIOS_PROCESSOR_STATUS_CPU_ENABLED |
|
t->status = SMBIOS_PROCESSOR_STATUS_CPU_ENABLED | SMBIOS_PROCESSOR_STATUS_POPULATED;
|
||||||
SMBIOS_PROCESSOR_STATUS_POPULATED;
|
|
||||||
t->processor_upgrade = get_socket_type();
|
t->processor_upgrade = get_socket_type();
|
||||||
len = t->length + smbios_string_table_len(t->eos);
|
len = t->length + smbios_string_table_len(t->eos);
|
||||||
if (cpu_have_cpuid() && cpuid_get_max_func() >= 0x16) {
|
if (cpu_have_cpuid() && cpuid_get_max_func() >= 0x16) {
|
||||||
|
@ -762,15 +732,14 @@ static int smbios_write_type4(unsigned long *current, int handle)
|
||||||
* Fill in some fields with constant values, as gathering the information
|
* Fill in some fields with constant values, as gathering the information
|
||||||
* from CPUID is impossible.
|
* from CPUID is impossible.
|
||||||
*/
|
*/
|
||||||
static int
|
static int smbios_write_type7(unsigned long *current,
|
||||||
smbios_write_type7(unsigned long *current,
|
const int handle,
|
||||||
const int handle,
|
const u8 level,
|
||||||
const u8 level,
|
const u8 sram_type,
|
||||||
const u8 sram_type,
|
const enum smbios_cache_associativity associativity,
|
||||||
const enum smbios_cache_associativity associativity,
|
const enum smbios_cache_type type,
|
||||||
const enum smbios_cache_type type,
|
const size_t max_cache_size,
|
||||||
const size_t max_cache_size,
|
const size_t cache_size)
|
||||||
const size_t cache_size)
|
|
||||||
{
|
{
|
||||||
struct smbios_type7 *t = (struct smbios_type7 *)*current;
|
struct smbios_type7 *t = (struct smbios_type7 *)*current;
|
||||||
int len = sizeof(struct smbios_type7);
|
int len = sizeof(struct smbios_type7);
|
||||||
|
@ -837,8 +806,7 @@ smbios_write_type7(unsigned long *current,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert the associativity as integer to the SMBIOS enum if available */
|
/* Convert the associativity as integer to the SMBIOS enum if available */
|
||||||
static enum smbios_cache_associativity
|
static enum smbios_cache_associativity smbios_cache_associativity(const u8 num)
|
||||||
smbios_cache_associativity(const u8 num)
|
|
||||||
{
|
{
|
||||||
switch (num) {
|
switch (num) {
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -924,8 +892,7 @@ static int smbios_write_type7_cache_parameters(unsigned long *current,
|
||||||
const size_t partitions = CPUID_CACHE_PHYS_LINE(res) + 1;
|
const size_t partitions = CPUID_CACHE_PHYS_LINE(res) + 1;
|
||||||
const size_t cache_line_size = CPUID_CACHE_COHER_LINE(res) + 1;
|
const size_t cache_line_size = CPUID_CACHE_COHER_LINE(res) + 1;
|
||||||
const size_t number_of_sets = CPUID_CACHE_NO_OF_SETS(res) + 1;
|
const size_t number_of_sets = CPUID_CACHE_NO_OF_SETS(res) + 1;
|
||||||
const size_t cache_size = assoc * partitions * cache_line_size *
|
const size_t cache_size = assoc * partitions * cache_line_size * number_of_sets;
|
||||||
number_of_sets;
|
|
||||||
|
|
||||||
if (!cache_type)
|
if (!cache_type)
|
||||||
/* No more caches in the system */
|
/* No more caches in the system */
|
||||||
|
@ -1124,8 +1091,7 @@ static int smbios_write_type17(unsigned long *current, int *handle, int type16)
|
||||||
return 0; /* can't find mem info in cbmem */
|
return 0; /* can't find mem info in cbmem */
|
||||||
|
|
||||||
printk(BIOS_INFO, "Create SMBIOS type 17\n");
|
printk(BIOS_INFO, "Create SMBIOS type 17\n");
|
||||||
for (i = 0; i < meminfo->dimm_cnt && i < ARRAY_SIZE(meminfo->dimm);
|
for (i = 0; i < meminfo->dimm_cnt && i < ARRAY_SIZE(meminfo->dimm); i++) {
|
||||||
i++) {
|
|
||||||
struct dimm_info *dimm;
|
struct dimm_info *dimm;
|
||||||
dimm = &meminfo->dimm[i];
|
dimm = &meminfo->dimm[i];
|
||||||
/*
|
/*
|
||||||
|
@ -1272,7 +1238,7 @@ static int smbios_write_type127(unsigned long *current, int handle)
|
||||||
|
|
||||||
/* Generate Type41 entries from devicetree */
|
/* Generate Type41 entries from devicetree */
|
||||||
static int smbios_walk_device_tree_type41(struct device *dev, int *handle,
|
static int smbios_walk_device_tree_type41(struct device *dev, int *handle,
|
||||||
unsigned long *current)
|
unsigned long *current)
|
||||||
{
|
{
|
||||||
static u8 type41_inst_cnt[SMBIOS_DEVICE_TYPE_COUNT + 1] = {};
|
static u8 type41_inst_cnt[SMBIOS_DEVICE_TYPE_COUNT + 1] = {};
|
||||||
|
|
||||||
|
@ -1352,16 +1318,14 @@ static int smbios_walk_device_tree_type9(struct device *dev, int *handle,
|
||||||
dev->path.pci.devfn);
|
dev->path.pci.devfn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smbios_walk_device_tree(struct device *tree, int *handle,
|
static int smbios_walk_device_tree(struct device *tree, int *handle, unsigned long *current)
|
||||||
unsigned long *current)
|
|
||||||
{
|
{
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
for (dev = tree; dev; dev = dev->next) {
|
for (dev = tree; dev; dev = dev->next) {
|
||||||
if (dev->enabled && dev->ops && dev->ops->get_smbios_data) {
|
if (dev->enabled && dev->ops && dev->ops->get_smbios_data) {
|
||||||
printk(BIOS_INFO, "%s (%s)\n", dev_path(dev),
|
printk(BIOS_INFO, "%s (%s)\n", dev_path(dev), dev_name(dev));
|
||||||
dev_name(dev));
|
|
||||||
len += dev->ops->get_smbios_data(dev, handle, current);
|
len += dev->ops->get_smbios_data(dev, handle, current);
|
||||||
}
|
}
|
||||||
len += smbios_walk_device_tree_type9(dev, handle, current);
|
len += smbios_walk_device_tree_type9(dev, handle, current);
|
||||||
|
@ -1391,42 +1355,32 @@ unsigned long smbios_write_tables(unsigned long current)
|
||||||
current = ALIGN_UP(current, 16);
|
current = ALIGN_UP(current, 16);
|
||||||
|
|
||||||
tables = current;
|
tables = current;
|
||||||
update_max(len, max_struct_size, smbios_write_type0(¤t,
|
update_max(len, max_struct_size, smbios_write_type0(¤t, handle++));
|
||||||
handle++));
|
update_max(len, max_struct_size, smbios_write_type1(¤t, handle++));
|
||||||
update_max(len, max_struct_size, smbios_write_type1(¤t,
|
|
||||||
handle++));
|
/* The chassis handle is the next one */
|
||||||
update_max(len, max_struct_size, smbios_write_type2(¤t,
|
update_max(len, max_struct_size, smbios_write_type2(¤t, handle, handle + 1));
|
||||||
handle, handle + 1)); /* The chassis handle is the next one */
|
|
||||||
handle++;
|
handle++;
|
||||||
update_max(len, max_struct_size, smbios_write_type3(¤t,
|
update_max(len, max_struct_size, smbios_write_type3(¤t, handle++));
|
||||||
handle++));
|
|
||||||
|
|
||||||
struct smbios_type4 *type4 = (struct smbios_type4 *)current;
|
struct smbios_type4 *type4 = (struct smbios_type4 *)current;
|
||||||
update_max(len, max_struct_size, smbios_write_type4(¤t,
|
update_max(len, max_struct_size, smbios_write_type4(¤t, handle++));
|
||||||
handle++));
|
len += smbios_write_type7_cache_parameters(¤t, &handle, &max_struct_size, type4);
|
||||||
len += smbios_write_type7_cache_parameters(¤t, &handle,
|
update_max(len, max_struct_size, smbios_write_type11(¤t, &handle));
|
||||||
&max_struct_size, type4);
|
|
||||||
update_max(len, max_struct_size, smbios_write_type11(¤t,
|
|
||||||
&handle));
|
|
||||||
if (CONFIG(ELOG))
|
if (CONFIG(ELOG))
|
||||||
update_max(len, max_struct_size,
|
update_max(len, max_struct_size,
|
||||||
elog_smbios_write_type15(¤t,handle++));
|
elog_smbios_write_type15(¤t, handle++));
|
||||||
|
|
||||||
const int type16 = handle;
|
const int type16 = handle;
|
||||||
update_max(len, max_struct_size, smbios_write_type16(¤t,
|
update_max(len, max_struct_size, smbios_write_type16(¤t, &handle));
|
||||||
&handle));
|
update_max(len, max_struct_size, smbios_write_type17(¤t, &handle, type16));
|
||||||
update_max(len, max_struct_size, smbios_write_type17(¤t,
|
update_max(len, max_struct_size, smbios_write_type19(¤t, &handle));
|
||||||
&handle, type16));
|
update_max(len, max_struct_size, smbios_write_type32(¤t, handle++));
|
||||||
update_max(len, max_struct_size, smbios_write_type19(¤t,
|
|
||||||
&handle));
|
|
||||||
update_max(len, max_struct_size, smbios_write_type32(¤t,
|
|
||||||
handle++));
|
|
||||||
|
|
||||||
update_max(len, max_struct_size, smbios_walk_device_tree(all_devices,
|
update_max(len, max_struct_size, smbios_walk_device_tree(all_devices,
|
||||||
&handle, ¤t));
|
&handle, ¤t));
|
||||||
|
|
||||||
update_max(len, max_struct_size, smbios_write_type127(¤t,
|
update_max(len, max_struct_size, smbios_write_type127(¤t, handle++));
|
||||||
handle++));
|
|
||||||
|
|
||||||
/* Install SMBIOS 2.1 entry point */
|
/* Install SMBIOS 2.1 entry point */
|
||||||
memset(se, 0, sizeof(struct smbios_entry));
|
memset(se, 0, sizeof(struct smbios_entry));
|
||||||
|
@ -1442,8 +1396,7 @@ unsigned long smbios_write_tables(unsigned long current)
|
||||||
se->struct_table_length = len;
|
se->struct_table_length = len;
|
||||||
|
|
||||||
se->intermediate_checksum = smbios_checksum((u8 *)se + 0x10,
|
se->intermediate_checksum = smbios_checksum((u8 *)se + 0x10,
|
||||||
sizeof(struct smbios_entry)
|
sizeof(struct smbios_entry) - 0x10);
|
||||||
- 0x10);
|
|
||||||
se->checksum = smbios_checksum((u8 *)se, sizeof(struct smbios_entry));
|
se->checksum = smbios_checksum((u8 *)se, sizeof(struct smbios_entry));
|
||||||
|
|
||||||
/* Install SMBIOS 3.0 entry point */
|
/* Install SMBIOS 3.0 entry point */
|
||||||
|
|
Loading…
Reference in New Issue