vserver 1.9.5.x5
[linux-2.6.git] / drivers / scsi / aic7xxx / aic79xx_osm.h
index f5c284d..605f92b 100644 (file)
 #include <asm/byteorder.h>
 #include <asm/io.h>
 
-#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 <linux/interrupt.h> /* For tasklet support. */
 #include <linux/config.h>
 #include <linux/slab.h>
-#else
-#include <linux/malloc.h>
-#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 {
@@ -158,12 +145,12 @@ typedef enum {
 
 typedef union {
        u_long            ioport;
-       volatile uint8_t *maddr;
+       volatile uint8_t __iomem *maddr;
 } bus_space_handle_t;
 
 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 <linux/spinlock.h>
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,93)
-#include <linux/smp.h>
-#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;
+       uint64_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
@@ -1212,4 +1143,5 @@ void      ahd_platform_dump_card_state(struct ahd_softc *ahd);
 #endif
 #define bootverbose aic79xx_verbose
 extern uint32_t aic79xx_verbose;
+
 #endif /* _AIC79XX_LINUX_H_ */