POST: add POST_STOP flag
Don't run futher tests in case of a test fails that is marked as POST_STOP. Signed-off-by: Ilya Yanok <yanok@emcraft.com> Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
This commit is contained in:
		
							parent
							
								
									a525145d81
								
							
						
					
					
						commit
						28a3850658
					
				| 
						 | 
					@ -61,6 +61,7 @@ typedef	struct	global_data {
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
					#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
					#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
				
			||||||
#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
					#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8")
 | 
					#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r8")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,6 +52,7 @@ typedef	struct	global_data {
 | 
				
			||||||
#define GD_FLG_DEVINIT	0x00002		/* Devices have been initialized */
 | 
					#define GD_FLG_DEVINIT	0x00002		/* Devices have been initialized */
 | 
				
			||||||
#define GD_FLG_SILENT	0x00004		/* Silent mode			 */
 | 
					#define GD_FLG_SILENT	0x00004		/* Silent mode			 */
 | 
				
			||||||
#define GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed	 */
 | 
					#define GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed	 */
 | 
				
			||||||
 | 
					#define GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted	 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5")
 | 
					#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,6 +62,7 @@ typedef struct global_data {
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002	/* Devices have been initialized */
 | 
					#define	GD_FLG_DEVINIT	0x00002	/* Devices have been initialized */
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004	/* Silent mode                   */
 | 
					#define	GD_FLG_SILENT	0x00004	/* Silent mode                   */
 | 
				
			||||||
#define	GD_FLG_POSTFAIL	0x00008	/* Critical POST test failed     */
 | 
					#define	GD_FLG_POSTFAIL	0x00008	/* Critical POST test failed     */
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010	/* POST seqeunce aborted	 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DECLARE_GLOBAL_DATA_PTR     register gd_t * volatile gd asm ("P5")
 | 
					#define DECLARE_GLOBAL_DATA_PTR     register gd_t * volatile gd asm ("P5")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,6 +55,7 @@ typedef	struct {
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
					#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
					#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
				
			||||||
#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
					#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern gd_t *global_data;
 | 
					extern gd_t *global_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,6 +73,7 @@ typedef	struct	global_data {
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
					#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
					#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
				
			||||||
#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
					#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 0
 | 
					#if 0
 | 
				
			||||||
extern gd_t *global_data;
 | 
					extern gd_t *global_data;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,6 +53,7 @@ typedef	struct	global_data {
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
					#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
					#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
				
			||||||
#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
					#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r31")
 | 
					#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r31")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,6 +55,7 @@ typedef	struct	global_data {
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized */
 | 
					#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized */
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004		/* Silent mode			 */
 | 
					#define	GD_FLG_SILENT	0x00004		/* Silent mode			 */
 | 
				
			||||||
#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed	 */
 | 
					#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed	 */
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted	 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("k0")
 | 
					#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("k0")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,6 +46,7 @@ typedef	struct	global_data {
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
					#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
					#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
				
			||||||
#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
					#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("%g7")
 | 
					#define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("%g7")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,7 @@ typedef	struct	global_data {
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
					#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
					#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
				
			||||||
#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
					#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("r15")
 | 
					#define DECLARE_GLOBAL_DATA_PTR     register gd_t *gd asm ("r15")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -168,6 +168,7 @@ typedef	struct	global_data {
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
					#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
					#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
				
			||||||
#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
					#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if 1
 | 
					#if 1
 | 
				
			||||||
#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
 | 
					#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("r2")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -45,6 +45,7 @@ typedef	struct global_data
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
					#define	GD_FLG_DEVINIT	0x00002		/* Devices have been initialized	*/
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
					#define	GD_FLG_SILENT	0x00004		/* Silent mode				*/
 | 
				
			||||||
#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
					#define	GD_FLG_POSTFAIL	0x00008		/* Critical POST test failed		*/
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010		/* POST seqeunce aborted		*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DECLARE_GLOBAL_DATA_PTR	register gd_t *gd asm ("r13")
 | 
					#define DECLARE_GLOBAL_DATA_PTR	register gd_t *gd asm ("r13")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -79,6 +79,8 @@ typedef struct global_data {
 | 
				
			||||||
#define	GD_FLG_RELOC	0x00001	/* Code was relocated to RAM            */
 | 
					#define	GD_FLG_RELOC	0x00001	/* Code was relocated to RAM            */
 | 
				
			||||||
#define	GD_FLG_DEVINIT	0x00002	/* Devices have been initialized        */
 | 
					#define	GD_FLG_DEVINIT	0x00002	/* Devices have been initialized        */
 | 
				
			||||||
#define	GD_FLG_SILENT	0x00004	/* Silent mode                          */
 | 
					#define	GD_FLG_SILENT	0x00004	/* Silent mode                          */
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTFAIL	0x00008	/* Critical POST test failed		*/
 | 
				
			||||||
 | 
					#define	GD_FLG_POSTSTOP	0x00010	/* POST seqeunce aborted		*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("%g7")
 | 
					#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("%g7")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,6 +43,7 @@
 | 
				
			||||||
#define POST_PREREL             0x1000  /* test runs before relocation */
 | 
					#define POST_PREREL             0x1000  /* test runs before relocation */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define POST_CRITICAL		0x2000	/* Use failbootcmd if test failed */
 | 
					#define POST_CRITICAL		0x2000	/* Use failbootcmd if test failed */
 | 
				
			||||||
 | 
					#define POST_STOP		0x4000	/* Interrupt POST sequence on fail */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define POST_MEM		(POST_RAM | POST_ROM)
 | 
					#define POST_MEM		(POST_RAM | POST_ROM)
 | 
				
			||||||
#define POST_ALWAYS		(POST_NORMAL	| \
 | 
					#define POST_ALWAYS		(POST_NORMAL	| \
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										17
									
								
								post/post.c
								
								
								
								
							
							
						
						
									
										17
									
								
								post/post.c
								
								
								
								
							| 
						 | 
					@ -238,14 +238,20 @@ static int post_run_single (struct post_test *test,
 | 
				
			||||||
		if (test_flags & POST_PREREL) {
 | 
							if (test_flags & POST_PREREL) {
 | 
				
			||||||
			if ((*test->test) (flags) == 0)
 | 
								if ((*test->test) (flags) == 0)
 | 
				
			||||||
				post_log_mark_succ ( test->testid );
 | 
									post_log_mark_succ ( test->testid );
 | 
				
			||||||
			else if (test_flags & POST_CRITICAL)
 | 
								else {
 | 
				
			||||||
				gd->flags |= GD_FLG_POSTFAIL;
 | 
									if (test_flags & POST_CRITICAL)
 | 
				
			||||||
 | 
										gd->flags |= GD_FLG_POSTFAIL;
 | 
				
			||||||
 | 
									if (test_flags & POST_STOP)
 | 
				
			||||||
 | 
										gd->flags |= GD_FLG_POSTSTOP;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
		if ((*test->test) (flags) != 0) {
 | 
							if ((*test->test) (flags) != 0) {
 | 
				
			||||||
			post_log ("FAILED\n");
 | 
								post_log ("FAILED\n");
 | 
				
			||||||
			show_boot_progress (-32);
 | 
								show_boot_progress (-32);
 | 
				
			||||||
			if (test_flags & POST_CRITICAL)
 | 
								if (test_flags & POST_CRITICAL)
 | 
				
			||||||
				gd->flags |= GD_FLG_POSTFAIL;
 | 
									gd->flags |= GD_FLG_POSTFAIL;
 | 
				
			||||||
 | 
								if (test_flags & POST_STOP)
 | 
				
			||||||
 | 
									gd->flags |= GD_FLG_POSTSTOP;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			post_log ("PASSED\n");
 | 
								post_log ("PASSED\n");
 | 
				
			||||||
| 
						 | 
					@ -271,6 +277,9 @@ int post_run (char *name, int flags)
 | 
				
			||||||
	if (name == NULL) {
 | 
						if (name == NULL) {
 | 
				
			||||||
		unsigned int last;
 | 
							unsigned int last;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (gd->flags & GD_FLG_POSTSTOP)
 | 
				
			||||||
 | 
								return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (post_bootmode_get (&last) & POST_POWERTEST) {
 | 
							if (post_bootmode_get (&last) & POST_POWERTEST) {
 | 
				
			||||||
			if (last & POST_FAIL_SAVE) {
 | 
								if (last & POST_FAIL_SAVE) {
 | 
				
			||||||
				last &= ~POST_FAIL_SAVE;
 | 
									last &= ~POST_FAIL_SAVE;
 | 
				
			||||||
| 
						 | 
					@ -285,6 +294,8 @@ int post_run (char *name, int flags)
 | 
				
			||||||
						 flags | POST_REBOOT, last);
 | 
											 flags | POST_REBOOT, last);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				for (i = last + 1; i < post_list_size; i++) {
 | 
									for (i = last + 1; i < post_list_size; i++) {
 | 
				
			||||||
 | 
										if (gd->flags & GD_FLG_POSTSTOP)
 | 
				
			||||||
 | 
											break;
 | 
				
			||||||
					post_run_single (post_list + i,
 | 
										post_run_single (post_list + i,
 | 
				
			||||||
							 test_flags[i],
 | 
												 test_flags[i],
 | 
				
			||||||
							 flags, i);
 | 
												 flags, i);
 | 
				
			||||||
| 
						 | 
					@ -292,6 +303,8 @@ int post_run (char *name, int flags)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			for (i = 0; i < post_list_size; i++) {
 | 
								for (i = 0; i < post_list_size; i++) {
 | 
				
			||||||
 | 
									if (gd->flags & GD_FLG_POSTSTOP)
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
				post_run_single (post_list + i,
 | 
									post_run_single (post_list + i,
 | 
				
			||||||
						 test_flags[i],
 | 
											 test_flags[i],
 | 
				
			||||||
						 flags, i);
 | 
											 flags, i);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue