From 5708e7bdac1aa3aa51292722bd6851de69be2b8b Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Thu, 23 Sep 2004 05:37:20 -0400 Subject: [PATCH] remove old ifdefs aic79xx From: janitor@sternwelten.at Patches to remove some old ifdefs. remove most of the #include kill compat cruft like #define ahd_pci_set_dma_mask pci_set_dma_mask Signed-off-by: Maximilian Attems Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic79xx.h | 8 +- drivers/scsi/aic7xxx/aic79xx_core.c | 14 +-- drivers/scsi/aic7xxx/aic79xx_inline.h | 10 +-- drivers/scsi/aic7xxx/aic79xx_osm.c | 89 +++---------------- drivers/scsi/aic7xxx/aic79xx_osm.h | 81 ++---------------- drivers/scsi/aic7xxx/aic79xx_osm_pci.c | 113 ++----------------------- drivers/scsi/aic7xxx/cam.h | 6 -- 7 files changed, 41 insertions(+), 280 deletions(-) diff --git a/drivers/scsi/aic7xxx/aic79xx.h b/drivers/scsi/aic7xxx/aic79xx.h index be65968acd39b..fd4b2f3eb0c20 100644 --- a/drivers/scsi/aic7xxx/aic79xx.h +++ b/drivers/scsi/aic7xxx/aic79xx.h @@ -549,7 +549,7 @@ struct ahd_dma64_seg { struct map_node { bus_dmamap_t dmamap; - bus_addr_t physaddr; + dma_addr_t physaddr; uint8_t *vaddr; SLIST_ENTRY(map_node) links; }; @@ -626,8 +626,8 @@ struct scb { struct map_node *sense_map; void *sg_list; uint8_t *sense_data; - bus_addr_t sg_list_busaddr; - bus_addr_t sense_busaddr; + dma_addr_t sg_list_busaddr; + dma_addr_t sense_busaddr; u_int sg_count;/* How full ahd_dma_seg is */ #define AHD_MAX_LQ_CRC_ERRORS 5 u_int crc_retry_count; @@ -1198,7 +1198,7 @@ struct ahd_softc { bus_dma_tag_t parent_dmat; bus_dma_tag_t shared_data_dmat; bus_dmamap_t shared_data_dmamap; - bus_addr_t shared_data_busaddr; + dma_addr_t shared_data_busaddr; /* Information saved through suspend/resume cycles */ struct ahd_suspend_state suspend_state; diff --git a/drivers/scsi/aic7xxx/aic79xx_core.c b/drivers/scsi/aic7xxx/aic79xx_core.c index 4440afca5f510..3262266f7e6ce 100644 --- a/drivers/scsi/aic7xxx/aic79xx_core.c +++ b/drivers/scsi/aic7xxx/aic79xx_core.c @@ -5493,9 +5493,9 @@ ahd_probe_scbs(struct ahd_softc *ahd) { static void ahd_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int error) { - bus_addr_t *baddr; + dma_addr_t *baddr; - baddr = (bus_addr_t *)arg; + baddr = (dma_addr_t *)arg; *baddr = segs->ds_addr; } @@ -5926,9 +5926,9 @@ ahd_alloc_scbs(struct ahd_softc *ahd) struct map_node *sense_map; uint8_t *segs; uint8_t *sense_data; - bus_addr_t hscb_busaddr; - bus_addr_t sg_busaddr; - bus_addr_t sense_busaddr; + dma_addr_t hscb_busaddr; + dma_addr_t sg_busaddr; + dma_addr_t sense_busaddr; int newcount; int i; @@ -6161,7 +6161,7 @@ ahd_init(struct ahd_softc *ahd) { uint8_t *base_vaddr; uint8_t *next_vaddr; - bus_addr_t next_baddr; + dma_addr_t next_baddr; size_t driver_data_size; int i; int error; @@ -6205,7 +6205,7 @@ ahd_init(struct ahd_softc *ahd) if (ahd_dma_tag_create(ahd, ahd->parent_dmat, /*alignment*/1, /*boundary*/BUS_SPACE_MAXADDR_32BIT + 1, /*lowaddr*/ahd->flags & AHD_39BIT_ADDRESSING - ? (bus_addr_t)0x7FFFFFFFFFULL + ? (dma_addr_t)0x7FFFFFFFFFULL : BUS_SPACE_MAXADDR_32BIT, /*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL, diff --git a/drivers/scsi/aic7xxx/aic79xx_inline.h b/drivers/scsi/aic7xxx/aic79xx_inline.h index 440212af4419b..d80bc5161fb14 100644 --- a/drivers/scsi/aic7xxx/aic79xx_inline.h +++ b/drivers/scsi/aic7xxx/aic79xx_inline.h @@ -231,7 +231,7 @@ ahd_unpause(struct ahd_softc *ahd) /*********************** Scatter Gather List Handling *************************/ static __inline void *ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb, - void *sgptr, bus_addr_t addr, + void *sgptr, dma_addr_t addr, bus_size_t len, int last); static __inline void ahd_setup_scb_common(struct ahd_softc *ahd, struct scb *scb); @@ -242,10 +242,10 @@ static __inline void ahd_setup_noxfer_scb(struct ahd_softc *ahd, static __inline void * ahd_sg_setup(struct ahd_softc *ahd, struct scb *scb, - void *sgptr, bus_addr_t addr, bus_size_t len, int last) + void *sgptr, dma_addr_t addr, bus_size_t len, int last) { scb->sg_count++; - if (sizeof(bus_addr_t) > 4 + if (sizeof(dma_addr_t) > 4 && (ahd->flags & AHD_64BIT_ADDRESSING) != 0) { struct ahd_dma64_seg *sg; @@ -361,7 +361,7 @@ ahd_sg_size(struct ahd_softc *ahd) static __inline void * ahd_sg_bus_to_virt(struct ahd_softc *ahd, struct scb *scb, uint32_t sg_busaddr) { - bus_addr_t sg_offset; + dma_addr_t sg_offset; /* sg_list_phys points to entry 1, not 0 */ sg_offset = sg_busaddr - (scb->sg_list_busaddr - ahd_sg_size(ahd)); @@ -371,7 +371,7 @@ ahd_sg_bus_to_virt(struct ahd_softc *ahd, struct scb *scb, uint32_t sg_busaddr) static __inline uint32_t ahd_sg_virt_to_bus(struct ahd_softc *ahd, struct scb *scb, void *sg) { - bus_addr_t sg_offset; + dma_addr_t sg_offset; /* sg_list_phys points to entry 1, not 0 */ sg_offset = ((uint8_t *)sg - (uint8_t *)scb->sg_list) diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 6a2bf6cc04bf2..4aa2720b14ee4 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -52,9 +52,7 @@ */ #include "aiclib.c" -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) #include /* __setup */ -#endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include "sd.h" /* For geometry detection */ @@ -68,14 +66,6 @@ */ spinlock_t ahd_list_spinlock; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) -struct proc_dir_entry proc_scsi_aic79xx = { - PROC_SCSI_AIC79XX, 7, "aic79xx", - S_IFDIR | S_IRUGO | S_IXUGO, 2, - 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL -}; -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* For dynamic sglist size calculation. */ u_int ahd_linux_nseg; @@ -561,7 +551,7 @@ static __inline void ahd_linux_unmap_scb(struct ahd_softc*, struct scb*); static __inline int ahd_linux_map_seg(struct ahd_softc *ahd, struct scb *scb, struct ahd_dma_seg *sg, - bus_addr_t addr, bus_size_t len); + dma_addr_t addr, bus_size_t len); static __inline void ahd_schedule_completeq(struct ahd_softc *ahd) @@ -579,31 +569,20 @@ ahd_schedule_completeq(struct ahd_softc *ahd) static __inline void ahd_schedule_runq(struct ahd_softc *ahd) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) tasklet_schedule(&ahd->platform_data->runq_tasklet); -#else - /* - * Tasklets are not available, so run inline. - */ - ahd_runq_tasklet((unsigned long)ahd); -#endif } static __inline void ahd_setup_runq_tasklet(struct ahd_softc *ahd) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) tasklet_init(&ahd->platform_data->runq_tasklet, ahd_runq_tasklet, (unsigned long)ahd); -#endif } static __inline void ahd_teardown_runq_tasklet(struct ahd_softc *ahd) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) tasklet_kill(&ahd->platform_data->runq_tasklet); -#endif } static __inline struct ahd_linux_device* @@ -734,7 +713,7 @@ ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb) static __inline int ahd_linux_map_seg(struct ahd_softc *ahd, struct scb *scb, - struct ahd_dma_seg *sg, bus_addr_t addr, bus_size_t len) + struct ahd_dma_seg *sg, dma_addr_t addr, bus_size_t len) { int consumed; @@ -746,7 +725,7 @@ ahd_linux_map_seg(struct ahd_softc *ahd, struct scb *scb, sg->addr = ahd_htole32(addr & 0xFFFFFFFF); scb->platform_data->xfer_len += len; - if (sizeof(bus_addr_t) > 4 + if (sizeof(dma_addr_t) > 4 && (ahd->flags & AHD_39BIT_ADDRESSING) != 0) len |= (addr >> 8) & AHD_SG_HIGH_ADDR_MASK; @@ -890,11 +869,7 @@ ahd_linux_detect(Scsi_Host_Template *template) "aic79xx: insmod or else it might trash certain memory areas.\n"); #endif -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,0) template->proc_name = "aic79xx"; -#else - template->proc_dir = &proc_scsi_aic79xx; -#endif /* * Initialize our softc list lock prior to @@ -1701,35 +1676,27 @@ ahd_runq_tasklet(unsigned long data) { struct ahd_softc* ahd; struct ahd_linux_device *dev; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) u_long flags; -#endif ahd = (struct ahd_softc *)data; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) ahd_lock(ahd, &flags); -#endif while ((dev = ahd_linux_next_device_to_run(ahd)) != NULL) { TAILQ_REMOVE(&ahd->platform_data->device_runq, dev, links); dev->flags &= ~AHD_DEV_ON_RUN_LIST; ahd_linux_check_device_queue(ahd, dev); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) /* Yeild to our interrupt handler */ ahd_unlock(ahd, &flags); ahd_lock(ahd, &flags); -#endif } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) ahd_unlock(ahd, &flags); -#endif } /******************************** Bus DMA *************************************/ int ahd_dma_tag_create(struct ahd_softc *ahd, bus_dma_tag_t parent, bus_size_t alignment, bus_size_t boundary, - bus_addr_t lowaddr, bus_addr_t highaddr, + dma_addr_t lowaddr, dma_addr_t highaddr, bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, bus_dma_tag_t *ret_tag) @@ -1766,7 +1733,6 @@ ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr, { bus_dmamap_t map; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) map = malloc(sizeof(*map), M_DEVBUF, M_NOWAIT); if (map == NULL) return (ENOMEM); @@ -1778,7 +1744,7 @@ ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr, * our dma mask when doing allocations. */ if (ahd->dev_softc != NULL) - if (ahd_pci_set_dma_mask(ahd->dev_softc, 0xFFFFFFFF)) { + if (pci_set_dma_mask(ahd->dev_softc, 0xFFFFFFFF)) { printk(KERN_WARNING "aic79xx: No suitable DMA available.\n"); kfree(map); return (ENODEV); @@ -1786,22 +1752,12 @@ ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr, *vaddr = pci_alloc_consistent(ahd->dev_softc, dmat->maxsize, &map->bus_addr); if (ahd->dev_softc != NULL) - if (ahd_pci_set_dma_mask(ahd->dev_softc, + if (pci_set_dma_mask(ahd->dev_softc, ahd->platform_data->hw_dma_mask)) { printk(KERN_WARNING "aic79xx: No suitable DMA available.\n"); kfree(map); return (ENODEV); } -#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) */ - /* - * At least in 2.2.14, malloc is a slab allocator so all - * allocations are aligned. We assume for these kernel versions - * that all allocations will be bellow 4Gig, physically contiguous, - * and accessible via DMA by the controller. - */ - map = NULL; /* No additional information to store */ - *vaddr = malloc(dmat->maxsize, M_DEVBUF, M_NOWAIT); -#endif if (*vaddr == NULL) return (ENOMEM); *mapp = map; @@ -1812,12 +1768,8 @@ void ahd_dmamem_free(struct ahd_softc *ahd, bus_dma_tag_t dmat, void* vaddr, bus_dmamap_t map) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) pci_free_consistent(ahd->dev_softc, dmat->maxsize, vaddr, map->bus_addr); -#else - free(vaddr, M_DEVBUF); -#endif } int @@ -1831,12 +1783,7 @@ ahd_dmamap_load(struct ahd_softc *ahd, bus_dma_tag_t dmat, bus_dmamap_t map, */ bus_dma_segment_t stack_sg; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) stack_sg.ds_addr = map->bus_addr; -#else -#define VIRT_TO_BUS(a) (uint32_t)virt_to_bus((void *)(a)) - stack_sg.ds_addr = VIRT_TO_BUS(buf); -#endif stack_sg.ds_len = dmat->maxsize; cb(cb_arg, &stack_sg, /*nseg*/1, /*error*/0); return (0); @@ -2068,9 +2015,7 @@ aic79xx_setup(char *s) return 1; } -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,0) __setup("aic79xx=", aic79xx_setup); -#endif uint32_t aic79xx_verbose; @@ -2113,8 +2058,7 @@ ahd_linux_register_host(struct ahd_softc *ahd, Scsi_Host_Template *template) ahd_set_name(ahd, new_name); } host->unique_id = ahd->unit; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,4) && \ - LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) scsi_set_pci_device(host, ahd->dev_softc); #endif ahd_linux_setup_user_rd_strm_settings(ahd); @@ -2266,15 +2210,9 @@ ahd_platform_alloc(struct ahd_softc *ahd, void *platform_arg) ahd->platform_data->completeq_timer.data = (u_long)ahd; ahd->platform_data->completeq_timer.function = (ahd_linux_callback_t *)ahd_linux_thread_run_complete_queue; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) init_MUTEX_LOCKED(&ahd->platform_data->eh_sem); init_MUTEX_LOCKED(&ahd->platform_data->dv_sem); init_MUTEX_LOCKED(&ahd->platform_data->dv_cmd_sem); -#else - ahd->platform_data->eh_sem = MUTEX_LOCKED; - ahd->platform_data->dv_sem = MUTEX_LOCKED; - ahd->platform_data->dv_cmd_sem = MUTEX_LOCKED; -#endif ahd_setup_runq_tasklet(ahd); ahd->seltime = (aic79xx_seltime & 0x3) << 4; return (0); @@ -2334,13 +2272,10 @@ ahd_platform_free(struct ahd_softc *ahd) base_addr = (u_long)ahd->bshs[0].maddr; base_addr &= PAGE_MASK; iounmap((void *)base_addr); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) release_mem_region(ahd->platform_data->mem_busaddr, 0x1000); -#endif } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) && \ - LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) /* * In 2.4 we detach from the scsi midlayer before the PCI * layer invokes our remove callback. No per-instance @@ -4130,7 +4065,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev) cmd->use_sg, dir); scb->platform_data->xfer_len = 0; for (sg = scb->sg_list; nseg > 0; nseg--, cur_seg++) { - bus_addr_t addr; + dma_addr_t addr; bus_size_t len; addr = sg_dma_address(cur_seg); @@ -4141,7 +4076,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev) } } else if (cmd->request_bufflen != 0) { void *sg; - bus_addr_t addr; + dma_addr_t addr; int dir; sg = scb->sg_list; @@ -4375,7 +4310,7 @@ ahd_send_async(struct ahd_softc *ahd, char channel, WARN_ON(lun != CAM_LUN_WILDCARD); scsi_report_device_reset(ahd->platform_data->host, channel - 'A', target); -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) +#else Scsi_Device *scsi_dev; /* @@ -4396,12 +4331,10 @@ ahd_send_async(struct ahd_softc *ahd, char channel, break; } case AC_BUS_RESET: -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) if (ahd->platform_data->host != NULL) { scsi_report_bus_reset(ahd->platform_data->host, channel - 'A'); } -#endif break; default: panic("ahd_send_async: Unexpected async event"); diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index f5c284dd42f9d..ae37e7c14f1d2 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h @@ -53,17 +53,9 @@ #include #include -#ifndef KERNEL_VERSION -#define KERNEL_VERSION(x,y,z) (((x)<<16)+((y)<<8)+(z)) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #include /* For tasklet support. */ #include #include -#else -#include -#endif /* Core SCSI definitions */ #define AIC_LIB_PREFIX ahd @@ -144,11 +136,6 @@ extern Scsi_Host_Template aic79xx_driver_template; /***************************** Bus Space/DMA **********************************/ -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,17) -typedef dma_addr_t bus_addr_t; -#else -typedef uint32_t bus_addr_t; -#endif typedef uint32_t bus_size_t; typedef enum { @@ -163,7 +150,7 @@ typedef union { typedef struct bus_dma_segment { - bus_addr_t ds_addr; + dma_addr_t ds_addr; bus_size_t ds_len; } bus_dma_segment_t; @@ -177,11 +164,11 @@ typedef struct ahd_linux_dma_tag* bus_dma_tag_t; struct ahd_linux_dmamap { - bus_addr_t bus_addr; + dma_addr_t bus_addr; }; typedef struct ahd_linux_dmamap* bus_dmamap_t; -typedef int bus_dma_filter_t(void*, bus_addr_t); +typedef int bus_dma_filter_t(void*, dma_addr_t); typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int); #define BUS_DMA_WAITOK 0x0 @@ -198,7 +185,7 @@ typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int); int ahd_dma_tag_create(struct ahd_softc *, bus_dma_tag_t /*parent*/, bus_size_t /*alignment*/, bus_size_t /*boundary*/, - bus_addr_t /*lowaddr*/, bus_addr_t /*highaddr*/, + dma_addr_t /*lowaddr*/, dma_addr_t /*highaddr*/, bus_dma_filter_t*/*filter*/, void */*filterarg*/, bus_size_t /*maxsize*/, int /*nsegments*/, bus_size_t /*maxsegsz*/, int /*flags*/, @@ -280,11 +267,7 @@ ahd_scb_timer_reset(struct scb *scb, u_int usec) } /***************************** SMP support ************************************/ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,17) #include -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93) -#include -#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) || defined(SCSI_HAS_HOST_LOCK)) #define AHD_SCSI_HAS_HOST_LOCK 1 @@ -509,11 +492,8 @@ typedef enum { struct scb_platform_data { struct ahd_linux_device *dev; - bus_addr_t buf_busaddr; + dma_addr_t buf_busaddr; uint32_t xfer_len; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) - uint32_t resid; /* Transfer residual */ -#endif uint32_t sense_resid; /* Auto-Sense residual */ ahd_linux_scb_flags flags; }; @@ -543,9 +523,7 @@ struct ahd_platform_data { struct ahd_completeq completeq; spinlock_t spin_lock; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) struct tasklet_struct runq_tasklet; -#endif u_int qfrozen; pid_t dv_pid; struct timer_list completeq_timer; @@ -562,7 +540,7 @@ struct ahd_platform_data { uint32_t irq; /* IRQ for this adapter */ uint32_t bios_address; uint32_t mem_busaddr; /* Mem Base Addr */ - bus_addr_t hw_dma_mask; + dma_addr_t hw_dma_mask; ahd_linux_softc_flags flags; }; @@ -859,9 +837,7 @@ ahd_list_unlock(unsigned long *flags) #define PCIXM_STATUS_MAXCRDS 0x1C00 /* Maximum Cumulative Read Size */ #define PCIXM_STATUS_RCVDSCEM 0x2000 /* Received a Split Comp w/Error msg */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) extern struct pci_driver aic79xx_pci_driver; -#endif typedef enum { @@ -965,25 +941,6 @@ ahd_flush_device_writes(struct ahd_softc *ahd) ahd_inb(ahd, INTSTAT); } -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0) -#define pci_map_sg(pdev, sg_list, nseg, direction) (nseg) -#define pci_unmap_sg(pdev, sg_list, nseg, direction) -#define sg_dma_address(sg) (VIRT_TO_BUS((sg)->address)) -#define sg_dma_len(sg) ((sg)->length) -#define pci_map_single(pdev, buffer, bufflen, direction) \ - (VIRT_TO_BUS(buffer)) -#define pci_unmap_single(pdev, buffer, buflen, direction) -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3) -#define ahd_pci_set_dma_mask pci_set_dma_mask -#else -/* - * Always "return" 0 for success. - */ -#define ahd_pci_set_dma_mask(dev_softc, mask) \ - (((dev_softc)->dma_mask = mask) && 0) -#endif /**************************** Proc FS Support *********************************/ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) int ahd_linux_proc_info(char *, char **, off_t, int, int, int); @@ -1091,35 +1048,13 @@ u_long ahd_get_transfer_length(struct scb *scb) static __inline int ahd_get_transfer_dir(struct scb *scb) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,40) return (scb->io_ctx->sc_data_direction); -#else - if (scb->io_ctx->bufflen == 0) - return (CAM_DIR_NONE); - - switch(scb->io_ctx->cmnd[0]) { - case 0x08: /* READ(6) */ - case 0x28: /* READ(10) */ - case 0xA8: /* READ(12) */ - return (CAM_DIR_IN); - case 0x0A: /* WRITE(6) */ - case 0x2A: /* WRITE(10) */ - case 0xAA: /* WRITE(12) */ - return (CAM_DIR_OUT); - default: - return (CAM_DIR_NONE); - } -#endif } static __inline void ahd_set_residual(struct scb *scb, u_long resid) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) scb->io_ctx->resid = resid; -#else - scb->platform_data->resid = resid; -#endif } static __inline @@ -1131,11 +1066,7 @@ void ahd_set_sense_residual(struct scb *scb, u_long resid) static __inline u_long ahd_get_residual(struct scb *scb) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) return (scb->io_ctx->resid); -#else - return (scb->platform_data->resid); -#endif } static __inline diff --git a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c index 804fb43cc9f1c..565cbf3a0e20d 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c @@ -42,12 +42,6 @@ #include "aic79xx_osm.h" #include "aic79xx_inline.h" -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -struct pci_device_id -{ -}; -#endif - static int ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent); static int ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, @@ -55,7 +49,6 @@ static int ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, static int ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd, u_long *bus_addr, uint8_t **maddr); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) static void ahd_linux_pci_dev_remove(struct pci_dev *pdev); /* We do our own ID filtering. So, grab all SCSI storage class devices. */ @@ -103,7 +96,6 @@ ahd_linux_pci_dev_remove(struct pci_dev *pdev) } ahd_list_unlock(&l); } -#endif /* !LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) */ static int ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) @@ -152,42 +144,39 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ahd = ahd_alloc(NULL, name); if (ahd == NULL) return (-ENOMEM); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) if (pci_enable_device(pdev)) { ahd_free(ahd); return (-ENODEV); } pci_set_master(pdev); - if (sizeof(bus_addr_t) > 4) { + if (sizeof(dma_addr_t) > 4) { uint64_t memsize; - bus_addr_t mask_64bit; - bus_addr_t mask_39bit; + dma_addr_t mask_64bit; + dma_addr_t mask_39bit; memsize = ahd_linux_get_memsize(); - mask_64bit = (bus_addr_t)0xFFFFFFFFFFFFFFFFULL; - mask_39bit = (bus_addr_t)0x7FFFFFFFFFULL; + mask_64bit = (dma_addr_t)0xFFFFFFFFFFFFFFFFULL; + mask_39bit = (dma_addr_t)0x7FFFFFFFFFULL; if (memsize >= 0x8000000000ULL - && ahd_pci_set_dma_mask(pdev, mask_64bit) == 0) { + && pci_set_dma_mask(pdev, mask_64bit) == 0) { ahd->flags |= AHD_64BIT_ADDRESSING; ahd->platform_data->hw_dma_mask = mask_64bit; } else if (memsize > 0x80000000 - && ahd_pci_set_dma_mask(pdev, mask_39bit) == 0) { + && pci_set_dma_mask(pdev, mask_39bit) == 0) { ahd->flags |= AHD_39BIT_ADDRESSING; ahd->platform_data->hw_dma_mask = mask_39bit; } } else { - ahd_pci_set_dma_mask(pdev, 0xFFFFFFFF); + pci_set_dma_mask(pdev, 0xFFFFFFFF); ahd->platform_data->hw_dma_mask = 0xFFFFFFFF; } -#endif ahd->dev_softc = pci; error = ahd_pci_config(ahd, entry); if (error != 0) { ahd_free(ahd); return (-error); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) pci_set_drvdata(pdev, ahd); if (aic79xx_detect_complete) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) @@ -198,38 +187,13 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) return (-ENODEV); #endif } -#endif return (0); } int ahd_linux_pci_init(void) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) return (pci_module_init(&aic79xx_pci_driver)); -#else - struct pci_dev *pdev; - u_int class; - int found; - - /* If we don't have a PCI bus, we can't find any adapters. */ - if (pci_present() == 0) - return (0); - - found = 0; - pdev = NULL; - class = PCI_CLASS_STORAGE_SCSI << 8; - while ((pdev = pci_find_class(class, pdev)) != NULL) { - ahd_dev_softc_t pci; - int error; - - pci = pdev; - error = ahd_linux_pci_dev_probe(pdev, /*pci_devid*/NULL); - if (error == 0) - found++; - } - return (found); -#endif } void @@ -242,7 +206,6 @@ static int ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, u_long *base, u_long *base2) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) *base = pci_resource_start(ahd->dev_softc, 0); /* * This is really the 3rd bar and should be at index 2, @@ -250,28 +213,14 @@ ahd_linux_pci_reserve_io_regions(struct ahd_softc *ahd, u_long *base, * bars. */ *base2 = pci_resource_start(ahd->dev_softc, 3); -#else - *base = ahd_pci_read_config(ahd->dev_softc, AHD_PCI_IOADDR0, 4); - *base2 = ahd_pci_read_config(ahd->dev_softc, AHD_PCI_IOADDR1, 4); - *base &= PCI_BASE_ADDRESS_IO_MASK; - *base2 &= PCI_BASE_ADDRESS_IO_MASK; -#endif if (*base == 0 || *base2 == 0) return (ENOMEM); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) - if (check_region(*base, 256) != 0 - || check_region(*base2, 256) != 0) - return (ENOMEM); - request_region(*base, 256, "aic79xx"); - request_region(*base2, 256, "aic79xx"); -#else if (request_region(*base, 256, "aic79xx") == 0) return (ENOMEM); if (request_region(*base2, 256, "aic79xx") == 0) { release_region(*base2, 256); return (ENOMEM); } -#endif return (0); } @@ -292,29 +241,18 @@ ahd_linux_pci_reserve_mem_region(struct ahd_softc *ahd, return (ENOMEM); error = 0; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) start = pci_resource_start(ahd->dev_softc, 1); base_page = start & PAGE_MASK; base_offset = start - base_page; -#else - start = ahd_pci_read_config(ahd->dev_softc, PCIR_MAPS+4, 4); - base_offset = start & PCI_BASE_ADDRESS_MEM_MASK; - base_page = base_offset & PAGE_MASK; - base_offset -= base_page; -#endif if (start != 0) { *bus_addr = start; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) if (request_mem_region(start, 0x1000, "aic79xx") == 0) error = ENOMEM; -#endif if (error == 0) { *maddr = ioremap_nocache(base_page, base_offset + 256); if (*maddr == NULL) { error = ENOMEM; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) release_mem_region(start, 0x1000); -#endif } else *maddr += base_offset; } @@ -356,10 +294,8 @@ ahd_pci_map_registers(struct ahd_softc *ahd) ahd_get_pci_slot(ahd->dev_softc), ahd_get_pci_function(ahd->dev_softc)); iounmap((void *)((u_long)maddr & PAGE_MASK)); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) release_mem_region(ahd->platform_data->mem_busaddr, 0x1000); -#endif ahd->bshs[0].maddr = NULL; maddr = NULL; } else @@ -412,38 +348,5 @@ ahd_pci_map_int(struct ahd_softc *ahd) void ahd_power_state_change(struct ahd_softc *ahd, ahd_power_state new_state) { -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) pci_set_power_state(ahd->dev_softc, new_state); -#else - uint32_t cap; - u_int cap_offset; - - /* - * Traverse the capability list looking for - * the power management capability. - */ - cap = 0; - cap_offset = ahd_pci_read_config(ahd->dev_softc, - PCIR_CAP_PTR, /*bytes*/1); - while (cap_offset != 0) { - - cap = ahd_pci_read_config(ahd->dev_softc, - cap_offset, /*bytes*/4); - if ((cap & 0xFF) == 1 - && ((cap >> 16) & 0x3) > 0) { - uint32_t pm_control; - - pm_control = ahd_pci_read_config(ahd->dev_softc, - cap_offset + 4, - /*bytes*/4); - pm_control &= ~0x3; - pm_control |= new_state; - ahd_pci_write_config(ahd->dev_softc, - cap_offset + 4, - pm_control, /*bytes*/2); - break; - } - cap_offset = (cap >> 8) & 0xFF; - } -#endif } diff --git a/drivers/scsi/aic7xxx/cam.h b/drivers/scsi/aic7xxx/cam.h index b9ba333a10e58..d40ba0760c765 100644 --- a/drivers/scsi/aic7xxx/cam.h +++ b/drivers/scsi/aic7xxx/cam.h @@ -85,12 +85,6 @@ typedef enum { CAM_STATUS_MASK = 0x3F } cam_status; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) -#define SCSI_DATA_READ 1 -#define SCSI_DATA_WRITE 2 -#define SCSI_DATA_NONE 3 -#endif - /* * Definitions for the asynchronous callback CCB fields. */ -- 2.53.0