efi_loader: Install the ACPI table from the bloblist
PATCH 1/1 efi_loader: Install the ACPI table from the bloblist
When BLOBLIST_TABLES is used, the ACPI tables are not currently added to the list of EFI tables. While we don't want to create a new memory region, we do want to tell EFI about the tables.
Fix this by covering this case. At some point the non-bloblist code can likely be removed.
---
lib/efi_loader/efi_acpi.c | 44 ++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 14 deletions(-)
lib/efi_loader/efi_acpi.c +30 -14
@@ -5,6 +5,9 @@* Copyright (C) 2018, Bin Meng <[email protected]> */ +#define LOG_CATEGORY LOGC_ACPI + +#include <bloblist.h> #include <efi_loader.h> #include <log.h> #include <mapmem.h>
@@ -32,25 +35,38 @@ efi_status_t efi_acpi_register(void)* add_u_boot_and_runtime(). At some point that function could create a * more detailed map. */ -if (IS_ENABLED (CONFIG_BLOBLIST_TABLES )) -return EFI_SUCCESS ; - -/* Mark space used for tables */ - start =ALIGN_DOWN (gd->arch.table_start,EFI_PAGE_MASK ); - end =ALIGN (gd->arch.table_end,EFI_PAGE_MASK ); - ret =efi_add_memory_map (start, end - start,EFI_ACPI_RECLAIM_MEMORY ); -if (ret !=EFI_SUCCESS ) -return ret; -if (gd->arch.table_start_high) { - start =ALIGN_DOWN (gd->arch.table_start_high,EFI_PAGE_MASK ); - end =ALIGN (gd->arch.table_end_high,EFI_PAGE_MASK ); +if (IS_ENABLED (CONFIG_BLOBLIST_TABLES )) { +int size; +void *tab =bloblist_get_blob (BLOBLISTT_ACPI_TABLES , &size); + +if (!tab) +return EFI_NOT_FOUND ; + addr =map_to_sysmem (tab); + + ret =efi_add_memory_map (addr, size, +EFI_ACPI_RECLAIM_MEMORY ); +if (ret !=EFI_SUCCESS ) +return ret; + }else { +/* Mark space used for tables */ + start =ALIGN_DOWN (gd->arch.table_start,EFI_PAGE_MASK ); + end =ALIGN (gd->arch.table_end,EFI_PAGE_MASK ); ret =efi_add_memory_map (start, end - start,EFI_ACPI_RECLAIM_MEMORY );if (ret !=EFI_SUCCESS )return ret; - } +if (gd->arch.table_start_high) { + start =ALIGN_DOWN (gd->arch.table_start_high, +EFI_PAGE_MASK ); + end =ALIGN (gd->arch.table_end_high,EFI_PAGE_MASK ); + ret =efi_add_memory_map (start, end - start, +EFI_ACPI_RECLAIM_MEMORY ); +if (ret !=EFI_SUCCESS ) +return ret; + } - addr =gd_acpi_start (); + addr =gd_acpi_start (); + }log_debug ("EFI using ACPI tables at %lx\n" , addr);/* And expose them to our EFI payload */
Signature · 1 line
2.43.0
Quoted 2 lines · Simon Glass
When
BLOBLIST_TABLESis used, the ACPI tables are not currently added to the list of EFI tables. While we don't want to create a new memory
EFI tables are added by InstallConfigurationTable().
It seems this patch is not about the list of EFI configuration tables but about the EFI memory map.
Could you, please, update the commit message accordingly.
Quoted 35 lines
region, we do want to tell EFI about the tables.
Fix this by covering this case. At some point the non-bloblist code can likely be removed.
Signed-off-by Simon Glass <[email protected]>Fixes 3da59ee9579 ("efi_loader: Avoid mapping the ACPI tables twice")---
lib/efi_loader/efi_acpi.c | 44 ++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 14 deletions(-)lib/efi_loader/efi_acpi.c +3
-5@@ -5,6 +5,9 @@* Copyright (C) 2018, Bin Meng <[email protected]> */ +#define LOG_CATEGORY LOGC_ACPI + +#include <bloblist.h> #include <efi_loader.h> #include <log.h> #include <mapmem.h> @@ -32,25 +35,38 @@ efi_status_t efi_acpi_register(void)* add_u_boot_and_runtime(). At some point that function could create a * more detailed map. */ -if (IS_ENABLED (CONFIG_BLOBLIST_TABLES )) -return EFI_SUCCESS ; - -/* Mark space used for tables */ - start =ALIGN_DOWN (gd->arch.table_start,EFI_PAGE_MASK );
lib/efi_loader/efi_acpi.c efi_status_t efi_acpi_register(void) · line 40
Quoted 10 lines
lib/efi_loader/efi_acpi.c +3
-7- end =ALIGN (gd->arch.table_end,EFI_PAGE_MASK ); - ret =efi_add_memory_map (start, end - start,EFI_ACPI_RECLAIM_MEMORY ); -if (ret !=EFI_SUCCESS ) -return ret; -if (gd->arch.table_start_high) { - start =ALIGN_DOWN (gd->arch.table_start_high,EFI_PAGE_MASK ); - end =ALIGN (gd->arch.table_end_high,EFI_PAGE_MASK ); +if (IS_ENABLED (CONFIG_BLOBLIST_TABLES )) { +int size; +void *tab =bloblist_get_blob (BLOBLISTT_ACPI_TABLES , &size);
Why don't you set gd->arch.table_* in the bloblist case? Wouldn't this be an easier fix?
Best regards
Heinrich
Quoted 34 lines
lib/efi_loader/efi_acpi.c +24
-2+ +if (!tab) +return EFI_NOT_FOUND ; + addr =map_to_sysmem (tab); + + ret =efi_add_memory_map (addr, size, +EFI_ACPI_RECLAIM_MEMORY ); +if (ret !=EFI_SUCCESS ) +return ret; + }else { +/* Mark space used for tables */ + start =ALIGN_DOWN (gd->arch.table_start,EFI_PAGE_MASK ); + end =ALIGN (gd->arch.table_end,EFI_PAGE_MASK ); ret =efi_add_memory_map (start, end - start,EFI_ACPI_RECLAIM_MEMORY );if (ret !=EFI_SUCCESS )return ret; - } +if (gd->arch.table_start_high) { + start =ALIGN_DOWN (gd->arch.table_start_high, +EFI_PAGE_MASK ); + end =ALIGN (gd->arch.table_end_high,EFI_PAGE_MASK ); + ret =efi_add_memory_map (start, end - start, +EFI_ACPI_RECLAIM_MEMORY ); +if (ret !=EFI_SUCCESS ) +return ret; + } - addr =gd_acpi_start (); + addr =gd_acpi_start (); + }log_debug ("EFI using ACPI tables at %lx\n" , addr);/* And expose them to our EFI payload */
Hi Heinrich,
Quoted 11 lines · Heinrich Schuchardt
Quoted 2 lines · Simon Glass
When
BLOBLIST_TABLESis used, the ACPI tables are not currently added to the list of EFI tables. While we don't want to create a new memoryEFI tables are added by
InstallConfigurationTable().It seems this patch is not about the list of EFI configuration tables but about the EFI memory map.
Could you, please, update the commit message accordingly.
It currently does not install the table. See the 'if (IS_ENABLED(CONFIG_BLOBLIST_TABLES))' below.
Quoted 41 lines
Quoted 41 lines
region, we do want to tell EFI about the tables.
Fix this by covering this case. At some point the non-bloblist code can likely be removed.
Signed-off-by Simon Glass <[email protected]>Fixes 3da59ee9579 ("efi_loader: Avoid mapping the ACPI tables twice")---
lib/efi_loader/efi_acpi.c | 44 ++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 14 deletions(-)lib/efi_loader/efi_acpi.c +3
-10@@ -5,6 +5,9 @@* Copyright (C) 2018, Bin Meng <[email protected]> */ +#define LOG_CATEGORY LOGC_ACPI + +#include <bloblist.h> #include <efi_loader.h> #include <log.h> #include <mapmem.h> @@ -32,25 +35,38 @@ efi_status_t efi_acpi_register(void)* add_u_boot_and_runtime(). At some point that function could create a * more detailed map. */ -if (IS_ENABLED (CONFIG_BLOBLIST_TABLES )) -return EFI_SUCCESS ; - -/* Mark space used for tables */ - start =ALIGN_DOWN (gd->arch.table_start,EFI_PAGE_MASK ); - end =ALIGN (gd->arch.table_end,EFI_PAGE_MASK ); - ret =efi_add_memory_map (start, end - start,EFI_ACPI_RECLAIM_MEMORY ); -if (ret !=EFI_SUCCESS ) -return ret; -if (gd->arch.table_start_high) {
Quoted 8 lines
lib/efi_loader/efi_acpi.c efi_status_t efi_acpi_register(void) · line 40
Quoted 5 lines
lib/efi_loader/efi_acpi.c +3
-2- start =ALIGN_DOWN (gd->arch.table_start_high,EFI_PAGE_MASK ); - end =ALIGN (gd->arch.table_end_high,EFI_PAGE_MASK ); +if (IS_ENABLED (CONFIG_BLOBLIST_TABLES )) { +int size; +void *tab =bloblist_get_blob (BLOBLISTT_ACPI_TABLES , &size);Why don't you set gd->arch.table_* in the bloblist case? Wouldn't this be an easier fix?
Yes, I did consider that as a quick hack. But I'm going to remove those fields. They are a pain to maintain and bloblist is easier.
Quoted 33 lines
Best regards
Heinrich
Quoted 28 lines
lib/efi_loader/efi_acpi.c +22
-1+ +if (!tab) +return EFI_NOT_FOUND ; + addr =map_to_sysmem (tab); + + ret =efi_add_memory_map (addr, size, +EFI_ACPI_RECLAIM_MEMORY ); +if (ret !=EFI_SUCCESS ) +return ret; + }else { +/* Mark space used for tables */ + start =ALIGN_DOWN (gd->arch.table_start,EFI_PAGE_MASK ); + end =ALIGN (gd->arch.table_end,EFI_PAGE_MASK ); ret =efi_add_memory_map (start, end - start,EFI_ACPI_RECLAIM_MEMORY );if (ret !=EFI_SUCCESS )return ret; - } +if (gd->arch.table_start_high) { + start =ALIGN_DOWN (gd->arch.table_start_high, +EFI_PAGE_MASK ); + end =ALIGN (gd->arch.table_end_high,EFI_PAGE_MASK ); + ret =efi_add_memory_map (start, end - start, +EFI_ACPI_RECLAIM_MEMORY ); +if (ret !=EFI_SUCCESS ) +return ret; + }
Quoted 7 lines
lib/efi_loader/efi_acpi.c efi_status_t efi_acpi_register(void) · line 72
Quoted 6 lines
lib/efi_loader/efi_acpi.c +2
-1- addr =gd_acpi_start (); + addr =gd_acpi_start (); + }log_debug ("EFI using ACPI tables at %lx\n" , addr);/* And expose them to our EFI payload */
Regards,
Simon
Hi Simon,
Quoted 110 lines · Simon Glass
Hi Heinrich,
Quoted 11 lines · Heinrich Schuchardt
Quoted 2 lines · Simon Glass
When
BLOBLIST_TABLESis used, the ACPI tables are not currently added to the list of EFI tables. While we don't want to create a new memoryEFI tables are added by
InstallConfigurationTable().It seems this patch is not about the list of EFI configuration tables but about the EFI memory map.
Could you, please, update the commit message accordingly.
It currently does not install the table. See the 'if (
IS_ENABLED(CONFIG_BLOBLIST_TABLES))' below.Quoted 41 lines
Quoted 41 lines
region, we do want to tell EFI about the tables.
Fix this by covering this case. At some point the non-bloblist code can likely be removed.
Signed-off-by Simon Glass <[email protected]>Fixes 3da59ee9579 ("efi_loader: Avoid mapping the ACPI tables twice")---
lib/efi_loader/efi_acpi.c | 44 ++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 14 deletions(-)lib/efi_loader/efi_acpi.c +3
-10@@ -5,6 +5,9 @@* Copyright (C) 2018, Bin Meng <[email protected]> */ +#define LOG_CATEGORY LOGC_ACPI + +#include <bloblist.h> #include <efi_loader.h> #include <log.h> #include <mapmem.h> @@ -32,25 +35,38 @@ efi_status_t efi_acpi_register(void)* add_u_boot_and_runtime(). At some point that function could create a * more detailed map. */ -if (IS_ENABLED (CONFIG_BLOBLIST_TABLES )) -return EFI_SUCCESS ; - -/* Mark space used for tables */ - start =ALIGN_DOWN (gd->arch.table_start,EFI_PAGE_MASK ); - end =ALIGN (gd->arch.table_end,EFI_PAGE_MASK ); - ret =efi_add_memory_map (start, end - start,EFI_ACPI_RECLAIM_MEMORY ); -if (ret !=EFI_SUCCESS ) -return ret; -if (gd->arch.table_start_high) {Quoted 8 lines
lib/efi_loader/efi_acpi.c efi_status_t efi_acpi_register(void) · line 40
Quoted 5 lines
lib/efi_loader/efi_acpi.c +3
-2- start =ALIGN_DOWN (gd->arch.table_start_high,EFI_PAGE_MASK ); - end =ALIGN (gd->arch.table_end_high,EFI_PAGE_MASK ); +if (IS_ENABLED (CONFIG_BLOBLIST_TABLES )) { +int size; +void *tab =bloblist_get_blob (BLOBLISTT_ACPI_TABLES , &size);Why don't you set gd->arch.table_* in the bloblist case? Wouldn't this be an easier fix?
Yes, I did consider that as a quick hack. But I'm going to remove those fields. They are a pain to maintain and bloblist is easier.
Quoted 38 lines
Best regards
Heinrich
Quoted 33 lines
lib/efi_loader/efi_acpi.c +24
-2+ +if (!tab) +return EFI_NOT_FOUND ; + addr =map_to_sysmem (tab); + + ret =efi_add_memory_map (addr, size, +EFI_ACPI_RECLAIM_MEMORY ); +if (ret !=EFI_SUCCESS ) +return ret; + }else { +/* Mark space used for tables */ + start =ALIGN_DOWN (gd->arch.table_start,EFI_PAGE_MASK ); + end =ALIGN (gd->arch.table_end,EFI_PAGE_MASK ); ret =efi_add_memory_map (start, end - start,EFI_ACPI_RECLAIM_MEMORY );if (ret !=EFI_SUCCESS )return ret; - } +if (gd->arch.table_start_high) { + start =ALIGN_DOWN (gd->arch.table_start_high, +EFI_PAGE_MASK ); + end =ALIGN (gd->arch.table_end_high,EFI_PAGE_MASK ); + ret =efi_add_memory_map (start, end - start, +EFI_ACPI_RECLAIM_MEMORY ); +if (ret !=EFI_SUCCESS ) +return ret; + } - addr =gd_acpi_start (); + addr =gd_acpi_start (); + }log_debug ("EFI using ACPI tables at %lx\n" , addr);
Quoted 5 lines
Quoted 2 lines
lib/efi_loader/efi_acpi.c efi_status_t efi_acpi_register(void) · line 72
Quoted 1 line
lib/efi_loader/efi_acpi.c +0
-0/* And expose them to our EFI payload */ Regards,
Simon
I can confirm that your patch fixes booting on qemu-system-aarch64 sbsa-ref as the ACPI tables are visible to the OS again.
Regards,
Patrick