Commit f36d0268 authored by James Bottomley's avatar James Bottomley

[PATCH] sym 2.1.18f

From: 	Matthew Wilcox <willy@debian.org>

2.1.18f:
 - Rewrite the Kconfig help
 - Always honour CONFIG_SCSI_SYM53C8XX_IOMAPPED.  Alpha people used to
   have it forced off, Sparc people used to have it forced on.  (Thanks
   to Dann Frazier for testing on Alpha)
 - Simplify the NVRAM handling a bit.
 - SYM_OPT_NO_BUS_MEMORY_MAPPING is never set.
 - Remove PCI DMA abstraction.  (Christoph Hellwig)
 - Redo SCSI midlayer registration and unregistration to allow module
   load/unload to work.  Now copes with scsi_add_host() failing.  (Thanks
   to Brian King for testing)
 - Replace bcmp() with memcmp().
 - Change the MAINTAINER entry to myself.
parent 1182b13f
......@@ -1234,8 +1234,8 @@ W: http://ldm.sourceforge.net
S: Maintained
LSILOGIC/SYMBIOS/NCR 53C8XX and 53C1010 PCI-SCSI drivers
P: Gerard Roudier
M: groudier@free.fr
P: Matthew Wilcox
M: matthew@wil.cx
L: linux-scsi@vger.kernel.org
S: Maintained
......
......@@ -911,37 +911,34 @@ config SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
depends on SCSI_SYM53C8XX_2
default "1"
---help---
This option only applies to PCI-SCSI chip that are PCI DAC capable
(875A, 895A, 896, 1010-33, 1010-66, 1000).
This option only applies to PCI-SCSI chips that are PCI DAC
capable (875A, 895A, 896, 1010-33, 1010-66, 1000).
When set to 0, only PCI 32 bit DMA addressing (SAC) will be performed.
When set to 1, 40 bit DMA addressing (with upper 24 bits of address
set to zero) is supported. The addressable range is here 1 TB.
When set to 2, full 64 bits of address for DMA are supported, but only
16 segments of 4 GB can be addressed. The addressable range is so
limited to 64 GB.
When set to 0, the driver will program the chip to only perform
32-bit DMA. When set to 1, the chip will be able to perform DMA
to addresses up to 1TB. When set to 2, the driver supports the
full 64-bit DMA address range, but can only address 16 segments
of 4 GB each. This limits the total addressable range to 64 GB.
The safest value is 0 (32 bit DMA addressing) that is guessed to still
fit most of real machines.
Most machines with less than 4GB of memory should use a setting
of 0 for best performance. If your machine has 4GB of memory
or more, you should set this option to 1 (the default).
The preferred value 1 (40 bit DMA addressing) should make happy
properly engineered PCI DAC capable host bridges. You may configure
this option for Intel platforms with more than 4 GB of memory.
The still experimental value 2 (64 bit DMA addressing with 16 x 4GB
segments limitation) can be used on systems that require PCI address
bits past bit 39 to be set for the addressing of memory using PCI
DAC cycles.
The still experimental value 2 (64 bit DMA addressing with 16
x 4GB segments limitation) can be used on systems that require
PCI address bits past bit 39 to be set for the addressing of
memory using PCI DAC cycles.
config SCSI_SYM53C8XX_DEFAULT_TAGS
int "default tagged command queue depth"
depends on SCSI_SYM53C8XX_2
default "16"
help
This is the default value of the command queue depth the driver will
announce to the generic SCSI layer for devices that support tagged
command queueing. This value can be changed from the boot command line.
This is a soft limit that cannot exceed CONFIG_SCSI_SYM53C8XX_MAX_TAGS.
This is the default value of the command queue depth the
driver will announce to the generic SCSI layer for devices
that support tagged command queueing. This value can be changed
from the boot command line. This is a soft limit that cannot
exceed CONFIG_SCSI_SYM53C8XX_MAX_TAGS.
config SCSI_SYM53C8XX_MAX_TAGS
int "maximum number of queued commands"
......@@ -954,11 +951,12 @@ config SCSI_SYM53C8XX_MAX_TAGS
This value is used as a compiled-in hard limit.
config SCSI_SYM53C8XX_IOMAPPED
bool "use normal IO"
bool "use port IO"
depends on SCSI_SYM53C8XX_2
help
If you say Y here, the driver will preferently use normal IO rather than
memory mapped IO.
If you say Y here, the driver will use port IO to access
the card. This is significantly slower then using memory
mapped IO. Most people should answer N.
config SCSI_ZALON
tristate "Zalon SCSI support"
......
......@@ -55,19 +55,7 @@
#include <linux/config.h>
/*
* Use normal IO if configured.
* Normal IO forced for alpha.
* Forced to MMIO for sparc.
*/
#if defined(__alpha__)
#define SYM_CONF_IOMAPPED
#elif defined(__sparc__)
#undef SYM_CONF_IOMAPPED
/* #elif defined(__powerpc__) */
/* #define SYM_CONF_IOMAPPED */
/* #define SYM_OPT_NO_BUS_MEMORY_MAPPING */
#elif defined(CONFIG_SCSI_SYM53C8XX_IOMAPPED)
#ifdef CONFIG_SCSI_SYM53C8XX_IOMAPPED
#define SYM_CONF_IOMAPPED
#endif
......@@ -93,8 +81,6 @@
*/
#if 1
#define SYM_CONF_NVRAM_SUPPORT (1)
#define SYM_SETUP_SYMBIOS_NVRAM (1)
#define SYM_SETUP_TEKRAM_NVRAM (1)
#endif
/*
......
......@@ -89,9 +89,6 @@ static struct sym_fwb_ofs sym_fw1b_ofs = {
};
static struct sym_fwz_ofs sym_fw1z_ofs = {
SYM_GEN_FW_Z(struct SYM_FWZ_SCR)
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
SYM_GEN_Z(struct SYM_FWZ_SCR, start_ram)
#endif
};
#undef SYM_FWA_SCR
#undef SYM_FWB_SCR
......@@ -122,10 +119,6 @@ static struct sym_fwb_ofs sym_fw2b_ofs = {
};
static struct sym_fwz_ofs sym_fw2z_ofs = {
SYM_GEN_FW_Z(struct SYM_FWZ_SCR)
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
SYM_GEN_Z(struct SYM_FWZ_SCR, start_ram)
SYM_GEN_Z(struct SYM_FWZ_SCR, start_ram64)
#endif
};
#undef SYM_FWA_SCR
#undef SYM_FWB_SCR
......@@ -146,22 +139,10 @@ sym_fw1_patch(hcb_p np)
{
struct sym_fw1a_scr *scripta0;
struct sym_fw1b_scr *scriptb0;
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
struct sym_fw1z_scr *scriptz0 =
(struct sym_fw1z_scr *) np->scriptz0;
#endif
scripta0 = (struct sym_fw1a_scr *) np->scripta0;
scriptb0 = (struct sym_fw1b_scr *) np->scriptb0;
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
/*
* Set up BUS physical address of SCRIPTS that is to
* be copied to on-chip RAM by the SCRIPTS processor.
*/
scriptz0->scripta0_ba[0] = cpu_to_scr(vtobus(scripta0));
#endif
/*
* Remove LED support if not needed.
*/
......@@ -199,25 +180,10 @@ sym_fw2_patch(hcb_p np)
{
struct sym_fw2a_scr *scripta0;
struct sym_fw2b_scr *scriptb0;
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
struct sym_fw2z_scr *scriptz0 =
(struct sym_fw2z_scr *) np->scriptz0;
#endif
scripta0 = (struct sym_fw2a_scr *) np->scripta0;
scriptb0 = (struct sym_fw2b_scr *) np->scriptb0;
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
/*
* Set up BUS physical address of SCRIPTS that is to
* be copied to on-chip RAM by the SCRIPTS processor.
*/
scriptz0->scripta0_ba64[0] = /* Nothing is missing here */
scriptz0->scripta0_ba[0] = cpu_to_scr(vtobus(scripta0));
scriptz0->scriptb0_ba64[0] = cpu_to_scr(vtobus(scriptb0));
scriptz0->ram_seg64[0] = np->scr_ram_seg;
#endif
/*
* Remove LED support if not needed.
*/
......
......@@ -113,10 +113,6 @@ struct sym_fwb_ofs {
};
struct sym_fwz_ofs {
SYM_GEN_FW_Z(u_short)
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
SYM_GEN_Z(u_short, start_ram)
SYM_GEN_Z(u_short, start_ram64)
#endif
};
/*
......@@ -136,10 +132,6 @@ struct sym_fwb_ba {
};
struct sym_fwz_ba {
SYM_GEN_FW_Z(u32)
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
SYM_GEN_Z(u32, start_ram)
SYM_GEN_Z(u32, start_ram64)
#endif
};
#undef SYM_GEN_A
#undef SYM_GEN_B
......
......@@ -234,10 +234,6 @@ struct SYM_FWB_SCR {
struct SYM_FWZ_SCR {
u32 snooptest [ 9];
u32 snoopend [ 2];
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
u32 start_ram [ 1];
u32 scripta0_ba [ 4];
#endif
};
static struct SYM_FWA_SCR SYM_FWA_SCR = {
......@@ -1851,24 +1847,5 @@ static struct SYM_FWZ_SCR SYM_FWZ_SCR = {
*/
SCR_INT,
99,
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
/*
* We may use MEMORY MOVE instructions to load the on chip-RAM,
* if it happens that mapping PCI memory is not possible.
* But writing the RAM from the CPU is the preferred method,
* since PCI 2.2 seems to disallow PCI self-mastering.
*/
}/*-------------------------< START_RAM >------------------------*/,{
/*
* Load the script into on-chip RAM,
* and jump to start point.
*/
SCR_COPY (sizeof(struct SYM_FWA_SCR)),
}/*-------------------------< SCRIPTA0_BA >----------------------*/,{
0,
PADDR_A (start),
SCR_JUMP,
PADDR_A (init),
#endif /* SYM_OPT_NO_BUS_MEMORY_MAPPING */
}/*--------------------------<>----------------------------------*/
};
......@@ -228,14 +228,6 @@ struct SYM_FWB_SCR {
struct SYM_FWZ_SCR {
u32 snooptest [ 6];
u32 snoopend [ 2];
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
u32 start_ram [ 1];
u32 scripta0_ba [ 4];
u32 start_ram64 [ 3];
u32 scripta0_ba64 [ 3];
u32 scriptb0_ba64 [ 6];
u32 ram_seg64 [ 1];
#endif
};
static struct SYM_FWA_SCR SYM_FWA_SCR = {
......@@ -1944,51 +1936,5 @@ static struct SYM_FWZ_SCR SYM_FWZ_SCR = {
*/
SCR_INT,
99,
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
/*
* We may use MEMORY MOVE instructions to load the on chip-RAM,
* if it happens that mapping PCI memory is not possible.
* But writing the RAM from the CPU is the preferred method,
* since PCI 2.2 seems to disallow PCI self-mastering.
*/
}/*-------------------------< START_RAM >------------------------*/,{
/*
* Load the script into on-chip RAM,
* and jump to start point.
*/
SCR_COPY (sizeof(struct SYM_FWA_SCR)),
}/*-------------------------< SCRIPTA0_BA >----------------------*/,{
0,
PADDR_A (start),
SCR_JUMP,
PADDR_A (init),
}/*-------------------------< START_RAM64 >----------------------*/,{
/*
* Load the RAM and start for 64 bit PCI (895A,896).
* Both scripts (script and scripth) are loaded into
* the RAM which is 8K (4K for 825A/875/895).
* We also need to load some 32-63 bit segments
* address of the SCRIPTS processor.
* LOAD/STORE ABSOLUTE always refers to on-chip RAM
* in our implementation. The main memory is
* accessed using LOAD/STORE DSA RELATIVE.
*/
SCR_LOAD_REL (mmws, 4),
offsetof (struct sym_hcb, scr_ram_seg),
SCR_COPY (sizeof(struct SYM_FWA_SCR)),
}/*-------------------------< SCRIPTA0_BA64 >--------------------*/,{
0,
PADDR_A (start),
SCR_COPY (sizeof(struct SYM_FWB_SCR)),
}/*-------------------------< SCRIPTB0_BA64 >--------------------*/,{
0,
PADDR_B (start64),
SCR_LOAD_REL (mmrs, 4),
offsetof (struct sym_hcb, scr_ram_seg),
SCR_JUMP64,
PADDR_B (start64),
}/*-------------------------< RAM_SEG64 >------------------------*/,{
0,
#endif /* SYM_OPT_NO_BUS_MEMORY_MAPPING */
}/*-------------------------<>-----------------------------------*/
};
......@@ -167,34 +167,16 @@ struct sym_ucmd { /* Override the SCSI pointer structure */
#define SYM_SCMD_PTR(ucmd) sym_que_entry(ucmd, struct scsi_cmnd, SCp)
#define SYM_SOFTC_PTR(cmd) (((struct host_data *)cmd->device->host->hostdata)->ncb)
/*
* Deal with DMA mapping/unmapping.
*/
#define bus_unmap_sg(pdev, sgptr, sgcnt, dir) \
pci_unmap_sg(pdev, sgptr, sgcnt, dir)
#define bus_unmap_single(pdev, mapping, bufptr, dir) \
pci_unmap_single(pdev, mapping, bufptr, dir)
#define bus_map_single(pdev, bufptr, bufsiz, dir) \
pci_map_single(pdev, bufptr, bufsiz, dir)
#define bus_map_sg(pdev, sgptr, sgcnt, dir) \
pci_map_sg(pdev, sgptr, sgcnt, dir)
#define bus_dma_sync_sg(pdev, sgptr, sgcnt, dir) \
pci_dma_sync_sg(pdev, sgptr, sgcnt, dir)
#define bus_dma_sync_single(pdev, mapping, bufsiz, dir) \
pci_dma_sync_single(pdev, mapping, bufsiz, dir)
#define bus_sg_dma_address(sc) sg_dma_address(sc)
#define bus_sg_dma_len(sc) sg_dma_len(sc)
static void __unmap_scsi_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)
{
int dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction);
switch(SYM_UCMD_PTR(cmd)->data_mapped) {
case 2:
bus_unmap_sg(pdev, cmd->buffer, cmd->use_sg, dma_dir);
pci_unmap_sg(pdev, cmd->buffer, cmd->use_sg, dma_dir);
break;
case 1:
bus_unmap_single(pdev, SYM_UCMD_PTR(cmd)->data_mapping,
pci_unmap_single(pdev, SYM_UCMD_PTR(cmd)->data_mapping,
cmd->request_bufflen, dma_dir);
break;
}
......@@ -206,7 +188,7 @@ static dma_addr_t __map_scsi_single_data(struct pci_dev *pdev, struct scsi_cmnd
dma_addr_t mapping;
int dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction);
mapping = bus_map_single(pdev, cmd->request_buffer,
mapping = pci_map_single(pdev, cmd->request_buffer,
cmd->request_bufflen, dma_dir);
if (mapping) {
SYM_UCMD_PTR(cmd)->data_mapped = 1;
......@@ -221,7 +203,7 @@ static int __map_scsi_sg_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)
int use_sg;
int dma_dir = scsi_to_pci_dma_dir(cmd->sc_data_direction);
use_sg = bus_map_sg(pdev, cmd->buffer, cmd->use_sg, dma_dir);
use_sg = pci_map_sg(pdev, cmd->buffer, cmd->use_sg, dma_dir);
if (use_sg > 0) {
SYM_UCMD_PTR(cmd)->data_mapped = 2;
SYM_UCMD_PTR(cmd)->data_mapping = use_sg;
......@@ -236,10 +218,10 @@ static void __sync_scsi_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)
switch(SYM_UCMD_PTR(cmd)->data_mapped) {
case 2:
bus_dma_sync_sg(pdev, cmd->buffer, cmd->use_sg, dma_dir);
pci_dma_sync_sg(pdev, cmd->buffer, cmd->use_sg, dma_dir);
break;
case 1:
bus_dma_sync_single(pdev, SYM_UCMD_PTR(cmd)->data_mapping,
pci_dma_sync_single(pdev, SYM_UCMD_PTR(cmd)->data_mapping,
cmd->request_bufflen, dma_dir);
break;
}
......@@ -469,8 +451,8 @@ static int sym_scatter(struct sym_hcb *np, struct sym_ccb *cp, struct scsi_cmnd
data = &cp->phys.data[SYM_CONF_MAX_SG - use_sg];
for (segment = 0; segment < use_sg; segment++) {
dma_addr_t baddr = bus_sg_dma_address(&scatter[segment]);
unsigned int len = bus_sg_dma_len(&scatter[segment]);
dma_addr_t baddr = sg_dma_address(&scatter[segment]);
unsigned int len = sg_dma_len(&scatter[segment]);
sym_build_sge(np, &data[segment], baddr, len);
cp->data_len += len;
......@@ -1595,10 +1577,8 @@ static void sym_free_resources(struct sym_hcb *np)
if (np->s.mmio_va)
iounmap(np->s.mmio_va);
#endif
#ifndef SYM_OPT_NO_BUS_MEMORY_MAPPING
if (np->s.ram_va)
iounmap(np->s.ram_va);
#endif
/*
* Free O/S independent resources.
*/
......@@ -1650,14 +1630,13 @@ static int sym_setup_bus_dma_mask(struct sym_hcb *np)
* If all is OK, install interrupt handling and
* start the timer daemon.
*/
static int __devinit
sym_attach (struct scsi_host_template *tpnt, int unit, struct sym_device *dev)
static struct Scsi_Host * __devinit sym_attach(struct scsi_host_template *tpnt,
int unit, struct sym_device *dev)
{
struct host_data *host_data;
struct sym_hcb *np = NULL;
struct Scsi_Host *instance = NULL;
unsigned long flags;
struct sym_nvram *nvram = dev->nvram;
struct sym_fw *fw;
printk(KERN_INFO
......@@ -1762,20 +1741,18 @@ sym_attach (struct scsi_host_template *tpnt, int unit, struct sym_device *dev)
np->ram_ws = 8192;
else
np->ram_ws = 4096;
#ifndef SYM_OPT_NO_BUS_MEMORY_MAPPING
np->s.ram_va = ioremap(dev->s.base_2_c, np->ram_ws);
if (!np->s.ram_va) {
printf_err("%s: can't map PCI MEMORY region\n",
sym_name(np));
goto attach_failed;
}
#endif
}
/*
* Perform O/S independent stuff.
*/
if (sym_hcb_attach(np, fw, nvram))
if (sym_hcb_attach(np, fw, dev->nvram))
goto attach_failed;
......@@ -1843,13 +1820,7 @@ sym_attach (struct scsi_host_template *tpnt, int unit, struct sym_device *dev)
spin_unlock_irqrestore(instance->host_lock, flags);
/*
* Now let the generic SCSI driver
* look for the SCSI devices on the bus ..
*/
scsi_add_host(instance, &dev->pdev->dev); /* XXX: handle failure */
scsi_scan_host(instance);
return 0;
return instance;
reset_failed:
printf_err("%s: FATAL ERROR: CHECK SCSI BUS - CABLES, "
......@@ -1857,13 +1828,13 @@ sym_attach (struct scsi_host_template *tpnt, int unit, struct sym_device *dev)
spin_unlock_irqrestore(instance->host_lock, flags);
attach_failed:
if (!instance)
return -1;
return NULL;
printf_info("%s: giving up ...\n", sym_name(np));
if (np)
sym_free_resources(np);
scsi_host_put(instance);
return -1;
return NULL;
}
......@@ -2115,7 +2086,7 @@ sym53c8xx_pci_init(struct pci_dev *pdev, struct sym_device *device)
* Ignore Symbios chips controlled by various RAID controllers.
* These controllers set value 0x52414944 at RAM end - 16.
*/
#if defined(__i386__) && !defined(SYM_OPT_NO_BUS_MEMORY_MAPPING)
#if defined(__i386__)
if (base_2_c) {
unsigned int ram_size, ram_val;
void *ram_ptr;
......@@ -2202,12 +2173,9 @@ sym53c8xx_pci_init(struct pci_dev *pdev, struct sym_device *device)
/*
* Linux release module stuff.
*
* Called before unloading the module.
* Detach the host.
* We have to free resources and halt the NCR chip.
*
*/
static int __devexit sym_detach(struct sym_hcb *np)
{
......@@ -2216,18 +2184,15 @@ static int __devexit sym_detach(struct sym_hcb *np)
del_timer_sync(&np->s.timer);
/*
* Reset NCR chip.
* We should use sym_soft_reset(), but we donnot want to do
* so, since we may not be safe if interrupts occur.
* Reset NCR chip.
* We should use sym_soft_reset(), but we don't want to do
* so, since we may not be safe if interrupts occur.
*/
printk("%s: resetting chip\n", sym_name(np));
OUTB (nc_istat, SRST);
UDELAY (10);
OUTB (nc_istat, 0);
/*
* Free host resources
*/
sym_free_resources(np);
return 1;
......@@ -2336,6 +2301,7 @@ static int __devinit sym2_probe(struct pci_dev *pdev,
{
struct sym_device sym_dev;
struct sym_nvram nvram;
struct Scsi_Host *instance;
memset(&sym_dev, 0, sizeof(sym_dev));
memset(&nvram, 0, sizeof(nvram));
......@@ -2354,12 +2320,20 @@ static int __devinit sym2_probe(struct pci_dev *pdev,
sym_get_nvram(&sym_dev, &nvram);
if (sym_attach(&sym2_template, attach_count, &sym_dev))
instance = sym_attach(&sym2_template, attach_count, &sym_dev);
if (!instance)
goto free;
if (scsi_add_host(instance, &pdev->dev))
goto detach;
scsi_scan_host(instance);
attach_count++;
return 0;
detach:
sym_detach(pci_get_drvdata(pdev));
free:
pci_release_regions(pdev);
disable:
......@@ -2369,7 +2343,13 @@ static int __devinit sym2_probe(struct pci_dev *pdev,
static void __devexit sym2_remove(struct pci_dev *pdev)
{
sym_detach(pci_get_drvdata(pdev));
struct sym_hcb *np = pci_get_drvdata(pdev);
struct Scsi_Host *host = np->s.host;
scsi_remove_host(host);
scsi_host_put(host);
sym_detach(np);
pci_release_regions(pdev);
pci_disable_device(pdev);
......
......@@ -74,10 +74,6 @@
#define bzero(d, n) memset((d), 0, (n))
#endif
#ifndef bcmp
#define bcmp(a, b, n) memcmp((a), (b), (n))
#endif
/*
* General driver includes.
*/
......@@ -96,7 +92,6 @@
#define SYM_OPT_SNIFF_INQUIRY
#define SYM_OPT_LIMIT_COMMAND_REORDERING
#define SYM_OPT_ANNOUNCE_TRANSFER_RATE
#define SYM_OPT_BUS_DMA_ABSTRACTION
/*
* Print a message with severity.
......
......@@ -50,7 +50,7 @@
* SUCH DAMAGE.
*/
#define SYM_DRIVER_NAME "sym-2.1.18b"
#define SYM_DRIVER_NAME "sym-2.1.18f"
#ifdef __FreeBSD__
#include <dev/sym/sym_glue.h>
......@@ -751,8 +751,6 @@ static u32 parisc_setup_hcb(hcb_p np, u32 period)
&np->maxwide, &scsi_mode))
return period;
printk("scsi_mode = %d, period = %ld\n", scsi_mode, pdc_period);
if (scsi_mode >= 0) {
/* C3000 PDC reports period/mode */
SYM_SETUP_SCSI_DIFF = 0;
......@@ -1962,13 +1960,6 @@ void sym_start_up (hcb_p np, int reason)
if (sym_verbose >= 2)
printf ("%s: Downloading SCSI SCRIPTS.\n",
sym_name(np));
#ifdef SYM_OPT_NO_BUS_MEMORY_MAPPING
np->fw_patch(np);
if (np->ram_ws == 8192)
phys = SCRIPTZ_BA (np, start_ram64);
else
phys = SCRIPTZ_BA (np, start_ram);
#else
if (np->ram_ws == 8192) {
OUTRAM_OFF(4096, np->scriptb0, np->scriptb_sz);
phys = scr_to_cpu(np->scr_ram_seg);
......@@ -1980,7 +1971,6 @@ void sym_start_up (hcb_p np, int reason)
else
phys = SCRIPTA_BA (np, init);
OUTRAM_OFF(0, np->scripta0, np->scripta_sz);
#endif
}
else
phys = SCRIPTA_BA (np, init);
......@@ -4151,8 +4141,10 @@ sym_ppr_nego_check(hcb_p np, int req, int target)
/*
* Check values against our limits.
*/
if (wide > np->maxwide)
{chg = 1; wide = np->maxwide;}
if (wide > np->maxwide) {
chg = 1;
wide = np->maxwide;
}
if (!wide || !(np->features & FE_ULTRA3))
dt &= ~PPR_OPT_DT;
if (req) {
......@@ -4306,8 +4298,10 @@ sym_wide_nego_check(hcb_p np, int req, int target)
/*
* Check values against our limits.
*/
if (wide > np->maxwide)
{chg = 1; wide = np->maxwide;}
if (wide > np->maxwide) {
chg = 1;
wide = np->maxwide;
}
if (req) {
if (wide > tp->tinfo.user.width)
{chg = 1; wide = tp->tinfo.user.width;}
......
......@@ -59,12 +59,6 @@
* They may be defined in platform specific headers, if they
* are useful.
*
* SYM_OPT_NO_BUS_MEMORY_MAPPING
* When this option is set, the driver will not load the
* on-chip RAM using MMIO, but let the SCRIPTS processor
* do the work using MOVE MEMORY instructions.
* (set for Linux/PPC)
*
* SYM_OPT_HANDLE_DIR_UNKNOWN
* When this option is set, the SCRIPTS used by the driver
* are able to handle SCSI transfers with direction not
......@@ -75,12 +69,6 @@
* When this option is set, the driver will use a queue per
* device and handle QUEUE FULL status requeuing internally.
*
* SYM_OPT_BUS_DMA_ABSTRACTION
* When this option is set, the driver allocator is responsible
* of maintaining bus physical addresses and so provides virtual
* to bus physical address translation of driver data structures.
* (set for FreeBSD-4 and Linux 2.3)
*
* SYM_OPT_SNIFF_INQUIRY
* When this option is set, the driver sniff out successful
* INQUIRY response and performs negotiations accordingly.
......@@ -92,10 +80,8 @@
* (set for Linux)
*/
#if 0
#define SYM_OPT_NO_BUS_MEMORY_MAPPING
#define SYM_OPT_HANDLE_DIR_UNKNOWN
#define SYM_OPT_HANDLE_DEVICE_QUEUEING
#define SYM_OPT_BUS_DMA_ABSTRACTION
#define SYM_OPT_SNIFF_INQUIRY
#define SYM_OPT_LIMIT_COMMAND_REORDERING
#endif
......@@ -958,9 +944,7 @@ struct sym_hcb {
/*
* DMA pool handle for this HBA.
*/
#ifdef SYM_OPT_BUS_DMA_ABSTRACTION
m_pool_ident_t bus_dmat;
#endif
/*
* O/S specific data structure
......@@ -1133,9 +1117,20 @@ struct sym_hcb {
/*
* NVRAM reading (sym_nvram.c).
*/
#if SYM_CONF_NVRAM_SUPPORT
void sym_nvram_setup_host (hcb_p np, struct sym_nvram *nvram);
void sym_nvram_setup_target (hcb_p np, int target, struct sym_nvram *nvp);
int sym_read_nvram (sdev_p np, struct sym_nvram *nvp);
#else
static inline void sym_nvram_setup_host(hcb_p np, struct sym_nvram *nvram) { }
static inline void sym_nvram_setup_target(hcb_p np, struct sym_nvram *nvram) { }
static inline int sym_read_nvram(sdev_p np, struct sym_nvram *nvp)
{
nvp->type = 0;
return 0;
}
#endif
/*
* FIRMWARES (sym_fw.c)
......@@ -1347,7 +1342,6 @@ typedef struct sym_m_link {
* Virtual to bus physical translation for a given cluster.
* Such a structure is only useful with DMA abstraction.
*/
#ifdef SYM_OPT_BUS_DMA_ABSTRACTION
typedef struct sym_m_vtob { /* Virtual to Bus address translation */
struct sym_m_vtob *next;
#ifdef SYM_HAVE_M_SVTOB
......@@ -1363,7 +1357,6 @@ typedef struct sym_m_vtob { /* Virtual to Bus address translation */
#define VTOB_HASH_MASK (VTOB_HASH_SIZE-1)
#define VTOB_HASH_CODE(m) \
((((m_addr_t) (m)) >> SYM_MEM_CLUSTER_SHIFT) & VTOB_HASH_MASK)
#endif /* SYM_OPT_BUS_DMA_ABSTRACTION */
/*
* Memory pool of a given kind.
......@@ -1375,7 +1368,6 @@ typedef struct sym_m_vtob { /* Virtual to Bus address translation */
* method are expected to tell the driver about.
*/
typedef struct sym_m_pool {
#ifdef SYM_OPT_BUS_DMA_ABSTRACTION
m_pool_ident_t dev_dmat; /* Identifies the pool (see above) */
m_addr_t (*get_mem_cluster)(struct sym_m_pool *);
#ifdef SYM_MEM_FREE_UNUSED
......@@ -1389,10 +1381,6 @@ typedef struct sym_m_pool {
int nump;
m_vtob_p vtob[VTOB_HASH_SIZE];
struct sym_m_pool *next;
#else
#define M_GET_MEM_CLUSTER() sym_get_mem_cluster()
#define M_FREE_MEM_CLUSTER(p) sym_free_mem_cluster(p)
#endif /* SYM_OPT_BUS_DMA_ABSTRACTION */
struct sym_m_link h[SYM_MEM_CLUSTER_SHIFT - SYM_MEM_SHIFT + 1];
} *m_pool_p;
......@@ -1406,12 +1394,10 @@ void *sym_calloc_unlocked(int size, char *name);
* Alloc, free and translate addresses to bus physical
* for DMAable memory.
*/
#ifdef SYM_OPT_BUS_DMA_ABSTRACTION
void *__sym_calloc_dma_unlocked(m_pool_ident_t dev_dmat, int size, char *name);
void
__sym_mfree_dma_unlocked(m_pool_ident_t dev_dmat, void *m,int size, char *name);
u32 __vtobus_unlocked(m_pool_ident_t dev_dmat, void *m);
#endif
/*
* Verbs used by the driver code for DMAable memory handling.
......
......@@ -204,18 +204,9 @@ static void __sym_mfree(m_pool_p mp, void *ptr, int size, char *name)
/*
* Default memory pool we donnot need to involve in DMA.
*
* If DMA abtraction is not needed, the generic allocator
* calls directly some kernel allocator.
*
* With DMA abstraction, we use functions (methods), to
* distinguish between non DMAable memory and DMAable memory.
*/
#ifndef SYM_OPT_BUS_DMA_ABSTRACTION
static struct sym_m_pool mp0;
#else
static m_addr_t ___mp0_get_mem_cluster(m_pool_p mp)
{
m_addr_t m = (m_addr_t) sym_get_mem_cluster();
......@@ -240,8 +231,6 @@ static struct sym_m_pool mp0 =
{0, ___mp0_get_mem_cluster};
#endif
#endif /* SYM_OPT_BUS_DMA_ABSTRACTION */
/*
* Actual memory allocation routine for non-DMAed memory.
*/
......@@ -260,7 +249,6 @@ void sym_mfree_unlocked(void *ptr, int size, char *name)
__sym_mfree(&mp0, ptr, size, name);
}
#ifdef SYM_OPT_BUS_DMA_ABSTRACTION
/*
* Methods that maintains DMAable pools according to user allocations.
* New pools are created on the fly when a new pool id is provided.
......@@ -417,5 +405,3 @@ u32 __vtobus_unlocked(m_pool_ident_t dev_dmat, void *m)
panic("sym: VTOBUS FAILED!\n");
return (u32)(vp ? vp->baddr + (((m_addr_t) m) - a) : 0);
}
#endif /* SYM_OPT_BUS_DMA_ABSTRACTION */
This diff is collapsed.
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