aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pc-bios/linuxboot_dma.binbin1536 -> 1536 bytes
-rw-r--r--pc-bios/optionrom/linuxboot_dma.c18
2 files changed, 4 insertions, 14 deletions
diff --git a/pc-bios/linuxboot_dma.bin b/pc-bios/linuxboot_dma.bin
index 238a195d38..218d3ab4a2 100644
--- a/pc-bios/linuxboot_dma.bin
+++ b/pc-bios/linuxboot_dma.bin
Binary files differ
diff --git a/pc-bios/optionrom/linuxboot_dma.c b/pc-bios/optionrom/linuxboot_dma.c
index 7549797732..4754282ad7 100644
--- a/pc-bios/optionrom/linuxboot_dma.c
+++ b/pc-bios/optionrom/linuxboot_dma.c
@@ -122,24 +122,14 @@ static inline void writel_es(uint16_t offset, uint32_t val)
static inline uint32_t bswap32(uint32_t x)
{
- return
- ((x & 0x000000ffU) << 24) |
- ((x & 0x0000ff00U) << 8) |
- ((x & 0x00ff0000U) >> 8) |
- ((x & 0xff000000U) >> 24);
+ asm("bswapl %0" : "=r" (x) : "0" (x));
+ return x;
}
static inline uint64_t bswap64(uint64_t x)
{
- return
- ((x & 0x00000000000000ffULL) << 56) |
- ((x & 0x000000000000ff00ULL) << 40) |
- ((x & 0x0000000000ff0000ULL) << 24) |
- ((x & 0x00000000ff000000ULL) << 8) |
- ((x & 0x000000ff00000000ULL) >> 8) |
- ((x & 0x0000ff0000000000ULL) >> 24) |
- ((x & 0x00ff000000000000ULL) >> 40) |
- ((x & 0xff00000000000000ULL) >> 56);
+ asm("bswapl %%eax; bswapl %%edx; xchg %%eax, %%edx" : "=A" (x) : "0" (x));
+ return x;
}
static inline uint64_t cpu_to_be64(uint64_t x)