On Thu, 19 Sept 2024 at 15:51, Heinrich Schuchardt <xypron.g...@gmx.de> wrote:
>
> On 12.09.24 02:58, Simon Glass wrote:
> > Hi Patrick,
> >
> > On Wed, 11 Sept 2024 at 00:25, Patrick Rudolph
> > <patrick.rudo...@9elements.com> wrote:
> >>
> >> Allocate memory for ACPI tables inside the efi_loader and write out
> >> the tables similar to SMBIOS tables. When ACPI is enabled and wasn't
> >> installed in other places, install the ACPI table in EFI. Since EFI
> >> is necessary to pass the ACPI table location when FDT isn't used,
> >> there's no need to install it separately.
> >>
> >> When CONFIG_BLOBLIST_TABLES is set the tables will be stored in a
> >> bloblist. The tables are still passed to the OS using EFI.
> >>
> >> This allows non x86 platforms to boot using ACPI only in case the
> >> EFI loader is being used.
> >>
> >> TEST: Booted QEMU SBSA (no QFW) using EFI and ACPI only.
> >>
> >> Signed-off-by: Patrick Rudolph <patrick.rudo...@9elements.com>
> >> Cc: Simon Glass <s...@chromium.org>
> >> Cc: Tom Rini <tr...@konsulko.com>
> >> ---
> >> Changelog v3:
> >> - Drop memalign and use efi_allocate_pages
> >> - Use log_debug instead of debug
> >> - Clarify commit message
> >> - Skip writing ACPI tables on sandbox
> >> - Rename function
> >> - Add function comment
> >> ---
> >>   lib/efi_loader/efi_acpi.c        | 80 +++++++++++++++++++++++++++++++-

[...]

>
> Please, have a look at init_sequence_r[].
>
> The memory allocate for the EFI sub-system is initialized in
> efi_memory_init directly after initr_lmb.
>
> So for sure we can and should use efi_allocate_pages() here.

Ah thanks Heinrich. Yes we should, I wrongly remembered we init the
memory subsystem when we init the EFI one.


Thanks
/Ilias

>
> We must not use bloblist_add() as the memory allocation would not be
> reported as AcpiReclaimMemory.
>
> Best regards
>
> Heinrich
>
> >
> > I think in fact we should make this ACPI stuff depend on bloblist and
> > just put the tables there. So set up bloblist size to something small,
> > like 0x100 and set BLOBLIST_SIZE_RELOC to larger than you need (e.g.
> > 68KB). Everything should work OK. I will do a bit of a tidy-up after
> > this series goes in.
> >
> >> +               if (ret != EFI_SUCCESS)
> >> +                       return log_msg_ret("mem", -ENOMEM);
> >> +
> >> +               addr = (void *)(uintptr_t)new_acpi_addr;
> >> +       }
> >> +
> >> +       table_addr = virt_to_phys(addr);
> >> +
> >> +       gd->arch.table_start_high = table_addr;
> >> +
> >> +       table_end = write_acpi_tables(table_addr);
> >> +       if (!table_end) {
> >> +               log_err("Can't create ACPI configuration table\n");
> >> +               return -EINTR;
> >> +       }
> >> +
> >> +       log_debug("- wrote 'acpi' to %llx, end %llx\n", table_addr, 
> >> table_end);
> >> +       if (table_end - table_addr > TABLE_SIZE) {
> >> +               log_err("Out of space for configuration tables: need %llx, 
> >> have %x\n",
> >> +                       table_end - table_addr, TABLE_SIZE);
> >> +               return log_msg_ret("acpi", -ENOSPC);
> >> +       }
> >> +       gd->arch.table_end_high = table_end;
> >> +
> >> +       log_debug("- done writing tables\n");
> >> +
> >> +       return 0;
> >> +}
> >> +
> >> +EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, alloc_write_acpi_tables);
> >> diff --git a/test/py/tests/test_event_dump.py 
> >> b/test/py/tests/test_event_dump.py
> >> index e282c67335..459bfa26bb 100644
> >> --- a/test/py/tests/test_event_dump.py
> >> +++ b/test/py/tests/test_event_dump.py
> >> @@ -18,6 +18,7 @@ def test_event_dump(u_boot_console):
> >>   --------------------  ------------------------------  
> >> ------------------------------
> >>   EVT_FT_FIXUP          bootmeth_vbe_ft_fixup           
> >> .*boot/vbe_request.c:.*
> >>   EVT_FT_FIXUP          bootmeth_vbe_simple_ft_fixup    
> >> .*boot/vbe_simple_os.c:.*
> >> +EVT_LAST_STAGE_INIT   alloc_write_acpi_tables         
> >> .*lib/efi_loader/efi_acpi.c:.*
> >>   EVT_LAST_STAGE_INIT   install_smbios_table            
> >> .*lib/efi_loader/efi_smbios.c:.*
> >>   EVT_MISC_INIT_F       sandbox_early_getopt_check      
> >> .*arch/sandbox/cpu/start.c:.*
> >>   EVT_TEST              h_adder_simple                  
> >> .*test/common/event.c:'''
> >> --
> >> 2.46.0
> >>
> >
> > Regards,
> > Simon
>

Reply via email to