/* * Baikal-T1 SoC ROMs are only accessible by the dword-aligned instructions. * We have to take this into account when implementing the data read-methods. * Note there is no need in bothering with endianness, since both Baikal-T1 * CPU and MMIO are LE.
*/ static map_word __xipram bt1_rom_map_read(struct map_info *map, unsignedlong ofs)
{ void __iomem *src = map->virt + ofs; unsignedint shift;
map_word ret;
u32 data;
/* Read data within offset dword. */
shift = (uintptr_t)src & 0x3;
data = readl_relaxed(src - shift); if (!shift) {
ret.x[0] = data; return ret;
}
ret.x[0] = data >> (shift * BITS_PER_BYTE);
/* Read data from the next dword. */
shift = 4 - shift; if (ofs + shift >= map->size) return ret;
data = readl_relaxed(src + shift);
ret.x[0] |= data << (shift * BITS_PER_BYTE);
/* Make sure we don't go over the map limit. */
len = min_t(ssize_t, map->size - from, len);
/* * Since requested data size can be pretty big we have to implement * the copy procedure as optimal as possible. That's why it's split * up into the next three stages: unaligned head, aligned body, * unaligned tail.
*/
shift = (uintptr_t)src & 0x3; if (shift) {
chunk = min_t(ssize_t, 4 - shift, len);
data = readl_relaxed(src - shift);
memcpy(to, (char *)&data + shift, chunk);
src += chunk;
to += chunk;
len -= chunk;
}
while (len >= 4) {
data = readl_relaxed(src);
memcpy(to, &data, 4);
src += 4;
to += 4;
len -= 4;
}
if (len) {
data = readl_relaxed(src);
memcpy(to, &data, len);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.