[U-Boot] couple questions re: special processing in image_setup_libfdt() for keystone

Robert P. J. Day rpjday at crashcourse.ca
Sun May 22 11:23:44 CEST 2016


  i note that, at the bottom of the image_setup_libfdt() routine in
common/image-fdt.c, there is some special processing for a particular
SoC:

  #if defined(CONFIG_SOC_KEYSTONE)
        if (IMAGE_OF_BOARD_SETUP)
                ft_board_setup_ex(blob, gd->bd);
  #endif

first, it seems kind of ... tacky to have a general support routine
like that contain a snippet of S0C-specific code. i do understand what
it does, as described in fdt-support.h:

  /*
   * The keystone2 SOC requires all 32 bit aliased addresses to be converted
   * to their 36 physical format. This has to happen after all fdt nodes
   * are added or modified by the image_setup_libfdt(). The ft_board_setup_ex()
   * called at the end of the image_setup_libfdt() is to do that convertion.
   */
  void ft_board_setup_ex(void *blob, bd_t *bd);

but why not just support a general-purpose routine like, say,
ft_board_setup_post(), that *anyone* can define if they need it and
get rid of that conditional, just in case someone else might want
something similar down the road?

  (an alternative would be to just fold that fixup into
ft_verify_fdt() in that one case, which is already guaranteed to be
called.)

  and a more specific question about that particular bit of code -- as
you see above, the explanation is that the keystone SoC needs some
special fixup if the fdt is modified in that routine. but is it not
possible that the fdt might be modified by something *other* than
calling ft_board_setup()?

  put another way, would it not be safer to replace this:

  #if defined(CONFIG_SOC_KEYSTONE)
        if (IMAGE_OF_BOARD_SETUP)
                ft_board_setup_ex(blob, gd->bd);
  #endif

with this:

  #if defined(CONFIG_SOC_KEYSTONE)
                ft_board_setup_ex(blob, gd->bd);
  #endif

just to play it safe?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================



More information about the U-Boot mailing list