U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>,
	U-Boot Mailing List <u-boot@lists.denx.de>,
	Marek Vasut <marek.vasut+renesas@gmail.com>
Subject: Re: [PATCH] loads: Block writes into LMB reserved areas of U-Boot
Date: Fri, 15 Oct 2021 12:09:51 -0400	[thread overview]
Message-ID: <20211015160951.GX7964@bill-the-cat> (raw)
In-Reply-To: <69e586a7-7fb3-e530-d0f2-196ebb59b098@denx.de>

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

On Fri, Oct 15, 2021 at 04:23:27PM +0200, Marek Vasut wrote:
> On 10/14/21 5:10 PM, Simon Glass wrote:
> [...]
> > > @@ -137,6 +138,7 @@ static int do_load_serial(struct cmd_tbl *cmdtp, int flag, int argc,
> > > 
> > >   static ulong load_serial(long offset)
> > >   {
> > > +       struct lmb lmb;
> > >          char    record[SREC_MAXRECLEN + 1];     /* buffer for one S-Record      */
> > >          char    binbuf[SREC_MAXBINLEN];         /* buffer for binary data       */
> > >          int     binlen;                         /* no. of data bytes in S-Rec.  */
> > > @@ -147,6 +149,9 @@ static ulong load_serial(long offset)
> > >          ulong   start_addr = ~0;
> > >          ulong   end_addr   =  0;
> > >          int     line_count =  0;
> > > +       long ret;
> > > +
> > > +       lmb_init_and_reserve(&lmb, gd->bd, (void *)gd->fdt_blob);
> > > 
> > >          while (read_record(record, SREC_MAXRECLEN + 1) >= 0) {
> > >                  type = srec_decode(record, &binlen, &addr, binbuf);
> > > @@ -172,7 +177,14 @@ static ulong load_serial(long offset)
> > >                      } else
> > >   #endif
> > >                      {
> > > +                       ret = lmb_reserve(&lmb, store_addr, binlen);
> > > +                       if (ret) {
> > > +                               printf("\nCannot overwrite reserved area (%08lx..%08lx)\n",
> > > +                                       store_addr, store_addr + binlen);
> > > +                               return ret;
> > > +                       }
> > >                          memcpy((char *)(store_addr), binbuf, binlen);
> > > +                       lmb_free(&lmb, store_addr, binlen);
> > >                      }
> > >                      if ((store_addr) < start_addr)
> > >                          start_addr = store_addr;
> > > --
> > > 2.33.0
> > > 
> > 
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> > 
> > This code looks OK but I don't know what lmb_reserve() and lmb_free()
> > do. Can you add comments to the header file?
> 
> Not here, the entire LMB stuff needs (better) documentation, that's where
> (all) such clarification should go.

Is that you saying you'll do such a follow-up patch, given you've
touched this code the most of late?

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2021-10-15 16:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-10 21:52 [PATCH] loads: Block writes into LMB reserved areas of U-Boot marek.vasut
2021-10-14 15:10 ` Simon Glass
2021-10-15 14:23   ` Marek Vasut
2021-10-15 16:09     ` Tom Rini [this message]
2021-10-15 16:30       ` Marek Vasut
2021-10-26 13:34 ` Tom Rini

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=20211015160951.GX7964@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=marex@denx.de \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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