Commit dbe74cf3 authored by Justin T. Gibbs's avatar Justin T. Gibbs

Aic6xxx and Aic79xx Driver Update

 o Remove errno and unistd.h usage
 o Remove splitting of S/G elements that cross
   a 4GB boundary.  Code above the driver already
   guatantees that this cannot happen.
 o Simplify irqreturn_t compatibility glue.
 o Fix GCC 3.3 warnings.
parent 6abea0ef
/*
* Adaptec AIC79xx device driver for Linux.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#160 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.c#166 $
*
* --------------------------------------------------------------------------
* Copyright (c) 1994-2000 Justin T. Gibbs.
......@@ -62,11 +62,6 @@
#include <linux/mm.h> /* For fetching system memory size */
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
static int errno;
/*
* Lock protecting manipulation of the ahd softc list.
*/
......@@ -755,31 +750,11 @@ ahd_linux_map_seg(struct ahd_softc *ahd, struct scb *scb,
consumed = 1;
sg->addr = ahd_htole32(addr & 0xFFFFFFFF);
scb->platform_data->xfer_len += len;
if (sizeof(bus_addr_t) > 4
&& (ahd->flags & AHD_39BIT_ADDRESSING) != 0) {
/*
* Due to DAC restrictions, we can't
* cross a 4GB boundary.
*/
if ((addr ^ (addr + len - 1)) & ~0xFFFFFFFF) {
struct ahd_dma_seg *next_sg;
uint32_t next_len;
printf("Crossed Seg\n");
if ((scb->sg_count + 2) > AHD_NSEG)
panic("Too few segs for dma mapping. "
"Increase AHD_NSEG\n");
consumed++;
next_sg = sg + 1;
next_sg->addr = 0;
next_len = 0x100000000 - (addr & 0xFFFFFFFF);
len -= next_len;
next_len |= ((addr >> 8) + 0x1000000) & 0x7F000000;
next_sg->len = ahd_htole32(next_len);
}
len |= (addr >> 8) & 0x7F000000;
}
&& (ahd->flags & AHD_39BIT_ADDRESSING) != 0)
len |= (addr >> 8) & AHD_SG_HIGH_ADDR_MASK;
sg->len = ahd_htole32(len);
return (consumed);
}
......@@ -796,14 +771,18 @@ static int ahd_linux_queue(Scsi_Cmnd *, void (*)(Scsi_Cmnd *));
static int ahd_linux_slave_alloc(Scsi_Device *);
static int ahd_linux_slave_configure(Scsi_Device *);
static void ahd_linux_slave_destroy(Scsi_Device *);
#if defined(__i386__)
static int ahd_linux_biosparam(struct scsi_device*,
struct block_device*, sector_t, int[]);
#endif
#else
static int ahd_linux_release(struct Scsi_Host *);
static void ahd_linux_select_queue_depth(struct Scsi_Host *host,
Scsi_Device *scsi_devs);
#if defined(__i386__)
static int ahd_linux_biosparam(Disk *, kdev_t, int[]);
#endif
#endif
static int ahd_linux_bus_reset(Scsi_Cmnd *);
static int ahd_linux_dev_reset(Scsi_Cmnd *);
static int ahd_linux_abort(Scsi_Cmnd *);
......@@ -1211,6 +1190,7 @@ ahd_linux_select_queue_depth(struct Scsi_Host * host,
}
#endif
#if defined(__i386__)
/*
* Return the disk geometry for the given SCSI device.
*/
......@@ -1273,6 +1253,7 @@ ahd_linux_biosparam(Disk *disk, kdev_t dev, int geom[])
geom[2] = cylinders;
return (0);
}
#endif
/*
* Abort the current SCSI command(s).
......@@ -4211,7 +4192,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev)
/*
* SCSI controller interrupt handler.
*/
AIC_LINUX_IRQRETURN_T
irqreturn_t
ahd_linux_isr(int irq, void *dev_id, struct pt_regs * regs)
{
struct ahd_softc *ahd;
......@@ -4225,7 +4206,7 @@ ahd_linux_isr(int irq, void *dev_id, struct pt_regs * regs)
ahd_schedule_runq(ahd);
ahd_linux_run_complete_queue(ahd);
ahd_unlock(ahd, &flags);
AIC_LINUX_IRQRETURN(ours);
return IRQ_RETVAL(ours);
}
void
......
......@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#130 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm.h#131 $
*
*/
#ifndef _AIC79XX_LINUX_H_
......@@ -1211,7 +1211,7 @@ void ahd_platform_set_tags(struct ahd_softc *ahd,
int ahd_platform_abort_scbs(struct ahd_softc *ahd, int target,
char channel, int lun, u_int tag,
role_t role, uint32_t status);
AIC_LINUX_IRQRETURN_T
irqreturn_t
ahd_linux_isr(int irq, void *dev_id, struct pt_regs * regs);
void ahd_platform_flushwork(struct ahd_softc *ahd);
int ahd_softc_comp(struct ahd_softc *, struct ahd_softc *);
......
......@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#21 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic79xx_osm_pci.c#23 $
*/
#include "aic79xx_osm.h"
......@@ -156,19 +156,21 @@ ahd_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_set_master(pdev);
if (sizeof(bus_addr_t) > 4) {
uint64_t memsize;
uint64_t memsize;
bus_addr_t mask_64bit;
bus_addr_t mask_39bit;
memsize = ahd_linux_get_memsize();
if (memsize >= 0x8000000000
&& ahd_pci_set_dma_mask(pdev, 0xFFFFFFFFFFFFFFFFULL) == 0) {
mask_64bit = (bus_addr_t)(0xFFFFFFFFFFFFFFFFULL&(bus_addr_t)~0);
mask_39bit = (bus_addr_t)(0x7FFFFFFFFFULL&(bus_addr_t)~0);
if (memsize >= 0x8000000000ULL
&& ahd_pci_set_dma_mask(pdev, mask_64bit) == 0) {
ahd->flags |= AHD_64BIT_ADDRESSING;
ahd->platform_data->hw_dma_mask =
(bus_addr_t)(0xFFFFFFFFFFFFFFFFULL&(bus_addr_t)~0);
ahd->platform_data->hw_dma_mask = mask_64bit;
} else if (memsize > 0x80000000
&& ahd_pci_set_dma_mask(pdev, 0x7FFFFFFFFFULL) == 0) {
&& ahd_pci_set_dma_mask(pdev, mask_39bit) == 0) {
ahd->flags |= AHD_39BIT_ADDRESSING;
ahd->platform_data->hw_dma_mask =
(bus_addr_t)(0x7FFFFFFFFFULL & (bus_addr_t)~0);
ahd->platform_data->hw_dma_mask = mask_39bit;
}
} else {
ahd_pci_set_dma_mask(pdev, 0xFFFFFFFF);
......
/*
* Adaptec AIC7xxx device driver for Linux.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#221 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.c#227 $
*
* Copyright (c) 1994 John Aycock
* The University of Calgary Department of Computer Science.
......@@ -141,11 +141,6 @@
#include <linux/mm.h> /* For fetching system memory size */
#include <linux/blk.h> /* For block_size() */
#define __KERNEL_SYSCALLS__
#include <linux/unistd.h>
static int errno;
/*
* Lock protecting manipulation of the ahc softc list.
*/
......@@ -749,31 +744,11 @@ ahc_linux_map_seg(struct ahc_softc *ahc, struct scb *scb,
consumed = 1;
sg->addr = ahc_htole32(addr & 0xFFFFFFFF);
scb->platform_data->xfer_len += len;
if (sizeof(bus_addr_t) > 4
&& (ahc->flags & AHC_39BIT_ADDRESSING) != 0) {
/*
* Due to DAC restrictions, we can't
* cross a 4GB boundary.
*/
if ((addr ^ (addr + len - 1)) & ~0xFFFFFFFF) {
struct ahc_dma_seg *next_sg;
uint32_t next_len;
printf("Crossed Seg\n");
if ((scb->sg_count + 2) > AHC_NSEG)
panic("Too few segs for dma mapping. "
"Increase AHC_NSEG\n");
consumed++;
next_sg = sg + 1;
next_sg->addr = 0;
next_len = 0x100000000 - (addr & 0xFFFFFFFF);
len -= next_len;
next_len |= ((addr >> 8) + 0x1000000) & 0x7F000000;
next_sg->len = ahc_htole32(next_len);
}
len |= (addr >> 8) & 0x7F000000;
}
&& (ahc->flags & AHC_39BIT_ADDRESSING) != 0)
len |= (addr >> 8) & AHC_SG_HIGH_ADDR_MASK;
sg->len = ahc_htole32(len);
return (consumed);
}
......@@ -787,14 +762,18 @@ static const char *ahc_linux_info(struct Scsi_Host *);
static int ahc_linux_slave_alloc(Scsi_Device *);
static int ahc_linux_slave_configure(Scsi_Device *);
static void ahc_linux_slave_destroy(Scsi_Device *);
#if defined(__i386__)
static int ahc_linux_biosparam(struct scsi_device*,
struct block_device*,
sector_t, int[]);
#endif
#else
static void ahc_linux_select_queue_depth(struct Scsi_Host *host,
Scsi_Device *scsi_devs);
#if defined(__i386__)
static int ahc_linux_biosparam(Disk *, kdev_t, int[]);
#endif
#endif
static int ahc_linux_bus_reset(Scsi_Cmnd *);
static int ahc_linux_dev_reset(Scsi_Cmnd *);
static int ahc_linux_abort(Scsi_Cmnd *);
......@@ -1194,6 +1173,7 @@ ahc_linux_select_queue_depth(struct Scsi_Host *host, Scsi_Device *scsi_devs)
}
#endif
#if defined(__i386__)
/*
* Return the disk geometry for the given SCSI device.
*/
......@@ -1260,6 +1240,7 @@ ahc_linux_biosparam(Disk *disk, kdev_t dev, int geom[])
geom[2] = cylinders;
return (0);
}
#endif
/*
* Abort the current SCSI command(s).
......@@ -3878,7 +3859,7 @@ ahc_linux_run_device_queue(struct ahc_softc *ahc, struct ahc_linux_device *dev)
/*
* SCSI controller interrupt handler.
*/
AIC_LINUX_IRQRETURN_T
irqreturn_t
ahc_linux_isr(int irq, void *dev_id, struct pt_regs * regs)
{
struct ahc_softc *ahc;
......@@ -3892,7 +3873,7 @@ ahc_linux_isr(int irq, void *dev_id, struct pt_regs * regs)
ahc_schedule_runq(ahc);
ahc_linux_run_complete_queue(ahc);
ahc_unlock(ahc, &flags);
AIC_LINUX_IRQRETURN(ours);
return IRQ_RETVAL(ours);
}
void
......
......@@ -53,7 +53,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#142 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#144 $
*
*/
#ifndef _AIC7XXX_LINUX_H_
......@@ -305,7 +305,7 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec)
#define AHC_SCSI_HAS_HOST_LOCK 0
#endif
#define AIC7XXX_DRIVER_VERSION "6.2.33"
#define AIC7XXX_DRIVER_VERSION "6.2.34"
/**************************** Front End Queues ********************************/
/*
......@@ -1165,7 +1165,7 @@ void ahc_platform_set_tags(struct ahc_softc *ahc,
int ahc_platform_abort_scbs(struct ahc_softc *ahc, int target,
char channel, int lun, u_int tag,
role_t role, uint32_t status);
AIC_LINUX_IRQRETURN_T
irqreturn_t
ahc_linux_isr(int irq, void *dev_id, struct pt_regs * regs);
void ahc_platform_flushwork(struct ahc_softc *ahc);
int ahc_softc_comp(struct ahc_softc *, struct ahc_softc *);
......
......@@ -36,7 +36,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#44 $
* $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c#45 $
*/
#include "aic7xxx_osm.h"
......@@ -110,6 +110,7 @@ static int
ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
char buf[80];
bus_addr_t mask_39bit;
struct ahc_softc *ahc;
ahc_dev_softc_t pci;
struct ahc_pci_identity *entry;
......@@ -160,12 +161,12 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
}
pci_set_master(pdev);
mask_39bit = (bus_addr_t)(0x7FFFFFFFFFULL & (bus_addr_t)~0);
if (sizeof(bus_addr_t) > 4
&& ahc_linux_get_memsize() > 0x80000000
&& ahc_pci_set_dma_mask(pdev, 0x7FFFFFFFFFULL) == 0) {
&& ahc_pci_set_dma_mask(pdev, mask_39bit) == 0) {
ahc->flags |= AHC_39BIT_ADDRESSING;
ahc->platform_data->hw_dma_mask =
(bus_addr_t)(0x7FFFFFFFFFULL & (bus_addr_t)~0);
ahc->platform_data->hw_dma_mask = mask_39bit;
} else {
ahc_pci_set_dma_mask(pdev, 0xFFFFFFFF);
ahc->platform_data->hw_dma_mask = 0xFFFFFFFF;
......
......@@ -39,7 +39,7 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#63 $
* $Id: //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#64 $
*
* $FreeBSD$
*/
......@@ -1963,8 +1963,7 @@ write_brdctl(struct ahc_softc *ahc, uint8_t value)
}
static uint8_t
read_brdctl(ahc)
struct ahc_softc *ahc;
read_brdctl(struct ahc_softc *ahc)
{
uint8_t brdctl;
uint8_t value;
......
......@@ -60,12 +60,9 @@
/*
* Linux Interrupt Support.
*/
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#define AIC_LINUX_IRQRETURN_T irqreturn_t
#define AIC_LINUX_IRQRETURN(ours) return (IRQ_RETVAL(ours))
#else
#define AIC_LINUX_IRQRETURN_T void
#define AIC_LINUX_IRQRETURN(ours) return
#ifndef IRQ_RETVAL
typedef void irqreturn_t;
#define IRQ_RETVAL(x)
#endif
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment