Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ scsi(K) — System V/386 Software Development System 3.2.2b

Media Vault

Software Library

Restoration Projects

Artifacts Sought



     SCSI(K)                   UNIX System V                   SCSI(K)



     Name
          scsi: scsi_get_gen_cmd, scsi_getdev, scsi_mkadr3,
          scsi_s2tos, scsi_s3tol, scsi_stok, scsi_stol, scsi_swap4 -
          SCSI routines

     Syntax
          #include "sys/scsi.h"

          int
          scsi_get_gen_cmd(request_ptr, command, arrayp, nelements)
          REQ_IO request_ptr;
          int command, nelements;
          paddr_t *arrayp;

          DEVCFG
          scsi_getdev(unit, config-tbl, dev_open, name)
          int unit;
          DEVCFG *config-tbl;
          int (*dev_open)();
          char *name;

          int
          scsi_mkadr3(str, adr)
          char str[];
          char adr[];

          short
          scsi_s2tos(adr)
          char *adr;

          long
          scsi_s3tol(adr)
          char  adr[];

          caddr_t
          scsi_stok(adr)
          char  adr[];
          long
          scsi_stol(adr)
          char adr[];

          int
          scsi_swap4(adr)
          char *adr;

     Description
          These routines are used when converting between different
          SCSI addressing schemes, and for miscellaneous tasks.
          scsi_get_gen_cmd is used to fill a command block;
          scsi_getdev gets a SCSI device number.  Refer to Chapter 7,
          "Writing a SCSI Driver" for conceptual information on the
          use of the scsi(K) routines.  The conversion routines are:

          ______________________________________________________________
         | Routine                    |     Source    |   Destination  |
         |____________________________|_______________|________________|
         | scsi_mkadr3(str, adr)      |       adr     |       str      |
         |                            | __|___|___|___|____|___|___|___|
         | Makes 3-byte address       |   |  2|  1|  0|    |  2|  1|  0|
         |                            | __|___|___|___|____|___|___|___|
         |                            |   |  a|  b|  c|    |  c|  b|  a|
         |____________________________|_______________|________________|
         | short = scsi_s2tos(adr)    |       adr     |      short     |
         |                            | __|___|___|___|____|___|___|___|
         | Converts 2 bytes to a short|   |   |  1|  0|    |   |  1|  0|
         |                            | __|___|___|___|____|___|___|___|
         |                            |   |   |  a|  b|    |   |  b|  a|
         |____________________________|_______________|________________|
         | long = scsi_s3tol(adr)     |       adr     |       long     |
         |                            | __|___|___|___|____|___|___|___|
         | Converts 3 bytes to a long |   |  2|  1|  0|   3|  2|  1|  0|
         |                            | __|___|___|___|____|___|___|___|
         |                            |   |  a|  b|  c|  0 |  c|  b|  a|
         |____________________________|_______________|________________|
         | kernel = scsi_stok(adr)    |       adr     |      kernel    |
         |                            | __|___|___|___|____|___|___|___|
         | Converts 3 bytes to a      |   |  2|  1|  0|  3 |  2|  1|  0|
         |                            | __|___|___|___|____|___|___|___|
         | kernel address             |   |  a|  b|  c|  0 |  c|  b|  a|
         |____________________________|_______________|________________|
         | long = scsi_stol(adr)      |       adr     |       long     |
         |                            | __|___|___|___|____|___|___|___|
         | Converts 4 bytes to a long |  3|  2|  1|  0|  3 |  2|  1|  0|
         |                            | __|___|___|___|____|___|___|___|
         |                            |  a|  b|  c|  d|  d |  c|  b|  a|
         |____________________________|_______________|________________|
         | scsi_swap4(adr)            |       adr     |       adr      |
         |                            | __|___|___|___|____|___|___|___|
         | Swaps 4 bytes              |  3|  2|  1|  0|  3 |  2|  1|  0|
         |                            | __|___|___|___|____|___|___|___|
         |                            |  a|  b|  c|  d|  d |  c|  b|  a|
         |____________________________|___|___|___|___|____|___|___|___|


     Parameters
               scsi_get_gen_cmd    request_ptr is a pointer to an
                                   instance of the scsi_io_req
                                   structure (SCSI I/O request block).
                                   command is: TEST_CMD, SENSE_CMD, or
                                   INQUIRY_CMD which are defined in
                                   scsi.h.  arrayp is a pointer to an
                                   array containing the arguments to
                                   command.  nelements indicates the
                                   number of elements in the array
                                   pointed to by arrayp.

               scsi_getdev         unit is a logical unit number, such
                                   as a device number.  config-tbl is
                                   a pointer to an configuration table
                                   (an array) in which device
                                   information is stored that is used
                                   to build a block or character
                                   device switch table entry.  The
                                   configuration table is an instance
                                   of the scsi_dev_cfg structure
                                   defined in scsi.h and must be NULL
                                   terminated.  The index field of
                                   this structure is filled in by the
                                   operating system and contains the
                                   major number of the device.  The
                                   dev_open argument to scsi_getdev is
                                   the address of the xxopen routine
                                   for your driver.  name is the
                                   address of an array containing the
                                   name of the disk.  For example, for
                                   the SCSI disk driver supplied with
                                   your system, "Sdsk" is used.

               scsi_mkadr3         str is a pointer to a three-byte
                                   array; adr points to a three-byte
                                   array for the address to be
                                   created.  The most significant byte
                                   of adr is not used.

               scsi_s2tos          adr in a pointer to a two-byte
                                   array.

               scsi_s3tol          adr in a pointer to a three-byte
                                   array.

               scsi_stok           adr in a pointer to a three-byte
                                   array.

               scsi_stol           adr in a pointer to a four-byte
                                   array.

               scsi_swap4          adr in a pointer to a four-byte
                                   array.

     Return Value
          scsi_get_gen_cmd has no return value under normal
          conditions, but -1 can be returned if command is not one of
          the three permissible values.

          scsi_getdev returns a pointer to the configuration table
          entry for the device or NULL if the device cannot be found
          in the configuration table.  In addition to returning NULL,
          the following message is displayed on the console and stored
          in the putbuf array in memory:

          WARNING: No configuration information for device name

          Where device is the major device number and name is the
          argument to the routine.

          scsi_s2tos returns a short integer.  scsi_s3tol returns a
          long integer.  scsi_stok returns a kernel address.
          scsi_stol returns a long integer.

                                                      (printed 7/6/89)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026