|
|
1.1 ! root 1: /* ! 2: ** ! 3: */ ! 4: ! 5: #include "vdfmt.h" ! 6: ! 7: main() ! 8: { ! 9: exdent(-1); ! 10: print("VDFORMAT Version 3.0 \n\n"); ! 11: print("Type `Help' for help, `Start' to execute operations.\n\n"); ! 12: ! 13: for(;;) { ! 14: determine_controller_types(); ! 15: if(!_setjmp(reset_environ)) { ! 16: init_environment(); ! 17: for(;;) { ! 18: if(!_setjmp(quit_environ)) { ! 19: reset_operation_tables(); ! 20: process_commands(); ! 21: } ! 22: else ! 23: report_unexecuted_ops(); ! 24: } ! 25: } ! 26: } ! 27: } ! 28: ! 29: ! 30: /* ! 31: ** ! 32: */ ! 33: ! 34: report_unexecuted_ops() ! 35: { ! 36: register int ctlr, drive; ! 37: char *header = "The following operations will not be executed:\n"; ! 38: ! 39: indent(); ! 40: for(ctlr=0; ctlr<MAXCTLR; ctlr++) ! 41: for(drive=0; drive<MAXDRIVE; drive++) ! 42: if(ops_to_do[ctlr][drive].op) { ! 43: print(header); ! 44: if(strlen(header)) { ! 45: indent(); ! 46: header = ""; ! 47: print(header); ! 48: } ! 49: display_operations(ctlr, drive); ! 50: ops_to_do[ctlr][drive].op = 0; ! 51: } ! 52: exdent(-1); ! 53: } ! 54: ! 55: ! 56: /* ! 57: ** ! 58: */ ! 59: ! 60: determine_controller_types() ! 61: { ! 62: extern fmt_err smd_decode_position(), smd_e_decode_position(); ! 63: extern bs_entry smd_code_position(), smd_e_code_position(); ! 64: extern int smd_cyl_skew(), smd_trk_skew(); ! 65: extern int smd_e_cyl_skew(), smd_e_trk_skew(); ! 66: register int ctlr, drive; ! 67: ! 68: /* Identify which controllers are present and what type they are. */ ! 69: num_controllers = 0; ! 70: for(ctlr = 0; ctlr < MAXCTLR; ctlr++) { ! 71: c_info[ctlr].addr = (cdr *)(vddcaddr[ctlr]+IOBASE); ! 72: if(!badaddr(c_info[ctlr].addr, 2)) { ! 73: num_controllers++; ! 74: c_info[ctlr].addr->cdr_reset = (unsigned)0xffffffff; ! 75: DELAY(1000000); ! 76: if(c_info[ctlr].addr->cdr_reset!=(unsigned)0xffffffff) { ! 77: c_info[ctlr].alive = u_true; ! 78: c_info[ctlr].type = SMDCTLR; ! 79: c_info[ctlr].name = "VDDC"; ! 80: c_info[ctlr].decode_pos = smd_decode_position; ! 81: c_info[ctlr].code_pos = smd_code_position; ! 82: c_info[ctlr].cylinder_skew = smd_cyl_skew; ! 83: c_info[ctlr].track_skew = smd_trk_skew; ! 84: DELAY(1000000); ! 85: } ! 86: else { ! 87: c_info[ctlr].alive = u_true; ! 88: c_info[ctlr].type = SMD_ECTLR; ! 89: c_info[ctlr].name = "SMD-E"; ! 90: c_info[ctlr].addr->cdr_reserved = 0x0; ! 91: c_info[ctlr].decode_pos = smd_e_decode_position; ! 92: c_info[ctlr].code_pos = smd_e_code_position; ! 93: c_info[ctlr].cylinder_skew = smd_e_cyl_skew; ! 94: c_info[ctlr].track_skew = smd_e_trk_skew; ! 95: DELAY(3000000); ! 96: } ! 97: } ! 98: else { ! 99: c_info[ctlr].alive = u_false; ! 100: c_info[ctlr].type = UNKNOWN; ! 101: } ! 102: for(drive=0; drive<MAXDRIVE; drive++) { ! 103: d_info[ctlr][drive].alive = u_unknown; ! 104: d_info[ctlr][drive].info = (fs_tab *)0; ! 105: } ! 106: } ! 107: if(num_controllers == 0) ! 108: _stop("vdfmt: I can't find any disk controllers. Giving up!"); ! 109: } ! 110: ! 111: ! 112: /* ! 113: ** Init_environment is used to reset everything to it's initial state. ! 114: ** All previously stored drive information is lost when this command ! 115: ** is executed. ! 116: */ ! 117: ! 118: init_environment() ! 119: { ! 120: register int ctlr, drive; ! 121: ! 122: /* clear list of operations to do */ ! 123: for(ctlr=0; ctlr<MAXCTLR; ctlr++) { ! 124: for(drive=0; drive<MAXCTLR; drive++) { ! 125: d_info[ctlr][drive].alive = u_unknown; ! 126: d_info[ctlr][drive].info = (fs_tab *)0; ! 127: d_info[ctlr][drive].id = -1; ! 128: d_info[ctlr][drive].trk_size = 0; ! 129: d_info[ctlr][drive].num_slip = 0; ! 130: d_info[ctlr][drive].track_skew = 0; ! 131: } ! 132: } ! 133: /* Init pattern table pointers */ ! 134: pattern_address[0] = pattern_0; ! 135: pattern_address[1] = pattern_1; ! 136: pattern_address[2] = pattern_2; ! 137: pattern_address[3] = pattern_3; ! 138: pattern_address[4] = pattern_4; ! 139: pattern_address[5] = pattern_5; ! 140: pattern_address[6] = pattern_6; ! 141: pattern_address[7] = pattern_7; ! 142: pattern_address[8] = pattern_8; ! 143: pattern_address[9] = pattern_9; ! 144: pattern_address[10] = pattern_10; ! 145: pattern_address[11] = pattern_11; ! 146: pattern_address[12] = pattern_12; ! 147: pattern_address[13] = pattern_13; ! 148: pattern_address[14] = pattern_14; ! 149: pattern_address[15] = pattern_15; ! 150: /* Init operations command table */ ! 151: operations[0].routine = format; ! 152: operations[0].op_name = "Format"; ! 153: operations[0].op_action = "Formatting"; ! 154: operations[1].routine = verify; ! 155: operations[1].op_name = "Verify"; ! 156: operations[1].op_action = "Verification"; ! 157: operations[2].routine = relocate; ! 158: operations[2].op_name = "Relocate"; ! 159: operations[2].op_action = "Relocation"; ! 160: operations[3].routine = info; ! 161: operations[3].op_name = "Info"; ! 162: operations[3].op_action = "Information gathering"; ! 163: operations[4].routine = correct; ! 164: operations[4].op_name = "Correct"; ! 165: operations[4].op_action = "Correction"; ! 166: operations[5].routine = profile; ! 167: operations[5].op_name = "Profile"; ! 168: operations[5].op_action = "Profiling"; ! 169: operations[6].routine = exercise; ! 170: operations[6].op_name = "Exercise"; ! 171: operations[6].op_action = "exercising"; ! 172: bad_map = (bs_map *)bs_map_space; ! 173: } ! 174: ! 175: ! 176: /* ! 177: ** Reset_operation_tables reinitializes all the tables that ! 178: ** control the sequence of formatter operations. ! 179: */ ! 180: ! 181: reset_operation_tables() ! 182: { ! 183: register int ctlr, drive; ! 184: ! 185: /* clear list of operations to do */ ! 186: for(ctlr=0; ctlr<MAXCTLR; ctlr++) { ! 187: for(drive=0; drive<MAXDRIVE; drive++) { ! 188: ops_to_do[ctlr][drive].op = 0; ! 189: ops_to_do[ctlr][drive].numpat = 1; ! 190: } ! 191: } ! 192: kill_processes = false; ! 193: } ! 194:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.