Commit c89701f8 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

[PATCH] sym2 patchset

A big pile of sym2-related changes.  I have most of them split apart in
CVS, so I can submit them as individual patches if anyone's interested.

Changelog:
 - Use pci_set_mwi() instead of trying to do it ourselves.
 - Rename PCI_ID_LSI53C1010 to 1010_33 and PCI_ID_LSI53C1010_2 to 1010_66.
 - Turn sym_udelay and sym_mdelay into macros.
 - Move the definition of sym53c8xx_lock near the functions that call it
   and remove the macros that wrapper it.
 - SYM_LINUX_DYNAMIC_DMA_MAPPING is always defined.  (Christoph Hellwig)
 - Remove first_host (Christoph Hellwig)
 - Support for hp C3000 (Grant Grundler)
 - Switch to using pci_name()
 - Remove the #if 0'd code from the pci_driver conversion.
 - Remove the sym_chip typedef.
 - Remove the pcifix option.
 - Remove a redundant printk on driver initialisation.
 - Use rmb() for __READ_BARRIER and wmb() for __WRITE_BARRIER
 - Increment the version to 2.1.17a.
parent 5b8b844d
...@@ -130,11 +130,6 @@ ...@@ -130,11 +130,6 @@
*/ */
/* #define SYM_CONF_IARB_SUPPORT */ /* #define SYM_CONF_IARB_SUPPORT */
/*
* Support for some PCI fix-ups (or assumed so).
*/
#define SYM_CONF_PCI_FIX_UP
/* /*
* Number of lists for the optimization of the IO timeout handling. * Number of lists for the optimization of the IO timeout handling.
* Not used under FreeBSD and Linux. * Not used under FreeBSD and Linux.
......
...@@ -74,8 +74,8 @@ ...@@ -74,8 +74,8 @@
#define PCI_ID_SYM53C896 0xb #define PCI_ID_SYM53C896 0xb
#define PCI_ID_SYM53C895A 0x12 #define PCI_ID_SYM53C895A 0x12
#define PCI_ID_SYM53C875A 0x13 #define PCI_ID_SYM53C875A 0x13
#define PCI_ID_LSI53C1010 0x20 #define PCI_ID_LSI53C1010_33 0x20
#define PCI_ID_LSI53C1010_2 0x21 #define PCI_ID_LSI53C1010_66 0x21
#define PCI_ID_LSI53C1510D 0xa #define PCI_ID_LSI53C1510D 0xa
/* /*
......
...@@ -270,13 +270,13 @@ sym_fw2_patch(hcb_p np) ...@@ -270,13 +270,13 @@ sym_fw2_patch(hcb_p np)
* Remove a couple of work-arounds specific to C1010 if * Remove a couple of work-arounds specific to C1010 if
* they are not desirable. See `sym_fw2.h' for more details. * they are not desirable. See `sym_fw2.h' for more details.
*/ */
if (!(np->device_id == PCI_ID_LSI53C1010_2 && if (!(np->device_id == PCI_ID_LSI53C1010_66 &&
np->revision_id < 0x1 && np->revision_id < 0x1 &&
np->pciclk_khz < 60000)) { np->pciclk_khz < 60000)) {
scripta0->datao_phase[0] = cpu_to_scr(SCR_NO_OP); scripta0->datao_phase[0] = cpu_to_scr(SCR_NO_OP);
scripta0->datao_phase[1] = cpu_to_scr(0); scripta0->datao_phase[1] = cpu_to_scr(0);
} }
if (!(np->device_id == PCI_ID_LSI53C1010 && if (!(np->device_id == PCI_ID_LSI53C1010_33 &&
/* np->revision_id < 0xff */ 1)) { /* np->revision_id < 0xff */ 1)) {
scripta0->sel_done[0] = cpu_to_scr(SCR_NO_OP); scripta0->sel_done[0] = cpu_to_scr(SCR_NO_OP);
scripta0->sel_done[1] = cpu_to_scr(0); scripta0->sel_done[1] = cpu_to_scr(0);
......
This diff is collapsed.
...@@ -111,8 +111,6 @@ typedef u_long vm_offset_t; ...@@ -111,8 +111,6 @@ typedef u_long vm_offset_t;
/* /*
* Configuration addendum for Linux. * Configuration addendum for Linux.
*/ */
#define SYM_LINUX_DYNAMIC_DMA_MAPPING
#define SYM_CONF_TIMER_INTERVAL ((HZ+1)/2) #define SYM_CONF_TIMER_INTERVAL ((HZ+1)/2)
#define SYM_OPT_HANDLE_DIR_UNKNOWN #define SYM_OPT_HANDLE_DIR_UNKNOWN
...@@ -121,10 +119,7 @@ typedef u_long vm_offset_t; ...@@ -121,10 +119,7 @@ typedef u_long vm_offset_t;
#define SYM_OPT_SNIFF_INQUIRY #define SYM_OPT_SNIFF_INQUIRY
#define SYM_OPT_LIMIT_COMMAND_REORDERING #define SYM_OPT_LIMIT_COMMAND_REORDERING
#define SYM_OPT_ANNOUNCE_TRANSFER_RATE #define SYM_OPT_ANNOUNCE_TRANSFER_RATE
#ifdef SYM_LINUX_DYNAMIC_DMA_MAPPING
#define SYM_OPT_BUS_DMA_ABSTRACTION #define SYM_OPT_BUS_DMA_ABSTRACTION
#endif
/* /*
* Print a message with severity. * Print a message with severity.
...@@ -142,8 +137,8 @@ typedef u_long vm_offset_t; ...@@ -142,8 +137,8 @@ typedef u_long vm_offset_t;
/* /*
* Insert a delay in micro-seconds and milli-seconds. * Insert a delay in micro-seconds and milli-seconds.
*/ */
void sym_udelay(int us); #define sym_udelay(us) udelay(us)
void sym_mdelay(int ms); #define sym_mdelay(ms) mdelay(ms)
/* /*
* Let the compiler know about driver data structure names. * Let the compiler know about driver data structure names.
...@@ -426,9 +421,6 @@ struct sym_shcb { ...@@ -426,9 +421,6 @@ struct sym_shcb {
struct Scsi_Host *host; struct Scsi_Host *host;
u_char bus; /* PCI BUS number */
u_char device_fn; /* PCI BUS device and function */
vm_offset_t mmio_va; /* MMIO kernel virtual address */ vm_offset_t mmio_va; /* MMIO kernel virtual address */
vm_offset_t ram_va; /* RAM kernel virtual address */ vm_offset_t ram_va; /* RAM kernel virtual address */
u_long io_port; /* IO port address cookie */ u_long io_port; /* IO port address cookie */
...@@ -455,8 +447,6 @@ struct sym_shcb { ...@@ -455,8 +447,6 @@ struct sym_shcb {
* used as sub-field 's' of another structure. * used as sub-field 's' of another structure.
*/ */
typedef struct { typedef struct {
int bus;
u_char device_fn;
u_long base; u_long base;
u_long base_2; u_long base_2;
u_long base_c; u_long base_c;
...@@ -469,12 +459,11 @@ typedef struct { ...@@ -469,12 +459,11 @@ typedef struct {
} sym_slot; } sym_slot;
typedef struct sym_nvram sym_nvram; typedef struct sym_nvram sym_nvram;
typedef struct sym_pci_chip sym_chip;
typedef struct { typedef struct {
struct pci_dev *pdev; struct pci_dev *pdev;
sym_slot s; sym_slot s;
sym_chip chip; struct sym_pci_chip chip;
sym_nvram *nvram; sym_nvram *nvram;
u_short device_id; u_short device_id;
u_char host_id; u_char host_id;
...@@ -496,9 +485,7 @@ typedef u_long m_addr_t; /* Enough bits to represent any address */ ...@@ -496,9 +485,7 @@ typedef u_long m_addr_t; /* Enough bits to represent any address */
#ifdef MODULE #ifdef MODULE
#define SYM_MEM_FREE_UNUSED /* Free unused pages immediately */ #define SYM_MEM_FREE_UNUSED /* Free unused pages immediately */
#endif #endif
#ifdef SYM_LINUX_DYNAMIC_DMA_MAPPING
typedef struct pci_dev *m_pool_ident_t; typedef struct pci_dev *m_pool_ident_t;
#endif
/* /*
* Include driver soft definitions. * Include driver soft definitions.
...@@ -521,19 +508,7 @@ typedef struct pci_dev *m_pool_ident_t; ...@@ -521,19 +508,7 @@ typedef struct pci_dev *m_pool_ident_t;
void *sym_calloc(int size, char *name); void *sym_calloc(int size, char *name);
void sym_mfree(void *m, int size, char *name); void sym_mfree(void *m, int size, char *name);
#ifndef SYM_LINUX_DYNAMIC_DMA_MAPPING
/* /*
* Simple case.
* All the memory assummed DMAable and O/S providing virtual
* to bus physical address translation.
*/
#define __sym_calloc_dma(pool_id, size, name) sym_calloc(size, name)
#define __sym_mfree_dma(pool_id, m, size, name) sym_mfree(m, size, name)
#define __vtobus(b, p) virt_to_bus(p)
#else /* SYM_LINUX_DYNAMIC_DMA_MAPPING */
/*
* Complex case.
* We have to provide the driver memory allocator with methods for * We have to provide the driver memory allocator with methods for
* it to maintain virtual to bus physical address translations. * it to maintain virtual to bus physical address translations.
*/ */
...@@ -560,15 +535,12 @@ static __inline void sym_m_free_dma_mem_cluster(m_pool_p mp, m_vtob_p vbp) ...@@ -560,15 +535,12 @@ static __inline void sym_m_free_dma_mem_cluster(m_pool_p mp, m_vtob_p vbp)
} }
#define sym_m_create_dma_mem_tag(mp) (0) #define sym_m_create_dma_mem_tag(mp) (0)
#define sym_m_delete_dma_mem_tag(mp) do { ; } while (0) #define sym_m_delete_dma_mem_tag(mp) do { ; } while (0)
void *__sym_calloc_dma(m_pool_ident_t dev_dmat, int size, char *name); void *__sym_calloc_dma(m_pool_ident_t dev_dmat, int size, char *name);
void __sym_mfree_dma(m_pool_ident_t dev_dmat, void *m, int size, char *name); void __sym_mfree_dma(m_pool_ident_t dev_dmat, void *m, int size, char *name);
m_addr_t __vtobus(m_pool_ident_t dev_dmat, void *m); m_addr_t __vtobus(m_pool_ident_t dev_dmat, void *m);
#endif /* SYM_LINUX_DYNAMIC_DMA_MAPPING */
/* /*
* Set the status field of a CAM CCB. * Set the status field of a CAM CCB.
*/ */
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#define SYM_DRIVER_NAME "sym-2.1.16a" #define SYM_DRIVER_NAME "sym-2.1.17a"
#ifdef __FreeBSD__ #ifdef __FreeBSD__
#include <dev/sym/sym_glue.h> #include <dev/sym/sym_glue.h>
...@@ -289,7 +289,7 @@ int sym_reset_scsi_bus(hcb_p np, int enab_int) ...@@ -289,7 +289,7 @@ int sym_reset_scsi_bus(hcb_p np, int enab_int)
((INW(nc_sbdl) & 0xff00) << 10) | /* d15-8 */ ((INW(nc_sbdl) & 0xff00) << 10) | /* d15-8 */
INB(nc_sbcl); /* req ack bsy sel atn msg cd io */ INB(nc_sbcl); /* req ack bsy sel atn msg cd io */
if (!(np->features & FE_WIDE)) if (!np->maxwide)
term &= 0x3ffff; term &= 0x3ffff;
if (term != (2<<7)) { if (term != (2<<7)) {
...@@ -744,6 +744,12 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram) ...@@ -744,6 +744,12 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram)
u32 period; u32 period;
int i; int i;
#ifdef CONFIG_PARISC
unsigned long pdc_period;
char scsi_mode = -1;
struct hardware_path hwpath;
#endif
/* /*
* Wide ? * Wide ?
*/ */
...@@ -800,6 +806,31 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram) ...@@ -800,6 +806,31 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram)
* Btw, 'period' is in tenths of nanoseconds. * Btw, 'period' is in tenths of nanoseconds.
*/ */
period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz; period = (4 * div_10M[0] + np->clock_khz - 1) / np->clock_khz;
#if defined(CONFIG_PARISC)
/* Host firmware (PDC) keeps a table for crippling SCSI capabilities.
* Many newer machines export one channel of 53c896 chip
* as SE, 50-pin HD. Also used for Multi-initiator SCSI clusters
* to set the SCSI Initiator ID.
*/
get_pci_node_path(np->s.device, &hwpath);
if (pdc_get_initiator(&hwpath, &np->myaddr, &pdc_period, &np->maxwide, &scsi_mode))
{
if (scsi_mode >= 0) {
/* C3000 PDC reports period/mode */
SYM_SETUP_SCSI_DIFF = 0;
switch(scsi_mode) {
case 0: np->scsi_mode = SMODE_SE; break;
case 1: np->scsi_mode = SMODE_HVD; break;
case 2: np->scsi_mode = SMODE_LVD; break;
default: break;
}
}
period = (u32) pdc_period;
}
#endif
if (period <= 250) np->minsync = 10; if (period <= 250) np->minsync = 10;
else if (period <= 303) np->minsync = 11; else if (period <= 303) np->minsync = 11;
else if (period <= 500) np->minsync = 12; else if (period <= 500) np->minsync = 12;
...@@ -862,7 +893,7 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram) ...@@ -862,7 +893,7 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram)
* In dual channel mode, contention occurs if internal cycles * In dual channel mode, contention occurs if internal cycles
* are used. Disable internal cycles. * are used. Disable internal cycles.
*/ */
if (np->device_id == PCI_ID_LSI53C1010 && if (np->device_id == PCI_ID_LSI53C1010_33 &&
np->revision_id < 0x1) np->revision_id < 0x1)
np->rv_ccntl0 |= DILS; np->rv_ccntl0 |= DILS;
...@@ -1362,17 +1393,17 @@ static struct sym_pci_chip sym_pci_dev_table[] = { ...@@ -1362,17 +1393,17 @@ static struct sym_pci_chip sym_pci_dev_table[] = {
FE_WIDE|FE_ULTRA|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| FE_WIDE|FE_ULTRA|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|
FE_RAM|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_LCKFRQ} FE_RAM|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_LCKFRQ}
, ,
{PCI_ID_LSI53C1010, 0x00, "1010-33", 6, 31, 7, 8, {PCI_ID_LSI53C1010_33, 0x00, "1010-33", 6, 31, 7, 8,
FE_WIDE|FE_ULTRA3|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFBC|FE_LDSTR|FE_PFEN| FE_WIDE|FE_ULTRA3|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFBC|FE_LDSTR|FE_PFEN|
FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_CRC| FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_CRC|
FE_C10} FE_C10}
, ,
{PCI_ID_LSI53C1010, 0xff, "1010-33", 6, 31, 7, 8, {PCI_ID_LSI53C1010_33, 0xff, "1010-33", 6, 31, 7, 8,
FE_WIDE|FE_ULTRA3|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFBC|FE_LDSTR|FE_PFEN| FE_WIDE|FE_ULTRA3|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFBC|FE_LDSTR|FE_PFEN|
FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_CRC| FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_CRC|
FE_C10|FE_U3EN} FE_C10|FE_U3EN}
, ,
{PCI_ID_LSI53C1010_2, 0xff, "1010-66", 6, 31, 7, 8, {PCI_ID_LSI53C1010_66, 0xff, "1010-66", 6, 31, 7, 8,
FE_WIDE|FE_ULTRA3|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFBC|FE_LDSTR|FE_PFEN| FE_WIDE|FE_ULTRA3|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFBC|FE_LDSTR|FE_PFEN|
FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_66MHZ|FE_CRC| FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_66MHZ|FE_CRC|
FE_C10|FE_U3EN} FE_C10|FE_U3EN}
...@@ -1809,7 +1840,7 @@ void sym_start_up (hcb_p np, int reason) ...@@ -1809,7 +1840,7 @@ void sym_start_up (hcb_p np, int reason)
/* /*
* For now, disable AIP generation on C1010-66. * For now, disable AIP generation on C1010-66.
*/ */
if (np->device_id == PCI_ID_LSI53C1010_2) if (np->device_id == PCI_ID_LSI53C1010_66)
OUTB (nc_aipcntl1, DISAIP); OUTB (nc_aipcntl1, DISAIP);
/* /*
...@@ -1819,7 +1850,7 @@ void sym_start_up (hcb_p np, int reason) ...@@ -1819,7 +1850,7 @@ void sym_start_up (hcb_p np, int reason)
* that from SCRIPTS for each selection/reselection, but * that from SCRIPTS for each selection/reselection, but
* I just don't want. :) * I just don't want. :)
*/ */
if (np->device_id == PCI_ID_LSI53C1010 && if (np->device_id == PCI_ID_LSI53C1010_33 &&
np->revision_id < 1) np->revision_id < 1)
OUTB (nc_stest1, INB(nc_stest1) | 0x30); OUTB (nc_stest1, INB(nc_stest1) | 0x30);
......
...@@ -77,23 +77,8 @@ ...@@ -77,23 +77,8 @@
* should be enough). * should be enough).
*/ */
#if defined __i386__ #define __READ_BARRIER() rmb()
#define __READ_BARRIER() \ #define __WRITE_BARRIER() wmb()
__asm__ volatile("lock; addl $0,0(%%esp)": : :"memory")
#define __WRITE_BARRIER() __asm__ volatile ("": : :"memory")
#elif defined __powerpc__
#define __READ_BARRIER() __asm__ volatile("eieio; sync" : : : "memory")
#define __WRITE_BARRIER() __asm__ volatile("eieio; sync" : : : "memory")
#elif defined __ia64__
#define __READ_BARRIER() __asm__ volatile("mf.a; mf" : : : "memory")
#define __WRITE_BARRIER() __asm__ volatile("mf.a; mf" : : : "memory")
#elif defined __alpha__
#define __READ_BARRIER() __asm__ volatile("mb": : :"memory")
#define __WRITE_BARRIER() __asm__ volatile("mb": : :"memory")
#else
#define __READ_BARRIER() mb()
#define __WRITE_BARRIER() mb()
#endif
#ifndef MEMORY_READ_BARRIER #ifndef MEMORY_READ_BARRIER
#define MEMORY_READ_BARRIER() __READ_BARRIER() #define MEMORY_READ_BARRIER() __READ_BARRIER()
......
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