Re: [PATCH v14 3/5] x86/boot: Introduce bios_get_rsdp_addr() to search RSDP in memory

From: Chao Fan
Date: Mon Dec 17 2018 - 21:29:32 EST


On Mon, Dec 17, 2018 at 06:38:37PM +0100, Ingo Molnar wrote:
>
>* Chao Fan <fanc.fnst@xxxxxxxxxxxxxx> wrote:
>
>> + /* Check the standard checksum */
>> + if (compute_checksum((u8 *) rsdp, ACPI_RSDP_CHECKSUM_LENGTH))
>> + continue;
>
>Could you please run your patches through checkpatch, does it not
>complain about this line?

I did, 0 errors, 0 warnings.
If you mean the useless space, I can drop it.
But it's from acpi_tb_validate_rsdp() of drivers/acpi/acpica/tbxfroot.c.
>
>> +/* Search RSDP address, based on acpi_find_root_pointer(). */
>> +static acpi_physical_address bios_get_rsdp_addr(void)
>> +{
>> + u8 *table_ptr;
>> + u32 address;
>> + u8 *rsdp;
>> +
>> + /* Get the location of the Extended BIOS Data Area (EBDA) */
>> + table_ptr = (u8 *)ACPI_EBDA_PTR_LOCATION;
>> + *(u32 *)(void *)&address = *(u16 *)(void *)table_ptr;
>
>what? So you take the address of 'u32 address', which turns it into an
>u32 * - then you cast it to void *, then back to u32 * and then deference
>it???

I will clean it, it's from
#define ACPI_MOVE_16_TO_32(d, s) *(u32 *)(void *)(d) = *(u16 *)(void *)(s)
in acpi_find_root_pointer().
I thought it is safe to use the code existing in kernel.

Thanks,
Chao Fan

>
>Thanks,
>
> Ingo
>
>