|
|
1.1 ! root 1: /* ! 2: * mkdev.c ! 3: * 06/28/93 ! 4: * ! 5: * Allow the user to configure devices requiring loadable drivers. ! 6: * Uses common routines in build0.c: cc -o mkdev mkdev.c build0.c ! 7: * Usage: mkdev [ -bdv ] { scsi | at | floppytape } ... ! 8: * Options: ! 9: * -b Use special processing when invoked from /etc/build ! 10: * -d Debug; echo commands without executing ! 11: * -v Verbose ! 12: * ! 13: * Roughly, do the following for device "foo" ( at | aha154x | ss ) ! 14: * ! 15: * cp /drv/foo /tmp/drv/foo ! 16: * make necessary patches "xxx" to /tmp/drv/foo ! 17: * if not "at" device ! 18: * make nodes (mknod -f) for the device ! 19: * if build mode (bflag) ! 20: * if rootdev ! 21: * append to LDKERFILE: ! 22: * HD=foo.a ! 23: * HDUNDEF="-u foocon_" ! 24: * HDPATCH="drvl_+xx0=foocon_" ! 25: * /etc/drvld -r /tmp/drv/foo ! 26: * append to PATCHFILE: ! 27: * cp /tmp/drv/foo /mnt/drv/foo ! 28: * if rootdev, also append to PATCHFILE: ! 29: * /conf/patch /mnt/coherent xxx ! 30: * else - not build mode ! 31: * display message saying patched driver is at /tmp/drv/foo ! 32: */ ! 33: ! 34: #define __KERNEL__ 1 ! 35: ! 36: #include <stdio.h> ! 37: #include <sys/devices.h> ! 38: #include <sys/con.h> ! 39: #include <string.h> ! 40: ! 41: #include "build0.h" ! 42: ! 43: #define VERSION "V4" /* version number */ ! 44: #define USAGEMSG "Usage:\t/etc/mkdev [ -bdv ] [ scsi | at | floppytape ] ...\n" ! 45: #define BUFLEN 50 ! 46: #define AHA_HDS 64 ! 47: #define AHA_DMA 5 ! 48: #define AHA_IRQ 11 ! 49: #define AHA_BASE 0x330 ! 50: #define TANDY_HDS 16 ! 51: ! 52: /* ! 53: * calculate the minor number for the specified floppy tape device: ! 54: * uu: unit # (0-3) ! 55: * vv: brand of drive: 0=Archive/Mountain/Summit, 1=CMS, 2&3=rsvd ! 56: * s: select: 0=hard select, 1=soft select ! 57: * r: rewind: 0=no rewind on close, 1=rewind on close ! 58: */ ! 59: #define FL_TAPE_MINOR(uu,vv,s,r) ((1<<6)|((uu)<<4)|((s)<<3)|((r)<<2)|(vv)) ! 60: #define FL_TAPE_HARD_SEL 0 ! 61: #define FL_TAPE_SOFT_SEL 1 ! 62: #define FL_TAPE_NOREW 0 ! 63: #define FL_TAPE_REW 1 ! 64: ! 65: /* Forward. */ ! 66: void scsi(); ! 67: void at(); ! 68: void floppy_tape(); ! 69: ! 70: /* Globals. */ ! 71: int bflag; /* Invoked from /etc/build. */ ! 72: ! 73: main(argc, argv) int argc; char *argv[]; ! 74: { ! 75: register char *s; ! 76: ! 77: argv0 = argv[0]; ! 78: usagemsg = USAGEMSG; ! 79: if (argc > 1 && argv[1][0] == '-') { ! 80: for (s = &argv[1][1]; *s; ++s) { ! 81: switch(*s) { ! 82: case 'b': ++bflag; break; ! 83: case 'd': ++dflag; break; ! 84: case 'v': ++vflag; break; ! 85: case 'V': ! 86: fprintf(stderr, "mkdev: %s\n", VERSION); ! 87: break; ! 88: default: usage(); break; ! 89: } ! 90: } ! 91: --argc; ! 92: ++argv; ! 93: } ! 94: ! 95: if (argc == 1) { ! 96: usage(); ! 97: } else { ! 98: /* Do specified things. */ ! 99: while (--argc > 0) { ! 100: if (strcmp (argv [1], "scsi") == 0) ! 101: scsi (); ! 102: else if (strcmp (argv [1], "at") == 0) ! 103: at (); ! 104: else if (strcmp (argv [1], "floppytape") == 0) ! 105: floppy_tape (); ! 106: else ! 107: usage (); ! 108: ++argv; ! 109: } ! 110: } ! 111: exit (0); ! 112: } ! 113: ! 114: void ! 115: scsi() ! 116: { ! 117: char *dev; ! 118: int i, id, lun; ! 119: int ss_dev = 0; ! 120: int fut_dev = 0; ! 121: unsigned nsdrive = 0; ! 122: int ss_int = 5, new_int; ! 123: unsigned int ss_base = 0xCA00, new_base; ! 124: unsigned char ss_patch[200], buf[BUFLEN]; ! 125: FILE *fp; ! 126: int aha_dev = 0, sd_hds = AHA_HDS, sd_dma = AHA_DMA; ! 127: int hai_dev = 0; ! 128: int sd_irq = AHA_IRQ, sd_base = AHA_BASE; ! 129: int hai_tape = 0; ! 130: int hai_disk = 0; ! 131: int unit; ! 132: int tape_dev; ! 133: int choice; ! 134: ! 135: static int sd_irq_list[] = { 9, 10, 11, 12, 14, 15 }; ! 136: int sd_irq_ct = sizeof(sd_irq_list)/sizeof(sd_irq_list[0]); ! 137: ! 138: static int sd_base_list[] = ! 139: { 0x130, 0x134, 0x230, 0x234, 0x330, 0x334 }; ! 140: int sd_base_ct = sizeof(sd_base_list)/sizeof(sd_base_list[0]); ! 141: ! 142: static int sd_dma_list[] = { 0, 5, 6, 7 }; ! 143: int sd_dma_ct = sizeof(sd_dma_list)/sizeof(sd_dma_list[0]); ! 144: ! 145: cls(0); ! 146: printf( ! 147: "COHERENT currently supports the following SCSI host adapters:\n" ! 148: "\n" ! 149: "(1) Adaptec AHA-154x series, no tape support\n" ! 150: "(2) Adaptec AHA-154x series, with tape support\n\n" ! 151: "(3) Seagate ST01 or ST02\n" ! 152: "(4) Future Domain TMC-845/850/860/875/885\n" ! 153: "(5) Future Domain TMC-840/841/880/881\n" ! 154: "\n" ! 155: ); ! 156: retry: ! 157: switch(get_int(0, 5, "Enter a number from the above list or 0 to exit:")) { ! 158: case 0: ! 159: return; ! 160: case 1: ! 161: aha_dev = 1; ! 162: break; ! 163: case 2: ! 164: hai_dev = 1; ! 165: break; ! 166: case 3: ! 167: ss_dev = 1; ! 168: break; ! 169: case 4: ! 170: ss_dev = 1; ! 171: fut_dev = 1; ! 172: nsdrive |= 0x8000; ! 173: break; ! 174: case 5: ! 175: ss_dev = 1; ! 176: fut_dev = 1; ! 177: nsdrive |= 0x4000; ! 178: break; ! 179: default: ! 180: goto retry; /* should never happen */ ! 181: } ! 182: ! 183: /* ! 184: * If Adaptec, allow patching host adapter variables SD_HDS ! 185: * for Tandy variant of host BIOS. ! 186: */ ! 187: if (aha_dev) { ! 188: printf("\nMost versions of the Adaptec BIOS use 64-head translation mode.\n"); ! 189: printf("A few, including some Tandy variants, use 16-head translation mode.\n\n"); ! 190: if (!yes_no("Do you want 64-head translation mode")) ! 191: sd_hds = TANDY_HDS; ! 192: } ! 193: ! 194: if (aha_dev || hai_dev) { ! 195: sd_irq = get_allowed_int(sd_irq_list, sd_irq_ct, ga_dec, ! 196: sd_irq, ga_nonstrict, ! 197: "\nWhich IRQ does the host adapter use? "); ! 198: sd_base = get_allowed_int(sd_base_list, sd_base_ct, ga_hex, ! 199: sd_base, ga_nonstrict, ! 200: "\nWhat is the hexadecimal host adapter base port address? "); ! 201: sd_dma = get_allowed_int(sd_dma_list, sd_dma_ct, ga_hex, ! 202: sd_dma, ga_nonstrict, ! 203: "\nWhich DMA channel does the host adapter use? "); ! 204: } ! 205: ! 206: /* ! 207: * If Seagate or Future Domain, allow patching host adapter ! 208: * variables SS_INT and SS_BASE. ! 209: */ ! 210: if (ss_dev) { ! 211: printf("\nPlease refer to the installation guide for your host adapter.\n"); ! 212: ! 213: /* Get value to patch for SS_INT */ ! 214: printf("\nWhich IRQ number does the host adapter use [%d]? ", ss_int); ! 215: while (1) { ! 216: new_int = ss_int; ! 217: fgets(buf, BUFLEN, stdin); ! 218: sscanf(buf, "%d", &new_int); ! 219: if (new_int < 3 || new_int > 15) ! 220: printf("Type a number between 3 and 15 or just <Enter> for the default: "); ! 221: else ! 222: break; ! 223: } /* endwhile */ ! 224: ss_int = new_int; ! 225: ! 226: /* Get value to patch for SS_BASE */ ! 227: printf("Your host adapter is configured for a base segment address. Possible\n"); ! 228: printf("values are: C800, CA00, CC00, CE00, DC00, and DE00.\n"); ! 229: printf("What is your 4-digit hexadecimal base address [%04lx]? ", ss_base); ! 230: while (1) { ! 231: new_base = ss_base; ! 232: fgets(buf, BUFLEN, stdin); ! 233: sscanf(buf, "%x", &new_base); ! 234: if (new_base < 0xC800 || new_base > 0xDE00) ! 235: printf("Type a number between C800 and DE00 or just <Enter> for the default: "); ! 236: else ! 237: break; ! 238: } /* endwhile */ ! 239: ss_base = new_base; ! 240: } ! 241: ! 242: /* Make device nodes. */ ! 243: cls(0); ! 244: if (hai_dev) { ! 245: printf( ! 246: "You must specify a SCSI-ID (0 through 7) for each SCSI hard disk or tape\n" ! 247: "device. Each SCSI hard disk device can contain up to four partitions.\n" ! 248: "Tape devices must be configured as logical unit number (LUN) 0. All current\n" ! 249: "SCSI tape drives with embedded SCSI controllers default to LUN 0.\n\n" ! 250: ); ! 251: } else { ! 252: printf( ! 253: "You must specify a SCSI-ID (0 through 7) for each SCSI hard disk device.\n" ! 254: "Each SCSI hard disk device can contain up to four partitions.\n\n" ! 255: ); ! 256: } ! 257: ! 258: for (;;) { ! 259: tape_dev = 0; ! 260: ! 261: if (hai_dev) { ! 262: printf( ! 263: "1) Enter SCSI ID for SCSI hard disk (fixed or removable media)\n" ! 264: "2) Enter SCSI ID for SCSI tape drive\n\n" ! 265: "3) End entering SCSI ID values.\n\n" ! 266: ); ! 267: choice = get_int(1, 3, "Your choice:"); ! 268: } else { ! 269: printf( ! 270: "1) Enter SCSI ID for SCSI hard disk (fixed or removable media)\n" ! 271: "2) End entering SCSI ID values.\n\n" ! 272: ); ! 273: choice = get_int(1, 2, "Your choice:"); ! 274: } ! 275: ! 276: if (hai_dev) { ! 277: if (choice == 2) ! 278: tape_dev = 1; ! 279: if (choice == 3) ! 280: break; ! 281: } else { ! 282: if (choice == 2) ! 283: break; ! 284: } ! 285: ! 286: if (tape_dev) { ! 287: id = get_int(0, 7, "\nEnter the next tape device SCSI-ID:"); ! 288: hai_tape |= (1 << id); ! 289: } else { ! 290: id = get_int(0, 7, "\nEnter the next disk device SCSI-ID:"); ! 291: hai_disk |= (1 << id); ! 292: } ! 293: ! 294: lun = 0; ! 295: nsdrive |= (1 << id); ! 296: ! 297: /* Make /tmp/dev if bflag. */ ! 298: if (bflag) { ! 299: if ((i = is_dir("/tmp/dev")) == 0) ! 300: sys("/bin/mkdir /tmp/dev", S_FATAL); ! 301: else if (i == -1) ! 302: fatal("/tmp/dev is not a directory"); ! 303: } ! 304: dev = (bflag) ? "/tmp/dev" : "/dev"; ! 305: ! 306: /* ! 307: * If we are creating a SCSI tape device (Adaptec only), ! 308: * create a device node in /tmp/dev. This will later be copied ! 309: * to the root filesystem on the hard drive. ! 310: */ ! 311: #if !TEST ! 312: if (tape_dev) { ! 313: ! 314: sprintf(cmd, "/etc/mknod -f /tmp/dev/rStp%d c %d %d", ! 315: id, SCSI_MAJOR, SCSI_minor(1, id, lun, 3)); ! 316: sys(cmd, S_NONFATAL); ! 317: ! 318: #if 0 ! 319: sprintf(cmd, "/etc/mknod -f %s/rst%dn c %d %d", ! 320: dev, id, SCSI_MAJOR, SCSI_minor(1, id, lun, 1)); ! 321: sys(cmd, S_NONFATAL); ! 322: ! 323: sprintf(cmd, "/bin/ln -f %s/rStp%d %s/tape", ! 324: dev, id, dev); ! 325: sys(cmd, S_NONFATAL); ! 326: ! 327: sprintf(cmd, "/bin/ln -f %s/rst%dn %s/ntape", ! 328: dev, id, dev); ! 329: sys(cmd, S_NONFATAL); ! 330: #endif ! 331: /* set the device permissions. */ ! 332: sprintf(cmd, "/bin/chmog 600 sys sys %s/rStp%d*", dev, id); ! 333: sys(cmd, S_NONFATAL); ! 334: } ! 335: ! 336: ! 337: /* scsi disk devics have been moved to /dev/of the boot floppy. ! 338: * bob h (8/11/93) ! 339: */ ! 340: ! 341: #if 0 ! 342: else { ! 343: /* ! 344: * SCSI disk device: ! 345: * Make the cooked devices. ! 346: */ ! 347: for (i = 0; i < 4; i++) { ! 348: sprintf(cmd, "/etc/mknod -f %s/sd%d%c b %d %d", ! 349: dev, id, 'a'+i, SCSI_MAJOR, SCSI_minor(0, id, lun, i)); ! 350: sys(cmd, S_NONFATAL); ! 351: } ! 352: sprintf(cmd, "/etc/mknod -f %s/sd%dx b %d %d", ! 353: dev, id, SCSI_MAJOR, SCSI_minor(1, id, lun, 0)); ! 354: sys(cmd, S_NONFATAL); ! 355: ! 356: /* make the raw devices. */ ! 357: for (i = 0; i < 4; i++) { ! 358: sprintf(cmd, "/etc/mknod -f %s/rsd%d%c c %d %d", ! 359: dev, id, 'a'+i, SCSI_MAJOR, SCSI_minor(0, id, lun, i)); ! 360: sys(cmd, S_NONFATAL); ! 361: } ! 362: sprintf(cmd, "/etc/mknod -f %s/rsd%dx c %d %d", ! 363: dev, id, SCSI_MAJOR, SCSI_minor(1, id, lun, 0)); ! 364: sys(cmd, S_NONFATAL); ! 365: ! 366: /* set the device permissions. */ ! 367: sprintf(cmd, "/bin/chmog 600 sys sys %s/sd*[a-d] %s/rsd*[a-d]",dev,dev); ! 368: sys(cmd, S_NONFATAL); ! 369: sprintf(cmd, "/bin/chmog 600 root root %s/sd*x %s/rsd*x", dev, dev); ! 370: sys(cmd, S_NONFATAL); ! 371: } /* !(tape_dev) */ ! 372: ! 373: #endif ! 374: ! 375: /* append lines to /tmp/devices to pass device info to /etc/build. ! 376: * This file is read to build the commands for fdisk a bit later. ! 377: */ ! 378: ! 379: if (bflag && !tape_dev) { ! 380: for (i = 0; i < 4; i++) { ! 381: sprintf(cmd, "/bin/echo sd%dx sd%d%c %d %d >>/tmp/devices", ! 382: id, id, 'a'+i, SCSI_MAJOR, SCSI_minor(0, id, lun, i)); ! 383: sys(cmd, S_NONFATAL); ! 384: } ! 385: } ! 386: #endif ! 387: cls(0); ! 388: printf("%s device has been installed at id %d\n\n", ! 389: tape_dev ? "Tape" : "Disk", id); ! 390: } ! 391: ! 392: /* At this point all SCSI id's attached to the host are known. */ ! 393: ! 394: /* ! 395: * Ugly patching stuff specific to "ss" driver. ! 396: */ ! 397: if (ss_dev) { ! 398: ! 399: /* "ss" device driver requires patching to work at all. */ ! 400: sprintf (ss_patch, ! 401: "NSDRIVE=0x%04x SS_INT=%d SS_BASE=0x%04x", ! 402: nsdrive, ss_int, ss_base); ! 403: ! 404: /* for target kernel */ ! 405: ! 406: idenable_dev ("ss"); ! 407: ! 408: sprintf (buf, "unsigned int\tNSDRIVE = 0x%04x;", nsdrive); ! 409: cohtune_ent ("ss", "NSDRIVE", buf); ! 410: ! 411: sprintf (buf, "unsigned int\tSS_INT = %d;", ss_int); ! 412: cohtune_ent ("ss", "SS_INT", buf); ! 413: ! 414: sprintf (buf, "unsigned int\tSS_BASE = %d;", ss_base); ! 415: cohtune_ent ("ss", "SS_BASE", buf); ! 416: ! 417: /* for second boot kernel */ ! 418: fp = fopen(PATCHFILE,"a"); ! 419: ! 420: fprintf (fp, "/conf/patch /mnt/coherent drvl+%d=sscon \n", ! 421: SCSI_MAJOR * sizeof (DRV)); ! 422: ! 423: fprintf (fp, "/conf/patch /mnt/coherent %s\n", ss_patch); ! 424: ! 425: fclose (fp); ! 426: ! 427: /* for first boot kernel */ ! 428: ! 429: sprintf (cmd, "/conf/kpatch -v %s", ss_patch); ! 430: sys (cmd, S_FATAL); ! 431: sprintf (cmd, "/conf/kpatch -v sscon:%d:in", SCSI_MAJOR); ! 432: sys (cmd, S_FATAL); ! 433: ! 434: /* ! 435: * Allow patching of the loaded driver parameters. ! 436: */ ! 437: for (unit = 0; unit < 7; unit++) { ! 438: if (nsdrive & (1 << unit)) { ! 439: sprintf (cmd, "/etc/hdparms -%c%c %s/sd%dx", ! 440: 'r', fut_dev ? 'f' : 's', dev, unit); ! 441: sys (cmd, S_NONFATAL); ! 442: } ! 443: } ! 444: } /* end of "ss" stuff */ ! 445: ! 446: /* ! 447: * Ugly patching stuff specific to "aha154x" driver. ! 448: * At this point all SCSI id's attached to the host are known. ! 449: */ ! 450: if (aha_dev) { ! 451: /* ! 452: * Tandy Adaptec BIOS spoofs different head count than ! 453: * Adaptec's Own Translation Mode. ! 454: */ ! 455: ! 456: sprintf (ss_patch, "SD_HDS=%d SDDMA=%d SDIRQ=%d SDBASE=0x%x ", ! 457: sd_hds, sd_dma, sd_irq, sd_base); ! 458: ! 459: /* for target kernel */ ! 460: ! 461: idenable_dev ("aha"); ! 462: ! 463: sprintf (buf, "int\tSD_HDS = %d;", sd_hds); ! 464: cohtune_ent ("aha", "SD_HDS", buf); ! 465: ! 466: sprintf (buf, "int\tSDDMA = %d;", sd_dma); ! 467: cohtune_ent ("aha", "SDDMA", buf); ! 468: ! 469: sprintf (buf, "int\tSDIRQ = %d;", sd_irq); ! 470: cohtune_ent ("aha", "SDIRQ", buf); ! 471: ! 472: sprintf (buf, "int\tSDBASE = 0x%x;", sd_base); ! 473: cohtune_ent ("aha", "SDBASE", buf); ! 474: ! 475: /* for second boot kernel */ ! 476: fp = fopen (PATCHFILE,"a"); ! 477: ! 478: fprintf (fp, "/conf/patch /mnt/coherent drvl+%d=sdcon\n", ! 479: SCSI_MAJOR * sizeof (DRV)); ! 480: ! 481: fprintf (fp, "/conf/patch /mnt/coherent %s\n", ss_patch); ! 482: ! 483: fclose (fp); ! 484: ! 485: /* for first boot kernel */ ! 486: ! 487: sprintf (cmd, "/conf/kpatch -v %s", ss_patch); ! 488: sys (cmd, S_FATAL); ! 489: sprintf (cmd, "/conf/kpatch -v sdcon:%d:in", SCSI_MAJOR); ! 490: sys (cmd, S_FATAL); ! 491: } ! 492: ! 493: /* ! 494: * Ugly patching stuff specific to "hai" driver. ! 495: * At this point all SCSI id's attached to the host are known. ! 496: */ ! 497: if (hai_dev) { ! 498: /* ! 499: * Tandy Adaptec BIOS spoofs different head count than ! 500: * Adaptec's Own Translation Mode. ! 501: */ ! 502: sprintf (ss_patch, "AHADMACHAN=%d:s AHAINTR=%d:s " ! 503: "AHABASE=0x%x:s HAI_DISK=%d HAI_TAPE=%d ", ! 504: sd_dma, sd_irq, sd_base, hai_disk, hai_tape); ! 505: ! 506: /* for target kernel */ ! 507: ! 508: idenable_dev ("hai"); ! 509: ! 510: sprintf (buf, "int\tAHADMACHAN = %d;", sd_dma); ! 511: cohtune_ent ("hai", "AHADMACHAN", buf); ! 512: ! 513: sprintf (buf, "int\tAHAINTR = %d;", sd_irq); ! 514: cohtune_ent ("hai", "AHAINTR", buf); ! 515: ! 516: sprintf (buf, "int\tAHABASE = %d;", sd_base); ! 517: cohtune_ent ("hai", "AHABASE", buf); ! 518: ! 519: sprintf (buf, "int\tHAI_DISK = %d;", hai_disk); ! 520: cohtune_ent ("hai", "HAI_DISK", buf); ! 521: ! 522: sprintf (buf, "int\tHAI_TAPE = %d;", hai_tape); ! 523: cohtune_ent ("hai", "HAI_TAPE", buf); ! 524: ! 525: /* for second boot kernel */ ! 526: fp = fopen (PATCHFILE,"a"); ! 527: ! 528: fprintf (fp, "/conf/patch /mnt/coherent drvl+%d=scsicon \n", ! 529: SCSI_MAJOR * sizeof (DRV)); ! 530: ! 531: fprintf (fp, "/conf/patch /mnt/coherent %s\n", ss_patch); ! 532: ! 533: fclose (fp); ! 534: ! 535: /* for first boot kernel */ ! 536: ! 537: sprintf (cmd, "/conf/kpatch -v %s", ss_patch); ! 538: sys (cmd, S_FATAL); ! 539: sprintf (cmd, "/conf/kpatch -v scsicon:%d:in", SCSI_MAJOR); ! 540: sys (cmd, S_FATAL); ! 541: ! 542: } /* end of "hai" stuff */ ! 543: } ! 544: ! 545: void ! 546: at() ! 547: { ! 548: unsigned char at_patch[80]; ! 549: FILE *fp; ! 550: int at_poll; ! 551: char line[512]; ! 552: int normal_at_poll; ! 553: int fl_dsk_ch_prob; ! 554: int use_ps1; ! 555: int at_drive_ct; ! 556: int y, z; /* dummy counters */ ! 557: /* Normal vs. alternate polling. */ ! 558: cls(0); ! 559: printf( ! 560: "Most AT-compatible controllers work with NORMAL polling.\n\n" ! 561: "Perstor controllers and some IDE hard drives require ALTERNATE polling.\n\n" ! 562: "If you get \"<Watchdog Timeout>\" or \"at0:TO\" errors with normal polling,\n" ! 563: "use alternate polling.\n\n"); ! 564: ! 565: if (normal_at_poll = yes_no ("Use NORMAL polling")) { ! 566: strcpy (at_patch, "ATSREG=0x3F6 "); ! 567: at_poll = 0x3F6; ! 568: } else { ! 569: strcpy (at_patch, "ATSREG=0x1F7 "); ! 570: at_poll = 0x1F7; ! 571: } ! 572: cls(0); ! 573: printf("%s polling will be used.\n\n", ! 574: normal_at_poll ? "NORMAL" : "ALTERNATE"); ! 575: ! 576: /* Ask for the number of AT drives so that we add the proper number of ! 577: * AT drive device entries to the /tmp/devices file. When we return to build, ! 578: * we will eventually read the devices file to build our fdisk command. ! 579: * Bob H. (8/10/93) ! 580: */ ! 581: at_drive_ct = get_int(1, 2,"Enter number of non-SCSI hard drives:"); ! 582: ! 583: ! 584: /* now add the appropriate number of AT drives to /tmp/devics. This file will ! 585: * be read by build() later when generating an fdisk command. ! 586: * Bob H. (8/10/93) ! 587: */ ! 588: if(bflag){ ! 589: for(z = 0 ; z < at_drive_ct ; z++){ ! 590: for(y = 0 ; y <= 3 ; y++){ ! 591: sprintf(cmd,"/bin/echo at%dx at%d%c %d %d >> /tmp/devices", ! 592: z, z, ( 'a' + y ), AT_MAJOR, ((4 * z) + y)); ! 593: sys(cmd,S_FATAL); ! 594: } ! 595: } ! 596: } ! 597: ! 598: /* Normal vs. PS1 hard disk counts. */ ! 599: if (use_ps1 = yes_no( ! 600: "Are you installing on an IBM PS1 or ValuePoint?")) { ! 601: fl_dsk_ch_prob = 1; ! 602: } else { ! 603: fl_dsk_ch_prob = 0; ! 604: } ! 605: ! 606: /* for target kernel */ ! 607: ! 608: idenable_dev ("at"); ! 609: sprintf (line, "int\tATSREG = 0x%x;", at_poll); ! 610: cohtune_ent ("at", "ATSREG", line); ! 611: if (use_ps1) ! 612: idtune_var("AT_DRIVE_CT", at_drive_ct); ! 613: idtune_var("FL_DSK_CH_PROB", fl_dsk_ch_prob); ! 614: ! 615: /* for second boot kernel */ ! 616: fp = fopen (PATCHFILE,"a"); ! 617: fprintf (fp, "/conf/patch /mnt/coherent drvl+%d=atcon \n", ! 618: AT_MAJOR * sizeof (DRV)); ! 619: fprintf (fp, "/conf/patch /mnt/coherent %s\n", at_patch); ! 620: fprintf (fp, "/conf/patch /mnt/coherent fl_dsk_ch_prob=%d\n", ! 621: fl_dsk_ch_prob); ! 622: if (use_ps1) ! 623: fprintf (fp, "/conf/patch /mnt/coherent at_drive_ct=%d\n", ! 624: at_drive_ct); ! 625: fclose (fp); ! 626: ! 627: /* for first boot kernel */ ! 628: ! 629: sprintf (cmd, "/conf/kpatch -v %s", at_patch); ! 630: sys (cmd, S_FATAL); ! 631: sprintf (cmd, "/conf/kpatch -v fl_dsk_ch_prob=%d", fl_dsk_ch_prob); ! 632: sys (cmd, S_FATAL); ! 633: if (use_ps1) { ! 634: sprintf (cmd, "/conf/kpatch -v at_drive_ct=%d", at_drive_ct); ! 635: sys (cmd, S_FATAL); ! 636: } ! 637: /* For PS1, this step must come AFTER at_drive_ct is fixed. */ ! 638: sprintf (cmd, "/conf/kpatch -v atcon:%d:in", AT_MAJOR); ! 639: sys (cmd, S_FATAL); ! 640: ! 641: } ! 642: ! 643: /* ! 644: * floppy_tape: add support for floppy tape (a really disgusting device) ! 645: * ! 646: * 1) give user some info regarding COH support for floppy tape ! 647: * 2) display a list of supported drives ! 648: * 3) query the user for type of drive ! 649: * 4) create device nodes for specified drive ! 650: * 5) (optional) test for which unit number the drive is seen as ! 651: */ ! 652: void ! 653: floppy_tape() ! 654: { ! 655: int brand; /* which brand of drive (from menu) */ ! 656: int i; /* loop counter */ ! 657: ! 658: cls(0); ! 659: printf( ! 660: "The COHERENT system supports several brands of \"floppy tape backup\" drives,\n" ! 661: "including QIC-40 and QIC-80 models from Archive, Colorado Memory Systems (CMS),\n" ! 662: "Mountain, and Summit.\n\n" ! 663: "Please specify the brand of floppy tape drive on this computer:\n\n" ! 664: "\t0) Archive, Mountain, or Summit\n" ! 665: "\t1) Colorado Memory Systems (CMS)\n" ! 666: "\t2) Other\n\n" ! 667: ); ! 668: brand = get_int(0, 2, "Enter drive type:"); ! 669: if (brand == 2) { ! 670: printf( ! 671: "\nYou have specified a brand of tape drive which is currently unsupported.\n" ! 672: ); ! 673: return; ! 674: } ! 675: ! 676: /* ! 677: * now create the following nodes for the specified drive brand: ! 678: * Rewind No Rewind Unit # ! 679: * -------- --------- --------- ! 680: * DEV/rct0 DEV/nrct0 (unit #0) ! 681: * DEV/rct1 DEV/nrct1 (unit #1) ! 682: * DEV/rct2 DEV/nrct2 (unit #2) ! 683: * DEV/rct3 DEV/nrct3 (unit #3) ! 684: * DEV/rctss DEV/nrctss (soft select) ! 685: * ! 686: * where DEV is /mnt/dev if called from /etc/build and /dev otherwise. ! 687: */ ! 688: for (i = 0; i <= 3; ++i) { ! 689: sprintf(cmd, "/etc/mknod -f %s/rct%d c %d %d", ! 690: (bflag) ? "/mnt/dev" : "/dev", i, FL_MAJOR, ! 691: FL_TAPE_MINOR(i, brand, FL_TAPE_HARD_SEL, FL_TAPE_REW)); ! 692: sys(cmd, S_NONFATAL); ! 693: sprintf(cmd, "/etc/mknod -f %s/nrct%d c %d %d", ! 694: (bflag) ? "/mnt/dev" : "/dev", i, FL_MAJOR, ! 695: FL_TAPE_MINOR(i, brand, FL_TAPE_HARD_SEL, FL_TAPE_NOREW)); ! 696: sys(cmd, S_NONFATAL); ! 697: } ! 698: sprintf(cmd, "/etc/mknod -f %s/rctss c %d %d", ! 699: (bflag) ? "/mnt/dev" : "/dev", FL_MAJOR, ! 700: FL_TAPE_MINOR(0, brand, FL_TAPE_SOFT_SEL, FL_TAPE_REW)); ! 701: sys(cmd, S_NONFATAL); ! 702: sprintf(cmd, "/etc/mknod -f %s/nrctss c %d %d", ! 703: (bflag) ? "/mnt/dev" : "/dev", FL_MAJOR, ! 704: FL_TAPE_MINOR(0, brand, FL_TAPE_SOFT_SEL, FL_TAPE_NOREW)); ! 705: sys(cmd, S_NONFATAL); ! 706: } ! 707: ! 708: /* end of mkdev.c */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.