Index: fdtape.c *** fdtape.c.dist Thu Feb 18 10:27:10 1993 --- fdtape.c Mon Feb 22 10:10:42 1993 *************** *** 118,123 **** --- 118,124 ---- #include #include #include + #include #include #include *************** *** 295,301 **** value = report_drive_status (unit, &status); ! fdt_sleep(MILLISECOND); #ifdef COLORADO /* Try colorado. */ value = tape_command (unit, QIC_COLORADO_ENABLE1); --- 296,302 ---- value = report_drive_status (unit, &status); ! fdt_sleep(20*MILLISECOND); #ifdef COLORADO /* Try colorado. */ value = tape_command (unit, QIC_COLORADO_ENABLE1); *************** *** 377,386 **** /* Now we have valid status from the drive. */ ! #if 0 ! printf ("Drive status = 0x%x, type = %d\n", status, unit_data[unit].drive_type); ! #endif result = ESUCCESS; --- 378,387 ---- /* Now we have valid status from the drive. */ ! /* #if 0 */ ! printf ("Drive status = 0x%02x, type = %d\n", status, unit_data[unit].drive_type); ! /* #endif */ result = ESUCCESS; *************** *** 468,474 **** _report_vendor_id_thread (int *id) { int result; ! result = ((report_rom_version (tape_unit, id) == 0) ? ESUCCESS : EIO); return result; } --- 469,475 ---- _report_vendor_id_thread (int *id) { int result; ! result = ((report_vendor_id (tape_unit, id) == 0) ? ESUCCESS : EIO); return result; } *************** *** 889,900 **** else return_value = result; ! printf ("fdtape: start=%d,count=%d,bits=0x%x, do=%d\n", sector + offset, count, *error_bits, data_offset); } else { ! printf ("fdtape: error st0 = 0x%x, st1 = 0x%x, st2 = 0x%x\n", in[0], in[1], in[2]); printf ("fdtape: read_segment, error cyl=%d, head=%d, sec=%d, ss=%d\n", in[3], in[4], in[5], in[6]); --- 890,901 ---- else return_value = result; ! printf ("fdtape: start=%d,count=%d,bits=0x%02x, do=%d\n", sector + offset, count, *error_bits, data_offset); } else { ! printf ("fdtape: error st0 = 0x%02x, st1 = 0x%02x, st2 = 0x%02x\n", in[0], in[1], in[2]); printf ("fdtape: read_segment, error cyl=%d, head=%d, sec=%d, ss=%d\n", in[3], in[4], in[5], in[6]); *************** *** 1008,1017 **** int wake_them = 0; int index; ! #if 0 printf ("_read_thread starts, state = %s (%d)\n", read_state_names[read_state], segment_count); ! #endif result = _start_tape (segment_being_read, &last_actual_segments[CURRENT_BUFFER], --- 1009,1018 ---- int wake_them = 0; int index; ! /* #if 0 */ printf ("_read_thread starts, state = %s (%d)\n", read_state_names[read_state], segment_count); ! /* #endif */ result = _start_tape (segment_being_read, &last_actual_segments[CURRENT_BUFFER], *************** *** 1059,1068 **** done = _read_thread_transitions[index].done; } if (!done && wake_them) ! #if 0 printf ("_read_thread wakes, not done, state = %s (%d)\n", read_state_names[read_state], segment_count), ! #endif _th_wakeup (0); /* Process needs to be awoken. */ } } --- 1060,1069 ---- done = _read_thread_transitions[index].done; } if (!done && wake_them) ! /* #if 0 */ printf ("_read_thread wakes, not done, state = %s (%d)\n", read_state_names[read_state], segment_count), ! /* #endif */ _th_wakeup (0); /* Process needs to be awoken. */ } } *************** *** 1085,1094 **** read_state = old_state; ! #if 0 printf ("_read_thread finishes, state = %s (%d)\n", read_state_names[read_state], segment_count); ! #endif return 0; } --- 1086,1095 ---- read_state = old_state; ! /* #if 0 */ printf ("_read_thread finishes, state = %s (%d)\n", read_state_names[read_state], segment_count); ! /* #endif */ return 0; } *************** *** 1168,1175 **** default: } tr->actual_segment = last_actual_segments[PREVIOUS_BUFFER]; ! result = copyout (&tape_buffer[PREVIOUS_BUFFER * TBUF_2], ! tr->buffer, TBUF_2); tr->error_bits = error_results[PREVIOUS_BUFFER]; } --- 1169,1177 ---- default: } tr->actual_segment = last_actual_segments[PREVIOUS_BUFFER]; ! memcpy(&tape_buffer[PREVIOUS_BUFFER * TBUF_2], ! &(tr->buffer), ! TBUF_2); tr->error_bits = error_results[PREVIOUS_BUFFER]; } *************** *** 1200,1206 **** _do_read_stop () { int s; - #ifndef LINUX s = splhigh (); #endif --- 1202,1207 ---- *************** *** 1222,1228 **** #ifndef LINUX splx (s); #endif - return 0; } --- 1223,1228 ---- *************** *** 1376,1382 **** if ((in[0] & ST0_CODE_MASK) != ST0_NORMAL) { ! printf ("fdtape: write error st0 = 0x%x, st1 = 0x%x, st2 = 0x%x\n", in[0], in[1], in[2]); printf ("fdtape: write_segment, error cyl=%d, head=%d, sec=%d, ss=%d\n", in[3], in[4], in[5], in[6]); --- 1376,1382 ---- if ((in[0] & ST0_CODE_MASK) != ST0_NORMAL) { ! printf ("fdtape: write error st0 = 0x%02x, st1 = 0x%02x, st2 = 0x%02x\n", in[0], in[1], in[2]); printf ("fdtape: write_segment, error cyl=%d, head=%d, sec=%d, ss=%d\n", in[3], in[4], in[5], in[6]); *************** *** 1597,1604 **** goto real_bad; /* Yuck. */ if (old_state == WRITE_i) segment_being_read = tw->segment; ! result = copyin (tw->buffer, ! &tape_buffer[CURRENT_BUFFER * TBUF_2], TBUF_2); INCREMENT_BUFFER; if (write_transitions[old_state].start) --- 1597,1605 ---- goto real_bad; /* Yuck. */ if (old_state == WRITE_i) segment_being_read = tw->segment; ! ! memcpy(&tape_buffer[CURRENT_BUFFER * TBUF_2], ! &(tw->buffer), TBUF_2); INCREMENT_BUFFER; if (write_transitions[old_state].start) *************** *** 1701,1706 **** --- 1702,1711 ---- vfo = 0x00; qic_rate = 2; break; + case FDT_RATE_1000: + vfo = 0x03; + qic_rate = 3; + break; default: result = EINVAL; goto error; *************** *** 1910,1916 **** memcpy_fromfs(&tmp_find, arg, sizeof(struct _fdt_find_me)); result = _read_id_thread (&tmp_find); verify_area(arg, sizeof(struct _fdt_find_me)); ! memcpy_fromfs(arg, &tmp_find, sizeof(struct _fdt_find_me)); break; case FDT_SUBMIT_ERROR_MAP: { --- 1915,1921 ---- memcpy_fromfs(&tmp_find, arg, sizeof(struct _fdt_find_me)); result = _read_id_thread (&tmp_find); verify_area(arg, sizeof(struct _fdt_find_me)); ! memcpy_tofs(arg, &tmp_find, sizeof(struct _fdt_find_me)); break; case FDT_SUBMIT_ERROR_MAP: { *************** *** 1919,1927 **** memcpy_fromfs(&map, arg, sizeof(struct error_map)); /* Zero out error map. */ bzero (error_masks, segments_per_track * sizeof (unsigned long)); ! for (tmp_int = 0; tmp_int < map.count * sizeof(unsigned long); tmp_int++) { ! (char *)error_masks[tmp_int] = (char *)map.error_masks[tmp_int]; ! } result = 0; } break; --- 1924,1930 ---- memcpy_fromfs(&map, arg, sizeof(struct error_map)); /* Zero out error map. */ bzero (error_masks, segments_per_track * sizeof (unsigned long)); ! memcpy(&error_masks, &map.error_masks, map.count * sizeof(unsigned long)); result = 0; } break; *************** *** 2422,2428 **** return result; } if (count++ == 1000) { - printk("sense_drive_status does not return with ST3_TRACK_0 (count=100)\n"); return -1; } } --- 2425,2430 ---- *************** *** 2630,2639 **** printf ("fdtape: read_id, result phase error\n"); return result; } ! #if 0 ! printf ("fdtape: read_id: 0:0x%x, 1:0x%x, 2:0x%x, 3:0x%x, 4:0x%x, 5:0x%x, 6:0x%x\n", in[0], in[1], in[2], in[3], in[4], in[5], in[6]); ! #endif /* Check return for normal. */ if ((in[0] & ST0_CODE_MASK) == ST0_NORMAL) --- 2632,2641 ---- printf ("fdtape: read_id, result phase error\n"); return result; } ! /* #if 0 */ ! printf ("fdtape: read_id: 0:0x%02x, 1:0x%02x, 2:0x%02x, 3:0x%02x, 4:0x%02x, 5:0x%02x, 6:0x%02x\n", in[0], in[1], in[2], in[3], in[4], in[5], in[6]); ! /* #endif */ /* Check return for normal. */ if ((in[0] & ST0_CODE_MASK) == ST0_NORMAL) *************** *** 2644,2650 **** } else { ! printf ("fdtape: read_id, error st0=0x%x, st1=0x%x, st2=0x%x\n", in[0] & 0xff, in[1] & 0xff, in[2] & 0xff); return -1; } --- 2646,2652 ---- } else { ! printf ("fdtape: read_id, error st0=0x%02x, st1=0x%02x, st2=0x%02x\n", in[0] & 0xff, in[1] & 0xff, in[2] & 0xff); return -1; } *************** *** 2658,2664 **** struct wait_queue *wait_intr = NULL; ! static int interrupt_wait(int unit, int time) { int result; do_floppy = qic_117_interrupt; --- 2660,2666 ---- struct wait_queue *wait_intr = NULL; ! /* static int interrupt_wait(int unit, int time) { int result; do_floppy = qic_117_interrupt; *************** *** 2670,2675 **** --- 2672,2701 ---- interrupt_seen = 0; return 0; } + } */ + + static int + interrupt_wait(int unit, int time) { + int result = 0; + struct wait_queue wait = {current, NULL}; + + if (interrupt_seen == 0) { + current->state = TASK_INTERRUPTIBLE; + current->timeout = jiffies + time; + add_wait_queue(&wait_intr, &wait); + if (interrupt_seen == 0) { + schedule(); + } + remove_wait_queue(&wait_intr, &wait); + if (interrupt_seen == 0) { + result = ETIME; + current->timeout = 0; + } + + } + interrupt_seen = 0; + return result; + } void