From: Robert P. J. Day Date: Sun, 27 Mar 2016 07:00:15 -0400 (EDT) Subject: [U-Boot] a few questions about u-boot POST tests Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de was just asked to add some POST tests to v2015.10 u-boot running on legacy MPC8360-based system -- couple general questions, then some specific ones. first, is the POST infrastructure used on a regular basis? that is, are people regularly taking advantage of it? from a brief glimpse so far, it's pretty impressive, i'm just curious if it's a standard part of u-boot for developers. next, the documentation doesn't appear to be keeping up with the actual code, as doc/README.POST is inaccurate in places, so let me ask about a few things in there. first, there's this: "The list of available POST tests be kept in the post_tests [sic] array filled at U-Boot build time. The format of entry in this array will be as follows (array name is actually post_list): struct post_test { char *name; char *cmd; char *desc; int flags; int (*test)(bd_t *bd, int flags); };" that's clearly(?) out of date, as post.h actually defines: struct post_test { char *name; char *cmd; char *desc; int flags; int (*test) (int flags); int (*init_f) (void); void (*reloc) (void); unsigned long testid; }; so at the very least that part should be updated (i can submit a patch after i collect a few more things). next, about those additional function pointers, "init_f" and "reloc", i notice that *none* of the standard tests defined in post/tests.c uses either of them, oh, wait, i just noticed: { "SYSMON test", "sysmon", "This test monitors system hardware.", POST_RAM | POST_ALWAYS, &sysmon_post_test, &sysmon_init_f, &sysmon_reloc, CONFIG_SYS_POST_SYSMON }, so i'll look into that more closely, i must have missed that the first time. for now, i'm going to assume that those two function pointers are targeted more at board-specific routines than the generic ones in post/tests.c. next, in README.POST, one reads: "Also, the following board-specific routines will be called from the U-Boot common code: o) int board_power_mode(void) This routine will return the mode the system is running in (POST_POWERON, POST_NORMAL or POST_SHUTDOWN). o) void board_poweroff(void) This routine will turn off the power supply of the board. It will be called on power-fail booting after running all POST tests." the single reference i see to "board_power_mode()" is that line in README.POST -- is there *supposed* to be a call to it from somewhere in the u-boot code? i see no reference to any routine by that name anywhere in the u-boot git log. similar question about "board_poweroff()" ... not a single board-specific definition of it anywhere in u-boot. normally, based on the pattern i've seen, if there is a board-specific routine that one might implement for a given board, there is a __weakly-linked, generic implementation for that routine, but there's nothing for board_poweroff(). some (predictable) pedantry -- given this: #define POST_ALWAYS (POST_NORMAL | \ POST_SLOWTEST | \ POST_MANUAL | \ POST_POWERON ) it's obviously pointless to have bit mask combinations such as: #if CONFIG_POST & CONFIG_SYS_POST_ETHER { "ETHERNET test", "ethernet", "This test verifies the ETHERNET operation.", POST_RAM | POST_ALWAYS | POST_MANUAL, <----------- ðer_post_test, NULL, NULL, CONFIG_SYS_POST_ETHER }, since POST_ALWAYS subsumes POST_MANUAL, but that's just being nitpicky, it clearly doesn't hurt. anyway, time to keep reading, i'll submit a couple simple patches to update some things, and more as i figure this out more. rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ========================================================================