[U-Boot] [u-boot 2/2] drivers/fsl-mc: Support DPSPARSER object and apply spb command

Joe Hershberger joe.hershberger at gmail.com
Tue Jul 9 20:33:38 UTC 2019


On Wed, May 15, 2019 at 4:10 AM Florinel Iordache
<florinel.iordache at nxp.com> wrote:
>
> Add support for DPSPARSER object (create/destroy, open/close, apply spb)
> required to configure Soft Parser by using MC. Also add uboot command to
> apply a Soft Parser Blob by using a command like: fsl_mc apply spb
> <spb_load_addr>
>
> Signed-off-by: Florinel Iordache <florinel.iordache at nxp.com>
> ---
>  drivers/net/fsl-mc/Kconfig      |  12 ++
>  drivers/net/fsl-mc/Makefile     |   4 +-
>  drivers/net/fsl-mc/dpsparser.c  | 138 ++++++++++++++++++++
>  drivers/net/fsl-mc/mc.c         | 272 +++++++++++++++++++++++++++++++++++++---
>  include/fsl-mc/fsl_dpsparser.h  | 208 ++++++++++++++++++++++++++++++
>  include/fsl-mc/fsl_mc_private.h |  17 ++-
>  6 files changed, 629 insertions(+), 22 deletions(-)
>  create mode 100644 drivers/net/fsl-mc/dpsparser.c
>  create mode 100644 include/fsl-mc/fsl_dpsparser.h
>

[ ... ]

> +int mc_apply_spb(u64 mc_spb_addr)
> +{
> +       int err = 0;
> +       u16 error, err_arr_size;
> +       u64 mc_spb_offset;
> +       u32 spb_size;
> +       struct sp_blob_header *sp_blob;
> +       u64 mc_ram_addr = mc_get_dram_addr();
> +
> +       if (!is_dpsparser_supported())
> +               return 0;
> +
> +       if (!mc_spb_addr) {
> +               printf("fsl-mc: Invalid Blob address\n");
> +               return -1;
> +       }
> +
> +#ifdef CONFIG_MC_DRAM_SPB_OFFSET
> +       mc_spb_offset = CONFIG_MC_DRAM_SPB_OFFSET;
> +#else
> +#error "CONFIG_MC_DRAM_SPB_OFFSET not defined"
> +#endif
> +
> +       // Read blob header and get size of SPB blob
> +       sp_blob = (struct sp_blob_header *)mc_spb_addr;
> +       spb_size = le32_to_cpu(sp_blob->length);
> +       if (spb_size > CONFIG_MC_SPB_MAX_SIZE) {
> +               printf("\nfsl-mc: ERROR: Bad SPB image (too large: %d)\n",
> +                      spb_size);
> +               return -EINVAL;
> +       }
> +
> +       mc_copy_image("MC SP Blob", mc_spb_addr, spb_size,
> +                     mc_ram_addr + mc_spb_offset);

This function is only available #ifndef CONFIG_SYS_LS_MC_FW_IN_DDR

This is breaking the ls2080a_emu build.


> +
> +       //Invoke MC command to apply SPB blob
> +       printf("fsl-mc: Applying soft parser blob... ");
> +       err = dpsparser_apply_spb(dflt_mc_io, MC_CMD_NO_FLAGS, dpsparser_handle,
> +                                 mc_spb_offset, &error);
> +       if (err)
> +               return err;
> +
> +       if (error == 0) {
> +               printf("SUCCESS\n");
> +       } else {
> +               printf("FAILED with error code = %d:\n", error);
> +               err_arr_size = (u16)ARRAY_SIZE(mc_err_msg_apply_spb);
> +
> +               if (error > 0 && error < err_arr_size)
> +                       printf(mc_err_msg_apply_spb[error]);
> +               else
> +                       printf(MC_ERROR_MSG_SPB_UNKNOWN);
> +       }
> +
> +       return err;
> +}
> +


[ ... ]


More information about the U-Boot mailing list