|
|
1.1 ! root 1: /* ! 2: * Mach Operating System ! 3: * Copyright (c) 1991,1990 Carnegie Mellon University ! 4: * All Rights Reserved. ! 5: * ! 6: * Permission to use, copy, modify and distribute this software and its ! 7: * documentation is hereby granted, provided that both the copyright ! 8: * notice and this permission notice appear in all copies of the ! 9: * software, derivative works or modified versions, and any portions ! 10: * thereof, and that both notices appear in supporting documentation. ! 11: * ! 12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" ! 13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ! 14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ! 15: * ! 16: * Carnegie Mellon requests users of this software to return to ! 17: * ! 18: * Software Distribution Coordinator or [email protected] ! 19: * School of Computer Science ! 20: * Carnegie Mellon University ! 21: * Pittsburgh PA 15213-3890 ! 22: * ! 23: * any improvements or extensions that they make and grant Carnegie Mellon ! 24: * the rights to redistribute these changes. ! 25: */ ! 26: /* ! 27: * File: scsi_comm.c ! 28: * Author: Alessandro Forin, Carnegie Mellon University ! 29: * Date: 10/90 ! 30: * ! 31: * Middle layer of the SCSI driver: SCSI protocol implementation ! 32: * ! 33: * This file contains code for SCSI commands for COMMUNICATION devices. ! 34: */ ! 35: ! 36: #include <mach/std_types.h> ! 37: #include <scsi/compat_30.h> ! 38: ! 39: #include <scsi/scsi.h> ! 40: #include <scsi/scsi_defs.h> ! 41: ! 42: #if (NSCSI > 0) ! 43: ! 44: char *sccomm_name( ! 45: boolean_t internal) ! 46: { ! 47: return internal ? "cz" : "comm"; ! 48: } ! 49: ! 50: void scsi_get_message( ! 51: register target_info_t *tgt, ! 52: io_req_t ior) ! 53: { ! 54: scsi_cmd_read_t *cmd; ! 55: register unsigned len, max; ! 56: ! 57: max = scsi_softc[(unsigned char)tgt->masterno]->max_dma_data; ! 58: ! 59: len = ior->io_count; ! 60: if (len > max) { ! 61: ior->io_residual = len - max; ! 62: len = max; ! 63: } ! 64: ! 65: cmd = (scsi_cmd_read_t*) (tgt->cmd_ptr); ! 66: cmd->scsi_cmd_code = SCSI_CMD_GET_MESSAGE; ! 67: cmd->scsi_cmd_lun_and_lba1 = tgt->lun << SCSI_LUN_SHIFT; ! 68: cmd->scsi_cmd_lba2 = len >> 16; ! 69: cmd->scsi_cmd_lba3 = len >> 8; ! 70: cmd->scsi_cmd_xfer_len = len; ! 71: cmd->scsi_cmd_ctrl_byte = 0; /* not linked */ ! 72: ! 73: tgt->cur_cmd = SCSI_CMD_GET_MESSAGE; ! 74: ! 75: scsi_go(tgt, sizeof(*cmd), len, FALSE); ! 76: } ! 77: ! 78: void scsi_send_message( ! 79: register target_info_t *tgt, ! 80: io_req_t ior) ! 81: { ! 82: scsi_cmd_write_t *cmd; ! 83: register unsigned len, max; ! 84: ! 85: len = ior->io_count; ! 86: max = scsi_softc[(unsigned char)tgt->masterno]->max_dma_data; ! 87: ! 88: if (len > max) { ! 89: ior->io_residual = len - max; ! 90: len = max; ! 91: } ! 92: ! 93: cmd = (scsi_cmd_write_t*) (tgt->cmd_ptr); ! 94: cmd->scsi_cmd_code = SCSI_CMD_SEND_MESSAGE; ! 95: cmd->scsi_cmd_lun_and_lba1 = tgt->lun << SCSI_LUN_SHIFT; ! 96: cmd->scsi_cmd_lba2 = len >> 16; ! 97: cmd->scsi_cmd_lba3 = len >> 8; ! 98: cmd->scsi_cmd_xfer_len = len; ! 99: cmd->scsi_cmd_ctrl_byte = 0; /* not linked */ ! 100: ! 101: tgt->cur_cmd = SCSI_CMD_SEND_MESSAGE; ! 102: ! 103: scsi_go(tgt, sizeof(*cmd), 0, FALSE); ! 104: } ! 105: ! 106: ! 107: #if 0 ! 108: /* For now, these are not needed */ ! 109: scsi_get_message_long ! 110: scsi_get_message_vlong ! 111: scsi_send_message_long ! 112: scsi_send_message_vlong ! 113: #endif ! 114: ! 115: #endif /* NSCSI > 0 */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.