All of lore.kernel.org
 help / color / mirror / Atom feed
* Read registers in AST-2500
@ 2018-10-22  6:37 AKASH G J
  2018-10-22  6:50 ` Lei YU
  0 siblings, 1 reply; 2+ messages in thread
From: AKASH G J @ 2018-10-22  6:37 UTC (permalink / raw)
  To: openbmc

[-- Attachment #1: Type: text/plain, Size: 398 bytes --]

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);
printf("%li",reg);
return 1;
}

Running the code I am getting Segmentation Fault (Core Dumped). Please
someone help to resolve the issue.


Thanks and Regards,

Akash

[-- Attachment #2: Type: text/html, Size: 534 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Read registers in AST-2500
  2018-10-22  6:37 Read registers in AST-2500 AKASH G J
@ 2018-10-22  6:50 ` Lei YU
  0 siblings, 0 replies; 2+ messages in thread
From: Lei YU @ 2018-10-22  6:50 UTC (permalink / raw)
  To: AKASH G J; +Cc: OpenBMC Maillist

On Mon, Oct 22, 2018 at 2:37 PM AKASH G J <akashgj91@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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-22  6:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-22  6:37 Read registers in AST-2500 AKASH G J
2018-10-22  6:50 ` Lei YU

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.