* Code cleanup:
  - remove trailing white space, trailing empty lines, C++ comments, etc.
  - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c)

* Patches by Kenneth Johansson, 25 Jun 2003:
  - major rework of command structure
    (work done mostly by Michal Cendrowski and Joakim Kristiansen)
diff --git a/post/cpu/b.c b/post/cpu/b.c
index 1ae22cc..b4b17c8 100644
--- a/post/cpu/b.c
+++ b/post/cpu/b.c
@@ -84,8 +84,8 @@
     }
     if (ret == 0)
     {
-    	if (link)
-            ret = lr == (ulong) code + 24 ? 0 : -1;
+	if (link)
+	    ret = lr == (ulong) code + 24 ? 0 : -1;
 	else
 	    ret = lr == 0 ? 0 : -1;
     }
@@ -100,7 +100,7 @@
 
     if (ret == 0)
     {
-    	ulong code[] =
+	ulong code[] =
 	{
 	   ASM_MFLR(4),
 	   ASM_MTLR(3),
@@ -115,15 +115,15 @@
 
 	ret = res == 0 ? 0 : -1;
 
-    	if (ret != 0)
-    	{
-            post_log ("Error at b1 test !\n");
-    	}
+	if (ret != 0)
+	{
+	    post_log ("Error at b1 test !\n");
+	}
     }
 
     if (ret == 0)
     {
-    	ulong code[] =
+	ulong code[] =
 	{
 	   ASM_MFLR(4),
 	   ASM_MTLR(3),
@@ -138,15 +138,15 @@
 
 	ret = res == (ulong)code + 12 ? 0 : -1;
 
-    	if (ret != 0)
-    	{
-            post_log ("Error at b2 test !\n");
-    	}
+	if (ret != 0)
+	{
+	    post_log ("Error at b2 test !\n");
+	}
     }
 
     if (ret == 0)
     {
-        ulong cc, cd;
+	ulong cc, cd;
 	int cond;
 	ulong ctr;
 	int link;
@@ -157,30 +157,30 @@
 	{
 	    for (cd = 0; cd < 4 && ret == 0; cd++)
 	    {
-	        for (link = 0; link <= 1 && ret == 0; link++)
+		for (link = 0; link <= 1 && ret == 0; link++)
 		{
 		    for (cond = 0; cond <= 1 && ret == 0; cond++)
 		    {
-		        for (ctr = 1; ctr <= 2 && ret == 0; ctr++)
+			for (ctr = 1; ctr <= 2 && ret == 0; ctr++)
 			{
 			    int dec = cd < 2;
 			    int cr = cond ? 0x80000000 : 0x00000000;
 			    int jumpc = cc >= 2 ||
-			                (cc == 0 && !cond) ||
-    			    		(cc == 1 && cond);
+					(cc == 0 && !cond) ||
+					(cc == 1 && cond);
 			    int jumpd = cd >= 2 ||
-			                (cd == 0 && ctr != 1) ||
-    			    		(cd == 1 && ctr == 1);
+					(cd == 0 && ctr != 1) ||
+					(cd == 1 && ctr == 1);
 			    int jump = jumpc && jumpd;
 
 			    ret = cpu_post_test_bc (link ? OP_BCL : OP_BC,
-			        (cc << 3) + (cd << 1), 0, jump, dec, link,
+				(cc << 3) + (cd << 1), 0, jump, dec, link,
 				ctr, cr);
 
-		    	    if (ret != 0)
-		    	    {
-		                post_log ("Error at b3 test %d !\n", i);
-		            }
+			    if (ret != 0)
+			    {
+				post_log ("Error at b3 test %d !\n", i);
+			    }
 
 			    i++;
 			}
diff --git a/post/cpu/complex.c b/post/cpu/complex.c
index dc8b080..033584b 100644
--- a/post/cpu/complex.c
+++ b/post/cpu/complex.c
@@ -116,7 +116,7 @@
 
     if (ret != 0)
     {
-        post_log ("Error at complex test !\n");
+	post_log ("Error at complex test !\n");
     }
 
     return ret;
diff --git a/post/cpu/cr.c b/post/cpu/cr.c
index 8e38729..da6ef37 100644
--- a/post/cpu/cr.c
+++ b/post/cpu/cr.c
@@ -70,11 +70,11 @@
 } cpu_post_cr_table2[] =
 {
     {
-    	0xa0000000,
+	0xa0000000,
 	1
     },
     {
-    	0x40000000,
+	0x40000000,
 	5
     },
 };
@@ -89,13 +89,13 @@
 } cpu_post_cr_table3[] =
 {
     {
-    	0x01234567,
+	0x01234567,
 	0,
 	4,
 	0x01230567
     },
     {
-    	0x01234567,
+	0x01234567,
 	7,
 	0,
 	0x71234567
@@ -115,131 +115,131 @@
 {
     {
 	OP_CRAND,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	16,
 	0,
-    	0x0000ffff
+	0x0000ffff
     },
     {
 	OP_CRAND,
-    	0x0000ffff,
+	0x0000ffff,
 	16,
 	17,
 	0,
-    	0x8000ffff
+	0x8000ffff
     },
     {
 	OP_CRANDC,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	16,
 	0,
-    	0x0000ffff
+	0x0000ffff
     },
     {
 	OP_CRANDC,
-    	0x0000ffff,
+	0x0000ffff,
 	16,
 	0,
 	0,
-    	0x8000ffff
+	0x8000ffff
     },
     {
 	OP_CROR,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	16,
 	0,
-    	0x8000ffff
+	0x8000ffff
     },
     {
 	OP_CROR,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	1,
 	0,
-    	0x0000ffff
+	0x0000ffff
     },
     {
 	OP_CRORC,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	16,
 	0,
-    	0x0000ffff
+	0x0000ffff
     },
     {
 	OP_CRORC,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	0,
 	0,
-    	0x8000ffff
+	0x8000ffff
     },
     {
 	OP_CRXOR,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	0,
 	0,
-    	0x0000ffff
+	0x0000ffff
     },
     {
 	OP_CRXOR,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	16,
 	0,
-    	0x8000ffff
+	0x8000ffff
     },
     {
 	OP_CRNAND,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	16,
 	0,
-    	0x8000ffff
+	0x8000ffff
     },
     {
 	OP_CRNAND,
-    	0x0000ffff,
+	0x0000ffff,
 	16,
 	17,
 	0,
-    	0x0000ffff
+	0x0000ffff
     },
     {
 	OP_CRNOR,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	16,
 	0,
-    	0x0000ffff
+	0x0000ffff
     },
     {
 	OP_CRNOR,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	1,
 	0,
-    	0x8000ffff
+	0x8000ffff
     },
     {
 	OP_CREQV,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	0,
 	0,
-    	0x8000ffff
+	0x8000ffff
     },
     {
 	OP_CREQV,
-    	0x0000ffff,
+	0x0000ffff,
 	0,
 	16,
 	0,
-    	0x0000ffff
+	0x0000ffff
     },
 };
 static unsigned int cpu_post_cr_size4 =
@@ -258,7 +258,7 @@
 	ulong cr = cpu_post_cr_table1[i];
 	ulong res;
 
-    	unsigned long code[] =
+	unsigned long code[] =
 	{
 	    ASM_MTCR(3),
 	    ASM_MFCR(3),
@@ -269,10 +269,10 @@
 
 	ret = res == cr ? 0 : -1;
 
-    	if (ret != 0)
-    	{
-            post_log ("Error at cr1 test %d !\n", i);
-    	}
+	if (ret != 0)
+	{
+	    post_log ("Error at cr1 test %d !\n", i);
+	}
     }
 
     for (i = 0; i < cpu_post_cr_size2 && ret == 0; i++)
@@ -281,7 +281,7 @@
 	ulong res;
 	ulong xer;
 
-    	unsigned long code[] =
+	unsigned long code[] =
 	{
 	    ASM_MTXER(3),
 	    ASM_MCRXR(test->cr),
@@ -295,10 +295,10 @@
 	ret = xer == 0 && ((res << (4 * test->cr)) & 0xe0000000) == test->xer ?
 	      0 : -1;
 
-    	if (ret != 0)
-    	{
-            post_log ("Error at cr2 test %d !\n", i);
-    	}
+	if (ret != 0)
+	{
+	    post_log ("Error at cr2 test %d !\n", i);
+	}
     }
 
     for (i = 0; i < cpu_post_cr_size3 && ret == 0; i++)
@@ -306,7 +306,7 @@
 	struct cpu_post_cr_s3 *test = cpu_post_cr_table3 + i;
 	ulong res;
 
-    	unsigned long code[] =
+	unsigned long code[] =
 	{
 	    ASM_MTCR(3),
 	    ASM_MCRF(test->cd, test->cs),
@@ -318,10 +318,10 @@
 
 	ret = res == test->res ? 0 : -1;
 
-    	if (ret != 0)
-    	{
-            post_log ("Error at cr3 test %d !\n", i);
-    	}
+	if (ret != 0)
+	{
+	    post_log ("Error at cr3 test %d !\n", i);
+	}
     }
 
     for (i = 0; i < cpu_post_cr_size4 && ret == 0; i++)
@@ -329,7 +329,7 @@
 	struct cpu_post_cr_s4 *test = cpu_post_cr_table4 + i;
 	ulong res;
 
-    	unsigned long code[] =
+	unsigned long code[] =
 	{
 	    ASM_MTCR(3),
 	    ASM_12F(test->cmd, test->op3, test->op1, test->op2),
@@ -341,10 +341,10 @@
 
 	ret = res == test->res ? 0 : -1;
 
-    	if (ret != 0)
-    	{
-            post_log ("Error at cr4 test %d !\n", i);
-    	}
+	if (ret != 0)
+	{
+	    post_log ("Error at cr4 test %d !\n", i);
+	}
     }
 
     asm ( "mtcr %0" : : "r" (cr_sav));
diff --git a/post/cpu/load.c b/post/cpu/load.c
index b3418ef..393c568 100644
--- a/post/cpu/load.c
+++ b/post/cpu/load.c
@@ -61,112 +61,112 @@
 } cpu_post_load_table[] =
 {
     {
-    	OP_LWZ,
+	OP_LWZ,
 	4,
 	0,
 	0,
 	4
     },
     {
-    	OP_LHA,
+	OP_LHA,
 	3,
 	0,
 	0,
 	2
     },
     {
-    	OP_LHZ,
+	OP_LHZ,
 	2,
 	0,
 	0,
 	2
     },
     {
-    	OP_LBZ,
+	OP_LBZ,
 	1,
 	0,
 	0,
 	1
     },
     {
-    	OP_LWZU,
+	OP_LWZU,
 	4,
 	1,
 	0,
 	4
     },
     {
-    	OP_LHAU,
+	OP_LHAU,
 	3,
 	1,
 	0,
 	2
     },
     {
-    	OP_LHZU,
+	OP_LHZU,
 	2,
 	1,
 	0,
 	2
     },
     {
-    	OP_LBZU,
+	OP_LBZU,
 	1,
 	1,
 	0,
 	1
     },
     {
-    	OP_LWZX,
+	OP_LWZX,
 	4,
 	0,
 	1,
 	4
     },
     {
-    	OP_LHAX,
+	OP_LHAX,
 	3,
 	0,
 	1,
 	2
     },
     {
-    	OP_LHZX,
+	OP_LHZX,
 	2,
 	0,
 	1,
 	2
     },
     {
-    	OP_LBZX,
+	OP_LBZX,
 	1,
 	0,
 	1,
 	1
     },
     {
-    	OP_LWZUX,
+	OP_LWZUX,
 	4,
 	1,
 	1,
 	4
     },
     {
-    	OP_LHAUX,
+	OP_LHAUX,
 	3,
 	1,
 	1,
 	2
     },
     {
-    	OP_LHZUX,
+	OP_LHZUX,
 	2,
 	1,
 	1,
 	2
     },
     {
-    	OP_LBZUX,
+	OP_LBZUX,
 	1,
 	1,
 	1,
@@ -186,7 +186,7 @@
 	struct cpu_post_load_s *test = cpu_post_load_table + i;
 	uchar data[16] =
 	{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-    	ulong base0 = (ulong) (data + 8);
+	ulong base0 = (ulong) (data + 8);
 	ulong base = base0;
 	ulong value;
 
@@ -194,7 +194,7 @@
 	{
 	    ulong code[] =
 	    {
-	    	ASM_12(test->cmd, 5, 3, 4),
+		ASM_12(test->cmd, 5, 3, 4),
 		ASM_BLR,
 	    };
 
@@ -204,7 +204,7 @@
 	{
 	    ulong code[] =
 	    {
-	    	ASM_11I(test->cmd, 4, 3, test->offset),
+		ASM_11I(test->cmd, 4, 3, test->offset),
 		ASM_BLR,
 	    };
 
@@ -224,27 +224,27 @@
 	    switch (test->width)
 	    {
 	    case 1:
-	        ret = *(uchar *)(base0 + test->offset) == value ?
+		ret = *(uchar *)(base0 + test->offset) == value ?
 		      0 : -1;
-	        break;
+		break;
 	    case 2:
-	        ret = *(ushort *)(base0 + test->offset) == value ?
+		ret = *(ushort *)(base0 + test->offset) == value ?
 		      0 : -1;
-	        break;
+		break;
 	    case 3:
-	        ret = *(short *)(base0 + test->offset) == value ?
+		ret = *(short *)(base0 + test->offset) == value ?
 		      0 : -1;
-	        break;
+		break;
 	    case 4:
-	        ret = *(ulong *)(base0 + test->offset) == value ?
+		ret = *(ulong *)(base0 + test->offset) == value ?
 		      0 : -1;
-	        break;
+		break;
 	    }
 	}
 
 	if (ret != 0)
 	{
-            post_log ("Error at load test %d !\n", i);
+	    post_log ("Error at load test %d !\n", i);
 	}
     }
 
diff --git a/post/cpu/multi.c b/post/cpu/multi.c
index bdad5d9..8724384 100644
--- a/post/cpu/multi.c
+++ b/post/cpu/multi.c
@@ -51,7 +51,7 @@
     {
 	ulong src [26], dst [26];
 
-    	ulong code[] =
+	ulong code[] =
 	{
 	    ASM_LMW(5, 3, 0),
 	    ASM_STMW(5, 4, 0),
@@ -71,7 +71,7 @@
 
     if (ret != 0)
     {
-        post_log ("Error at multi test !\n");
+	post_log ("Error at multi test !\n");
     }
 
     return ret;
diff --git a/post/cpu/store.c b/post/cpu/store.c
index e5189c7..f495bf2 100644
--- a/post/cpu/store.c
+++ b/post/cpu/store.c
@@ -62,7 +62,7 @@
 } cpu_post_store_table[] =
 {
     {
-    	OP_STW,
+	OP_STW,
 	4,
 	0,
 	0,
@@ -70,7 +70,7 @@
 	0xff00ff00
     },
     {
-    	OP_STH,
+	OP_STH,
 	2,
 	0,
 	0,
@@ -78,7 +78,7 @@
 	0xff00
     },
     {
-    	OP_STB,
+	OP_STB,
 	1,
 	0,
 	0,
@@ -86,7 +86,7 @@
 	0xff
     },
     {
-    	OP_STWU,
+	OP_STWU,
 	4,
 	1,
 	0,
@@ -94,7 +94,7 @@
 	0xff00ff00
     },
     {
-    	OP_STHU,
+	OP_STHU,
 	2,
 	1,
 	0,
@@ -102,7 +102,7 @@
 	0xff00
     },
     {
-    	OP_STBU,
+	OP_STBU,
 	1,
 	1,
 	0,
@@ -110,7 +110,7 @@
 	0xff
     },
     {
-    	OP_STWX,
+	OP_STWX,
 	4,
 	0,
 	1,
@@ -118,7 +118,7 @@
 	0xff00ff00
     },
     {
-    	OP_STHX,
+	OP_STHX,
 	2,
 	0,
 	1,
@@ -126,7 +126,7 @@
 	0xff00
     },
     {
-    	OP_STBX,
+	OP_STBX,
 	1,
 	0,
 	1,
@@ -134,7 +134,7 @@
 	0xff
     },
     {
-    	OP_STWUX,
+	OP_STWUX,
 	4,
 	1,
 	1,
@@ -142,7 +142,7 @@
 	0xff00ff00
     },
     {
-    	OP_STHUX,
+	OP_STHUX,
 	2,
 	1,
 	1,
@@ -150,7 +150,7 @@
 	0xff00
     },
     {
-    	OP_STBUX,
+	OP_STBUX,
 	1,
 	1,
 	1,
@@ -171,14 +171,14 @@
 	struct cpu_post_store_s *test = cpu_post_store_table + i;
 	uchar data[16] =
 	{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-    	ulong base0 = (ulong) (data + 8);
+	ulong base0 = (ulong) (data + 8);
 	ulong base = base0;
 
 	if (test->index)
 	{
 	    ulong code[] =
 	    {
-	    	ASM_12(test->cmd, 5, 3, 4),
+		ASM_12(test->cmd, 5, 3, 4),
 		ASM_BLR,
 	    };
 
@@ -188,7 +188,7 @@
 	{
 	    ulong code[] =
 	    {
-	    	ASM_11I(test->cmd, 4, 3, test->offset),
+		ASM_11I(test->cmd, 4, 3, test->offset),
 		ASM_BLR,
 	    };
 
@@ -208,23 +208,23 @@
 	    switch (test->width)
 	    {
 	    case 1:
-	        ret = *(uchar *)(base0 + test->offset) == test->value ?
+		ret = *(uchar *)(base0 + test->offset) == test->value ?
 		      0 : -1;
-	        break;
+		break;
 	    case 2:
-	        ret = *(ushort *)(base0 + test->offset) == test->value ?
+		ret = *(ushort *)(base0 + test->offset) == test->value ?
 		      0 : -1;
-	        break;
+		break;
 	    case 4:
-	        ret = *(ulong *)(base0 + test->offset) == test->value ?
+		ret = *(ulong *)(base0 + test->offset) == test->value ?
 		      0 : -1;
-	        break;
+		break;
 	    }
 	}
 
 	if (ret != 0)
 	{
-            post_log ("Error at store test %d !\n", i);
+	    post_log ("Error at store test %d !\n", i);
 	}
     }
 
diff --git a/post/cpu/string.c b/post/cpu/string.c
index a19a755..bd83bd1 100644
--- a/post/cpu/string.c
+++ b/post/cpu/string.c
@@ -54,7 +54,7 @@
     {
 	char src [31], dst [31];
 
-    	ulong code[] =
+	ulong code[] =
 	{
 	    ASM_LSWI(5, 3, 31),
 	    ASM_STSWI(5, 4, 31),
@@ -76,7 +76,7 @@
     {
 	char src [95], dst [95];
 
-    	ulong code[] =
+	ulong code[] =
 	{
 	    ASM_LSWX(8, 3, 5),
 	    ASM_STSWX(8, 4, 5),
@@ -96,7 +96,7 @@
 
     if (ret != 0)
     {
-        post_log ("Error at string test !\n");
+	post_log ("Error at string test !\n");
     }
 
     return ret;
diff --git a/post/cpu/two.c b/post/cpu/two.c
index 6075714..cfbac5e 100644
--- a/post/cpu/two.c
+++ b/post/cpu/two.c
@@ -53,32 +53,32 @@
 } cpu_post_two_table[] =
 {
     {
-    	OP_NEG,
+	OP_NEG,
 	3,
 	-3
     },
     {
-    	OP_NEG,
+	OP_NEG,
 	5,
 	-5
     },
     {
-        OP_ADDME,
+	OP_ADDME,
 	6,
 	5
     },
     {
-        OP_ADDZE,
+	OP_ADDZE,
 	5,
 	5
     },
     {
-        OP_SUBFME,
+	OP_SUBFME,
 	6,
 	~6 - 1
     },
     {
-        OP_SUBFZE,
+	OP_SUBFZE,
 	5,
 	~5
     },
@@ -101,7 +101,7 @@
 	    unsigned int reg0 = (reg + 0) % 32;
 	    unsigned int reg1 = (reg + 1) % 32;
 	    unsigned int stk = reg < 16 ? 31 : 15;
-    	    unsigned long code[] =
+	    unsigned long code[] =
 	    {
 		ASM_STW(stk, 1, -4),
 		ASM_ADDI(stk, 1, -16),
@@ -118,7 +118,7 @@
 		ASM_LWZ(stk, 1, -4),
 		ASM_BLR,
 	    };
-    	    unsigned long codecr[] =
+	    unsigned long codecr[] =
 	    {
 		ASM_STW(stk, 1, -4),
 		ASM_ADDI(stk, 1, -16),
@@ -140,34 +140,34 @@
 
 	    if (ret == 0)
 	    {
- 	    	cr = 0;
-	    	cpu_post_exec_21 (code, & cr, & res, test->op);
+		cr = 0;
+		cpu_post_exec_21 (code, & cr, & res, test->op);
 
-	    	ret = res == test->res && cr == 0 ? 0 : -1;
+		ret = res == test->res && cr == 0 ? 0 : -1;
 
-	    	if (ret != 0)
-	    	{
-	            post_log ("Error at two test %d !\n", i);
-	    	}
+		if (ret != 0)
+		{
+		    post_log ("Error at two test %d !\n", i);
+		}
 	    }
 
 	    if (ret == 0)
 	    {
-	    	cpu_post_exec_21 (codecr, & cr, & res, test->op);
+		cpu_post_exec_21 (codecr, & cr, & res, test->op);
 
-	    	ret = res == test->res &&
+		ret = res == test->res &&
 		      (cr & 0xe0000000) == cpu_post_makecr (res) ? 0 : -1;
 
-	    	if (ret != 0)
-	    	{
-	            post_log ("Error at two test %d !\n", i);
-	        }
+		if (ret != 0)
+		{
+		    post_log ("Error at two test %d !\n", i);
+		}
 	    }
 	}
     }
 
     if (flag)
-    	enable_interrupts();
+	enable_interrupts();
 
     return ret;
 }