fork of PCE focusing on macplus, supporting DaynaPort SCSI network emulation
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

macplus: Properly handle multi-packet DaynaPort WRITE(6)s

This greatly speeds up EtherTalk since we are no longer dropping
additional packets and having to wait and retry them.

+38 -7
+38 -7
src/arch/macplus/scsi.c
··· 656 656 } 657 657 break; 658 658 case MAC_SCSI_DEV_ETHERNET: 659 - if (scsi->cmd[5] == 0x80) { 660 - cnt = (scsi->buf[0] << 8) | scsi->buf[1]; 661 - mac_scsi_ethernet_write (dev, scsi->buf + 4, cnt); 662 - } else { 663 - mac_scsi_ethernet_write (dev, scsi->buf, cnt); 659 + for (;;) { 660 + if (scsi->cmd[5] == 0x80) { 661 + cnt = (long)(scsi->buf[0] << 8) | scsi->buf[1]; 662 + mac_scsi_ethernet_write (dev, scsi->buf + 4, cnt); 663 + } else { 664 + /* XXX: do these non-preamble packets exist? */ 665 + mac_scsi_ethernet_write (dev, scsi->buf, cnt); 666 + break; 667 + } 668 + 669 + /* trailing 2 bytes are size of next packet + flags */ 670 + cnt = (long)(scsi->buf[cnt + 4] << 8) | 671 + scsi->buf[cnt + 5]; 672 + if (cnt == 0) 673 + break; 674 + 675 + /* 676 + * setup scsi buffers to pretend this next packet in 677 + * the same read(6) is actually a new transaction 678 + */ 679 + scsi->cmd[3] = (cnt >> 8) & 0xff; 680 + scsi->cmd[4] = cnt & 0xff; 681 + 682 + scsi->buf[0] = (cnt >> 8) & 0xff; 683 + scsi->buf[1] = cnt & 0xff; 684 + scsi->buf[2] = 0; 685 + scsi->buf[3] = 0; 686 + 687 + scsi->buf_i = 4; 688 + scsi->buf_n = 4 + cnt + 4; 689 + return; 664 690 } 665 691 break; 666 692 } ··· 719 745 break; 720 746 721 747 case MAC_SCSI_DEV_ETHERNET: 722 - size = scsi->cmd[4] + (scsi->cmd[3] << 8); 748 + size = ((long)(scsi->cmd[3]) << 8) + scsi->cmd[4]; 749 + 723 750 if (scsi->cmd[5] == 0x80) { 724 - size += 8; 751 + /* 752 + * multi-packet capable, include 4-byte header and 753 + * 4-byte header of next packet 754 + */ 755 + size += 4 + 4; 725 756 } 726 757 break; 727 758 }