/* Reads PE internal data memory (DMEM) from the host through indirect access registers.  */
u32 pe_dmem_read(int id, u32 addr, u8 size)
/* Reads PE internal data memory (DMEM) from the host through indirect access registers.  */
u32 pe_dmem_read(int id, u32 addr, u8 size)
{
	u32 offset = addr & 0x3;
	u32 mask = 0xffffffff >> ((4 - size) << 3);
	u32 val;
	addr = pe[id].dmem_base_addr | (addr & ~0x3) | PE_MEM_ACCESS_READ |
		PE_MEM_ACCESS_DMEM | PE_MEM_ACCESS_BYTE_ENABLE(offset, size);
	writel(addr, pe[id].mem_access_addr);
	val = be32_to_cpu(readl(pe[id].mem_access_rdata));
	return (val >> (offset << 3)) & mask;
}