diff options
| author | Christoph Hellwig <hch@lst.de> | 2005-05-16 12:52:06 -0400 |
|---|---|---|
| committer | James Bottomley <jejb@mulgrave.(none)> | 2005-05-20 16:54:36 -0400 |
| commit | dedd831081052028f35aaf924ea3d6c55109074f (patch) | |
| tree | 518497bc7e5aa491bc932d50149ce96cae0b26c3 | |
| parent | c06716fe1cea97749668c83e8374b453fbd00823 (diff) | |
[SCSI] aic7xxx: remove Linux 2.4 ifdefs
There's not much sense in sharing code anymore now that aic7xxx uses
various transport class facilities.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
| -rw-r--r-- | drivers/scsi/aic7xxx/aic7770_osm.c | 52 | ||||
| -rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm.c | 314 | ||||
| -rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm.h | 89 | ||||
| -rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | 9 | ||||
| -rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_proc.c | 13 |
5 files changed, 5 insertions, 472 deletions
diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c index c2b47f2bdffd..682ca0b32b44 100644 --- a/drivers/scsi/aic7xxx/aic7770_osm.c +++ b/drivers/scsi/aic7xxx/aic7770_osm.c | |||
| @@ -41,7 +41,6 @@ | |||
| 41 | 41 | ||
| 42 | #include "aic7xxx_osm.h" | 42 | #include "aic7xxx_osm.h" |
| 43 | 43 | ||
| 44 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 45 | #include <linux/device.h> | 44 | #include <linux/device.h> |
| 46 | #include <linux/eisa.h> | 45 | #include <linux/eisa.h> |
| 47 | 46 | ||
| @@ -62,13 +61,6 @@ static struct eisa_driver aic7770_driver = { | |||
| 62 | }; | 61 | }; |
| 63 | 62 | ||
| 64 | typedef struct device *aic7770_dev_t; | 63 | typedef struct device *aic7770_dev_t; |
| 65 | #else | ||
| 66 | #define MINSLOT 1 | ||
| 67 | #define NUMSLOTS 16 | ||
| 68 | #define IDOFFSET 0x80 | ||
| 69 | |||
| 70 | typedef void *aic7770_dev_t; | ||
| 71 | #endif | ||
| 72 | 64 | ||
| 73 | static int aic7770_linux_config(struct aic7770_identity *entry, | 65 | static int aic7770_linux_config(struct aic7770_identity *entry, |
| 74 | aic7770_dev_t dev, u_int eisaBase); | 66 | aic7770_dev_t dev, u_int eisaBase); |
| @@ -76,7 +68,6 @@ static int aic7770_linux_config(struct aic7770_identity *entry, | |||
| 76 | int | 68 | int |
| 77 | ahc_linux_eisa_init(void) | 69 | ahc_linux_eisa_init(void) |
| 78 | { | 70 | { |
| 79 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 80 | struct eisa_device_id *eid; | 71 | struct eisa_device_id *eid; |
| 81 | struct aic7770_identity *id; | 72 | struct aic7770_identity *id; |
| 82 | int i; | 73 | int i; |
| @@ -110,44 +101,6 @@ ahc_linux_eisa_init(void) | |||
| 110 | eid->sig[0] = 0; | 101 | eid->sig[0] = 0; |
| 111 | 102 | ||
| 112 | return eisa_driver_register(&aic7770_driver); | 103 | return eisa_driver_register(&aic7770_driver); |
| 113 | #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */ | ||
| 114 | struct aic7770_identity *entry; | ||
| 115 | u_int slot; | ||
| 116 | u_int eisaBase; | ||
| 117 | u_int i; | ||
| 118 | int ret = -ENODEV; | ||
| 119 | |||
| 120 | if (aic7xxx_probe_eisa_vl == 0) | ||
| 121 | return ret; | ||
| 122 | |||
| 123 | eisaBase = 0x1000 + AHC_EISA_SLOT_OFFSET; | ||
| 124 | for (slot = 1; slot < NUMSLOTS; eisaBase+=0x1000, slot++) { | ||
| 125 | uint32_t eisa_id; | ||
| 126 | size_t id_size; | ||
| 127 | |||
| 128 | if (request_region(eisaBase, AHC_EISA_IOSIZE, "aic7xxx") == 0) | ||
| 129 | continue; | ||
| 130 | |||
| 131 | eisa_id = 0; | ||
| 132 | id_size = sizeof(eisa_id); | ||
| 133 | for (i = 0; i < 4; i++) { | ||
| 134 | /* VLcards require priming*/ | ||
| 135 | outb(0x80 + i, eisaBase + IDOFFSET); | ||
| 136 | eisa_id |= inb(eisaBase + IDOFFSET + i) | ||
| 137 | << ((id_size-i-1) * 8); | ||
| 138 | } | ||
| 139 | release_region(eisaBase, AHC_EISA_IOSIZE); | ||
| 140 | if (eisa_id & 0x80000000) | ||
| 141 | continue; /* no EISA card in slot */ | ||
| 142 | |||
| 143 | entry = aic7770_find_device(eisa_id); | ||
| 144 | if (entry != NULL) { | ||
| 145 | aic7770_linux_config(entry, NULL, eisaBase); | ||
| 146 | ret = 0; | ||
| 147 | } | ||
| 148 | } | ||
| 149 | return ret; | ||
| 150 | #endif | ||
| 151 | } | 104 | } |
| 152 | 105 | ||
| 153 | void | 106 | void |
| @@ -187,11 +140,10 @@ aic7770_linux_config(struct aic7770_identity *entry, aic7770_dev_t dev, | |||
| 187 | ahc_free(ahc); | 140 | ahc_free(ahc); |
| 188 | return (error); | 141 | return (error); |
| 189 | } | 142 | } |
| 190 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | 143 | |
| 191 | dev->driver_data = (void *)ahc; | 144 | dev->driver_data = (void *)ahc; |
| 192 | if (aic7xxx_detect_complete) | 145 | if (aic7xxx_detect_complete) |
| 193 | error = ahc_linux_register_host(ahc, &aic7xxx_driver_template); | 146 | error = ahc_linux_register_host(ahc, &aic7xxx_driver_template); |
| 194 | #endif | ||
| 195 | return (error); | 147 | return (error); |
| 196 | } | 148 | } |
| 197 | 149 | ||
| @@ -225,7 +177,6 @@ aic7770_map_int(struct ahc_softc *ahc, u_int irq) | |||
| 225 | return (-error); | 177 | return (-error); |
| 226 | } | 178 | } |
| 227 | 179 | ||
| 228 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 229 | static int | 180 | static int |
| 230 | aic7770_eisa_dev_probe(struct device *dev) | 181 | aic7770_eisa_dev_probe(struct device *dev) |
| 231 | { | 182 | { |
| @@ -261,4 +212,3 @@ aic7770_eisa_dev_remove(struct device *dev) | |||
| 261 | 212 | ||
| 262 | return (0); | 213 | return (0); |
| 263 | } | 214 | } |
| 264 | #endif | ||
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 9017942407d8..37fda70b5435 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
| @@ -134,11 +134,6 @@ static struct scsi_transport_template *ahc_linux_transport_template = NULL; | |||
| 134 | #include "aiclib.c" | 134 | #include "aiclib.c" |
| 135 | 135 | ||
| 136 | #include <linux/init.h> /* __setup */ | 136 | #include <linux/init.h> /* __setup */ |
| 137 | |||
| 138 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 139 | #include "sd.h" /* For geometry detection */ | ||
| 140 | #endif | ||
| 141 | |||
| 142 | #include <linux/mm.h> /* For fetching system memory size */ | 137 | #include <linux/mm.h> /* For fetching system memory size */ |
| 143 | #include <linux/blkdev.h> /* For block_size() */ | 138 | #include <linux/blkdev.h> /* For block_size() */ |
| 144 | #include <linux/delay.h> /* For ssleep/msleep */ | 139 | #include <linux/delay.h> /* For ssleep/msleep */ |
| @@ -148,11 +143,6 @@ static struct scsi_transport_template *ahc_linux_transport_template = NULL; | |||
| 148 | */ | 143 | */ |
| 149 | spinlock_t ahc_list_spinlock; | 144 | spinlock_t ahc_list_spinlock; |
| 150 | 145 | ||
| 151 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 152 | /* For dynamic sglist size calculation. */ | ||
| 153 | u_int ahc_linux_nseg; | ||
| 154 | #endif | ||
| 155 | |||
| 156 | /* | 146 | /* |
| 157 | * Set this to the delay in seconds after SCSI bus reset. | 147 | * Set this to the delay in seconds after SCSI bus reset. |
| 158 | * Note, we honor this only for the initial bus reset. | 148 | * Note, we honor this only for the initial bus reset. |
| @@ -443,7 +433,6 @@ static void ahc_linux_release_simq(u_long arg); | |||
| 443 | static void ahc_linux_dev_timed_unfreeze(u_long arg); | 433 | static void ahc_linux_dev_timed_unfreeze(u_long arg); |
| 444 | static int ahc_linux_queue_recovery_cmd(Scsi_Cmnd *cmd, scb_flag flag); | 434 | static int ahc_linux_queue_recovery_cmd(Scsi_Cmnd *cmd, scb_flag flag); |
| 445 | static void ahc_linux_initialize_scsi_bus(struct ahc_softc *ahc); | 435 | static void ahc_linux_initialize_scsi_bus(struct ahc_softc *ahc); |
| 446 | static void ahc_linux_size_nseg(void); | ||
| 447 | static void ahc_linux_thread_run_complete_queue(struct ahc_softc *ahc); | 436 | static void ahc_linux_thread_run_complete_queue(struct ahc_softc *ahc); |
| 448 | static u_int ahc_linux_user_tagdepth(struct ahc_softc *ahc, | 437 | static u_int ahc_linux_user_tagdepth(struct ahc_softc *ahc, |
| 449 | struct ahc_devinfo *devinfo); | 438 | struct ahc_devinfo *devinfo); |
| @@ -519,11 +508,9 @@ static struct ahc_cmd * | |||
| 519 | ahc_linux_run_complete_queue(struct ahc_softc *ahc) | 508 | ahc_linux_run_complete_queue(struct ahc_softc *ahc) |
| 520 | { | 509 | { |
| 521 | struct ahc_cmd *acmd; | 510 | struct ahc_cmd *acmd; |
| 522 | u_long done_flags; | ||
| 523 | int with_errors; | 511 | int with_errors; |
| 524 | 512 | ||
| 525 | with_errors = 0; | 513 | with_errors = 0; |
| 526 | ahc_done_lock(ahc, &done_flags); | ||
| 527 | while ((acmd = TAILQ_FIRST(&ahc->platform_data->completeq)) != NULL) { | 514 | while ((acmd = TAILQ_FIRST(&ahc->platform_data->completeq)) != NULL) { |
| 528 | Scsi_Cmnd *cmd; | 515 | Scsi_Cmnd *cmd; |
| 529 | 516 | ||
| @@ -549,7 +536,6 @@ ahc_linux_run_complete_queue(struct ahc_softc *ahc) | |||
| 549 | 536 | ||
| 550 | cmd->scsi_done(cmd); | 537 | cmd->scsi_done(cmd); |
| 551 | } | 538 | } |
| 552 | ahc_done_unlock(ahc, &done_flags); | ||
| 553 | return (acmd); | 539 | return (acmd); |
| 554 | } | 540 | } |
| 555 | 541 | ||
| @@ -600,7 +586,6 @@ ahc_linux_map_seg(struct ahc_softc *ahc, struct scb *scb, | |||
| 600 | static int ahc_linux_detect(Scsi_Host_Template *); | 586 | static int ahc_linux_detect(Scsi_Host_Template *); |
| 601 | static int ahc_linux_queue(Scsi_Cmnd *, void (*)(Scsi_Cmnd *)); | 587 | static int ahc_linux_queue(Scsi_Cmnd *, void (*)(Scsi_Cmnd *)); |
| 602 | static const char *ahc_linux_info(struct Scsi_Host *); | 588 | static const char *ahc_linux_info(struct Scsi_Host *); |
| 603 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 604 | static int ahc_linux_slave_alloc(Scsi_Device *); | 589 | static int ahc_linux_slave_alloc(Scsi_Device *); |
| 605 | static int ahc_linux_slave_configure(Scsi_Device *); | 590 | static int ahc_linux_slave_configure(Scsi_Device *); |
| 606 | static void ahc_linux_slave_destroy(Scsi_Device *); | 591 | static void ahc_linux_slave_destroy(Scsi_Device *); |
| @@ -609,80 +594,11 @@ static int ahc_linux_biosparam(struct scsi_device*, | |||
| 609 | struct block_device*, | 594 | struct block_device*, |
| 610 | sector_t, int[]); | 595 | sector_t, int[]); |
| 611 | #endif | 596 | #endif |
| 612 | #else | ||
| 613 | static int ahc_linux_release(struct Scsi_Host *); | ||
| 614 | static void ahc_linux_select_queue_depth(struct Scsi_Host *host, | ||
| 615 | Scsi_Device *scsi_devs); | ||
| 616 | #if defined(__i386__) | ||
| 617 | static int ahc_linux_biosparam(Disk *, kdev_t, int[]); | ||
| 618 | #endif | ||
| 619 | #endif | ||
| 620 | static int ahc_linux_bus_reset(Scsi_Cmnd *); | 597 | static int ahc_linux_bus_reset(Scsi_Cmnd *); |
| 621 | static int ahc_linux_dev_reset(Scsi_Cmnd *); | 598 | static int ahc_linux_dev_reset(Scsi_Cmnd *); |
| 622 | static int ahc_linux_abort(Scsi_Cmnd *); | 599 | static int ahc_linux_abort(Scsi_Cmnd *); |
| 623 | 600 | ||
| 624 | /* | 601 | /* |
| 625 | * Calculate a safe value for AHC_NSEG (as expressed through ahc_linux_nseg). | ||
| 626 | * | ||
| 627 | * In pre-2.5.X... | ||
| 628 | * The midlayer allocates an S/G array dynamically when a command is issued | ||
| 629 | * using SCSI malloc. This array, which is in an OS dependent format that | ||
| 630 | * must later be copied to our private S/G list, is sized to house just the | ||
| 631 | * number of segments needed for the current transfer. Since the code that | ||
| 632 | * sizes the SCSI malloc pool does not take into consideration fragmentation | ||
| 633 | * of the pool, executing transactions numbering just a fraction of our | ||
| 634 | * concurrent transaction limit with list lengths aproaching AHC_NSEG will | ||
| 635 | * quickly depleat the SCSI malloc pool of usable space. Unfortunately, the | ||
| 636 | * mid-layer does not properly handle this scsi malloc failures for the S/G | ||
| 637 | * array and the result can be a lockup of the I/O subsystem. We try to size | ||
| 638 | * our S/G list so that it satisfies our drivers allocation requirements in | ||
| 639 | * addition to avoiding fragmentation of the SCSI malloc pool. | ||
| 640 | */ | ||
| 641 | static void | ||
| 642 | ahc_linux_size_nseg(void) | ||
| 643 | { | ||
| 644 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 645 | u_int cur_size; | ||
| 646 | u_int best_size; | ||
| 647 | |||
| 648 | /* | ||
| 649 | * The SCSI allocator rounds to the nearest 512 bytes | ||
| 650 | * an cannot allocate across a page boundary. Our algorithm | ||
| 651 | * is to start at 1K of scsi malloc space per-command and | ||
| 652 | * loop through all factors of the PAGE_SIZE and pick the best. | ||
| 653 | */ | ||
| 654 | best_size = 0; | ||
| 655 | for (cur_size = 1024; cur_size <= PAGE_SIZE; cur_size *= 2) { | ||
| 656 | u_int nseg; | ||
| 657 | |||
| 658 | nseg = cur_size / sizeof(struct scatterlist); | ||
| 659 | if (nseg < AHC_LINUX_MIN_NSEG) | ||
| 660 | continue; | ||
| 661 | |||
| 662 | if (best_size == 0) { | ||
| 663 | best_size = cur_size; | ||
| 664 | ahc_linux_nseg = nseg; | ||
| 665 | } else { | ||
| 666 | u_int best_rem; | ||
| 667 | u_int cur_rem; | ||
| 668 | |||
| 669 | /* | ||
| 670 | * Compare the traits of the current "best_size" | ||
| 671 | * with the current size to determine if the | ||
| 672 | * current size is a better size. | ||
| 673 | */ | ||
| 674 | best_rem = best_size % sizeof(struct scatterlist); | ||
| 675 | cur_rem = cur_size % sizeof(struct scatterlist); | ||
| 676 | if (cur_rem < best_rem) { | ||
| 677 | best_size = cur_size; | ||
| 678 | ahc_linux_nseg = nseg; | ||
| 679 | } | ||
| 680 | } | ||
| 681 | } | ||
| 682 | #endif | ||
| 683 | } | ||
| 684 | |||
| 685 | /* | ||
| 686 | * Try to detect an Adaptec 7XXX controller. | 602 | * Try to detect an Adaptec 7XXX controller. |
| 687 | */ | 603 | */ |
| 688 | static int | 604 | static int |
| @@ -691,14 +607,6 @@ ahc_linux_detect(Scsi_Host_Template *template) | |||
| 691 | struct ahc_softc *ahc; | 607 | struct ahc_softc *ahc; |
| 692 | int found = 0; | 608 | int found = 0; |
| 693 | 609 | ||
| 694 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 695 | /* | ||
| 696 | * It is a bug that the upper layer takes | ||
| 697 | * this lock just prior to calling us. | ||
| 698 | */ | ||
| 699 | spin_unlock_irq(&io_request_lock); | ||
| 700 | #endif | ||
| 701 | |||
| 702 | /* | 610 | /* |
| 703 | * Sanity checking of Linux SCSI data structures so | 611 | * Sanity checking of Linux SCSI data structures so |
| 704 | * that some of our hacks^H^H^H^H^Hassumptions aren't | 612 | * that some of our hacks^H^H^H^H^Hassumptions aren't |
| @@ -710,7 +618,6 @@ ahc_linux_detect(Scsi_Host_Template *template) | |||
| 710 | printf("ahc_linux_detect: Unable to attach\n"); | 618 | printf("ahc_linux_detect: Unable to attach\n"); |
| 711 | return (0); | 619 | return (0); |
| 712 | } | 620 | } |
| 713 | ahc_linux_size_nseg(); | ||
| 714 | /* | 621 | /* |
| 715 | * If we've been passed any parameters, process them now. | 622 | * If we've been passed any parameters, process them now. |
| 716 | */ | 623 | */ |
| @@ -739,48 +646,11 @@ ahc_linux_detect(Scsi_Host_Template *template) | |||
| 739 | found++; | 646 | found++; |
| 740 | } | 647 | } |
| 741 | 648 | ||
| 742 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 743 | spin_lock_irq(&io_request_lock); | ||
| 744 | #endif | ||
| 745 | aic7xxx_detect_complete++; | 649 | aic7xxx_detect_complete++; |
| 746 | 650 | ||
| 747 | return (found); | 651 | return (found); |
| 748 | } | 652 | } |
| 749 | 653 | ||
| 750 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 751 | /* | ||
| 752 | * Free the passed in Scsi_Host memory structures prior to unloading the | ||
| 753 | * module. | ||
| 754 | */ | ||
| 755 | int | ||
| 756 | ahc_linux_release(struct Scsi_Host * host) | ||
| 757 | { | ||
| 758 | struct ahc_softc *ahc; | ||
| 759 | u_long l; | ||
| 760 | |||
| 761 | ahc_list_lock(&l); | ||
| 762 | if (host != NULL) { | ||
| 763 | |||
| 764 | /* | ||
| 765 | * We should be able to just perform | ||
| 766 | * the free directly, but check our | ||
| 767 | * list for extra sanity. | ||
| 768 | */ | ||
| 769 | ahc = ahc_find_softc(*(struct ahc_softc **)host->hostdata); | ||
| 770 | if (ahc != NULL) { | ||
| 771 | u_long s; | ||
| 772 | |||
| 773 | ahc_lock(ahc, &s); | ||
| 774 | ahc_intr_enable(ahc, FALSE); | ||
| 775 | ahc_unlock(ahc, &s); | ||
| 776 | ahc_free(ahc); | ||
| 777 | } | ||
| 778 | } | ||
| 779 | ahc_list_unlock(&l); | ||
| 780 | return (0); | ||
| 781 | } | ||
| 782 | #endif | ||
| 783 | |||
| 784 | /* | 654 | /* |
| 785 | * Return a string describing the driver. | 655 | * Return a string describing the driver. |
| 786 | */ | 656 | */ |
| @@ -843,7 +713,6 @@ ahc_linux_queue(Scsi_Cmnd * cmd, void (*scsi_done) (Scsi_Cmnd *)) | |||
| 843 | return ahc_linux_run_command(ahc, dev, cmd); | 713 | return ahc_linux_run_command(ahc, dev, cmd); |
| 844 | } | 714 | } |
| 845 | 715 | ||
| 846 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 847 | static int | 716 | static int |
| 848 | ahc_linux_slave_alloc(Scsi_Device *device) | 717 | ahc_linux_slave_alloc(Scsi_Device *device) |
| 849 | { | 718 | { |
| @@ -860,12 +729,10 @@ ahc_linux_slave_configure(Scsi_Device *device) | |||
| 860 | { | 729 | { |
| 861 | struct ahc_softc *ahc; | 730 | struct ahc_softc *ahc; |
| 862 | struct ahc_linux_device *dev; | 731 | struct ahc_linux_device *dev; |
| 863 | u_long flags; | ||
| 864 | 732 | ||
| 865 | ahc = *((struct ahc_softc **)device->host->hostdata); | 733 | ahc = *((struct ahc_softc **)device->host->hostdata); |
| 866 | if (bootverbose) | 734 | if (bootverbose) |
| 867 | printf("%s: Slave Configure %d\n", ahc_name(ahc), device->id); | 735 | printf("%s: Slave Configure %d\n", ahc_name(ahc), device->id); |
| 868 | ahc_midlayer_entrypoint_lock(ahc, &flags); | ||
| 869 | /* | 736 | /* |
| 870 | * Since Linux has attached to the device, configure | 737 | * Since Linux has attached to the device, configure |
| 871 | * it so we don't free and allocate the device | 738 | * it so we don't free and allocate the device |
| @@ -879,7 +746,6 @@ ahc_linux_slave_configure(Scsi_Device *device) | |||
| 879 | dev->scsi_device = device; | 746 | dev->scsi_device = device; |
| 880 | ahc_linux_device_queue_depth(ahc, dev); | 747 | ahc_linux_device_queue_depth(ahc, dev); |
| 881 | } | 748 | } |
| 882 | ahc_midlayer_entrypoint_unlock(ahc, &flags); | ||
| 883 | 749 | ||
| 884 | /* Initial Domain Validation */ | 750 | /* Initial Domain Validation */ |
| 885 | if (!spi_initial_dv(device->sdev_target)) | 751 | if (!spi_initial_dv(device->sdev_target)) |
| @@ -893,12 +759,10 @@ ahc_linux_slave_destroy(Scsi_Device *device) | |||
| 893 | { | 759 | { |
| 894 | struct ahc_softc *ahc; | 760 | struct ahc_softc *ahc; |
| 895 | struct ahc_linux_device *dev; | 761 | struct ahc_linux_device *dev; |
| 896 | u_long flags; | ||
| 897 | 762 | ||
| 898 | ahc = *((struct ahc_softc **)device->host->hostdata); | 763 | ahc = *((struct ahc_softc **)device->host->hostdata); |
| 899 | if (bootverbose) | 764 | if (bootverbose) |
| 900 | printf("%s: Slave Destroy %d\n", ahc_name(ahc), device->id); | 765 | printf("%s: Slave Destroy %d\n", ahc_name(ahc), device->id); |
| 901 | ahc_midlayer_entrypoint_lock(ahc, &flags); | ||
| 902 | dev = ahc_linux_get_device(ahc, device->channel, | 766 | dev = ahc_linux_get_device(ahc, device->channel, |
| 903 | device->id, device->lun, | 767 | device->id, device->lun, |
| 904 | /*alloc*/FALSE); | 768 | /*alloc*/FALSE); |
| @@ -916,93 +780,17 @@ ahc_linux_slave_destroy(Scsi_Device *device) | |||
| 916 | && (dev->flags & AHC_DEV_TIMER_ACTIVE) == 0) | 780 | && (dev->flags & AHC_DEV_TIMER_ACTIVE) == 0) |
| 917 | ahc_linux_free_device(ahc, dev); | 781 | ahc_linux_free_device(ahc, dev); |
| 918 | } | 782 | } |
| 919 | ahc_midlayer_entrypoint_unlock(ahc, &flags); | ||
| 920 | } | 783 | } |
| 921 | #else | ||
| 922 | /* | ||
| 923 | * Sets the queue depth for each SCSI device hanging | ||
| 924 | * off the input host adapter. | ||
| 925 | */ | ||
| 926 | static void | ||
| 927 | ahc_linux_select_queue_depth(struct Scsi_Host *host, Scsi_Device *scsi_devs) | ||
| 928 | { | ||
| 929 | Scsi_Device *device; | ||
| 930 | Scsi_Device *ldev; | ||
| 931 | struct ahc_softc *ahc; | ||
| 932 | u_long flags; | ||
| 933 | |||
| 934 | ahc = *((struct ahc_softc **)host->hostdata); | ||
| 935 | ahc_lock(ahc, &flags); | ||
| 936 | for (device = scsi_devs; device != NULL; device = device->next) { | ||
| 937 | |||
| 938 | /* | ||
| 939 | * Watch out for duplicate devices. This works around | ||
| 940 | * some quirks in how the SCSI scanning code does its | ||
| 941 | * device management. | ||
| 942 | */ | ||
| 943 | for (ldev = scsi_devs; ldev != device; ldev = ldev->next) { | ||
| 944 | if (ldev->host == device->host | ||
| 945 | && ldev->channel == device->channel | ||
| 946 | && ldev->id == device->id | ||
| 947 | && ldev->lun == device->lun) | ||
| 948 | break; | ||
| 949 | } | ||
| 950 | /* Skip duplicate. */ | ||
| 951 | if (ldev != device) | ||
| 952 | continue; | ||
| 953 | |||
| 954 | if (device->host == host) { | ||
| 955 | struct ahc_linux_device *dev; | ||
| 956 | |||
| 957 | /* | ||
| 958 | * Since Linux has attached to the device, configure | ||
| 959 | * it so we don't free and allocate the device | ||
| 960 | * structure on every command. | ||
| 961 | */ | ||
| 962 | dev = ahc_linux_get_device(ahc, device->channel, | ||
| 963 | device->id, device->lun, | ||
| 964 | /*alloc*/TRUE); | ||
| 965 | if (dev != NULL) { | ||
| 966 | dev->flags &= ~AHC_DEV_UNCONFIGURED; | ||
| 967 | dev->scsi_device = device; | ||
| 968 | ahc_linux_device_queue_depth(ahc, dev); | ||
| 969 | device->queue_depth = dev->openings | ||
| 970 | + dev->active; | ||
| 971 | if ((dev->flags & (AHC_DEV_Q_BASIC | ||
| 972 | | AHC_DEV_Q_TAGGED)) == 0) { | ||
| 973 | /* | ||
| 974 | * We allow the OS to queue 2 untagged | ||
| 975 | * transactions to us at any time even | ||
| 976 | * though we can only execute them | ||
| 977 | * serially on the controller/device. | ||
| 978 | * This should remove some latency. | ||
| 979 | */ | ||
| 980 | device->queue_depth = 2; | ||
| 981 | } | ||
| 982 | } | ||
| 983 | } | ||
| 984 | } | ||
| 985 | ahc_unlock(ahc, &flags); | ||
| 986 | } | ||
| 987 | #endif | ||
| 988 | 784 | ||
| 989 | #if defined(__i386__) | 785 | #if defined(__i386__) |
| 990 | /* | 786 | /* |
| 991 | * Return the disk geometry for the given SCSI device. | 787 | * Return the disk geometry for the given SCSI device. |
| 992 | */ | 788 | */ |
| 993 | static int | 789 | static int |
| 994 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 995 | ahc_linux_biosparam(struct scsi_device *sdev, struct block_device *bdev, | 790 | ahc_linux_biosparam(struct scsi_device *sdev, struct block_device *bdev, |
| 996 | sector_t capacity, int geom[]) | 791 | sector_t capacity, int geom[]) |
| 997 | { | 792 | { |
| 998 | uint8_t *bh; | 793 | uint8_t *bh; |
| 999 | #else | ||
| 1000 | ahc_linux_biosparam(Disk *disk, kdev_t dev, int geom[]) | ||
| 1001 | { | ||
| 1002 | struct scsi_device *sdev = disk->device; | ||
| 1003 | u_long capacity = disk->capacity; | ||
| 1004 | struct buffer_head *bh; | ||
| 1005 | #endif | ||
| 1006 | int heads; | 794 | int heads; |
| 1007 | int sectors; | 795 | int sectors; |
| 1008 | int cylinders; | 796 | int cylinders; |
| @@ -1014,22 +802,11 @@ ahc_linux_biosparam(Disk *disk, kdev_t dev, int geom[]) | |||
| 1014 | ahc = *((struct ahc_softc **)sdev->host->hostdata); | 802 | ahc = *((struct ahc_softc **)sdev->host->hostdata); |
| 1015 | channel = sdev->channel; | 803 | channel = sdev->channel; |
| 1016 | 804 | ||
| 1017 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 1018 | bh = scsi_bios_ptable(bdev); | 805 | bh = scsi_bios_ptable(bdev); |
| 1019 | #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,17) | ||
| 1020 | bh = bread(MKDEV(MAJOR(dev), MINOR(dev) & ~0xf), 0, block_size(dev)); | ||
| 1021 | #else | ||
| 1022 | bh = bread(MKDEV(MAJOR(dev), MINOR(dev) & ~0xf), 0, 1024); | ||
| 1023 | #endif | ||
| 1024 | |||
| 1025 | if (bh) { | 806 | if (bh) { |
| 1026 | ret = scsi_partsize(bh, capacity, | 807 | ret = scsi_partsize(bh, capacity, |
| 1027 | &geom[2], &geom[0], &geom[1]); | 808 | &geom[2], &geom[0], &geom[1]); |
| 1028 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 1029 | kfree(bh); | 809 | kfree(bh); |
| 1030 | #else | ||
| 1031 | brelse(bh); | ||
| 1032 | #endif | ||
| 1033 | if (ret != -1) | 810 | if (ret != -1) |
| 1034 | return (ret); | 811 | return (ret); |
| 1035 | } | 812 | } |
| @@ -1090,15 +867,12 @@ static int | |||
| 1090 | ahc_linux_bus_reset(Scsi_Cmnd *cmd) | 867 | ahc_linux_bus_reset(Scsi_Cmnd *cmd) |
| 1091 | { | 868 | { |
| 1092 | struct ahc_softc *ahc; | 869 | struct ahc_softc *ahc; |
| 1093 | u_long s; | ||
| 1094 | int found; | 870 | int found; |
| 1095 | 871 | ||
| 1096 | ahc = *(struct ahc_softc **)cmd->device->host->hostdata; | 872 | ahc = *(struct ahc_softc **)cmd->device->host->hostdata; |
| 1097 | ahc_midlayer_entrypoint_lock(ahc, &s); | ||
| 1098 | found = ahc_reset_channel(ahc, cmd->device->channel + 'A', | 873 | found = ahc_reset_channel(ahc, cmd->device->channel + 'A', |
| 1099 | /*initiate reset*/TRUE); | 874 | /*initiate reset*/TRUE); |
| 1100 | ahc_linux_run_complete_queue(ahc); | 875 | ahc_linux_run_complete_queue(ahc); |
| 1101 | ahc_midlayer_entrypoint_unlock(ahc, &s); | ||
| 1102 | 876 | ||
| 1103 | if (bootverbose) | 877 | if (bootverbose) |
| 1104 | printf("%s: SCSI bus reset delivered. " | 878 | printf("%s: SCSI bus reset delivered. " |
| @@ -1461,11 +1235,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, Scsi_Host_Template *template) | |||
| 1461 | 1235 | ||
| 1462 | *((struct ahc_softc **)host->hostdata) = ahc; | 1236 | *((struct ahc_softc **)host->hostdata) = ahc; |
| 1463 | ahc_lock(ahc, &s); | 1237 | ahc_lock(ahc, &s); |
| 1464 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 1465 | scsi_assign_lock(host, &ahc->platform_data->spin_lock); | 1238 | scsi_assign_lock(host, &ahc->platform_data->spin_lock); |
| 1466 | #elif AHC_SCSI_HAS_HOST_LOCK != 0 | ||
| 1467 | host->lock = &ahc->platform_data->spin_lock; | ||
| 1468 | #endif | ||
| 1469 | ahc->platform_data->host = host; | 1239 | ahc->platform_data->host = host; |
| 1470 | host->can_queue = AHC_MAX_QUEUE; | 1240 | host->can_queue = AHC_MAX_QUEUE; |
| 1471 | host->cmd_per_lun = 2; | 1241 | host->cmd_per_lun = 2; |
| @@ -1484,19 +1254,14 @@ ahc_linux_register_host(struct ahc_softc *ahc, Scsi_Host_Template *template) | |||
| 1484 | ahc_set_name(ahc, new_name); | 1254 | ahc_set_name(ahc, new_name); |
| 1485 | } | 1255 | } |
| 1486 | host->unique_id = ahc->unit; | 1256 | host->unique_id = ahc->unit; |
| 1487 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 1488 | scsi_set_pci_device(host, ahc->dev_softc); | ||
| 1489 | #endif | ||
| 1490 | ahc_linux_initialize_scsi_bus(ahc); | 1257 | ahc_linux_initialize_scsi_bus(ahc); |
| 1491 | ahc_intr_enable(ahc, TRUE); | 1258 | ahc_intr_enable(ahc, TRUE); |
| 1492 | ahc_unlock(ahc, &s); | 1259 | ahc_unlock(ahc, &s); |
| 1493 | 1260 | ||
| 1494 | host->transportt = ahc_linux_transport_template; | 1261 | host->transportt = ahc_linux_transport_template; |
| 1495 | 1262 | ||
| 1496 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 1497 | scsi_add_host(host, (ahc->dev_softc ? &ahc->dev_softc->dev : NULL)); /* XXX handle failure */ | 1263 | scsi_add_host(host, (ahc->dev_softc ? &ahc->dev_softc->dev : NULL)); /* XXX handle failure */ |
| 1498 | scsi_scan_host(host); | 1264 | scsi_scan_host(host); |
| 1499 | #endif | ||
| 1500 | return (0); | 1265 | return (0); |
| 1501 | } | 1266 | } |
| 1502 | 1267 | ||
| @@ -1619,7 +1384,6 @@ ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg) | |||
| 1619 | ahc->platform_data->irq = AHC_LINUX_NOIRQ; | 1384 | ahc->platform_data->irq = AHC_LINUX_NOIRQ; |
| 1620 | ahc->platform_data->hw_dma_mask = 0xFFFFFFFF; | 1385 | ahc->platform_data->hw_dma_mask = 0xFFFFFFFF; |
| 1621 | ahc_lockinit(ahc); | 1386 | ahc_lockinit(ahc); |
| 1622 | ahc_done_lockinit(ahc); | ||
| 1623 | init_timer(&ahc->platform_data->completeq_timer); | 1387 | init_timer(&ahc->platform_data->completeq_timer); |
| 1624 | ahc->platform_data->completeq_timer.data = (u_long)ahc; | 1388 | ahc->platform_data->completeq_timer.data = (u_long)ahc; |
| 1625 | ahc->platform_data->completeq_timer.function = | 1389 | ahc->platform_data->completeq_timer.function = |
| @@ -1643,9 +1407,7 @@ ahc_platform_free(struct ahc_softc *ahc) | |||
| 1643 | if (ahc->platform_data != NULL) { | 1407 | if (ahc->platform_data != NULL) { |
| 1644 | del_timer_sync(&ahc->platform_data->completeq_timer); | 1408 | del_timer_sync(&ahc->platform_data->completeq_timer); |
| 1645 | if (ahc->platform_data->host != NULL) { | 1409 | if (ahc->platform_data->host != NULL) { |
| 1646 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 1647 | scsi_remove_host(ahc->platform_data->host); | 1410 | scsi_remove_host(ahc->platform_data->host); |
| 1648 | #endif | ||
| 1649 | scsi_host_put(ahc->platform_data->host); | 1411 | scsi_host_put(ahc->platform_data->host); |
| 1650 | } | 1412 | } |
| 1651 | 1413 | ||
| @@ -1681,16 +1443,7 @@ ahc_platform_free(struct ahc_softc *ahc) | |||
| 1681 | release_mem_region(ahc->platform_data->mem_busaddr, | 1443 | release_mem_region(ahc->platform_data->mem_busaddr, |
| 1682 | 0x1000); | 1444 | 0x1000); |
| 1683 | } | 1445 | } |
| 1684 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | 1446 | |
| 1685 | /* | ||
| 1686 | * In 2.4 we detach from the scsi midlayer before the PCI | ||
| 1687 | * layer invokes our remove callback. No per-instance | ||
| 1688 | * detach is provided, so we must reach inside the PCI | ||
| 1689 | * subsystem's internals and detach our driver manually. | ||
| 1690 | */ | ||
| 1691 | if (ahc->dev_softc != NULL) | ||
| 1692 | ahc->dev_softc->driver = NULL; | ||
| 1693 | #endif | ||
| 1694 | free(ahc->platform_data, M_DEVBUF); | 1447 | free(ahc->platform_data, M_DEVBUF); |
| 1695 | } | 1448 | } |
| 1696 | } | 1449 | } |
| @@ -1767,7 +1520,6 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | |||
| 1767 | dev->maxtags = 0; | 1520 | dev->maxtags = 0; |
| 1768 | dev->openings = 1 - dev->active; | 1521 | dev->openings = 1 - dev->active; |
| 1769 | } | 1522 | } |
| 1770 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 1771 | if (dev->scsi_device != NULL) { | 1523 | if (dev->scsi_device != NULL) { |
| 1772 | switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { | 1524 | switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { |
| 1773 | case AHC_DEV_Q_BASIC: | 1525 | case AHC_DEV_Q_BASIC: |
| @@ -1793,7 +1545,6 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, | |||
| 1793 | break; | 1545 | break; |
| 1794 | } | 1546 | } |
| 1795 | } | 1547 | } |
| 1796 | #endif | ||
| 1797 | } | 1548 | } |
| 1798 | 1549 | ||
| 1799 | int | 1550 | int |
| @@ -1948,7 +1699,6 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, | |||
| 1948 | } | 1699 | } |
| 1949 | 1700 | ||
| 1950 | if ((dev->flags & (AHC_DEV_Q_TAGGED|AHC_DEV_Q_BASIC)) != 0) { | 1701 | if ((dev->flags & (AHC_DEV_Q_TAGGED|AHC_DEV_Q_BASIC)) != 0) { |
| 1951 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 1952 | int msg_bytes; | 1702 | int msg_bytes; |
| 1953 | uint8_t tag_msgs[2]; | 1703 | uint8_t tag_msgs[2]; |
| 1954 | 1704 | ||
| @@ -1957,10 +1707,8 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, | |||
| 1957 | hscb->control |= tag_msgs[0]; | 1707 | hscb->control |= tag_msgs[0]; |
| 1958 | if (tag_msgs[0] == MSG_ORDERED_TASK) | 1708 | if (tag_msgs[0] == MSG_ORDERED_TASK) |
| 1959 | dev->commands_since_idle_or_otag = 0; | 1709 | dev->commands_since_idle_or_otag = 0; |
| 1960 | } else | 1710 | } else if (dev->commands_since_idle_or_otag == AHC_OTAG_THRESH |
| 1961 | #endif | 1711 | && (dev->flags & AHC_DEV_Q_TAGGED) != 0) { |
| 1962 | if (dev->commands_since_idle_or_otag == AHC_OTAG_THRESH | ||
| 1963 | && (dev->flags & AHC_DEV_Q_TAGGED) != 0) { | ||
| 1964 | hscb->control |= MSG_ORDERED_TASK; | 1712 | hscb->control |= MSG_ORDERED_TASK; |
| 1965 | dev->commands_since_idle_or_otag = 0; | 1713 | dev->commands_since_idle_or_otag = 0; |
| 1966 | } else { | 1714 | } else { |
| @@ -2280,28 +2028,9 @@ ahc_send_async(struct ahc_softc *ahc, char channel, | |||
| 2280 | } | 2028 | } |
| 2281 | case AC_SENT_BDR: | 2029 | case AC_SENT_BDR: |
| 2282 | { | 2030 | { |
| 2283 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 2284 | WARN_ON(lun != CAM_LUN_WILDCARD); | 2031 | WARN_ON(lun != CAM_LUN_WILDCARD); |
| 2285 | scsi_report_device_reset(ahc->platform_data->host, | 2032 | scsi_report_device_reset(ahc->platform_data->host, |
| 2286 | channel - 'A', target); | 2033 | channel - 'A', target); |
| 2287 | #else | ||
| 2288 | Scsi_Device *scsi_dev; | ||
| 2289 | |||
| 2290 | /* | ||
| 2291 | * Find the SCSI device associated with this | ||
| 2292 | * request and indicate that a UA is expected. | ||
| 2293 | */ | ||
| 2294 | for (scsi_dev = ahc->platform_data->host->host_queue; | ||
| 2295 | scsi_dev != NULL; scsi_dev = scsi_dev->next) { | ||
| 2296 | if (channel - 'A' == scsi_dev->channel | ||
| 2297 | && target == scsi_dev->id | ||
| 2298 | && (lun == CAM_LUN_WILDCARD | ||
| 2299 | || lun == scsi_dev->lun)) { | ||
| 2300 | scsi_dev->was_reset = 1; | ||
| 2301 | scsi_dev->expecting_cc_ua = 1; | ||
| 2302 | } | ||
| 2303 | } | ||
| 2304 | #endif | ||
| 2305 | break; | 2034 | break; |
| 2306 | } | 2035 | } |
| 2307 | case AC_BUS_RESET: | 2036 | case AC_BUS_RESET: |
| @@ -2791,7 +2520,6 @@ ahc_linux_queue_recovery_cmd(Scsi_Cmnd *cmd, scb_flag flag) | |||
| 2791 | struct ahc_softc *ahc; | 2520 | struct ahc_softc *ahc; |
| 2792 | struct ahc_linux_device *dev; | 2521 | struct ahc_linux_device *dev; |
| 2793 | struct scb *pending_scb; | 2522 | struct scb *pending_scb; |
| 2794 | u_long s; | ||
| 2795 | u_int saved_scbptr; | 2523 | u_int saved_scbptr; |
| 2796 | u_int active_scb_index; | 2524 | u_int active_scb_index; |
| 2797 | u_int last_phase; | 2525 | u_int last_phase; |
| @@ -2819,22 +2547,6 @@ ahc_linux_queue_recovery_cmd(Scsi_Cmnd *cmd, scb_flag flag) | |||
| 2819 | printf("\n"); | 2547 | printf("\n"); |
| 2820 | 2548 | ||
| 2821 | /* | 2549 | /* |
| 2822 | * In all versions of Linux, we have to work around | ||
| 2823 | * a major flaw in how the mid-layer is locked down | ||
| 2824 | * if we are to sleep successfully in our error handler | ||
| 2825 | * while allowing our interrupt handler to run. Since | ||
| 2826 | * the midlayer acquires either the io_request_lock or | ||
| 2827 | * our lock prior to calling us, we must use the | ||
| 2828 | * spin_unlock_irq() method for unlocking our lock. | ||
| 2829 | * This will force interrupts to be enabled on the | ||
| 2830 | * current CPU. Since the EH thread should not have | ||
| 2831 | * been running with CPU interrupts disabled other than | ||
| 2832 | * by acquiring either the io_request_lock or our own | ||
| 2833 | * lock, this *should* be safe. | ||
| 2834 | */ | ||
| 2835 | ahc_midlayer_entrypoint_lock(ahc, &s); | ||
| 2836 | |||
| 2837 | /* | ||
| 2838 | * First determine if we currently own this command. | 2550 | * First determine if we currently own this command. |
| 2839 | * Start by searching the device queue. If not found | 2551 | * Start by searching the device queue. If not found |
| 2840 | * there, check the pending_scb list. If not found | 2552 | * there, check the pending_scb list. If not found |
| @@ -3090,7 +2802,6 @@ done: | |||
| 3090 | spin_lock_irq(&ahc->platform_data->spin_lock); | 2802 | spin_lock_irq(&ahc->platform_data->spin_lock); |
| 3091 | } | 2803 | } |
| 3092 | ahc_linux_run_complete_queue(ahc); | 2804 | ahc_linux_run_complete_queue(ahc); |
| 3093 | ahc_midlayer_entrypoint_unlock(ahc, &s); | ||
| 3094 | return (retval); | 2805 | return (retval); |
| 3095 | } | 2806 | } |
| 3096 | 2807 | ||
| @@ -3357,7 +3068,6 @@ static struct spi_function_template ahc_linux_transport_functions = { | |||
| 3357 | static int __init | 3068 | static int __init |
| 3358 | ahc_linux_init(void) | 3069 | ahc_linux_init(void) |
| 3359 | { | 3070 | { |
| 3360 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 3361 | ahc_linux_transport_template = spi_attach_transport(&ahc_linux_transport_functions); | 3071 | ahc_linux_transport_template = spi_attach_transport(&ahc_linux_transport_functions); |
| 3362 | if (!ahc_linux_transport_template) | 3072 | if (!ahc_linux_transport_template) |
| 3363 | return -ENODEV; | 3073 | return -ENODEV; |
| @@ -3366,29 +3076,11 @@ ahc_linux_init(void) | |||
| 3366 | spi_release_transport(ahc_linux_transport_template); | 3076 | spi_release_transport(ahc_linux_transport_template); |
| 3367 | ahc_linux_exit(); | 3077 | ahc_linux_exit(); |
| 3368 | return -ENODEV; | 3078 | return -ENODEV; |
| 3369 | #else | ||
| 3370 | scsi_register_module(MODULE_SCSI_HA, &aic7xxx_driver_template); | ||
| 3371 | if (aic7xxx_driver_template.present == 0) { | ||
| 3372 | scsi_unregister_module(MODULE_SCSI_HA, | ||
| 3373 | &aic7xxx_driver_template); | ||
| 3374 | return (-ENODEV); | ||
| 3375 | } | ||
| 3376 | |||
| 3377 | return (0); | ||
| 3378 | #endif | ||
| 3379 | } | 3079 | } |
| 3380 | 3080 | ||
| 3381 | static void | 3081 | static void |
| 3382 | ahc_linux_exit(void) | 3082 | ahc_linux_exit(void) |
| 3383 | { | 3083 | { |
| 3384 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 3385 | /* | ||
| 3386 | * In 2.4 we have to unregister from the PCI core _after_ | ||
| 3387 | * unregistering from the scsi midlayer to avoid dangling | ||
| 3388 | * references. | ||
| 3389 | */ | ||
| 3390 | scsi_unregister_module(MODULE_SCSI_HA, &aic7xxx_driver_template); | ||
| 3391 | #endif | ||
| 3392 | ahc_linux_pci_exit(); | 3084 | ahc_linux_pci_exit(); |
| 3393 | ahc_linux_eisa_exit(); | 3085 | ahc_linux_eisa_exit(); |
| 3394 | spi_release_transport(ahc_linux_transport_template); | 3086 | spi_release_transport(ahc_linux_transport_template); |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index 6ea2bfb8820c..752022e4d4d4 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h | |||
| @@ -281,12 +281,6 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec) | |||
| 281 | /***************************** SMP support ************************************/ | 281 | /***************************** SMP support ************************************/ |
| 282 | #include <linux/spinlock.h> | 282 | #include <linux/spinlock.h> |
| 283 | 283 | ||
| 284 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) || defined(SCSI_HAS_HOST_LOCK)) | ||
| 285 | #define AHC_SCSI_HAS_HOST_LOCK 1 | ||
| 286 | #else | ||
| 287 | #define AHC_SCSI_HAS_HOST_LOCK 0 | ||
| 288 | #endif | ||
| 289 | |||
| 290 | #define AIC7XXX_DRIVER_VERSION "6.2.36" | 284 | #define AIC7XXX_DRIVER_VERSION "6.2.36" |
| 291 | 285 | ||
| 292 | /**************************** Front End Queues ********************************/ | 286 | /**************************** Front End Queues ********************************/ |
| @@ -438,18 +432,7 @@ struct ahc_linux_target { | |||
| 438 | * manner and are allocated below 4GB, the number of S/G segments is | 432 | * manner and are allocated below 4GB, the number of S/G segments is |
| 439 | * unrestricted. | 433 | * unrestricted. |
| 440 | */ | 434 | */ |
| 441 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 442 | /* | ||
| 443 | * We dynamically adjust the number of segments in pre-2.5 kernels to | ||
| 444 | * avoid fragmentation issues in the SCSI mid-layer's private memory | ||
| 445 | * allocator. See aic7xxx_osm.c ahc_linux_size_nseg() for details. | ||
| 446 | */ | ||
| 447 | extern u_int ahc_linux_nseg; | ||
| 448 | #define AHC_NSEG ahc_linux_nseg | ||
| 449 | #define AHC_LINUX_MIN_NSEG 64 | ||
| 450 | #else | ||
| 451 | #define AHC_NSEG 128 | 435 | #define AHC_NSEG 128 |
| 452 | #endif | ||
| 453 | 436 | ||
| 454 | /* | 437 | /* |
| 455 | * Per-SCB OSM storage. | 438 | * Per-SCB OSM storage. |
| @@ -607,17 +590,6 @@ static __inline void ahc_lockinit(struct ahc_softc *); | |||
| 607 | static __inline void ahc_lock(struct ahc_softc *, unsigned long *flags); | 590 | static __inline void ahc_lock(struct ahc_softc *, unsigned long *flags); |
| 608 | static __inline void ahc_unlock(struct ahc_softc *, unsigned long *flags); | 591 | static __inline void ahc_unlock(struct ahc_softc *, unsigned long *flags); |
| 609 | 592 | ||
| 610 | /* Lock acquisition and release of the above lock in midlayer entry points. */ | ||
| 611 | static __inline void ahc_midlayer_entrypoint_lock(struct ahc_softc *, | ||
| 612 | unsigned long *flags); | ||
| 613 | static __inline void ahc_midlayer_entrypoint_unlock(struct ahc_softc *, | ||
| 614 | unsigned long *flags); | ||
| 615 | |||
| 616 | /* Lock held during command compeletion to the upper layer */ | ||
| 617 | static __inline void ahc_done_lockinit(struct ahc_softc *); | ||
| 618 | static __inline void ahc_done_lock(struct ahc_softc *, unsigned long *flags); | ||
| 619 | static __inline void ahc_done_unlock(struct ahc_softc *, unsigned long *flags); | ||
| 620 | |||
| 621 | /* Lock held during ahc_list manipulation and ahc softc frees */ | 593 | /* Lock held during ahc_list manipulation and ahc softc frees */ |
| 622 | extern spinlock_t ahc_list_spinlock; | 594 | extern spinlock_t ahc_list_spinlock; |
| 623 | static __inline void ahc_list_lockinit(void); | 595 | static __inline void ahc_list_lockinit(void); |
| @@ -643,57 +615,6 @@ ahc_unlock(struct ahc_softc *ahc, unsigned long *flags) | |||
| 643 | } | 615 | } |
| 644 | 616 | ||
| 645 | static __inline void | 617 | static __inline void |
| 646 | ahc_midlayer_entrypoint_lock(struct ahc_softc *ahc, unsigned long *flags) | ||
| 647 | { | ||
| 648 | /* | ||
| 649 | * In 2.5.X and some 2.4.X versions, the midlayer takes our | ||
| 650 | * lock just before calling us, so we avoid locking again. | ||
| 651 | * For other kernel versions, the io_request_lock is taken | ||
| 652 | * just before our entry point is called. In this case, we | ||
| 653 | * trade the io_request_lock for our per-softc lock. | ||
| 654 | */ | ||
| 655 | #if AHC_SCSI_HAS_HOST_LOCK == 0 | ||
| 656 | spin_unlock(&io_request_lock); | ||
| 657 | spin_lock(&ahc->platform_data->spin_lock); | ||
| 658 | #endif | ||
| 659 | } | ||
| 660 | |||
| 661 | static __inline void | ||
| 662 | ahc_midlayer_entrypoint_unlock(struct ahc_softc *ahc, unsigned long *flags) | ||
| 663 | { | ||
| 664 | #if AHC_SCSI_HAS_HOST_LOCK == 0 | ||
| 665 | spin_unlock(&ahc->platform_data->spin_lock); | ||
| 666 | spin_lock(&io_request_lock); | ||
| 667 | #endif | ||
| 668 | } | ||
| 669 | |||
| 670 | static __inline void | ||
| 671 | ahc_done_lockinit(struct ahc_softc *ahc) | ||
| 672 | { | ||
| 673 | /* | ||
| 674 | * In 2.5.X, our own lock is held during completions. | ||
| 675 | * In previous versions, the io_request_lock is used. | ||
| 676 | * In either case, we can't initialize this lock again. | ||
| 677 | */ | ||
| 678 | } | ||
| 679 | |||
| 680 | static __inline void | ||
| 681 | ahc_done_lock(struct ahc_softc *ahc, unsigned long *flags) | ||
| 682 | { | ||
| 683 | #if AHC_SCSI_HAS_HOST_LOCK == 0 | ||
| 684 | spin_lock_irqsave(&io_request_lock, *flags); | ||
| 685 | #endif | ||
| 686 | } | ||
| 687 | |||
| 688 | static __inline void | ||
| 689 | ahc_done_unlock(struct ahc_softc *ahc, unsigned long *flags) | ||
| 690 | { | ||
| 691 | #if AHC_SCSI_HAS_HOST_LOCK == 0 | ||
| 692 | spin_unlock_irqrestore(&io_request_lock, *flags); | ||
| 693 | #endif | ||
| 694 | } | ||
| 695 | |||
| 696 | static __inline void | ||
| 697 | ahc_list_lockinit(void) | 618 | ahc_list_lockinit(void) |
| 698 | { | 619 | { |
| 699 | spin_lock_init(&ahc_list_spinlock); | 620 | spin_lock_init(&ahc_list_spinlock); |
| @@ -759,12 +680,6 @@ typedef enum | |||
| 759 | } ahc_power_state; | 680 | } ahc_power_state; |
| 760 | 681 | ||
| 761 | /**************************** VL/EISA Routines ********************************/ | 682 | /**************************** VL/EISA Routines ********************************/ |
| 762 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) \ | ||
| 763 | && (defined(__i386__) || defined(__alpha__)) \ | ||
| 764 | && (!defined(CONFIG_EISA))) | ||
| 765 | #define CONFIG_EISA | ||
| 766 | #endif | ||
| 767 | |||
| 768 | #ifdef CONFIG_EISA | 683 | #ifdef CONFIG_EISA |
| 769 | extern uint32_t aic7xxx_probe_eisa_vl; | 684 | extern uint32_t aic7xxx_probe_eisa_vl; |
| 770 | int ahc_linux_eisa_init(void); | 685 | int ahc_linux_eisa_init(void); |
| @@ -880,12 +795,8 @@ ahc_flush_device_writes(struct ahc_softc *ahc) | |||
| 880 | } | 795 | } |
| 881 | 796 | ||
| 882 | /**************************** Proc FS Support *********************************/ | 797 | /**************************** Proc FS Support *********************************/ |
| 883 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 884 | int ahc_linux_proc_info(char *, char **, off_t, int, int, int); | ||
| 885 | #else | ||
| 886 | int ahc_linux_proc_info(struct Scsi_Host *, char *, char **, | 798 | int ahc_linux_proc_info(struct Scsi_Host *, char *, char **, |
| 887 | off_t, int, int); | 799 | off_t, int, int); |
| 888 | #endif | ||
| 889 | 800 | ||
| 890 | /*************************** Domain Validation ********************************/ | 801 | /*************************** Domain Validation ********************************/ |
| 891 | /*********************** Transaction Access Wrappers *************************/ | 802 | /*********************** Transaction Access Wrappers *************************/ |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index 6f6674aa31ef..886f92f91846 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | |||
| @@ -236,15 +236,8 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 236 | return (-error); | 236 | return (-error); |
| 237 | } | 237 | } |
| 238 | pci_set_drvdata(pdev, ahc); | 238 | pci_set_drvdata(pdev, ahc); |
| 239 | if (aic7xxx_detect_complete) { | 239 | if (aic7xxx_detect_complete) |
| 240 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) | ||
| 241 | ahc_linux_register_host(ahc, &aic7xxx_driver_template); | 240 | ahc_linux_register_host(ahc, &aic7xxx_driver_template); |
| 242 | #else | ||
| 243 | printf("aic7xxx: ignoring PCI device found after " | ||
| 244 | "initialization\n"); | ||
| 245 | return (-ENODEV); | ||
| 246 | #endif | ||
| 247 | } | ||
| 248 | return (0); | 241 | return (0); |
| 249 | } | 242 | } |
| 250 | 243 | ||
diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c index 85e80eecc9d0..5fece859fbd9 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c | |||
| @@ -289,13 +289,8 @@ done: | |||
| 289 | * Return information to handle /proc support for the driver. | 289 | * Return information to handle /proc support for the driver. |
| 290 | */ | 290 | */ |
| 291 | int | 291 | int |
| 292 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 293 | ahc_linux_proc_info(char *buffer, char **start, off_t offset, | ||
| 294 | int length, int hostno, int inout) | ||
| 295 | #else | ||
| 296 | ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | 292 | ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, |
| 297 | off_t offset, int length, int inout) | 293 | off_t offset, int length, int inout) |
| 298 | #endif | ||
| 299 | { | 294 | { |
| 300 | struct ahc_softc *ahc; | 295 | struct ahc_softc *ahc; |
| 301 | struct info_str info; | 296 | struct info_str info; |
| @@ -307,15 +302,7 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, | |||
| 307 | 302 | ||
| 308 | retval = -EINVAL; | 303 | retval = -EINVAL; |
| 309 | ahc_list_lock(&s); | 304 | ahc_list_lock(&s); |
| 310 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) | ||
| 311 | TAILQ_FOREACH(ahc, &ahc_tailq, links) { | ||
| 312 | if (ahc->platform_data->host->host_no == hostno) | ||
| 313 | break; | ||
| 314 | } | ||
| 315 | #else | ||
| 316 | ahc = ahc_find_softc(*(struct ahc_softc **)shost->hostdata); | 305 | ahc = ahc_find_softc(*(struct ahc_softc **)shost->hostdata); |
| 317 | #endif | ||
| 318 | |||
| 319 | if (ahc == NULL) | 306 | if (ahc == NULL) |
| 320 | goto done; | 307 | goto done; |
| 321 | 308 | ||
