mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-20 20:04:46 +00:00
efi_selftest: simplify endian conversion for FDT test
UEFI code is always little-endian. Remove a superfluous test. Remove a superfluous type conversion. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
9d1564dabc
commit
9abd2ca96e
1 changed files with 8 additions and 7 deletions
|
@ -23,23 +23,24 @@ static const char *fdt;
|
||||||
static const efi_guid_t fdt_guid = EFI_FDT_GUID;
|
static const efi_guid_t fdt_guid = EFI_FDT_GUID;
|
||||||
static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID;
|
static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Convert FDT value to host endianness.
|
* f2h() - convert FDT value to host endianness.
|
||||||
*
|
*
|
||||||
* @val FDT value
|
* UEFI code is always low endian. The FDT is big endian.
|
||||||
* @return converted value
|
*
|
||||||
|
* @val: FDT value
|
||||||
|
* Return: converted value
|
||||||
*/
|
*/
|
||||||
static uint32_t f2h(fdt32_t val)
|
static uint32_t f2h(fdt32_t val)
|
||||||
{
|
{
|
||||||
char *buf = (char *)&val;
|
char *buf = (char *)&val;
|
||||||
char i;
|
char i;
|
||||||
|
|
||||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
||||||
/* Swap the bytes */
|
/* Swap the bytes */
|
||||||
i = buf[0]; buf[0] = buf[3]; buf[3] = i;
|
i = buf[0]; buf[0] = buf[3]; buf[3] = i;
|
||||||
i = buf[1]; buf[1] = buf[2]; buf[2] = i;
|
i = buf[1]; buf[1] = buf[2]; buf[2] = i;
|
||||||
#endif
|
|
||||||
return *(uint32_t *)buf;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue