Lijian Zhao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32279
Change subject: smbios: Add type 17 device/bank locator override ......................................................................
smbios: Add type 17 device/bank locator override
Current SMBIOS type 17 device and bank locator string is like "Channel-x-Dimm-x" and "Bank-x", x is deciminal number. Give silicon or mainboard vendor a chance to replace with something matches with silkscreen.
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: I54f7282244cb25a05780a3cdb9d1f5405c600513 --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 17 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/79/32279/1
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index 44ff578..d71c0d5 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -203,6 +203,19 @@ } } } +/* this function will fill the corresponding locator */ +void __weak smbios_fill_dimm_locator(const struct dimm_info *dimm, + struct smbios_type17 *t) +{ + char locator[40]; + + snprintf(locator, sizeof(locator), "Channel-%d-DIMM-%d", + dimm->channel_num, dimm->dimm_num); + t->device_locator = smbios_add_string(t->eos, locator); + + snprintf(locator, sizeof(locator), "BANK %d", dimm->bank_locator); + t->bank_locator = smbios_add_string(t->eos, locator); +}
static void trim_trailing_whitespace(char *buffer, size_t buffer_size) { @@ -280,7 +293,6 @@ unsigned long *current, int *handle) { struct smbios_type17 *t = (struct smbios_type17 *)*current; - char locator[40];
memset(t, 0, sizeof(struct smbios_type17)); t->memory_type = dimm->ddr_type; @@ -316,13 +328,7 @@
smbios_fill_dimm_manufacturer_from_id(dimm->mod_id, t); smbios_fill_dimm_serial_number(dimm, t); - - snprintf(locator, sizeof(locator), "Channel-%d-DIMM-%d", - dimm->channel_num, dimm->dimm_num); - t->device_locator = smbios_add_string(t->eos, locator); - - snprintf(locator, sizeof(locator), "BANK %d", dimm->bank_locator); - t->bank_locator = smbios_add_string(t->eos, locator); + smbios_fill_dimm_locator(dimm, t);
/* put '\0' in the end of data */ dimm->module_part_number[DIMM_INFO_PART_NUMBER_SIZE - 1] = '\0'; diff --git a/src/include/smbios.h b/src/include/smbios.h index 08e6b61..5e06947 100644 --- a/src/include/smbios.h +++ b/src/include/smbios.h @@ -19,6 +19,7 @@ #define SMBIOS_H
#include <types.h> +#include <memory_info.h>
unsigned long smbios_write_tables(unsigned long start); int smbios_add_string(u8 *start, const char *str); @@ -629,6 +630,8 @@
void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id, struct smbios_type17 *t); +void smbios_fill_dimm_locator(const struct dimm_info *dimm, + struct smbios_type17 *t);
smbios_board_type smbios_mainboard_board_type(void);
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32279 )
Change subject: smbios: Add type 17 device/bank locator override ......................................................................
Patch Set 1: Code-Review+1
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32279 )
Change subject: smbios: Add type 17 device/bank locator override ......................................................................
Patch Set 1: -Code-Review
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/32279 )
Change subject: smbios: Add type 17 device/bank locator override ......................................................................
Patch Set 1: Code-Review+2
Duncan Laurie has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/32279 )
Change subject: smbios: Add type 17 device/bank locator override ......................................................................
smbios: Add type 17 device/bank locator override
Current SMBIOS type 17 device and bank locator string is like "Channel-x-Dimm-x" and "Bank-x", x is deciminal number. Give silicon or mainboard vendor a chance to replace with something matches with silkscreen.
Signed-off-by: Lijian Zhao lijian.zhao@intel.com Change-Id: I54f7282244cb25a05780a3cdb9d1f5405c600513 Reviewed-on: https://review.coreboot.org/c/coreboot/+/32279 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Duncan Laurie dlaurie@chromium.org --- M src/arch/x86/smbios.c M src/include/smbios.h 2 files changed, 17 insertions(+), 8 deletions(-)
Approvals: build bot (Jenkins): Verified Duncan Laurie: Looks good to me, approved
diff --git a/src/arch/x86/smbios.c b/src/arch/x86/smbios.c index 44ff578..d71c0d5 100644 --- a/src/arch/x86/smbios.c +++ b/src/arch/x86/smbios.c @@ -203,6 +203,19 @@ } } } +/* this function will fill the corresponding locator */ +void __weak smbios_fill_dimm_locator(const struct dimm_info *dimm, + struct smbios_type17 *t) +{ + char locator[40]; + + snprintf(locator, sizeof(locator), "Channel-%d-DIMM-%d", + dimm->channel_num, dimm->dimm_num); + t->device_locator = smbios_add_string(t->eos, locator); + + snprintf(locator, sizeof(locator), "BANK %d", dimm->bank_locator); + t->bank_locator = smbios_add_string(t->eos, locator); +}
static void trim_trailing_whitespace(char *buffer, size_t buffer_size) { @@ -280,7 +293,6 @@ unsigned long *current, int *handle) { struct smbios_type17 *t = (struct smbios_type17 *)*current; - char locator[40];
memset(t, 0, sizeof(struct smbios_type17)); t->memory_type = dimm->ddr_type; @@ -316,13 +328,7 @@
smbios_fill_dimm_manufacturer_from_id(dimm->mod_id, t); smbios_fill_dimm_serial_number(dimm, t); - - snprintf(locator, sizeof(locator), "Channel-%d-DIMM-%d", - dimm->channel_num, dimm->dimm_num); - t->device_locator = smbios_add_string(t->eos, locator); - - snprintf(locator, sizeof(locator), "BANK %d", dimm->bank_locator); - t->bank_locator = smbios_add_string(t->eos, locator); + smbios_fill_dimm_locator(dimm, t);
/* put '\0' in the end of data */ dimm->module_part_number[DIMM_INFO_PART_NUMBER_SIZE - 1] = '\0'; diff --git a/src/include/smbios.h b/src/include/smbios.h index 08e6b61..5e06947 100644 --- a/src/include/smbios.h +++ b/src/include/smbios.h @@ -19,6 +19,7 @@ #define SMBIOS_H
#include <types.h> +#include <memory_info.h>
unsigned long smbios_write_tables(unsigned long start); int smbios_add_string(u8 *start, const char *str); @@ -629,6 +630,8 @@
void smbios_fill_dimm_manufacturer_from_id(uint16_t mod_id, struct smbios_type17 *t); +void smbios_fill_dimm_locator(const struct dimm_info *dimm, + struct smbios_type17 *t);
smbios_board_type smbios_mainboard_board_type(void);