[U-Boot] [PATCH v2 1/2] common: image: update boot_get_fpga to support arbitrary fpga image
Dalon Westergreen
dwesterg at gmail.com
Mon Feb 20 14:42:03 UTC 2017
On Mon, 2017-02-20 at 09:14 +0100, Marek Vasut wrote:
> On 02/20/2017 04:35 AM, Dalon Westergreen wrote:
> >
> > The implementation of boot_get_fpga only supported one fpga family.
> > This modification allows for any of the fpga devices supported by
> > fpga_load to be used.
> >
> > Signed-off-by: Dalon Westergreen <dwesterg at gmail.com>
>
> IMO looks OK, minor nits below
>
> >
> > --
> > Changes in v2:
> > - Add fitimage support for fpga-devnum and fpga-partial-image
> > - Use above in boot_get_fpga
> > - for xilinx fpgas double check using image size to determine
> > if image is a partial image
> > ---
> > common/image-fit.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
> > common/image.c | 51 ++++++++++++++++++++++++++++++++-------------------
> > include/image.h | 5 +++++
> > 3 files changed, 88 insertions(+), 19 deletions(-)
> >
> > diff --git a/common/image-fit.c b/common/image-fit.c
> > index 109ecfa..eb0c633 100644
> > --- a/common/image-fit.c
> > +++ b/common/image-fit.c
> > @@ -916,6 +916,57 @@ ulong fit_get_end(const void *fit)
> > }
> >
> >
[...]
> >
> > + fit_image_fpga_get_devnum(buf, conf_noffset, &devnum);
> > +
> > + /* check bitstream type */
>
> At least start the sentence with capital letter please.
>
> >
> > + if (fit_image_fpga_is_partial(buf, conf_noffset))
> > + bstype = BIT_PARTIAL;
>
> Are there any chances there will be something else besides full and
> partial in the future ?
It's plausible but i think not a likely use case here. In Arria10 there is the
periphery/core image that configures just the io or fpga core. I believe,
though, that this is just a special case of a partial image and is treated the
same.
--dalon
>
> >
> > + /* legacy support detecting partial config files for xilinx
> > */
>
> DTTO, start with caps.
>
> >
> > + desc = fpga_get_desc(devnum);
> > + if (desc->devtype == fpga_xilinx) {
> > + desc_xilinx = desc->devdesc;
> > + if (img_len < desc_xilinx->size)
> > + bstype = BIT_PARTIAL;
> > }
> >
> > + /* Try bitstream format first */
> > + err = fpga_loadbitstream(devnum, (char *)img_data,
> > + img_len, bstype);
> > + if (err)
> > + err = fpga_load(devnum, (const void *)img_data,
> > + img_len, bstype);
> > +
> > if (err)
> > return err;
> >
> > - printf(" Programming %s bitstream... OK\n", name);
> > + if (bstype == BIT_PARTIAL)
> > + name = "partial";
> > + else
> > + name = "full";
> > +
> > + printf(" Programming %s bitstream into fpga %d... OK\n",
> > + name, devnum);
> > break;
> > default:
> > printf("The given image format is not supported
> > (corrupt?)\n");
> > diff --git a/include/image.h b/include/image.h
> > index 1e686b7..75d2afc 100644
> > --- a/include/image.h
> > +++ b/include/image.h
> > @@ -876,6 +876,8 @@ int bootz_setup(ulong image, ulong *start, ulong *end);
> > #define FIT_COMP_PROP "compression"
> > #define FIT_ENTRY_PROP "entry"
> > #define FIT_LOAD_PROP "load"
> > +#define FIT_FPGA_DEVNUM_PROP "fpga-devnum"
> > +#define FIT_FPGA_PARTIAL_PROP "fpga-partial-image"
> >
> > /* configuration node */
> > #define FIT_KERNEL_PROP "kernel"
> > @@ -955,6 +957,9 @@ int fit_image_hash_get_value(const void *fit, int
> > noffset, uint8_t **value,
> >
> > int fit_set_timestamp(void *fit, int noffset, time_t timestamp);
> >
> > +int fit_image_fpga_get_devnum(const void *fit, int noffset, int *devnum);
> > +int fit_image_fpga_is_partial(const void *fit, int noffset);
> > +
> > /**
> > * fit_add_verification_data() - add verification data to FIT image nodes
> > *
> >
>
>
More information about the U-Boot
mailing list