]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/aic7xxx/aic7xxx_osm.h
[SCSI] aic7xxx: fix MMIO for PPC 44x platforms
[linux-2.6-omap-h63xx.git] / drivers / scsi / aic7xxx / aic7xxx_osm.h
index d42a71ee076df62f7c59cca626398984966a1027..c2a9ad76d35d1c71316d24b32bcac10958557a7a 100644 (file)
@@ -64,7 +64,6 @@
 #include <linux/delay.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
-#include <linux/smp_lock.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -256,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
@@ -329,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
@@ -373,7 +365,7 @@ struct ahc_platform_data {
 #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 */
+       resource_size_t          mem_busaddr;   /* Mem Base Addr */
 };
 
 /************************** OS Utility Wrappers *******************************/
@@ -383,82 +375,16 @@ 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 *,
@@ -533,8 +459,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,
@@ -565,61 +489,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
@@ -761,7 +636,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
@@ -773,7 +648,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
@@ -824,17 +699,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);