Deleted Added
full compact
scsi_all.c (275722) scsi_all.c (280438)
1/*-
2 * Implementation of Utility functions for all SCSI device types.
3 *
4 * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs.
5 * Copyright (c) 1997, 1998, 2003 Kenneth D. Merry.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Implementation of Utility functions for all SCSI device types.
3 *
4 * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs.
5 * Copyright (c) 1997, 1998, 2003 Kenneth D. Merry.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: stable/10/sys/cam/scsi/scsi_all.c 275722 2014-12-12 07:41:08Z mav $");
31__FBSDID("$FreeBSD: stable/10/sys/cam/scsi/scsi_all.c 280438 2015-03-24 14:36:10Z ken $");
32
33#include <sys/param.h>
34#include <sys/types.h>
35#include <sys/stdint.h>
36
37#ifdef _KERNEL
38#include <opt_scsi.h>
39

--- 7398 unchanged lines hidden (view full) ---

7438 struct scsi_per_res_out *scsi_cmd;
7439
7440 scsi_cmd = (struct scsi_per_res_out *)&csio->cdb_io.cdb_bytes;
7441 bzero(scsi_cmd, sizeof(*scsi_cmd));
7442
7443 scsi_cmd->opcode = PERSISTENT_RES_OUT;
7444 scsi_cmd->action = service_action;
7445 scsi_cmd->scope_type = scope | res_type;
32
33#include <sys/param.h>
34#include <sys/types.h>
35#include <sys/stdint.h>
36
37#ifdef _KERNEL
38#include <opt_scsi.h>
39

--- 7398 unchanged lines hidden (view full) ---

7438 struct scsi_per_res_out *scsi_cmd;
7439
7440 scsi_cmd = (struct scsi_per_res_out *)&csio->cdb_io.cdb_bytes;
7441 bzero(scsi_cmd, sizeof(*scsi_cmd));
7442
7443 scsi_cmd->opcode = PERSISTENT_RES_OUT;
7444 scsi_cmd->action = service_action;
7445 scsi_cmd->scope_type = scope | res_type;
7446
7447 cam_fill_csio(csio,
7448 retries,
7449 cbfcnp,
7450 /*flags*/CAM_DIR_OUT,
7451 tag_action,
7452 /*data_ptr*/data_ptr,
7453 /*dxfer_len*/dxfer_len,
7454 sense_len,
7455 sizeof(*scsi_cmd),
7456 timeout);
7457}
7458
7459void
7460scsi_security_protocol_in(struct ccb_scsiio *csio, uint32_t retries,
7461 void (*cbfcnp)(struct cam_periph *, union ccb *),
7462 uint8_t tag_action, uint32_t security_protocol,
7463 uint32_t security_protocol_specific, int byte4,
7464 uint8_t *data_ptr, uint32_t dxfer_len, int sense_len,
7465 int timeout)
7466{
7467 struct scsi_security_protocol_in *scsi_cmd;
7468
7469 scsi_cmd = (struct scsi_security_protocol_in *)&csio->cdb_io.cdb_bytes;
7470 bzero(scsi_cmd, sizeof(*scsi_cmd));
7471
7472 scsi_cmd->opcode = SECURITY_PROTOCOL_IN;
7473
7474 scsi_cmd->security_protocol = security_protocol;
7475 scsi_ulto2b(security_protocol_specific,
7476 scsi_cmd->security_protocol_specific);
7477 scsi_cmd->byte4 = byte4;
7446 scsi_ulto4b(dxfer_len, scsi_cmd->length);
7447
7448 cam_fill_csio(csio,
7449 retries,
7450 cbfcnp,
7478 scsi_ulto4b(dxfer_len, scsi_cmd->length);
7479
7480 cam_fill_csio(csio,
7481 retries,
7482 cbfcnp,
7483 /*flags*/CAM_DIR_IN,
7484 tag_action,
7485 data_ptr,
7486 dxfer_len,
7487 sense_len,
7488 sizeof(*scsi_cmd),
7489 timeout);
7490}
7491
7492void
7493scsi_security_protocol_out(struct ccb_scsiio *csio, uint32_t retries,
7494 void (*cbfcnp)(struct cam_periph *, union ccb *),
7495 uint8_t tag_action, uint32_t security_protocol,
7496 uint32_t security_protocol_specific, int byte4,
7497 uint8_t *data_ptr, uint32_t dxfer_len, int sense_len,
7498 int timeout)
7499{
7500 struct scsi_security_protocol_out *scsi_cmd;
7501
7502 scsi_cmd = (struct scsi_security_protocol_out *)&csio->cdb_io.cdb_bytes;
7503 bzero(scsi_cmd, sizeof(*scsi_cmd));
7504
7505 scsi_cmd->opcode = SECURITY_PROTOCOL_OUT;
7506
7507 scsi_cmd->security_protocol = security_protocol;
7508 scsi_ulto2b(security_protocol_specific,
7509 scsi_cmd->security_protocol_specific);
7510 scsi_cmd->byte4 = byte4;
7511 scsi_ulto4b(dxfer_len, scsi_cmd->length);
7512
7513 cam_fill_csio(csio,
7514 retries,
7515 cbfcnp,
7451 /*flags*/CAM_DIR_OUT,
7452 tag_action,
7453 data_ptr,
7454 dxfer_len,
7455 sense_len,
7456 sizeof(*scsi_cmd),
7457 timeout);
7458}

--- 190 unchanged lines hidden ---
7516 /*flags*/CAM_DIR_OUT,
7517 tag_action,
7518 data_ptr,
7519 dxfer_len,
7520 sense_len,
7521 sizeof(*scsi_cmd),
7522 timeout);
7523}

--- 190 unchanged lines hidden ---