From: Renaud Barbier <Renaud.Barbier@ametek.com>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>,
Barebox List <barebox@lists.infradead.org>
Subject: RE: handoff data
Date: Tue, 22 Jul 2025 15:46:00 +0000 [thread overview]
Message-ID: <DM5PR07MB353236A680007CD791A00D95EC5CA@DM5PR07MB3532.namprd07.prod.outlook.com> (raw)
In-Reply-To: <15ecd1db-7a4f-4ba4-9ddd-27e4391ceee9@pengutronix.de>
>
> 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 |
next prev parent reply other threads:[~2025-07-22 16:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 11:08 Renaud Barbier
2025-07-22 12:16 ` Ahmad Fatoum
2025-07-22 15:46 ` Renaud Barbier [this message]
2025-07-22 16:05 ` Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM5PR07MB353236A680007CD791A00D95EC5CA@DM5PR07MB3532.namprd07.prod.outlook.com \
--to=renaud.barbier@ametek.com \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox