handoff data

Renaud Barbier Renaud.Barbier at ametek.com
Tue Jul 22 08:46:00 PDT 2025


> 
> Hello Renaud,
> 
> On 7/22/25 13:08, Renaud Barbier wrote:
> > On our LS1046A based board (v2022.03) we used to pass the results of
> memory tests in the PBL  through the OCRAM to the barebox load.
> > I see there is handoff data support.
> >
> > In my board lowlevel.c code, I have added the call:
> >
> > handoff_add_arm_machine(0x12345678);
> 
> You should define a new handoff type for your custom info, e.g.:
> 
> #define HANDOFF_DATA_MEMTEST   HANDOFF_DATA_BOARD(0)
> 
> instead of overloading the (legacy) ARM machine id for something else.
> 
> > And then try to read it back from device_initcall:
> >
> >  machine = handoff_data_get_entry(HANDOFF_DATA_ARM_MACHINE,
> &hsize);
> > printf("machine = %ld, %p\n", hsize, machine);
> >
> > However, both the machine pointer and size are set to 0.
> >
> > Am I missing something in the process?
> 
> Handoff data is used for DT as well, so if you get to a functional barebox,
> handoff is working...
> 
> As a sanity check, what happens if you move your handoff_add_arm_machine
> behind handoff_data_add_dt() in barebox_pbl_start?
Doing so I can now get the machine value back 0x12345678
machine = 4, 00000000fbf031a0, 0x12345678

> 
> If that works, but your handoff_add_arm_machine in lowlevel.c doesn't, can
> you share your code?

So in my lowlevel code:
static noinline __noreturn void owc_swex50s_r_entry(unsigned long memsize)
{
          Uint32_t baudrate;
...
          /* Data goes to OCRAM. In this example we pass the baudrate*/
          puts("ADD BOARD DATA\n");
          handoff_data_add(HANDOFF_BAUDRATE, &baudrate, sizeof(uint32_t));

          /* Only use 2G */
          if (IS_ENABLED(CONFIG_MACH_OWCSWE550S))
                  memsize = memsize >> 1;
          ls1046a_xload_start_image(&dram_info);

          pr_err("Booting failed\n");

          while (1);
  }

  void owc_swex50s_entry(unsigned long r0, unsigned long r1, unsigned long r2);

  __noreturn void owc_swex50s_entry(unsigned long r0, unsigned long r1, unsigned long r2)
  {
          relocate_to_current_adr();
          setup_c();

          owc_swex50s_r_entry(r0);
  }

I get the following debug output:
ADD BOARD DATA
handoff_data_add_entry hd = 0x00000000100143e8  ==> My data added from lowlevel.c to the OCRAM

Then, from barebox_pbl_start:
~         if (boarddata) {
+                 puts("ADD DT\n");
                  handoff_data_add_dt(boarddata);
+                 puts("ADD MACHINE\n");
+                 handoff_add_arm_machine(0x12345678);
+         }

ADD DT
handoff_data_add_entry hd = 0x00000000800143e8 ====> DT added to DDR  memory
ADD MACHINE
handoff_data_add_entry hd = 0x00000000800143e8 ====> Machine  added to DDR memory
uncompress.c: uncompressing barebox binary at 0x0000000080015370 (size 0x000853fc) to 0xfbd00000 (uncompressed size: 0x000fc5c8)
 handoff_data_move hd = 0x00000000800143e8, dest = 0x00000000fbefc5c8 =====> Handoff data moved to new location
 handoff_data_get_entry hd = 0x00000000fbefc5c8, cookie = 0x28061971

Board: owc-swe550s
RENAUD: handoff_data_get_entry hd = 0x00000000fbefc5c8, cookie = 0x28061971
...
handoff 0x28061971 at 0x00000000fbefc600 (size 27560)
handoff 0x28061974 at 0x00000000fbf031d0 (size 4)

From device_initcall:
 handoff_data_get_entry hd = 0x00000000fbefc5c8, cookie = 0x951726fb
 baudrate = 0, 0000000000000000 =====> 			Obviously, no copied from OCRAM
 handoff_data_get_entry hd = 0x00000000fbefc5c8, cookie = 0x28061974
 machine = 4, 00000000fbf031d0, 0x12345678 ==> MACHINE data is correct

So, there is a need to copy the data from OCRAM to when the memory is available.

> 
> Cheers,
> Ahmad
> 
> >
> > Cheers,
> > Renaud
> >
> >
> 
> --
> Pengutronix e.K.                  |                             |
> Steuerwalder Str. 21              |
> https://urldefense.com/v3/__http://www.pengutronix.de/__;!!HKOSU0g!HR
> UHvAKHu8BujxVw_027NrNyWR1gCzuOAqRxHitCLcKK7_3GAlFYC1T3Ybcg07
> WVj9r_PsvGrn9utecIX6xw5yiaxC4$   |
> 31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list