678 #if !defined(lint)
679 _NOTE(SCHEME_PROTECTS_DATA("unique per pkt",
680 scsi_pkt buf uio scsi_cdb uscsi_cmd))
681 _NOTE(SCHEME_PROTECTS_DATA("unique per pkt", scsi_extended_sense scsi_status))
682 _NOTE(SCHEME_PROTECTS_DATA("unique per pkt", recov_info))
683 _NOTE(SCHEME_PROTECTS_DATA("stable data", scsi_device))
684 _NOTE(DATA_READABLE_WITHOUT_LOCK(st_drivetype scsi_address))
685 #endif
686
687 /*
688 * autoconfiguration routines.
689 */
690
691 static struct modldrv modldrv = {
692 &mod_driverops, /* Type of module. This one is a driver */
693 "SCSI tape Driver", /* Name of the module. */
694 &st_ops /* driver ops */
695 };
696
697 static struct modlinkage modlinkage = {
698 MODREV_1, &modldrv, NULL
699 };
700
701 /*
702 * Notes on Post Reset Behavior in the tape driver:
703 *
704 * When the tape drive is opened, the driver attempts to make sure that
705 * the tape head is positioned exactly where it was left when it was last
706 * closed provided the medium is not changed. If the tape drive is
707 * opened in O_NDELAY mode, the repositioning (if necessary for any loss
708 * of position due to reset) will happen when the first tape operation or
709 * I/O occurs. The repositioning (if required) may not be possible under
710 * certain situations such as when the device firmware not able to report
711 * the medium change in the REQUEST SENSE data because of a reset or a
712 * misbehaving bus not allowing the reposition to happen. In such
713 * extraordinary situations, where the driver fails to position the head
714 * at its original position, it will fail the open the first time, to
715 * save the applications from overwriting the data. All further attempts
716 * to open the tape device will result in the driver attempting to load
717 * the tape at BOT (beginning of tape). Also a warning message to
718 * indicate that further attempts to open the tape device may result in
1947 : ST_RELEASE)) {
1948 (void) st_reserve_release(un, reserved, st_uscsi_cmd);
1949 }
1950
1951 un->un_unit_attention_flags |= 1;
1952
1953 scsi_log(ST_DEVINFO, st_label, CE_NOTE, "?<%s>\n", dp->name);
1954
1955 }
1956
1957
1958 typedef struct {
1959 int mask;
1960 int bottom;
1961 int top;
1962 char *name;
1963 } conf_limit;
1964
1965 static const conf_limit conf_limits[] = {
1966
1967 -1, 1, 2, "conf version",
1968 -1, MT_ISTS, ST_LAST_TYPE, "drive type",
1969 -1, 0, 0xffffff, "block size",
1970 ST_VALID_OPTS, 0, ST_VALID_OPTS, "options",
1971 -1, 0, 4, "number of densities",
1972 -1, 0, UINT8_MAX, "density code",
1973 -1, 0, 3, "default density",
1974 -1, 0, UINT16_MAX, "non motion timeout",
1975 -1, 0, UINT16_MAX, "I/O timeout",
1976 -1, 0, UINT16_MAX, "space timeout",
1977 -1, 0, UINT16_MAX, "load timeout",
1978 -1, 0, UINT16_MAX, "unload timeout",
1979 -1, 0, UINT16_MAX, "erase timeout",
1980 0, 0, 0, NULL
1981 };
1982
1983 static int
1984 st_validate_conf_data(struct scsi_tape *un, int *list, int list_len,
1985 const char *conf_name)
1986 {
1987 int dens;
1988 int ndens;
1989 int value;
1990 int type;
1991 int count;
1992 const conf_limit *limit = &conf_limits[0];
1993
1994 ST_FUNC(ST_DEVINFO, st_validate_conf_data);
1995
1996 ST_DEBUG3(ST_DEVINFO, st_label, CE_NOTE,
1997 "Checking %d entrys total with %d densities\n", list_len, list[4]);
1998
1999 count = list_len;
2000 type = *list;
|
678 #if !defined(lint)
679 _NOTE(SCHEME_PROTECTS_DATA("unique per pkt",
680 scsi_pkt buf uio scsi_cdb uscsi_cmd))
681 _NOTE(SCHEME_PROTECTS_DATA("unique per pkt", scsi_extended_sense scsi_status))
682 _NOTE(SCHEME_PROTECTS_DATA("unique per pkt", recov_info))
683 _NOTE(SCHEME_PROTECTS_DATA("stable data", scsi_device))
684 _NOTE(DATA_READABLE_WITHOUT_LOCK(st_drivetype scsi_address))
685 #endif
686
687 /*
688 * autoconfiguration routines.
689 */
690
691 static struct modldrv modldrv = {
692 &mod_driverops, /* Type of module. This one is a driver */
693 "SCSI tape Driver", /* Name of the module. */
694 &st_ops /* driver ops */
695 };
696
697 static struct modlinkage modlinkage = {
698 MODREV_1, { &modldrv, NULL }
699 };
700
701 /*
702 * Notes on Post Reset Behavior in the tape driver:
703 *
704 * When the tape drive is opened, the driver attempts to make sure that
705 * the tape head is positioned exactly where it was left when it was last
706 * closed provided the medium is not changed. If the tape drive is
707 * opened in O_NDELAY mode, the repositioning (if necessary for any loss
708 * of position due to reset) will happen when the first tape operation or
709 * I/O occurs. The repositioning (if required) may not be possible under
710 * certain situations such as when the device firmware not able to report
711 * the medium change in the REQUEST SENSE data because of a reset or a
712 * misbehaving bus not allowing the reposition to happen. In such
713 * extraordinary situations, where the driver fails to position the head
714 * at its original position, it will fail the open the first time, to
715 * save the applications from overwriting the data. All further attempts
716 * to open the tape device will result in the driver attempting to load
717 * the tape at BOT (beginning of tape). Also a warning message to
718 * indicate that further attempts to open the tape device may result in
1947 : ST_RELEASE)) {
1948 (void) st_reserve_release(un, reserved, st_uscsi_cmd);
1949 }
1950
1951 un->un_unit_attention_flags |= 1;
1952
1953 scsi_log(ST_DEVINFO, st_label, CE_NOTE, "?<%s>\n", dp->name);
1954
1955 }
1956
1957
1958 typedef struct {
1959 int mask;
1960 int bottom;
1961 int top;
1962 char *name;
1963 } conf_limit;
1964
1965 static const conf_limit conf_limits[] = {
1966
1967 { -1, 1, 2, "conf version" },
1968 { -1, MT_ISTS, ST_LAST_TYPE, "drive type" },
1969 { -1, 0, 0xffffff, "block size" },
1970 { ST_VALID_OPTS, 0, ST_VALID_OPTS, "options" },
1971 { -1, 0, 4, "number of densities" },
1972 { -1, 0, UINT8_MAX, "density code" },
1973 { -1, 0, 3, "default density" },
1974 { -1, 0, UINT16_MAX, "non motion timeout" },
1975 { -1, 0, UINT16_MAX, "I/O timeout" },
1976 { -1, 0, UINT16_MAX, "space timeout" },
1977 { -1, 0, UINT16_MAX, "load timeout" },
1978 { -1, 0, UINT16_MAX, "unload timeout" },
1979 { -1, 0, UINT16_MAX, "erase timeout" },
1980 { 0, 0, 0, NULL }
1981 };
1982
1983 static int
1984 st_validate_conf_data(struct scsi_tape *un, int *list, int list_len,
1985 const char *conf_name)
1986 {
1987 int dens;
1988 int ndens;
1989 int value;
1990 int type;
1991 int count;
1992 const conf_limit *limit = &conf_limits[0];
1993
1994 ST_FUNC(ST_DEVINFO, st_validate_conf_data);
1995
1996 ST_DEBUG3(ST_DEVINFO, st_label, CE_NOTE,
1997 "Checking %d entrys total with %d densities\n", list_len, list[4]);
1998
1999 count = list_len;
2000 type = *list;
|