aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/scsi.h10
-rw-r--r--include/scsi/scsi_cmnd.h14
-rw-r--r--include/scsi/scsi_transport_fc.h41
3 files changed, 32 insertions, 33 deletions
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index c60b8ff2f5e4..1bc675201413 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -25,13 +25,6 @@ extern const unsigned char scsi_command_size[8];
25#define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7] 25#define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7]
26 26
27/* 27/*
28 * SCSI device types
29 */
30
31#define MAX_SCSI_DEVICE_CODE 15
32extern const char *const scsi_device_types[MAX_SCSI_DEVICE_CODE];
33
34/*
35 * Special value for scanning to specify scanning or rescanning of all 28 * Special value for scanning to specify scanning or rescanning of all
36 * possible channels, (target) ids, or luns on a given shost. 29 * possible channels, (target) ids, or luns on a given shost.
37 */ 30 */
@@ -225,6 +218,9 @@ static inline int scsi_status_is_good(int status)
225#define TYPE_RBC 0x0e 218#define TYPE_RBC 0x0e
226#define TYPE_NO_LUN 0x7f 219#define TYPE_NO_LUN 0x7f
227 220
221/* Returns a human-readable name for the device */
222extern const char * scsi_device_type(unsigned type);
223
228/* 224/*
229 * standard mode-select header prepended to all mode-select commands 225 * standard mode-select header prepended to all mode-select commands
230 */ 226 */
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h
index 58e6444eebee..be117f812deb 100644
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -118,20 +118,6 @@ struct scsi_cmnd {
118 unsigned long pid; /* Process ID, starts at 0. Unique per host. */ 118 unsigned long pid; /* Process ID, starts at 0. Unique per host. */
119}; 119};
120 120
121/*
122 * These are the values that scsi_cmd->state can take.
123 */
124#define SCSI_STATE_TIMEOUT 0x1000
125#define SCSI_STATE_FINISHED 0x1001
126#define SCSI_STATE_FAILED 0x1002
127#define SCSI_STATE_QUEUED 0x1003
128#define SCSI_STATE_UNUSED 0x1006
129#define SCSI_STATE_DISCONNECTING 0x1008
130#define SCSI_STATE_INITIALIZING 0x1009
131#define SCSI_STATE_BHQUEUE 0x100a
132#define SCSI_STATE_MLQUEUE 0x100b
133
134
135extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t); 121extern struct scsi_cmnd *scsi_get_command(struct scsi_device *, gfp_t);
136extern void scsi_put_command(struct scsi_cmnd *); 122extern void scsi_put_command(struct scsi_cmnd *);
137extern void scsi_io_completion(struct scsi_cmnd *, unsigned int); 123extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 6d28b0317657..c74be5dabfeb 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -312,7 +312,6 @@ struct fc_host_attrs {
312 u64 permanent_port_name; 312 u64 permanent_port_name;
313 u32 supported_classes; 313 u32 supported_classes;
314 u8 supported_fc4s[FC_FC4_LIST_SIZE]; 314 u8 supported_fc4s[FC_FC4_LIST_SIZE];
315 char symbolic_name[FC_SYMBOLIC_NAME_SIZE];
316 u32 supported_speeds; 315 u32 supported_speeds;
317 u32 maxframe_size; 316 u32 maxframe_size;
318 char serial_number[FC_SERIAL_NUMBER_SIZE]; 317 char serial_number[FC_SERIAL_NUMBER_SIZE];
@@ -324,6 +323,8 @@ struct fc_host_attrs {
324 u8 active_fc4s[FC_FC4_LIST_SIZE]; 323 u8 active_fc4s[FC_FC4_LIST_SIZE];
325 u32 speed; 324 u32 speed;
326 u64 fabric_name; 325 u64 fabric_name;
326 char symbolic_name[FC_SYMBOLIC_NAME_SIZE];
327 char system_hostname[FC_SYMBOLIC_NAME_SIZE];
327 328
328 /* Private (Transport-managed) Attributes */ 329 /* Private (Transport-managed) Attributes */
329 enum fc_tgtid_binding_type tgtid_bind_type; 330 enum fc_tgtid_binding_type tgtid_bind_type;
@@ -354,8 +355,6 @@ struct fc_host_attrs {
354 (((struct fc_host_attrs *)(x)->shost_data)->supported_classes) 355 (((struct fc_host_attrs *)(x)->shost_data)->supported_classes)
355#define fc_host_supported_fc4s(x) \ 356#define fc_host_supported_fc4s(x) \
356 (((struct fc_host_attrs *)(x)->shost_data)->supported_fc4s) 357 (((struct fc_host_attrs *)(x)->shost_data)->supported_fc4s)
357#define fc_host_symbolic_name(x) \
358 (((struct fc_host_attrs *)(x)->shost_data)->symbolic_name)
359#define fc_host_supported_speeds(x) \ 358#define fc_host_supported_speeds(x) \
360 (((struct fc_host_attrs *)(x)->shost_data)->supported_speeds) 359 (((struct fc_host_attrs *)(x)->shost_data)->supported_speeds)
361#define fc_host_maxframe_size(x) \ 360#define fc_host_maxframe_size(x) \
@@ -374,6 +373,10 @@ struct fc_host_attrs {
374 (((struct fc_host_attrs *)(x)->shost_data)->speed) 373 (((struct fc_host_attrs *)(x)->shost_data)->speed)
375#define fc_host_fabric_name(x) \ 374#define fc_host_fabric_name(x) \
376 (((struct fc_host_attrs *)(x)->shost_data)->fabric_name) 375 (((struct fc_host_attrs *)(x)->shost_data)->fabric_name)
376#define fc_host_symbolic_name(x) \
377 (((struct fc_host_attrs *)(x)->shost_data)->symbolic_name)
378#define fc_host_system_hostname(x) \
379 (((struct fc_host_attrs *)(x)->shost_data)->system_hostname)
377#define fc_host_tgtid_bind_type(x) \ 380#define fc_host_tgtid_bind_type(x) \
378 (((struct fc_host_attrs *)(x)->shost_data)->tgtid_bind_type) 381 (((struct fc_host_attrs *)(x)->shost_data)->tgtid_bind_type)
379#define fc_host_rports(x) \ 382#define fc_host_rports(x) \
@@ -409,6 +412,8 @@ struct fc_function_template {
409 void (*get_host_active_fc4s)(struct Scsi_Host *); 412 void (*get_host_active_fc4s)(struct Scsi_Host *);
410 void (*get_host_speed)(struct Scsi_Host *); 413 void (*get_host_speed)(struct Scsi_Host *);
411 void (*get_host_fabric_name)(struct Scsi_Host *); 414 void (*get_host_fabric_name)(struct Scsi_Host *);
415 void (*get_host_symbolic_name)(struct Scsi_Host *);
416 void (*set_host_system_hostname)(struct Scsi_Host *);
412 417
413 struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *); 418 struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *);
414 void (*reset_fc_host_stats)(struct Scsi_Host *); 419 void (*reset_fc_host_stats)(struct Scsi_Host *);
@@ -445,7 +450,6 @@ struct fc_function_template {
445 unsigned long show_host_permanent_port_name:1; 450 unsigned long show_host_permanent_port_name:1;
446 unsigned long show_host_supported_classes:1; 451 unsigned long show_host_supported_classes:1;
447 unsigned long show_host_supported_fc4s:1; 452 unsigned long show_host_supported_fc4s:1;
448 unsigned long show_host_symbolic_name:1;
449 unsigned long show_host_supported_speeds:1; 453 unsigned long show_host_supported_speeds:1;
450 unsigned long show_host_maxframe_size:1; 454 unsigned long show_host_maxframe_size:1;
451 unsigned long show_host_serial_number:1; 455 unsigned long show_host_serial_number:1;
@@ -456,6 +460,8 @@ struct fc_function_template {
456 unsigned long show_host_active_fc4s:1; 460 unsigned long show_host_active_fc4s:1;
457 unsigned long show_host_speed:1; 461 unsigned long show_host_speed:1;
458 unsigned long show_host_fabric_name:1; 462 unsigned long show_host_fabric_name:1;
463 unsigned long show_host_symbolic_name:1;
464 unsigned long show_host_system_hostname:1;
459}; 465};
460 466
461 467
@@ -491,6 +497,25 @@ fc_remote_port_chkready(struct fc_rport *rport)
491 return result; 497 return result;
492} 498}
493 499
500static inline u64 wwn_to_u64(u8 *wwn)
501{
502 return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 |
503 (u64)wwn[2] << 40 | (u64)wwn[3] << 32 |
504 (u64)wwn[4] << 24 | (u64)wwn[5] << 16 |
505 (u64)wwn[6] << 8 | (u64)wwn[7];
506}
507
508static inline void u64_to_wwn(u64 inm, u8 *wwn)
509{
510 wwn[0] = (inm >> 56) & 0xff;
511 wwn[1] = (inm >> 48) & 0xff;
512 wwn[2] = (inm >> 40) & 0xff;
513 wwn[3] = (inm >> 32) & 0xff;
514 wwn[4] = (inm >> 24) & 0xff;
515 wwn[5] = (inm >> 16) & 0xff;
516 wwn[6] = (inm >> 8) & 0xff;
517 wwn[7] = inm & 0xff;
518}
494 519
495struct scsi_transport_template *fc_attach_transport( 520struct scsi_transport_template *fc_attach_transport(
496 struct fc_function_template *); 521 struct fc_function_template *);
@@ -502,12 +527,4 @@ void fc_remote_port_delete(struct fc_rport *rport);
502void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles); 527void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles);
503int scsi_is_fc_rport(const struct device *); 528int scsi_is_fc_rport(const struct device *);
504 529
505static inline u64 wwn_to_u64(u8 *wwn)
506{
507 return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 |
508 (u64)wwn[2] << 40 | (u64)wwn[3] << 32 |
509 (u64)wwn[4] << 24 | (u64)wwn[5] << 16 |
510 (u64)wwn[6] << 8 | (u64)wwn[7];
511}
512
513#endif /* SCSI_TRANSPORT_FC_H */ 530#endif /* SCSI_TRANSPORT_FC_H */