--- Gnu-Mach/linux/src/drivers/scsi/ppa.c 2020/09/02 04:41:40 1.1 +++ Gnu-Mach/linux/src/drivers/scsi/ppa.c 2020/09/02 04:46:30 1.1.1.3 @@ -259,7 +259,6 @@ int ppa_detect(Scsi_Host_Template * host struct Scsi_Host *hreg; int ports; int i, nhosts; - unsigned short ppb; printk("ppa: Version %s\n", PPA_VERSION); nhosts = 0; @@ -267,7 +266,7 @@ int ppa_detect(Scsi_Host_Template * host for (i = 0; i < parbus_no; i++) { if (parbus_base[i] == 0x0000) continue; - ppb = ppa_hosts[i].base = parbus_base[i]; + ppa_hosts[i].base = parbus_base[i]; /* sanity checks */ if (check_region(parbus_base[i], @@ -470,41 +469,13 @@ static inline void ecp_sync(unsigned sho static inline int ppa_byte_out(unsigned short base, char *buffer, unsigned int len) { - /* - * %eax scratch - * %ebx Data to transfer - * %ecx Counter (Don't touch!!) - * %edx Port - * %esi Source buffer (mem pointer) - * - * In case you are wondering what the last line of the asm does... - * : : - */ - asm("shr $2,%%ecx\n" \ - " jz .no_more_bulk_bo\n" \ - " .align 4\n" \ - ".loop_bulk_bo:\n" \ - " movl (%%esi),%%ebx\n" \ - BYTE_OUT(%%bl) \ - BYTE_OUT(%%bh) \ - " rorl $16,%%ebx\n" \ - BYTE_OUT(%%bl) \ - BYTE_OUT(%%bh) \ - " addl $4,%%esi\n" \ - " loop .loop_bulk_bo\n" \ - " .align 4\n" \ - ".no_more_bulk_bo:" \ - : "=S"(buffer): "c"(len), "d"(base), "S"(buffer):"eax", "ebx", "ecx"); - - asm("andl $3,%%ecx\n" \ - " jz .no_more_loose_bo\n" \ - " .align 4\n" \ - ".loop_loose_bo:\n" \ - BYTE_OUT((%%esi)) \ - " incl %%esi\n" \ - " loop .loop_loose_bo\n" \ - ".no_more_loose_bo:\n" \ - : /* no output */ : "c"(len), "d"(base), "S"(buffer):"eax", "ebx", "ecx"); + int i; + + for (i = len; i; i--) { + w_dtr(base, *buffer++); + w_ctr(base, 0xe); + w_ctr(base, 0xc); + } return 1; /* All went well - we hope! */ } @@ -520,42 +491,13 @@ static inline int ppa_byte_out(unsigned static inline int ppa_byte_in(unsigned short base, char *buffer, int len) { - /* - * %eax scratch - * %ebx Data to transfer - * %ecx Counter (Don't touch!!) - * %edx Port - * %esi Source buffer (mem pointer) - * - * In case you are wondering what the last line of the asm does... - * : : - */ - asm("shr $2,%%ecx\n" \ - " jz .no_more_bulk_bi\n" \ - " .align 4\n" \ - ".loop_bulk_bi:\n" \ - BYTE_IN(%%bl) \ - BYTE_IN(%%bh) \ - " rorl $16,%%ebx\n" \ - BYTE_IN(%%bl) \ - BYTE_IN(%%bh) \ - " rorl $16,%%ebx\n" \ - " movl %%ebx,(%%esi)\n" \ - " addl $4,%%esi\n" \ - " loop .loop_bulk_bi\n" \ - " .align 4\n" \ - ".no_more_bulk_bi:" \ - : "=S"(buffer): "c"(len), "d"(base), "S"(buffer):"eax", "ebx", "ecx"); - - asm("andl $3,%%ecx\n" \ - " jz .no_more_loose_bi\n" \ - " .align 4\n" \ - ".loop_loose_bi:\n" \ - BYTE_IN((%%esi)) \ - " incl %%esi\n" \ - " loop .loop_loose_bi\n" \ - ".no_more_loose_bi:\n" \ - : /* no output */ : "c"(len), "d"(base), "S"(buffer):"eax", "ebx", "ecx"); + int i; + + for (i = len; i; i--) { + *buffer++ = r_dtr(base); + w_ctr(base, 0x27); + w_ctr(base, 0x25); + } return 1; /* All went well - we hope! */ } @@ -575,44 +517,16 @@ static inline int ppa_byte_in(unsigned s " shrb $4,%%al\n" \ " orb %%al," #reg "\n" -static inline int ppa_nibble_in(unsigned short str_p, char *buffer, int len) +static inline int ppa_nibble_in(unsigned short base, char *buffer, int len) { - /* - * %eax scratch - * %ebx Data to transfer - * %ecx Counter (Don't touch!!) - * %edx Port - * %esi Source buffer (mem pointer) - * - * In case you are wondering what the last line of the asm does... - * : : - */ - asm("shr $2,%%ecx\n" \ - " jz .no_more_bulk_ni\n" \ - " .align 4\n" \ - ".loop_bulk_ni:\n" \ - NIBBLE_IN(%%bl) \ - NIBBLE_IN(%%bh) \ - " rorl $16,%%ebx\n" \ - NIBBLE_IN(%%bl) \ - NIBBLE_IN(%%bh) \ - " rorl $16,%%ebx\n" \ - " movl %%ebx,(%%esi)\n" \ - " addl $4,%%esi\n" \ - " loop .loop_bulk_ni\n" \ - " .align 4\n" \ - ".no_more_bulk_ni:" \ - : "=S"(buffer): "c"(len), "d"(str_p), "S"(buffer):"eax", "ebx", "ecx"); - - asm("andl $3,%%ecx\n" \ - " jz .no_more_loose_ni\n" \ - " .align 4\n" \ - ".loop_loose_ni:\n" \ - NIBBLE_IN((%%esi)) \ - " incl %%esi\n" \ - " loop .loop_loose_ni\n" \ - ".no_more_loose_ni:\n" \ - : /* no output */ : "c"(len), "d"(str_p), "S"(buffer):"eax", "ebx", "ecx"); + for (; len; len--) { + unsigned char h; + + w_ctr(base, 0x4); + h = r_str(base) & 0xf0; + w_ctr(base, 0x6); + *buffer++ = h | ((r_str(base) & 0xf0) >> 4); + } return 1; /* All went well - we hope! */ } #else /* Old style C routines */