Commit e35b6d40 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Anton Blanchard

[PATCH] sym53c8xx driver 2.1.18

Yes, there's a lot of changes here.  I've been busy :-P

 - Delete linux/version.h include as it's not necessary
 - Delete compatibility with ncr53c8xx configuration options
 - Convert to C99 initialisers
 - Delete the options: pci_parity, scsi_parity, min_sync, max_wide,
   max_offs, max_lun and pci_fix_up.  Some were unused, some are now
   unused.
 - Delete all the default settings from sym_conf.h that were unused.
 - Delete host_lock abstractions.
 - Replace custom jiffy handling with standard ones.
 - Replace u_long with unsigned long
 - Inline scsi_data_direction()
 - Use ioremap directly instead of indirecting through pci_map_mem.
 - Delete typedefs: bus_addr_t, ucmd_p, vm_offset_t, stcb_p,
   slcb_p, sccb_p, shcb_p, sym_device and sym_slot.
 - Use min() instead of MIN()
 - Use memcpy() instead of bcopy().
 - Delete code dependent on SYM_CONF_PCIQ_BROKEN_INTR as it's never defined.
 - Simplify the locking in sym_eh_handler().
 - Make the eh handlers static.
 - Use ctype.h instead of custom variants.
 - Use SYM_CONF_IOMAPPED and SYM_OPT_NO_BUS_MEMORY_MAPPING in a more
   consistent manner.
 - Remove check_region() and use pci_request_region instead.
 - Mark sym_detach() as __devexit.
 - Move many includes from sym_glue.h to sym_glue.c
 - Stop using Scsi_Cmnd.
 - Stop using ../hosts.h.
 - Simplify *_raw definitions.
 - Move PA-RISC specific code into its own function.
parent abe68253
...@@ -53,37 +53,8 @@ ...@@ -53,37 +53,8 @@
#ifndef SYM53C8XX_H #ifndef SYM53C8XX_H
#define SYM53C8XX_H #define SYM53C8XX_H
#if !defined(LINUX_VERSION_CODE)
#include <linux/version.h>
#endif
#include <linux/config.h> #include <linux/config.h>
/*
* Compatibility with ncr53c8xx and sym53c8xx configuration options.
*/
#ifndef CONFIG_SCSI_SYM53C8XX_IOMAPPED
#ifdef CONFIG_SCSI_NCR53C8XX_IOMAPPED
#define CONFIG_SCSI_SYM53C8XX_IOMAPPED CONFIG_SCSI_NCR53C8XX_IOMAPPED
#endif
#endif
#ifndef CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS
#ifdef CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS
#define CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS
#endif
#endif
#ifndef CONFIG_SCSI_SYM53C8XX_MAX_TAGS
#ifdef CONFIG_SCSI_NCR53C8XX_MAX_TAGS
#define CONFIG_SCSI_SYM53C8XX_MAX_TAGS CONFIG_SCSI_NCR53C8XX_MAX_TAGS
#endif
#endif
/*
* Translate kernel configuration parameters
* into corresponding driver parameters.
*/
/* /*
* Use normal IO if configured. * Use normal IO if configured.
* Normal IO forced for alpha. * Normal IO forced for alpha.
...@@ -108,9 +79,7 @@ ...@@ -108,9 +79,7 @@
* 2 : 64 bit addressing when supported by chip, * 2 : 64 bit addressing when supported by chip,
* limited to 16 segments of 4 GB -> 64 GB max. * limited to 16 segments of 4 GB -> 64 GB max.
*/ */
#ifdef CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
#define SYM_CONF_DMA_ADDRESSING_MODE CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE #define SYM_CONF_DMA_ADDRESSING_MODE CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
#endif
/* /*
* NCR PQS/PDS special device support. * NCR PQS/PDS special device support.
...@@ -174,27 +143,11 @@ ...@@ -174,27 +143,11 @@
#define SYM_CONF_MAX_TAG_ORDER (8) #define SYM_CONF_MAX_TAG_ORDER (8)
#endif #endif
/*
* Sync transfer frequency at startup.
* Allow up to ULTRA-160. The driver will scale the value
* according to controller capabilities.
*/
#define CONFIG_SCSI_SYM53C8XX_DEFAULT_SYNC (9)
/* /*
* Max number of SG entries. * Max number of SG entries.
*/ */
#define SYM_CONF_MAX_SG (96) #define SYM_CONF_MAX_SG (96)
/*
* Max number of LUNs per target.
*/
#if 1 /* defined CONFIG_SCSI_MULTI_LUN */
#define CONFIG_SCSI_SYM53C8XX_MAX_LUN (16)
#else
#define CONFIG_SCSI_SYM53C8XX_MAX_LUN (1)
#endif
/* /*
* Driver setup structure. * Driver setup structure.
* *
...@@ -202,20 +155,13 @@ ...@@ -202,20 +155,13 @@
* It can be overridden at boot-up by the boot command line. * It can be overridden at boot-up by the boot command line.
*/ */
struct sym_driver_setup { struct sym_driver_setup {
u_char pci_parity;
u_char scsi_parity;
u_short max_tag; u_short max_tag;
u_char min_sync;
u_char burst_order; u_char burst_order;
u_char scsi_led; u_char scsi_led;
u_char max_wide;
u_char scsi_diff; u_char scsi_diff;
u_char irq_mode; u_char irq_mode;
u_char scsi_bus_check; u_char scsi_bus_check;
u_char host_id; u_char host_id;
u_char max_offs;
u_char max_lun;
u_char pci_fix_up;
u_char reverse_probe; u_char reverse_probe;
u_char verbose; u_char verbose;
...@@ -226,47 +172,36 @@ struct sym_driver_setup { ...@@ -226,47 +172,36 @@ struct sym_driver_setup {
char tag_ctrl[100]; char tag_ctrl[100];
}; };
#define SYM_SETUP_PCI_PARITY sym_driver_setup.pci_parity
#define SYM_SETUP_SCSI_PARITY sym_driver_setup.scsi_parity
#define SYM_SETUP_MAX_TAG sym_driver_setup.max_tag #define SYM_SETUP_MAX_TAG sym_driver_setup.max_tag
#define SYM_SETUP_MIN_SYNC sym_driver_setup.min_sync
#define SYM_SETUP_BURST_ORDER sym_driver_setup.burst_order #define SYM_SETUP_BURST_ORDER sym_driver_setup.burst_order
#define SYM_SETUP_SCSI_LED sym_driver_setup.scsi_led #define SYM_SETUP_SCSI_LED sym_driver_setup.scsi_led
#define SYM_SETUP_MAX_WIDE sym_driver_setup.max_wide
#define SYM_SETUP_SCSI_DIFF sym_driver_setup.scsi_diff #define SYM_SETUP_SCSI_DIFF sym_driver_setup.scsi_diff
#define SYM_SETUP_IRQ_MODE sym_driver_setup.irq_mode #define SYM_SETUP_IRQ_MODE sym_driver_setup.irq_mode
#define SYM_SETUP_SCSI_BUS_CHECK sym_driver_setup.scsi_bus_check #define SYM_SETUP_SCSI_BUS_CHECK sym_driver_setup.scsi_bus_check
#define SYM_SETUP_HOST_ID sym_driver_setup.host_id #define SYM_SETUP_HOST_ID sym_driver_setup.host_id
#define SYM_SETUP_MAX_OFFS sym_driver_setup.max_offs
#define SYM_SETUP_MAX_LUN sym_driver_setup.max_lun /* Always enable parity. */
#define SYM_SETUP_PCI_FIX_UP sym_driver_setup.pci_fix_up #define SYM_SETUP_PCI_PARITY 1
#define SYM_SETUP_SCSI_PARITY 1
/* /*
* Initial setup. * Initial setup.
* *
* Can be overriden at startup by a command line. * Can be overriden at startup by a command line.
*/ */
#define SYM_LINUX_DRIVER_SETUP \ #define SYM_LINUX_DRIVER_SETUP { \
{ \ .max_tag = CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS, \
1, /* pci_parity */ \ .burst_order = 7, \
1, /* scsi_parity */ \ .scsi_led = 1, \
CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS, \ .scsi_diff = 1, \
CONFIG_SCSI_SYM53C8XX_DEFAULT_SYNC, \ .irq_mode = 0, \
7, /* burst_order */ \ .scsi_bus_check = 1, \
1, /* scsi_led */ \ .host_id = 7, \
1, /* max_wide */ \ .reverse_probe = 0, \
1, /* scsi_diff */ \ .verbose = 0, \
0, /* irq_mode */ \ .debug = 0, \
1, /* scsi_bus_check */ \ .settle_delay = 3, \
7, /* host_id */ \ .use_nvram = 1, \
62, /* max_offs */ \
CONFIG_SCSI_SYM53C8XX_MAX_LUN, \
3, /* pci_fix_up */ \
0, /* reverse_probe */ \
0, /* verbose */ \
0, /* debug */ \
3, /* settle_delay */ \
1, /* use_nvram */ \
} }
/* /*
...@@ -275,27 +210,19 @@ struct sym_driver_setup { ...@@ -275,27 +210,19 @@ struct sym_driver_setup {
* Override initial setup from boot command line: * Override initial setup from boot command line:
* sym53c8xx=safe:y * sym53c8xx=safe:y
*/ */
#define SYM_LINUX_DRIVER_SAFE_SETUP \ #define SYM_LINUX_DRIVER_SAFE_SETUP { \
{ \ .max_tag = 0, \
0, /* pci_parity */ \ .burst_order = 0, \
0, /* scsi_parity */ \ .scsi_led = 0, \
0, /* max_tag */ \ .scsi_diff = 1, \
50, /* min_sync */ \ .irq_mode = 0, \
0, /* burst_order */ \ .scsi_bus_check = 2, \
0, /* scsi_led */ \ .host_id = 7, \
1, /* max_wide */ \ .reverse_probe = 0, \
1, /* scsi_diff */ \ .verbose = 2, \
0, /* irq_mode */ \ .debug = 0, \
2, /* scsi_bus_check */ \ .settle_delay = 10, \
7, /* host_id */ \ .use_nvram = 1, \
15, /* max_offs */ \
1, /* max_lun */ \
0, /* pci_fix_up */ \
0, /* reverse_probe */ \
2, /* verbose */ \
0, /* debug */ \
10, /* settle_delay */ \
1, /* use_nvram */ \
} }
/* /*
......
...@@ -53,39 +53,7 @@ ...@@ -53,39 +53,7 @@
#ifndef SYM_CONF_H #ifndef SYM_CONF_H
#define SYM_CONF_H #define SYM_CONF_H
/*------------------------------------------------------------------- #include "sym53c8xx.h"
* Static configuration.
*-------------------------------------------------------------------
*/
/*
* Also support early NCR 810, 815 and 825 chips.
*/
#ifndef SYM_CONF_GENERIC_SUPPORT
#define SYM_CONF_GENERIC_SUPPORT (1)
#endif
/*
* Use Normal IO instead of MMIO.
*/
/* #define SYM_CONF_IOMAPPED */
/*
* Max tags for a device (logical unit)
* We use a power of 2, (7) means 2<<7=128
* Maximum is 8 -> 256 tags
*/
#ifndef SYM_CONF_MAX_TAG_ORDER
#define SYM_CONF_MAX_TAG_ORDER (6)
#endif
/*
* Max number of scatter/gather entries for en IO.
* Each entry costs 8 bytes in the internal CCB data structure.
*/
#ifndef SYM_CONF_MAX_SG
#define SYM_CONF_MAX_SG (33)
#endif
/* /*
* Max number of targets. * Max number of targets.
...@@ -117,13 +85,6 @@ ...@@ -117,13 +85,6 @@
*/ */
/* #define SYM_CONF_MAX_START (PAGE_SIZE/8 - 16) */ /* #define SYM_CONF_MAX_START (PAGE_SIZE/8 - 16) */
/*
* Support for NVRAM.
*/
#ifndef SYM_CONF_NVRAM_SUPPORT
#define SYM_CONF_NVRAM_SUPPORT (1)
#endif
/* /*
* Support for Immediate Arbitration. * Support for Immediate Arbitration.
* Not advised. * Not advised.
...@@ -138,148 +99,6 @@ ...@@ -138,148 +99,6 @@
#define SYM_CONF_TIMEOUT_ORDER_MAX (8) #define SYM_CONF_TIMEOUT_ORDER_MAX (8)
#endif #endif
/*
* How the driver handles DMA addressing of user data.
* 0 : 32 bit addressing
* 1 : 40 bit addressing
* 2 : 64 bit addressing using segment registers
*/
#ifndef SYM_CONF_DMA_ADDRESSING_MODE
#define SYM_CONF_DMA_ADDRESSING_MODE (0)
#endif
/*-------------------------------------------------------------------
* Configuration that could be dynamic if it was possible
* to pass arguments to the driver.
*-------------------------------------------------------------------
*/
/*
* HOST default scsi id.
*/
#ifndef SYM_SETUP_HOST_ID
#define SYM_SETUP_HOST_ID 7
#endif
/*
* Max synchronous transfers.
*/
#ifndef SYM_SETUP_MIN_SYNC
#define SYM_SETUP_MIN_SYNC (9)
#endif
/*
* Max wide order.
*/
#ifndef SYM_SETUP_MAX_WIDE
#define SYM_SETUP_MAX_WIDE (1)
#endif
/*
* Max SCSI offset.
*/
#ifndef SYM_SETUP_MAX_OFFS
#define SYM_SETUP_MAX_OFFS (63)
#endif
/*
* Default number of tags.
*/
#ifndef SYM_SETUP_MAX_TAG
#define SYM_SETUP_MAX_TAG (1<<SYM_CONF_MAX_TAG_ORDER)
#endif
/*
* SYMBIOS NVRAM format support.
*/
#ifndef SYM_SETUP_SYMBIOS_NVRAM
#define SYM_SETUP_SYMBIOS_NVRAM (1)
#endif
/*
* TEKRAM NVRAM format support.
*/
#ifndef SYM_SETUP_TEKRAM_NVRAM
#define SYM_SETUP_TEKRAM_NVRAM (1)
#endif
/*
* PCI parity checking.
* It should not be an option, but some poor or broken
* PCI-HOST bridges have been reported to make problems
* when this feature is enabled.
* Setting this option to 0 tells the driver not to
* enable the checking against PCI parity.
*/
#ifndef SYM_SETUP_PCI_PARITY
#define SYM_SETUP_PCI_PARITY (2)
#endif
/*
* SCSI parity checking.
*/
#ifndef SYM_SETUP_SCSI_PARITY
#define SYM_SETUP_SCSI_PARITY (1)
#endif
/*
* SCSI activity LED.
*/
#ifndef SYM_SETUP_SCSI_LED
#define SYM_SETUP_SCSI_LED (0)
#endif
/*
* SCSI High Voltage Differential support.
*
* HVD/LVD/SE capable controllers (895, 895A, 896, 1010)
* report the actual SCSI BUS mode from the STEST4 IO
* register.
*
* But for HVD/SE only capable chips (825a, 875, 885),
* the driver uses some heuristic to probe against HVD.
* Normally, the chip senses the DIFFSENS signal and
* should switch its BUS transceivers to high impedance
* in situation of the driver having been wrong about
* the actual BUS mode. May-be, the BUS mode probing of
* the driver is safe, but, given that it may be partially
* based on some previous IO register settings, it
* cannot be stated so. Thus, decision has been taken
* to require a user option to be set for the DIFF probing
* to be applied for the 825a, 875 and 885 chips.
*
* This setup option works as follows:
*
* 0 -> HVD only supported for 895, 895A, 896, 1010.
* 1 -> HVD probed for 825A, 875, 885.
* 2 -> HVD assumed for 825A, 875, 885 (not advised).
*/
#ifndef SYM_SETUP_SCSI_DIFF
#define SYM_SETUP_SCSI_DIFF (0)
#endif
/*
* IRQ mode.
*/
#ifndef SYM_SETUP_IRQ_MODE
#define SYM_SETUP_IRQ_MODE (0)
#endif
/*
* Check SCSI BUS signal on reset.
*/
#ifndef SYM_SETUP_SCSI_BUS_CHECK
#define SYM_SETUP_SCSI_BUS_CHECK (1)
#endif
/*
* Max burst for PCI (1<<value)
* 7 means: (1<<7) = 128 DWORDS.
*/
#ifndef SYM_SETUP_BURST_ORDER
#define SYM_SETUP_BURST_ORDER (7)
#endif
/* /*
* Only relevant if IARB support configured. * Only relevant if IARB support configured.
* - Max number of successive settings of IARB hints. * - Max number of successive settings of IARB hints.
...@@ -309,16 +128,4 @@ ...@@ -309,16 +128,4 @@
#define SYM_SETUP_MAX_LUN (8) #define SYM_SETUP_MAX_LUN (8)
#endif #endif
/*
* Bits indicating what kind of fix-ups we want.
*
* Bit 0 (1) : cache line size configuration register.
* Bit 1 (2) : MWI bit in command register.
* Bit 2 (4) : latency timer if seems too low.
*/
#ifndef SYM_SETUP_PCI_FIX_UP
#define SYM_SETUP_PCI_FIX_UP (3)
#endif
#endif /* SYM_CONF_H */ #endif /* SYM_CONF_H */
This diff is collapsed.
...@@ -53,40 +53,22 @@ ...@@ -53,40 +53,22 @@
#ifndef SYM_GLUE_H #ifndef SYM_GLUE_H
#define SYM_GLUE_H #define SYM_GLUE_H
#if 0 #include <linux/config.h>
#define SYM_CONF_DMA_ADDRESSING_MODE 2
#endif
#include <asm/dma.h>
#include <asm/io.h>
#include <asm/system.h>
#include <linux/spinlock.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/signal.h> #include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/mm.h>
#include <linux/ioport.h>
#include <linux/time.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/stat.h> #include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/blkdev.h>
#include <asm/io.h>
#ifdef __sparc__ #ifdef __sparc__
# include <asm/irq.h> # include <asm/irq.h>
#endif #endif
#include <linux/init.h>
#include "../scsi.h"
#include "../hosts.h"
#include <linux/types.h>
typedef u_long vm_offset_t; #include <scsi/scsi_cmnd.h>
#include <scsi/scsi_host.h>
#include "../scsi.h" /* XXX: DID_* */
#ifndef bcopy #ifndef bcopy
#define bcopy(s, d, n) memcpy((d), (s), (n)) #define bcopy(s, d, n) memcpy((d), (s), (n))
...@@ -103,7 +85,6 @@ typedef u_long vm_offset_t; ...@@ -103,7 +85,6 @@ typedef u_long vm_offset_t;
/* /*
* General driver includes. * General driver includes.
*/ */
#include "sym53c8xx.h"
#include "sym_misc.h" #include "sym_misc.h"
#include "sym_conf.h" #include "sym_conf.h"
#include "sym_defs.h" #include "sym_defs.h"
...@@ -147,16 +128,12 @@ typedef struct sym_tcb *tcb_p; ...@@ -147,16 +128,12 @@ typedef struct sym_tcb *tcb_p;
typedef struct sym_lcb *lcb_p; typedef struct sym_lcb *lcb_p;
typedef struct sym_ccb *ccb_p; typedef struct sym_ccb *ccb_p;
typedef struct sym_hcb *hcb_p; typedef struct sym_hcb *hcb_p;
typedef struct sym_stcb *stcb_p;
typedef struct sym_slcb *slcb_p;
typedef struct sym_sccb *sccb_p;
typedef struct sym_shcb *shcb_p;
/* /*
* Define a reference to the O/S dependent IO request. * Define a reference to the O/S dependent IO request.
*/ */
typedef Scsi_Cmnd *cam_ccb_p; /* Generic */ typedef struct scsi_cmnd *cam_ccb_p; /* Generic */
typedef Scsi_Cmnd *cam_scsiio_p;/* SCSI I/O */ typedef struct scsi_cmnd *cam_scsiio_p;/* SCSI I/O */
/* /*
...@@ -177,30 +154,17 @@ typedef Scsi_Cmnd *cam_scsiio_p;/* SCSI I/O */ ...@@ -177,30 +154,17 @@ typedef Scsi_Cmnd *cam_scsiio_p;/* SCSI I/O */
#else /* little endian */ #else /* little endian */
#if defined(__i386__) /* i386 implements full FLAT memory/MMIO model */
#define inw_raw inw
#define inl_raw inl
#define outw_raw outw
#define outl_raw outl
#define readb_raw(a) (*(volatile unsigned char *) (a))
#define readw_raw(a) (*(volatile unsigned short *) (a))
#define readl_raw(a) (*(volatile unsigned int *) (a))
#define writeb_raw(b,a) ((*(volatile unsigned char *) (a)) = (b))
#define writew_raw(b,a) ((*(volatile unsigned short *) (a)) = (b))
#define writel_raw(b,a) ((*(volatile unsigned int *) (a)) = (b))
#else /* Other little-endian */
#define inw_raw inw #define inw_raw inw
#define inl_raw inl #define inl_raw inl
#define outw_raw outw #define outw_raw outw
#define outl_raw outl #define outl_raw outl
#define readw_raw readw #define readw_raw readw
#define readl_raw readl #define readl_raw readl
#define writew_raw writew #define writew_raw writew
#define writel_raw writel #define writel_raw writel
#endif #endif /* endian */
#endif
#ifdef SYM_CONF_CHIP_BIG_ENDIAN #ifdef SYM_CONF_CHIP_BIG_ENDIAN
#error "Chips in BIG ENDIAN addressing mode are not (yet) supported" #error "Chips in BIG ENDIAN addressing mode are not (yet) supported"
...@@ -421,8 +385,8 @@ struct sym_shcb { ...@@ -421,8 +385,8 @@ struct sym_shcb {
struct Scsi_Host *host; struct Scsi_Host *host;
vm_offset_t mmio_va; /* MMIO kernel virtual address */ void * mmio_va; /* MMIO kernel virtual address */
vm_offset_t ram_va; /* RAM kernel virtual address */ void * ram_va; /* RAM kernel virtual address */
u_long io_port; /* IO port address cookie */ u_long io_port; /* IO port address cookie */
u_short io_ws; /* IO window size */ u_short io_ws; /* IO window size */
int irq; /* IRQ number */ int irq; /* IRQ number */
...@@ -446,7 +410,7 @@ struct sym_shcb { ...@@ -446,7 +410,7 @@ struct sym_shcb {
* Must resolve the IO macros and sym_name(), when * Must resolve the IO macros and sym_name(), when
* used as sub-field 's' of another structure. * used as sub-field 's' of another structure.
*/ */
typedef struct { struct sym_slot {
u_long base; u_long base;
u_long base_2; u_long base_2;
u_long base_c; u_long base_c;
...@@ -454,26 +418,23 @@ typedef struct { ...@@ -454,26 +418,23 @@ typedef struct {
int irq; int irq;
/* port and address fields to fit INB, OUTB macros */ /* port and address fields to fit INB, OUTB macros */
u_long io_port; u_long io_port;
vm_offset_t mmio_va; void * mmio_va;
char inst_name[16]; char inst_name[16];
} sym_slot; };
typedef struct sym_nvram sym_nvram;
typedef struct { struct sym_device {
struct pci_dev *pdev; struct pci_dev *pdev;
sym_slot s; struct sym_slot s;
struct sym_pci_chip chip; struct sym_pci_chip chip;
sym_nvram *nvram; struct sym_nvram *nvram;
u_short device_id; u_short device_id;
u_char host_id; u_char host_id;
#ifdef SYM_CONF_PQS_PDS_SUPPORT #ifdef SYM_CONF_PQS_PDS_SUPPORT
u_char pqs_pds; u_char pqs_pds;
#endif #endif
int attach_done; };
} sym_device;
typedef sym_device *sdev_p; typedef struct sym_device *sdev_p;
/* /*
* The driver definitions (sym_hipd.h) must know about a * The driver definitions (sym_hipd.h) must know about a
...@@ -545,7 +506,7 @@ m_addr_t __vtobus(m_pool_ident_t dev_dmat, void *m); ...@@ -545,7 +506,7 @@ m_addr_t __vtobus(m_pool_ident_t dev_dmat, void *m);
* Set the status field of a CAM CCB. * Set the status field of a CAM CCB.
*/ */
static __inline void static __inline void
sym_set_cam_status(Scsi_Cmnd *ccb, int status) sym_set_cam_status(struct scsi_cmnd *ccb, int status)
{ {
ccb->result &= ~(0xff << 16); ccb->result &= ~(0xff << 16);
ccb->result |= (status << 16); ccb->result |= (status << 16);
...@@ -555,7 +516,7 @@ sym_set_cam_status(Scsi_Cmnd *ccb, int status) ...@@ -555,7 +516,7 @@ sym_set_cam_status(Scsi_Cmnd *ccb, int status)
* Get the status field of a CAM CCB. * Get the status field of a CAM CCB.
*/ */
static __inline int static __inline int
sym_get_cam_status(Scsi_Cmnd *ccb) sym_get_cam_status(struct scsi_cmnd *ccb)
{ {
return ((ccb->result >> 16) & 0xff); return ((ccb->result >> 16) & 0xff);
} }
...@@ -584,7 +545,7 @@ void sym_xpt_async_nego_wide(hcb_p np, int target); ...@@ -584,7 +545,7 @@ void sym_xpt_async_nego_wide(hcb_p np, int target);
*/ */
static __inline void sym_set_cam_result_ok(hcb_p np, ccb_p cp, int resid) static __inline void sym_set_cam_result_ok(hcb_p np, ccb_p cp, int resid)
{ {
Scsi_Cmnd *cmd = cp->cam_ccb; struct scsi_cmnd *cmd = cp->cam_ccb;
cmd->resid = resid; cmd->resid = resid;
cmd->result = (((DID_OK) << 16) + ((cp->ssss_status) & 0x7f)); cmd->result = (((DID_OK) << 16) + ((cp->ssss_status) & 0x7f));
...@@ -604,8 +565,6 @@ void sym_xpt_async_bus_reset(hcb_p np); ...@@ -604,8 +565,6 @@ void sym_xpt_async_bus_reset(hcb_p np);
void sym_xpt_async_sent_bdr(hcb_p np, int target); void sym_xpt_async_sent_bdr(hcb_p np, int target);
int sym_setup_data_and_start (hcb_p np, cam_scsiio_p csio, ccb_p cp); int sym_setup_data_and_start (hcb_p np, cam_scsiio_p csio, ccb_p cp);
void sym_log_bus_error(hcb_p np); void sym_log_bus_error(hcb_p np);
#ifdef SYM_OPT_SNIFF_INQUIRY void sym_sniff_inquiry(hcb_p np, struct scsi_cmnd *cmd, int resid);
void sym_sniff_inquiry(hcb_p np, Scsi_Cmnd *cmd, int resid);
#endif
#endif /* SYM_GLUE_H */ #endif /* SYM_GLUE_H */
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#define SYM_DRIVER_NAME "sym-2.1.17a" #define SYM_DRIVER_NAME "sym-2.1.18"
#ifdef __FreeBSD__ #ifdef __FreeBSD__
#include <dev/sym/sym_glue.h> #include <dev/sym/sym_glue.h>
...@@ -734,6 +734,41 @@ static void sym_save_initial_setting (hcb_p np) ...@@ -734,6 +734,41 @@ static void sym_save_initial_setting (hcb_p np)
np->sv_ctest5 = INB(nc_ctest5) & 0x24; np->sv_ctest5 = INB(nc_ctest5) & 0x24;
} }
#ifdef CONFIG_PARISC
static u32 parisc_setup_hcb(hcb_p np, u32 period)
{
unsigned long pdc_period;
char scsi_mode;
struct hardware_path hwpath;
/* 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))
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;
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;
}
}
return (u32) pdc_period;
}
#else
static inline int parisc_setup_hcb(hcb_p np, u32 period) { return period; }
#endif
/* /*
* Prepare io register values used by sym_start_up() * Prepare io register values used by sym_start_up()
* according to selected and supported features. * according to selected and supported features.
...@@ -744,12 +779,6 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram) ...@@ -744,12 +779,6 @@ 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 ?
*/ */
...@@ -807,29 +836,7 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram) ...@@ -807,29 +836,7 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram)
*/ */
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) period = parisc_setup_hcb(np, period);
/* 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;
......
...@@ -129,12 +129,6 @@ ...@@ -129,12 +129,6 @@
/* /*
* These ones should have been already defined. * These ones should have been already defined.
*/ */
#ifndef offsetof
#define offsetof(t, m) ((size_t) (&((t *)0)->m))
#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef assert #ifndef assert
#define assert(expression) { \ #define assert(expression) { \
if (!(expression)) { \ if (!(expression)) { \
......
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