diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-01-26 13:10:44 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-03-04 01:26:55 -0500 |
commit | bb7b11290afd2a192d33c357a2a62cb8eaf29eab (patch) | |
tree | 26713e5fb62a4950f485890157696620aba13d0b /arch | |
parent | b65a0e0c84cf489bfa00d6aa6c48abc5a237100f (diff) |
Blackfin: outs[lwb]: make sure count is greater than 0
Some devices will use the outs* funcs with a length of zero, so make sure
we do not write any data in that case.
Reported-by: Gilbert Inho <gneny@edevice.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/blackfin/lib/outs.S | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/blackfin/lib/outs.S b/arch/blackfin/lib/outs.S index 250f4d4b9436..06a5e674401f 100644 --- a/arch/blackfin/lib/outs.S +++ b/arch/blackfin/lib/outs.S | |||
@@ -13,6 +13,8 @@ | |||
13 | .align 2 | 13 | .align 2 |
14 | 14 | ||
15 | ENTRY(_outsl) | 15 | ENTRY(_outsl) |
16 | CC = R2 == 0; | ||
17 | IF CC JUMP 1f; | ||
16 | P0 = R0; /* P0 = port */ | 18 | P0 = R0; /* P0 = port */ |
17 | P1 = R1; /* P1 = address */ | 19 | P1 = R1; /* P1 = address */ |
18 | P2 = R2; /* P2 = count */ | 20 | P2 = R2; /* P2 = count */ |
@@ -20,10 +22,12 @@ ENTRY(_outsl) | |||
20 | LSETUP( .Llong_loop_s, .Llong_loop_e) LC0 = P2; | 22 | LSETUP( .Llong_loop_s, .Llong_loop_e) LC0 = P2; |
21 | .Llong_loop_s: R0 = [P1++]; | 23 | .Llong_loop_s: R0 = [P1++]; |
22 | .Llong_loop_e: [P0] = R0; | 24 | .Llong_loop_e: [P0] = R0; |
23 | RTS; | 25 | 1: RTS; |
24 | ENDPROC(_outsl) | 26 | ENDPROC(_outsl) |
25 | 27 | ||
26 | ENTRY(_outsw) | 28 | ENTRY(_outsw) |
29 | CC = R2 == 0; | ||
30 | IF CC JUMP 1f; | ||
27 | P0 = R0; /* P0 = port */ | 31 | P0 = R0; /* P0 = port */ |
28 | P1 = R1; /* P1 = address */ | 32 | P1 = R1; /* P1 = address */ |
29 | P2 = R2; /* P2 = count */ | 33 | P2 = R2; /* P2 = count */ |
@@ -31,10 +35,12 @@ ENTRY(_outsw) | |||
31 | LSETUP( .Lword_loop_s, .Lword_loop_e) LC0 = P2; | 35 | LSETUP( .Lword_loop_s, .Lword_loop_e) LC0 = P2; |
32 | .Lword_loop_s: R0 = W[P1++]; | 36 | .Lword_loop_s: R0 = W[P1++]; |
33 | .Lword_loop_e: W[P0] = R0; | 37 | .Lword_loop_e: W[P0] = R0; |
34 | RTS; | 38 | 1: RTS; |
35 | ENDPROC(_outsw) | 39 | ENDPROC(_outsw) |
36 | 40 | ||
37 | ENTRY(_outsb) | 41 | ENTRY(_outsb) |
42 | CC = R2 == 0; | ||
43 | IF CC JUMP 1f; | ||
38 | P0 = R0; /* P0 = port */ | 44 | P0 = R0; /* P0 = port */ |
39 | P1 = R1; /* P1 = address */ | 45 | P1 = R1; /* P1 = address */ |
40 | P2 = R2; /* P2 = count */ | 46 | P2 = R2; /* P2 = count */ |
@@ -42,10 +48,12 @@ ENTRY(_outsb) | |||
42 | LSETUP( .Lbyte_loop_s, .Lbyte_loop_e) LC0 = P2; | 48 | LSETUP( .Lbyte_loop_s, .Lbyte_loop_e) LC0 = P2; |
43 | .Lbyte_loop_s: R0 = B[P1++]; | 49 | .Lbyte_loop_s: R0 = B[P1++]; |
44 | .Lbyte_loop_e: B[P0] = R0; | 50 | .Lbyte_loop_e: B[P0] = R0; |
45 | RTS; | 51 | 1: RTS; |
46 | ENDPROC(_outsb) | 52 | ENDPROC(_outsb) |
47 | 53 | ||
48 | ENTRY(_outsw_8) | 54 | ENTRY(_outsw_8) |
55 | CC = R2 == 0; | ||
56 | IF CC JUMP 1f; | ||
49 | P0 = R0; /* P0 = port */ | 57 | P0 = R0; /* P0 = port */ |
50 | P1 = R1; /* P1 = address */ | 58 | P1 = R1; /* P1 = address */ |
51 | P2 = R2; /* P2 = count */ | 59 | P2 = R2; /* P2 = count */ |
@@ -56,5 +64,5 @@ ENTRY(_outsw_8) | |||
56 | R0 = R0 << 8; | 64 | R0 = R0 << 8; |
57 | R0 = R0 + R1; | 65 | R0 = R0 + R1; |
58 | .Lword8_loop_e: W[P0] = R0; | 66 | .Lword8_loop_e: W[P0] = R0; |
59 | RTS; | 67 | 1: RTS; |
60 | ENDPROC(_outsw_8) | 68 | ENDPROC(_outsw_8) |