This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Access Boot Tracing Vector Registers in Linux

Our product has the ability to boot from one of multiple possible boot media for a given BTMODE setting. Regardless of which medium is used, the kernel and rootfs will be identical, and we will need a way to determine which boot path was taken from within a user-mode Linux application.

It seem that the most appropriate way to do this would be to inspect the tracing vector registers described in Sections 4.3.2.4 and 4.12 of the TRM. However, attempting to access these registers via an mmap() of /dev/mem (or, equivalently, through the use of the devmem2 utility) results in a "Bus error" and some kernel output:

# devmem2 0x4031d040 w
/dev/mem opened.Unhandled fault: external abort on non-linefetch (0x1018) at 0x4026e040

Memory mapped at address 0x4026e000.
Bus error

From seeing similar behavior in other forum posts here, it seems as though this might be caused by an interface clock being disabled. Thus, I tried to enable the OCMC clock via the CM_ALWON_OCMC_0_CLKCTRL register to see if that would make a difference, but the register did not take on the new value:

# devmem2 0x481801b4 w 2
/dev/mem opened.
Memory mapped at address 0x400fd000.
Value at address 0x481801B4 (0x400fd1b4): 0x0
Written 0x2; readback 0x0

Again, a search of the forums pointed me to the possibility that certain registers might only be mutable when the CPU is in supervisor mode.

That all said, I have a few questions:

  1. Am I on the right path here, or is there a much different/easier approach that I should be taking to determine the boot source?
  2. How do I determine which clock(s) to enable in order to access the registers that I'm interested in?
  3. How can I successfully achieve the register write that I'm attempting (the second devmem2 example, above) from a user-space application?
  • Frank,

    I need read the TRM more to answer your questions correctly. But for you if you want to access these values from kernel, you can pass these value from u-boot to kernel using bootargs. You can refer the particular kernel argument and pass on the value to even user space through various other methods. I hope this approach will solve your problem partially.

  • Thanks for the quick response. I'm afraid that I'm looking for a user-space solution, though.

    Are you implying that these registers/values are not accessible/valid following kernel boot, or are you simply proposing one possible solution?

  • Frank,

    Frank Jenner said:
    Are you implying that these registers/values are not accessible/valid following kernel boot,

    I need to read the TRM more to understand which all registers are required to be modified in order to enable the address region. But in my opinion accessing the registers from user space is not a good idea. Its always better to get it through kernel. In fact devmem2 is doing it via kernel only. 

    What I proposed is just an alternate approach.

  • Hi Frank,

    Other possible approach for accessing registers from user space, is using the readmem executable: http://e2e.ti.com/cfs-file.ashx/__key/communityserver-discussions-components-files/716/3554.readmem

    I can read the boot tracing vector 1 register (at address 0x4031D040) with no other modifications:

    root@dm816x-evm:~# ./readmem 0x4031D040
    0x0000009E

    You should place the readmem file in your root file system, /media/ROOTFS in case you are using MMC/SD card.

    BR,

    Pavel

  • Pavel,

    Thanks for the test program. Unfortunately, I'm still seeing the same symptoms as with devmem2. Here is the output:

    root@dm814x-evm:~# ./readmem 0x4031d040
    Unhandled fault: external abort on non-linefetch (0x1018) at 0x400a8040
    Bus error

    Since this appears to have worked for you, though, I'm supposing that there must be something unique about my setup (aside from using DM814x vs.DM816x) and I will have to go back and investigate further.

    Thank you.

  • Which linux PSP version are you using. Older PSP version was disabling clock to OCMC on kernel bootup.I believe recent kernel version should leave OCMC undisturbed.

  • I'm using the TI814X PSP 04.04.00.01.

    If the clock is disabled, is there any way that I can enable it from a user application?

  • No I dont think this is possible .You can read but will be unable to modify unless A8 is in supervisor mode which means you will have to be in kernel space.However the contents of OCMC would have been wiped out even if you enable OCMC clock again. If you want OCMC content to be unmodified from uboot I beleive only option is to modify the kernel so that it does not disable OCMC

  • That is the conclusion that I was coming to as well, but I'm glad that you were able to confirm this.

    Thanks for the assistance!