Re: [PATCH v2] x86/boot: Use EFI setup data if provided
From: bhe@xxxxxxxxxx
Date: Thu Mar 28 2019 - 23:55:36 EST
On 03/29/19 at 03:34am, Junichi Nomura wrote:
> On 3/29/19 8:11 AM, bhe@xxxxxxxxxx wrote:
> > On 03/28/19 at 07:43am, Junichi Nomura wrote:
> >> /* Search EFI system tables for RSDP. */
> >> -static acpi_physical_address efi_get_rsdp_addr(void)
> >> +static acpi_physical_address __efi_get_rsdp_addr(unsigned long config_tables, unsigned int nr_tables, int size, bool efi_64)
> >
> > Here parameter 'size' and 'efi_64' seems a little duplicated on
> > functionality. Only passing efi_64 can deduce the size? Personal
> > opinion.
>
> Yes. But I'm not sure which is preferred.
>
> The current code is:
>
I would like to change them like below two cases. I personally prefer
the 2nd one. Feel free to take one you like better.
1)
__efi_get_rsdp_addr() {
size = efi_64 ? sizeof(efi_config_table_64_t):sizeof(efi_config_table_32_t);;
Or if/else sytle.
for (i = 0; i < nr_tables; i++) {
config_tables += size;
if (efi_64) {
efi_config_table_64_t *tbl = (efi_config_table_64_t *)config_tables;
// get guid and table
} else {
efi_config_table_32_t *tbl = (efi_config_table_32_t *)config_tables;
// get guid and table
}
// check guid and return table if it's valid
}
}
2)
__efi_get_rsdp_addr() {
for (i = 0; i < nr_tables; i++) {
if (efi_64) {
efi_config_table_64_t *tbl = (efi_config_table_64_t *)config_tables + i;
// get guid and table
} else {
efi_config_table_32_t *tbl = (efi_config_table_32_t *)config_tables + i;
// get guid and table
}
// check guid and return table if it's valid
}
}
>
> Or we could create 2 functions, __efi_get_rsdp_addr32() and __efi_get_rsdp_addr64(),
> and let efi_get_rsdp_addr() to choose which one to use based on signature.
>
> > It might be worth adding code comments here to tell why we only care
> > about 64bit kexec booting?
>
> I think so. I'll add a comment.
>
> --
> Jun'ichi Nomura, NEC Corporation / NEC Solution Innovators, Ltd.