diff options
author | wdenk <wdenk> | 2003-06-27 21:31:46 +0000 |
---|---|---|
committer | wdenk <wdenk> | 2003-06-27 21:31:46 +0000 |
commit | 8bde7f776c77b343aca29b8c7b58464d915ac245 (patch) | |
tree | 20f1fd99975215e7c658454a15cdb4ed4694e2d4 /post/cpu | |
parent | 993cad9364c6b87ae429d1ed1130d8153f6f027e (diff) | |
download | u-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.zip u-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.gz u-boot-imx-8bde7f776c77b343aca29b8c7b58464d915ac245.tar.bz2 |
* 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)
Diffstat (limited to 'post/cpu')
-rw-r--r-- | post/cpu/b.c | 48 | ||||
-rw-r--r-- | post/cpu/complex.c | 2 | ||||
-rw-r--r-- | post/cpu/cr.c | 112 | ||||
-rw-r--r-- | post/cpu/load.c | 56 | ||||
-rw-r--r-- | post/cpu/multi.c | 4 | ||||
-rw-r--r-- | post/cpu/store.c | 44 | ||||
-rw-r--r-- | post/cpu/string.c | 6 | ||||
-rw-r--r-- | post/cpu/two.c | 44 |
8 files changed, 158 insertions, 158 deletions
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 @@ static int cpu_post_test_bc (ulong cmd, ulong bo, ulong bi, } 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 @@ int cpu_post_test_b (void) if (ret == 0) { - ulong code[] = + ulong code[] = { ASM_MFLR(4), ASM_MTLR(3), @@ -115,15 +115,15 @@ int cpu_post_test_b (void) 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 @@ int cpu_post_test_b (void) 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 @@ int cpu_post_test_b (void) { 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 @@ int cpu_post_test_complex (void) 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 @@ static struct cpu_post_cr_s2 { } cpu_post_cr_table2[] = { { - 0xa0000000, + 0xa0000000, 1 }, { - 0x40000000, + 0x40000000, 5 }, }; @@ -89,13 +89,13 @@ static struct cpu_post_cr_s3 { } cpu_post_cr_table3[] = { { - 0x01234567, + 0x01234567, 0, 4, 0x01230567 }, { - 0x01234567, + 0x01234567, 7, 0, 0x71234567 @@ -115,131 +115,131 @@ static struct cpu_post_cr_s4 { { { 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 @@ int cpu_post_test_cr (void) 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 @@ int cpu_post_test_cr (void) 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 @@ int cpu_post_test_cr (void) ulong res; ulong xer; - unsigned long code[] = + unsigned long code[] = { ASM_MTXER(3), ASM_MCRXR(test->cr), @@ -295,10 +295,10 @@ int cpu_post_test_cr (void) 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 @@ int cpu_post_test_cr (void) 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 @@ int cpu_post_test_cr (void) 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 @@ int cpu_post_test_cr (void) 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 @@ int cpu_post_test_cr (void) 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 @@ static struct cpu_post_load_s } 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 @@ int cpu_post_test_load (void) 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 @@ int cpu_post_test_load (void) { ulong code[] = { - ASM_12(test->cmd, 5, 3, 4), + ASM_12(test->cmd, 5, 3, 4), ASM_BLR, }; @@ -204,7 +204,7 @@ int cpu_post_test_load (void) { ulong code[] = { - ASM_11I(test->cmd, 4, 3, test->offset), + ASM_11I(test->cmd, 4, 3, test->offset), ASM_BLR, }; @@ -224,27 +224,27 @@ int cpu_post_test_load (void) 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 @@ int cpu_post_test_multi (void) { ulong src [26], dst [26]; - ulong code[] = + ulong code[] = { ASM_LMW(5, 3, 0), ASM_STMW(5, 4, 0), @@ -71,7 +71,7 @@ int cpu_post_test_multi (void) 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 @@ static struct cpu_post_store_s } cpu_post_store_table[] = { { - OP_STW, + OP_STW, 4, 0, 0, @@ -70,7 +70,7 @@ static struct cpu_post_store_s 0xff00ff00 }, { - OP_STH, + OP_STH, 2, 0, 0, @@ -78,7 +78,7 @@ static struct cpu_post_store_s 0xff00 }, { - OP_STB, + OP_STB, 1, 0, 0, @@ -86,7 +86,7 @@ static struct cpu_post_store_s 0xff }, { - OP_STWU, + OP_STWU, 4, 1, 0, @@ -94,7 +94,7 @@ static struct cpu_post_store_s 0xff00ff00 }, { - OP_STHU, + OP_STHU, 2, 1, 0, @@ -102,7 +102,7 @@ static struct cpu_post_store_s 0xff00 }, { - OP_STBU, + OP_STBU, 1, 1, 0, @@ -110,7 +110,7 @@ static struct cpu_post_store_s 0xff }, { - OP_STWX, + OP_STWX, 4, 0, 1, @@ -118,7 +118,7 @@ static struct cpu_post_store_s 0xff00ff00 }, { - OP_STHX, + OP_STHX, 2, 0, 1, @@ -126,7 +126,7 @@ static struct cpu_post_store_s 0xff00 }, { - OP_STBX, + OP_STBX, 1, 0, 1, @@ -134,7 +134,7 @@ static struct cpu_post_store_s 0xff }, { - OP_STWUX, + OP_STWUX, 4, 1, 1, @@ -142,7 +142,7 @@ static struct cpu_post_store_s 0xff00ff00 }, { - OP_STHUX, + OP_STHUX, 2, 1, 1, @@ -150,7 +150,7 @@ static struct cpu_post_store_s 0xff00 }, { - OP_STBUX, + OP_STBUX, 1, 1, 1, @@ -171,14 +171,14 @@ int cpu_post_test_store (void) 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 @@ int cpu_post_test_store (void) { ulong code[] = { - ASM_11I(test->cmd, 4, 3, test->offset), + ASM_11I(test->cmd, 4, 3, test->offset), ASM_BLR, }; @@ -208,23 +208,23 @@ int cpu_post_test_store (void) 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 @@ int cpu_post_test_string (void) { char src [31], dst [31]; - ulong code[] = + ulong code[] = { ASM_LSWI(5, 3, 31), ASM_STSWI(5, 4, 31), @@ -76,7 +76,7 @@ int cpu_post_test_string (void) { char src [95], dst [95]; - ulong code[] = + ulong code[] = { ASM_LSWX(8, 3, 5), ASM_STSWX(8, 4, 5), @@ -96,7 +96,7 @@ int cpu_post_test_string (void) 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 @@ static struct cpu_post_two_s } 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 @@ int cpu_post_test_two (void) 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 @@ int cpu_post_test_two (void) 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 @@ int cpu_post_test_two (void) 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; } |