l$ ._$ ..m$ ..install.cmdn$.installo$scsi_netlink_fc.hp$ scsi_bsg_fc.hq$ sg.hr$ scsi_ioctl.hs$scsi.ht$scsi_netlink.hu$Dfccmd_/usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux/include/scsi/.install := perl scripts/headers_install.pl /usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux-2.6.37.2/include/scsi /usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux/include/scsi x86 scsi_bsg_fc.h scsi_netlink.h scsi_netlink_fc.h; perl scripts/headers_install.pl /usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux-2.6.37.2/include/scsi /usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux/include/scsi x86 ; touch /usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux/include/scsi/.install /* * FC Transport Netlink Interface * * Copyright (C) 2006 James Smart, Emulex Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef SCSI_NETLINK_FC_H #define SCSI_NETLINK_FC_H #include /* * This file intended to be included by both kernel and user space */ /* * FC Transport Message Types */ /* kernel -> user */ #define FC_NL_ASYNC_EVENT 0x0100 /* user -> kernel */ /* none */ /* * Message Structures : */ /* macro to round up message lengths to 8byte boundary */ #define FC_NL_MSGALIGN(len) (((len) + 7) & ~7) /* * FC Transport Broadcast Event Message : * FC_NL_ASYNC_EVENT * * Note: if Vendor Unique message, &event_data will be start of * vendor unique payload, and the length of the payload is * per event_datalen * * Note: When specifying vendor_id, be sure to read the Vendor Type and ID * formatting requirements specified in scsi_netlink.h */ struct fc_nl_event { struct scsi_nl_hdr snlh; /* must be 1st element ! */ uint64_t seconds; uint64_t vendor_id; uint16_t host_no; uint16_t event_datalen; uint32_t event_num; uint32_t event_code; uint32_t event_data; } __attribute__((aligned(sizeof(uint64_t)))); #endif /* SCSI_NETLINK_FC_H */ /* * FC Transport BSG Interface * * Copyright (C) 2008 James Smart, Emulex Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef SCSI_BSG_FC_H #define SCSI_BSG_FC_H /* * This file intended to be included by both kernel and user space */ #include /* * FC Transport SGIO v4 BSG Message Support */ /* Default BSG request timeout (in seconds) */ #define FC_DEFAULT_BSG_TIMEOUT (10 * HZ) /* * Request Message Codes supported by the FC Transport */ /* define the class masks for the message codes */ #define FC_BSG_CLS_MASK 0xF0000000 /* find object class */ #define FC_BSG_HST_MASK 0x80000000 /* fc host class */ #define FC_BSG_RPT_MASK 0x40000000 /* fc rport class */ /* fc_host Message Codes */ #define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001) #define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002) #define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003) #define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004) #define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF) /* fc_rport Message Codes */ #define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001) #define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002) /* * FC Address Identifiers in Message Structures : * * Whenever a command payload contains a FC Address Identifier * (aka port_id), the value is effectively in big-endian * order, thus the array elements are decoded as follows: * element [0] is bits 23:16 of the FC Address Identifier * element [1] is bits 15:8 of the FC Address Identifier * element [2] is bits 7:0 of the FC Address Identifier */ /* * FC Host Messages */ /* FC_BSG_HST_ADDR_PORT : */ /* Request: * This message requests the FC host to login to the remote port * at the specified N_Port_Id. The remote port is to be enumerated * with the transport upon completion of the login. */ struct fc_bsg_host_add_rport { uint8_t reserved; /* FC Address Identier of the remote port to login to */ uint8_t port_id[3]; }; /* Response: * There is no additional response data - fc_bsg_reply->result is sufficient */ /* FC_BSG_HST_DEL_RPORT : */ /* Request: * This message requests the FC host to remove an enumerated * remote port and to terminate the login to it. * * Note: The driver is free to reject this request if it desires to * remain logged in with the remote port. */ struct fc_bsg_host_del_rport { uint8_t reserved; /* FC Address Identier of the remote port to logout of */ uint8_t port_id[3]; }; /* Response: * There is no additional response data - fc_bsg_reply->result is sufficient */ /* FC_BSG_HST_ELS_NOLOGIN : */ /* Request: * This message requests the FC_Host to send an ELS to a specific * N_Port_ID. The host does not need to log into the remote port, * nor does it need to enumerate the rport for further traffic * (although, the FC host is free to do so if it desires). */ struct fc_bsg_host_els { /* * ELS Command Code being sent (must be the same as byte 0 * of the payload) */ uint8_t command_code; /* FC Address Identier of the remote port to send the ELS to */ uint8_t port_id[3]; }; /* Response: */ /* fc_bsg_ctels_reply->status values */ #define FC_CTELS_STATUS_OK 0x00000000 #define FC_CTELS_STATUS_REJECT 0x00000001 #define FC_CTELS_STATUS_P_RJT 0x00000002 #define FC_CTELS_STATUS_F_RJT 0x00000003 #define FC_CTELS_STATUS_P_BSY 0x00000004 #define FC_CTELS_STATUS_F_BSY 0x00000006 struct fc_bsg_ctels_reply { /* * Note: An ELS LS_RJT may be reported in 2 ways: * a) A status of FC_CTELS_STATUS_OK is returned. The caller * is to look into the ELS receive payload to determine * LS_ACC or LS_RJT (by contents of word 0). The reject * data will be in word 1. * b) A status of FC_CTELS_STATUS_REJECT is returned, The * rjt_data field will contain valid data. * * Note: ELS LS_ACC is determined by an FC_CTELS_STATUS_OK, and * the receive payload word 0 indicates LS_ACC * (e.g. value is 0x02xxxxxx). * * Note: Similarly, a CT Reject may be reported in 2 ways: * a) A status of FC_CTELS_STATUS_OK is returned. The caller * is to look into the CT receive payload to determine * Accept or Reject (by contents of word 2). The reject * data will be in word 3. * b) A status of FC_CTELS_STATUS_REJECT is returned, The * rjt_data field will contain valid data. * * Note: x_RJT/BSY status will indicae that the rjt_data field * is valid and contains the reason/explanation values. */ uint32_t status; /* See FC_CTELS_STATUS_xxx */ /* valid if status is not FC_CTELS_STATUS_OK */ struct { uint8_t action; /* fragment_id for CT REJECT */ uint8_t reason_code; uint8_t reason_explanation; uint8_t vendor_unique; } rjt_data; }; /* FC_BSG_HST_CT : */ /* Request: * This message requests that a CT Request be performed with the * indicated N_Port_ID. The driver is responsible for logging in with * the fabric and/or N_Port_ID, etc as per FC rules. This request does * not mandate that the driver must enumerate the destination in the * transport. The driver is allowed to decide whether to enumerate it, * and whether to tear it down after the request. */ struct fc_bsg_host_ct { uint8_t reserved; /* FC Address Identier of the remote port to send the ELS to */ uint8_t port_id[3]; /* * We need words 0-2 of the generic preamble for the LLD's */ uint32_t preamble_word0; /* revision & IN_ID */ uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */ uint32_t preamble_word2; /* Cmd Code, Max Size */ }; /* Response: * * The reply structure is an fc_bsg_ctels_reply structure */ /* FC_BSG_HST_VENDOR : */ /* Request: * Note: When specifying vendor_id, be sure to read the Vendor Type and ID * formatting requirements specified in scsi_netlink.h */ struct fc_bsg_host_vendor { /* * Identifies the vendor that the message is formatted for. This * should be the recipient of the message. */ uint64_t vendor_id; /* start of vendor command area */ uint32_t vendor_cmd[0]; }; /* Response: */ struct fc_bsg_host_vendor_reply { /* start of vendor response area */ uint32_t vendor_rsp[0]; }; /* * FC Remote Port Messages */ /* FC_BSG_RPT_ELS : */ /* Request: * This message requests that an ELS be performed with the rport. */ struct fc_bsg_rport_els { /* * ELS Command Code being sent (must be the same as * byte 0 of the payload) */ uint8_t els_code; }; /* Response: * * The reply structure is an fc_bsg_ctels_reply structure */ /* FC_BSG_RPT_CT : */ /* Request: * This message requests that a CT Request be performed with the rport. */ struct fc_bsg_rport_ct { /* * We need words 0-2 of the generic preamble for the LLD's */ uint32_t preamble_word0; /* revision & IN_ID */ uint32_t preamble_word1; /* GS_Type, GS_SubType, Options, Rsvd */ uint32_t preamble_word2; /* Cmd Code, Max Size */ }; /* Response: * * The reply structure is an fc_bsg_ctels_reply structure */ /* request (CDB) structure of the sg_io_v4 */ struct fc_bsg_request { uint32_t msgcode; union { struct fc_bsg_host_add_rport h_addrport; struct fc_bsg_host_del_rport h_delrport; struct fc_bsg_host_els h_els; struct fc_bsg_host_ct h_ct; struct fc_bsg_host_vendor h_vendor; struct fc_bsg_rport_els r_els; struct fc_bsg_rport_ct r_ct; } rqst_data; } __attribute__((packed)); /* response (request sense data) structure of the sg_io_v4 */ struct fc_bsg_reply { /* * The completion result. Result exists in two forms: * if negative, it is an -Exxx system errno value. There will * be no further reply information supplied. * else, it's the 4-byte scsi error result, with driver, host, * msg and status fields. The per-msgcode reply structure * will contain valid data. */ uint32_t result; /* If there was reply_payload, how much was recevied ? */ uint32_t reply_payload_rcv_len; union { struct fc_bsg_host_vendor_reply vendor_reply; struct fc_bsg_ctels_reply ctels_reply; } reply_data; }; #endif /* SCSI_BSG_FC_H */ /* Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* History: Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user process control of SCSI devices. Development Sponsored by Killy Corp. NY NY */ #ifndef _SCSI_SG_H #define _SCSI_SG_H 1 #include /* New interface introduced in the 3.x SG drivers follows */ /* Same structure as used by readv() Linux system call. It defines one scatter-gather element. */ typedef struct sg_iovec { void * iov_base; /* Starting address */ size_t iov_len; /* Length in bytes */ } sg_iovec_t; typedef struct sg_io_hdr { int interface_id; /* [i] 'S' for SCSI generic (required) */ int dxfer_direction; /* [i] data transfer direction */ unsigned char cmd_len; /* [i] SCSI command length ( <= 16 bytes) */ unsigned char mx_sb_len; /* [i] max length to write to sbp */ unsigned short int iovec_count; /* [i] 0 implies no scatter gather */ unsigned int dxfer_len; /* [i] byte count of data transfer */ void * dxferp; /* [i], [*io] points to data transfer memory or scatter gather list */ unsigned char * cmdp; /* [i], [*i] points to command to perform */ unsigned char * sbp; /* [i], [*o] points to sense_buffer memory */ unsigned int timeout; /* [i] MAX_UINT->no timeout (unit: millisec) */ unsigned int flags; /* [i] 0 -> default, see SG_FLAG... */ int pack_id; /* [i->o] unused internally (normally) */ void * usr_ptr; /* [i->o] unused internally */ unsigned char status; /* [o] scsi status */ unsigned char masked_status;/* [o] shifted, masked scsi status */ unsigned char msg_status; /* [o] messaging level data (optional) */ unsigned char sb_len_wr; /* [o] byte count actually written to sbp */ unsigned short int host_status; /* [o] errors from host adapter */ unsigned short int driver_status;/* [o] errors from software driver */ int resid; /* [o] dxfer_len - actual_transferred */ unsigned int duration; /* [o] time taken by cmd (unit: millisec) */ unsigned int info; /* [o] auxiliary information */ } sg_io_hdr_t; /* Use negative values to flag difference from original sg_header structure. */ #define SG_DXFER_NONE -1 /* e.g. a SCSI Test Unit Ready command */ #define SG_DXFER_TO_DEV -2 /* e.g. a SCSI WRITE command */ #define SG_DXFER_FROM_DEV -3 /* e.g. a SCSI READ command */ #define SG_DXFER_TO_FROM_DEV -4 /* treated like SG_DXFER_FROM_DEV with the additional property than during indirect IO the user buffer is copied into the kernel buffers before the transfer */ /* following flag values can be "or"-ed together */ #define SG_FLAG_DIRECT_IO 1 /* default is indirect IO */ #define SG_FLAG_LUN_INHIBIT 2 /* default is to put device's lun into */ /* the 2nd byte of SCSI command */ #define SG_FLAG_NO_DXFER 0x10000 /* no transfer of kernel buffers to/from */ /* user space (debug indirect IO) */ /* The following 'info' values are "or"-ed together. */ #define SG_INFO_OK_MASK 0x1 #define SG_INFO_OK 0x0 /* no sense, host nor driver "noise" */ #define SG_INFO_CHECK 0x1 /* something abnormal happened */ #define SG_INFO_DIRECT_IO_MASK 0x6 #define SG_INFO_INDIRECT_IO 0x0 /* data xfer via kernel buffers (or no xfer) */ #define SG_INFO_DIRECT_IO 0x2 /* direct IO requested and performed */ #define SG_INFO_MIXED_IO 0x4 /* part direct, part indirect IO */ /* Request information about a specific SG device, used by SG_GET_SCSI_ID ioctl (). */ struct sg_scsi_id { /* Host number as in "scsi" where 'n' is one of 0, 1, 2 etc. */ int host_no; int channel; /* SCSI id of target device. */ int scsi_id; int lun; /* TYPE_... defined in . */ int scsi_type; /* Host (adapter) maximum commands per lun. */ short int h_cmd_per_lun; /* Device (or adapter) maximum queue length. */ short int d_queue_depth; /* Unused, set to 0 for now. */ int unused[2]; }; /* Used by SG_GET_REQUEST_TABLE ioctl(). */ typedef struct sg_req_info { char req_state; /* 0 -> not used, 1 -> written, 2 -> ready to read */ char orphan; /* 0 -> normal request, 1 -> from interruped SG_IO */ char sg_io_owned; /* 0 -> complete with read(), 1 -> owned by SG_IO */ char problem; /* 0 -> no problem detected, 1 -> error to report */ int pack_id; /* pack_id associated with request */ void * usr_ptr; /* user provided pointer (in new interface) */ unsigned int duration; /* millisecs elapsed since written (req_state==1) or request duration (req_state==2) */ int unused; } sg_req_info_t; /* IOCTLs: Those ioctls that are relevant to the SG 3.x drivers follow. [Those that only apply to the SG 2.x drivers are at the end of the file.] (_GET_s yield result via 'int *' 3rd argument unless otherwise indicated) */ #define SG_EMULATED_HOST 0x2203 /* true for emulated host adapter (ATAPI) */ /* Used to configure SCSI command transformation layer for ATAPI devices */ /* Only supported by the ide-scsi driver */ #define SG_SET_TRANSFORM 0x2204 /* N.B. 3rd arg is not pointer but value: */ /* 3rd arg = 0 to disable transform, 1 to enable it */ #define SG_GET_TRANSFORM 0x2205 #define SG_SET_RESERVED_SIZE 0x2275 /* request a new reserved buffer size */ #define SG_GET_RESERVED_SIZE 0x2272 /* actual size of reserved buffer */ /* The following ioctl has a 'sg_scsi_id_t *' object as its 3rd argument. */ #define SG_GET_SCSI_ID 0x2276 /* Yields fd's bus, chan, dev, lun + type */ /* SCSI id information can also be obtained from SCSI_IOCTL_GET_IDLUN */ /* Override host setting and always DMA using low memory ( <16MB on i386) */ #define SG_SET_FORCE_LOW_DMA 0x2279 /* 0-> use adapter setting, 1-> force */ #define SG_GET_LOW_DMA 0x227a /* 0-> use all ram for dma; 1-> low dma ram */ /* When SG_SET_FORCE_PACK_ID set to 1, pack_id is input to read() which tries to fetch a packet with a matching pack_id, waits, or returns EAGAIN. If pack_id is -1 then read oldest waiting. When ...FORCE_PACK_ID set to 0 then pack_id ignored by read() and oldest readable fetched. */ #define SG_SET_FORCE_PACK_ID 0x227b #define SG_GET_PACK_ID 0x227c /* Yields oldest readable pack_id (or -1) */ #define SG_GET_NUM_WAITING 0x227d /* Number of commands awaiting read() */ /* Yields max scatter gather tablesize allowed by current host adapter */ #define SG_GET_SG_TABLESIZE 0x227F /* 0 implies can't do scatter gather */ #define SG_GET_VERSION_NUM 0x2282 /* Example: version 2.1.34 yields 20134 */ /* Returns -EBUSY if occupied. 3rd argument pointer to int (see next) */ #define SG_SCSI_RESET 0x2284 /* Associated values that can be given to SG_SCSI_RESET follow */ #define SG_SCSI_RESET_NOTHING 0 #define SG_SCSI_RESET_DEVICE 1 #define SG_SCSI_RESET_BUS 2 #define SG_SCSI_RESET_HOST 3 /* synchronous SCSI command ioctl, (only in version 3 interface) */ #define SG_IO 0x2285 /* similar effect as write() followed by read() */ #define SG_GET_REQUEST_TABLE 0x2286 /* yields table of active requests */ /* How to treat EINTR during SG_IO ioctl(), only in SG 3.x series */ #define SG_SET_KEEP_ORPHAN 0x2287 /* 1 -> hold for read(), 0 -> drop (def) */ #define SG_GET_KEEP_ORPHAN 0x2288 #define SG_SCATTER_SZ (8 * 4096) /* PAGE_SIZE not available to user */ /* Largest size (in bytes) a single scatter-gather list element can have. The value must be a power of 2 and <= (PAGE_SIZE * 32) [131072 bytes on i386]. The minimum value is PAGE_SIZE. If scatter-gather not supported by adapter then this value is the largest data block that can be read/written by a single scsi command. The user can find the value of PAGE_SIZE by calling getpagesize() defined in unistd.h . */ #define SG_DEFAULT_RETRIES 1 /* Defaults, commented if they differ from original sg driver */ #define SG_DEF_FORCE_LOW_DMA 0 /* was 1 -> memory below 16MB on i386 */ #define SG_DEF_FORCE_PACK_ID 0 #define SG_DEF_KEEP_ORPHAN 0 #define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ /* load time option */ /* maximum outstanding requests, write() yields EDOM if exceeded */ #define SG_MAX_QUEUE 16 #define SG_BIG_BUFF SG_DEF_RESERVED_SIZE /* for backward compatibility */ /* Alternate style type names, "..._t" variants preferred */ typedef struct sg_io_hdr Sg_io_hdr; typedef struct sg_io_vec Sg_io_vec; typedef struct sg_scsi_id Sg_scsi_id; typedef struct sg_req_info Sg_req_info; /* vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ /* The older SG interface based on the 'sg_header' structure follows. */ /* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */ #define SG_MAX_SENSE 16 /* this only applies to the sg_header interface */ struct sg_header { /* Length of incoming packet (including header). */ int pack_len; /* Maximal length of expected reply. */ int reply_len; /* Id number of packet. */ int pack_id; /* 0==ok, otherwise error number. */ int result; /* Force 12 byte command length for group 6 & 7 commands. */ unsigned int twelve_byte:1; /* SCSI status from target. */ unsigned int target_status:5; /* Host status (see "DID" codes). */ unsigned int host_status:8; /* Driver status+suggestion. */ unsigned int driver_status:8; /* Unused. */ unsigned int other_flags:10; /* Output in 3 cases: when target_status is CHECK_CONDITION or when target_status is COMMAND_TERMINATED or when (driver_status & DRIVER_SENSE) is true. */ unsigned char sense_buffer[SG_MAX_SENSE]; }; /* IOCTLs: The following are not required (or ignored) when the sg_io_hdr_t interface is used. They are kept for backward compatibility with the original and version 2 drivers. */ #define SG_SET_TIMEOUT 0x2201 /* Set timeout; *(int *)arg==timeout. */ #define SG_GET_TIMEOUT 0x2202 /* Get timeout; return timeout. */ /* Get/set command queuing state per fd (default is SG_DEF_COMMAND_Q). */ #define SG_GET_COMMAND_Q 0x2270 /* Yields 0 (queuing off) or 1 (on). */ #define SG_SET_COMMAND_Q 0x2271 /* Change queuing state with 0 or 1. */ /* Turn on error sense trace (1..8), dump this device to log/console (9) or dump all sg device states ( >9 ) to log/console. */ #define SG_SET_DEBUG 0x227e /* 0 -> turn off debug */ #define SG_NEXT_CMD_LEN 0x2283 /* Override SCSI command length with given number on the next write() on this file descriptor. */ /* Defaults, commented if they differ from original sg driver */ #define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */ #define SG_DEF_COMMAND_Q 0 /* command queuing is always on when the new interface is used */ #define SG_DEF_UNDERRUN_FLAG 0 #endif /* scsi/sg.h */ /* Copyright (C) 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _SCSI_IOCTL_H #define _SCSI_IOCTL_H /* IOCTLs for SCSI. */ #define SCSI_IOCTL_SEND_COMMAND 1 /* Send a command to the SCSI host. */ #define SCSI_IOCTL_TEST_UNIT_READY 2 /* Test if unit is ready. */ #define SCSI_IOCTL_BENCHMARK_COMMAND 3 #define SCSI_IOCTL_SYNC 4 /* Request synchronous parameters. */ #define SCSI_IOCTL_START_UNIT 5 #define SCSI_IOCTL_STOP_UNIT 6 #define SCSI_IOCTL_DOORLOCK 0x5380 /* Lock the eject mechanism. */ #define SCSI_IOCTL_DOORUNLOCK 0x5381 /* Unlock the mechanism. */ #endif /* Copyright (C) 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* * This header file contains public constants and structures used by * the scsi code for linux. */ #ifndef _SCSI_SCSI_H #define _SCSI_SCSI_H 1 #include /* * SCSI opcodes */ #define TEST_UNIT_READY 0x00 #define REZERO_UNIT 0x01 #define REQUEST_SENSE 0x03 #define FORMAT_UNIT 0x04 #define READ_BLOCK_LIMITS 0x05 #define REASSIGN_BLOCKS 0x07 #define READ_6 0x08 #define WRITE_6 0x0a #define SEEK_6 0x0b #define READ_REVERSE 0x0f #define WRITE_FILEMARKS 0x10 #define SPACE 0x11 #define INQUIRY 0x12 #define RECOVER_BUFFERED_DATA 0x14 #define MODE_SELECT 0x15 #define RESERVE 0x16 #define RELEASE 0x17 #define COPY 0x18 #define ERASE 0x19 #define MODE_SENSE 0x1a #define START_STOP 0x1b #define RECEIVE_DIAGNOSTIC 0x1c #define SEND_DIAGNOSTIC 0x1d #define ALLOW_MEDIUM_REMOVAL 0x1e #define SET_WINDOW 0x24 #define READ_CAPACITY 0x25 #define READ_10 0x28 #define WRITE_10 0x2a #define SEEK_10 0x2b #define WRITE_VERIFY 0x2e #define VERIFY 0x2f #define SEARCH_HIGH 0x30 #define SEARCH_EQUAL 0x31 #define SEARCH_LOW 0x32 #define SET_LIMITS 0x33 #define PRE_FETCH 0x34 #define READ_POSITION 0x34 #define SYNCHRONIZE_CACHE 0x35 #define LOCK_UNLOCK_CACHE 0x36 #define READ_DEFECT_DATA 0x37 #define MEDIUM_SCAN 0x38 #define COMPARE 0x39 #define COPY_VERIFY 0x3a #define WRITE_BUFFER 0x3b #define READ_BUFFER 0x3c #define UPDATE_BLOCK 0x3d #define READ_LONG 0x3e #define WRITE_LONG 0x3f #define CHANGE_DEFINITION 0x40 #define WRITE_SAME 0x41 #define READ_TOC 0x43 #define LOG_SELECT 0x4c #define LOG_SENSE 0x4d #define MODE_SELECT_10 0x55 #define RESERVE_10 0x56 #define RELEASE_10 0x57 #define MODE_SENSE_10 0x5a #define PERSISTENT_RESERVE_IN 0x5e #define PERSISTENT_RESERVE_OUT 0x5f #define MOVE_MEDIUM 0xa5 #define READ_12 0xa8 #define WRITE_12 0xaa #define WRITE_VERIFY_12 0xae #define SEARCH_HIGH_12 0xb0 #define SEARCH_EQUAL_12 0xb1 #define SEARCH_LOW_12 0xb2 #define READ_ELEMENT_STATUS 0xb8 #define SEND_VOLUME_TAG 0xb6 #define WRITE_LONG_2 0xea /* * Status codes */ #define GOOD 0x00 #define CHECK_CONDITION 0x01 #define CONDITION_GOOD 0x02 #define BUSY 0x04 #define INTERMEDIATE_GOOD 0x08 #define INTERMEDIATE_C_GOOD 0x0a #define RESERVATION_CONFLICT 0x0c #define COMMAND_TERMINATED 0x11 #define QUEUE_FULL 0x14 #define STATUS_MASK 0x3e /* * SENSE KEYS */ #define NO_SENSE 0x00 #define RECOVERED_ERROR 0x01 #define NOT_READY 0x02 #define MEDIUM_ERROR 0x03 #define HARDWARE_ERROR 0x04 #define ILLEGAL_REQUEST 0x05 #define UNIT_ATTENTION 0x06 #define DATA_PROTECT 0x07 #define BLANK_CHECK 0x08 #define COPY_ABORTED 0x0a #define ABORTED_COMMAND 0x0b #define VOLUME_OVERFLOW 0x0d #define MISCOMPARE 0x0e /* * DEVICE TYPES */ #define TYPE_DISK 0x00 #define TYPE_TAPE 0x01 #define TYPE_PROCESSOR 0x03 /* HP scanners use this */ #define TYPE_WORM 0x04 /* Treated as ROM by our system */ #define TYPE_ROM 0x05 #define TYPE_SCANNER 0x06 #define TYPE_MOD 0x07 /* Magneto-optical disk - * - treated as TYPE_DISK */ #define TYPE_MEDIUM_CHANGER 0x08 #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ #define TYPE_NO_LUN 0x7f /* * standard mode-select header prepended to all mode-select commands * * moved here from cdrom.h -- kraxel */ struct ccs_modesel_head { unsigned char _r1; /* reserved. */ unsigned char medium; /* device-specific medium type. */ unsigned char _r2; /* reserved. */ unsigned char block_desc_length; /* block descriptor length. */ unsigned char density; /* device-specific density code. */ unsigned char number_blocks_hi; /* number of blocks in this block desc. */ unsigned char number_blocks_med; unsigned char number_blocks_lo; unsigned char _r3; unsigned char block_length_hi; /* block length for blocks in this desc. */ unsigned char block_length_med; unsigned char block_length_lo; }; /* * MESSAGE CODES */ #define COMMAND_COMPLETE 0x00 #define EXTENDED_MESSAGE 0x01 #define EXTENDED_MODIFY_DATA_POINTER 0x00 #define EXTENDED_SDTR 0x01 #define EXTENDED_EXTENDED_IDENTIFY 0x02 /* SCSI-I only */ #define EXTENDED_WDTR 0x03 #define SAVE_POINTERS 0x02 #define RESTORE_POINTERS 0x03 #define DISCONNECT 0x04 #define INITIATOR_ERROR 0x05 #define ABORT 0x06 #define MESSAGE_REJECT 0x07 #define NOP 0x08 #define MSG_PARITY_ERROR 0x09 #define LINKED_CMD_COMPLETE 0x0a #define LINKED_FLG_CMD_COMPLETE 0x0b #define BUS_DEVICE_RESET 0x0c #define INITIATE_RECOVERY 0x0f /* SCSI-II only */ #define RELEASE_RECOVERY 0x10 /* SCSI-II only */ #define SIMPLE_QUEUE_TAG 0x20 #define HEAD_OF_QUEUE_TAG 0x21 #define ORDERED_QUEUE_TAG 0x22 /* * Here are some scsi specific ioctl commands which are sometimes useful. */ /* These are a few other constants only used by scsi devices. */ #define SCSI_IOCTL_GET_IDLUN 0x5382 /* Used to turn on and off tagged queuing for scsi devices. */ #define SCSI_IOCTL_TAGGED_ENABLE 0x5383 #define SCSI_IOCTL_TAGGED_DISABLE 0x5384 /* Used to obtain the host number of a device. */ #define SCSI_IOCTL_PROBE_HOST 0x5385 /* Used to get the bus number for a device. */ #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 #endif /* scsi/scsi.h */ /* * SCSI Transport Netlink Interface * Used for the posting of outbound SCSI transport events * * Copyright (C) 2006 James Smart, Emulex Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #ifndef SCSI_NETLINK_H #define SCSI_NETLINK_H #include /* * This file intended to be included by both kernel and user space */ /* Single Netlink Message type to send all SCSI Transport messages */ #define SCSI_TRANSPORT_MSG NLMSG_MIN_TYPE + 1 /* SCSI Transport Broadcast Groups */ /* leaving groups 0 and 1 unassigned */ #define SCSI_NL_GRP_FC_EVENTS (1<<2) /* Group 2 */ #define SCSI_NL_GRP_CNT 3 /* SCSI_TRANSPORT_MSG event message header */ struct scsi_nl_hdr { uint8_t version; uint8_t transport; uint16_t magic; uint16_t msgtype; uint16_t msglen; } __attribute__((aligned(sizeof(uint64_t)))); /* scsi_nl_hdr->version value */ #define SCSI_NL_VERSION 1 /* scsi_nl_hdr->magic value */ #define SCSI_NL_MAGIC 0xA1B2 /* scsi_nl_hdr->transport value */ #define SCSI_NL_TRANSPORT 0 #define SCSI_NL_TRANSPORT_FC 1 #define SCSI_NL_MAX_TRANSPORTS 2 /* Transport-based scsi_nl_hdr->msgtype values are defined in each transport */ /* * GENERIC SCSI scsi_nl_hdr->msgtype Values */ /* kernel -> user */ #define SCSI_NL_SHOST_VENDOR 0x0001 /* user -> kernel */ /* SCSI_NL_SHOST_VENDOR msgtype is kernel->user and user->kernel */ /* * Message Structures : */ /* macro to round up message lengths to 8byte boundary */ #define SCSI_NL_MSGALIGN(len) (((len) + 7) & ~7) /* * SCSI HOST Vendor Unique messages : * SCSI_NL_SHOST_VENDOR * * Note: The Vendor Unique message payload will begin directly after * this structure, with the length of the payload per vmsg_datalen. * * Note: When specifying vendor_id, be sure to read the Vendor Type and ID * formatting requirements specified below */ struct scsi_nl_host_vendor_msg { struct scsi_nl_hdr snlh; /* must be 1st element ! */ uint64_t vendor_id; uint16_t host_no; uint16_t vmsg_datalen; } __attribute__((aligned(sizeof(uint64_t)))); /* * Vendor ID: * If transports post vendor-unique events, they must pass a well-known * 32-bit vendor identifier. This identifier consists of 8 bits indicating * the "type" of identifier contained, and 24 bits of id data. * * Identifiers for each type: * PCI : ID data is the 16 bit PCI Registered Vendor ID */ #define SCSI_NL_VID_TYPE_SHIFT 56 #define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT) #define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) #define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK) #define INIT_SCSI_NL_HDR(hdr, t, mtype, mlen) \ { \ (hdr)->version = SCSI_NL_VERSION; \ (hdr)->transport = t; \ (hdr)->magic = SCSI_NL_MAGIC; \ (hdr)->msgtype = mtype; \ (hdr)->msglen = mlen; \ } #endif /* SCSI_NETLINK_H */ u$ .l$ ..v$ ..install.cmdw$.installx$fc_els.hy$fc_fs.hz$fc_gs.h{$fc_ns.hcmd_/usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux/include/scsi/fc/.install := perl scripts/headers_install.pl /usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux-2.6.37.2/include/scsi/fc /usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux/include/scsi/fc x86 fc_els.h fc_fs.h fc_gs.h fc_ns.h; perl scripts/headers_install.pl /usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux-2.6.37.2/include/scsi/fc /usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux/include/scsi/fc x86 ; touch /usr/local/home/bellard/cpux86/rootdisk/buildroot-2011.02/output/toolchain/linux/include/scsi/fc/.install /* * Copyright(c) 2007 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. * * Maintained at www.Open-FCoE.org */ #ifndef _FC_ELS_H_ #define _FC_ELS_H_ #include /* * Fibre Channel Switch - Enhanced Link Services definitions. * From T11 FC-LS Rev 1.2 June 7, 2005. */ /* * ELS Command codes - byte 0 of the frame payload */ enum fc_els_cmd { ELS_LS_RJT = 0x01, /* ESL reject */ ELS_LS_ACC = 0x02, /* ESL Accept */ ELS_PLOGI = 0x03, /* N_Port login */ ELS_FLOGI = 0x04, /* F_Port login */ ELS_LOGO = 0x05, /* Logout */ ELS_ABTX = 0x06, /* Abort exchange - obsolete */ ELS_RCS = 0x07, /* read connection status */ ELS_RES = 0x08, /* read exchange status block */ ELS_RSS = 0x09, /* read sequence status block */ ELS_RSI = 0x0a, /* read sequence initiative */ ELS_ESTS = 0x0b, /* establish streaming */ ELS_ESTC = 0x0c, /* estimate credit */ ELS_ADVC = 0x0d, /* advise credit */ ELS_RTV = 0x0e, /* read timeout value */ ELS_RLS = 0x0f, /* read link error status block */ ELS_ECHO = 0x10, /* echo */ ELS_TEST = 0x11, /* test */ ELS_RRQ = 0x12, /* reinstate recovery qualifier */ ELS_REC = 0x13, /* read exchange concise */ ELS_SRR = 0x14, /* sequence retransmission request */ ELS_PRLI = 0x20, /* process login */ ELS_PRLO = 0x21, /* process logout */ ELS_SCN = 0x22, /* state change notification */ ELS_TPLS = 0x23, /* test process login state */ ELS_TPRLO = 0x24, /* third party process logout */ ELS_LCLM = 0x25, /* login control list mgmt (obs) */ ELS_GAID = 0x30, /* get alias_ID */ ELS_FACT = 0x31, /* fabric activate alias_id */ ELS_FDACDT = 0x32, /* fabric deactivate alias_id */ ELS_NACT = 0x33, /* N-port activate alias_id */ ELS_NDACT = 0x34, /* N-port deactivate alias_id */ ELS_QOSR = 0x40, /* quality of service request */ ELS_RVCS = 0x41, /* read virtual circuit status */ ELS_PDISC = 0x50, /* discover N_port service params */ ELS_FDISC = 0x51, /* discover F_port service params */ ELS_ADISC = 0x52, /* discover address */ ELS_RNC = 0x53, /* report node cap (obs) */ ELS_FARP_REQ = 0x54, /* FC ARP request */ ELS_FARP_REPL = 0x55, /* FC ARP reply */ ELS_RPS = 0x56, /* read port status block */ ELS_RPL = 0x57, /* read port list */ ELS_RPBC = 0x58, /* read port buffer condition */ ELS_FAN = 0x60, /* fabric address notification */ ELS_RSCN = 0x61, /* registered state change notification */ ELS_SCR = 0x62, /* state change registration */ ELS_RNFT = 0x63, /* report node FC-4 types */ ELS_CSR = 0x68, /* clock synch. request */ ELS_CSU = 0x69, /* clock synch. update */ ELS_LINIT = 0x70, /* loop initialize */ ELS_LSTS = 0x72, /* loop status */ ELS_RNID = 0x78, /* request node ID data */ ELS_RLIR = 0x79, /* registered link incident report */ ELS_LIRR = 0x7a, /* link incident record registration */ ELS_SRL = 0x7b, /* scan remote loop */ ELS_SBRP = 0x7c, /* set bit-error reporting params */ ELS_RPSC = 0x7d, /* report speed capabilities */ ELS_QSA = 0x7e, /* query security attributes */ ELS_EVFP = 0x7f, /* exchange virt. fabrics params */ ELS_LKA = 0x80, /* link keep-alive */ ELS_AUTH_ELS = 0x90, /* authentication ELS */ }; /* * Initializer useful for decoding table. * Please keep this in sync with the above definitions. */ #define FC_ELS_CMDS_INIT { \ [ELS_LS_RJT] = "LS_RJT", \ [ELS_LS_ACC] = "LS_ACC", \ [ELS_PLOGI] = "PLOGI", \ [ELS_FLOGI] = "FLOGI", \ [ELS_LOGO] = "LOGO", \ [ELS_ABTX] = "ABTX", \ [ELS_RCS] = "RCS", \ [ELS_RES] = "RES", \ [ELS_RSS] = "RSS", \ [ELS_RSI] = "RSI", \ [ELS_ESTS] = "ESTS", \ [ELS_ESTC] = "ESTC", \ [ELS_ADVC] = "ADVC", \ [ELS_RTV] = "RTV", \ [ELS_RLS] = "RLS", \ [ELS_ECHO] = "ECHO", \ [ELS_TEST] = "TEST", \ [ELS_RRQ] = "RRQ", \ [ELS_REC] = "REC", \ [ELS_SRR] = "SRR", \ [ELS_PRLI] = "PRLI", \ [ELS_PRLO] = "PRLO", \ [ELS_SCN] = "SCN", \ [ELS_TPLS] = "TPLS", \ [ELS_TPRLO] = "TPRLO", \ [ELS_LCLM] = "LCLM", \ [ELS_GAID] = "GAID", \ [ELS_FACT] = "FACT", \ [ELS_FDACDT] = "FDACDT", \ [ELS_NACT] = "NACT", \ [ELS_NDACT] = "NDACT", \ [ELS_QOSR] = "QOSR", \ [ELS_RVCS] = "RVCS", \ [ELS_PDISC] = "PDISC", \ [ELS_FDISC] = "FDISC", \ [ELS_ADISC] = "ADISC", \ [ELS_RNC] = "RNC", \ [ELS_FARP_REQ] = "FARP_REQ", \ [ELS_FARP_REPL] = "FARP_REPL", \ [ELS_RPS] = "RPS", \ [ELS_RPL] = "RPL", \ [ELS_RPBC] = "RPBC", \ [ELS_FAN] = "FAN", \ [ELS_RSCN] = "RSCN", \ [ELS_SCR] = "SCR", \ [ELS_RNFT] = "RNFT", \ [ELS_CSR] = "CSR", \ [ELS_CSU] = "CSU", \ [ELS_LINIT] = "LINIT", \ [ELS_LSTS] = "LSTS", \ [ELS_RNID] = "RNID", \ [ELS_RLIR] = "RLIR", \ [ELS_LIRR] = "LIRR", \ [ELS_SRL] = "SRL", \ [ELS_SBRP] = "SBRP", \ [ELS_RPSC] = "RPSC", \ [ELS_QSA] = "QSA", \ [ELS_EVFP] = "EVFP", \ [ELS_LKA] = "LKA", \ [ELS_AUTH_ELS] = "AUTH_ELS", \ } /* * LS_ACC payload. */ struct fc_els_ls_acc { __u8 la_cmd; /* command code ELS_LS_ACC */ __u8 la_resv[3]; /* reserved */ }; /* * ELS reject payload. */ struct fc_els_ls_rjt { __u8 er_cmd; /* command code ELS_LS_RJT */ __u8 er_resv[4]; /* reserved must be zero */ __u8 er_reason; /* reason (enum fc_els_rjt_reason below) */ __u8 er_explan; /* explanation (enum fc_els_rjt_explan below) */ __u8 er_vendor; /* vendor specific code */ }; /* * ELS reject reason codes (er_reason). */ enum fc_els_rjt_reason { ELS_RJT_NONE = 0, /* no reject - not to be sent */ ELS_RJT_INVAL = 0x01, /* invalid ELS command code */ ELS_RJT_LOGIC = 0x03, /* logical error */ ELS_RJT_BUSY = 0x05, /* logical busy */ ELS_RJT_PROT = 0x07, /* protocol error */ ELS_RJT_UNAB = 0x09, /* unable to perform command request */ ELS_RJT_UNSUP = 0x0b, /* command not supported */ ELS_RJT_INPROG = 0x0e, /* command already in progress */ ELS_RJT_FIP = 0x20, /* FIP error */ ELS_RJT_VENDOR = 0xff, /* vendor specific error */ }; /* * reason code explanation (er_explan). */ enum fc_els_rjt_explan { ELS_EXPL_NONE = 0x00, /* No additional explanation */ ELS_EXPL_SPP_OPT_ERR = 0x01, /* service parameter error - options */ ELS_EXPL_SPP_ICTL_ERR = 0x03, /* service parm error - initiator ctl */ ELS_EXPL_AH = 0x11, /* invalid association header */ ELS_EXPL_AH_REQ = 0x13, /* association_header required */ ELS_EXPL_SID = 0x15, /* invalid originator S_ID */ ELS_EXPL_OXID_RXID = 0x17, /* invalid OX_ID-RX_ID combination */ ELS_EXPL_INPROG = 0x19, /* Request already in progress */ ELS_EXPL_PLOGI_REQD = 0x1e, /* N_Port login required */ ELS_EXPL_INSUF_RES = 0x29, /* insufficient resources */ ELS_EXPL_UNAB_DATA = 0x2a, /* unable to supply requested data */ ELS_EXPL_UNSUPR = 0x2c, /* Request not supported */ ELS_EXPL_INV_LEN = 0x2d, /* Invalid payload length */ ELS_EXPL_NOT_NEIGHBOR = 0x62, /* VN2VN_Port not in neighbor set */ /* TBD - above definitions incomplete */ }; /* * Common service parameters (N ports). */ struct fc_els_csp { __u8 sp_hi_ver; /* highest version supported (obs.) */ __u8 sp_lo_ver; /* highest version supported (obs.) */ __be16 sp_bb_cred; /* buffer-to-buffer credits */ __be16 sp_features; /* common feature flags */ __be16 sp_bb_data; /* b-b state number and data field sz */ union { struct { __be16 _sp_tot_seq; /* total concurrent sequences */ __be16 _sp_rel_off; /* rel. offset by info cat */ } sp_plogi; struct { __be32 _sp_r_a_tov; /* resource alloc. timeout msec */ } sp_flogi_acc; } sp_u; __be32 sp_e_d_tov; /* error detect timeout value */ }; #define sp_tot_seq sp_u.sp_plogi._sp_tot_seq #define sp_rel_off sp_u.sp_plogi._sp_rel_off #define sp_r_a_tov sp_u.sp_flogi_acc._sp_r_a_tov #define FC_SP_BB_DATA_MASK 0xfff /* mask for data field size in sp_bb_data */ /* * Minimum and maximum values for max data field size in service parameters. */ #define FC_SP_MIN_MAX_PAYLOAD FC_MIN_MAX_PAYLOAD #define FC_SP_MAX_MAX_PAYLOAD FC_MAX_PAYLOAD /* * sp_features */ #define FC_SP_FT_NPIV 0x8000 /* multiple N_Port_ID support (FLOGI) */ #define FC_SP_FT_CIRO 0x8000 /* continuously increasing rel off (PLOGI) */ #define FC_SP_FT_CLAD 0x8000 /* clean address (in FLOGI LS_ACC) */ #define FC_SP_FT_RAND 0x4000 /* random relative offset */ #define FC_SP_FT_VAL 0x2000 /* valid vendor version level */ #define FC_SP_FT_NPIV_ACC 0x2000 /* NPIV assignment (FLOGI LS_ACC) */ #define FC_SP_FT_FPORT 0x1000 /* F port (1) vs. N port (0) */ #define FC_SP_FT_ABB 0x0800 /* alternate BB_credit management */ #define FC_SP_FT_EDTR 0x0400 /* E_D_TOV Resolution is nanoseconds */ #define FC_SP_FT_MCAST 0x0200 /* multicast */ #define FC_SP_FT_BCAST 0x0100 /* broadcast */ #define FC_SP_FT_HUNT 0x0080 /* hunt group */ #define FC_SP_FT_SIMP 0x0040 /* dedicated simplex */ #define FC_SP_FT_SEC 0x0020 /* reserved for security */ #define FC_SP_FT_CSYN 0x0010 /* clock synch. supported */ #define FC_SP_FT_RTTOV 0x0008 /* R_T_TOV value 100 uS, else 100 mS */ #define FC_SP_FT_HALF 0x0004 /* dynamic half duplex */ #define FC_SP_FT_SEQC 0x0002 /* SEQ_CNT */ #define FC_SP_FT_PAYL 0x0001 /* FLOGI payload length 256, else 116 */ /* * Class-specific service parameters. */ struct fc_els_cssp { __be16 cp_class; /* class flags */ __be16 cp_init; /* initiator flags */ __be16 cp_recip; /* recipient flags */ __be16 cp_rdfs; /* receive data field size */ __be16 cp_con_seq; /* concurrent sequences */ __be16 cp_ee_cred; /* N-port end-to-end credit */ __u8 cp_resv1; /* reserved */ __u8 cp_open_seq; /* open sequences per exchange */ __u8 _cp_resv2[2]; /* reserved */ }; /* * cp_class flags. */ #define FC_CPC_VALID 0x8000 /* class valid */ #define FC_CPC_IMIX 0x4000 /* intermix mode */ #define FC_CPC_SEQ 0x0800 /* sequential delivery */ #define FC_CPC_CAMP 0x0200 /* camp-on */ #define FC_CPC_PRI 0x0080 /* priority */ /* * cp_init flags. * (TBD: not all flags defined here). */ #define FC_CPI_CSYN 0x0010 /* clock synch. capable */ /* * cp_recip flags. */ #define FC_CPR_CSYN 0x0008 /* clock synch. capable */ /* * NFC_ELS_FLOGI: Fabric login request. * NFC_ELS_PLOGI: Port login request (same format). */ struct fc_els_flogi { __u8 fl_cmd; /* command */ __u8 _fl_resvd[3]; /* must be zero */ struct fc_els_csp fl_csp; /* common service parameters */ __be64 fl_wwpn; /* port name */ __be64 fl_wwnn; /* node name */ struct fc_els_cssp fl_cssp[4]; /* class 1-4 service parameters */ __u8 fl_vend[16]; /* vendor version level */ } __attribute__((__packed__)); /* * Process login service parameter page. */ struct fc_els_spp { __u8 spp_type; /* type code or common service params */ __u8 spp_type_ext; /* type code extension */ __u8 spp_flags; __u8 _spp_resvd; __be32 spp_orig_pa; /* originator process associator */ __be32 spp_resp_pa; /* responder process associator */ __be32 spp_params; /* service parameters */ }; /* * spp_flags. */ #define FC_SPP_OPA_VAL 0x80 /* originator proc. assoc. valid */ #define FC_SPP_RPA_VAL 0x40 /* responder proc. assoc. valid */ #define FC_SPP_EST_IMG_PAIR 0x20 /* establish image pair */ #define FC_SPP_RESP_MASK 0x0f /* mask for response code (below) */ /* * SPP response code in spp_flags - lower 4 bits. */ enum fc_els_spp_resp { FC_SPP_RESP_ACK = 1, /* request executed */ FC_SPP_RESP_RES = 2, /* unable due to lack of resources */ FC_SPP_RESP_INIT = 3, /* initialization not complete */ FC_SPP_RESP_NO_PA = 4, /* unknown process associator */ FC_SPP_RESP_CONF = 5, /* configuration precludes image pair */ FC_SPP_RESP_COND = 6, /* request completed conditionally */ FC_SPP_RESP_MULT = 7, /* unable to handle multiple SPPs */ FC_SPP_RESP_INVL = 8, /* SPP is invalid */ }; /* * ELS_R56789:;<=>?@ABRQ - Reinstate Recovery Qualifier */ struct fc_els_rrq { __u8 rrq_cmd; /* command (0x12) */ __u8 rrq_zero[3]; /* specified as zero - part of cmd */ __u8 rrq_resvd; /* reserved */ __u8 rrq_s_id[3]; /* originator FID */ __be16 rrq_ox_id; /* originator exchange ID */ __be16 rrq_rx_id; /* responders exchange ID */ }; /* * ELS_REC - Read exchange concise. */ struct fc_els_rec { __u8 rec_cmd; /* command (0x13) */ __u8 rec_zero[3]; /* specified as zero - part of cmd */ __u8 rec_resvd; /* reserved */ __u8 rec_s_id[3]; /* originator FID */ __be16 rec_ox_id; /* originator exchange ID */ __be16 rec_rx_id; /* responders exchange ID */ }; /* * ELS_REC LS_ACC payload. */ struct fc_els_rec_acc { __u8 reca_cmd; /* accept (0x02) */ __u8 reca_zero[3]; /* specified as zero - part of cmd */ __be16 reca_ox_id; /* originator exchange ID */ __be16 reca_rx_id; /* responders exchange ID */ __u8 reca_resvd1; /* reserved */ __u8 reca_ofid[3]; /* originator FID */ __u8 reca_resvd2; /* reserved */ __u8 reca_rfid[3]; /* responder FID */ __be32 reca_fc4value; /* FC4 value */ __be32 reca_e_stat; /* ESB (exchange status block) status */ }; /* * ELS_PRLI - Process login request and response. */ struct fc_els_prli { __u8 prli_cmd; /* command */ __u8 prli_spp_len; /* length of each serv. parm. page */ __be16 prli_len; /* length of entire payload */ /* service parameter pages follow */ }; /* * ELS_PRLO - Process logout request and response. */ struct fc_els_prlo { __u8 prlo_cmd; /* command */ __u8 prlo_obs; /* obsolete, but shall be set to 10h */ __be16 prlo_len; /* payload length */ }; /* * ELS_ADISC payload */ struct fc_els_adisc { __u8 adisc_cmd; __u8 adisc_resv[3]; __u8 adisc_resv1; __u8 adisc_hard_addr[3]; __be64 adisc_wwpn; __be64 adisc_wwnn; __u8 adisc_resv2; __u8 adisc_port_id[3]; } __attribute__((__packed__)); /* * ELS_LOGO - process or fabric logout. */ struct fc_els_logo { __u8 fl_cmd; /* command code */ __u8 fl_zero[3]; /* specified as zero - part of cmd */ __u8 fl_resvd; /* reserved */ __u8 fl_n_port_id[3];/* N port ID */ __be64 fl_n_port_wwn; /* port name */ }; /* * ELS_RTV - read timeout value. */ struct fc_els_rtv { __u8 rtv_cmd; /* command code 0x0e */ __u8 rtv_zero[3]; /* specified as zero - part of cmd */ }; /* * LS_ACC for ELS_RTV - read timeout value. */ struct fc_els_rtv_acc { __u8 rtv_cmd; /* command code 0x02 */ __u8 rtv_zero[3]; /* specified as zero - part of cmd */ __be32 rtv_r_a_tov; /* resource allocation timeout value */ __be32 rtv_e_d_tov; /* error detection timeout value */ __be32 rtv_toq; /* timeout qualifier (see below) */ }; /* * rtv_toq bits. */ #define FC_ELS_RTV_EDRES (1 << 26) /* E_D_TOV resolution is nS else mS */ #define FC_ELS_RTV_RTTOV (1 << 19) /* R_T_TOV is 100 uS else 100 mS */ /* * ELS_SCR - state change registration payload. */ struct fc_els_scr { __u8 scr_cmd; /* command code */ __u8 scr_resv[6]; /* reserved */ __u8 scr_reg_func; /* registration function (see below) */ }; enum fc_els_scr_func { ELS_SCRF_FAB = 1, /* fabric-detected registration */ ELS_SCRF_NPORT = 2, /* Nx_Port-detected registration */ ELS_SCRF_FULL = 3, /* full registration */ ELS_SCRF_CLEAR = 255, /* remove any current registrations */ }; /* * ELS_RSCN - registered state change notification payload. */ struct fc_els_rscn { __u8 rscn_cmd; /* RSCN opcode (0x61) */ __u8 rscn_page_len; /* page length (4) */ __be16 rscn_plen; /* payload length including this word */ /* followed by 4-byte generic affected Port_ID pages */ }; struct fc_els_rscn_page { __u8 rscn_page_flags; /* event and address format */ __u8 rscn_fid[3]; /* fabric ID */ }; #define ELS_RSCN_EV_QUAL_BIT 2 /* shift count for event qualifier */ #define ELS_RSCN_EV_QUAL_MASK 0xf /* mask for event qualifier */ #define ELS_RSCN_ADDR_FMT_BIT 0 /* shift count for address format */ #define ELS_RSCN_ADDR_FMT_MASK 0x3 /* mask for address format */ enum fc_els_rscn_ev_qual { ELS_EV_QUAL_NONE = 0, /* unspecified */ ELS_EV_QUAL_NS_OBJ = 1, /* changed name server object */ ELS_EV_QUAL_PORT_ATTR = 2, /* changed port attribute */ ELS_EV_QUAL_SERV_OBJ = 3, /* changed service object */ ELS_EV_QUAL_SW_CONFIG = 4, /* changed switch configuration */ ELS_EV_QUAL_REM_OBJ = 5, /* removed object */ }; enum fc_els_rscn_addr_fmt { ELS_ADDR_FMT_PORT = 0, /* rscn_fid is a port address */ ELS_ADDR_FMT_AREA = 1, /* rscn_fid is a area address */ ELS_ADDR_FMT_DOM = 2, /* rscn_fid is a domain address */ ELS_ADDR_FMT_FAB = 3, /* anything on fabric may have changed */ }; /* * ELS_RNID - request Node ID. */ struct fc_els_rnid { __u8 rnid_cmd; /* RNID opcode (0x78) */ __u8 rnid_resv[3]; /* reserved */ __u8 rnid_fmt; /* data format */ __u8 rnid_resv2[3]; /* reserved */ }; /* * Node Identification Data formats (rnid_fmt) */ enum fc_els_rnid_fmt { ELS_RNIDF_NONE = 0, /* no specific identification data */ ELS_RNIDF_GEN = 0xdf, /* general topology discovery format */ }; /* * ELS_RNID response. */ struct fc_els_rnid_resp { __u8 rnid_cmd; /* response code (LS_ACC) */ __u8 rnid_resv[3]; /* reserved */ __u8 rnid_fmt; /* data format */ __u8 rnid_cid_len; /* common ID data length */ __u8 rnid_resv2; /* reserved */ __u8 rnid_sid_len; /* specific ID data length */ }; struct fc_els_rnid_cid { __be64 rnid_wwpn; /* N port name */ __be64 rnid_wwnn; /* node name */ }; struct fc_els_rnid_gen { __u8 rnid_vend_id[16]; /* vendor-unique ID */ __be32 rnid_atype; /* associated type (see below) */ __be32 rnid_phys_port; /* physical port number */ __be32 rnid_att_nodes; /* number of attached nodes */ __u8 rnid_node_mgmt; /* node management (see below) */ __u8 rnid_ip_ver; /* IP version (see below) */ __be16 rnid_prot_port; /* UDP / TCP port number */ __be32 rnid_ip_addr[4]; /* IP address */ __u8 rnid_resvd[2]; /* reserved */ __be16 rnid_vend_spec; /* vendor-specific field */ }; enum fc_els_rnid_atype { ELS_RNIDA_UNK = 0x01, /* unknown */ ELS_RNIDA_OTHER = 0x02, /* none of the following */ ELS_RNIDA_HUB = 0x03, ELS_RNIDA_SWITCH = 0x04, ELS_RNIDA_GATEWAY = 0x05, ELS_RNIDA_CONV = 0x06, /* Obsolete, do not use this value */ ELS_RNIDA_HBA = 0x07, /* Obsolete, do not use this value */ ELS_RNIDA_PROXY = 0x08, /* Obsolete, do not use this value */ ELS_RNIDA_STORAGE = 0x09, ELS_RNIDA_HOST = 0x0a, ELS_RNIDA_SUBSYS = 0x0b, /* storage subsystem (e.g., RAID) */ ELS_RNIDA_ACCESS = 0x0e, /* access device (e.g. media changer) */ ELS_RNIDA_NAS = 0x11, /* NAS server */ ELS_RNIDA_BRIDGE = 0x12, /* bridge */ ELS_RNIDA_VIRT = 0x13, /* virtualization device */ ELS_RNIDA_MF = 0xff, /* multifunction device (bits below) */ ELS_RNIDA_MF_HUB = 1UL << 31, /* hub */ ELS_RNIDA_MF_SW = 1UL << 30, /* switch */ ELS_RNIDA_MF_GW = 1UL << 29, /* gateway */ ELS_RNIDA_MF_ST = 1UL << 28, /* storage */ ELS_RNIDA_MF_HOST = 1UL << 27, /* host */ ELS_RNIDA_MF_SUB = 1UL << 26, /* storage subsystem */ ELS_RNIDA_MF_ACC = 1UL << 25, /* storage access dev */ ELS_RNIDA_MF_WDM = 1UL << 24, /* wavelength division mux */ ELS_RNIDA_MF_NAS = 1UL << 23, /* NAS server */ ELS_RNIDA_MF_BR = 1UL << 22, /* bridge */ ELS_RNIDA_MF_VIRT = 1UL << 21, /* virtualization device */ }; enum fc_els_rnid_mgmt { ELS_RNIDM_SNMP = 0, ELS_RNIDM_TELNET = 1, ELS_RNIDM_HTTP = 2, ELS_RNIDM_HTTPS = 3, ELS_RNIDM_XML = 4, /* HTTP + XML */ }; enum fc_els_rnid_ipver { ELS_RNIDIP_NONE = 0, /* no IP support or node mgmt. */ ELS_RNIDIP_V4 = 1, /* IPv4 */ ELS_RNIDIP_V6 = 2, /* IPv6 */ }; /* * ELS RPL - Read Port List. */ struct fc_els_rpl { __u8 rpl_cmd; /* command */ __u8 rpl_resv[5]; /* reserved - must be zero */ __be16 rpl_max_size; /* maximum response size or zero */ __u8 rpl_resv1; /* reserved - must be zero */ __u8 rpl_index[3]; /* starting index */ }; /* * Port number block in RPL response. */ struct fc_els_pnb { __be32 pnb_phys_pn; /* physical port number */ __u8 pnb_resv; /* reserved */ __u8 pnb_port_id[3]; /* port ID */ __be64 pnb_wwpn; /* port name */ }; /* * RPL LS_ACC response. */ struct fc_els_rpl_resp { __u8 rpl_cmd; /* ELS_LS_ACC */ __u8 rpl_resv1; /* reserved - must be zero */ __be16 rpl_plen; /* payload length */ __u8 rpl_resv2; /* reserved - must be zero */ __u8 rpl_llen[3]; /* list length */ __u8 rpl_resv3; /* reserved - must be zero */ __u8 rpl_index[3]; /* starting index */ struct fc_els_pnb rpl_pnb[1]; /* variable number of PNBs */ }; /* * Link Error Status Block. */ struct fc_els_lesb { __be32 lesb_link_fail; /* link failure count */ __be32 lesb_sync_loss; /* loss of synchronization count */ __be32 lesb_sig_loss; /* loss of signal count */ __be32 lesb_prim_err; /* primitive sequence error count */ __be32 lesb_inv_word; /* invalid transmission word count */ __be32 lesb_inv_crc; /* invalid CRC count */ }; /* * ELS RPS - Read Port Status Block request. */ struct fc_els_rps { __u8 rps_cmd; /* command */ __u8 rps_resv[2]; /* reserved - must be zero */ __u8 rps_flag; /* flag - see below */ __be64 rps_port_spec; /* port selection */ }; enum fc_els_rps_flag { FC_ELS_RPS_DID = 0x00, /* port identified by D_ID of req. */ FC_ELS_RPS_PPN = 0x01, /* port_spec is physical port number */ FC_ELS_RPS_WWPN = 0x02, /* port_spec is port WWN */ }; /* * ELS RPS LS_ACC response. */ struct fc_els_rps_resp { __u8 rps_cmd; /* command - LS_ACC */ __u8 rps_resv[2]; /* reserved - must be zero */ __u8 rps_flag; /* flag - see below */ __u8 rps_resv2[2]; /* reserved */ __be16 rps_status; /* port status - see below */ struct fc_els_lesb rps_lesb; /* link error status block */ }; enum fc_els_rps_resp_flag { FC_ELS_RPS_LPEV = 0x01, /* L_port extension valid */ }; enum fc_els_rps_resp_status { FC_ELS_RPS_PTP = 1 << 5, /* point-to-point connection */ FC_ELS_RPS_LOOP = 1 << 4, /* loop mode */ FC_ELS_RPS_FAB = 1 << 3, /* fabric present */ FC_ELS_RPS_NO_SIG = 1 << 2, /* loss of signal */ FC_ELS_RPS_NO_SYNC = 1 << 1, /* loss of synchronization */ FC_ELS_RPS_RESET = 1 << 0, /* in link reset protocol */ }; /* * ELS LIRR - Link Incident Record Registration request. */ struct fc_els_lirr { __u8 lirr_cmd; /* command */ __u8 lirr_resv[3]; /* reserved - must be zero */ __u8 lirr_func; /* registration function */ __u8 lirr_fmt; /* FC-4 type of RLIR requested */ __u8 lirr_resv2[2]; /* reserved - must be zero */ }; enum fc_els_lirr_func { ELS_LIRR_SET_COND = 0x01, /* set - conditionally receive */ ELS_LIRR_SET_UNCOND = 0x02, /* set - unconditionally receive */ ELS_LIRR_CLEAR = 0xff /* clear registration */ }; /* * ELS SRL - Scan Remote Loop request. */ struct fc_els_srl { __u8 srl_cmd; /* command */ __u8 srl_resv[3]; /* reserved - must be zero */ __u8 srl_flag; /* flag - see below */ __u8 srl_flag_param[3]; /* flag parameter */ }; enum fc_els_srl_flag { FC_ELS_SRL_ALL = 0x00, /* scan all FL ports */ FC_ELS_SRL_ONE = 0x01, /* scan specified loop */ FC_ELS_SRL_EN_PER = 0x02, /* enable periodic scanning (param) */ FC_ELS_SRL_DIS_PER = 0x03, /* disable periodic scanning */