[PATCH v4 36/45] x86: Show the number of physical address bits

Simon Glass sjg at chromium.org
Mon Jun 19 13:59:51 CEST 2023


Add this information to global_data and show it with the 'bdinfo' command.
For now we use CONFIG_CPU_ADDR_BITS to control the number of bits, but
this could change if needed.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v2)

Changes in v2:
- Add new patch to show the number of physical address bits

 arch/x86/cpu/i386/cpu.c            | 2 ++
 arch/x86/include/asm/global_data.h | 1 +
 arch/x86/lib/bdinfo.c              | 1 +
 3 files changed, 4 insertions(+)

diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
index 91cd5d7c9e40..5c17d279092e 100644
--- a/arch/x86/cpu/i386/cpu.c
+++ b/arch/x86/cpu/i386/cpu.c
@@ -468,6 +468,7 @@ int x86_cpu_init_f(void)
 	if (ll_boot_init())
 		setup_cpu_features();
 	setup_identity();
+	gd->arch.phys_bits = cpu_phys_address_size();
 	setup_mtrr();
 	setup_pci_ram_top();
 
@@ -483,6 +484,7 @@ int x86_cpu_reinit_f(void)
 	long addr;
 
 	setup_identity();
+	gd->arch.phys_bits = cpu_phys_address_size();
 	setup_pci_ram_top();
 	addr = locate_coreboot_table();
 	if (addr >= 0) {
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index ea58259ad774..5b802f79d502 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -127,6 +127,7 @@ struct arch_global_data {
 	ulong table_end;		/* End address of x86 tables */
 	ulong table_start_high;		/* Start address of high x86 tables */
 	ulong table_end_high;		/* End address of high x86 tables */
+	uint phys_bits;			/* Number of physical address bits */
 };
 
 #endif
diff --git a/arch/x86/lib/bdinfo.c b/arch/x86/lib/bdinfo.c
index 9504e7fc293e..c5fda22679ad 100644
--- a/arch/x86/lib/bdinfo.c
+++ b/arch/x86/lib/bdinfo.c
@@ -27,6 +27,7 @@ void arch_print_bdinfo(void)
 	bdinfo_print_num_l("table end", gd->arch.table_end);
 	bdinfo_print_num_l(" high start", gd->arch.table_start_high);
 	bdinfo_print_num_l(" high end", gd->arch.table_end_high);
+	bdinfo_print_num_l("phys bits", gd->arch.phys_bits);
 
 	if (IS_ENABLED(CONFIG_EFI_STUB))
 		efi_show_bdinfo();
-- 
2.41.0.162.gfafddb0af9-goog



More information about the U-Boot mailing list