Re: [PATCH v14 2/5] x86/boot: Introduce efi_get_rsdp_addr() to find RSDP from EFI table

From: Ingo Molnar
Date: Mon Dec 17 2018 - 12:36:12 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

> > + if (!(efi_guidcmp(guid, ACPI_TABLE_GUID)))
> > + rsdp_addr = (acpi_physical_address)table;
> > + else if (!(efi_guidcmp(guid, ACPI_20_TABLE_GUID)))
> > + return (acpi_physical_address)table;
>
> 'return' is not a function.

Disregard this - I got confused by the type cast.

The type cast is ugly nevertheless. 'table' is an 'unsigned long'.

So 'acpi_physical_address' is basically an u64/u32, depending on
ACPI_MACHINE_WIDTH, right?

Since this is x86, can ACPI_MACHINE_WIDTH ever get out of sync with the
native 'unsigned long' size?

If not then why not make the return type 'unsigned long', instead of
'acpi_physical_address' that you have to wade through a couple of headers
to figure out its true size. Does that cause complications elsewhere?

I.e. the excessive type casts are ugly and make the code somewhat
fragile.

Thanks,

Ingo