From 410506b47cda79f2e4ad7307d5d31d43a2ae2d16 Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Thu, 30 Oct 2025 11:59:09 -0500 Subject: [PATCH] Makefile.mk: Print all FMAP region sizes in hexadecimal format The generated build/fmap.fmd file was displaying region sizes and offsets in a mix of decimal and hexadecimal formats, making it harder to read and compare values. This change ensures all numeric values are consistently printed in hexadecimal. The conversion to hex is done in two places: 1. For conditional FMAP entries (MRC_CACHE, SMMSTORE, SPD_CACHE, VPD, HSPHY_FW, CONSOLE), the _tohex conversion is applied at entry definition time. This is necessary because these entries may be empty when their respective CONFIG options are disabled, and the conditional logic happens before the sed substitution. 2. For unconditional values (ROM_SIZE, BIOS_BASE, BIOS_SIZE, FMAP_BASE, CBFS_BASE, CBFS_SIZE), the _tohex conversion is applied directly in the sed command when generating fmap.fmd. This keeps the base variables in decimal form for continued use in arithmetic operations. All internal calculations continue to use decimal values. Only the final output strings that are written to fmap.fmd are converted to hex format. Before: SI_BIOS@29032448 4521984 { SMMSTORE@65536 0x40000 RW_SPD_CACHE@327680 4096 After: SI_BIOS@0x1bb0000 0x450000 { SMMSTORE@0x10000 0x40000 RW_SPD_CACHE@0x50000 0x1000 Change-Id: I48cc39b430943cb4923955b5e3d64ad6dd24a6cf Signed-off-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/89836 Reviewed-by: Paul Menzel Reviewed-by: Marc Jones Tested-by: build bot (Jenkins) Reviewed-by: Martin L Roth --- Makefile.mk | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Makefile.mk b/Makefile.mk index e28e4f800d..abc804e99a 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -1112,7 +1112,7 @@ FMAP_CURRENT_BASE := 0 ifeq ($(CONFIG_CONSOLE_SPI_FLASH),y) FMAP_CONSOLE_BASE := $(FMAP_CURRENT_BASE) FMAP_CONSOLE_SIZE := $(CONFIG_CONSOLE_SPI_FLASH_BUFFER_SIZE) -FMAP_CONSOLE_ENTRY := CONSOLE@$(FMAP_CONSOLE_BASE) $(FMAP_CONSOLE_SIZE) +FMAP_CONSOLE_ENTRY := CONSOLE@$(call _tohex,$(FMAP_CONSOLE_BASE)) $(call _tohex,$(FMAP_CONSOLE_SIZE)) FMAP_CURRENT_BASE := $(call int-add, $(FMAP_CONSOLE_BASE) $(FMAP_CONSOLE_SIZE)) else FMAP_CONSOLE_ENTRY := @@ -1121,7 +1121,7 @@ endif ifeq ($(CONFIG_CACHE_MRC_SETTINGS),y) FMAP_MRC_CACHE_BASE := $(call int-align, $(FMAP_CURRENT_BASE), 0x10000) FMAP_MRC_CACHE_SIZE := $(CONFIG_MRC_SETTINGS_CACHE_SIZE) -FMAP_MRC_CACHE_ENTRY := RW_MRC_CACHE@$(FMAP_MRC_CACHE_BASE) $(FMAP_MRC_CACHE_SIZE) +FMAP_MRC_CACHE_ENTRY := RW_MRC_CACHE@$(call _tohex,$(FMAP_MRC_CACHE_BASE)) $(call _tohex,$(FMAP_MRC_CACHE_SIZE)) FMAP_CURRENT_BASE := $(call int-add, $(FMAP_MRC_CACHE_BASE) $(FMAP_MRC_CACHE_SIZE)) else FMAP_MRC_CACHE_ENTRY := @@ -1130,7 +1130,7 @@ endif ifeq ($(CONFIG_SMMSTORE),y) FMAP_SMMSTORE_BASE := $(call int-align, $(FMAP_CURRENT_BASE), 0x10000) FMAP_SMMSTORE_SIZE := $(CONFIG_SMMSTORE_SIZE) -FMAP_SMMSTORE_ENTRY := SMMSTORE@$(FMAP_SMMSTORE_BASE) $(FMAP_SMMSTORE_SIZE) +FMAP_SMMSTORE_ENTRY := SMMSTORE@$(call _tohex,$(FMAP_SMMSTORE_BASE)) $(call _tohex,$(FMAP_SMMSTORE_SIZE)) FMAP_CURRENT_BASE := $(call int-add, $(FMAP_SMMSTORE_BASE) $(FMAP_SMMSTORE_SIZE)) else FMAP_SMMSTORE_ENTRY := @@ -1140,7 +1140,7 @@ ifeq ($(CONFIG_SPD_CACHE_IN_FMAP),y) FMAP_SPD_CACHE_BASE := $(call int-align, $(FMAP_CURRENT_BASE), 0x4000) FMAP_SPD_CACHE_SIZE := $(call int-multiply, $(CONFIG_DIMM_MAX) $(CONFIG_DIMM_SPD_SIZE)) FMAP_SPD_CACHE_SIZE := $(call int-align, $(FMAP_SPD_CACHE_SIZE), 0x1000) -FMAP_SPD_CACHE_ENTRY := $(CONFIG_SPD_CACHE_FMAP_NAME)@$(FMAP_SPD_CACHE_BASE) $(FMAP_SPD_CACHE_SIZE) +FMAP_SPD_CACHE_ENTRY := $(CONFIG_SPD_CACHE_FMAP_NAME)@$(call _tohex,$(FMAP_SPD_CACHE_BASE)) $(call _tohex,$(FMAP_SPD_CACHE_SIZE)) FMAP_CURRENT_BASE := $(call int-add, $(FMAP_SPD_CACHE_BASE) $(FMAP_SPD_CACHE_SIZE)) else FMAP_SPD_CACHE_ENTRY := @@ -1149,7 +1149,7 @@ endif ifeq ($(CONFIG_VPD),y) FMAP_VPD_BASE := $(call int-align, $(FMAP_CURRENT_BASE), 0x4000) FMAP_VPD_SIZE := $(CONFIG_VPD_FMAP_SIZE) -FMAP_VPD_ENTRY := $(CONFIG_VPD_FMAP_NAME)@$(FMAP_VPD_BASE) $(FMAP_VPD_SIZE) +FMAP_VPD_ENTRY := $(CONFIG_VPD_FMAP_NAME)@$(call _tohex,$(FMAP_VPD_BASE)) $(call _tohex,$(FMAP_VPD_SIZE)) FMAP_CURRENT_BASE := $(call int-add, $(FMAP_VPD_BASE) $(FMAP_VPD_SIZE)) else FMAP_VPD_ENTRY := @@ -1158,7 +1158,7 @@ endif ifeq ($(CONFIG_INCLUDE_HSPHY_IN_FMAP),y) FMAP_HSPHY_FW_BASE := $(call int-align, $(FMAP_CURRENT_BASE), 0x1000) FMAP_HSPHY_FW_SIZE := $(CONFIG_HSPHY_FW_MAX_SIZE) -FMAP_HSPHY_FW_ENTRY := HSPHY_FW@$(FMAP_HSPHY_FW_BASE) $(FMAP_HSPHY_FW_SIZE) +FMAP_HSPHY_FW_ENTRY := HSPHY_FW@$(call _tohex,$(FMAP_HSPHY_FW_BASE)) $(call _tohex,$(FMAP_HSPHY_FW_SIZE)) FMAP_CURRENT_BASE := $(call int-add, $(FMAP_HSPHY_FW_BASE) $(FMAP_HSPHY_FW_SIZE)) else FMAP_HSPHY_FW_ENTRY := @@ -1200,7 +1200,7 @@ FMAP_CURRENT_BASE := $(call int-add, $(FMAP_FMAP_BASE) $(FMAP_FMAP_SIZE)) ifeq ($(CONFIG_CONSOLE_SPI_FLASH),y) FMAP_CONSOLE_BASE := $(FMAP_CURRENT_BASE) FMAP_CONSOLE_SIZE := $(CONFIG_CONSOLE_SPI_FLASH_BUFFER_SIZE) -FMAP_CONSOLE_ENTRY := CONSOLE@$(FMAP_CONSOLE_BASE) $(FMAP_CONSOLE_SIZE) +FMAP_CONSOLE_ENTRY := CONSOLE@$(call _tohex,$(FMAP_CONSOLE_BASE)) $(call _tohex,$(FMAP_CONSOLE_SIZE)) FMAP_CURRENT_BASE := $(call int-add, $(FMAP_CONSOLE_BASE) $(FMAP_CONSOLE_SIZE)) else FMAP_CONSOLE_ENTRY := @@ -1213,7 +1213,7 @@ endif ifeq ($(CONFIG_CACHE_MRC_SETTINGS),y) FMAP_MRC_CACHE_BASE := $(call int-align, $(FMAP_CURRENT_BASE), 0x10000) FMAP_MRC_CACHE_SIZE := $(CONFIG_MRC_SETTINGS_CACHE_SIZE) -FMAP_MRC_CACHE_ENTRY := RW_MRC_CACHE@$(FMAP_MRC_CACHE_BASE) $(FMAP_MRC_CACHE_SIZE) +FMAP_MRC_CACHE_ENTRY := RW_MRC_CACHE@$(call _tohex,$(FMAP_MRC_CACHE_BASE)) $(call _tohex,$(FMAP_MRC_CACHE_SIZE)) FMAP_CURRENT_BASE := $(call int-add, $(FMAP_MRC_CACHE_BASE) $(FMAP_MRC_CACHE_SIZE)) else FMAP_MRC_CACHE_ENTRY := @@ -1229,10 +1229,10 @@ FMAP_CBFS_SIZE := $(call int-subtract,$(FMAP_BIOS_SIZE) $(FMAP_CBFS_BASE)) endif # ifeq ($(CONFIG_ARCH_X86),y) $(obj)/fmap.fmd: $(top)/Makefile.mk $(DEFAULT_FLASHMAP) $(obj)/config.h - sed -e "s,##ROM_SIZE##,$(FMAP_ROM_SIZE)," \ - -e "s,##BIOS_BASE##,$(FMAP_BIOS_BASE)," \ - -e "s,##BIOS_SIZE##,$(FMAP_BIOS_SIZE)," \ - -e "s,##FMAP_BASE##,$(FMAP_FMAP_BASE)," \ + sed -e "s,##ROM_SIZE##,$(call _tohex,$(FMAP_ROM_SIZE))," \ + -e "s,##BIOS_BASE##,$(call _tohex,$(FMAP_BIOS_BASE))," \ + -e "s,##BIOS_SIZE##,$(call _tohex,$(FMAP_BIOS_SIZE))," \ + -e "s,##FMAP_BASE##,$(call _tohex,$(FMAP_FMAP_BASE))," \ -e "s,##FMAP_SIZE##,$(FMAP_FMAP_SIZE)," \ -e "s,##CONSOLE_ENTRY##,$(FMAP_CONSOLE_ENTRY)," \ -e "s,##MRC_CACHE_ENTRY##,$(FMAP_MRC_CACHE_ENTRY)," \ @@ -1240,8 +1240,8 @@ $(obj)/fmap.fmd: $(top)/Makefile.mk $(DEFAULT_FLASHMAP) $(obj)/config.h -e "s,##SPD_CACHE_ENTRY##,$(FMAP_SPD_CACHE_ENTRY)," \ -e "s,##VPD_ENTRY##,$(FMAP_VPD_ENTRY)," \ -e "s,##HSPHY_FW_ENTRY##,$(FMAP_HSPHY_FW_ENTRY)," \ - -e "s,##CBFS_BASE##,$(FMAP_CBFS_BASE)," \ - -e "s,##CBFS_SIZE##,$(FMAP_CBFS_SIZE)," \ + -e "s,##CBFS_BASE##,$(call _tohex,$(FMAP_CBFS_BASE))," \ + -e "s,##CBFS_SIZE##,$(call _tohex,$(FMAP_CBFS_SIZE))," \ $(DEFAULT_FLASHMAP) > $@.tmp mv $@.tmp $@ else # ifeq ($(CONFIG_FMDFILE),)