lkml.org 
[lkml]   [2022]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v8 24/40] x86/compressed/acpi: move EFI system table lookup to helper
On Fri, Dec 10, 2021 at 09:43:16AM -0600, Brijesh Singh wrote:
> +int efi_get_system_table(struct boot_params *boot_params, unsigned long *sys_tbl_pa,
> + bool *is_efi_64)

Nah, that's doing two things in one function.

The signature should be a lot simpler:

unsigned long efi_get_system_table(struct boot_params *bp)

returns 0 on failure, non-null on success and then it returns the
physical address of the system table.

> +{
> + unsigned long sys_tbl;
> + struct efi_info *ei;
> + bool efi_64;
> + char *sig;
> +
> + if (!sys_tbl_pa || !is_efi_64)
> + return -EINVAL;
> +

This...

> + ei = &boot_params->efi_info;
> + sig = (char *)&ei->efi_loader_signature;
> +
> + if (!strncmp(sig, EFI64_LOADER_SIGNATURE, 4)) {
> + efi_64 = true;
> + } else if (!strncmp(sig, EFI32_LOADER_SIGNATURE, 4)) {
> + efi_64 = false;
> + } else {
> + debug_putstr("Wrong EFI loader signature.\n");
> + return -EOPNOTSUPP;
> + }

... up to here needs to be another function:

enum get_efi_type(sig)

where enum is { EFI64, EFI32, INVALID } or so.

And you call this function at the call sites:

if (efi_get_type(sig) == INVALID)
error...

sys_tbl_pa = efi_get_system_table(bp);
if (!sys_tbl_pa)
error...


Completely pseudo but you get the idea.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

\
 
 \ /
  Last update: 2022-01-06 00:50    [W:1.387 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site