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)
{
......@@ -2217,7 +2185,7 @@ static int __devexit sym_detach(struct sym_hcb *np)
/*
* Reset NCR chip.
* We should use sym_soft_reset(), but we donnot want to do
* 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));
......@@ -2225,9 +2193,6 @@ static int __devexit sym_detach(struct sym_hcb *np)
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 */
......@@ -59,25 +59,22 @@
/*
* Some poor and bogus sync table that refers to Tekram NVRAM layout.
*/
#if SYM_CONF_NVRAM_SUPPORT
static u_char Tekram_sync[16] =
{25,31,37,43, 50,62,75,125, 12,15,18,21, 6,7,9,10};
#ifdef SYM_CONF_DEBUG_NVRAM
static u_char Tekram_boot_delay[7] = {3, 5, 10, 20, 30, 60, 120};
#endif
#endif
/*
* Get host setup from NVRAM.
*/
void sym_nvram_setup_host (hcb_p np, struct sym_nvram *nvram)
void sym_nvram_setup_host(struct sym_hcb *np, struct sym_nvram *nvram)
{
#if SYM_CONF_NVRAM_SUPPORT
/*
* Get parity checking, host ID, verbose mode
* and miscellaneous host flags from NVRAM.
*/
switch(nvram->type) {
switch (nvram->type) {
case SYM_SYMBIOS_NVRAM:
if (!(nvram->data.Symbios.flags & SYMBIOS_PARITY_ENABLE))
np->rv_scntl0 &= ~0x0a;
......@@ -95,41 +92,15 @@ void sym_nvram_setup_host (hcb_p np, struct sym_nvram *nvram)
default:
break;
}
#endif
}
/*
* Get target setup from NVRAM.
*/
#if SYM_CONF_NVRAM_SUPPORT
static void sym_Symbios_setup_target(hcb_p np,int target, Symbios_nvram *nvram);
static void sym_Tekram_setup_target(hcb_p np,int target, Tekram_nvram *nvram);
#endif
void sym_nvram_setup_target (hcb_p np, int target, struct sym_nvram *nvp)
{
#if SYM_CONF_NVRAM_SUPPORT
switch(nvp->type) {
case SYM_SYMBIOS_NVRAM:
sym_Symbios_setup_target (np, target, &nvp->data.Symbios);
break;
case SYM_TEKRAM_NVRAM:
sym_Tekram_setup_target (np, target, &nvp->data.Tekram);
break;
default:
break;
}
#endif
}
#if SYM_CONF_NVRAM_SUPPORT
/*
* Get target set-up from Symbios format NVRAM.
*/
static void
sym_Symbios_setup_target(hcb_p np, int target, Symbios_nvram *nvram)
sym_Symbios_setup_target(struct sym_hcb *np, int target, Symbios_nvram *nvram)
{
tcb_p tp = &np->target[target];
struct sym_tcb *tp = &np->target[target];
Symbios_target *tn = &nvram->target[target];
tp->tinfo.user.period = tn->sync_period ? (tn->sync_period + 3) / 4 : 0;
......@@ -149,9 +120,9 @@ sym_Symbios_setup_target(hcb_p np, int target, Symbios_nvram *nvram)
* Get target set-up from Tekram format NVRAM.
*/
static void
sym_Tekram_setup_target(hcb_p np, int target, Tekram_nvram *nvram)
sym_Tekram_setup_target(struct sym_hcb *np, int target, Tekram_nvram *nvram)
{
tcb_p tp = &np->target[target];
struct sym_tcb *tp = &np->target[target];
struct Tekram_target *tn = &nvram->target[target];
int i;
......@@ -160,8 +131,8 @@ sym_Tekram_setup_target(hcb_p np, int target, Tekram_nvram *nvram)
tp->tinfo.user.period = Tekram_sync[i];
}
tp->tinfo.user.width =
(tn->flags & TEKRAM_WIDE_NEGO) ? BUS_16_BIT : BUS_8_BIT;
tp->tinfo.user.width = (tn->flags & TEKRAM_WIDE_NEGO) ?
BUS_16_BIT : BUS_8_BIT;
if (tn->flags & TEKRAM_TAGGED_COMMANDS) {
tp->usrtags = 2 << nvram->max_tags_index;
......@@ -175,11 +146,28 @@ sym_Tekram_setup_target(hcb_p np, int target, Tekram_nvram *nvram)
np->rv_scntl0 &= ~0x0a; /* SCSI parity checking disabled */
}
/*
* Get target setup from NVRAM.
*/
void sym_nvram_setup_target(struct sym_hcb *np, int target, struct sym_nvram *nvp)
{
switch (nvp->type) {
case SYM_SYMBIOS_NVRAM:
sym_Symbios_setup_target(np, target, &nvp->data.Symbios);
break;
case SYM_TEKRAM_NVRAM:
sym_Tekram_setup_target(np, target, &nvp->data.Tekram);
break;
default:
break;
}
}
#ifdef SYM_CONF_DEBUG_NVRAM
/*
* Dump Symbios format NVRAM for debugging purpose.
*/
static void sym_display_Symbios_nvram(sdev_p np, Symbios_nvram *nvram)
static void sym_display_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram)
{
int i;
......@@ -211,7 +199,7 @@ static void sym_display_Symbios_nvram(sdev_p np, Symbios_nvram *nvram)
/*
* Dump TEKRAM format NVRAM for debugging purpose.
*/
static void sym_display_Tekram_nvram(sdev_p np, Tekram_nvram *nvram)
static void sym_display_Tekram_nvram(struct sym_device *np, Tekram_nvram *nvram)
{
int i, tags, boot_delay;
char *rem;
......@@ -221,7 +209,7 @@ static void sym_display_Tekram_nvram(sdev_p np, Tekram_nvram *nvram)
boot_delay = 0;
if (nvram->boot_delay_index < 6)
boot_delay = Tekram_boot_delay[nvram->boot_delay_index];
switch((nvram->flags & TEKRAM_REMOVABLE_FLAGS) >> 6) {
switch ((nvram->flags & TEKRAM_REMOVABLE_FLAGS) >> 6) {
default:
case 0: rem = ""; break;
case 1: rem = " REMOVABLE=boot device"; break;
......@@ -257,49 +245,12 @@ static void sym_display_Tekram_nvram(sdev_p np, Tekram_nvram *nvram)
sync);
}
}
#endif /* SYM_CONF_DEBUG_NVRAM */
#endif /* SYM_CONF_NVRAM_SUPPORT */
/*
* Try reading Symbios or Tekram NVRAM
*/
#if SYM_CONF_NVRAM_SUPPORT
static int sym_read_Symbios_nvram (sdev_p np, Symbios_nvram *nvram);
static int sym_read_Tekram_nvram (sdev_p np, Tekram_nvram *nvram);
#endif
int sym_read_nvram (sdev_p np, struct sym_nvram *nvp)
{
#if SYM_CONF_NVRAM_SUPPORT
/*
* Try to read SYMBIOS nvram.
* Try to read TEKRAM nvram if Symbios nvram not found.
*/
if (SYM_SETUP_SYMBIOS_NVRAM &&
!sym_read_Symbios_nvram (np, &nvp->data.Symbios)) {
nvp->type = SYM_SYMBIOS_NVRAM;
#ifdef SYM_CONF_DEBUG_NVRAM
sym_display_Symbios_nvram(np, &nvp->data.Symbios);
#endif
}
else if (SYM_SETUP_TEKRAM_NVRAM &&
!sym_read_Tekram_nvram (np, &nvp->data.Tekram)) {
nvp->type = SYM_TEKRAM_NVRAM;
#ifdef SYM_CONF_DEBUG_NVRAM
sym_display_Tekram_nvram(np, &nvp->data.Tekram);
#endif
}
else
nvp->type = 0;
#else
nvp->type = 0;
#endif
return nvp->type;
}
static void sym_display_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram) { }
static void sym_display_Tekram_nvram(struct sym_device *np, Tekram_nvram *nvram) { }
#endif /* SYM_CONF_DEBUG_NVRAM */
#if SYM_CONF_NVRAM_SUPPORT
/*
* 24C16 EEPROM reading.
*
......@@ -316,11 +267,11 @@ int sym_read_nvram (sdev_p np, struct sym_nvram *nvp)
/*
* Set/clear data/clock bit in GPIO0
*/
static void S24C16_set_bit(sdev_p np, u_char write_bit, u_char *gpreg,
static void S24C16_set_bit(struct sym_device *np, u_char write_bit, u_char *gpreg,
int bit_mode)
{
UDELAY (5);
switch (bit_mode){
switch (bit_mode) {
case SET_BIT:
*gpreg |= write_bit;
break;
......@@ -342,7 +293,7 @@ static void S24C16_set_bit(sdev_p np, u_char write_bit, u_char *gpreg,
/*
* Send START condition to NVRAM to wake it up.
*/
static void S24C16_start(sdev_p np, u_char *gpreg)
static void S24C16_start(struct sym_device *np, u_char *gpreg)
{
S24C16_set_bit(np, 1, gpreg, SET_BIT);
S24C16_set_bit(np, 0, gpreg, SET_CLK);
......@@ -353,7 +304,7 @@ static void S24C16_start(sdev_p np, u_char *gpreg)
/*
* Send STOP condition to NVRAM - puts NVRAM to sleep... ZZzzzz!!
*/
static void S24C16_stop(sdev_p np, u_char *gpreg)
static void S24C16_stop(struct sym_device *np, u_char *gpreg)
{
S24C16_set_bit(np, 0, gpreg, SET_CLK);
S24C16_set_bit(np, 1, gpreg, SET_BIT);
......@@ -363,7 +314,7 @@ static void S24C16_stop(sdev_p np, u_char *gpreg)
* Read or write a bit to the NVRAM,
* read if GPIO0 input else write if GPIO0 output
*/
static void S24C16_do_bit(sdev_p np, u_char *read_bit, u_char write_bit,
static void S24C16_do_bit(struct sym_device *np, u_char *read_bit, u_char write_bit,
u_char *gpreg)
{
S24C16_set_bit(np, write_bit, gpreg, SET_BIT);
......@@ -378,7 +329,7 @@ static void S24C16_do_bit(sdev_p np, u_char *read_bit, u_char write_bit,
* Output an ACK to the NVRAM after reading,
* change GPIO0 to output and when done back to an input
*/
static void S24C16_write_ack(sdev_p np, u_char write_bit, u_char *gpreg,
static void S24C16_write_ack(struct sym_device *np, u_char write_bit, u_char *gpreg,
u_char *gpcntl)
{
OUTB (nc_gpcntl, *gpcntl & 0xfe);
......@@ -390,7 +341,7 @@ static void S24C16_write_ack(sdev_p np, u_char write_bit, u_char *gpreg,
* Input an ACK from NVRAM after writing,
* change GPIO0 to input and when done back to an output
*/
static void S24C16_read_ack(sdev_p np, u_char *read_bit, u_char *gpreg,
static void S24C16_read_ack(struct sym_device *np, u_char *read_bit, u_char *gpreg,
u_char *gpcntl)
{
OUTB (nc_gpcntl, *gpcntl | 0x01);
......@@ -402,7 +353,7 @@ static void S24C16_read_ack(sdev_p np, u_char *read_bit, u_char *gpreg,
* WRITE a byte to the NVRAM and then get an ACK to see it was accepted OK,
* GPIO0 must already be set as an output
*/
static void S24C16_write_byte(sdev_p np, u_char *ack_data, u_char write_data,
static void S24C16_write_byte(struct sym_device *np, u_char *ack_data, u_char write_data,
u_char *gpreg, u_char *gpcntl)
{
int x;
......@@ -417,7 +368,7 @@ static void S24C16_write_byte(sdev_p np, u_char *ack_data, u_char write_data,
* READ a byte from the NVRAM and then send an ACK to say we have got it,
* GPIO0 must already be set as an input
*/
static void S24C16_read_byte(sdev_p np, u_char *read_data, u_char ack_data,
static void S24C16_read_byte(struct sym_device *np, u_char *read_data, u_char ack_data,
u_char *gpreg, u_char *gpcntl)
{
int x;
......@@ -435,7 +386,7 @@ static void S24C16_read_byte(sdev_p np, u_char *read_data, u_char ack_data,
/*
* Read 'len' bytes starting at 'offset'.
*/
static int sym_read_S24C16_nvram (sdev_p np, int offset, u_char *data, int len)
static int sym_read_S24C16_nvram(struct sym_device *np, int offset, u_char *data, int len)
{
u_char gpcntl, gpreg;
u_char old_gpcntl, old_gpreg;
......@@ -514,7 +465,7 @@ static int sym_read_S24C16_nvram (sdev_p np, int offset, u_char *data, int len)
* Try reading Symbios NVRAM.
* Return 0 if OK.
*/
static int sym_read_Symbios_nvram (sdev_p np, Symbios_nvram *nvram)
static int sym_read_Symbios_nvram(struct sym_device *np, Symbios_nvram *nvram)
{
static u_char Symbios_trailer[6] = {0xfe, 0xfe, 0, 0, 0, 0};
u_char *data = (u_char *) nvram;
......@@ -528,7 +479,7 @@ static int sym_read_Symbios_nvram (sdev_p np, Symbios_nvram *nvram)
/* check valid NVRAM signature, verify byte count and checksum */
if (nvram->type != 0 ||
bcmp(nvram->trailer, Symbios_trailer, 6) ||
memcmp(nvram->trailer, Symbios_trailer, 6) ||
nvram->byte_count != len - 12)
return 1;
......@@ -555,7 +506,7 @@ static int sym_read_Symbios_nvram (sdev_p np, Symbios_nvram *nvram)
/*
* Pulse clock bit in GPIO0
*/
static void T93C46_Clk(sdev_p np, u_char *gpreg)
static void T93C46_Clk(struct sym_device *np, u_char *gpreg)
{
OUTB (nc_gpreg, *gpreg | 0x04);
UDELAY (2);
......@@ -565,7 +516,7 @@ static void T93C46_Clk(sdev_p np, u_char *gpreg)
/*
* Read bit from NVRAM
*/
static void T93C46_Read_Bit(sdev_p np, u_char *read_bit, u_char *gpreg)
static void T93C46_Read_Bit(struct sym_device *np, u_char *read_bit, u_char *gpreg)
{
UDELAY (2);
T93C46_Clk(np, gpreg);
......@@ -575,7 +526,7 @@ static void T93C46_Read_Bit(sdev_p np, u_char *read_bit, u_char *gpreg)
/*
* Write bit to GPIO0
*/
static void T93C46_Write_Bit(sdev_p np, u_char write_bit, u_char *gpreg)
static void T93C46_Write_Bit(struct sym_device *np, u_char write_bit, u_char *gpreg)
{
if (write_bit & 0x01)
*gpreg |= 0x02;
......@@ -593,7 +544,7 @@ static void T93C46_Write_Bit(sdev_p np, u_char write_bit, u_char *gpreg)
/*
* Send STOP condition to NVRAM - puts NVRAM to sleep... ZZZzzz!!
*/
static void T93C46_Stop(sdev_p np, u_char *gpreg)
static void T93C46_Stop(struct sym_device *np, u_char *gpreg)
{
*gpreg &= 0xef;
OUTB (nc_gpreg, *gpreg);
......@@ -605,7 +556,7 @@ static void T93C46_Stop(sdev_p np, u_char *gpreg)
/*
* Send read command and address to NVRAM
*/
static void T93C46_Send_Command(sdev_p np, u_short write_data,
static void T93C46_Send_Command(struct sym_device *np, u_short write_data,
u_char *read_bit, u_char *gpreg)
{
int x;
......@@ -620,7 +571,8 @@ static void T93C46_Send_Command(sdev_p np, u_short write_data,
/*
* READ 2 bytes from the NVRAM
*/
static void T93C46_Read_Word(sdev_p np, u_short *nvram_data, u_char *gpreg)
static void T93C46_Read_Word(struct sym_device *np,
unsigned short *nvram_data, unsigned char *gpreg)
{
int x;
u_char read_bit;
......@@ -639,13 +591,13 @@ static void T93C46_Read_Word(sdev_p np, u_short *nvram_data, u_char *gpreg)
/*
* Read Tekram NvRAM data.
*/
static int T93C46_Read_Data(sdev_p np, u_short *data,int len,u_char *gpreg)
static int T93C46_Read_Data(struct sym_device *np, unsigned short *data,
int len, unsigned char *gpreg)
{
u_char read_bit;
int x;
for (x = 0; x < len; x++) {
unsigned char read_bit;
/* output read command and address */
T93C46_Send_Command(np, 0x180 | x, &read_bit, gpreg);
if (read_bit & 0x01)
......@@ -660,7 +612,7 @@ static int T93C46_Read_Data(sdev_p np, u_short *data,int len,u_char *gpreg)
/*
* Try reading 93C46 Tekram NVRAM.
*/
static int sym_read_T93C46_nvram (sdev_p np, Tekram_nvram *nvram)
static int sym_read_T93C46_nvram(struct sym_device *np, Tekram_nvram *nvram)
{
u_char gpcntl, gpreg;
u_char old_gpcntl, old_gpreg;
......@@ -692,7 +644,7 @@ static int sym_read_T93C46_nvram (sdev_p np, Tekram_nvram *nvram)
* Try reading Tekram NVRAM.
* Return 0 if OK.
*/
static int sym_read_Tekram_nvram (sdev_p np, Tekram_nvram *nvram)
static int sym_read_Tekram_nvram (struct sym_device *np, Tekram_nvram *nvram)
{
u_char *data = (u_char *) nvram;
int len = sizeof(*nvram);
......@@ -700,13 +652,13 @@ static int sym_read_Tekram_nvram (sdev_p np, Tekram_nvram *nvram)
int x;
switch (np->device_id) {
case PCI_ID_SYM53C885:
case PCI_ID_SYM53C895:
case PCI_ID_SYM53C896:
case PCI_DEVICE_ID_NCR_53C885:
case PCI_DEVICE_ID_NCR_53C895:
case PCI_DEVICE_ID_NCR_53C896:
x = sym_read_S24C16_nvram(np, TEKRAM_24C16_NVRAM_ADDRESS,
data, len);
break;
case PCI_ID_SYM53C875:
case PCI_DEVICE_ID_NCR_53C875:
x = sym_read_S24C16_nvram(np, TEKRAM_24C16_NVRAM_ADDRESS,
data, len);
if (!x)
......@@ -727,4 +679,19 @@ static int sym_read_Tekram_nvram (sdev_p np, Tekram_nvram *nvram)
return 0;
}
#endif /* SYM_CONF_NVRAM_SUPPORT */
/*
* Try reading Symbios or Tekram NVRAM
*/
int sym_read_nvram(struct sym_device *np, struct sym_nvram *nvp)
{
if (!sym_read_Symbios_nvram(np, &nvp->data.Symbios)) {
nvp->type = SYM_SYMBIOS_NVRAM;
sym_display_Symbios_nvram(np, &nvp->data.Symbios);
} else if (!sym_read_Tekram_nvram(np, &nvp->data.Tekram)) {
nvp->type = SYM_TEKRAM_NVRAM;
sym_display_Tekram_nvram(np, &nvp->data.Tekram);
} else {
nvp->type = 0;
}
return nvp->type;
}
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