scsi_all.h (223081) | scsi_all.h (225950) |
---|---|
1/*- 2 * Largely written by Julian Elischer (julian@tfs.com) 3 * for TRW Financial Systems. 4 * 5 * TRW Financial Systems, in accordance with their agreement with Carnegie 6 * Mellon University, makes this software available to CMU to distribute 7 * or use in any manner that they see fit as long as this message is kept with 8 * the software. For this reason TFS also grants any other persons or 9 * organisations permission to use or modify this software. 10 * 11 * TFS supplies this software to be publicly redistributed 12 * on the understanding that TFS is not responsible for the correct 13 * functioning of this software in any circumstances. 14 * 15 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 16 * | 1/*- 2 * Largely written by Julian Elischer (julian@tfs.com) 3 * for TRW Financial Systems. 4 * 5 * TRW Financial Systems, in accordance with their agreement with Carnegie 6 * Mellon University, makes this software available to CMU to distribute 7 * or use in any manner that they see fit as long as this message is kept with 8 * the software. For this reason TFS also grants any other persons or 9 * organisations permission to use or modify this software. 10 * 11 * TFS supplies this software to be publicly redistributed 12 * on the understanding that TFS is not responsible for the correct 13 * functioning of this software in any circumstances. 14 * 15 * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 16 * |
17 * $FreeBSD: head/sys/cam/scsi/scsi_all.h 223081 2011-06-14 14:53:17Z gibbs $ | 17 * $FreeBSD: head/sys/cam/scsi/scsi_all.h 225950 2011-10-03 20:32:55Z ken $ |
18 */ 19 20/* 21 * SCSI general interface description 22 */ 23 24#ifndef _SCSI_SCSI_ALL_H 25#define _SCSI_SCSI_ALL_H 1 26 27#include <sys/cdefs.h> | 18 */ 19 20/* 21 * SCSI general interface description 22 */ 23 24#ifndef _SCSI_SCSI_ALL_H 25#define _SCSI_SCSI_ALL_H 1 26 27#include <sys/cdefs.h> |
28#include <machine/stdarg.h> |
|
28 29#ifdef _KERNEL 30/* 31 * This is the number of seconds we wait for devices to settle after a SCSI 32 * bus reset. 33 */ 34extern int scsi_delay; 35#endif /* _KERNEL */ --- 130 unchanged lines hidden (view full) --- 166 u_int8_t length; 167 u_int8_t control; 168}; 169 170struct scsi_inquiry 171{ 172 u_int8_t opcode; 173 u_int8_t byte2; | 29 30#ifdef _KERNEL 31/* 32 * This is the number of seconds we wait for devices to settle after a SCSI 33 * bus reset. 34 */ 35extern int scsi_delay; 36#endif /* _KERNEL */ --- 130 unchanged lines hidden (view full) --- 167 u_int8_t length; 168 u_int8_t control; 169}; 170 171struct scsi_inquiry 172{ 173 u_int8_t opcode; 174 u_int8_t byte2; |
174#define SI_EVPD 0x01 | 175#define SI_EVPD 0x01 176#define SI_CMDDT 0x02 |
175 u_int8_t page_code; 176 u_int8_t reserved; 177 u_int8_t length; 178 u_int8_t control; 179}; 180 181struct scsi_mode_sense_6 182{ --- 12 unchanged lines hidden (view full) --- 195#define SMS_PROTO_SPECIFIC_PAGE 0x19 196#define SMS_INFO_EXCEPTIONS_PAGE 0x1C 197#define SMS_ALL_PAGES_PAGE 0x3F 198#define SMS_PAGE_CTRL_MASK 0xC0 199#define SMS_PAGE_CTRL_CURRENT 0x00 200#define SMS_PAGE_CTRL_CHANGEABLE 0x40 201#define SMS_PAGE_CTRL_DEFAULT 0x80 202#define SMS_PAGE_CTRL_SAVED 0xC0 | 177 u_int8_t page_code; 178 u_int8_t reserved; 179 u_int8_t length; 180 u_int8_t control; 181}; 182 183struct scsi_mode_sense_6 184{ --- 12 unchanged lines hidden (view full) --- 197#define SMS_PROTO_SPECIFIC_PAGE 0x19 198#define SMS_INFO_EXCEPTIONS_PAGE 0x1C 199#define SMS_ALL_PAGES_PAGE 0x3F 200#define SMS_PAGE_CTRL_MASK 0xC0 201#define SMS_PAGE_CTRL_CURRENT 0x00 202#define SMS_PAGE_CTRL_CHANGEABLE 0x40 203#define SMS_PAGE_CTRL_DEFAULT 0x80 204#define SMS_PAGE_CTRL_SAVED 0xC0 |
203 u_int8_t unused; | 205 u_int8_t subpage; 206#define SMS_SUBPAGE_PAGE_0 0x00 207#define SMS_SUBPAGE_ALL 0xff |
204 u_int8_t length; 205 u_int8_t control; 206}; 207 208struct scsi_mode_sense_10 209{ 210 u_int8_t opcode; 211 u_int8_t byte2; /* same bits as small version */ | 208 u_int8_t length; 209 u_int8_t control; 210}; 211 212struct scsi_mode_sense_10 213{ 214 u_int8_t opcode; 215 u_int8_t byte2; /* same bits as small version */ |
216#define SMS10_LLBAA 0x10 |
|
212 u_int8_t page; /* same bits as small version */ | 217 u_int8_t page; /* same bits as small version */ |
213 u_int8_t unused[4]; | 218 u_int8_t subpage; 219 u_int8_t unused[3]; |
214 u_int8_t length[2]; 215 u_int8_t control; 216}; 217 218struct scsi_mode_select_6 219{ 220 u_int8_t opcode; 221 u_int8_t byte2; --- 36 unchanged lines hidden (view full) --- 258struct scsi_mode_block_descr 259{ 260 u_int8_t density_code; 261 u_int8_t num_blocks[3]; 262 u_int8_t reserved; 263 u_int8_t block_len[3]; 264}; 265 | 220 u_int8_t length[2]; 221 u_int8_t control; 222}; 223 224struct scsi_mode_select_6 225{ 226 u_int8_t opcode; 227 u_int8_t byte2; --- 36 unchanged lines hidden (view full) --- 264struct scsi_mode_block_descr 265{ 266 u_int8_t density_code; 267 u_int8_t num_blocks[3]; 268 u_int8_t reserved; 269 u_int8_t block_len[3]; 270}; 271 |
272struct scsi_per_res_in 273{ 274 u_int8_t opcode; 275 u_int8_t action; 276#define SPRI_RK 0x00 277#define SPRI_RR 0x01 278#define SPRI_RC 0x02 279#define SPRI_RS 0x03 280 u_int8_t reserved[5]; 281 u_int8_t length[2]; 282 u_int8_t control; 283}; 284 285struct scsi_per_res_in_header 286{ 287 u_int8_t generation[4]; 288 u_int8_t length[4]; 289}; 290 291struct scsi_per_res_key 292{ 293 u_int8_t key[8]; 294}; 295 296struct scsi_per_res_in_keys 297{ 298 struct scsi_per_res_in_header header; 299 struct scsi_per_res_key keys[0]; 300}; 301 302struct scsi_per_res_cap 303{ 304 uint8_t length[2]; 305 uint8_t flags1; 306#define SPRI_CRH 0x10 307#define SPRI_SIP_C 0x08 308#define SPRI_ATP_C 0x04 309#define SPRI_PTPL_C 0x01 310 uint8_t flags2; 311#define SPRI_TMV 0x80 312#define SPRI_PTPL_A 0x01 313 uint8_t type_mask[2]; 314#define SPRI_TM_WR_EX_AR 0x8000 315#define SPRI_TM_EX_AC_RO 0x4000 316#define SPRI_TM_WR_EX_RO 0x2000 317#define SPRI_TM_EX_AC 0x0800 318#define SPRI_TM_WR_EX 0x0200 319#define SPRI_TM_EX_AC_AR 0x0001 320 uint8_t reserved[2]; 321}; 322 323struct scsi_per_res_in_rsrv_data 324{ 325 uint8_t reservation[8]; 326 uint8_t obsolete1[4]; 327 uint8_t reserved; 328 uint8_t scopetype; 329#define SPRT_WE 0x01 330#define SPRT_EA 0x03 331#define SPRT_WERO 0x05 332#define SPRT_EARO 0x06 333#define SPRT_WEAR 0x07 334#define SPRT_EAAR 0x08 335 uint8_t obsolete2[2]; 336}; 337 338struct scsi_per_res_in_rsrv 339{ 340 struct scsi_per_res_in_header header; 341 struct scsi_per_res_in_rsrv_data data; 342}; 343 344struct scsi_per_res_out 345{ 346 u_int8_t opcode; 347 u_int8_t action; 348#define SPRO_REGISTER 0x00 349#define SPRO_RESERVE 0x01 350#define SPRO_RELEASE 0x02 351#define SPRO_CLEAR 0x03 352#define SPRO_PREEMPT 0x04 353#define SPRO_PRE_ABO 0x05 354#define SPRO_REG_IGNO 0x06 355#define SPRO_REG_MOVE 0x07 356#define SPRO_ACTION_MASK 0x1f 357 u_int8_t scope_type; 358#define SPR_SCOPE_MASK 0xf0 359#define SPR_LU_SCOPE 0x00 360#define SPR_TYPE_MASK 0x0f 361#define SPR_TYPE_WR_EX 0x01 362#define SPR_TYPE_EX_AC 0x03 363#define SPR_TYPE_WR_EX_RO 0x05 364#define SPR_TYPE_EX_AC_RO 0x06 365#define SPR_TYPE_WR_EX_AR 0x07 366#define SPR_TYPE_EX_AC_AR 0x08 367 u_int8_t reserved[2]; 368 u_int8_t length[4]; 369 u_int8_t control; 370}; 371 372struct scsi_per_res_out_parms 373{ 374 struct scsi_per_res_key res_key; 375 u_int8_t serv_act_res_key[8]; 376 u_int8_t obsolete1[4]; 377 u_int8_t flags; 378#define SPR_SPEC_I_PT 0x08 379#define SPR_ALL_TG_PT 0x04 380#define SPR_APTPL 0x01 381 u_int8_t reserved1; 382 u_int8_t obsolete2[2]; 383}; 384 385 |
|
266struct scsi_log_sense 267{ 268 u_int8_t opcode; 269 u_int8_t byte2; 270#define SLS_SP 0x01 271#define SLS_PPC 0x02 272 u_int8_t page; 273#define SLS_PAGE_CODE 0x3F --- 58 unchanged lines hidden (view full) --- 332#define SLP_DU 0x80 333 u_int8_t param_len; 334}; 335 336struct scsi_control_page { 337 u_int8_t page_code; 338 u_int8_t page_length; 339 u_int8_t rlec; | 386struct scsi_log_sense 387{ 388 u_int8_t opcode; 389 u_int8_t byte2; 390#define SLS_SP 0x01 391#define SLS_PPC 0x02 392 u_int8_t page; 393#define SLS_PAGE_CODE 0x3F --- 58 unchanged lines hidden (view full) --- 452#define SLP_DU 0x80 453 u_int8_t param_len; 454}; 455 456struct scsi_control_page { 457 u_int8_t page_code; 458 u_int8_t page_length; 459 u_int8_t rlec; |
340#define SCB_RLEC 0x01 /*Report Log Exception Cond*/ | 460#define SCP_RLEC 0x01 /*Report Log Exception Cond*/ 461#define SCP_GLTSD 0x02 /*Global Logging target 462 save disable */ 463#define SCP_DSENSE 0x04 /*Descriptor Sense */ 464#define SCP_DPICZ 0x08 /*Disable Prot. Info Check 465 if Prot. Field is Zero */ 466#define SCP_TMF_ONLY 0x10 /*TM Functions Only*/ 467#define SCP_TST_MASK 0xE0 /*Task Set Type Mask*/ 468#define SCP_TST_ONE 0x00 /*One Task Set*/ 469#define SCP_TST_SEPARATE 0x20 /*Separate Task Sets*/ |
341 u_int8_t queue_flags; 342#define SCP_QUEUE_ALG_MASK 0xF0 343#define SCP_QUEUE_ALG_RESTRICTED 0x00 344#define SCP_QUEUE_ALG_UNRESTRICTED 0x10 345#define SCP_QUEUE_ERR 0x02 /*Queued I/O aborted for CACs*/ 346#define SCP_QUEUE_DQUE 0x01 /*Queued I/O disabled*/ 347 u_int8_t eca_and_aen; 348#define SCP_EECA 0x80 /*Enable Extended CA*/ --- 14 unchanged lines hidden (view full) --- 363#define SCHP_FLAGS_RCD 0x01 /* Read Cache Disable */ 364 u_int8_t rw_cache_policy; 365 u_int8_t dis_prefetch[2]; 366 u_int8_t min_prefetch[2]; 367 u_int8_t max_prefetch[2]; 368 u_int8_t max_prefetch_ceil[2]; 369}; 370 | 470 u_int8_t queue_flags; 471#define SCP_QUEUE_ALG_MASK 0xF0 472#define SCP_QUEUE_ALG_RESTRICTED 0x00 473#define SCP_QUEUE_ALG_UNRESTRICTED 0x10 474#define SCP_QUEUE_ERR 0x02 /*Queued I/O aborted for CACs*/ 475#define SCP_QUEUE_DQUE 0x01 /*Queued I/O disabled*/ 476 u_int8_t eca_and_aen; 477#define SCP_EECA 0x80 /*Enable Extended CA*/ --- 14 unchanged lines hidden (view full) --- 492#define SCHP_FLAGS_RCD 0x01 /* Read Cache Disable */ 493 u_int8_t rw_cache_policy; 494 u_int8_t dis_prefetch[2]; 495 u_int8_t min_prefetch[2]; 496 u_int8_t max_prefetch[2]; 497 u_int8_t max_prefetch_ceil[2]; 498}; 499 |
500/* 501 * XXX KDM 502 * Updated version of the cache page, as of SBC. Update this to SBC-3 and 503 * rationalize the two. 504 */ 505struct scsi_caching_page { 506 uint8_t page_code; 507#define SMS_CACHING_PAGE 0x08 508 uint8_t page_length; 509 uint8_t flags1; 510#define SCP_IC 0x80 511#define SCP_ABPF 0x40 512#define SCP_CAP 0x20 513#define SCP_DISC 0x10 514#define SCP_SIZE 0x08 515#define SCP_WCE 0x04 516#define SCP_MF 0x02 517#define SCP_RCD 0x01 518 uint8_t ret_priority; 519 uint8_t disable_pf_transfer_len[2]; 520 uint8_t min_prefetch[2]; 521 uint8_t max_prefetch[2]; 522 uint8_t max_pf_ceiling[2]; 523 uint8_t flags2; 524#define SCP_FSW 0x80 525#define SCP_LBCSS 0x40 526#define SCP_DRA 0x20 527#define SCP_VS1 0x10 528#define SCP_VS2 0x08 529 uint8_t cache_segments; 530 uint8_t cache_seg_size[2]; 531 uint8_t reserved; 532 uint8_t non_cache_seg_size[3]; 533}; 534 |
|
371struct scsi_info_exceptions_page { 372 u_int8_t page_code; 373#define SIEP_PAGE_SAVABLE 0x80 /* Page is savable */ 374 u_int8_t page_length; 375 u_int8_t info_flags; 376#define SIEP_FLAGS_PERF 0x80 377#define SIEP_FLAGS_EBF 0x20 378#define SIEP_FLAGS_EWASC 0x10 --- 22 unchanged lines hidden (view full) --- 401#define SPSP_PROTO_ATA 0x08 402#define SPSP_PROTO_NONE 0x0f 403}; 404 405struct scsi_reserve 406{ 407 u_int8_t opcode; 408 u_int8_t byte2; | 535struct scsi_info_exceptions_page { 536 u_int8_t page_code; 537#define SIEP_PAGE_SAVABLE 0x80 /* Page is savable */ 538 u_int8_t page_length; 539 u_int8_t info_flags; 540#define SIEP_FLAGS_PERF 0x80 541#define SIEP_FLAGS_EBF 0x20 542#define SIEP_FLAGS_EWASC 0x10 --- 22 unchanged lines hidden (view full) --- 565#define SPSP_PROTO_ATA 0x08 566#define SPSP_PROTO_NONE 0x0f 567}; 568 569struct scsi_reserve 570{ 571 u_int8_t opcode; 572 u_int8_t byte2; |
409 u_int8_t unused[2]; 410 u_int8_t length; | 573#define SR_EXTENT 0x01 574#define SR_ID_MASK 0x0e 575#define SR_3RDPTY 0x10 576#define SR_LUN_MASK 0xe0 577 u_int8_t resv_id; 578 u_int8_t length[2]; |
411 u_int8_t control; 412}; 413 | 579 u_int8_t control; 580}; 581 |
582struct scsi_reserve_10 { 583 uint8_t opcode; 584 uint8_t byte2; 585#define SR10_3RDPTY 0x10 586#define SR10_LONGID 0x02 587#define SR10_EXTENT 0x01 588 uint8_t resv_id; 589 uint8_t thirdparty_id; 590 uint8_t reserved[3]; 591 uint8_t length[2]; 592 uint8_t control; 593}; 594 595 |
|
414struct scsi_release 415{ 416 u_int8_t opcode; 417 u_int8_t byte2; | 596struct scsi_release 597{ 598 u_int8_t opcode; 599 u_int8_t byte2; |
418 u_int8_t unused[2]; | 600 u_int8_t resv_id; 601 u_int8_t unused[1]; |
419 u_int8_t length; 420 u_int8_t control; 421}; 422 | 602 u_int8_t length; 603 u_int8_t control; 604}; 605 |
606struct scsi_release_10 { 607 uint8_t opcode; 608 uint8_t byte2; 609 uint8_t resv_id; 610 uint8_t thirdparty_id; 611 uint8_t reserved[3]; 612 uint8_t length[2]; 613 uint8_t control; 614}; 615 |
|
423struct scsi_prevent 424{ 425 u_int8_t opcode; 426 u_int8_t byte2; 427 u_int8_t unused[2]; 428 u_int8_t how; 429 u_int8_t control; 430}; 431#define PR_PREVENT 0x01 432#define PR_ALLOW 0x00 433 434struct scsi_sync_cache 435{ 436 u_int8_t opcode; 437 u_int8_t byte2; | 616struct scsi_prevent 617{ 618 u_int8_t opcode; 619 u_int8_t byte2; 620 u_int8_t unused[2]; 621 u_int8_t how; 622 u_int8_t control; 623}; 624#define PR_PREVENT 0x01 625#define PR_ALLOW 0x00 626 627struct scsi_sync_cache 628{ 629 u_int8_t opcode; 630 u_int8_t byte2; |
631#define SSC_IMMED 0x02 632#define SSC_RELADR 0x01 |
|
438 u_int8_t begin_lba[4]; 439 u_int8_t reserved; 440 u_int8_t lb_count[2]; 441 u_int8_t control; 442}; 443 | 633 u_int8_t begin_lba[4]; 634 u_int8_t reserved; 635 u_int8_t lb_count[2]; 636 u_int8_t control; 637}; 638 |
639struct scsi_sync_cache_16 640{ 641 uint8_t opcode; 642 uint8_t byte2; 643 uint8_t begin_lba[8]; 644 uint8_t lb_count[4]; 645 uint8_t reserved; 646 uint8_t control; 647}; |
|
444 | 648 |
649struct scsi_format { 650 uint8_t opcode; 651 uint8_t byte2; 652#define SF_LONGLIST 0x20 653#define SF_FMTDATA 0x10 654#define SF_CMPLIST 0x08 655#define SF_FORMAT_MASK 0x07 656#define SF_FORMAT_BLOCK 0x00 657#define SF_FORMAT_LONG_BLOCK 0x03 658#define SF_FORMAT_BFI 0x04 659#define SF_FORMAT_PHYS 0x05 660 uint8_t vendor; 661 uint8_t interleave[2]; 662 uint8_t control; 663}; 664 665struct scsi_format_header_short { 666 uint8_t reserved; 667#define SF_DATA_FOV 0x80 668#define SF_DATA_DPRY 0x40 669#define SF_DATA_DCRT 0x20 670#define SF_DATA_STPF 0x10 671#define SF_DATA_IP 0x08 672#define SF_DATA_DSP 0x04 673#define SF_DATA_IMMED 0x02 674#define SF_DATA_VS 0x01 675 uint8_t byte2; 676 uint8_t defect_list_len[2]; 677}; 678 679struct scsi_format_header_long { 680 uint8_t reserved; 681 uint8_t byte2; 682 uint8_t reserved2[2]; 683 uint8_t defect_list_len[4]; 684}; 685 |
|
445struct scsi_changedef 446{ 447 u_int8_t opcode; 448 u_int8_t byte2; 449 u_int8_t unused1; 450 u_int8_t how; 451 u_int8_t unused[4]; 452 u_int8_t datalen; 453 u_int8_t control; 454}; 455 456struct scsi_read_buffer 457{ 458 u_int8_t opcode; 459 u_int8_t byte2; 460#define RWB_MODE 0x07 461#define RWB_MODE_HDR_DATA 0x00 | 686struct scsi_changedef 687{ 688 u_int8_t opcode; 689 u_int8_t byte2; 690 u_int8_t unused1; 691 u_int8_t how; 692 u_int8_t unused[4]; 693 u_int8_t datalen; 694 u_int8_t control; 695}; 696 697struct scsi_read_buffer 698{ 699 u_int8_t opcode; 700 u_int8_t byte2; 701#define RWB_MODE 0x07 702#define RWB_MODE_HDR_DATA 0x00 |
703#define RWB_MODE_VENDOR 0x01 |
|
462#define RWB_MODE_DATA 0x02 463#define RWB_MODE_DOWNLOAD 0x04 464#define RWB_MODE_DOWNLOAD_SAVE 0x05 465 u_int8_t buffer_id; 466 u_int8_t offset[3]; 467 u_int8_t length[3]; 468 u_int8_t control; 469}; --- 54 unchanged lines hidden (view full) --- 524#define SRW16_DPO 0x10 525 u_int8_t byte2; 526 u_int8_t addr[8]; 527 u_int8_t length[4]; 528 u_int8_t reserved; 529 u_int8_t control; 530}; 531 | 704#define RWB_MODE_DATA 0x02 705#define RWB_MODE_DOWNLOAD 0x04 706#define RWB_MODE_DOWNLOAD_SAVE 0x05 707 u_int8_t buffer_id; 708 u_int8_t offset[3]; 709 u_int8_t length[3]; 710 u_int8_t control; 711}; --- 54 unchanged lines hidden (view full) --- 766#define SRW16_DPO 0x10 767 u_int8_t byte2; 768 u_int8_t addr[8]; 769 u_int8_t length[4]; 770 u_int8_t reserved; 771 u_int8_t control; 772}; 773 |
774struct scsi_write_verify_10 775{ 776 uint8_t opcode; 777 uint8_t byte2; 778#define SWV_BYTCHK 0x02 779#define SWV_DPO 0x10 780#define SWV_WRPROECT_MASK 0xe0 781 uint8_t addr[4]; 782 uint8_t group; 783 uint8_t length[2]; 784 uint8_t control; 785}; 786 787struct scsi_write_verify_12 788{ 789 uint8_t opcode; 790 uint8_t byte2; 791 uint8_t addr[4]; 792 uint8_t length[4]; 793 uint8_t group; 794 uint8_t control; 795}; 796 797struct scsi_write_verify_16 798{ 799 uint8_t opcode; 800 uint8_t byte2; 801 uint8_t addr[8]; 802 uint8_t length[4]; 803 uint8_t group; 804 uint8_t control; 805}; 806 807 |
|
532struct scsi_start_stop_unit 533{ 534 u_int8_t opcode; 535 u_int8_t byte2; 536#define SSS_IMMED 0x01 537 u_int8_t reserved[2]; 538 u_int8_t how; 539#define SSS_START 0x01 540#define SSS_LOEJ 0x02 | 808struct scsi_start_stop_unit 809{ 810 u_int8_t opcode; 811 u_int8_t byte2; 812#define SSS_IMMED 0x01 813 u_int8_t reserved[2]; 814 u_int8_t how; 815#define SSS_START 0x01 816#define SSS_LOEJ 0x02 |
817#define SSS_PC_MASK 0xf0 818#define SSS_PC_START_VALID 0x00 819#define SSS_PC_ACTIVE 0x10 820#define SSS_PC_IDLE 0x20 821#define SSS_PC_STANDBY 0x30 822#define SSS_PC_LU_CONTROL 0x70 823#define SSS_PC_FORCE_IDLE_0 0xa0 824#define SSS_PC_FORCE_STANDBY_0 0xb0 |
|
541 u_int8_t control; 542}; 543 544struct ata_pass_12 { 545 u_int8_t opcode; 546 u_int8_t protocol; 547#define AP_MULTI 0xe0 548 u_int8_t flags; --- 8 unchanged lines hidden (view full) --- 557 u_int8_t lba_mid; 558 u_int8_t lba_high; 559 u_int8_t device; 560 u_int8_t command; 561 u_int8_t reserved; 562 u_int8_t control; 563}; 564 | 825 u_int8_t control; 826}; 827 828struct ata_pass_12 { 829 u_int8_t opcode; 830 u_int8_t protocol; 831#define AP_MULTI 0xe0 832 u_int8_t flags; --- 8 unchanged lines hidden (view full) --- 841 u_int8_t lba_mid; 842 u_int8_t lba_high; 843 u_int8_t device; 844 u_int8_t command; 845 u_int8_t reserved; 846 u_int8_t control; 847}; 848 |
849struct scsi_maintenance_in 850{ 851 uint8_t opcode; 852 uint8_t byte2; 853#define SERVICE_ACTION_MASK 0x1f 854#define SA_RPRT_TRGT_GRP 0x0a 855 uint8_t reserved[4]; 856 uint8_t length[4]; 857 uint8_t reserved1; 858 uint8_t control; 859}; 860 |
|
565struct ata_pass_16 { 566 u_int8_t opcode; 567 u_int8_t protocol; 568#define AP_EXTEND 0x01 569 u_int8_t flags; 570 u_int8_t features_ext; 571 u_int8_t features; 572 u_int8_t sector_count_ext; --- 29 unchanged lines hidden (view full) --- 602#define RELEASE 0x17 603#define RECEIVE_DIAGNOSTIC 0x1C 604#define SEND_DIAGNOSTIC 0x1D 605#define PREVENT_ALLOW 0x1E 606#define READ_CAPACITY 0x25 607#define READ_10 0x28 608#define WRITE_10 0x2A 609#define POSITION_TO_ELEMENT 0x2B | 861struct ata_pass_16 { 862 u_int8_t opcode; 863 u_int8_t protocol; 864#define AP_EXTEND 0x01 865 u_int8_t flags; 866 u_int8_t features_ext; 867 u_int8_t features; 868 u_int8_t sector_count_ext; --- 29 unchanged lines hidden (view full) --- 898#define RELEASE 0x17 899#define RECEIVE_DIAGNOSTIC 0x1C 900#define SEND_DIAGNOSTIC 0x1D 901#define PREVENT_ALLOW 0x1E 902#define READ_CAPACITY 0x25 903#define READ_10 0x28 904#define WRITE_10 0x2A 905#define POSITION_TO_ELEMENT 0x2B |
906#define WRITE_VERIFY_10 0x2E |
|
610#define SYNCHRONIZE_CACHE 0x35 611#define READ_DEFECT_DATA_10 0x37 612#define WRITE_BUFFER 0x3B 613#define READ_BUFFER 0x3C 614#define CHANGE_DEFINITION 0x40 615#define LOG_SELECT 0x4C 616#define LOG_SENSE 0x4D 617#define MODE_SELECT_10 0x55 | 907#define SYNCHRONIZE_CACHE 0x35 908#define READ_DEFECT_DATA_10 0x37 909#define WRITE_BUFFER 0x3B 910#define READ_BUFFER 0x3C 911#define CHANGE_DEFINITION 0x40 912#define LOG_SELECT 0x4C 913#define LOG_SENSE 0x4D 914#define MODE_SELECT_10 0x55 |
915#define RESERVE_10 0x56 916#define RELEASE_10 0x57 |
|
618#define MODE_SENSE_10 0x5A | 917#define MODE_SENSE_10 0x5A |
918#define PERSISTENT_RES_IN 0x5E 919#define PERSISTENT_RES_OUT 0x5F |
|
619#define ATA_PASS_16 0x85 620#define READ_16 0x88 621#define WRITE_16 0x8A | 920#define ATA_PASS_16 0x85 921#define READ_16 0x88 922#define WRITE_16 0x8A |
923#define WRITE_VERIFY_16 0x8E 924#define SYNCHRONIZE_CACHE_16 0x91 |
|
622#define SERVICE_ACTION_IN 0x9E 623#define REPORT_LUNS 0xA0 624#define ATA_PASS_12 0xA1 625#define MAINTENANCE_IN 0xA3 626#define MAINTENANCE_OUT 0xA4 627#define MOVE_MEDIUM 0xA5 628#define READ_12 0xA8 629#define WRITE_12 0xAA | 925#define SERVICE_ACTION_IN 0x9E 926#define REPORT_LUNS 0xA0 927#define ATA_PASS_12 0xA1 928#define MAINTENANCE_IN 0xA3 929#define MAINTENANCE_OUT 0xA4 930#define MOVE_MEDIUM 0xA5 931#define READ_12 0xA8 932#define WRITE_12 0xAA |
933#define WRITE_VERIFY_12 0xAE |
|
630#define READ_ELEMENT_STATUS 0xB8 631 632/* Maintenance In Service Action Codes */ 633#define REPORT_IDENTIFYING_INFRMATION 0x05 634#define REPORT_TARGET_PORT_GROUPS 0x0A 635#define REPORT_ALIASES 0x0B 636#define REPORT_SUPPORTED_OPERATION_CODES 0x0C 637#define REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS 0x0D --- 94 unchanged lines hidden (view full) --- 732#define SCSI_REV_SPC3 5 733#define SCSI_REV_SPC4 6 734 735#define SID_ECMA 0x38 736#define SID_ISO 0xC0 737 u_int8_t response_format; 738#define SID_AENC 0x80 739#define SID_TrmIOP 0x40 | 934#define READ_ELEMENT_STATUS 0xB8 935 936/* Maintenance In Service Action Codes */ 937#define REPORT_IDENTIFYING_INFRMATION 0x05 938#define REPORT_TARGET_PORT_GROUPS 0x0A 939#define REPORT_ALIASES 0x0B 940#define REPORT_SUPPORTED_OPERATION_CODES 0x0C 941#define REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS 0x0D --- 94 unchanged lines hidden (view full) --- 1036#define SCSI_REV_SPC3 5 1037#define SCSI_REV_SPC4 6 1038 1039#define SID_ECMA 0x38 1040#define SID_ISO 0xC0 1041 u_int8_t response_format; 1042#define SID_AENC 0x80 1043#define SID_TrmIOP 0x40 |
1044#define SID_NormACA 0x20 1045#define SID_HiSup 0x10 |
|
740 u_int8_t additional_length; 741#define SID_ADDITIONAL_LENGTH(iqd) \ 742 ((iqd)->additional_length + \ | 1046 u_int8_t additional_length; 1047#define SID_ADDITIONAL_LENGTH(iqd) \ 1048 ((iqd)->additional_length + \ |
743 offsetof(struct scsi_inquiry_data, additional_length) + 1) | 1049 __offsetof(struct scsi_inquiry_data, additional_length) + 1) |
744 u_int8_t spc3_flags; 745#define SPC3_SID_PROTECT 0x01 746#define SPC3_SID_3PC 0x08 747#define SPC3_SID_TPGS_MASK 0x30 748#define SPC3_SID_TPGS_IMPLICIT 0x10 749#define SPC3_SID_TPGS_EXPLICIT 0x20 750#define SPC3_SID_ACC 0x40 751#define SPC3_SID_SCCS 0x80 752 u_int8_t spc2_flags; | 1050 u_int8_t spc3_flags; 1051#define SPC3_SID_PROTECT 0x01 1052#define SPC3_SID_3PC 0x08 1053#define SPC3_SID_TPGS_MASK 0x30 1054#define SPC3_SID_TPGS_IMPLICIT 0x10 1055#define SPC3_SID_TPGS_EXPLICIT 0x20 1056#define SPC3_SID_ACC 0x40 1057#define SPC3_SID_SCCS 0x80 1058 u_int8_t spc2_flags; |
1059#define SPC2_SID_ADDR16 0x01 |
|
753#define SPC2_SID_MChngr 0x08 754#define SPC2_SID_MultiP 0x10 755#define SPC2_SID_EncServ 0x40 756#define SPC2_SID_BQueue 0x80 757 758#define INQ_DATA_TQ_ENABLED(iqd) \ 759 ((SID_ANSI_REV(iqd) < SCSI_REV_SPC2)? ((iqd)->flags & SID_CmdQue) : \ 760 (((iqd)->flags & SID_CmdQue) && !((iqd)->spc2_flags & SPC2_SID_BQueue)) || \ --- 43 unchanged lines hidden (view full) --- 804 u_int8_t version8[2]; 805 806 u_int8_t reserved3[22]; 807 808#define SID_VENDOR_SPECIFIC_1_SIZE 160 809 u_int8_t vendor_specific1[SID_VENDOR_SPECIFIC_1_SIZE]; 810}; 811 | 1060#define SPC2_SID_MChngr 0x08 1061#define SPC2_SID_MultiP 0x10 1062#define SPC2_SID_EncServ 0x40 1063#define SPC2_SID_BQueue 0x80 1064 1065#define INQ_DATA_TQ_ENABLED(iqd) \ 1066 ((SID_ANSI_REV(iqd) < SCSI_REV_SPC2)? ((iqd)->flags & SID_CmdQue) : \ 1067 (((iqd)->flags & SID_CmdQue) && !((iqd)->spc2_flags & SPC2_SID_BQueue)) || \ --- 43 unchanged lines hidden (view full) --- 1111 u_int8_t version8[2]; 1112 1113 u_int8_t reserved3[22]; 1114 1115#define SID_VENDOR_SPECIFIC_1_SIZE 160 1116 u_int8_t vendor_specific1[SID_VENDOR_SPECIFIC_1_SIZE]; 1117}; 1118 |
1119/* 1120 * This structure is more suited to initiator operation, because the 1121 * maximum number of supported pages is already allocated. 1122 */ |
|
812struct scsi_vpd_supported_page_list 813{ 814 u_int8_t device; 815 u_int8_t page_code; 816#define SVPD_SUPPORTED_PAGE_LIST 0x00 817#define SVPD_SUPPORTED_PAGES_HDR_LEN 4 818 u_int8_t reserved; 819 u_int8_t length; /* number of VPD entries */ --- 27 unchanged lines hidden (view full) --- 847 u_int8_t serial_num[SVPD_SERIAL_NUM_SIZE]; 848}; 849 850struct scsi_vpd_device_id 851{ 852 u_int8_t device; 853 u_int8_t page_code; 854#define SVPD_DEVICE_ID 0x83 | 1123struct scsi_vpd_supported_page_list 1124{ 1125 u_int8_t device; 1126 u_int8_t page_code; 1127#define SVPD_SUPPORTED_PAGE_LIST 0x00 1128#define SVPD_SUPPORTED_PAGES_HDR_LEN 4 1129 u_int8_t reserved; 1130 u_int8_t length; /* number of VPD entries */ --- 27 unchanged lines hidden (view full) --- 1158 u_int8_t serial_num[SVPD_SERIAL_NUM_SIZE]; 1159}; 1160 1161struct scsi_vpd_device_id 1162{ 1163 u_int8_t device; 1164 u_int8_t page_code; 1165#define SVPD_DEVICE_ID 0x83 |
855#define SVPD_DEVICE_ID_MAX_SIZE 0xffff 856#define SVPD_DEVICE_ID_HDR_LEN 4 857#define SVPD_DEVICE_ID_DESC_HDR_LEN 4 | 1166#define SVPD_DEVICE_ID_MAX_SIZE 252 1167#define SVPD_DEVICE_ID_HDR_LEN \ 1168 __offsetof(struct scsi_vpd_device_id, desc_list) |
858 u_int8_t length[2]; | 1169 u_int8_t length[2]; |
859 u_int8_t desc_list[0]; | 1170 u_int8_t desc_list[]; |
860}; 861 862struct scsi_vpd_id_descriptor 863{ 864 u_int8_t proto_codeset; 865#define SCSI_PROTO_FC 0x00 866#define SCSI_PROTO_SPI 0x01 867#define SCSI_PROTO_SSA 0x02 868#define SCSI_PROTO_1394 0x03 869#define SCSI_PROTO_RDMA 0x04 870#define SCSI_PROTO_iSCSI 0x05 871#define SCSI_PROTO_SAS 0x06 872#define SVPD_ID_PROTO_SHIFT 4 873#define SVPD_ID_CODESET_BINARY 0x01 874#define SVPD_ID_CODESET_ASCII 0x02 | 1171}; 1172 1173struct scsi_vpd_id_descriptor 1174{ 1175 u_int8_t proto_codeset; 1176#define SCSI_PROTO_FC 0x00 1177#define SCSI_PROTO_SPI 0x01 1178#define SCSI_PROTO_SSA 0x02 1179#define SCSI_PROTO_1394 0x03 1180#define SCSI_PROTO_RDMA 0x04 1181#define SCSI_PROTO_iSCSI 0x05 1182#define SCSI_PROTO_SAS 0x06 1183#define SVPD_ID_PROTO_SHIFT 4 1184#define SVPD_ID_CODESET_BINARY 0x01 1185#define SVPD_ID_CODESET_ASCII 0x02 |
1186#define SVPD_ID_CODESET_MASK 0x0f |
|
875 u_int8_t id_type; 876#define SVPD_ID_PIV 0x80 877#define SVPD_ID_ASSOC_LUN 0x00 878#define SVPD_ID_ASSOC_PORT 0x10 879#define SVPD_ID_ASSOC_TARGET 0x20 | 1187 u_int8_t id_type; 1188#define SVPD_ID_PIV 0x80 1189#define SVPD_ID_ASSOC_LUN 0x00 1190#define SVPD_ID_ASSOC_PORT 0x10 1191#define SVPD_ID_ASSOC_TARGET 0x20 |
1192#define SVPD_ID_ASSOC_MASK 0x30 |
|
880#define SVPD_ID_TYPE_VENDOR 0x00 881#define SVPD_ID_TYPE_T10 0x01 882#define SVPD_ID_TYPE_EUI64 0x02 883#define SVPD_ID_TYPE_NAA 0x03 884#define SVPD_ID_TYPE_RELTARG 0x04 885#define SVPD_ID_TYPE_TPORTGRP 0x05 886#define SVPD_ID_TYPE_LUNGRP 0x06 887#define SVPD_ID_TYPE_MD5_LUN_ID 0x07 888#define SVPD_ID_TYPE_SCSI_NAME 0x08 889#define SVPD_ID_TYPE_MASK 0x0f 890 u_int8_t reserved; 891 u_int8_t length; | 1193#define SVPD_ID_TYPE_VENDOR 0x00 1194#define SVPD_ID_TYPE_T10 0x01 1195#define SVPD_ID_TYPE_EUI64 0x02 1196#define SVPD_ID_TYPE_NAA 0x03 1197#define SVPD_ID_TYPE_RELTARG 0x04 1198#define SVPD_ID_TYPE_TPORTGRP 0x05 1199#define SVPD_ID_TYPE_LUNGRP 0x06 1200#define SVPD_ID_TYPE_MD5_LUN_ID 0x07 1201#define SVPD_ID_TYPE_SCSI_NAME 0x08 1202#define SVPD_ID_TYPE_MASK 0x0f 1203 u_int8_t reserved; 1204 u_int8_t length; |
892 u_int8_t identifier[0]; | 1205#define SVPD_DEVICE_ID_DESC_HDR_LEN \ 1206 __offsetof(struct scsi_vpd_id_descriptor, identifier) 1207 u_int8_t identifier[]; |
893}; 894 895struct scsi_vpd_id_t10 896{ 897 u_int8_t vendor[8]; 898 u_int8_t vendor_spec_id[0]; 899}; 900 --- 84 unchanged lines hidden (view full) --- 985 uint8_t lun_id[16]; 986}; 987 988struct scsi_vpd_id_scsi_name 989{ 990 uint8_t name_string[256]; 991}; 992 | 1208}; 1209 1210struct scsi_vpd_id_t10 1211{ 1212 u_int8_t vendor[8]; 1213 u_int8_t vendor_spec_id[0]; 1214}; 1215 --- 84 unchanged lines hidden (view full) --- 1300 uint8_t lun_id[16]; 1301}; 1302 1303struct scsi_vpd_id_scsi_name 1304{ 1305 uint8_t name_string[256]; 1306}; 1307 |
1308struct scsi_service_action_in 1309{ 1310 uint8_t opcode; 1311 uint8_t service_action; 1312 uint8_t action_dependent[13]; 1313 uint8_t control; 1314}; 1315 |
|
993struct scsi_read_capacity 994{ 995 u_int8_t opcode; 996 u_int8_t byte2; | 1316struct scsi_read_capacity 1317{ 1318 u_int8_t opcode; 1319 u_int8_t byte2; |
1320#define SRC_RELADR 0x01 |
|
997 u_int8_t addr[4]; | 1321 u_int8_t addr[4]; |
998 u_int8_t unused[3]; | 1322 u_int8_t unused[2]; 1323 u_int8_t pmi; 1324#define SRC_PMI 0x01 |
999 u_int8_t control; 1000}; 1001 1002struct scsi_read_capacity_16 1003{ 1004 uint8_t opcode; 1005#define SRC16_SERVICE_ACTION 0x10 1006 uint8_t service_action; --- 26 unchanged lines hidden (view full) --- 1033#define RPL_REPORT_ALL 0x02 1034 uint8_t select_report; 1035 uint8_t reserved2[3]; 1036 uint8_t length[4]; 1037 uint8_t reserved3; 1038 uint8_t control; 1039}; 1040 | 1325 u_int8_t control; 1326}; 1327 1328struct scsi_read_capacity_16 1329{ 1330 uint8_t opcode; 1331#define SRC16_SERVICE_ACTION 0x10 1332 uint8_t service_action; --- 26 unchanged lines hidden (view full) --- 1359#define RPL_REPORT_ALL 0x02 1360 uint8_t select_report; 1361 uint8_t reserved2[3]; 1362 uint8_t length[4]; 1363 uint8_t reserved3; 1364 uint8_t control; 1365}; 1366 |
1041struct scsi_report_luns_data { 1042 u_int8_t length[4]; /* length of LUN inventory, in bytes */ 1043 u_int8_t reserved[4]; /* unused */ 1044 /* 1045 * LUN inventory- we only support the type zero form for now. 1046 */ 1047 struct { 1048 u_int8_t lundata[8]; 1049 } luns[0]; 1050}; | 1367struct scsi_report_luns_lundata { 1368 uint8_t lundata[8]; |
1051#define RPL_LUNDATA_PERIPH_BUS_MASK 0x3f 1052#define RPL_LUNDATA_FLAT_LUN_MASK 0x3f | 1369#define RPL_LUNDATA_PERIPH_BUS_MASK 0x3f 1370#define RPL_LUNDATA_FLAT_LUN_MASK 0x3f |
1371#define RPL_LUNDATA_FLAT_LUN_BITS 0x06 |
|
1053#define RPL_LUNDATA_LUN_TARG_MASK 0x3f 1054#define RPL_LUNDATA_LUN_BUS_MASK 0xe0 1055#define RPL_LUNDATA_LUN_LUN_MASK 0x1f 1056#define RPL_LUNDATA_EXT_LEN_MASK 0x30 1057#define RPL_LUNDATA_EXT_EAM_MASK 0x0f 1058#define RPL_LUNDATA_EXT_EAM_WK 0x01 1059#define RPL_LUNDATA_EXT_EAM_NOT_SPEC 0x0f 1060#define RPL_LUNDATA_ATYP_MASK 0xc0 /* MBZ for type 0 lun */ 1061#define RPL_LUNDATA_ATYP_PERIPH 0x00 1062#define RPL_LUNDATA_ATYP_FLAT 0x40 1063#define RPL_LUNDATA_ATYP_LUN 0x80 1064#define RPL_LUNDATA_ATYP_EXTLUN 0xc0 | 1372#define RPL_LUNDATA_LUN_TARG_MASK 0x3f 1373#define RPL_LUNDATA_LUN_BUS_MASK 0xe0 1374#define RPL_LUNDATA_LUN_LUN_MASK 0x1f 1375#define RPL_LUNDATA_EXT_LEN_MASK 0x30 1376#define RPL_LUNDATA_EXT_EAM_MASK 0x0f 1377#define RPL_LUNDATA_EXT_EAM_WK 0x01 1378#define RPL_LUNDATA_EXT_EAM_NOT_SPEC 0x0f 1379#define RPL_LUNDATA_ATYP_MASK 0xc0 /* MBZ for type 0 lun */ 1380#define RPL_LUNDATA_ATYP_PERIPH 0x00 1381#define RPL_LUNDATA_ATYP_FLAT 0x40 1382#define RPL_LUNDATA_ATYP_LUN 0x80 1383#define RPL_LUNDATA_ATYP_EXTLUN 0xc0 |
1384}; |
|
1065 | 1385 |
1386struct scsi_report_luns_data { 1387 u_int8_t length[4]; /* length of LUN inventory, in bytes */ 1388 u_int8_t reserved[4]; /* unused */ 1389 /* 1390 * LUN inventory- we only support the type zero form for now. 1391 */ 1392 struct scsi_report_luns_lundata luns[0]; 1393}; 1394 |
|
1066struct scsi_target_group 1067{ 1068 uint8_t opcode; 1069 uint8_t service_action; 1070#define STG_PDF_LENGTH 0x00 1071#define RPL_PDF_EXTENDED 0x20 1072 uint8_t reserved1[4]; 1073 uint8_t length[4]; --- 24 unchanged lines hidden (view full) --- 1098#define TPG_S_SUP 0x04 1099#define TPG_U_SUP 0x08 1100#define TPG_LBD_SUP 0x10 1101#define TPG_O_SUP 0x40 1102#define TPG_T_SUP 0x80 1103 uint8_t target_port_group[2]; 1104 uint8_t reserved; 1105 uint8_t status; | 1395struct scsi_target_group 1396{ 1397 uint8_t opcode; 1398 uint8_t service_action; 1399#define STG_PDF_LENGTH 0x00 1400#define RPL_PDF_EXTENDED 0x20 1401 uint8_t reserved1[4]; 1402 uint8_t length[4]; --- 24 unchanged lines hidden (view full) --- 1427#define TPG_S_SUP 0x04 1428#define TPG_U_SUP 0x08 1429#define TPG_LBD_SUP 0x10 1430#define TPG_O_SUP 0x40 1431#define TPG_T_SUP 0x80 1432 uint8_t target_port_group[2]; 1433 uint8_t reserved; 1434 uint8_t status; |
1435#define TPG_UNAVLBL 0 1436#define TPG_SET_BY_STPG 0x01 1437#define TPG_IMPLICIT 0x02 |
|
1106 uint8_t vendor_specific; 1107 uint8_t target_port_count; 1108 struct scsi_target_port_descriptor descriptors[]; 1109}; 1110 1111struct scsi_target_group_data { 1112 uint8_t length[4]; /* length of returned data, in bytes */ 1113 struct scsi_target_port_group_descriptor groups[]; 1114}; 1115 1116struct scsi_target_group_data_extended { 1117 uint8_t length[4]; /* length of returned data, in bytes */ 1118 uint8_t format_type; /* STG_PDF_LENGTH or RPL_PDF_EXTENDED */ 1119 uint8_t implicit_transition_time; 1120 uint8_t reserved[2]; 1121 struct scsi_target_port_group_descriptor groups[]; 1122}; 1123 1124 | 1438 uint8_t vendor_specific; 1439 uint8_t target_port_count; 1440 struct scsi_target_port_descriptor descriptors[]; 1441}; 1442 1443struct scsi_target_group_data { 1444 uint8_t length[4]; /* length of returned data, in bytes */ 1445 struct scsi_target_port_group_descriptor groups[]; 1446}; 1447 1448struct scsi_target_group_data_extended { 1449 uint8_t length[4]; /* length of returned data, in bytes */ 1450 uint8_t format_type; /* STG_PDF_LENGTH or RPL_PDF_EXTENDED */ 1451 uint8_t implicit_transition_time; 1452 uint8_t reserved[2]; 1453 struct scsi_target_port_group_descriptor groups[]; 1454}; 1455 1456 |
1457typedef enum { 1458 SSD_TYPE_NONE, 1459 SSD_TYPE_FIXED, 1460 SSD_TYPE_DESC 1461} scsi_sense_data_type; 1462 1463typedef enum { 1464 SSD_ELEM_NONE, 1465 SSD_ELEM_SKIP, 1466 SSD_ELEM_DESC, 1467 SSD_ELEM_SKS, 1468 SSD_ELEM_COMMAND, 1469 SSD_ELEM_INFO, 1470 SSD_ELEM_FRU, 1471 SSD_ELEM_STREAM, 1472 SSD_ELEM_MAX 1473} scsi_sense_elem_type; 1474 1475 |
|
1125struct scsi_sense_data 1126{ | 1476struct scsi_sense_data 1477{ |
1478 uint8_t error_code; 1479 /* 1480 * SPC-4 says that the maximum length of sense data is 252 bytes. 1481 * So this structure is exactly 252 bytes log. 1482 */ 1483#define SSD_FULL_SIZE 252 1484 uint8_t sense_buf[SSD_FULL_SIZE - 1]; 1485 /* 1486 * XXX KDM is this still a reasonable minimum size? 1487 */ 1488#define SSD_MIN_SIZE 18 1489 /* 1490 * Maximum value for the extra_len field in the sense data. 1491 */ 1492#define SSD_EXTRA_MAX 244 1493}; 1494 1495/* 1496 * Fixed format sense data. 1497 */ 1498struct scsi_sense_data_fixed 1499{ |
|
1127 u_int8_t error_code; 1128#define SSD_ERRCODE 0x7F 1129#define SSD_CURRENT_ERROR 0x70 1130#define SSD_DEFERRED_ERROR 0x71 1131#define SSD_ERRCODE_VALID 0x80 1132 u_int8_t segment; 1133 u_int8_t flags; 1134#define SSD_KEY 0x0F --- 7 unchanged lines hidden (view full) --- 1142#define SSD_KEY_DATA_PROTECT 0x07 1143#define SSD_KEY_BLANK_CHECK 0x08 1144#define SSD_KEY_Vendor_Specific 0x09 1145#define SSD_KEY_COPY_ABORTED 0x0a 1146#define SSD_KEY_ABORTED_COMMAND 0x0b 1147#define SSD_KEY_EQUAL 0x0c 1148#define SSD_KEY_VOLUME_OVERFLOW 0x0d 1149#define SSD_KEY_MISCOMPARE 0x0e | 1500 u_int8_t error_code; 1501#define SSD_ERRCODE 0x7F 1502#define SSD_CURRENT_ERROR 0x70 1503#define SSD_DEFERRED_ERROR 0x71 1504#define SSD_ERRCODE_VALID 0x80 1505 u_int8_t segment; 1506 u_int8_t flags; 1507#define SSD_KEY 0x0F --- 7 unchanged lines hidden (view full) --- 1515#define SSD_KEY_DATA_PROTECT 0x07 1516#define SSD_KEY_BLANK_CHECK 0x08 1517#define SSD_KEY_Vendor_Specific 0x09 1518#define SSD_KEY_COPY_ABORTED 0x0a 1519#define SSD_KEY_ABORTED_COMMAND 0x0b 1520#define SSD_KEY_EQUAL 0x0c 1521#define SSD_KEY_VOLUME_OVERFLOW 0x0d 1522#define SSD_KEY_MISCOMPARE 0x0e |
1150#define SSD_KEY_RESERVED 0x0f | 1523#define SSD_KEY_COMPLETED 0x0f |
1151#define SSD_ILI 0x20 1152#define SSD_EOM 0x40 1153#define SSD_FILEMARK 0x80 1154 u_int8_t info[4]; 1155 u_int8_t extra_len; 1156 u_int8_t cmd_spec_info[4]; 1157 u_int8_t add_sense_code; 1158 u_int8_t add_sense_code_qual; 1159 u_int8_t fru; 1160 u_int8_t sense_key_spec[3]; 1161#define SSD_SCS_VALID 0x80 1162#define SSD_FIELDPTR_CMD 0x40 1163#define SSD_BITPTR_VALID 0x08 1164#define SSD_BITPTR_VALUE 0x07 | 1524#define SSD_ILI 0x20 1525#define SSD_EOM 0x40 1526#define SSD_FILEMARK 0x80 1527 u_int8_t info[4]; 1528 u_int8_t extra_len; 1529 u_int8_t cmd_spec_info[4]; 1530 u_int8_t add_sense_code; 1531 u_int8_t add_sense_code_qual; 1532 u_int8_t fru; 1533 u_int8_t sense_key_spec[3]; 1534#define SSD_SCS_VALID 0x80 1535#define SSD_FIELDPTR_CMD 0x40 1536#define SSD_BITPTR_VALID 0x08 1537#define SSD_BITPTR_VALUE 0x07 |
1165#define SSD_MIN_SIZE 18 | |
1166 u_int8_t extra_bytes[14]; | 1538 u_int8_t extra_bytes[14]; |
1167#define SSD_FULL_SIZE sizeof(struct scsi_sense_data) | 1539#define SSD_FIXED_IS_PRESENT(sense, length, field) \ 1540 ((length >= (offsetof(struct scsi_sense_data_fixed, field) + \ 1541 sizeof(sense->field))) ? 1 :0) 1542#define SSD_FIXED_IS_FILLED(sense, field) \ 1543 ((((offsetof(struct scsi_sense_data_fixed, field) + \ 1544 sizeof(sense->field)) - \ 1545 (offsetof(struct scsi_sense_data_fixed, extra_len) + \ 1546 sizeof(sense->extra_len))) <= sense->extra_len) ? 1 : 0) |
1168}; 1169 | 1547}; 1548 |
1549/* 1550 * Descriptor format sense data definitions. 1551 * Introduced in SPC-3. 1552 */ 1553struct scsi_sense_data_desc 1554{ 1555 uint8_t error_code; 1556#define SSD_DESC_CURRENT_ERROR 0x72 1557#define SSD_DESC_DEFERRED_ERROR 0x73 1558 uint8_t sense_key; 1559 uint8_t add_sense_code; 1560 uint8_t add_sense_code_qual; 1561 uint8_t reserved[3]; 1562 /* 1563 * Note that SPC-4, section 4.5.2.1 says that the extra_len field 1564 * must be less than or equal to 244. 1565 */ 1566 uint8_t extra_len; 1567 uint8_t sense_desc[0]; 1568#define SSD_DESC_IS_PRESENT(sense, length, field) \ 1569 ((length >= (offsetof(struct scsi_sense_data_desc, field) + \ 1570 sizeof(sense->field))) ? 1 :0) 1571}; 1572 1573struct scsi_sense_desc_header 1574{ 1575 uint8_t desc_type; 1576 uint8_t length; 1577}; 1578/* 1579 * The information provide in the Information descriptor is device type or 1580 * command specific information, and defined in a command standard. 1581 * 1582 * Note that any changes to the field names or positions in this structure, 1583 * even reserved fields, should be accompanied by an examination of the 1584 * code in ctl_set_sense() that uses them. 1585 * 1586 * Maximum descriptors allowed: 1 (as of SPC-4) 1587 */ 1588struct scsi_sense_info 1589{ 1590 uint8_t desc_type; 1591#define SSD_DESC_INFO 0x00 1592 uint8_t length; 1593 uint8_t byte2; 1594#define SSD_INFO_VALID 0x80 1595 uint8_t reserved; 1596 uint8_t info[8]; 1597}; 1598 1599/* 1600 * Command-specific information depends on the command for which the 1601 * reported condition occured. 1602 * 1603 * Note that any changes to the field names or positions in this structure, 1604 * even reserved fields, should be accompanied by an examination of the 1605 * code in ctl_set_sense() that uses them. 1606 * 1607 * Maximum descriptors allowed: 1 (as of SPC-4) 1608 */ 1609struct scsi_sense_command 1610{ 1611 uint8_t desc_type; 1612#define SSD_DESC_COMMAND 0x01 1613 uint8_t length; 1614 uint8_t reserved[2]; 1615 uint8_t command_info[8]; 1616}; 1617 1618/* 1619 * Sense key specific descriptor. The sense key specific data format 1620 * depends on the sense key in question. 1621 * 1622 * Maximum descriptors allowed: 1 (as of SPC-4) 1623 */ 1624struct scsi_sense_sks 1625{ 1626 uint8_t desc_type; 1627#define SSD_DESC_SKS 0x02 1628 uint8_t length; 1629 uint8_t reserved1[2]; 1630 uint8_t sense_key_spec[3]; 1631#define SSD_SKS_VALID 0x80 1632 uint8_t reserved2; 1633}; 1634 1635/* 1636 * This is used for the Illegal Request sense key (0x05) only. 1637 */ 1638struct scsi_sense_sks_field 1639{ 1640 uint8_t byte0; 1641#define SSD_SKS_FIELD_VALID 0x80 1642#define SSD_SKS_FIELD_CMD 0x40 1643#define SSD_SKS_BPV 0x08 1644#define SSD_SKS_BIT_VALUE 0x07 1645 uint8_t field[2]; 1646}; 1647 1648 1649/* 1650 * This is used for the Hardware Error (0x04), Medium Error (0x03) and 1651 * Recovered Error (0x01) sense keys. 1652 */ 1653struct scsi_sense_sks_retry 1654{ 1655 uint8_t byte0; 1656#define SSD_SKS_RETRY_VALID 0x80 1657 uint8_t actual_retry_count[2]; 1658}; 1659 1660/* 1661 * Used with the NO Sense (0x00) or Not Ready (0x02) sense keys. 1662 */ 1663struct scsi_sense_sks_progress 1664{ 1665 uint8_t byte0; 1666#define SSD_SKS_PROGRESS_VALID 0x80 1667 uint8_t progress[2]; 1668#define SSD_SKS_PROGRESS_DENOM 0x10000 1669}; 1670 1671/* 1672 * Used with the Copy Aborted (0x0a) sense key. 1673 */ 1674struct scsi_sense_sks_segment 1675{ 1676 uint8_t byte0; 1677#define SSD_SKS_SEGMENT_VALID 0x80 1678#define SSD_SKS_SEGMENT_SD 0x20 1679#define SSD_SKS_SEGMENT_BPV 0x08 1680#define SSD_SKS_SEGMENT_BITPTR 0x07 1681 uint8_t field[2]; 1682}; 1683 1684/* 1685 * Used with the Unit Attention (0x06) sense key. 1686 * 1687 * This is currently used to indicate that the unit attention condition 1688 * queue has overflowed (when the overflow bit is set). 1689 */ 1690struct scsi_sense_sks_overflow 1691{ 1692 uint8_t byte0; 1693#define SSD_SKS_OVERFLOW_VALID 0x80 1694#define SSD_SKS_OVERFLOW_SET 0x01 1695 uint8_t reserved[2]; 1696}; 1697 1698/* 1699 * This specifies which component is associated with the sense data. There 1700 * is no standard meaning for the fru value. 1701 * 1702 * Maximum descriptors allowed: 1 (as of SPC-4) 1703 */ 1704struct scsi_sense_fru 1705{ 1706 uint8_t desc_type; 1707#define SSD_DESC_FRU 0x03 1708 uint8_t length; 1709 uint8_t reserved; 1710 uint8_t fru; 1711}; 1712 1713/* 1714 * Used for Stream commands, defined in SSC-4. 1715 * 1716 * Maximum descriptors allowed: 1 (as of SPC-4) 1717 */ 1718 1719struct scsi_sense_stream 1720{ 1721 uint8_t desc_type; 1722#define SSD_DESC_STREAM 0x04 1723 uint8_t length; 1724 uint8_t reserved; 1725 uint8_t byte3; 1726#define SSD_DESC_STREAM_FM 0x80 1727#define SSD_DESC_STREAM_EOM 0x40 1728#define SSD_DESC_STREAM_ILI 0x20 1729}; 1730 1731/* 1732 * Used for Block commands, defined in SBC-3. 1733 * 1734 * This is currently (as of SBC-3) only used for the Incorrect Length 1735 * Indication (ILI) bit, which says that the data length requested in the 1736 * READ LONG or WRITE LONG command did not match the length of the logical 1737 * block. 1738 * 1739 * Maximum descriptors allowed: 1 (as of SPC-4) 1740 */ 1741struct scsi_sense_block 1742{ 1743 uint8_t desc_type; 1744#define SSD_DESC_BLOCK 0x05 1745 uint8_t length; 1746 uint8_t reserved; 1747 uint8_t byte3; 1748#define SSD_DESC_BLOCK_ILI 0x20 1749}; 1750 1751/* 1752 * Used for Object-Based Storage Devices (OSD-3). 1753 * 1754 * Maximum descriptors allowed: 1 (as of SPC-4) 1755 */ 1756struct scsi_sense_osd_objid 1757{ 1758 uint8_t desc_type; 1759#define SSD_DESC_OSD_OBJID 0x06 1760 uint8_t length; 1761 uint8_t reserved[6]; 1762 /* 1763 * XXX KDM provide the bit definitions here? There are a lot of 1764 * them, and we don't have an OSD driver yet. 1765 */ 1766 uint8_t not_init_cmds[4]; 1767 uint8_t completed_cmds[4]; 1768 uint8_t partition_id[8]; 1769 uint8_t object_id[8]; 1770}; 1771 1772/* 1773 * Used for Object-Based Storage Devices (OSD-3). 1774 * 1775 * Maximum descriptors allowed: 1 (as of SPC-4) 1776 */ 1777struct scsi_sense_osd_integrity 1778{ 1779 uint8_t desc_type; 1780#define SSD_DESC_OSD_INTEGRITY 0x07 1781 uint8_t length; 1782 uint8_t integ_check_val[32]; 1783}; 1784 1785/* 1786 * Used for Object-Based Storage Devices (OSD-3). 1787 * 1788 * Maximum descriptors allowed: 1 (as of SPC-4) 1789 */ 1790struct scsi_sense_osd_attr_id 1791{ 1792 uint8_t desc_type; 1793#define SSD_DESC_OSD_ATTR_ID 0x08 1794 uint8_t length; 1795 uint8_t reserved[2]; 1796 uint8_t attr_desc[0]; 1797}; 1798 1799/* 1800 * Used with Sense keys No Sense (0x00) and Not Ready (0x02). 1801 * 1802 * Maximum descriptors allowed: 32 (as of SPC-4) 1803 */ 1804struct scsi_sense_progress 1805{ 1806 uint8_t desc_type; 1807#define SSD_DESC_PROGRESS 0x0a 1808 uint8_t length; 1809 uint8_t sense_key; 1810 uint8_t add_sense_code; 1811 uint8_t add_sense_code_qual; 1812 uint8_t reserved; 1813 uint8_t progress[2]; 1814}; 1815 1816/* 1817 * This is typically forwarded as the result of an EXTENDED COPY command. 1818 * 1819 * Maximum descriptors allowed: 2 (as of SPC-4) 1820 */ 1821struct scsi_sense_forwarded 1822{ 1823 uint8_t desc_type; 1824#define SSD_DESC_FORWARDED 0x0c 1825 uint8_t length; 1826 uint8_t byte2; 1827#define SSD_FORWARDED_FSDT 0x80 1828#define SSD_FORWARDED_SDS_MASK 0x0f 1829#define SSD_FORWARDED_SDS_UNK 0x00 1830#define SSD_FORWARDED_SDS_EXSRC 0x01 1831#define SSD_FORWARDED_SDS_EXDST 0x02 1832}; 1833 1834/* 1835 * Vendor-specific sense descriptor. The desc_type field will be in the 1836 * range bewteen MIN and MAX inclusive. 1837 */ 1838struct scsi_sense_vendor 1839{ 1840 uint8_t desc_type; 1841#define SSD_DESC_VENDOR_MIN 0x80 1842#define SSD_DESC_VENDOR_MAX 0xff 1843 uint8_t length; 1844 uint8_t data[0]; 1845}; 1846 |
|
1170struct scsi_mode_header_6 1171{ 1172 u_int8_t data_length; /* Sense data length */ 1173 u_int8_t medium_type; 1174 u_int8_t dev_spec; 1175 u_int8_t blk_desc_len; 1176}; 1177 --- 4 unchanged lines hidden (view full) --- 1182 u_int8_t dev_spec; 1183 u_int8_t unused[2]; 1184 u_int8_t blk_desc_len[2]; 1185}; 1186 1187struct scsi_mode_page_header 1188{ 1189 u_int8_t page_code; | 1847struct scsi_mode_header_6 1848{ 1849 u_int8_t data_length; /* Sense data length */ 1850 u_int8_t medium_type; 1851 u_int8_t dev_spec; 1852 u_int8_t blk_desc_len; 1853}; 1854 --- 4 unchanged lines hidden (view full) --- 1859 u_int8_t dev_spec; 1860 u_int8_t unused[2]; 1861 u_int8_t blk_desc_len[2]; 1862}; 1863 1864struct scsi_mode_page_header 1865{ 1866 u_int8_t page_code; |
1867#define SMPH_PS 0x80 1868#define SMPH_SPF 0x40 1869#define SMPH_PC_MASK 0x3f |
|
1190 u_int8_t page_length; 1191}; 1192 | 1870 u_int8_t page_length; 1871}; 1872 |
1873struct scsi_mode_page_header_sp 1874{ 1875 uint8_t page_code; 1876 uint8_t subpage; 1877 uint8_t page_length[2]; 1878}; 1879 1880 |
|
1193struct scsi_mode_blk_desc 1194{ 1195 u_int8_t density; 1196 u_int8_t nblocks[3]; 1197 u_int8_t reserved; 1198 u_int8_t blklen[3]; 1199}; 1200 --- 86 unchanged lines hidden (view full) --- 1287__BEGIN_DECLS 1288void scsi_sense_desc(int sense_key, int asc, int ascq, 1289 struct scsi_inquiry_data *inq_data, 1290 const char **sense_key_desc, const char **asc_desc); 1291scsi_sense_action scsi_error_action(struct ccb_scsiio* csio, 1292 struct scsi_inquiry_data *inq_data, 1293 u_int32_t sense_flags); 1294const char * scsi_status_string(struct ccb_scsiio *csio); | 1881struct scsi_mode_blk_desc 1882{ 1883 u_int8_t density; 1884 u_int8_t nblocks[3]; 1885 u_int8_t reserved; 1886 u_int8_t blklen[3]; 1887}; 1888 --- 86 unchanged lines hidden (view full) --- 1975__BEGIN_DECLS 1976void scsi_sense_desc(int sense_key, int asc, int ascq, 1977 struct scsi_inquiry_data *inq_data, 1978 const char **sense_key_desc, const char **asc_desc); 1979scsi_sense_action scsi_error_action(struct ccb_scsiio* csio, 1980 struct scsi_inquiry_data *inq_data, 1981 u_int32_t sense_flags); 1982const char * scsi_status_string(struct ccb_scsiio *csio); |
1983 1984void scsi_desc_iterate(struct scsi_sense_data_desc *sense, u_int sense_len, 1985 int (*iter_func)(struct scsi_sense_data_desc *sense, 1986 u_int, struct scsi_sense_desc_header *, 1987 void *), void *arg); 1988uint8_t *scsi_find_desc(struct scsi_sense_data_desc *sense, u_int sense_len, 1989 uint8_t desc_type); 1990void scsi_set_sense_data(struct scsi_sense_data *sense_data, 1991 scsi_sense_data_type sense_format, int current_error, 1992 int sense_key, int asc, int ascq, ...) ; 1993void scsi_set_sense_data_va(struct scsi_sense_data *sense_data, 1994 scsi_sense_data_type sense_format, 1995 int current_error, int sense_key, int asc, 1996 int ascq, va_list ap); 1997int scsi_get_sense_info(struct scsi_sense_data *sense_data, u_int sense_len, 1998 uint8_t info_type, uint64_t *info, 1999 int64_t *signed_info); 2000int scsi_get_sks(struct scsi_sense_data *sense_data, u_int sense_len, 2001 uint8_t *sks); 2002int scsi_get_block_info(struct scsi_sense_data *sense_data, u_int sense_len, 2003 struct scsi_inquiry_data *inq_data, 2004 uint8_t *block_bits); 2005int scsi_get_stream_info(struct scsi_sense_data *sense_data, u_int sense_len, 2006 struct scsi_inquiry_data *inq_data, 2007 uint8_t *stream_bits); 2008void scsi_info_sbuf(struct sbuf *sb, uint8_t *cdb, int cdb_len, 2009 struct scsi_inquiry_data *inq_data, uint64_t info); 2010void scsi_command_sbuf(struct sbuf *sb, uint8_t *cdb, int cdb_len, 2011 struct scsi_inquiry_data *inq_data, uint64_t csi); 2012void scsi_progress_sbuf(struct sbuf *sb, uint16_t progress); 2013int scsi_sks_sbuf(struct sbuf *sb, int sense_key, uint8_t *sks); 2014void scsi_fru_sbuf(struct sbuf *sb, uint64_t fru); 2015void scsi_stream_sbuf(struct sbuf *sb, uint8_t stream_bits, uint64_t info); 2016void scsi_block_sbuf(struct sbuf *sb, uint8_t block_bits, uint64_t info); 2017void scsi_sense_info_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, 2018 u_int sense_len, uint8_t *cdb, int cdb_len, 2019 struct scsi_inquiry_data *inq_data, 2020 struct scsi_sense_desc_header *header); 2021 2022void scsi_sense_command_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, 2023 u_int sense_len, uint8_t *cdb, int cdb_len, 2024 struct scsi_inquiry_data *inq_data, 2025 struct scsi_sense_desc_header *header); 2026void scsi_sense_sks_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, 2027 u_int sense_len, uint8_t *cdb, int cdb_len, 2028 struct scsi_inquiry_data *inq_data, 2029 struct scsi_sense_desc_header *header); 2030void scsi_sense_fru_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, 2031 u_int sense_len, uint8_t *cdb, int cdb_len, 2032 struct scsi_inquiry_data *inq_data, 2033 struct scsi_sense_desc_header *header); 2034void scsi_sense_stream_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, 2035 u_int sense_len, uint8_t *cdb, int cdb_len, 2036 struct scsi_inquiry_data *inq_data, 2037 struct scsi_sense_desc_header *header); 2038void scsi_sense_block_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, 2039 u_int sense_len, uint8_t *cdb, int cdb_len, 2040 struct scsi_inquiry_data *inq_data, 2041 struct scsi_sense_desc_header *header); 2042void scsi_sense_progress_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, 2043 u_int sense_len, uint8_t *cdb, int cdb_len, 2044 struct scsi_inquiry_data *inq_data, 2045 struct scsi_sense_desc_header *header); 2046void scsi_sense_generic_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, 2047 u_int sense_len, uint8_t *cdb, int cdb_len, 2048 struct scsi_inquiry_data *inq_data, 2049 struct scsi_sense_desc_header *header); 2050void scsi_sense_desc_sbuf(struct sbuf *sb, struct scsi_sense_data *sense, 2051 u_int sense_len, uint8_t *cdb, int cdb_len, 2052 struct scsi_inquiry_data *inq_data, 2053 struct scsi_sense_desc_header *header); 2054scsi_sense_data_type scsi_sense_type(struct scsi_sense_data *sense_data); 2055 2056void scsi_sense_only_sbuf(struct scsi_sense_data *sense, u_int sense_len, 2057 struct sbuf *sb, char *path_str, 2058 struct scsi_inquiry_data *inq_data, uint8_t *cdb, 2059 int cdb_len); 2060 |
|
1295#ifdef _KERNEL 1296int scsi_command_string(struct ccb_scsiio *csio, struct sbuf *sb); 1297int scsi_sense_sbuf(struct ccb_scsiio *csio, struct sbuf *sb, 1298 scsi_sense_string_flags flags); 1299char * scsi_sense_string(struct ccb_scsiio *csio, 1300 char *str, int str_len); 1301void scsi_sense_print(struct ccb_scsiio *csio); 1302int scsi_interpret_sense(union ccb *ccb, --- 189 unchanged lines hidden (view full) --- 1492 int immediate, u_int8_t sense_len, u_int32_t timeout); 1493 1494int scsi_inquiry_match(caddr_t inqbuffer, caddr_t table_entry); 1495int scsi_static_inquiry_match(caddr_t inqbuffer, 1496 caddr_t table_entry); 1497int scsi_devid_match(uint8_t *rhs, size_t rhs_len, 1498 uint8_t *lhs, size_t lhs_len); 1499 | 2061#ifdef _KERNEL 2062int scsi_command_string(struct ccb_scsiio *csio, struct sbuf *sb); 2063int scsi_sense_sbuf(struct ccb_scsiio *csio, struct sbuf *sb, 2064 scsi_sense_string_flags flags); 2065char * scsi_sense_string(struct ccb_scsiio *csio, 2066 char *str, int str_len); 2067void scsi_sense_print(struct ccb_scsiio *csio); 2068int scsi_interpret_sense(union ccb *ccb, --- 189 unchanged lines hidden (view full) --- 2258 int immediate, u_int8_t sense_len, u_int32_t timeout); 2259 2260int scsi_inquiry_match(caddr_t inqbuffer, caddr_t table_entry); 2261int scsi_static_inquiry_match(caddr_t inqbuffer, 2262 caddr_t table_entry); 2263int scsi_devid_match(uint8_t *rhs, size_t rhs_len, 2264 uint8_t *lhs, size_t lhs_len); 2265 |
1500static __inline void scsi_extract_sense(struct scsi_sense_data *sense, 1501 int *error_code, int *sense_key, 1502 int *asc, int *ascq); | 2266void scsi_extract_sense(struct scsi_sense_data *sense, int *error_code, 2267 int *sense_key, int *asc, int *ascq); 2268void scsi_extract_sense_len(struct scsi_sense_data *sense, 2269 u_int sense_len, int *error_code, int *sense_key, 2270 int *asc, int *ascq, int show_errors); 2271int scsi_get_sense_key(struct scsi_sense_data *sense, u_int sense_len, 2272 int show_errors); 2273int scsi_get_asc(struct scsi_sense_data *sense, u_int sense_len, 2274 int show_errors); 2275int scsi_get_ascq(struct scsi_sense_data *sense, u_int sense_len, 2276 int show_errors); |
1503static __inline void scsi_ulto2b(u_int32_t val, u_int8_t *bytes); 1504static __inline void scsi_ulto3b(u_int32_t val, u_int8_t *bytes); 1505static __inline void scsi_ulto4b(u_int32_t val, u_int8_t *bytes); 1506static __inline void scsi_u64to8b(u_int64_t val, u_int8_t *bytes); | 2277static __inline void scsi_ulto2b(u_int32_t val, u_int8_t *bytes); 2278static __inline void scsi_ulto3b(u_int32_t val, u_int8_t *bytes); 2279static __inline void scsi_ulto4b(u_int32_t val, u_int8_t *bytes); 2280static __inline void scsi_u64to8b(u_int64_t val, u_int8_t *bytes); |
1507static __inline u_int32_t scsi_2btoul(u_int8_t *bytes); 1508static __inline u_int32_t scsi_3btoul(u_int8_t *bytes); 1509static __inline int32_t scsi_3btol(u_int8_t *bytes); 1510static __inline u_int32_t scsi_4btoul(u_int8_t *bytes); 1511static __inline u_int64_t scsi_8btou64(u_int8_t *bytes); | 2281static __inline uint32_t scsi_2btoul(const uint8_t *bytes); 2282static __inline uint32_t scsi_3btoul(const uint8_t *bytes); 2283static __inline int32_t scsi_3btol(const uint8_t *bytes); 2284static __inline uint32_t scsi_4btoul(const uint8_t *bytes); 2285static __inline uint64_t scsi_8btou64(const uint8_t *bytes); |
1512static __inline void *find_mode_page_6(struct scsi_mode_header_6 *mode_header); 1513static __inline void *find_mode_page_10(struct scsi_mode_header_10 *mode_header); 1514 | 2286static __inline void *find_mode_page_6(struct scsi_mode_header_6 *mode_header); 2287static __inline void *find_mode_page_10(struct scsi_mode_header_10 *mode_header); 2288 |
1515static __inline void scsi_extract_sense(struct scsi_sense_data *sense, 1516 int *error_code, int *sense_key, 1517 int *asc, int *ascq) 1518{ 1519 *error_code = sense->error_code & SSD_ERRCODE; 1520 *sense_key = sense->flags & SSD_KEY; 1521 *asc = (sense->extra_len >= 5) ? sense->add_sense_code : 0; 1522 *ascq = (sense->extra_len >= 6) ? sense->add_sense_code_qual : 0; 1523} 1524 | |
1525static __inline void 1526scsi_ulto2b(u_int32_t val, u_int8_t *bytes) 1527{ 1528 1529 bytes[0] = (val >> 8) & 0xff; 1530 bytes[1] = val & 0xff; 1531} 1532 --- 25 unchanged lines hidden (view full) --- 1558 bytes[2] = (val >> 40) & 0xff; 1559 bytes[3] = (val >> 32) & 0xff; 1560 bytes[4] = (val >> 24) & 0xff; 1561 bytes[5] = (val >> 16) & 0xff; 1562 bytes[6] = (val >> 8) & 0xff; 1563 bytes[7] = val & 0xff; 1564} 1565 | 2289static __inline void 2290scsi_ulto2b(u_int32_t val, u_int8_t *bytes) 2291{ 2292 2293 bytes[0] = (val >> 8) & 0xff; 2294 bytes[1] = val & 0xff; 2295} 2296 --- 25 unchanged lines hidden (view full) --- 2322 bytes[2] = (val >> 40) & 0xff; 2323 bytes[3] = (val >> 32) & 0xff; 2324 bytes[4] = (val >> 24) & 0xff; 2325 bytes[5] = (val >> 16) & 0xff; 2326 bytes[6] = (val >> 8) & 0xff; 2327 bytes[7] = val & 0xff; 2328} 2329 |
1566static __inline u_int32_t 1567scsi_2btoul(u_int8_t *bytes) | 2330static __inline uint32_t 2331scsi_2btoul(const uint8_t *bytes) |
1568{ | 2332{ |
1569 u_int32_t rv; | 2333 uint32_t rv; |
1570 1571 rv = (bytes[0] << 8) | 1572 bytes[1]; 1573 return (rv); 1574} 1575 | 2334 2335 rv = (bytes[0] << 8) | 2336 bytes[1]; 2337 return (rv); 2338} 2339 |
1576static __inline u_int32_t 1577scsi_3btoul(u_int8_t *bytes) | 2340static __inline uint32_t 2341scsi_3btoul(const uint8_t *bytes) |
1578{ | 2342{ |
1579 u_int32_t rv; | 2343 uint32_t rv; |
1580 1581 rv = (bytes[0] << 16) | 1582 (bytes[1] << 8) | 1583 bytes[2]; 1584 return (rv); 1585} 1586 1587static __inline int32_t | 2344 2345 rv = (bytes[0] << 16) | 2346 (bytes[1] << 8) | 2347 bytes[2]; 2348 return (rv); 2349} 2350 2351static __inline int32_t |
1588scsi_3btol(u_int8_t *bytes) | 2352scsi_3btol(const uint8_t *bytes) |
1589{ | 2353{ |
1590 u_int32_t rc = scsi_3btoul(bytes); | 2354 uint32_t rc = scsi_3btoul(bytes); |
1591 1592 if (rc & 0x00800000) 1593 rc |= 0xff000000; 1594 1595 return (int32_t) rc; 1596} 1597 | 2355 2356 if (rc & 0x00800000) 2357 rc |= 0xff000000; 2358 2359 return (int32_t) rc; 2360} 2361 |
1598static __inline u_int32_t 1599scsi_4btoul(u_int8_t *bytes) | 2362static __inline uint32_t 2363scsi_4btoul(const uint8_t *bytes) |
1600{ | 2364{ |
1601 u_int32_t rv; | 2365 uint32_t rv; |
1602 1603 rv = (bytes[0] << 24) | 1604 (bytes[1] << 16) | 1605 (bytes[2] << 8) | 1606 bytes[3]; 1607 return (rv); 1608} 1609 1610static __inline uint64_t | 2366 2367 rv = (bytes[0] << 24) | 2368 (bytes[1] << 16) | 2369 (bytes[2] << 8) | 2370 bytes[3]; 2371 return (rv); 2372} 2373 2374static __inline uint64_t |
1611scsi_8btou64(uint8_t *bytes) | 2375scsi_8btou64(const uint8_t *bytes) |
1612{ 1613 uint64_t rv; 1614 1615 rv = (((uint64_t)bytes[0]) << 56) | 1616 (((uint64_t)bytes[1]) << 48) | 1617 (((uint64_t)bytes[2]) << 40) | 1618 (((uint64_t)bytes[3]) << 32) | 1619 (((uint64_t)bytes[4]) << 24) | --- 35 unchanged lines hidden --- | 2376{ 2377 uint64_t rv; 2378 2379 rv = (((uint64_t)bytes[0]) << 56) | 2380 (((uint64_t)bytes[1]) << 48) | 2381 (((uint64_t)bytes[2]) << 40) | 2382 (((uint64_t)bytes[3]) << 32) | 2383 (((uint64_t)bytes[4]) << 24) | --- 35 unchanged lines hidden --- |