Read registers in AST-2500

Lei YU mine260309 at gmail.com
Mon Oct 22 17:50:29 AEDT 2018


On Mon, Oct 22, 2018 at 2:37 PM AKASH G J <akashgj91 at gmail.com> wrote:
>
> Hi all,
>
> I used the following code to get the value of the control register 'SCU13C' in BMC Aspeed AST-2500.
>
> #include<stdio.h>
>
> #define SCU13C_ADDR 0x1E6E213C
> int main()
> {
> long reg;
> reg=123;
> reg = *(volatile long *)(SCU13C_ADDR);

This is getting value from virtual address of the process, it is not related
to physical address at all.
You need to use "devmem" tool to read registers, which will handle the memory
mapping.

Note:
1. "devmem" depends on "/dev/mem" device, which depends on kernel config
   "CONFIG_DEVMEM"
2. With the patch
https://lists.ozlabs.org/pipermail/openbmc/2018-October/013665.html,
   you could use "DEVMEM_BOOTPARAM" and add 'mem.devmem' in kernel command
   line to enable the device.


More information about the openbmc mailing list