Deleted Added
full compact
scsi_sa.c (295114) scsi_sa.c (298431)
1/*-
2 * Implementation of SCSI Sequential Access Peripheral driver for CAM.
3 *
4 * Copyright (c) 1999, 2000 Matthew Jacob
5 * Copyright (c) 2013, 2014, 2015 Spectra Logic Corporation
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 SCSI Sequential Access Peripheral driver for CAM.
3 *
4 * Copyright (c) 1999, 2000 Matthew Jacob
5 * Copyright (c) 2013, 2014, 2015 Spectra Logic Corporation
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: head/sys/cam/scsi/scsi_sa.c 295114 2016-02-01 02:33:58Z araujo $");
31__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_sa.c 298431 2016-04-21 19:40:10Z pfg $");
32
33#include <sys/param.h>
34#include <sys/queue.h>
35#ifdef _KERNEL
36#include <sys/systm.h>
37#include <sys/kernel.h>
38#endif
39#include <sys/types.h>

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

304 { "lbp_r", MT_PARAM_SET_UNSIGNED,
305 __offsetof(struct sa_prot_state, lbp_r),
306 /*min_val*/ 0, /*max_val*/ 1, NULL },
307 { "rbdp", MT_PARAM_SET_UNSIGNED,
308 __offsetof(struct sa_prot_state, rbdp),
309 /*min_val*/ 0, /*max_val*/ 1, NULL }
310};
311
32
33#include <sys/param.h>
34#include <sys/queue.h>
35#ifdef _KERNEL
36#include <sys/systm.h>
37#include <sys/kernel.h>
38#endif
39#include <sys/types.h>

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

304 { "lbp_r", MT_PARAM_SET_UNSIGNED,
305 __offsetof(struct sa_prot_state, lbp_r),
306 /*min_val*/ 0, /*max_val*/ 1, NULL },
307 { "rbdp", MT_PARAM_SET_UNSIGNED,
308 __offsetof(struct sa_prot_state, rbdp),
309 /*min_val*/ 0, /*max_val*/ 1, NULL }
310};
311
312#define SA_NUM_PROT_ENTS sizeof(sa_prot_table)/sizeof(sa_prot_table[0])
312#define SA_NUM_PROT_ENTS nitems(sa_prot_table)
313
314#define SA_PROT_ENABLED(softc) ((softc->flags & SA_FLAG_PROTECT_SUPP) \
315 && (softc->prot_info.cur_prot_state.initialized != 0) \
316 && (softc->prot_info.cur_prot_state.prot_method != 0))
317
318#define SA_PROT_LEN(softc) softc->prot_info.cur_prot_state.pi_length
319
320struct sa_softc {

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

1308 {"protection.", SA_PARAM_TYPE_NODE, sasetprotents }
1309};
1310
1311static struct sa_param_ent *
1312safindparament(struct mtparamset *ps)
1313{
1314 unsigned int i;
1315
313
314#define SA_PROT_ENABLED(softc) ((softc->flags & SA_FLAG_PROTECT_SUPP) \
315 && (softc->prot_info.cur_prot_state.initialized != 0) \
316 && (softc->prot_info.cur_prot_state.prot_method != 0))
317
318#define SA_PROT_LEN(softc) softc->prot_info.cur_prot_state.pi_length
319
320struct sa_softc {

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

1308 {"protection.", SA_PARAM_TYPE_NODE, sasetprotents }
1309};
1310
1311static struct sa_param_ent *
1312safindparament(struct mtparamset *ps)
1313{
1314 unsigned int i;
1315
1316 for (i = 0; i < sizeof(sa_param_table) /sizeof(sa_param_table[0]); i++){
1316 for (i = 0; i < nitems(sa_param_table); i++){
1317 /*
1318 * For entries, we compare all of the characters. For
1319 * nodes, we only compare the first N characters. The node
1320 * handler will decode the rest.
1321 */
1322 if (sa_param_table[i].param_type == SA_PARAM_TYPE_ENTRY) {
1323 if (strcmp(ps->value_name, sa_param_table[i].name) != 0)
1324 continue;

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

2370 softc->periph = periph;
2371 periph->softc = softc;
2372
2373 /*
2374 * See if this device has any quirks.
2375 */
2376 match = cam_quirkmatch((caddr_t)&cgd->inq_data,
2377 (caddr_t)sa_quirk_table,
1317 /*
1318 * For entries, we compare all of the characters. For
1319 * nodes, we only compare the first N characters. The node
1320 * handler will decode the rest.
1321 */
1322 if (sa_param_table[i].param_type == SA_PARAM_TYPE_ENTRY) {
1323 if (strcmp(ps->value_name, sa_param_table[i].name) != 0)
1324 continue;

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

2370 softc->periph = periph;
2371 periph->softc = softc;
2372
2373 /*
2374 * See if this device has any quirks.
2375 */
2376 match = cam_quirkmatch((caddr_t)&cgd->inq_data,
2377 (caddr_t)sa_quirk_table,
2378 sizeof(sa_quirk_table)/sizeof(*sa_quirk_table),
2378 nitems(sa_quirk_table),
2379 sizeof(*sa_quirk_table), scsi_inquiry_match);
2380
2381 if (match != NULL) {
2382 softc->quirks = ((struct sa_quirk_entry *)match)->quirks;
2383 softc->last_media_blksize =
2384 ((struct sa_quirk_entry *)match)->prefblk;
2385 } else
2386 softc->quirks = SA_QUIRK_NONE;

--- 3495 unchanged lines hidden ---
2379 sizeof(*sa_quirk_table), scsi_inquiry_match);
2380
2381 if (match != NULL) {
2382 softc->quirks = ((struct sa_quirk_entry *)match)->quirks;
2383 softc->last_media_blksize =
2384 ((struct sa_quirk_entry *)match)->prefblk;
2385 } else
2386 softc->quirks = SA_QUIRK_NONE;

--- 3495 unchanged lines hidden ---