diff options
Diffstat (limited to 'drivers/scsi/aic7xxx/aic79xx_osm.h')
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx_osm.h | 288 |
1 files changed, 30 insertions, 258 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index 7823e52e99ab..052c6619accc 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h | |||
@@ -42,6 +42,7 @@ | |||
42 | #ifndef _AIC79XX_LINUX_H_ | 42 | #ifndef _AIC79XX_LINUX_H_ |
43 | #define _AIC79XX_LINUX_H_ | 43 | #define _AIC79XX_LINUX_H_ |
44 | 44 | ||
45 | #include <linux/config.h> | ||
45 | #include <linux/types.h> | 46 | #include <linux/types.h> |
46 | #include <linux/blkdev.h> | 47 | #include <linux/blkdev.h> |
47 | #include <linux/delay.h> | 48 | #include <linux/delay.h> |
@@ -49,18 +50,23 @@ | |||
49 | #include <linux/pci.h> | 50 | #include <linux/pci.h> |
50 | #include <linux/smp_lock.h> | 51 | #include <linux/smp_lock.h> |
51 | #include <linux/version.h> | 52 | #include <linux/version.h> |
53 | #include <linux/interrupt.h> | ||
52 | #include <linux/module.h> | 54 | #include <linux/module.h> |
55 | #include <linux/slab.h> | ||
53 | #include <asm/byteorder.h> | 56 | #include <asm/byteorder.h> |
54 | #include <asm/io.h> | 57 | #include <asm/io.h> |
55 | 58 | ||
56 | #include <linux/interrupt.h> /* For tasklet support. */ | 59 | #include <scsi/scsi.h> |
57 | #include <linux/config.h> | 60 | #include <scsi/scsi_cmnd.h> |
58 | #include <linux/slab.h> | 61 | #include <scsi/scsi_eh.h> |
62 | #include <scsi/scsi_device.h> | ||
63 | #include <scsi/scsi_host.h> | ||
64 | #include <scsi/scsi_tcq.h> | ||
65 | #include <scsi/scsi_transport.h> | ||
66 | #include <scsi/scsi_transport_spi.h> | ||
59 | 67 | ||
60 | /* Core SCSI definitions */ | 68 | /* Core SCSI definitions */ |
61 | #define AIC_LIB_PREFIX ahd | 69 | #define AIC_LIB_PREFIX ahd |
62 | #include "scsi.h" | ||
63 | #include <scsi/scsi_host.h> | ||
64 | 70 | ||
65 | /* Name space conflict with BSD queue macros */ | 71 | /* Name space conflict with BSD queue macros */ |
66 | #ifdef LIST_HEAD | 72 | #ifdef LIST_HEAD |
@@ -95,7 +101,7 @@ | |||
95 | /************************* Forward Declarations *******************************/ | 101 | /************************* Forward Declarations *******************************/ |
96 | struct ahd_softc; | 102 | struct ahd_softc; |
97 | typedef struct pci_dev *ahd_dev_softc_t; | 103 | typedef struct pci_dev *ahd_dev_softc_t; |
98 | typedef Scsi_Cmnd *ahd_io_ctx_t; | 104 | typedef struct scsi_cmnd *ahd_io_ctx_t; |
99 | 105 | ||
100 | /******************************* Byte Order ***********************************/ | 106 | /******************************* Byte Order ***********************************/ |
101 | #define ahd_htobe16(x) cpu_to_be16(x) | 107 | #define ahd_htobe16(x) cpu_to_be16(x) |
@@ -114,8 +120,7 @@ typedef Scsi_Cmnd *ahd_io_ctx_t; | |||
114 | 120 | ||
115 | /************************* Configuration Data *********************************/ | 121 | /************************* Configuration Data *********************************/ |
116 | extern uint32_t aic79xx_allow_memio; | 122 | extern uint32_t aic79xx_allow_memio; |
117 | extern int aic79xx_detect_complete; | 123 | extern struct scsi_host_template aic79xx_driver_template; |
118 | extern Scsi_Host_Template aic79xx_driver_template; | ||
119 | 124 | ||
120 | /***************************** Bus Space/DMA **********************************/ | 125 | /***************************** Bus Space/DMA **********************************/ |
121 | 126 | ||
@@ -145,11 +150,7 @@ struct ahd_linux_dma_tag | |||
145 | }; | 150 | }; |
146 | typedef struct ahd_linux_dma_tag* bus_dma_tag_t; | 151 | typedef struct ahd_linux_dma_tag* bus_dma_tag_t; |
147 | 152 | ||
148 | struct ahd_linux_dmamap | 153 | typedef dma_addr_t bus_dmamap_t; |
149 | { | ||
150 | dma_addr_t bus_addr; | ||
151 | }; | ||
152 | typedef struct ahd_linux_dmamap* bus_dmamap_t; | ||
153 | 154 | ||
154 | typedef int bus_dma_filter_t(void*, dma_addr_t); | 155 | typedef int bus_dma_filter_t(void*, dma_addr_t); |
155 | typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int); | 156 | typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int); |
@@ -226,12 +227,12 @@ typedef struct timer_list ahd_timer_t; | |||
226 | #define ahd_timer_init init_timer | 227 | #define ahd_timer_init init_timer |
227 | #define ahd_timer_stop del_timer_sync | 228 | #define ahd_timer_stop del_timer_sync |
228 | typedef void ahd_linux_callback_t (u_long); | 229 | typedef void ahd_linux_callback_t (u_long); |
229 | static __inline void ahd_timer_reset(ahd_timer_t *timer, u_int usec, | 230 | static __inline void ahd_timer_reset(ahd_timer_t *timer, int usec, |
230 | ahd_callback_t *func, void *arg); | 231 | ahd_callback_t *func, void *arg); |
231 | static __inline void ahd_scb_timer_reset(struct scb *scb, u_int usec); | 232 | static __inline void ahd_scb_timer_reset(struct scb *scb, u_int usec); |
232 | 233 | ||
233 | static __inline void | 234 | static __inline void |
234 | ahd_timer_reset(ahd_timer_t *timer, u_int usec, ahd_callback_t *func, void *arg) | 235 | ahd_timer_reset(ahd_timer_t *timer, int usec, ahd_callback_t *func, void *arg) |
235 | { | 236 | { |
236 | struct ahd_softc *ahd; | 237 | struct ahd_softc *ahd; |
237 | 238 | ||
@@ -252,43 +253,8 @@ ahd_scb_timer_reset(struct scb *scb, u_int usec) | |||
252 | /***************************** SMP support ************************************/ | 253 | /***************************** SMP support ************************************/ |
253 | #include <linux/spinlock.h> | 254 | #include <linux/spinlock.h> |
254 | 255 | ||
255 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) || defined(SCSI_HAS_HOST_LOCK)) | ||
256 | #define AHD_SCSI_HAS_HOST_LOCK 1 | ||
257 | #else | ||
258 | #define AHD_SCSI_HAS_HOST_LOCK 0 | ||
259 | #endif | ||
260 | |||
261 | #define AIC79XX_DRIVER_VERSION "1.3.11" | 256 | #define AIC79XX_DRIVER_VERSION "1.3.11" |
262 | 257 | ||
263 | /**************************** Front End Queues ********************************/ | ||
264 | /* | ||
265 | * Data structure used to cast the Linux struct scsi_cmnd to something | ||
266 | * that allows us to use the queue macros. The linux structure has | ||
267 | * plenty of space to hold the links fields as required by the queue | ||
268 | * macros, but the queue macors require them to have the correct type. | ||
269 | */ | ||
270 | struct ahd_cmd_internal { | ||
271 | /* Area owned by the Linux scsi layer. */ | ||
272 | uint8_t private[offsetof(struct scsi_cmnd, SCp.Status)]; | ||
273 | union { | ||
274 | STAILQ_ENTRY(ahd_cmd) ste; | ||
275 | LIST_ENTRY(ahd_cmd) le; | ||
276 | TAILQ_ENTRY(ahd_cmd) tqe; | ||
277 | } links; | ||
278 | uint32_t end; | ||
279 | }; | ||
280 | |||
281 | struct ahd_cmd { | ||
282 | union { | ||
283 | struct ahd_cmd_internal icmd; | ||
284 | struct scsi_cmnd scsi_cmd; | ||
285 | } un; | ||
286 | }; | ||
287 | |||
288 | #define acmd_icmd(cmd) ((cmd)->un.icmd) | ||
289 | #define acmd_scsi_cmd(cmd) ((cmd)->un.scsi_cmd) | ||
290 | #define acmd_links un.icmd.links | ||
291 | |||
292 | /*************************** Device Data Structures ***************************/ | 258 | /*************************** Device Data Structures ***************************/ |
293 | /* | 259 | /* |
294 | * A per probed device structure used to deal with some error recovery | 260 | * A per probed device structure used to deal with some error recovery |
@@ -297,22 +263,17 @@ struct ahd_cmd { | |||
297 | * after a successfully completed inquiry command to the target when | 263 | * after a successfully completed inquiry command to the target when |
298 | * that inquiry data indicates a lun is present. | 264 | * that inquiry data indicates a lun is present. |
299 | */ | 265 | */ |
300 | TAILQ_HEAD(ahd_busyq, ahd_cmd); | 266 | |
301 | typedef enum { | 267 | typedef enum { |
302 | AHD_DEV_UNCONFIGURED = 0x01, | ||
303 | AHD_DEV_FREEZE_TIL_EMPTY = 0x02, /* Freeze queue until active == 0 */ | 268 | AHD_DEV_FREEZE_TIL_EMPTY = 0x02, /* Freeze queue until active == 0 */ |
304 | AHD_DEV_TIMER_ACTIVE = 0x04, /* Our timer is active */ | ||
305 | AHD_DEV_ON_RUN_LIST = 0x08, /* Queued to be run later */ | ||
306 | AHD_DEV_Q_BASIC = 0x10, /* Allow basic device queuing */ | 269 | AHD_DEV_Q_BASIC = 0x10, /* Allow basic device queuing */ |
307 | AHD_DEV_Q_TAGGED = 0x20, /* Allow full SCSI2 command queueing */ | 270 | AHD_DEV_Q_TAGGED = 0x20, /* Allow full SCSI2 command queueing */ |
308 | AHD_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */ | 271 | AHD_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */ |
309 | AHD_DEV_SLAVE_CONFIGURED = 0x80 /* slave_configure() has been called */ | ||
310 | } ahd_linux_dev_flags; | 272 | } ahd_linux_dev_flags; |
311 | 273 | ||
312 | struct ahd_linux_target; | 274 | struct ahd_linux_target; |
313 | struct ahd_linux_device { | 275 | struct ahd_linux_device { |
314 | TAILQ_ENTRY(ahd_linux_device) links; | 276 | TAILQ_ENTRY(ahd_linux_device) links; |
315 | struct ahd_busyq busyq; | ||
316 | 277 | ||
317 | /* | 278 | /* |
318 | * The number of transactions currently | 279 | * The number of transactions currently |
@@ -388,62 +349,12 @@ struct ahd_linux_device { | |||
388 | */ | 349 | */ |
389 | u_int commands_since_idle_or_otag; | 350 | u_int commands_since_idle_or_otag; |
390 | #define AHD_OTAG_THRESH 500 | 351 | #define AHD_OTAG_THRESH 500 |
391 | |||
392 | int lun; | ||
393 | Scsi_Device *scsi_device; | ||
394 | struct ahd_linux_target *target; | ||
395 | }; | 352 | }; |
396 | 353 | ||
397 | typedef enum { | ||
398 | AHD_DV_REQUIRED = 0x01, | ||
399 | AHD_INQ_VALID = 0x02, | ||
400 | AHD_BASIC_DV = 0x04, | ||
401 | AHD_ENHANCED_DV = 0x08 | ||
402 | } ahd_linux_targ_flags; | ||
403 | |||
404 | /* DV States */ | ||
405 | typedef enum { | ||
406 | AHD_DV_STATE_EXIT = 0, | ||
407 | AHD_DV_STATE_INQ_SHORT_ASYNC, | ||
408 | AHD_DV_STATE_INQ_ASYNC, | ||
409 | AHD_DV_STATE_INQ_ASYNC_VERIFY, | ||
410 | AHD_DV_STATE_TUR, | ||
411 | AHD_DV_STATE_REBD, | ||
412 | AHD_DV_STATE_INQ_VERIFY, | ||
413 | AHD_DV_STATE_WEB, | ||
414 | AHD_DV_STATE_REB, | ||
415 | AHD_DV_STATE_SU, | ||
416 | AHD_DV_STATE_BUSY | ||
417 | } ahd_dv_state; | ||
418 | |||
419 | struct ahd_linux_target { | 354 | struct ahd_linux_target { |
420 | struct ahd_linux_device *devices[AHD_NUM_LUNS]; | 355 | struct scsi_device *sdev[AHD_NUM_LUNS]; |
421 | int channel; | ||
422 | int target; | ||
423 | int refcount; | ||
424 | struct ahd_transinfo last_tinfo; | 356 | struct ahd_transinfo last_tinfo; |
425 | struct ahd_softc *ahd; | 357 | struct ahd_softc *ahd; |
426 | ahd_linux_targ_flags flags; | ||
427 | struct scsi_inquiry_data *inq_data; | ||
428 | /* | ||
429 | * The next "fallback" period to use for narrow/wide transfers. | ||
430 | */ | ||
431 | uint8_t dv_next_narrow_period; | ||
432 | uint8_t dv_next_wide_period; | ||
433 | uint8_t dv_max_width; | ||
434 | uint8_t dv_max_ppr_options; | ||
435 | uint8_t dv_last_ppr_options; | ||
436 | u_int dv_echo_size; | ||
437 | ahd_dv_state dv_state; | ||
438 | u_int dv_state_retry; | ||
439 | uint8_t *dv_buffer; | ||
440 | uint8_t *dv_buffer1; | ||
441 | |||
442 | /* | ||
443 | * Cumulative counter of errors. | ||
444 | */ | ||
445 | u_long errors_detected; | ||
446 | u_long cmds_since_error; | ||
447 | }; | 358 | }; |
448 | 359 | ||
449 | /********************* Definitions Required by the Core ***********************/ | 360 | /********************* Definitions Required by the Core ***********************/ |
@@ -453,32 +364,16 @@ struct ahd_linux_target { | |||
453 | * manner and are allocated below 4GB, the number of S/G segments is | 364 | * manner and are allocated below 4GB, the number of S/G segments is |
454 | * unrestricted. | 365 | * unrestricted. |
455 | */ | 366 | */ |
456 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
457 | /* | ||
458 | * We dynamically adjust the number of segments in pre-2.5 kernels to | ||
459 | * avoid fragmentation issues in the SCSI mid-layer's private memory | ||
460 | * allocator. See aic79xx_osm.c ahd_linux_size_nseg() for details. | ||
461 | */ | ||
462 | extern u_int ahd_linux_nseg; | ||
463 | #define AHD_NSEG ahd_linux_nseg | ||
464 | #define AHD_LINUX_MIN_NSEG 64 | ||
465 | #else | ||
466 | #define AHD_NSEG 128 | 367 | #define AHD_NSEG 128 |
467 | #endif | ||
468 | 368 | ||
469 | /* | 369 | /* |
470 | * Per-SCB OSM storage. | 370 | * Per-SCB OSM storage. |
471 | */ | 371 | */ |
472 | typedef enum { | ||
473 | AHD_SCB_UP_EH_SEM = 0x1 | ||
474 | } ahd_linux_scb_flags; | ||
475 | |||
476 | struct scb_platform_data { | 372 | struct scb_platform_data { |
477 | struct ahd_linux_device *dev; | 373 | struct ahd_linux_device *dev; |
478 | dma_addr_t buf_busaddr; | 374 | dma_addr_t buf_busaddr; |
479 | uint32_t xfer_len; | 375 | uint32_t xfer_len; |
480 | uint32_t sense_resid; /* Auto-Sense residual */ | 376 | uint32_t sense_resid; /* Auto-Sense residual */ |
481 | ahd_linux_scb_flags flags; | ||
482 | }; | 377 | }; |
483 | 378 | ||
484 | /* | 379 | /* |
@@ -487,44 +382,23 @@ struct scb_platform_data { | |||
487 | * alignment restrictions of the various platforms supported by | 382 | * alignment restrictions of the various platforms supported by |
488 | * this driver. | 383 | * this driver. |
489 | */ | 384 | */ |
490 | typedef enum { | ||
491 | AHD_DV_WAIT_SIMQ_EMPTY = 0x01, | ||
492 | AHD_DV_WAIT_SIMQ_RELEASE = 0x02, | ||
493 | AHD_DV_ACTIVE = 0x04, | ||
494 | AHD_DV_SHUTDOWN = 0x08, | ||
495 | AHD_RUN_CMPLT_Q_TIMER = 0x10 | ||
496 | } ahd_linux_softc_flags; | ||
497 | |||
498 | TAILQ_HEAD(ahd_completeq, ahd_cmd); | ||
499 | |||
500 | struct ahd_platform_data { | 385 | struct ahd_platform_data { |
501 | /* | 386 | /* |
502 | * Fields accessed from interrupt context. | 387 | * Fields accessed from interrupt context. |
503 | */ | 388 | */ |
504 | struct ahd_linux_target *targets[AHD_NUM_TARGETS]; | 389 | struct scsi_target *starget[AHD_NUM_TARGETS]; |
505 | TAILQ_HEAD(, ahd_linux_device) device_runq; | ||
506 | struct ahd_completeq completeq; | ||
507 | 390 | ||
508 | spinlock_t spin_lock; | 391 | spinlock_t spin_lock; |
509 | struct tasklet_struct runq_tasklet; | ||
510 | u_int qfrozen; | 392 | u_int qfrozen; |
511 | pid_t dv_pid; | ||
512 | struct timer_list completeq_timer; | ||
513 | struct timer_list reset_timer; | 393 | struct timer_list reset_timer; |
514 | struct timer_list stats_timer; | ||
515 | struct semaphore eh_sem; | 394 | struct semaphore eh_sem; |
516 | struct semaphore dv_sem; | ||
517 | struct semaphore dv_cmd_sem; /* XXX This needs to be in | ||
518 | * the target struct | ||
519 | */ | ||
520 | struct scsi_device *dv_scsi_dev; | ||
521 | struct Scsi_Host *host; /* pointer to scsi host */ | 395 | struct Scsi_Host *host; /* pointer to scsi host */ |
522 | #define AHD_LINUX_NOIRQ ((uint32_t)~0) | 396 | #define AHD_LINUX_NOIRQ ((uint32_t)~0) |
523 | uint32_t irq; /* IRQ for this adapter */ | 397 | uint32_t irq; /* IRQ for this adapter */ |
524 | uint32_t bios_address; | 398 | uint32_t bios_address; |
525 | uint32_t mem_busaddr; /* Mem Base Addr */ | 399 | uint32_t mem_busaddr; /* Mem Base Addr */ |
526 | uint64_t hw_dma_mask; | 400 | #define AHD_SCB_UP_EH_SEM 0x1 |
527 | ahd_linux_softc_flags flags; | 401 | uint32_t flags; |
528 | }; | 402 | }; |
529 | 403 | ||
530 | /************************** OS Utility Wrappers *******************************/ | 404 | /************************** OS Utility Wrappers *******************************/ |
@@ -641,7 +515,7 @@ ahd_insb(struct ahd_softc * ahd, long port, uint8_t *array, int count) | |||
641 | 515 | ||
642 | /**************************** Initialization **********************************/ | 516 | /**************************** Initialization **********************************/ |
643 | int ahd_linux_register_host(struct ahd_softc *, | 517 | int ahd_linux_register_host(struct ahd_softc *, |
644 | Scsi_Host_Template *); | 518 | struct scsi_host_template *); |
645 | 519 | ||
646 | uint64_t ahd_linux_get_memsize(void); | 520 | uint64_t ahd_linux_get_memsize(void); |
647 | 521 | ||
@@ -657,28 +531,6 @@ void ahd_format_transinfo(struct info_str *info, | |||
657 | struct ahd_transinfo *tinfo); | 531 | struct ahd_transinfo *tinfo); |
658 | 532 | ||
659 | /******************************** Locking *************************************/ | 533 | /******************************** Locking *************************************/ |
660 | /* Lock protecting internal data structures */ | ||
661 | static __inline void ahd_lockinit(struct ahd_softc *); | ||
662 | static __inline void ahd_lock(struct ahd_softc *, unsigned long *flags); | ||
663 | static __inline void ahd_unlock(struct ahd_softc *, unsigned long *flags); | ||
664 | |||
665 | /* Lock acquisition and release of the above lock in midlayer entry points. */ | ||
666 | static __inline void ahd_midlayer_entrypoint_lock(struct ahd_softc *, | ||
667 | unsigned long *flags); | ||
668 | static __inline void ahd_midlayer_entrypoint_unlock(struct ahd_softc *, | ||
669 | unsigned long *flags); | ||
670 | |||
671 | /* Lock held during command compeletion to the upper layer */ | ||
672 | static __inline void ahd_done_lockinit(struct ahd_softc *); | ||
673 | static __inline void ahd_done_lock(struct ahd_softc *, unsigned long *flags); | ||
674 | static __inline void ahd_done_unlock(struct ahd_softc *, unsigned long *flags); | ||
675 | |||
676 | /* Lock held during ahd_list manipulation and ahd softc frees */ | ||
677 | extern spinlock_t ahd_list_spinlock; | ||
678 | static __inline void ahd_list_lockinit(void); | ||
679 | static __inline void ahd_list_lock(unsigned long *flags); | ||
680 | static __inline void ahd_list_unlock(unsigned long *flags); | ||
681 | |||
682 | static __inline void | 534 | static __inline void |
683 | ahd_lockinit(struct ahd_softc *ahd) | 535 | ahd_lockinit(struct ahd_softc *ahd) |
684 | { | 536 | { |
@@ -697,75 +549,6 @@ ahd_unlock(struct ahd_softc *ahd, unsigned long *flags) | |||
697 | spin_unlock_irqrestore(&ahd->platform_data->spin_lock, *flags); | 549 | spin_unlock_irqrestore(&ahd->platform_data->spin_lock, *flags); |
698 | } | 550 | } |
699 | 551 | ||
700 | static __inline void | ||
701 | ahd_midlayer_entrypoint_lock(struct ahd_softc *ahd, unsigned long *flags) | ||
702 | { | ||
703 | /* | ||
704 | * In 2.5.X and some 2.4.X versions, the midlayer takes our | ||
705 | * lock just before calling us, so we avoid locking again. | ||
706 | * For other kernel versions, the io_request_lock is taken | ||
707 | * just before our entry point is called. In this case, we | ||
708 | * trade the io_request_lock for our per-softc lock. | ||
709 | */ | ||
710 | #if AHD_SCSI_HAS_HOST_LOCK == 0 | ||
711 | spin_unlock(&io_request_lock); | ||
712 | spin_lock(&ahd->platform_data->spin_lock); | ||
713 | #endif | ||
714 | } | ||
715 | |||
716 | static __inline void | ||
717 | ahd_midlayer_entrypoint_unlock(struct ahd_softc *ahd, unsigned long *flags) | ||
718 | { | ||
719 | #if AHD_SCSI_HAS_HOST_LOCK == 0 | ||
720 | spin_unlock(&ahd->platform_data->spin_lock); | ||
721 | spin_lock(&io_request_lock); | ||
722 | #endif | ||
723 | } | ||
724 | |||
725 | static __inline void | ||
726 | ahd_done_lockinit(struct ahd_softc *ahd) | ||
727 | { | ||
728 | /* | ||
729 | * In 2.5.X, our own lock is held during completions. | ||
730 | * In previous versions, the io_request_lock is used. | ||
731 | * In either case, we can't initialize this lock again. | ||
732 | */ | ||
733 | } | ||
734 | |||
735 | static __inline void | ||
736 | ahd_done_lock(struct ahd_softc *ahd, unsigned long *flags) | ||
737 | { | ||
738 | #if AHD_SCSI_HAS_HOST_LOCK == 0 | ||
739 | spin_lock(&io_request_lock); | ||
740 | #endif | ||
741 | } | ||
742 | |||
743 | static __inline void | ||
744 | ahd_done_unlock(struct ahd_softc *ahd, unsigned long *flags) | ||
745 | { | ||
746 | #if AHD_SCSI_HAS_HOST_LOCK == 0 | ||
747 | spin_unlock(&io_request_lock); | ||
748 | #endif | ||
749 | } | ||
750 | |||
751 | static __inline void | ||
752 | ahd_list_lockinit(void) | ||
753 | { | ||
754 | spin_lock_init(&ahd_list_spinlock); | ||
755 | } | ||
756 | |||
757 | static __inline void | ||
758 | ahd_list_lock(unsigned long *flags) | ||
759 | { | ||
760 | spin_lock_irqsave(&ahd_list_spinlock, *flags); | ||
761 | } | ||
762 | |||
763 | static __inline void | ||
764 | ahd_list_unlock(unsigned long *flags) | ||
765 | { | ||
766 | spin_unlock_irqrestore(&ahd_list_spinlock, *flags); | ||
767 | } | ||
768 | |||
769 | /******************************* PCI Definitions ******************************/ | 552 | /******************************* PCI Definitions ******************************/ |
770 | /* | 553 | /* |
771 | * PCIM_xxx: mask to locate subfield in register | 554 | * PCIM_xxx: mask to locate subfield in register |
@@ -925,27 +708,17 @@ ahd_flush_device_writes(struct ahd_softc *ahd) | |||
925 | } | 708 | } |
926 | 709 | ||
927 | /**************************** Proc FS Support *********************************/ | 710 | /**************************** Proc FS Support *********************************/ |
928 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
929 | int ahd_linux_proc_info(char *, char **, off_t, int, int, int); | ||
930 | #else | ||
931 | int ahd_linux_proc_info(struct Scsi_Host *, char *, char **, | 711 | int ahd_linux_proc_info(struct Scsi_Host *, char *, char **, |
932 | off_t, int, int); | 712 | off_t, int, int); |
933 | #endif | ||
934 | |||
935 | /*************************** Domain Validation ********************************/ | ||
936 | #define AHD_DV_CMD(cmd) ((cmd)->scsi_done == ahd_linux_dv_complete) | ||
937 | #define AHD_DV_SIMQ_FROZEN(ahd) \ | ||
938 | ((((ahd)->platform_data->flags & AHD_DV_ACTIVE) != 0) \ | ||
939 | && (ahd)->platform_data->qfrozen == 1) | ||
940 | 713 | ||
941 | /*********************** Transaction Access Wrappers **************************/ | 714 | /*********************** Transaction Access Wrappers **************************/ |
942 | static __inline void ahd_cmd_set_transaction_status(Scsi_Cmnd *, uint32_t); | 715 | static __inline void ahd_cmd_set_transaction_status(struct scsi_cmnd *, uint32_t); |
943 | static __inline void ahd_set_transaction_status(struct scb *, uint32_t); | 716 | static __inline void ahd_set_transaction_status(struct scb *, uint32_t); |
944 | static __inline void ahd_cmd_set_scsi_status(Scsi_Cmnd *, uint32_t); | 717 | static __inline void ahd_cmd_set_scsi_status(struct scsi_cmnd *, uint32_t); |
945 | static __inline void ahd_set_scsi_status(struct scb *, uint32_t); | 718 | static __inline void ahd_set_scsi_status(struct scb *, uint32_t); |
946 | static __inline uint32_t ahd_cmd_get_transaction_status(Scsi_Cmnd *cmd); | 719 | static __inline uint32_t ahd_cmd_get_transaction_status(struct scsi_cmnd *cmd); |
947 | static __inline uint32_t ahd_get_transaction_status(struct scb *); | 720 | static __inline uint32_t ahd_get_transaction_status(struct scb *); |
948 | static __inline uint32_t ahd_cmd_get_scsi_status(Scsi_Cmnd *cmd); | 721 | static __inline uint32_t ahd_cmd_get_scsi_status(struct scsi_cmnd *cmd); |
949 | static __inline uint32_t ahd_get_scsi_status(struct scb *); | 722 | static __inline uint32_t ahd_get_scsi_status(struct scb *); |
950 | static __inline void ahd_set_transaction_tag(struct scb *, int, u_int); | 723 | static __inline void ahd_set_transaction_tag(struct scb *, int, u_int); |
951 | static __inline u_long ahd_get_transfer_length(struct scb *); | 724 | static __inline u_long ahd_get_transfer_length(struct scb *); |
@@ -964,7 +737,7 @@ static __inline void ahd_platform_scb_free(struct ahd_softc *ahd, | |||
964 | static __inline void ahd_freeze_scb(struct scb *scb); | 737 | static __inline void ahd_freeze_scb(struct scb *scb); |
965 | 738 | ||
966 | static __inline | 739 | static __inline |
967 | void ahd_cmd_set_transaction_status(Scsi_Cmnd *cmd, uint32_t status) | 740 | void ahd_cmd_set_transaction_status(struct scsi_cmnd *cmd, uint32_t status) |
968 | { | 741 | { |
969 | cmd->result &= ~(CAM_STATUS_MASK << 16); | 742 | cmd->result &= ~(CAM_STATUS_MASK << 16); |
970 | cmd->result |= status << 16; | 743 | cmd->result |= status << 16; |
@@ -977,7 +750,7 @@ void ahd_set_transaction_status(struct scb *scb, uint32_t status) | |||
977 | } | 750 | } |
978 | 751 | ||
979 | static __inline | 752 | static __inline |
980 | void ahd_cmd_set_scsi_status(Scsi_Cmnd *cmd, uint32_t status) | 753 | void ahd_cmd_set_scsi_status(struct scsi_cmnd *cmd, uint32_t status) |
981 | { | 754 | { |
982 | cmd->result &= ~0xFFFF; | 755 | cmd->result &= ~0xFFFF; |
983 | cmd->result |= status; | 756 | cmd->result |= status; |
@@ -990,7 +763,7 @@ void ahd_set_scsi_status(struct scb *scb, uint32_t status) | |||
990 | } | 763 | } |
991 | 764 | ||
992 | static __inline | 765 | static __inline |
993 | uint32_t ahd_cmd_get_transaction_status(Scsi_Cmnd *cmd) | 766 | uint32_t ahd_cmd_get_transaction_status(struct scsi_cmnd *cmd) |
994 | { | 767 | { |
995 | return ((cmd->result >> 16) & CAM_STATUS_MASK); | 768 | return ((cmd->result >> 16) & CAM_STATUS_MASK); |
996 | } | 769 | } |
@@ -1002,7 +775,7 @@ uint32_t ahd_get_transaction_status(struct scb *scb) | |||
1002 | } | 775 | } |
1003 | 776 | ||
1004 | static __inline | 777 | static __inline |
1005 | uint32_t ahd_cmd_get_scsi_status(Scsi_Cmnd *cmd) | 778 | uint32_t ahd_cmd_get_scsi_status(struct scsi_cmnd *cmd) |
1006 | { | 779 | { |
1007 | return (cmd->result & 0xFFFF); | 780 | return (cmd->result & 0xFFFF); |
1008 | } | 781 | } |
@@ -1117,7 +890,6 @@ void ahd_done(struct ahd_softc*, struct scb*); | |||
1117 | void ahd_send_async(struct ahd_softc *, char channel, | 890 | void ahd_send_async(struct ahd_softc *, char channel, |
1118 | u_int target, u_int lun, ac_code, void *); | 891 | u_int target, u_int lun, ac_code, void *); |
1119 | void ahd_print_path(struct ahd_softc *, struct scb *); | 892 | void ahd_print_path(struct ahd_softc *, struct scb *); |
1120 | void ahd_platform_dump_card_state(struct ahd_softc *ahd); | ||
1121 | 893 | ||
1122 | #ifdef CONFIG_PCI | 894 | #ifdef CONFIG_PCI |
1123 | #define AHD_PCI_CONFIG 1 | 895 | #define AHD_PCI_CONFIG 1 |