aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi_host.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/scsi_host.h')
-rw-r--r--include/scsi/scsi_host.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 81d5234f6771..916144be208b 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -429,12 +429,15 @@ struct scsi_host_template {
429}; 429};
430 430
431/* 431/*
432 * shost states 432 * shost state: If you alter this, you also need to alter scsi_sysfs.c
433 * (for the ascii descriptions) and the state model enforcer:
434 * scsi_host_set_state()
433 */ 435 */
434enum { 436enum scsi_host_state {
435 SHOST_ADD, 437 SHOST_CREATED = 1,
436 SHOST_DEL, 438 SHOST_RUNNING,
437 SHOST_CANCEL, 439 SHOST_CANCEL,
440 SHOST_DEL,
438 SHOST_RECOVERY, 441 SHOST_RECOVERY,
439}; 442};
440 443
@@ -464,12 +467,10 @@ struct Scsi_Host {
464 struct task_struct * ehandler; /* Error recovery thread. */ 467 struct task_struct * ehandler; /* Error recovery thread. */
465 struct semaphore * eh_wait; /* The error recovery thread waits 468 struct semaphore * eh_wait; /* The error recovery thread waits
466 on this. */ 469 on this. */
467 struct completion * eh_notify; /* wait for eh to begin or end */
468 struct semaphore * eh_action; /* Wait for specific actions on the 470 struct semaphore * eh_action; /* Wait for specific actions on the
469 host. */ 471 host. */
470 unsigned int eh_active:1; /* Indicates the eh thread is awake and active if 472 unsigned int eh_active:1; /* Indicates the eh thread is awake and active if
471 this is true. */ 473 this is true. */
472 unsigned int eh_kill:1; /* set when killing the eh thread */
473 wait_queue_head_t host_wait; 474 wait_queue_head_t host_wait;
474 struct scsi_host_template *hostt; 475 struct scsi_host_template *hostt;
475 struct scsi_transport_template *transportt; 476 struct scsi_transport_template *transportt;
@@ -575,7 +576,7 @@ struct Scsi_Host {
575 unsigned int irq; 576 unsigned int irq;
576 577
577 578
578 unsigned long shost_state; 579 enum scsi_host_state shost_state;
579 580
580 /* ldm bits */ 581 /* ldm bits */
581 struct device shost_gendev; 582 struct device shost_gendev;
@@ -633,6 +634,7 @@ extern void scsi_remove_host(struct Scsi_Host *);
633extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *); 634extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
634extern void scsi_host_put(struct Scsi_Host *t); 635extern void scsi_host_put(struct Scsi_Host *t);
635extern struct Scsi_Host *scsi_host_lookup(unsigned short); 636extern struct Scsi_Host *scsi_host_lookup(unsigned short);
637extern const char *scsi_host_state_name(enum scsi_host_state);
636 638
637extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); 639extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
638 640
@@ -646,6 +648,15 @@ static inline struct device *scsi_get_device(struct Scsi_Host *shost)
646 return shost->shost_gendev.parent; 648 return shost->shost_gendev.parent;
647} 649}
648 650
651/**
652 * scsi_host_scan_allowed - Is scanning of this host allowed
653 * @shost: Pointer to Scsi_Host.
654 **/
655static inline int scsi_host_scan_allowed(struct Scsi_Host *shost)
656{
657 return shost->shost_state == SHOST_RUNNING;
658}
659
649extern void scsi_unblock_requests(struct Scsi_Host *); 660extern void scsi_unblock_requests(struct Scsi_Host *);
650extern void scsi_block_requests(struct Scsi_Host *); 661extern void scsi_block_requests(struct Scsi_Host *);
651 662
@@ -663,5 +674,6 @@ extern struct scsi_device *scsi_get_host_dev(struct Scsi_Host *);
663/* legacy interfaces */ 674/* legacy interfaces */
664extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int); 675extern struct Scsi_Host *scsi_register(struct scsi_host_template *, int);
665extern void scsi_unregister(struct Scsi_Host *); 676extern void scsi_unregister(struct Scsi_Host *);
677extern int scsi_host_set_state(struct Scsi_Host *, enum scsi_host_state);
666 678
667#endif /* _SCSI_SCSI_HOST_H */ 679#endif /* _SCSI_SCSI_HOST_H */