home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-11-04 | 44.5 KB | 1,629 lines |
- Newsgroups: comp.sources.misc
- From: briana@tau-ceti.isc-br.com (Brian W. Antoine)
- Subject: v25i018: st01scsi - DOS SCSI Driver for the Seagate ST-01, v2.0, Part01/02
- Message-ID: <csm-v25i018=st01scsi.213229@sparky.IMD.Sterling.COM>
- X-Md4-Signature: 3180d53f0c86f6c6737916d984dd4cec
- Date: Tue, 5 Nov 1991 03:34:28 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: briana@tau-ceti.isc-br.com (Brian W. Antoine)
- Posting-number: Volume 25, Issue 18
- Archive-name: st01scsi/part01
- Environment: DOS, ST-01
- Supersedes: ST01SCSI.12: Volume 15, Issue 2-3
-
- This is release 2.0 of my SCSI driver for the Seagate ST-01 card.
- Its major feature is support for large drives under DOS 4.0 and higher.
- It also refines the support for the tape driver and handles multiple
- containers per tape now. It also includes a simple remap utility for
- mapping out bad sectors on hard disks.
-
- #
- # This is a Shell Archive.
- # Remove everything above and including the cut line.
- # Then run the rest of the file through #! /bin/sh.
- # -----cut here-----cut here-----cut here-----cut here-----
- #! /bin/sh
- # Execute the file with #! /bin/sh (not csh) to create the files:
- # readme.txt
- # history.txt
- # makefile
- # binmode.c
- # mt.c
- # sformat.c
- # sremap.c
- # ioctl.h
- # equ.inc
- # options.inc
- # struct.inc
- # This Archive created: Fri Oct 18 22:46:52 1991
- # By: Brian W. Antoine at ISC - Bunker Ramo, Spokane, WA
- #
- export PATH; PATH=/bin:$PATH
- echo shar: extracting "'readme.txt'" '(391 characters)'
- if test -f 'readme.txt'
- then
- echo shar: will not over-write existing file "'readme.txt'"
- else
- sed 's/^XX//' > 'readme.txt' << \SHAR_EOF
- XXScsi Version 2.0
- XX
- XX This is release 2.0 of my SCSI driver for the Seagate ST-01 card.
- XXIt major feature is support for large drives under DOS 4.0 and higher.
- XXIt also refines the support for the tape driver and handles multiple
- XXcontainers per tape now. It also includes a simple remap utility for
- XXmapping out bad sectors on hard disks.
- XX
- XXBrian Antoine 10/18/91 'briana@tau-ceti.isc-br.com'
- SHAR_EOF
- if test 391 -ne "`wc -c < 'readme.txt'`"
- then
- echo shar: error transmitting "'readme.txt'" '(should have been 391 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'history.txt'" '(7155 characters)'
- if test -f 'history.txt'
- then
- echo shar: will not over-write existing file "'history.txt'"
- else
- sed 's/^XX//' > 'history.txt' << \SHAR_EOF
- XXScsi Version 1.0
- XX
- XX The code you received with this file is a very simple SCSI device
- XXdriver that uses the Seagate ST-01 interface card. As this driver is
- XXmy first PC assembler project other then "hello world", please don't
- XXsnicker to loudly.
- XX
- XX The package includes the source for a device driver that will scan
- XXthe SCSI bus for disk drives and partition any drives found into chunks
- XXof 32Meg plus any leftovers. As soon as I discover a way to get DOS to
- XXlet me use > 512 byte sectors, It will just allocate the entire disk to
- XXa single logical drive. It also includes a utility to access the low
- XXlevel SCSI format function for any disk found. You may specify the
- XXinterleave when the low level format is done and the version of the
- XXdriver here seems to work fine at 1:1 with my 8Mhz NEC.
- XX
- XX Some of the things to look out for are:
- XX
- XX#1 The receive_data and send_data functions in subs.asm use polled I/O
- XX to transfer data to/from the card. I would have loved to just use
- XX the I/O Channel Ready line that the card is suppose to support, but
- XX my NEC does not seem to use that line. Hence the polling of the REQ
- XX bit in the status port.
- XX
- XX#2 I did not know how to do clock speed independent timing loops, so there
- XX is a wait100us function in subs.asm that is very processor speed
- XX dependent :-(
- XX
- XX#3 In ioctl.asm there is a commented out call to scsi_verify. This is
- XX used by the DOS format utility to scan for errors. You may want to
- XX enable the call after you get everything setup. I shut it off while
- XX I was testing as I didn't want to wait for the verify everytime I
- XX changed the interleave.
- XX
- XX To bring up the driver. Assemble and link scsi.sys and add it to
- XXyour config.sys file. After rebooting, you may optionaly do a low level
- XXformat of each disk found using sformat.exe. You then use the DOS format
- XXutility on each logical drive. I did figure out just what format needed
- XXin the way of ioctl support to get it to do the high level format for me.
- XXAt this point you should have fully functional DOS drives. In testing
- XXI found that with multi_sector support (subs.asm) enabled, the SCSI drives
- XXwere just about as fast as the ST-412 C: that came with the machine. I
- XXam sure that the speed problem is basic to the inner loop of the data
- XXtransfer routines, but I'm at a loss to figure out how to speed it up.
- XX
- XX Anyway, maybe someone can find some use for the code. I got the
- XXcard for free, so I can't really complain about the speed or cost too
- XXmuch :-)
- XX
- XX Also thanks to the people that sent me samples of other device drivers
- XXfor the PC. I lost the names to a disk crash, but here is the result of
- XXyour help and my thanks.
- XX
- XXScsi Version 1.1
- XX
- XX This version of the driver add support for a single tape drive, and
- XXcleans up some of the code a little. It also adds a file that has equates
- XXto customize some of the major areas of the driver.
- XX
- XX When the driver is initialized it does a scan of the SCSI bus for
- XXdevices. The FIRST tape device found is assigned to a char device with the
- XXname "SCSITAPE". If no tape drive is found, the char device is still valid
- XXbut will generate a "bad unit" error when accessed.
- XX
- XX The SCSITAPE device expects reads and writes to be done in some variation
- XXof 512 bytes. I/O done where (size mod 512) is non-zero will generate an
- XXerror. Tape access must be done in RAW mode, and this is where I had to
- XXsome code in the driver that I'm not sure is very pretty. The problem is
- XXthat DOS insists on opening char devices in cooked mode. It does give you
- XXthe ability to switch to RAW mode, but only by using 'intdos()' to access
- XXthe ioctl interface. The MSC 'setmode()' call for binary will not effect
- XXchar devices, nor will opening the file with O_BINARY. So I had two choices.
- XXI could modify every program that expected to talk to the tape so that it
- XXalso issued the ioctl stuff (see binmode.c), or I could kludge the driver
- XXto issue the required calls.
- XX
- XX In the end, I punted and did both. The code in binmode.c is the function
- XXthat along with 'setmode()', will make sure that ANYTHING you open is accessed
- XXin RAW mode. Simply check for any call to 'setmode()' that is switching to
- XXO_BINARY, and add another call to 'binmode()'. This assumes that you have
- XXthe source to the utility in question. For those who are don't mind a little
- XXkludge amount friends. The file options.inc has an equate called 'use_kludge'
- XXthat when enabled turns on some code in kludge.asm. This code links into the
- XXINT 21h vector and waits for a DOS open request to go by. When it sees an
- XXopen request, it 'calls' rather then 'jmps' to the normal vector. This allows
- XXthe driver to get the 'handle' returned by DOS. Because the SCSITAPE device
- XXenables the driver_open function, I can tell from the fact that an open is
- XXin progress and wether the driver just got an open request, wether any
- XXparticular open was for me. When the open was in fact for the SCSITAPE device,
- XXI take the 'handle' returned by DOS and forge the required ioctl calls to
- XXswitch to RAW mode.
- XX
- XX With the addition of tape support. I now use GNU Tar to swap tapes with
- XXmy normal UN*X system at work. The driver works well enough that I have yet
- XXto have a format problem with the different systems. It is also a lot faster
- XXwhen doing backups on the PC. Using 'fastback' I would get about 1 Meg a
- XXminute thruput on my 8 Mhz AT. Using GNU Tar and the SCSITAPE device I get
- XX> 2.5 Meg a minute to the tape and don't have to swap disks quite so often :-)
- XX
- XX Anyway, I hope that someone out there actually gets some use out of this
- XXcode. It has been a real adventure for me.
- XX
- XXScsi Version 1.2
- XX
- XX This version of the driver enhances the tape drive support by adding
- XXa program to control the action of the tape drive, and move around within
- XXmultiple containers on the tape. As I used the Bezerkley 'mt' command for
- XXideas, the program is naturally called 'mt'. You can tell the driver to:
- XX
- XX#1 Rewind/No Rewind on close.
- XX#2 Erase the tape.
- XX#3 Step forwards or backwards X tape marks.
- XX Note: the command 'mt -s 0' steps to End Of Data.
- XX
- XX I also did a little more work on the routines that actually transfer
- XXdate to/from the card. I found that I had left out a check for timeout
- XXin the inner loops of the the data xfer routines. When the random parity
- XXerror or other glitch occured. The driver would hang forever. Not very
- XXfriendly... The added code does not seem to slow the driver any, or at
- XXleast the disk thru-put tester I use shows no difference.
- XX
- XX As the driver seems to be stable now, and it does about everything
- XXI started out to do. I'm going to post this to comp.sources.misc instead
- XXof alt.sources in the hopes that more people will see it. Hopefully this
- XXwill be usefull to someone else (at least they might get a good chuckle).
- XX
- XXScsi Version 2.0
- XX
- XX This is release 2.0 of my SCSI driver for the Seagate ST-01 card.
- XXIt major feature is support for large drives under DOS 4.0 and higher.
- XXIt also refines the support for the tape driver and handles multiple
- XXcontainers per tape now. It also includes a simple remap utility for
- XXmapping out bad sectors on hard disks.
- SHAR_EOF
- if test 7155 -ne "`wc -c < 'history.txt'`"
- then
- echo shar: error transmitting "'history.txt'" '(should have been 7155 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'makefile'" '(719 characters)'
- if test -f 'makefile'
- then
- echo shar: will not over-write existing file "'makefile'"
- else
- sed 's/^XX//' > 'makefile' << \SHAR_EOF
- XX#
- XX# SCSI Stuff
- XX#
- XXCC = cl
- XXCFLAGS = -G2 -Ox
- XXAS = masm
- XXAFLAGS =
- XXSRCS = scsi.asm subs.asm ioctl.asm dump.asm units.asm kludge.asm
- XXINCS = options.inc equ.inc struct.inc
- XX
- XXall: scsi.sys sformat.exe sremap.exe mt.exe
- XX
- XX#
- XX# SCSI Disk Device Driver
- XX#
- XXscsi.sys: scsi.obj
- XX link +scsi.obj, scsi ;
- XX exe2bin scsi.exe scsi.sys
- XX del scsi.exe
- XX
- XXscsi.obj: $(SRCS) $(INCS)
- XX $(AS) $(AFLAGS) scsi.asm scsi.obj scsi.lst ;
- XX
- XX#
- XX# SCSI Disk Formatter
- XX#
- XXsformat.exe: sformat.c ioctl.h
- XX $(CC) $(CFLAGS) -o sformat.exe sformat.c
- XX
- XX#
- XX# SCSI Disk Block Remap
- XX#
- XXsremap.exe: sremap.c ioctl.h
- XX $(CC) $(CFLAGS) -o sremap.exe sremap.c
- XX
- XX#
- XX# SCSI Tape Control
- XX#
- XXmt.exe: mt.c ioctl.h
- XX $(CC) $(CFLAGS) -o mt.exe mt.c
- XX
- XX#
- XX# clean
- XX#
- XXclean:
- XX rm -f *.exe *.obj *.lst
- SHAR_EOF
- if test 719 -ne "`wc -c < 'makefile'`"
- then
- echo shar: error transmitting "'makefile'" '(should have been 719 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'binmode.c'" '(497 characters)'
- if test -f 'binmode.c'
- then
- echo shar: will not over-write existing file "'binmode.c'"
- else
- sed 's/^XX//' > 'binmode.c' << \SHAR_EOF
- XX#ifdef MSDOS
- XX#include <dos.h>
- XX
- XXbinmode(fd)
- XXint fd;
- XX{
- XX union REGS inregs, outregs;
- XX
- XX /*
- XX ** get the current mode
- XX */
- XX inregs.h.ah = 0x44; /* ioctl */
- XX inregs.h.al = 0x00; /* get */
- XX inregs.x.bx = fd; /* unit */
- XX intdos(&inregs, &outregs);
- XX
- XX /*
- XX ** set to BINARY mode (this works for char devices)
- XX */
- XX inregs.h.ah = 0x44; /* ioctl */
- XX inregs.h.al = 0x01; /* set */
- XX inregs.x.bx = fd; /* unit */
- XX inregs.h.dh = 0;
- XX inregs.h.dl = outregs.h.dl | 0x20;
- XX intdos(&inregs, &outregs);
- XX}
- XX#endif
- SHAR_EOF
- if test 497 -ne "`wc -c < 'binmode.c'`"
- then
- echo shar: error transmitting "'binmode.c'" '(should have been 497 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'mt.c'" '(3087 characters)'
- if test -f 'mt.c'
- then
- echo shar: will not over-write existing file "'mt.c'"
- else
- sed 's/^XX//' > 'mt.c' << \SHAR_EOF
- XX/*
- XX** SCSI Tape Control (Low Level)
- XX**
- XX** usage: mt bsf|bsr|eod|fsf|fsr|offline|online|eof|weof|erase|rewind [count]
- XX**
- XX** Revision History:
- XX**
- XX** Version 1.0 09/09/90 Initial Release
- XX**
- XX** Version 1.1 09/29/90 Use keywords instead of minus style options.
- XX** This makes us a little more like the
- XX** bezerkley 'mt' command.
- XX**
- XX** Version 1.2 10/04/90 Update the i/o packet structure.
- XX**
- XX*/
- XX#include <stdio.h>
- XX#include <fcntl.h>
- XX#include <string.h>
- XX#include <dos.h>
- XX#include "ioctl.h"
- XX
- XX#define TRUE (1)
- XX#define FALSE (0)
- XX#define VERSION "mt Version 1.2 BWA"
- XX
- XXextern int _doserrno;
- XX
- XXstruct cmd ioctl_data;
- XXunion REGS inregs, outregs;
- XXstruct SREGS segregs;
- XXint fd;
- XXchar *device = "SCSITAPE";
- XXchar far *cp;
- XX
- XXmain(argc, argv)
- XXint argc;
- XXchar *argv[];
- XX{
- XX /*
- XX ** say hello
- XX */
- XX if (argc < 2 || argc > 3) usage();
- XX if ( !strcmp(argv[1], "bsf") ) /* space by filemark */
- XX {
- XX ioctl_data.command = 'S';
- XX if (argc == 3)
- XX ioctl_data.arg1 = -atoi(argv[2]);
- XX else
- XX ioctl_data.arg1 = -1;
- XX ioctl_data.arg2 = 1;
- XX }
- XX else if ( !strcmp(argv[1], "bsr") ) /* space by block */
- XX {
- XX ioctl_data.command = 'S';
- XX if (argc == 3)
- XX ioctl_data.arg1 = -atoi(argv[2]);
- XX else
- XX ioctl_data.arg1 = -1;
- XX ioctl_data.arg2 = 0;
- XX }
- XX else if ( !strcmp(argv[1], "eod") ) /* space to eod */
- XX {
- XX if (argc == 3) usage();
- XX ioctl_data.command = 'S';
- XX ioctl_data.arg1 = 1;
- XX ioctl_data.arg2 = 3;
- XX }
- XX else if ( !strcmp(argv[1], "fsf") ) /* space by filemark */
- XX {
- XX ioctl_data.command = 'S';
- XX if (argc == 3)
- XX ioctl_data.arg1 = atoi(argv[2]);
- XX else
- XX ioctl_data.arg1 = 1;
- XX ioctl_data.arg2 = 1;
- XX }
- XX else if ( !strcmp(argv[1], "fsr") ) /* space by block */
- XX {
- XX ioctl_data.command = 'S';
- XX if (argc == 3)
- XX ioctl_data.arg1 = atoi(argv[2]);
- XX else
- XX ioctl_data.arg1 = 1;
- XX ioctl_data.arg2 = 0;
- XX }
- XX else if ( !strcmp(argv[1], "online") )
- XX {
- XX if (argc == 3) usage();
- XX ioctl_data.command = 'N';
- XX }
- XX else if ( !strcmp(argv[1], "offline") )
- XX {
- XX if (argc == 3) usage();
- XX ioctl_data.command = 'L';
- XX }
- XX else if ( !strcmp(argv[1], "eof") || !strcmp(argv[1], "weof") )
- XX {
- XX ioctl_data.command = 'M';
- XX if (argc == 3)
- XX ioctl_data.arg1 = atoi(argv[2]);
- XX else
- XX ioctl_data.arg1 = 1;
- XX }
- XX else if ( !strcmp(argv[1], "erase") )
- XX {
- XX if (argc == 3) usage();
- XX ioctl_data.command = 'E';
- XX }
- XX else if ( !strcmp(argv[1], "rewind") )
- XX {
- XX if (argc == 3) usage();
- XX ioctl_data.command = 'R';
- XX }
- XX else
- XX {
- XX usage();
- XX }
- XX
- XX /*
- XX ** put together the command
- XX */
- XX fd = open(device, O_WRONLY);
- XX if ( fd < 0 )
- XX {
- XX perror(device);
- XX exit(1);
- XX }
- XX inregs.h.ah = 0x44; /* ioctl */
- XX inregs.h.al = 0x03; /* write */
- XX inregs.x.bx = fd; /* unit */
- XX inregs.x.cx = sizeof(struct cmd);
- XX cp = (char *) &ioctl_data;
- XX inregs.x.dx = FP_OFF(cp);
- XX segregs.ds = FP_SEG(cp);
- XX
- XX /*
- XX ** start the command
- XX */
- XX intdosx(&inregs, &outregs, &segregs);
- XX
- XX /*
- XX ** see what happened
- XX */
- XX if ( outregs.x.cflag )
- XX printf("mt: %s: error %d.\n", device, _doserrno);
- XX close(fd);
- XX exit(0);
- XX}
- XX
- XXusage()
- XX{
- XX puts(VERSION);
- XX puts("usage: mt bsf|bsr|eod|fsf|fsr|offline|online|eof|weof|erase|rewind [count]");
- XX exit(1);
- XX}
- SHAR_EOF
- if test 3087 -ne "`wc -c < 'mt.c'`"
- then
- echo shar: error transmitting "'mt.c'" '(should have been 3087 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'sformat.c'" '(6035 characters)'
- if test -f 'sformat.c'
- then
- echo shar: will not over-write existing file "'sformat.c'"
- else
- sed 's/^XX//' > 'sformat.c' << \SHAR_EOF
- XX/*
- XX** SCSI Disk Formatter (Low Level)
- XX**
- XX** usage: sformat drive:
- XX**
- XX** Revision History:
- XX**
- XX** Version 1.0 08/03/90 Initial Release
- XX**
- XX** Version 1.1 08/20/90 Add verification message.
- XX**
- XX** Version 1.2 09/18/90 Correct ioctl_data struct.
- XX**
- XX** Version 1.3 10/04/90 Update the i/o packet structure.
- XX** Allow for inputing of the defect list.
- XX**
- XX** Version 1.4 10/17/90 Use Defines from ioctl.h for commands.
- XX** If no defect list is entered, ask if
- XX** the existing list should be used.
- XX**
- XX** Version 1.5 11/10/90 Allow for either logical block or cyl-head-index
- XX** styles of defect information.
- XX*/
- XX#include <stdio.h>
- XX#include <dos.h>
- XX#include "ioctl.h"
- XX
- XX#define TRUE (1)
- XX#define FALSE (0)
- XX#define VERSION "sformat Version 1.5 BWA"
- XX
- XXextern int _doserrno;
- XX
- XXstruct cmd ioctl_data;
- XXstruct defects_lba defect_list_lba;
- XXstruct defects_chi defect_list_chi;
- XXunion REGS inregs, outregs;
- XXstruct SREGS segregs;
- XXunsigned short interleave = 0, format_type = FORMAT_NORMAL;
- XXint defect_type = DEFECT_LBA;
- XXunsigned char drive;
- XXchar far *cp;
- XX
- XXmain(argc, argv)
- XXint argc;
- XXchar *argv[];
- XX{
- XX long block, cyl, head, index;
- XX short defect_count = 0;
- XX char answer[BUFSIZ];
- XX
- XX /*
- XX ** say hello
- XX */
- XX puts(VERSION);
- XX if (argc != 2) usage();
- XX
- XX /*
- XX ** figure out who to format
- XX */
- XX if (argv[1][1] != ':') usage();
- XX drive = argv[1][0];
- XX drive = toupper(drive);
- XX drive -= '@';
- XX
- XX /*
- XX ** ask about interleave
- XX */
- XX printf("Interleave [0]? ");
- XX fflush(stdout);
- XX fgets(answer, BUFSIZ, stdin);
- XX if ( strlen(answer) ) interleave = atoi(answer);
- XX
- XX /*
- XX ** ask for defect list
- XX */
- XX puts("Input your defect list, <enter> to terminate.");
- XX while (defect_count < MAX_DEFECTS)
- XX {
- XX /*
- XX ** which prompt
- XX */
- XX switch ( defect_type )
- XX {
- XX case DEFECT_LBA:
- XX printf("Logical Block Address: ");
- XX break;
- XX
- XX case DEFECT_CHI:
- XX printf("Cyl, Head, Index: ");
- XX break;
- XX }
- XX fflush(stdout);
- XX fgets(answer, BUFSIZ, stdin);
- XX if ( answer[0] == '\n' ) break;
- XX
- XX /*
- XX ** switch to cyl-head-index?
- XX */
- XX if ( strchr(answer, ',') ) defect_type = DEFECT_CHI;
- XX
- XX /*
- XX ** scan the answer
- XX */
- XX switch ( defect_type )
- XX {
- XX case DEFECT_LBA:
- XX sscanf(answer, "%lx", &block);
- XX defect_list_lba.list[defect_count].defect_lba3 = (block >> 24) & 0x00FF;
- XX defect_list_lba.list[defect_count].defect_lba2 = (block >> 16) & 0x00FF;
- XX defect_list_lba.list[defect_count].defect_lba1 = (block >> 8) & 0x00FF;
- XX defect_list_lba.list[defect_count].defect_lba0 = block & 0x00FF;
- XX format_type = FORMAT_ADDLBA;
- XX break;
- XX
- XX case DEFECT_CHI:
- XX sscanf(answer, "%ld, %ld, %ld", &cyl, &head, &index);
- XX defect_list_chi.list[defect_count].defect_cyl2 = (cyl >> 16) & 0x00FF;
- XX defect_list_chi.list[defect_count].defect_cyl1 = (cyl >> 8) & 0x00FF;
- XX defect_list_chi.list[defect_count].defect_cyl0 = cyl & 0x00FF;
- XX defect_list_chi.list[defect_count].defect_head = head & 0x00FF;
- XX defect_list_chi.list[defect_count].defect_idx3 = (index >> 24) & 0x00FF;
- XX defect_list_chi.list[defect_count].defect_idx2 = (index >> 16) & 0x00FF;
- XX defect_list_chi.list[defect_count].defect_idx1 = (index >> 8) & 0x00FF;
- XX defect_list_chi.list[defect_count].defect_idx0 = index & 0x00FF;
- XX format_type = FORMAT_ADDCHI;
- XX break;
- XX }
- XX defect_count++;
- XX }
- XX
- XX /*
- XX ** adjust to be length of list in bytes
- XX */
- XX switch ( defect_type )
- XX {
- XX case DEFECT_LBA:
- XX defect_count *= sizeof(struct defect_entry_lba);
- XX break;
- XX
- XX case DEFECT_CHI:
- XX defect_count *= sizeof(struct defect_entry_chi);
- XX break;
- XX }
- XX
- XX /*
- XX ** if no defect list was entered, check to see if the
- XX ** existing list should be used.
- XX */
- XX if ( !defect_count )
- XX {
- XX printf("Should the existing G_LIST be used (y,n)? ");
- XX fflush(stdout);
- XX fgets(answer, BUFSIZ, stdin);
- XX if ( answer[0] == 'n' ) format_type = FORMAT_ORIG;
- XX }
- XX
- XX /*
- XX ** verify that this is what the user really wants to do
- XX */
- XX printf("Do you really wish to format the SCSI\n");
- XX printf("device that contains drive %c: (y,n)? ", argv[1][0]);
- XX fflush(stdout);
- XX fgets(answer, BUFSIZ, stdin);
- XX if ( answer[0] != 'y' )
- XX {
- XX puts("Aborting low level format ....");
- XX exit(1);
- XX }
- XX
- XX /*
- XX ** build the defect list header
- XX */
- XX switch ( defect_type )
- XX {
- XX case DEFECT_LBA:
- XX defect_list_lba.header.reserved = 0;
- XX defect_list_lba.header.options = 0;
- XX defect_list_lba.header.dll_msb = (defect_count >> 8) & 0x00FF;
- XX defect_list_lba.header.dll_lsb = defect_count & 0x00FF;
- XX break;
- XX
- XX case DEFECT_CHI:
- XX defect_list_chi.header.reserved = 0;
- XX defect_list_chi.header.options = 0;
- XX defect_list_chi.header.dll_msb = (defect_count >> 8) & 0x00FF;
- XX defect_list_chi.header.dll_lsb = defect_count & 0x00FF;
- XX break;
- XX }
- XX
- XX /*
- XX ** put together the command
- XX */
- XX inregs.h.ah = 0x44; /* ioctl */
- XX inregs.h.al = 0x05; /* write */
- XX inregs.h.bl = drive; /* unit */
- XX inregs.x.cx = sizeof(struct cmd);
- XX cp = (char *) &ioctl_data;
- XX inregs.x.dx = FP_OFF(cp);
- XX segregs.ds = FP_SEG(cp);
- XX ioctl_data.command = I_FORMAT;
- XX ioctl_data.arg1 = interleave;
- XX ioctl_data.arg2 = format_type;
- XX switch ( defect_type )
- XX {
- XX case DEFECT_LBA:
- XX cp = (char *) &defect_list_lba;
- XX break;
- XX
- XX case DEFECT_CHI:
- XX cp = (char *) &defect_list_chi;
- XX break;
- XX }
- XX ioctl_data.buf_ofs = FP_OFF(cp);
- XX ioctl_data.buf_seg = FP_SEG(cp);
- XX ioctl_data.buf_len = sizeof(struct defect_header) + defect_count;
- XX
- XX /*
- XX ** start the format
- XX */
- XX printf("Now formating with ");
- XX switch (format_type)
- XX {
- XX case FORMAT_NORMAL:
- XX puts("P_LIST and G_LIST ...");
- XX break;
- XX
- XX case FORMAT_ADDLBA:
- XX printf("P_LIST, G_LIST and %d defects ...\n", (defect_count / sizeof(struct defect_entry_lba)));
- XX break;
- XX
- XX case FORMAT_ADDCHI:
- XX printf("%d defects ...\n", (defect_count / sizeof(struct defect_entry_chi)));
- XX break;
- XX
- XX case FORMAT_ORIG:
- XX puts("P_LIST only ...");
- XX break;
- XX }
- XX puts("Please wait ....");
- XX intdosx(&inregs, &outregs, &segregs);
- XX
- XX /*
- XX ** see what happened
- XX */
- XX if ( outregs.x.cflag )
- XX printf("DOS error %d occured during format.\n", _doserrno);
- XX else
- XX puts("Formating complete.");
- XX exit(0);
- XX}
- XX
- XXusage()
- XX{
- XX puts("usage: sformat drive:");
- XX exit(1);
- XX}
- SHAR_EOF
- if test 6035 -ne "`wc -c < 'sformat.c'`"
- then
- echo shar: error transmitting "'sformat.c'" '(should have been 6035 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'sremap.c'" '(2674 characters)'
- if test -f 'sremap.c'
- then
- echo shar: will not over-write existing file "'sremap.c'"
- else
- sed 's/^XX//' > 'sremap.c' << \SHAR_EOF
- XX/*
- XX** SCSI Disk Block Reassign
- XX**
- XX** usage: sremap drive:
- XX**
- XX** Revision History:
- XX**
- XX** Version 1.0 10/17/90 Initial Release
- XX*/
- XX#include <stdio.h>
- XX#include <dos.h>
- XX#include "ioctl.h"
- XX
- XX#define TRUE (1)
- XX#define FALSE (0)
- XX#define VERSION "sremap Version 1.0 BWA"
- XX
- XXextern int _doserrno;
- XX
- XXstruct cmd ioctl_data;
- XXstruct remaps remap_list;
- XXunion REGS inregs, outregs;
- XXstruct SREGS segregs;
- XXunsigned char drive;
- XXchar far *cp;
- XX
- XXmain(argc, argv)
- XXint argc;
- XXchar *argv[];
- XX{
- XX long block;
- XX short remap_count = 0;
- XX char answer[BUFSIZ];
- XX
- XX /*
- XX ** say hello
- XX */
- XX puts(VERSION);
- XX if (argc != 2) usage();
- XX
- XX /*
- XX ** figure out who to format
- XX */
- XX if (argv[1][1] != ':') usage();
- XX drive = argv[1][0];
- XX drive = toupper(drive);
- XX drive -= '@';
- XX
- XX /*
- XX ** ask for remap list
- XX */
- XX puts("Input your remap list, <enter> to terminate.");
- XX while (remap_count < MAX_DEFECTS)
- XX {
- XX printf("Logical Block Address: ");
- XX fflush(stdout);
- XX fgets(answer, BUFSIZ, stdin);
- XX if ( answer[0] == '\n' ) break;
- XX sscanf(answer, "%lx", &block);
- XX remap_list.list[remap_count].remap_lba3 = (block >> 24) & 0x00FF;
- XX remap_list.list[remap_count].remap_lba2 = (block >> 16) & 0x00FF;
- XX remap_list.list[remap_count].remap_lba1 = (block >> 8) & 0x00FF;
- XX remap_list.list[remap_count].remap_lba0 = block & 0x00FF;
- XX remap_count++;
- XX }
- XX
- XX /*
- XX ** adjust to length of list in bytes
- XX */
- XX remap_count *= sizeof(struct remap_entry);
- XX
- XX /*
- XX ** verify that this is what the user really wants to do
- XX */
- XX printf("Do you really wish to remap blocks on the SCSI\n");
- XX printf("device that contains drive %c: (y,n)? ", argv[1][0]);
- XX fflush(stdout);
- XX if ( getchar() != 'y' )
- XX {
- XX puts("Aborting reassign ....");
- XX exit(1);
- XX }
- XX
- XX /*
- XX ** build the remap list header
- XX */
- XX remap_list.header.reserved = 0;
- XX remap_list.header.reserved2 = 0;
- XX remap_list.header.rll_msb = (remap_count >> 8) & 0x00FF;
- XX remap_list.header.rll_lsb = remap_count & 0x00FF;
- XX
- XX /*
- XX ** put together the command
- XX */
- XX inregs.h.ah = 0x44; /* ioctl */
- XX inregs.h.al = 0x05; /* write */
- XX inregs.h.bl = drive; /* unit */
- XX inregs.x.cx = sizeof(struct cmd);
- XX cp = (char *) &ioctl_data;
- XX inregs.x.dx = FP_OFF(cp);
- XX segregs.ds = FP_SEG(cp);
- XX ioctl_data.command = I_REASSIGN;
- XX cp = (char *) &remap_list;
- XX ioctl_data.buf_ofs = FP_OFF(cp);
- XX ioctl_data.buf_seg = FP_SEG(cp);
- XX ioctl_data.buf_len = sizeof(struct remap_header) + remap_count;
- XX
- XX /*
- XX ** start the remap
- XX */
- XX puts("Now reassigning ....");
- XX puts("Please wait ....");
- XX intdosx(&inregs, &outregs, &segregs);
- XX
- XX /*
- XX ** see what happened
- XX */
- XX if ( outregs.x.cflag )
- XX printf("DOS error %d occured during reassign.\n", _doserrno);
- XX else
- XX puts("Reassigning complete.");
- XX exit(0);
- XX}
- XX
- XXusage()
- XX{
- XX puts("usage: sremap drive:");
- XX exit(1);
- XX}
- SHAR_EOF
- if test 2674 -ne "`wc -c < 'sremap.c'`"
- then
- echo shar: error transmitting "'sremap.c'" '(should have been 2674 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'ioctl.h'" '(2373 characters)'
- if test -f 'ioctl.h'
- then
- echo shar: will not over-write existing file "'ioctl.h'"
- else
- sed 's/^XX//' > 'ioctl.h' << \SHAR_EOF
- XX/*
- XX** ioctl types that the driver understands
- XX*/
- XX#define I_FORMAT 'F'
- XX#define I_ERASE 'E'
- XX#define I_REWIND 'R'
- XX#define I_LOAD 'L'
- XX#define I_NOLOAD 'N'
- XX#define I_SPACE 'S'
- XX#define I_FILEMARK 'M'
- XX#define I_REASSIGN 'A'
- XX
- XX/*
- XX** definition of the structure to pass to the SCSI driver
- XX**
- XX** This should agree with the 'ioc' struct in 'struct.inc'
- XX*/
- XXstruct cmd {
- XX short command; /* command type */
- XX short arg1; /* command args */
- XX short arg2; /* command args */
- XX short buf_seg; /* command buffer segment */
- XX short buf_ofs; /* command buffer offset */
- XX short buf_len; /* command buffer length */
- XX};
- XX
- XX/*
- XX** Format Command options types
- XX*/
- XX#define FORMAT_NORMAL (0x00)
- XX#define FORMAT_ADDLBA (0x10)
- XX#define FORMAT_ORIG (0x18)
- XX#define FORMAT_ADDCHI (0x1C)
- XX
- XX/*
- XX** Defect List types
- XX*/
- XX#define DEFECT_LBA (1)
- XX#define DEFECT_CHI (2)
- XX
- XX#define MAX_DEFECTS (64)
- XX
- XX/*
- XX** defect list header
- XX*/
- XXstruct defect_header {
- XX char reserved; /* reserved */
- XX char options; /* format options */
- XX char dll_msb; /* defect list length MSB */
- XX char dll_lsb; /* defect list length LSB */
- XX};
- XX
- XX/*
- XX** defect list entry / block number
- XX*/
- XXstruct defect_entry_lba {
- XX char defect_lba3; /* defect block address MSB */
- XX char defect_lba2;
- XX char defect_lba1;
- XX char defect_lba0; /* defect block address LSB */
- XX};
- XX
- XX/*
- XX** defect list / block number
- XX*/
- XXstruct defects_lba {
- XX struct defect_header header;
- XX struct defect_entry_lba list[MAX_DEFECTS];
- XX};
- XX
- XX/*
- XX** defect list entry / cyl-head-index
- XX*/
- XXstruct defect_entry_chi {
- XX char defect_cyl2; /* defect cylinder MSB */
- XX char defect_cyl1;
- XX char defect_cyl0; /* defect cylinder LSB */
- XX char defect_head;
- XX char defect_idx3; /* defect index MSB */
- XX char defect_idx2;
- XX char defect_idx1;
- XX char defect_idx0; /* defect index LSB */
- XX};
- XX
- XX/*
- XX** defect list / chl-head-index
- XX*/
- XXstruct defects_chi {
- XX struct defect_header header;
- XX struct defect_entry_chi list[MAX_DEFECTS];
- XX};
- XX
- XX/*
- XX** remap list header
- XX*/
- XXstruct remap_header {
- XX char reserved; /* reserved */
- XX char reserved2; /* reserved */
- XX char rll_msb; /* remap list length MSB */
- XX char rll_lsb; /* remap list length LSB */
- XX};
- XX
- XX/*
- XX** remap list entry
- XX*/
- XXstruct remap_entry {
- XX char remap_lba3; /* remap block address MSB */
- XX char remap_lba2;
- XX char remap_lba1;
- XX char remap_lba0; /* remap block address LSB */
- XX};
- XX
- XX/*
- XX** remap list
- XX*/
- XXstruct remaps {
- XX struct remap_header header;
- XX struct remap_entry list[MAX_DEFECTS];
- XX};
- SHAR_EOF
- if test 2373 -ne "`wc -c < 'ioctl.h'`"
- then
- echo shar: error transmitting "'ioctl.h'" '(should have been 2373 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'equ.inc'" '(4746 characters)'
- if test -f 'equ.inc'
- then
- echo shar: will not over-write existing file "'equ.inc'"
- else
- sed 's/^XX//' > 'equ.inc' << \SHAR_EOF
- XX;
- XX; Equates
- XX;
- XXTRUE EQU 001h
- XXFALSE EQU 000h
- XX
- XXDISK_REQUEST EQU 000h ;Disk I/O Request
- XXTAPE_REQUEST EQU 001h ;Tape I/O Request
- XX
- XX;
- XX; Video Bus Monitoring
- XX;
- XXVIDEO_SEG EQU 0B800h
- XXVIDEO_OFS EQU 79 * 2
- XXVIDEO_COLOR EQU 00600h ;Light Red
- XX
- XX;
- XX; ST-01 Card Registers
- XX;
- XXSCSI_CARD_SEG EQU 0DE00h ;Base Segment of Card
- XXSCSI_CMD_PORT EQU 01A00h ;Offset to Command Port
- XXSCSI_DATA_PORT EQU 01C00h ;Offset to Data Port
- XX
- XXSTACK_SIZE EQU 1024 ;Our Local Stack
- XX
- XX;
- XX; How the 16 bit sector number is broken down
- XX; into a sector and cylinder number.
- XX;
- XX; x = Cylinder, y = track, always have only 1 head
- XX;
- XX; xxxx xxxx xxxx yyyy
- XX;
- XX if large_drives
- XXSECT_TRACK EQU 16 ;Sectors per Track
- XXROUND_CYL EQU 0FFF0h ;Round Sectors to nearest Cylinder
- XXCLUSTSIZE EQU 8 ;Number of Sectors to a Cluster
- XX else
- XXSECT_TRACK EQU 16 ;Sectors per Track
- XXROUND_CYL EQU 0FFF0h ;Round Sectors to nearest Cylinder
- XXCLUSTSIZE EQU 4 ;Number of Sectors to a Cluster
- XXSECT_2_FS EQU 10 ;How far to shift for
- XX ;Total Sectors to Fat Sectors
- XX endif
- XX
- XX;
- XX; The max target to check for (0-X).
- XX; If using 'reserve_addr', this should not execede 6!
- XX;
- XXMAXUNIT EQU 6 ;Maximum Unit Number
- XX
- XXP_SECT EQU 512 ;Physical Sector Size
- XX
- XX;
- XX; CHUNK_MASK is the maximum number of sectors to access in one
- XX; SCSI request. It MUST be a power of two, and CHUNK_MASK * P_SECT
- XX; MUST be <= 64K to prevent segment wrap problems.
- XX;
- XXCHUNK_MAX EQU 32
- XX
- XXCMDENABLE EQU 080h ;Enable the output drivers
- XXCMDENINTR EQU 040h ;Enable Interrupt
- XXCMDPARITY EQU 020h ;Enable Parity
- XXCMDSTARB EQU 010h ;Start Bus Arbitration
- XXCMDATTN EQU 008h ;Assert ATTN
- XXCMDBSY EQU 004h ;Assert BSY
- XXCMDSEL EQU 002h ;Assert SEL
- XXCMDRST EQU 001h ;Assert RST
- XX
- XX if scsi_parity
- XXCMDBASE EQU CMDPARITY ;Base value of all commands
- XX else
- XXCMDBASE EQU 000h ;Base value of all commands
- XX endif
- XX
- XXSTARBCOMPL EQU 080h ;Arbitration Complete
- XXSTPARERR EQU 040h ;Parity Error
- XXSTSEL EQU 020h ;SEL Asserted
- XXSTREQ EQU 010h ;REQ Asserted
- XXSTCD EQU 008h ;C/D Asserted
- XXSTIO EQU 004h ;I/O Asserted
- XXSTMSG EQU 002h ;MSG Asserted
- XXSTBSY EQU 001h ;BSY Asserted
- XX
- XXREQ_MASK EQU STCD or STIO or STMSG
- XXREQ_DATAOUT EQU 000h ;Data Out Phase
- XXREQ_DATAIN EQU STIO ;Data In Phase
- XXREQ_CMDOUT EQU STCD ;Command Out Phase
- XXREQ_STATIN EQU STCD or STIO ;Status In Phase
- XXREQ_MSGOUT EQU STMSG or STCD ;Msg Out Phase
- XXREQ_MSGIN EQU STMSG or STCD or STIO ;Msg In Phase
- XX
- XXCOK EQU 0 ;Command Completed OK
- XXCNOCONNECT EQU 1 ;Unable to Connect to Target
- XXCBUSBUSY EQU 2 ;Bus Busy
- XXCTIMEOUT EQU 3 ;Timeout waiting for Response
- XXCERROR EQU 4 ;Target Return Error
- XXCBUSY EQU 5 ;Target was Busy
- XXCDISCONNECT EQU 6 ;Target Disconnected
- XXCOFFLINE EQU 7 ;Target Went Offline
- XXCMSGOUT EQU 8 ;Target Request Message Out???
- XXCPARERR EQU 9 ;Parity Error Detected
- XXCSELERR EQU 10 ;Re-Select Detected
- XX
- XXSCSI_TESTREADY EQU 000h ;Test Unit Ready (6 byte)
- XXSCSI_REWIND EQU 001h ;Rewind (6 byte)
- XXSCSI_REQSENSE EQU 003h ;Request Sense (6 byte)
- XXSCSI_FORMATUNIT EQU 004h ;Format Disk (6 byte)
- XXSCSI_REASSIGN EQU 007h ;Reassign Bad Block (6 byte)
- XXSCSI_WRITEFM EQU 010h ;Write File Marks (6 byte)
- XXSCSI_SPACE EQU 011h ;Space Tape (6 byte)
- XXSCSI_INQUIRY EQU 012h ;Inquire (6 byte)
- XXSCSI_MODE_SET EQU 015h ;Mode Select (6 byte)
- XXSCSI_ERASE EQU 019h ;Erase Tape (6 byte)
- XXSCSI_MODE_GET EQU 01Ah ;Mode Sense (6 byte)
- XXSCSI_LOAD EQU 01Bh ;Load / Unload Tape (6 byte)
- XXSCSI_READSIZE EQU 025h ;Read Drive Capacity (10 byte)
- XX if extended_io
- XXSCSI_READBLK EQU 028h ;Read Sectors (10 byte)
- XXSCSI_WRITEBLK EQU 02Ah ;Write Sectors (10 byte)
- XX else
- XXSCSI_READBLK EQU 008h ;Read Sectors (6 byte)
- XXSCSI_WRITEBLK EQU 00Ah ;Write Sectors (6 byte)
- XX endif
- XXSCSI_VERIFYBLK EQU 02Fh ;Verify Blocks (10 byte)
- XX
- XXMSG_COMPLETE EQU 000h ;Command is Complete
- XXMSG_EXTEND EQU 001h ;Extended Message Follows
- XXMSG_SAVE EQU 002h ;Save Data Pointers
- XXMSG_RESTORE EQU 003h ;Restore Data Pointers
- XXMSG_DISCONNECT EQU 004h ;Disconnect Requested
- XXMSG_ERROR EQU 005h ;Error Detected
- XXMSG_ABORT EQU 006h ;Abort the Command
- XXMSG_REJECT EQU 007h ;Reject the Command
- XXMSG_NOP EQU 008h ;No Operation
- XXMSG_PARITY EQU 009h ;Parity Error Occured
- XXMSG_RESET EQU 00Ch ;Reset the Unit
- XXMSG_IDENTIFY EQU 080h ;Identify Yourself
- XX
- XX;
- XX; Test Unit Ready Retry Count
- XX;
- XXREADY_RETRY EQU 10 ;Wait 10 seconds for ready
- XX
- XX;
- XX; Command Retry Count
- XX;
- XXMAX_RETRY EQU 3 ;Retry 3 times
- XX
- XX;
- XX; Sense sub types
- XX;
- XXSENSE_CCS EQU 070h ;Extended Sense Available
- XX
- XX;
- XX; Format sub types
- XX;
- XXFORMAT_NORMAL EQU 000h ;Format with known defect list
- XXFORMAT_ADDING EQU 010h ;Format with additional bad blocks
- XXFORMAT_ORIG EQU 018h ;Format with original bad block list
- XX
- XX;
- XX; Load sub types
- XX;
- XXLOAD_TAPE EQU 001h ;Load
- XXUNLOAD_TAPE EQU 000h ;Unload
- XX
- XX;
- XX; We write one filemark at the end of a tape
- XX; so that we can space forward over stuff.
- XX;
- XXCLOSE_FM_CNT EQU 001h
- SHAR_EOF
- if test 4746 -ne "`wc -c < 'equ.inc'`"
- then
- echo shar: error transmitting "'equ.inc'" '(should have been 4746 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'options.inc'" '(1384 characters)'
- if test -f 'options.inc'
- then
- echo shar: will not over-write existing file "'options.inc'"
- else
- sed 's/^XX//' > 'options.inc' << \SHAR_EOF
- XX;
- XX; Partition drives into single large partitions
- XX;
- XX; This is allowed if you are using DOS 4.0 or greater.
- XX; Instead of breaking the drive up into 32Meg chunks,
- XX; the entire drive will be allocated as one chunk.
- XX;
- XXlarge_drives = 1
- XX
- XX;
- XX; Allow multi_sector reads and writes.
- XX;
- XX; This means that a read request of less then CHUNK_MAX
- XX; sectors will be done in one request to the drive rather
- XX; then multiple single sector requests.
- XX;
- XXmulti_sector = 1
- XX
- XX;
- XX; Use the extended SCSI commands for reads and writes.
- XX;
- XX; This means that we can access drives larger then 1Gb
- XX; and read/write more then 256 sectors per command.
- XX;
- XX; The disadvantage here is that not all devices support
- XX; the extended command set.
- XX;
- XXextended_io = 0
- XX
- XX;
- XX; Use parity on the SCSI bus
- XX;
- XXscsi_parity = 0
- XX
- XX;
- XX; Reserve SCSI Address 7 for card
- XX; This also means use Arbitration for getting control of the BUS
- XX;
- XXreserve_addr = 0
- XX
- XX;
- XX; Dump Sense information to the screen
- XX;
- XXdump_sense = 1
- XX
- XX;
- XX; Include the code to kludge the RAW ioctl call after an open
- XX;
- XXuse_kludge = 1
- XX
- XX;
- XX; Only Inquire for enough data to determine device type.
- XX; This allows for older devices that violate the SCSI
- XX; spec in that they don't return the normal inquire structure.
- XX;
- XXmini_inquire = 0
- XX
- XX;
- XX; Include code to display the SCSI bus phase on the screen
- XX;
- XXmonitor = 0
- XX
- XX;
- XX; Now select wether we want 8088 compatability or 80286+ code
- XX;
- XXoldcode = 0
- SHAR_EOF
- if test 1384 -ne "`wc -c < 'options.inc'`"
- then
- echo shar: error transmitting "'options.inc'" '(should have been 1384 characters)'
- fi
- fi # end of overwriting check
- echo shar: extracting "'struct.inc'" '(7831 characters)'
- if test -f 'struct.inc'
- then
- echo shar: will not over-write existing file "'struct.inc'"
- else
- sed 's/^XX//' > 'struct.inc' << \SHAR_EOF
- XX;
- XX; Structures for SCSI commands
- XX;
- XXio_cmd struc
- XXio_cmd_op db ? ;Opcode
- XX if extended_io
- XXio_cmd_lun db ?
- XXio_cmd_lba_b3 db ? ;Logical Block Address
- XXio_cmd_lba_b2 db ?
- XXio_cmd_lba_b1 db ?
- XXio_cmd_lba_b0 db ?
- XXio_cmd_dummy1 db ?
- XXio_cmd_cnt_b1 db ? ;Block Count
- XXio_cmd_cnt_b0 db ?
- XXio_cmd_dummy2 db ?
- XX else
- XXio_cmd_lba_b2 db ? ;Logical Block Address / Lun
- XXio_cmd_lba_b1 db ?
- XXio_cmd_lba_b0 db ?
- XXio_cmd_cnt_b0 db ? ;Block Count
- XXio_cmd_dummy1 db ?
- XX endif
- XXio_cmd ends
- XX
- XXtio_cmd struc
- XXtio_cmd_op db ? ;Opcode
- XXtio_cmd_lun db ? ;Lun
- XXtio_cmd_cnt_b2 db ? ;Block Count
- XXtio_cmd_cnt_b1 db ?
- XXtio_cmd_cnt_b0 db ?
- XXtio_cmd_dummy1 db ?
- XXtio_cmd ends
- XX
- XX;
- XX; Format the Unit
- XX;
- XXfmt_cmd struc
- XXfmt_cmd_op db ? ;Opcode
- XXfmt_cmd_type db ? ;Format Type
- XXfmt_cmd_dummy1 db ?
- XXfmt_cmd_il_b1 db ? ;Interleave (MSB)
- XXfmt_cmd_il_b0 db ? ;Interleave (LSB)
- XXfmt_cmd_dummy3 db ?
- XXfmt_cmd ends
- XX
- XX;
- XX; Verify Sectors
- XX;
- XXver_cmd struc
- XXver_cmd_op db ? ;Opcode
- XXver_cmd_lun db ? ;Lun
- XXver_cmd_lba_b3 db ? ;Logical Block Address MSB
- XXver_cmd_lba_b2 db ?
- XXver_cmd_lba_b1 db ?
- XXver_cmd_lba_b0 db ? ;Logical Block Address LSB
- XXver_cmd_dummy1 db ?
- XXver_cmd_len_b1 db ? ;Length MSB
- XXver_cmd_len_b0 db ? ;Length LSB
- XXver_cmd_dummy2 db ?
- XXver_cmd ends
- XX
- XX;
- XX; Load / Unload a Tape
- XX;
- XXload_cmd struc
- XXload_cmd_op db ? ;Opcode
- XXload_cmd_lun db ? ;Lun
- XXload_cmd_dummy1 db 2 dup (?)
- XXload_cmd_type db ? ;Load / Unload
- XXload_cmd_dummy2 db ?
- XXload_cmd ends
- XX
- XX;
- XX; Write Filemarks on a Tape
- XX;
- XXfm_cmd struc
- XXfm_cmd_op db ? ;Opcode
- XXfm_cmd_lun db ? ;Lun
- XXfm_cmd_cnt_b2 db ? ;Filemark MSB
- XXfm_cmd_cnt_b1 db ?
- XXfm_cmd_cnt_b0 db ? ;Filemark LSB
- XXfm_cmd_dummy db ?
- XXfm_cmd ends
- XX
- XX;
- XX; Space a Tape
- XX;
- XXspace_cmd struc
- XXspace_cmd_op db ? ;Opcode
- XXspace_cmd_code db ?
- XXspace_cmd_cnt2 db ? ;Count
- XXspace_cmd_cnt1 db ?
- XXspace_cmd_cnt0 db ?
- XXspace_cmd_dummy db ?
- XXspace_cmd ends
- XX
- XX;
- XX; Reassign a Block
- XX;
- XXremap_cmd struc
- XXremap_cmd_op db ? ;Opcode
- XXremap_cmd_lun db ? ;Lun
- XXremap_cmd_dum1 db ? ;Reserved
- XXremap_cmd_dum2 db ?
- XXremap_cmd_dum3 db ?
- XXremap_cmd_dum4 db ?
- XXremap_cmd ends
- XX
- XX;
- XX; Structure(s) returned by the sense command(s)
- XX;
- XXsense struc
- XXsense_sense db ? ;Sense (Error) code
- XXsense_lba_b2 db ? ;Failed Block Address
- XXsense_lba_b1 db ?
- XXsense_lba_b0 db ?
- XXsense ends
- XX
- XXe_sense struc
- XXe_sense_ccs db ? ;0x70 for Extended Sense
- XXe_sense_dummy1 db ?
- XXe_sense_sense db ? ;Sense (Error) Group
- XXe_sense_lba_b3 db ? ;Failed Block Address
- XXe_sense_lba_b2 db ?
- XXe_sense_lba_b1 db ?
- XXe_sense_lba_b0 db ?
- XXe_sense ends
- XX
- XX;
- XX; Structure returned by the unit inquiry command
- XX;
- XXinq struc
- XXinq_dev_type db ? ;Device Type
- XXinq_dev_qual db ? ;Device Qualifier
- XX ife mini_inquire
- XXinq_stand_rev db ? ;Standard Revision Level
- XXinq_format db ? ;Response Format
- XXinq_length db ? ;Length of Extra Data
- XXinq_reserv1 db ?
- XXinq_reserv2 db ?
- XXinq_reserv3 db ?
- XXinq_manufact db 8 dup (?) ;Manufacture
- XXinq_product db 16 dup (?) ;Product
- XX endif
- XXinq ends
- XX
- XX;
- XX; Structure returned by the read drive capacity command
- XX;
- XXcap struc
- XXcap_sectors_b3 db ? ;MSB of sector count
- XXcap_sectors_b2 db ?
- XXcap_sectors_b1 db ?
- XXcap_sectors_b0 db ? ;LSB of sector count
- XXcap_size_b3 db ? ;MSB of sector size
- XXcap_size_b2 db ?
- XXcap_size_b1 db ?
- XXcap_size_b0 db ? ;LSB of sector size
- XXcap ends
- XX
- XX;
- XX; Structure Definitions For Our Device Driver
- XX;
- XXbpb struc
- XXbpb_ss dw ? ;Sector Size
- XXbpb_au db ? ;Cluster Size in Sectors
- XXbpb_rs dw ? ;Reserved Sectors
- XXbpb_nf db ? ;Number of Fats
- XXbpb_de dw ? ;Number of Root Directory Entries
- XXbpb_ts dw ? ;Total Number Of Sectors
- XXbpb_md db ? ;Media Descriptor
- XXbpb_fs dw ? ;Number of Sectors in each Fat
- XXbpb_st dw ? ;Number of Sectors per Track
- XXbpb_nh dw ? ;Number of Heads
- XXbpb_hs_lsw dw ? ;Hidden Sectors (Least Sig Word)
- XXbpb_hs_msw dw ? ;Hidden Sectors (Most Sig Word)
- XXbpb_ts_lsw dw ? ;Large Total Sector Count
- XXbpb_ts_msw dw ?
- XXbpb_res db 6 dup (?) ;Reserved
- XXbpb ends
- XX
- XX;
- XX; ioctl function 42h/62h
- XX;
- XXioctl_fmt struc
- XXioctl_fmt_spec db ? ;Special Flags
- XXioctl_fmt_head dw ? ;Head to Format
- XXioctl_fmt_cyl dw ? ;Cylinder to Format
- XXioctl_fmt_len dw ? ;How Many Tracks
- XXioctl_fmt ends
- XX
- XX;
- XX; ioctl function 61h
- XX;
- XXioctl_read struc
- XXioctl_read_spec db ? ;Special Flags
- XXioctl_read_head dw ? ;Head to Read
- XXioctl_read_cyl dw ? ;Cylinder to Read
- XXioctl_read_sect dw ? ;Sector to Read
- XXioctl_read_len dw ? ;How Many Sectors
- XXioctl_read_ofs dw ? ;Buffer Offset
- XXioctl_read_seg dw ? ;Buffer Segment
- XXioctl_read ends
- XX
- XX;
- XX; ioctl function 60h/61h return
- XX;
- XXdpb struc
- XXdpb_special db ? ;Special Flags
- XXdpb_type db ? ;Device Type
- XXdpb_attr dw ? ;Device Attributes
- XXdpb_cyl dw ? ;Device Cylinder Count
- XXdpb_media db ? ;Device Media Type if Diskette
- XXdpb_bpb db size bpb dup (?)
- XXdpb_sectors dw ? ;Sectors in Track
- XXdpb_track dd SECT_TRACK dup (?)
- XXdpb ends
- XX
- XX;
- XX; The internal control structure for a SCSI device
- XX;
- XXunit struc
- XXunit_1st_drv db ? ;DOS Drive Numbers
- XXunit_num_drv db ? ;DOS Drive Count
- XXunit_select db ? ;SCSI Select Bit
- XXunit_mcheck db ? ;Media Check Byte
- XXunit_inq_buf db size inq dup (?)
- XXunit_inq_term db ?
- XXunit_cap_buf db size cap dup (?)
- XXunit_sense db size sense dup (?)
- XXunit_e_sense db size e_sense dup (?)
- XXunit ends
- XX
- XX;
- XX; Ioctl Commands
- XX;
- XXioc struc
- XXioc_command dw ? ;Command
- XXioc_param1 dw ? ;Command Dependent Data
- XXioc_param2 dw ? ;Command Dependent Data
- XXioc_buf_seg dw ? ;Buffer Segment
- XXioc_buf_ofs dw ? ;Buffer Offset
- XXioc_buf_len dw ? ;Buffer Length
- XXioc ends
- XX
- XX;
- XX; DOS requests
- XX;
- XXrh struc
- XXrh_len db ? ;Length of Packet
- XXrh_unit db ? ;Unit Code (Block Only)
- XXrh_cmd db ? ;Command Code
- XXrh_status dw ? ;Returned Status
- XXrh_res db 8 dup (?) ;Reserved
- XXrh ends
- XX
- XXrh0 struc ;INITIALIZATION
- XXrh0_rh db size rh dup (?) ;Fixed Portion
- XXrh0_nunits db ? ;Number of units (Block Only)
- XXrh0_brk_ofs dw ? ;Break Address (Offset)
- XXrh0_brk_seg dw ? ;Break Address (Segment)
- XXrh0_bpb_tbo dw ? ;Pointer to BPB Array (Offset)
- XXrh0_bpb_tbs dw ? ;Pointer to BPB Array (Segment)
- XXrh0_drv_ltr db ? ;First Available Drive (DOS 3+, Block Only)
- XXrh0 ends
- XX
- XXrh1 struc ;MEDIA CHECK
- XXrh1_rh db size rh dup (?) ;Fixed Portion
- XXrh1_media db ? ;Media Descriptor from DPB
- XXrh1_md_stat db ? ;Media Status returned by Device Driver
- XXrh1_volid_ofs dw ? ;Offset of Volume ID String (DOS 3+)
- XXrh1_volid_seg dw ? ;Segment of Volume ID String (DOS 3+)
- XXrh1 ends
- XX
- XXrh2 struc ;GET BPB
- XXrh2_rh db size rh dup (?) ;Fixed Portion
- XXrh2_media db ? ;Media Descriptor from DPB
- XXrh2_buf_ofs dw ? ;Offset of Data Transfer Area
- XXrh2_buf_seg dw ? ;Segment of Data Transfer Area
- XXrh2_pbpbo dw ? ;Offset of Pointer to BPB
- XXrh2_pbpbs dw ? ;Segment of Pointer to BPB
- XXrh2 ends
- XX
- XXrh4 struc ;INPUT
- XXrh4_rh db size rh dup (?) ;Fixed Portion
- XXrh4_media db ? ;Media Descriptor from DPB
- XXrh4_buf_ofs dw ? ;Offset of Data Transfer Area
- XXrh4_buf_seg dw ? ;Segment of Data Transfer Area
- XXrh4_count dw ? ;Transfer Count (Sectors)
- XXrh4_sector dw ? ;Start Sector Number
- XX dd ?
- XXrh4_lsect_lsw dw ? ;Start Sector LSW (32 bit)
- XXrh4_lsect_msw dw ? ;Start Sector MSW (32 bit)
- XXrh4 ends
- XX
- XXrh8 struc ;OUTPUT
- XXrh8_rh db size rh dup (?) ;Fixed Portion
- XXrh8_media db ? ;Media Descriptor from DPB
- XXrh8_buf_ofs dw ? ;Offset of Data Transfer Area
- XXrh8_buf_seg dw ? ;Segment of Data Transfer Area
- XXrh8_count dw ? ;Transfer Count (Sectors)
- XXrh8_sector dw ? ;Start Sector Number
- XX dd ?
- XXrh8_lsect_lsw dw ? ;Start Sector LSW (32 bit)
- XXrh8_lsect_msw dw ? ;Start Sector MSW (32 bit)
- XXrh8 ends
- XX
- XXrh12 struc ;OUTPUT IOCTL
- XXrh12_rh db size rh dup (?) ;Fixed Portion
- XXrh12_media db ? ;Media Descriptor from DPB
- XXrh12_buf_ofs dw ? ;Offset of Data Transfer Area
- XXrh12_buf_seg dw ? ;Segment of Data Transfer Area
- XXrh12_count dw ? ;Transfer Count (Sectors)
- XXrh12_sector dw ? ;Start Sector Number
- XXrh12 ends
- XX
- XXrh19 struc ;IOCTL
- XXrh19_rh db size rh dup (?) ;Fixed Portion
- XXrh19_major db ? ;Major Code
- XXrh19_minor db ? ;Minor Code
- XXrh19_si dw ? ;Caller SI Register
- XXrh19_di dw ? ;Caller DI Register
- XXrh19_buf_ofs dw ? ;Caller Buffer Offset
- XXrh19_buf_seg dw ? ;Caller Buffer Segment
- XXrh19 ends
- SHAR_EOF
- if test 7831 -ne "`wc -c < 'struct.inc'`"
- then
- echo shar: error transmitting "'struct.inc'" '(should have been 7831 characters)'
- fi
- fi # end of overwriting check
- #
- # End of shell archive
- #
- exit 0
- --
- Brian Antoine |
- ISC-Bunker Ramo | ...uunet!isc-br!tau-ceti!briana
- Spokane, WA | briana@tau-ceti.isc-br.com
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-