powerpc: Sanitize stack pointer in signal handling code
[safe/jmp/linux-2.6] / drivers / scsi / aic7xxx / aic7xxx_osm.h
index c529962..3f7238d 100644 (file)
 #ifndef _AIC7XXX_LINUX_H_
 #define _AIC7XXX_LINUX_H_
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
-#include <linux/smp_lock.h>
-#include <linux/version.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -224,9 +221,6 @@ int ahc_dmamap_unload(struct ahc_softc *, bus_dma_tag_t, bus_dmamap_t);
  */
 #define ahc_dmamap_sync(ahc, dma_tag, dmamap, offset, len, op)
 
-/************************** Timer DataStructures ******************************/
-typedef struct timer_list ahc_timer_t;
-
 /********************************** Includes **********************************/
 #ifdef CONFIG_AIC7XXX_REG_PRETTY_PRINT
 #define AIC_DEBUG_REGISTERS 1
@@ -236,30 +230,9 @@ typedef struct timer_list ahc_timer_t;
 #include "aic7xxx.h"
 
 /***************************** Timer Facilities *******************************/
-#define ahc_timer_init init_timer
-#define ahc_timer_stop del_timer_sync
-typedef void ahc_linux_callback_t (u_long);  
-static __inline void ahc_timer_reset(ahc_timer_t *timer, int usec,
-                                    ahc_callback_t *func, void *arg);
-static __inline void ahc_scb_timer_reset(struct scb *scb, u_int usec);
-
-static __inline void
-ahc_timer_reset(ahc_timer_t *timer, int usec, ahc_callback_t *func, void *arg)
-{
-       struct ahc_softc *ahc;
-
-       ahc = (struct ahc_softc *)arg;
-       del_timer(timer);
-       timer->data = (u_long)arg;
-       timer->expires = jiffies + (usec * HZ)/1000000;
-       timer->function = (ahc_linux_callback_t*)func;
-       add_timer(timer);
-}
-
 static __inline void
 ahc_scb_timer_reset(struct scb *scb, u_int usec)
 {
-       mod_timer(&scb->io_ctx->eh_timeout, jiffies + (usec * HZ)/1000000);
 }
 
 /***************************** SMP support ************************************/
@@ -282,7 +255,6 @@ typedef enum {
        AHC_DEV_PERIODIC_OTAG    = 0x40, /* Send OTAG to prevent starvation */
 } ahc_linux_dev_flags;
 
-struct ahc_linux_target;
 struct ahc_linux_device {
        /*
         * The number of transactions currently
@@ -355,12 +327,6 @@ struct ahc_linux_device {
 #define AHC_OTAG_THRESH        500
 };
 
-struct ahc_linux_target {
-       struct scsi_device       *sdev[AHC_NUM_LUNS];
-       struct ahc_transinfo      last_tinfo;
-       struct ahc_softc         *ahc;
-};
-
 /********************* Definitions Required by the Core ***********************/
 /*
  * Number of SG segments we require.  So long as the S/G segments for
@@ -394,16 +360,12 @@ struct ahc_platform_data {
 
        spinlock_t               spin_lock;
        u_int                    qfrozen;
-       struct timer_list        reset_timer;
-       struct semaphore         eh_sem;
+       struct completion       *eh_done;
        struct Scsi_Host        *host;          /* pointer to scsi host */
 #define AHC_LINUX_NOIRQ        ((uint32_t)~0)
        uint32_t                 irq;           /* IRQ for this adapter */
        uint32_t                 bios_address;
-       uint32_t                 mem_busaddr;   /* Mem Base Addr */
-
-#define        AHC_UP_EH_SEMAPHORE      0x1
-       uint32_t                 flags;
+       resource_size_t          mem_busaddr;   /* Mem Base Addr */
 };
 
 /************************** OS Utility Wrappers *******************************/
@@ -413,89 +375,21 @@ struct ahc_platform_data {
 #define malloc(size, type, flags) kmalloc(size, flags)
 #define free(ptr, type) kfree(ptr)
 
-static __inline void ahc_delay(long);
-static __inline void
-ahc_delay(long usec)
-{
-       /*
-        * udelay on Linux can have problems for
-        * multi-millisecond waits.  Wait at most
-        * 1024us per call.
-        */
-       while (usec > 0) {
-               udelay(usec % 1024);
-               usec -= 1024;
-       }
-}
+void ahc_delay(long);
 
 
 /***************************** Low Level I/O **********************************/
-static __inline uint8_t ahc_inb(struct ahc_softc * ahc, long port);
-static __inline void ahc_outb(struct ahc_softc * ahc, long port, uint8_t val);
-static __inline void ahc_outsb(struct ahc_softc * ahc, long port,
-                              uint8_t *, int count);
-static __inline void ahc_insb(struct ahc_softc * ahc, long port,
-                              uint8_t *, int count);
-
-static __inline uint8_t
-ahc_inb(struct ahc_softc * ahc, long port)
-{
-       uint8_t x;
-
-       if (ahc->tag == BUS_SPACE_MEMIO) {
-               x = readb(ahc->bsh.maddr + port);
-       } else {
-               x = inb(ahc->bsh.ioport + port);
-       }
-       mb();
-       return (x);
-}
-
-static __inline void
-ahc_outb(struct ahc_softc * ahc, long port, uint8_t val)
-{
-       if (ahc->tag == BUS_SPACE_MEMIO) {
-               writeb(val, ahc->bsh.maddr + port);
-       } else {
-               outb(val, ahc->bsh.ioport + port);
-       }
-       mb();
-}
-
-static __inline void
-ahc_outsb(struct ahc_softc * ahc, long port, uint8_t *array, int count)
-{
-       int i;
-
-       /*
-        * There is probably a more efficient way to do this on Linux
-        * but we don't use this for anything speed critical and this
-        * should work.
-        */
-       for (i = 0; i < count; i++)
-               ahc_outb(ahc, port, *array++);
-}
-
-static __inline void
-ahc_insb(struct ahc_softc * ahc, long port, uint8_t *array, int count)
-{
-       int i;
-
-       /*
-        * There is probably a more efficient way to do this on Linux
-        * but we don't use this for anything speed critical and this
-        * should work.
-        */
-       for (i = 0; i < count; i++)
-               *array++ = ahc_inb(ahc, port);
-}
+uint8_t ahc_inb(struct ahc_softc * ahc, long port);
+void ahc_outb(struct ahc_softc * ahc, long port, uint8_t val);
+void ahc_outsb(struct ahc_softc * ahc, long port,
+              uint8_t *, int count);
+void ahc_insb(struct ahc_softc * ahc, long port,
+              uint8_t *, int count);
 
 /**************************** Initialization **********************************/
 int            ahc_linux_register_host(struct ahc_softc *,
                                        struct scsi_host_template *);
 
-uint64_t       ahc_linux_get_memsize(void);
-
 /*************************** Pretty Printing **********************************/
 struct info_str {
        char *buffer;
@@ -504,9 +398,6 @@ struct info_str {
        int pos;
 };
 
-void   ahc_format_transinfo(struct info_str *info,
-                            struct ahc_transinfo *tinfo);
-
 /******************************** Locking *************************************/
 /* Lock protecting internal data structures */
 
@@ -565,8 +456,6 @@ ahc_unlock(struct ahc_softc *ahc, unsigned long *flags)
 #define PCIR_SUBVEND_0 0x2c
 #define PCIR_SUBDEV_0  0x2e
 
-extern struct pci_driver aic7xxx_pci_driver;
-
 typedef enum
 {
        AHC_POWER_STATE_D0,
@@ -597,61 +486,12 @@ void                       ahc_linux_pci_exit(void);
 int                     ahc_pci_map_registers(struct ahc_softc *ahc);
 int                     ahc_pci_map_int(struct ahc_softc *ahc);
 
-static __inline uint32_t ahc_pci_read_config(ahc_dev_softc_t pci,
+uint32_t                ahc_pci_read_config(ahc_dev_softc_t pci,
                                             int reg, int width);
 
-static __inline uint32_t
-ahc_pci_read_config(ahc_dev_softc_t pci, int reg, int width)
-{
-       switch (width) {
-       case 1:
-       {
-               uint8_t retval;
-
-               pci_read_config_byte(pci, reg, &retval);
-               return (retval);
-       }
-       case 2:
-       {
-               uint16_t retval;
-               pci_read_config_word(pci, reg, &retval);
-               return (retval);
-       }
-       case 4:
-       {
-               uint32_t retval;
-               pci_read_config_dword(pci, reg, &retval);
-               return (retval);
-       }
-       default:
-               panic("ahc_pci_read_config: Read size too big");
-               /* NOTREACHED */
-               return (0);
-       }
-}
-
-static __inline void ahc_pci_write_config(ahc_dev_softc_t pci,
-                                         int reg, uint32_t value,
-                                         int width);
-
-static __inline void
-ahc_pci_write_config(ahc_dev_softc_t pci, int reg, uint32_t value, int width)
-{
-       switch (width) {
-       case 1:
-               pci_write_config_byte(pci, reg, value);
-               break;
-       case 2:
-               pci_write_config_word(pci, reg, value);
-               break;
-       case 4:
-               pci_write_config_dword(pci, reg, value);
-               break;
-       default:
-               panic("ahc_pci_write_config: Write size too big");
-               /* NOTREACHED */
-       }
-}
+void                    ahc_pci_write_config(ahc_dev_softc_t pci,
+                                             int reg, uint32_t value,
+                                             int width);
 
 static __inline int ahc_get_pci_function(ahc_dev_softc_t);
 static __inline int
@@ -793,7 +633,7 @@ int ahc_get_transfer_dir(struct scb *scb)
 static __inline
 void ahc_set_residual(struct scb *scb, u_long resid)
 {
-       scb->io_ctx->resid = resid;
+       scsi_set_resid(scb->io_ctx, resid);
 }
 
 static __inline
@@ -805,7 +645,7 @@ void ahc_set_sense_residual(struct scb *scb, u_long resid)
 static __inline
 u_long ahc_get_residual(struct scb *scb)
 {
-       return (scb->io_ctx->resid);
+       return scsi_get_resid(scb->io_ctx);
 }
 
 static __inline
@@ -856,17 +696,17 @@ ahc_freeze_scb(struct scb *scb)
         }
 }
 
-void   ahc_platform_set_tags(struct ahc_softc *ahc,
+void   ahc_platform_set_tags(struct ahc_softc *ahc, struct scsi_device *sdev,
                              struct ahc_devinfo *devinfo, ahc_queue_alg);
 int    ahc_platform_abort_scbs(struct ahc_softc *ahc, int target,
                                char channel, int lun, u_int tag,
                                role_t role, uint32_t status);
 irqreturn_t
-       ahc_linux_isr(int irq, void *dev_id, struct pt_regs * regs);
+       ahc_linux_isr(int irq, void *dev_id);
 void   ahc_platform_flushwork(struct ahc_softc *ahc);
 void   ahc_done(struct ahc_softc*, struct scb*);
 void   ahc_send_async(struct ahc_softc *, char channel,
-                      u_int target, u_int lun, ac_code, void *);
+                      u_int target, u_int lun, ac_code);
 void   ahc_print_path(struct ahc_softc *, struct scb *);
 void   ahc_platform_dump_card_state(struct ahc_softc *ahc);