Commit 09e13e91 authored by Finn Thain's avatar Finn Thain Committed by James Bottomley

[SCSI] m68k: mac_esp asm fix

Fix asm constraints and arguments so as not to transfer an odd byte when
there may be more words to transfer. The bug would probably also cause
exceptions sometimes by transferring one too many bytes.
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 749af3d5
...@@ -170,7 +170,7 @@ static inline int mac_esp_wait_for_dreq(struct esp *esp) ...@@ -170,7 +170,7 @@ static inline int mac_esp_wait_for_dreq(struct esp *esp)
#define MAC_ESP_PDMA_LOOP(operands) \ #define MAC_ESP_PDMA_LOOP(operands) \
asm volatile ( \ asm volatile ( \
" tstw %2 \n" \ " tstw %1 \n" \
" jbeq 20f \n" \ " jbeq 20f \n" \
"1: movew " operands " \n" \ "1: movew " operands " \n" \
"2: movew " operands " \n" \ "2: movew " operands " \n" \
...@@ -188,14 +188,14 @@ static inline int mac_esp_wait_for_dreq(struct esp *esp) ...@@ -188,14 +188,14 @@ static inline int mac_esp_wait_for_dreq(struct esp *esp)
"14: movew " operands " \n" \ "14: movew " operands " \n" \
"15: movew " operands " \n" \ "15: movew " operands " \n" \
"16: movew " operands " \n" \ "16: movew " operands " \n" \
" subqw #1,%2 \n" \ " subqw #1,%1 \n" \
" jbne 1b \n" \ " jbne 1b \n" \
"20: tstw %3 \n" \ "20: tstw %2 \n" \
" jbeq 30f \n" \ " jbeq 30f \n" \
"21: movew " operands " \n" \ "21: movew " operands " \n" \
" subqw #1,%3 \n" \ " subqw #1,%2 \n" \
" jbne 21b \n" \ " jbne 21b \n" \
"30: tstw %4 \n" \ "30: tstw %3 \n" \
" jbeq 40f \n" \ " jbeq 40f \n" \
"31: moveb " operands " \n" \ "31: moveb " operands " \n" \
"32: nop \n" \ "32: nop \n" \
...@@ -223,8 +223,8 @@ static inline int mac_esp_wait_for_dreq(struct esp *esp) ...@@ -223,8 +223,8 @@ static inline int mac_esp_wait_for_dreq(struct esp *esp)
" .long 31b,40b \n" \ " .long 31b,40b \n" \
" .long 32b,40b \n" \ " .long 32b,40b \n" \
" .previous \n" \ " .previous \n" \
: "+a" (addr) \ : "+a" (addr), "+r" (count32), "+r" (count2) \
: "a" (mep->pdma_io), "r" (count32), "r" (count2), "g" (esp_count)) : "g" (count1), "a" (mep->pdma_io))
static void mac_esp_send_pdma_cmd(struct esp *esp, u32 addr, u32 esp_count, static void mac_esp_send_pdma_cmd(struct esp *esp, u32 addr, u32 esp_count,
u32 dma_count, int write, u8 cmd) u32 dma_count, int write, u8 cmd)
...@@ -247,19 +247,20 @@ static void mac_esp_send_pdma_cmd(struct esp *esp, u32 addr, u32 esp_count, ...@@ -247,19 +247,20 @@ static void mac_esp_send_pdma_cmd(struct esp *esp, u32 addr, u32 esp_count,
do { do {
unsigned int count32 = esp_count >> 5; unsigned int count32 = esp_count >> 5;
unsigned int count2 = (esp_count & 0x1F) >> 1; unsigned int count2 = (esp_count & 0x1F) >> 1;
unsigned int count1 = esp_count & 1;
unsigned int start_addr = addr; unsigned int start_addr = addr;
if (mac_esp_wait_for_dreq(esp)) if (mac_esp_wait_for_dreq(esp))
break; break;
if (write) { if (write) {
MAC_ESP_PDMA_LOOP("%1@,%0@+"); MAC_ESP_PDMA_LOOP("%4@,%0@+");
esp_count -= addr - start_addr; esp_count -= addr - start_addr;
} else { } else {
unsigned int n; unsigned int n;
MAC_ESP_PDMA_LOOP("%0@+,%1@"); MAC_ESP_PDMA_LOOP("%0@+,%4@");
if (mac_esp_wait_for_empty_fifo(esp)) if (mac_esp_wait_for_empty_fifo(esp))
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment