Merging upstream version 2.9.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
bb95f41000
commit
698d985f9d
451 changed files with 5896 additions and 2734 deletions
23
common.h
23
common.h
|
@ -3,6 +3,7 @@
|
|||
#define _COMMON_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "ccan/endian/endian.h"
|
||||
|
||||
|
@ -32,7 +33,27 @@ static inline uint64_t mmio_read64(void *addr)
|
|||
low = le32_to_cpu(*p);
|
||||
high = le32_to_cpu(*(p + 1));
|
||||
|
||||
return ((uint64_t) high << 32) | low;
|
||||
return ((uint64_t)high << 32) | low;
|
||||
}
|
||||
|
||||
static inline void mmio_write32(void *addr, uint32_t value)
|
||||
{
|
||||
leint32_t *p = addr;
|
||||
|
||||
*p = cpu_to_le32(value);
|
||||
}
|
||||
|
||||
/* Access 64-bit registers as 2 32-bit if write32 flag set; Some devices fail 64-bit MMIO. */
|
||||
static inline void mmio_write64(void *addr, uint64_t value, bool write32)
|
||||
{
|
||||
uint64_t *p = addr;
|
||||
|
||||
if (write32) {
|
||||
mmio_write32(addr, value);
|
||||
mmio_write32((uint32_t *)addr + 1, value >> 32);
|
||||
return;
|
||||
}
|
||||
|
||||
*p = cpu_to_le64(value);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue