Commit a6257edd authored by James Bottomley's avatar James Bottomley

update ncr53c8xx to new dma_ API (needed to incorporate zalon)

Also update zalon to C99 initialisers
parent 29384203
...@@ -131,6 +131,8 @@ ...@@ -131,6 +131,8 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/ioport.h> #include <linux/ioport.h>
...@@ -193,6 +195,7 @@ typedef u_long vm_offset_t; ...@@ -193,6 +195,7 @@ typedef u_long vm_offset_t;
#if defined(CONFIG_SCSI_ZALON) || defined(CONFIG_SCSI_ZALON_MODULE) #if defined(CONFIG_SCSI_ZALON) || defined(CONFIG_SCSI_ZALON_MODULE)
#define ENABLE_SCSI_ZALON #define ENABLE_SCSI_ZALON
#include <asm/parisc-device.h>
#include "zalon.h" #include "zalon.h"
#endif #endif
...@@ -1116,7 +1119,7 @@ struct ncb { ...@@ -1116,7 +1119,7 @@ struct ncb {
** General controller parameters and configuration. ** General controller parameters and configuration.
**---------------------------------------------------------------- **----------------------------------------------------------------
*/ */
pcidev_t pdev; device_t dev;
u_short device_id; /* PCI device id */ u_short device_id; /* PCI device id */
u_char revision_id; /* PCI device revision id */ u_char revision_id; /* PCI device revision id */
u_char bus; /* PCI BUS number */ u_char bus; /* PCI BUS number */
...@@ -3681,11 +3684,11 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device) ...@@ -3681,11 +3684,11 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
/* /*
** Allocate the host control block. ** Allocate the host control block.
*/ */
np = __m_calloc_dma(device->pdev, sizeof(struct ncb), "NCB"); np = __m_calloc_dma(device->dev, sizeof(struct ncb), "NCB");
if (!np) if (!np)
goto attach_error; goto attach_error;
NCR_INIT_LOCK_NCB(np); NCR_INIT_LOCK_NCB(np);
np->pdev = device->pdev; np->dev = device->dev;
np->p_ncb = vtobus(np); np->p_ncb = vtobus(np);
host_data->ncb = np; host_data->ncb = np;
...@@ -3826,9 +3829,7 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device) ...@@ -3826,9 +3829,7 @@ ncr_attach (Scsi_Host_Template *tpnt, int unit, ncr_device *device)
instance->dma_channel = 0; instance->dma_channel = 0;
instance->cmd_per_lun = MAX_TAGS; instance->cmd_per_lun = MAX_TAGS;
instance->can_queue = (MAX_START-4); instance->can_queue = (MAX_START-4);
#ifndef ENABLE_SCSI_ZALON scsi_set_device(instance, device->dev);
scsi_set_pci_device(instance, device->pdev);
#endif
#ifdef SCSI_NCR_INTEGRITY_CHECKING #ifdef SCSI_NCR_INTEGRITY_CHECKING
np->check_integrity = 0; np->check_integrity = 0;
...@@ -9443,7 +9444,7 @@ int zalon_attach(Scsi_Host_Template *tpnt, unsigned long io_port, ...@@ -9443,7 +9444,7 @@ int zalon_attach(Scsi_Host_Template *tpnt, unsigned long io_port,
/* Initialise ncr_device structure with items required by ncr_attach. */ /* Initialise ncr_device structure with items required by ncr_attach. */
device.host_id = driver_setup.host_id; device.host_id = driver_setup.host_id;
device.pdev = ccio_get_fake(dev); device.dev = &dev->dev;
device.slot.bus = 0; device.slot.bus = 0;
device.slot.device_fn = 0; device.slot.device_fn = 0;
device.slot.base = (u_long)io_port; device.slot.base = (u_long)io_port;
...@@ -9510,7 +9511,20 @@ static ...@@ -9510,7 +9511,20 @@ static
#endif #endif
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0) || defined(MODULE) #if LINUX_VERSION_CODE >= LinuxVersionCode(2,4,0) || defined(MODULE)
#ifdef ENABLE_SCSI_ZALON #ifdef ENABLE_SCSI_ZALON
Scsi_Host_Template driver_template = SCSI_ZALON; Scsi_Host_Template driver_template = {
.proc_name = "zalon720",
.detect = zalon7xx_detect,
.release = zalon7xx_release,
.info = ncr53c8xx_info,
.queuecommand = ncr53c8xx_queue_command,
.can_queue = SCSI_NCR_CAN_QUEUE,
.this_id = 7,
.sg_tablesize = SCSI_NCR_SG_TABLESIZE,
.cmd_per_lun = SCSI_NCR_CMD_PER_LUN,
.use_clustering = DISABLE_CLUSTERING,
};
#else #else
Scsi_Host_Template driver_template = NCR53C8XX; Scsi_Host_Template driver_template = NCR53C8XX;
#endif #endif
......
...@@ -265,6 +265,7 @@ static inline struct xpt_quehead *xpt_remque_tail(struct xpt_quehead *head) ...@@ -265,6 +265,7 @@ static inline struct xpt_quehead *xpt_remque_tail(struct xpt_quehead *head)
#if LINUX_VERSION_CODE >= LinuxVersionCode(2,2,0) #if LINUX_VERSION_CODE >= LinuxVersionCode(2,2,0)
typedef struct pci_dev *pcidev_t; typedef struct pci_dev *pcidev_t;
typedef struct device *device_t;
#define PCIDEV_NULL (0) #define PCIDEV_NULL (0)
#define PciBusNumber(d) (d)->bus->number #define PciBusNumber(d) (d)->bus->number
#define PciDeviceFn(d) (d)->devfn #define PciDeviceFn(d) (d)->devfn
...@@ -312,6 +313,7 @@ pci_get_base_address(struct pci_dev *pdev, int index, u_long *base) ...@@ -312,6 +313,7 @@ pci_get_base_address(struct pci_dev *pdev, int index, u_long *base)
#else /* Incomplete emulation of current PCI code for pre-2.2 kernels */ #else /* Incomplete emulation of current PCI code for pre-2.2 kernels */
typedef unsigned int pcidev_t; typedef unsigned int pcidev_t;
typedef unsinged int device_t;
#define PCIDEV_NULL (~0u) #define PCIDEV_NULL (~0u)
#define PciBusNumber(d) ((d)>>8) #define PciBusNumber(d) ((d)>>8)
#define PciDeviceFn(d) ((d)&0xff) #define PciDeviceFn(d) ((d)&0xff)
...@@ -564,7 +566,7 @@ static void MDELAY(long ms) { while (ms--) UDELAY(1000); } ...@@ -564,7 +566,7 @@ static void MDELAY(long ms) { while (ms--) UDELAY(1000); }
#define MEMO_CLUSTER_MASK (MEMO_CLUSTER_SIZE-1) #define MEMO_CLUSTER_MASK (MEMO_CLUSTER_SIZE-1)
typedef u_long m_addr_t; /* Enough bits to bit-hack addresses */ typedef u_long m_addr_t; /* Enough bits to bit-hack addresses */
typedef pcidev_t m_bush_t; /* Something that addresses DMAable */ typedef struct device *m_bush_t; /* Something that addresses DMAable */
typedef struct m_link { /* Link between free memory chunks */ typedef struct m_link { /* Link between free memory chunks */
struct m_link *next; struct m_link *next;
...@@ -793,7 +795,7 @@ static m_addr_t ___dma_getp(m_pool_s *mp) ...@@ -793,7 +795,7 @@ static m_addr_t ___dma_getp(m_pool_s *mp)
vbp = __m_calloc(&mp0, sizeof(*vbp), "VTOB"); vbp = __m_calloc(&mp0, sizeof(*vbp), "VTOB");
if (vbp) { if (vbp) {
dma_addr_t daddr; dma_addr_t daddr;
vp = (m_addr_t) pci_alloc_consistent(mp->bush, vp = (m_addr_t) dma_alloc_coherent(mp->bush,
PAGE_SIZE<<MEMO_PAGE_ORDER, PAGE_SIZE<<MEMO_PAGE_ORDER,
&daddr); &daddr);
if (vp) { if (vp) {
...@@ -822,8 +824,8 @@ static void ___dma_freep(m_pool_s *mp, m_addr_t m) ...@@ -822,8 +824,8 @@ static void ___dma_freep(m_pool_s *mp, m_addr_t m)
if (*vbpp) { if (*vbpp) {
vbp = *vbpp; vbp = *vbpp;
*vbpp = (*vbpp)->next; *vbpp = (*vbpp)->next;
pci_free_consistent(mp->bush, PAGE_SIZE<<MEMO_PAGE_ORDER, dma_free_coherent(mp->bush, PAGE_SIZE<<MEMO_PAGE_ORDER,
(void *)vbp->vaddr, (dma_addr_t)vbp->baddr); (void *)vbp->vaddr, (dma_addr_t)vbp->baddr);
__m_free(&mp0, vbp, sizeof(*vbp), "VTOB"); __m_free(&mp0, vbp, sizeof(*vbp), "VTOB");
--mp->nump; --mp->nump;
} }
...@@ -917,11 +919,11 @@ static m_addr_t __vtobus(m_bush_t bush, void *m) ...@@ -917,11 +919,11 @@ static m_addr_t __vtobus(m_bush_t bush, void *m)
#endif /* SCSI_NCR_DYNAMIC_DMA_MAPPING */ #endif /* SCSI_NCR_DYNAMIC_DMA_MAPPING */
#define _m_calloc_dma(np, s, n) __m_calloc_dma(np->pdev, s, n) #define _m_calloc_dma(np, s, n) __m_calloc_dma(np->dev, s, n)
#define _m_free_dma(np, p, s, n) __m_free_dma(np->pdev, p, s, n) #define _m_free_dma(np, p, s, n) __m_free_dma(np->dev, p, s, n)
#define m_calloc_dma(s, n) _m_calloc_dma(np, s, n) #define m_calloc_dma(s, n) _m_calloc_dma(np, s, n)
#define m_free_dma(p, s, n) _m_free_dma(np, p, s, n) #define m_free_dma(p, s, n) _m_free_dma(np, p, s, n)
#define _vtobus(np, p) __vtobus(np->pdev, p) #define _vtobus(np, p) __vtobus(np->dev, p)
#define vtobus(p) _vtobus(np, p) #define vtobus(p) _vtobus(np, p)
/* /*
...@@ -932,10 +934,10 @@ static m_addr_t __vtobus(m_bush_t bush, void *m) ...@@ -932,10 +934,10 @@ static m_addr_t __vtobus(m_bush_t bush, void *m)
/* Linux versions prior to pci bus iommu kernel interface */ /* Linux versions prior to pci bus iommu kernel interface */
#define __unmap_scsi_data(pdev, cmd) do {; } while (0) #define __unmap_scsi_data(dev, cmd) do {; } while (0)
#define __map_scsi_single_data(pdev, cmd) (__vtobus(pdev,(cmd)->request_buffer)) #define __map_scsi_single_data(dev, cmd) (__vtobus(dev,(cmd)->request_buffer))
#define __map_scsi_sg_data(pdev, cmd) ((cmd)->use_sg) #define __map_scsi_sg_data(dev, cmd) ((cmd)->use_sg)
#define __sync_scsi_data(pdev, cmd) do {; } while (0) #define __sync_scsi_data(dev, cmd) do {; } while (0)
#define scsi_sg_dma_address(sc) vtobus((sc)->address) #define scsi_sg_dma_address(sc) vtobus((sc)->address)
#define scsi_sg_dma_len(sc) ((sc)->length) #define scsi_sg_dma_len(sc) ((sc)->length)
...@@ -948,31 +950,34 @@ static m_addr_t __vtobus(m_bush_t bush, void *m) ...@@ -948,31 +950,34 @@ static m_addr_t __vtobus(m_bush_t bush, void *m)
#define __data_mapped SCp.phase #define __data_mapped SCp.phase
#define __data_mapping SCp.have_data_in #define __data_mapping SCp.have_data_in
static void __unmap_scsi_data(pcidev_t pdev, Scsi_Cmnd *cmd) static void __unmap_scsi_data(device_t dev, Scsi_Cmnd *cmd)
{ {
int dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); enum dma_data_direction dma_dir =
(enum dma_data_direction)scsi_to_pci_dma_dir(cmd->sc_data_direction);
switch(cmd->__data_mapped) { switch(cmd->__data_mapped) {
case 2: case 2:
pci_unmap_sg(pdev, cmd->buffer, cmd->use_sg, dma_dir); dma_unmap_sg(dev, cmd->buffer, cmd->use_sg, dma_dir);
break; break;
case 1: case 1:
pci_unmap_single(pdev, cmd->__data_mapping, dma_unmap_single(dev, cmd->__data_mapping,
cmd->request_bufflen, dma_dir); cmd->request_bufflen, dma_dir);
break; break;
} }
cmd->__data_mapped = 0; cmd->__data_mapped = 0;
} }
static u_long __map_scsi_single_data(pcidev_t pdev, Scsi_Cmnd *cmd) static u_long __map_scsi_single_data(device_t dev, Scsi_Cmnd *cmd)
{ {
dma_addr_t mapping; dma_addr_t mapping;
int dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); enum dma_data_direction dma_dir =
(enum dma_data_direction)scsi_to_pci_dma_dir(cmd->sc_data_direction);
if (cmd->request_bufflen == 0) if (cmd->request_bufflen == 0)
return 0; return 0;
mapping = pci_map_single(pdev, cmd->request_buffer, mapping = dma_map_single(dev, cmd->request_buffer,
cmd->request_bufflen, dma_dir); cmd->request_bufflen, dma_dir);
cmd->__data_mapped = 1; cmd->__data_mapped = 1;
cmd->__data_mapping = mapping; cmd->__data_mapping = mapping;
...@@ -980,32 +985,34 @@ static u_long __map_scsi_single_data(pcidev_t pdev, Scsi_Cmnd *cmd) ...@@ -980,32 +985,34 @@ static u_long __map_scsi_single_data(pcidev_t pdev, Scsi_Cmnd *cmd)
return mapping; return mapping;
} }
static int __map_scsi_sg_data(pcidev_t pdev, Scsi_Cmnd *cmd) static int __map_scsi_sg_data(device_t dev, Scsi_Cmnd *cmd)
{ {
int use_sg; int use_sg;
int dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); enum dma_data_direction dma_dir =
(enum dma_data_direction)scsi_to_pci_dma_dir(cmd->sc_data_direction);
if (cmd->use_sg == 0) if (cmd->use_sg == 0)
return 0; return 0;
use_sg = pci_map_sg(pdev, cmd->buffer, cmd->use_sg, dma_dir); use_sg = dma_map_sg(dev, cmd->buffer, cmd->use_sg, dma_dir);
cmd->__data_mapped = 2; cmd->__data_mapped = 2;
cmd->__data_mapping = use_sg; cmd->__data_mapping = use_sg;
return use_sg; return use_sg;
} }
static void __sync_scsi_data(pcidev_t pdev, Scsi_Cmnd *cmd) static void __sync_scsi_data(device_t dev, Scsi_Cmnd *cmd)
{ {
int dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); enum dma_data_direction dma_dir =
(enum dma_data_direction)scsi_to_pci_dma_dir(cmd->sc_data_direction);
switch(cmd->__data_mapped) { switch(cmd->__data_mapped) {
case 2: case 2:
pci_dma_sync_sg(pdev, cmd->buffer, cmd->use_sg, dma_dir); dma_sync_sg(dev, cmd->buffer, cmd->use_sg, dma_dir);
break; break;
case 1: case 1:
pci_dma_sync_single(pdev, cmd->__data_mapping, dma_sync_single(dev, cmd->__data_mapping,
cmd->request_bufflen, dma_dir); cmd->request_bufflen, dma_dir);
break; break;
} }
} }
...@@ -1015,10 +1022,10 @@ static void __sync_scsi_data(pcidev_t pdev, Scsi_Cmnd *cmd) ...@@ -1015,10 +1022,10 @@ static void __sync_scsi_data(pcidev_t pdev, Scsi_Cmnd *cmd)
#endif /* SCSI_NCR_DYNAMIC_DMA_MAPPING */ #endif /* SCSI_NCR_DYNAMIC_DMA_MAPPING */
#define unmap_scsi_data(np, cmd) __unmap_scsi_data(np->pdev, cmd) #define unmap_scsi_data(np, cmd) __unmap_scsi_data(np->dev, cmd)
#define map_scsi_single_data(np, cmd) __map_scsi_single_data(np->pdev, cmd) #define map_scsi_single_data(np, cmd) __map_scsi_single_data(np->dev, cmd)
#define map_scsi_sg_data(np, cmd) __map_scsi_sg_data(np->pdev, cmd) #define map_scsi_sg_data(np, cmd) __map_scsi_sg_data(np->dev, cmd)
#define sync_scsi_data(np, cmd) __sync_scsi_data(np->pdev, cmd) #define sync_scsi_data(np, cmd) __sync_scsi_data(np->dev, cmd)
/*========================================================== /*==========================================================
** **
...@@ -1140,7 +1147,7 @@ typedef struct { ...@@ -1140,7 +1147,7 @@ typedef struct {
**========================================================== **==========================================================
*/ */
typedef struct { typedef struct {
pcidev_t pdev; device_t dev;
ncr_slot slot; ncr_slot slot;
ncr_chip chip; ncr_chip chip;
ncr_nvram *nvram; ncr_nvram *nvram;
...@@ -2486,7 +2493,7 @@ sym53c8xx_pci_init(Scsi_Host_Template *tpnt, pcidev_t pdev, ncr_device *device) ...@@ -2486,7 +2493,7 @@ sym53c8xx_pci_init(Scsi_Host_Template *tpnt, pcidev_t pdev, ncr_device *device)
/* /*
** Initialise ncr_device structure with items required by ncr_attach. ** Initialise ncr_device structure with items required by ncr_attach.
*/ */
device->pdev = pdev; device->dev = &pdev->dev;
device->slot.bus = PciBusNumber(pdev); device->slot.bus = PciBusNumber(pdev);
device->slot.device_fn = PciDeviceFn(pdev); device->slot.device_fn = PciDeviceFn(pdev);
device->slot.base = base; device->slot.base = base;
......
...@@ -133,9 +133,9 @@ static struct parisc_device_id zalon_tbl[] = { ...@@ -133,9 +133,9 @@ static struct parisc_device_id zalon_tbl[] = {
MODULE_DEVICE_TABLE(parisc, zalon_tbl); MODULE_DEVICE_TABLE(parisc, zalon_tbl);
static struct parisc_driver zalon_driver = { static struct parisc_driver zalon_driver = {
name: "GSC SCSI (Zalon)", .name = "GSC SCSI (Zalon)",
id_table: zalon_tbl, .id_table = zalon_tbl,
probe: zalon_scsi_callback, .probe = zalon_scsi_callback,
}; };
int zalon7xx_detect(Scsi_Host_Template *tpnt) int zalon7xx_detect(Scsi_Host_Template *tpnt)
......
...@@ -22,19 +22,6 @@ int zalon7xx_release(struct Scsi_Host *); ...@@ -22,19 +22,6 @@ int zalon7xx_release(struct Scsi_Host *);
#define zalon7xx_release NULL #define zalon7xx_release NULL
#endif #endif
#define SCSI_ZALON { proc_name: "zalon720", \
detect: zalon7xx_detect, \
release: zalon7xx_release, \
info: ncr53c8xx_info, \
queuecommand: ncr53c8xx_queue_command,\
bios_param: scsicam_bios_param, \
can_queue: SCSI_NCR_CAN_QUEUE, \
this_id: 7, \
sg_tablesize: SCSI_NCR_SG_TABLESIZE, \
cmd_per_lun: SCSI_NCR_CMD_PER_LUN, \
use_clustering: DISABLE_CLUSTERING}
#define GSC_SCSI_ZALON_OFFSET 0x800 #define GSC_SCSI_ZALON_OFFSET 0x800
#define IO_MODULE_EIM (1*4) #define IO_MODULE_EIM (1*4)
......
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