📄 sym53c8xx_defs.h
字号:
#elif defined __powerpc__#define MEMORY_BARRIER() __asm__ volatile("eieio; sync" : : : "memory")#elif defined __ia64__#define MEMORY_BARRIER() __asm__ volatile("mf.a; mf" : : : "memory")#else#define MEMORY_BARRIER() mb()#endif/* * If the NCR uses big endian addressing mode over the * PCI, actual io register addresses for byte and word * accesses must be changed according to lane routing. * Btw, ncr_offb() and ncr_offw() macros only apply to * constants and so donnot generate bloated code. */#if defined(SCSI_NCR_BIG_ENDIAN)#define ncr_offb(o) (((o)&~3)+((~((o)&3))&3))#define ncr_offw(o) (((o)&~3)+((~((o)&3))&2))#else#define ncr_offb(o) (o)#define ncr_offw(o) (o)#endif/* * If the CPU and the NCR use same endian-ness adressing, * no byte reordering is needed for script patching. * Macro cpu_to_scr() is to be used for script patching. * Macro scr_to_cpu() is to be used for getting a DWORD * from the script. */#if defined(__BIG_ENDIAN) && !defined(SCSI_NCR_BIG_ENDIAN)#define cpu_to_scr(dw) cpu_to_le32(dw)#define scr_to_cpu(dw) le32_to_cpu(dw)#elif defined(__LITTLE_ENDIAN) && defined(SCSI_NCR_BIG_ENDIAN)#define cpu_to_scr(dw) cpu_to_be32(dw)#define scr_to_cpu(dw) be32_to_cpu(dw)#else#define cpu_to_scr(dw) (dw)#define scr_to_cpu(dw) (dw)#endif/* * Access to the controller chip. * * If SCSI_NCR_IOMAPPED is defined, the driver will use * normal IOs instead of the MEMORY MAPPED IO method * recommended by PCI specifications. * If all PCI bridges, host brigdes and architectures * would have been correctly designed for PCI, this * option would be useless. * * If the CPU and the NCR use same endian-ness adressing, * no byte reordering is needed for accessing chip io * registers. Functions suffixed by '_raw' are assumed * to access the chip over the PCI without doing byte * reordering. Functions suffixed by '_l2b' are * assumed to perform little-endian to big-endian byte * reordering, those suffixed by '_b2l' blah, blah, * blah, ... */#if defined(SCSI_NCR_IOMAPPED)/* * IO mapped only input / ouput */#define INB_OFF(o) inb (np->base_io + ncr_offb(o))#define OUTB_OFF(o, val) outb ((val), np->base_io + ncr_offb(o))#if defined(__BIG_ENDIAN) && !defined(SCSI_NCR_BIG_ENDIAN)#define INW_OFF(o) inw_l2b (np->base_io + ncr_offw(o))#define INL_OFF(o) inl_l2b (np->base_io + (o))#define OUTW_OFF(o, val) outw_b2l ((val), np->base_io + ncr_offw(o))#define OUTL_OFF(o, val) outl_b2l ((val), np->base_io + (o))#elif defined(__LITTLE_ENDIAN) && defined(SCSI_NCR_BIG_ENDIAN)#define INW_OFF(o) inw_b2l (np->base_io + ncr_offw(o))#define INL_OFF(o) inl_b2l (np->base_io + (o))#define OUTW_OFF(o, val) outw_l2b ((val), np->base_io + ncr_offw(o))#define OUTL_OFF(o, val) outl_l2b ((val), np->base_io + (o))#else#define INW_OFF(o) inw_raw (np->base_io + ncr_offw(o))#define INL_OFF(o) inl_raw (np->base_io + (o))#define OUTW_OFF(o, val) outw_raw ((val), np->base_io + ncr_offw(o))#define OUTL_OFF(o, val) outl_raw ((val), np->base_io + (o))#endif /* ENDIANs */#else /* defined SCSI_NCR_IOMAPPED *//* * MEMORY mapped IO input / output */#define INB_OFF(o) readb_raw((char *)np->reg + ncr_offb(o))#define OUTB_OFF(o, val) writeb_raw((val), (char *)np->reg + ncr_offb(o))#if defined(__BIG_ENDIAN) && !defined(SCSI_NCR_BIG_ENDIAN)#define INW_OFF(o) readw_l2b((char *)np->reg + ncr_offw(o))#define INL_OFF(o) readl_l2b((char *)np->reg + (o))#define OUTW_OFF(o, val) writew_b2l((val), (char *)np->reg + ncr_offw(o))#define OUTL_OFF(o, val) writel_b2l((val), (char *)np->reg + (o))#elif defined(__LITTLE_ENDIAN) && defined(SCSI_NCR_BIG_ENDIAN)#define INW_OFF(o) readw_b2l((char *)np->reg + ncr_offw(o))#define INL_OFF(o) readl_b2l((char *)np->reg + (o))#define OUTW_OFF(o, val) writew_l2b((val), (char *)np->reg + ncr_offw(o))#define OUTL_OFF(o, val) writel_l2b((val), (char *)np->reg + (o))#else#define INW_OFF(o) readw_raw((char *)np->reg + ncr_offw(o))#define INL_OFF(o) readl_raw((char *)np->reg + (o))#define OUTW_OFF(o, val) writew_raw((val), (char *)np->reg + ncr_offw(o))#define OUTL_OFF(o, val) writel_raw((val), (char *)np->reg + (o))#endif#endif /* defined SCSI_NCR_IOMAPPED */#define INB(r) INB_OFF (offsetof(struct ncr_reg,r))#define INW(r) INW_OFF (offsetof(struct ncr_reg,r))#define INL(r) INL_OFF (offsetof(struct ncr_reg,r))#define OUTB(r, val) OUTB_OFF (offsetof(struct ncr_reg,r), (val))#define OUTW(r, val) OUTW_OFF (offsetof(struct ncr_reg,r), (val))#define OUTL(r, val) OUTL_OFF (offsetof(struct ncr_reg,r), (val))/* * Set bit field ON, OFF */#define OUTONB(r, m) OUTB(r, INB(r) | (m))#define OUTOFFB(r, m) OUTB(r, INB(r) & ~(m))#define OUTONW(r, m) OUTW(r, INW(r) | (m))#define OUTOFFW(r, m) OUTW(r, INW(r) & ~(m))#define OUTONL(r, m) OUTL(r, INL(r) | (m))#define OUTOFFL(r, m) OUTL(r, INL(r) & ~(m))/* * We normally want the chip to have a consistent view * of driver internal data structures when we restart it. * Thus these macros. */#define OUTL_DSP(v) \ do { \ MEMORY_BARRIER(); \ OUTL (nc_dsp, (v)); \ } while (0)#define OUTONB_STD() \ do { \ MEMORY_BARRIER(); \ OUTONB (nc_dcntl, (STD|NOCOM)); \ } while (0)/*** NCR53C8XX Device Ids*/#ifndef PCI_DEVICE_ID_NCR_53C810#define PCI_DEVICE_ID_NCR_53C810 1#endif#ifndef PCI_DEVICE_ID_NCR_53C810AP#define PCI_DEVICE_ID_NCR_53C810AP 5#endif#ifndef PCI_DEVICE_ID_NCR_53C815#define PCI_DEVICE_ID_NCR_53C815 4#endif#ifndef PCI_DEVICE_ID_NCR_53C820#define PCI_DEVICE_ID_NCR_53C820 2#endif#ifndef PCI_DEVICE_ID_NCR_53C825#define PCI_DEVICE_ID_NCR_53C825 3#endif#ifndef PCI_DEVICE_ID_NCR_53C860#define PCI_DEVICE_ID_NCR_53C860 6#endif#ifndef PCI_DEVICE_ID_NCR_53C875#define PCI_DEVICE_ID_NCR_53C875 0xf#endif#ifndef PCI_DEVICE_ID_NCR_53C875J#define PCI_DEVICE_ID_NCR_53C875J 0x8f#endif#ifndef PCI_DEVICE_ID_NCR_53C885#define PCI_DEVICE_ID_NCR_53C885 0xd#endif#ifndef PCI_DEVICE_ID_NCR_53C895#define PCI_DEVICE_ID_NCR_53C895 0xc#endif#ifndef PCI_DEVICE_ID_NCR_53C896#define PCI_DEVICE_ID_NCR_53C896 0xb#endif#ifndef PCI_DEVICE_ID_NCR_53C895A#define PCI_DEVICE_ID_NCR_53C895A 0x12#endif#ifndef PCI_DEVICE_ID_NCR_53C875A#define PCI_DEVICE_ID_NCR_53C875A 0x13#endif#ifndef PCI_DEVICE_ID_NCR_53C1510D#define PCI_DEVICE_ID_NCR_53C1510D 0xa#endif#ifndef PCI_DEVICE_ID_LSI_53C1010#define PCI_DEVICE_ID_LSI_53C1010 0x20#endif#ifndef PCI_DEVICE_ID_LSI_53C1010_66#define PCI_DEVICE_ID_LSI_53C1010_66 0x21#endif/*** NCR53C8XX devices features table.*/typedef struct { unsigned short device_id; unsigned short revision_id; char *name; unsigned char burst_max; /* log-base-2 of max burst */ unsigned char offset_max; unsigned char nr_divisor; unsigned int features;#define FE_LED0 (1<<0)#define FE_WIDE (1<<1) /* Wide data transfers */#define FE_ULTRA (1<<2) /* Ultra speed 20Mtrans/sec */#define FE_ULTRA2 (1<<3) /* Ultra 2 - 40 Mtrans/sec */#define FE_DBLR (1<<4) /* Clock doubler present */#define FE_QUAD (1<<5) /* Clock quadrupler present */#define FE_ERL (1<<6) /* Enable read line */#define FE_CLSE (1<<7) /* Cache line size enable */#define FE_WRIE (1<<8) /* Write & Invalidate enable */#define FE_ERMP (1<<9) /* Enable read multiple */#define FE_BOF (1<<10) /* Burst opcode fetch */#define FE_DFS (1<<11) /* DMA fifo size */#define FE_PFEN (1<<12) /* Prefetch enable */#define FE_LDSTR (1<<13) /* Load/Store supported */#define FE_RAM (1<<14) /* On chip RAM present */#define FE_VARCLK (1<<15) /* SCSI clock may vary */#define FE_RAM8K (1<<16) /* On chip RAM sized 8Kb */#define FE_64BIT (1<<17) /* Have a 64-bit PCI interface */#define FE_IO256 (1<<18) /* Requires full 256 bytes in PCI space */#define FE_NOPM (1<<19) /* Scripts handles phase mismatch */#define FE_LEDC (1<<20) /* Hardware control of LED */#define FE_DIFF (1<<21) /* Support Differential SCSI */#define FE_ULTRA3 (1<<22) /* Ultra-3 80Mtrans/sec */#define FE_66MHZ (1<<23) /* 66MHz PCI Support */#define FE_DAC (1<<24) /* Support DAC cycles (64 bit addressing) */#define FE_ISTAT1 (1<<25) /* Have ISTAT1, MBOX0, MBOX1 registers */#define FE_DAC_IN_USE (1<<26) /* Platform does DAC cycles */#define FE_CACHE_SET (FE_ERL|FE_CLSE|FE_WRIE|FE_ERMP)#define FE_SCSI_SET (FE_WIDE|FE_ULTRA|FE_ULTRA2|FE_DBLR|FE_QUAD|F_CLK80)#define FE_SPECIAL_SET (FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM)} ncr_chip;/*** DEL 397 - 53C875 Rev 3 - Part Number 609-0392410 - ITEM 3.** Memory Read transaction terminated by a retry followed by ** Memory Read Line command.*/#define FE_CACHE0_SET (FE_CACHE_SET & ~FE_ERL)/*** DEL 397 - 53C875 Rev 3 - Part Number 609-0392410 - ITEM 5.** On paper, this errata is harmless. But it is a good reason for ** using a shorter programmed burst length (64 DWORDS instead of 128).*/#define SCSI_NCR_CHIP_TABLE \{ \ {PCI_DEVICE_ID_NCR_53C810, 0x0f, "810", 4, 8, 4, \ FE_ERL} \ , \ {PCI_DEVICE_ID_NCR_53C810, 0xff, "810a", 4, 8, 4, \ FE_CACHE_SET|FE_LDSTR|FE_PFEN|FE_BOF} \ , \ {PCI_DEVICE_ID_NCR_53C815, 0xff, "815", 4, 8, 4, \ FE_ERL|FE_BOF} \ , \ {PCI_DEVICE_ID_NCR_53C820, 0xff, "820", 4, 8, 4, \ FE_WIDE|FE_ERL} \ , \ {PCI_DEVICE_ID_NCR_53C825, 0x0f, "825", 4, 8, 4, \ FE_WIDE|FE_ERL|FE_BOF|FE_DIFF} \ , \ {PCI_DEVICE_ID_NCR_53C825, 0xff, "825a", 6, 8, 4, \ FE_WIDE|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM|FE_DIFF} \ , \ {PCI_DEVICE_ID_NCR_53C860, 0xff, "860", 4, 8, 5, \ FE_ULTRA|FE_CACHE_SET|FE_BOF|FE_LDSTR|FE_PFEN} \ , \ {PCI_DEVICE_ID_NCR_53C875, 0x01, "875", 6, 16, 5, \ FE_WIDE|FE_ULTRA|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| \ FE_RAM|FE_DIFF|FE_VARCLK} \ , \ {PCI_DEVICE_ID_NCR_53C875, 0xff, "875", 6, 16, 5, \ FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| \ FE_RAM|FE_DIFF|FE_VARCLK} \ , \ {PCI_DEVICE_ID_NCR_53C875J,0xff, "875J", 6, 16, 5, \ FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| \ FE_RAM|FE_VARCLK} \ , \ {PCI_DEVICE_ID_NCR_53C885, 0xff, "885", 6, 16, 5, \ FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| \ FE_RAM|FE_DIFF|FE_VARCLK} \ , \ {PCI_DEVICE_ID_NCR_53C895, 0xff, "895", 6, 31, 7, \ FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| \ FE_RAM} \ , \ {PCI_DEVICE_ID_NCR_53C896, 0xff, "896", 6, 31, 7, \ FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| \ FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_ISTAT1} \ , \ {PCI_DEVICE_ID_NCR_53C895A, 0xff, "895a", 6, 31, 7, \ FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| \ FE_RAM|FE_RAM8K|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC} \ , \ {PCI_DEVICE_ID_NCR_53C875A, 0xff, "875a", 6, 31, 7, \ 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} \ , \ {PCI_DEVICE_ID_NCR_53C1510D, 0xff, "1510D", 7, 31, 7, \ FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN| \ FE_RAM|FE_IO256} \ , \ {PCI_DEVICE_ID_LSI_53C1010, 0xff, "1010-33", 6, 62, 7, \ FE_WIDE|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_ISTAT1| \ FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_ULTRA3} \ , \ {PCI_DEVICE_ID_LSI_53C1010_66, 0xff, "1010-66", 6, 62, 7, \ FE_WIDE|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_ISTAT1| \ FE_RAM|FE_RAM8K|FE_64BIT|FE_DAC|FE_IO256|FE_NOPM|FE_LEDC|FE_ULTRA3| \ FE_66MHZ} \}/* * List of supported NCR chip ids */#define SCSI_NCR_CHIP_IDS \{ \ PCI_DEVICE_ID_NCR_53C810, \ PCI_DEVICE_ID_NCR_53C815, \ PCI_DEVICE_ID_NCR_53C820, \ PCI_DEVICE_ID_NCR_53C825, \ PCI_DEVICE_ID_NCR_53C860, \ PCI_DEVICE_ID_NCR_53C875, \ PCI_DEVICE_ID_NCR_53C875J, \ PCI_DEVICE_ID_NCR_53C885, \ PCI_DEVICE_ID_NCR_53C895, \ PCI_DEVICE_ID_NCR_53C896, \ PCI_DEVICE_ID_NCR_53C895A, \ PCI_DEVICE_ID_NCR_53C1510D, \ PCI_DEVICE_ID_LSI_53C1010, \ PCI_DEVICE_ID_LSI_53C1010_66 \}/*** Driver setup structure.**** This structure is initialized from linux config options.** It can be overridden at boot-up by the boot command line.*/#define SCSI_NCR_MAX_EXCLUDES 8struct ncr_driver_setup { u_char master_parity; u_char scsi_parity; u_char disconnection; u_char special_features; u_char force_sync_nego; u_char reverse_probe; u_char pci_fix_up; u_char use_nvram; u_char verbose; u_char default_tags; u_short default_sync; u_short debug; u_char burst_max; u_char led_pin; u_char max_wide; u_char settle_delay; u_char diff_support; u_char irqm; u_char bus_check; u_char optimize; u_char recovery; u_char host_id; u_short iarb; u_long excludes[SCSI_NCR_MAX_EXCLUDES]; char tag_ctrl[100];};/*** Initial setup.** Can be overriden at startup by a command line.*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -