mirror of
https://github.com/raspberrypi/userland.git
synced 2025-12-06 04:49:12 +00:00
arm_dt: Work around an absent cache-line-size
The upstream VCHIQ has been denied its cache-line-size property and forces a cache line size of 32. This doesn't work on V7/8 cpus with 64-bit cache lines. If an updated DT is found (based on the size encoded in the reg property, which should be 0x3c not 0xf, and the vchiq node name "mailbox@7e00b840"), assume the kernel is using the correct cache line size. A corresponding kernel patch derives the correct value, and updates the size as indicated.
This commit is contained in:
@@ -65,27 +65,48 @@ static void dtoverlay_stdio_logging(dtoverlay_logging_type_t type,
|
||||
static DTOVERLAY_LOGGING_FUNC *dtoverlay_logging_func = dtoverlay_stdio_logging;
|
||||
static int dtoverlay_debug_enabled = 0;
|
||||
|
||||
static uint32_t dtoverlay_read_u32(const void *src, int off)
|
||||
uint8_t dtoverlay_read_u8(const void *src, int off)
|
||||
{
|
||||
const unsigned char *p = src;
|
||||
return (p[off + 0] << 0);
|
||||
}
|
||||
|
||||
uint16_t dtoverlay_read_u16(const void *src, int off)
|
||||
{
|
||||
const unsigned char *p = src;
|
||||
return (p[off + 0] << 8) | (p[off + 1] << 0);
|
||||
}
|
||||
|
||||
uint32_t dtoverlay_read_u32(const void *src, int off)
|
||||
{
|
||||
const unsigned char *p = src;
|
||||
return (p[off + 0] << 24) | (p[off + 1] << 16) |
|
||||
(p[off + 2] << 8) | (p[off + 3] << 0);
|
||||
}
|
||||
|
||||
static void dtoverlay_write_u8(void *dst, int off, uint32_t val)
|
||||
uint64_t dtoverlay_read_u64(const void *src, int off)
|
||||
{
|
||||
const unsigned char *p = src;
|
||||
return ((uint64_t)p[off + 0] << 56) | ((uint64_t)p[off + 1] << 48) |
|
||||
((uint64_t)p[off + 2] << 40) | ((uint64_t)p[off + 3] << 32) |
|
||||
(p[off + 4] << 24) | (p[off + 5] << 16) |
|
||||
(p[off + 6] << 8) | (p[off + 7] << 0);
|
||||
}
|
||||
|
||||
void dtoverlay_write_u8(void *dst, int off, uint32_t val)
|
||||
{
|
||||
unsigned char *p = dst;
|
||||
p[off] = (val >> 0) & 0xff;
|
||||
}
|
||||
|
||||
static void dtoverlay_write_u16(void *dst, int off, uint32_t val)
|
||||
void dtoverlay_write_u16(void *dst, int off, uint32_t val)
|
||||
{
|
||||
unsigned char *p = dst;
|
||||
p[off + 0] = (val >> 8) & 0xff;
|
||||
p[off + 1] = (val >> 0) & 0xff;
|
||||
}
|
||||
|
||||
static void dtoverlay_write_u32(void *dst, int off, uint32_t val)
|
||||
void dtoverlay_write_u32(void *dst, int off, uint32_t val)
|
||||
{
|
||||
unsigned char *p = dst;
|
||||
p[off + 0] = (val >> 24) & 0xff;
|
||||
@@ -94,7 +115,7 @@ static void dtoverlay_write_u32(void *dst, int off, uint32_t val)
|
||||
p[off + 3] = (val >> 0) & 0xff;
|
||||
}
|
||||
|
||||
static void dtoverlay_write_u64(void *dst, int off, uint64_t val)
|
||||
void dtoverlay_write_u64(void *dst, int off, uint64_t val)
|
||||
{
|
||||
unsigned char *p = dst;
|
||||
p[off + 0] = (val >> 56) & 0xff;
|
||||
|
||||
@@ -81,6 +81,15 @@ typedef int (*override_callback_t)(int override_type,
|
||||
int target_off, int target_size,
|
||||
void *callback_value);
|
||||
|
||||
uint8_t dtoverlay_read_u8(const void *src, int off);
|
||||
uint16_t dtoverlay_read_u16(const void *src, int off);
|
||||
uint32_t dtoverlay_read_u32(const void *src, int off);
|
||||
uint64_t dtoverlay_read_u64(const void *src, int off);
|
||||
void dtoverlay_write_u8(void *dst, int off, uint32_t val);
|
||||
void dtoverlay_write_u16(void *dst, int off, uint32_t val);
|
||||
void dtoverlay_write_u32(void *dst, int off, uint32_t val);
|
||||
void dtoverlay_write_u64(void *dst, int off, uint64_t val);
|
||||
|
||||
/* Return values: -ve = fatal error, positive = non-fatal error */
|
||||
int dtoverlay_create_node(DTBLOB_T *dtb, const char *node_name, int path_len);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user