Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

macintosh/via-cuda: Don't rely on Cuda to end a transfer

Certain Cuda transfers have to be ended by the driver. According
to Apple's open source Cuda driver, as found in mkLinux and XNU, this
applies to any "open ended request such as PRAM read". This fixes an
infinite polling loop in cuda_pram_read_byte().

Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Finn Thain and committed by
Greg Kroah-Hartman
458c77f3 aefcb746

+5 -3
+5 -3
drivers/macintosh/via-cuda.c
··· 569 569 unsigned char ibuf[16]; 570 570 int ibuf_len = 0; 571 571 int complete = 0; 572 + bool full; 572 573 573 574 spin_lock_irqsave(&cuda_lock, flags); 574 575 ··· 657 656 break; 658 657 659 658 case reading: 660 - if (reading_reply ? ARRAY_FULL(current_req->reply, reply_ptr) 661 - : ARRAY_FULL(cuda_rbuf, reply_ptr)) 659 + full = reading_reply ? ARRAY_FULL(current_req->reply, reply_ptr) 660 + : ARRAY_FULL(cuda_rbuf, reply_ptr); 661 + if (full) 662 662 (void)in_8(&via[SR]); 663 663 else 664 664 *reply_ptr++ = in_8(&via[SR]); 665 - if (!TREQ_asserted(status)) { 665 + if (!TREQ_asserted(status) || full) { 666 666 if (mcu_is_egret) 667 667 assert_TACK(); 668 668 /* that's all folks */