|
|
1.1 ! root 1: /****************************************************************************** ! 2: ** Device driver for the PCI-SCSI NCR538XX controller family. ! 3: ** ! 4: ** Copyright (C) 1994 Wolfgang Stanglmeier ! 5: ** ! 6: ** This program is free software; you can redistribute it and/or modify ! 7: ** it under the terms of the GNU General Public License as published by ! 8: ** the Free Software Foundation; either version 2 of the License, or ! 9: ** (at your option) any later version. ! 10: ** ! 11: ** This program is distributed in the hope that it will be useful, ! 12: ** but WITHOUT ANY WARRANTY; without even the implied warranty of ! 13: ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 14: ** GNU General Public License for more details. ! 15: ** ! 16: ** You should have received a copy of the GNU General Public License ! 17: ** along with this program; if not, write to the Free Software ! 18: ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! 19: ** ! 20: **----------------------------------------------------------------------------- ! 21: ** ! 22: ** This driver has been ported to Linux from the FreeBSD NCR53C8XX driver ! 23: ** and is currently maintained by ! 24: ** ! 25: ** Gerard Roudier <[email protected]> ! 26: ** ! 27: ** Being given that this driver originates from the FreeBSD version, and ! 28: ** in order to keep synergy on both, any suggested enhancements and corrections ! 29: ** received on Linux are automatically a potential candidate for the FreeBSD ! 30: ** version. ! 31: ** ! 32: ** The original driver has been written for 386bsd and FreeBSD by ! 33: ** Wolfgang Stanglmeier <[email protected]> ! 34: ** Stefan Esser <[email protected]> ! 35: ** ! 36: ** And has been ported to NetBSD by ! 37: ** Charles M. Hannum <[email protected]> ! 38: ** ! 39: ******************************************************************************* ! 40: */ ! 41: ! 42: #ifndef NCR53C8XX_H ! 43: #define NCR53C8XX_H ! 44: ! 45: /* ! 46: ** Name and revision of the driver ! 47: */ ! 48: #define SCSI_NCR_DRIVER_NAME "ncr53c8xx - revision 2.5f.1" ! 49: ! 50: /* ! 51: ** Check supported Linux versions ! 52: */ ! 53: ! 54: #if !defined(LINUX_VERSION_CODE) ! 55: #include <linux/version.h> ! 56: #endif ! 57: #include <linux/config.h> ! 58: ! 59: /* ! 60: ** During make dep of linux-1.2.13, LINUX_VERSION_CODE is undefined ! 61: ** Under linux-1.3.X, all seems to be OK. ! 62: ** So, we have only to define it under 1.2.13 ! 63: */ ! 64: ! 65: #define LinuxVersionCode(v, p, s) (((v)<<16)+((p)<<8)+(s)) ! 66: ! 67: #if !defined(LINUX_VERSION_CODE) ! 68: #define LINUX_VERSION_CODE LinuxVersionCode(1,2,13) ! 69: #endif ! 70: ! 71: /* ! 72: ** Normal IO or memory mapped IO. ! 73: ** ! 74: ** Memory mapped IO only works with linux-1.3.X ! 75: ** If your motherboard does not work with memory mapped IO, ! 76: ** define SCSI_NCR_IOMAPPED for PATCHLEVEL 3 too. ! 77: */ ! 78: ! 79: #if LINUX_VERSION_CODE < LinuxVersionCode(1,3,0) ! 80: # define SCSI_NCR_IOMAPPED ! 81: #endif ! 82: ! 83: #if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,0) ! 84: # define SCSI_NCR_PROC_INFO_SUPPORT ! 85: #endif ! 86: ! 87: #if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,72) ! 88: # define SCSI_NCR_SHARE_IRQ ! 89: #endif ! 90: ! 91: /* ! 92: ** If you want a driver as small as possible, donnot define the ! 93: ** following options. ! 94: */ ! 95: ! 96: #define SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT ! 97: #define SCSI_NCR_DEBUG_INFO_SUPPORT ! 98: #define SCSI_NCR_PCI_FIX_UP_SUPPORT ! 99: #ifdef SCSI_NCR_PROC_INFO_SUPPORT ! 100: # define SCSI_NCR_PROFILE_SUPPORT ! 101: # define SCSI_NCR_USER_COMMAND_SUPPORT ! 102: # define SCSI_NCR_USER_INFO_SUPPORT ! 103: /* # define SCSI_NCR_DEBUG_ERROR_RECOVERY_SUPPORT */ ! 104: #endif ! 105: ! 106: /*========================================================== ! 107: ** ! 108: ** nvram settings - #define SCSI_NCR_NVRAM_SUPPORT to enable ! 109: ** ! 110: **========================================================== ! 111: */ ! 112: ! 113: #ifdef CONFIG_SCSI_NCR53C8XX_NVRAM_DETECT ! 114: #define SCSI_NCR_NVRAM_SUPPORT ! 115: /* #define SCSI_NCR_DEBUG_NVRAM */ ! 116: #endif ! 117: ! 118: /* --------------------------------------------------------------------- ! 119: ** Take into account kernel configured parameters. ! 120: ** Most of these options can be overridden at startup by a command line. ! 121: ** --------------------------------------------------------------------- ! 122: */ ! 123: ! 124: /* ! 125: * For Ultra2 SCSI support option, use special features and allow 40Mhz ! 126: * synchronous data transfers. ! 127: */ ! 128: #define SCSI_NCR_SETUP_SPECIAL_FEATURES (3) ! 129: #define SCSI_NCR_SETUP_ULTRA_SCSI (2) ! 130: #define SCSI_NCR_MAX_SYNC (40) ! 131: ! 132: /* ! 133: * Allow tags from 2 to 12, default 4 ! 134: */ ! 135: #ifdef CONFIG_SCSI_NCR53C8XX_MAX_TAGS ! 136: #if CONFIG_SCSI_NCR53C8XX_MAX_TAGS < 2 ! 137: #define SCSI_NCR_MAX_TAGS (2) ! 138: #elif CONFIG_SCSI_NCR53C8XX_MAX_TAGS > 12 ! 139: #define SCSI_NCR_MAX_TAGS (12) ! 140: #else ! 141: #define SCSI_NCR_MAX_TAGS CONFIG_SCSI_NCR53C8XX_MAX_TAGS ! 142: #endif ! 143: #else ! 144: #define SCSI_NCR_MAX_TAGS (4) ! 145: #endif ! 146: ! 147: /* ! 148: * Allow tagged command queuing support if configured with default number ! 149: * of tags set to max (see above). ! 150: */ ! 151: #ifdef CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE ! 152: #define SCSI_NCR_SETUP_DEFAULT_TAGS SCSI_NCR_MAX_TAGS ! 153: #else ! 154: #define SCSI_NCR_SETUP_DEFAULT_TAGS (0) ! 155: #endif ! 156: ! 157: /* ! 158: * Use normal IO if configured. Forced for alpha and ppc. ! 159: */ ! 160: #if defined(CONFIG_SCSI_NCR53C8XX_IOMAPPED) ! 161: #define SCSI_NCR_IOMAPPED ! 162: #elif defined(__alpha__) || defined(__powerpc__) ! 163: #define SCSI_NCR_IOMAPPED ! 164: #endif ! 165: ! 166: /* ! 167: * Sync transfer frequency at startup. ! 168: * Allow from 5Mhz to 40Mhz default 10 Mhz. ! 169: */ ! 170: #ifndef CONFIG_SCSI_NCR53C8XX_SYNC ! 171: #define CONFIG_SCSI_NCR53C8XX_SYNC (5) ! 172: #elif CONFIG_SCSI_NCR53C8XX_SYNC > SCSI_NCR_MAX_SYNC ! 173: #define SCSI_NCR_SETUP_DEFAULT_SYNC SCSI_NCR_MAX_SYNC ! 174: #endif ! 175: ! 176: #if CONFIG_SCSI_NCR53C8XX_SYNC == 0 ! 177: #define SCSI_NCR_SETUP_DEFAULT_SYNC (255) ! 178: #elif CONFIG_SCSI_NCR53C8XX_SYNC <= 5 ! 179: #define SCSI_NCR_SETUP_DEFAULT_SYNC (50) ! 180: #elif CONFIG_SCSI_NCR53C8XX_SYNC <= 20 ! 181: #define SCSI_NCR_SETUP_DEFAULT_SYNC (250/(CONFIG_SCSI_NCR53C8XX_SYNC)) ! 182: #elif CONFIG_SCSI_NCR53C8XX_SYNC <= 33 ! 183: #define SCSI_NCR_SETUP_DEFAULT_SYNC (11) ! 184: #else ! 185: #define SCSI_NCR_SETUP_DEFAULT_SYNC (10) ! 186: #endif ! 187: ! 188: /* ! 189: * Disallow disconnections at boot-up ! 190: */ ! 191: #ifdef CONFIG_SCSI_NCR53C8XX_NO_DISCONNECT ! 192: #define SCSI_NCR_SETUP_DISCONNECTION (0) ! 193: #else ! 194: #define SCSI_NCR_SETUP_DISCONNECTION (1) ! 195: #endif ! 196: ! 197: /* ! 198: * Force synchronous negotiation for all targets ! 199: */ ! 200: #ifdef CONFIG_SCSI_NCR53C8XX_FORCE_SYNC_NEGO ! 201: #define SCSI_NCR_SETUP_FORCE_SYNC_NEGO (1) ! 202: #else ! 203: #define SCSI_NCR_SETUP_FORCE_SYNC_NEGO (0) ! 204: #endif ! 205: ! 206: /* ! 207: * Disable master parity checking (flawed hardwares need that) ! 208: */ ! 209: #ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_MPARITY_CHECK ! 210: #define SCSI_NCR_SETUP_MASTER_PARITY (0) ! 211: #else ! 212: #define SCSI_NCR_SETUP_MASTER_PARITY (1) ! 213: #endif ! 214: ! 215: /* ! 216: * Disable scsi parity checking (flawed devices may need that) ! 217: */ ! 218: #ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_PARITY_CHECK ! 219: #define SCSI_NCR_SETUP_SCSI_PARITY (0) ! 220: #else ! 221: #define SCSI_NCR_SETUP_SCSI_PARITY (1) ! 222: #endif ! 223: ! 224: /* ! 225: * Vendor specific stuff ! 226: */ ! 227: #ifdef CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT ! 228: #define SCSI_NCR_SETUP_LED_PIN (1) ! 229: #define SCSI_NCR_SETUP_DIFF_SUPPORT (3) ! 230: #else ! 231: #define SCSI_NCR_SETUP_LED_PIN (0) ! 232: #define SCSI_NCR_SETUP_DIFF_SUPPORT (0) ! 233: #endif ! 234: ! 235: /* ! 236: * Settle time after reset at boot-up ! 237: */ ! 238: #define SCSI_NCR_SETUP_SETTLE_TIME (2) ! 239: ! 240: /* ! 241: ** Other parameters not configurable with "make config" ! 242: ** Avoid to change these constants, unless you know what you are doing. ! 243: */ ! 244: ! 245: #define SCSI_NCR_ALWAYS_SIMPLE_TAG ! 246: #define SCSI_NCR_MAX_SCATTER (127) ! 247: #define SCSI_NCR_MAX_TARGET (16) ! 248: #define SCSI_NCR_MAX_HOST (2) ! 249: #define SCSI_NCR_TIMEOUT_ALERT (3*HZ) ! 250: ! 251: #define SCSI_NCR_CAN_QUEUE (7*SCSI_NCR_MAX_TAGS) ! 252: #define SCSI_NCR_CMD_PER_LUN (SCSI_NCR_MAX_TAGS) ! 253: #define SCSI_NCR_SG_TABLESIZE (SCSI_NCR_MAX_SCATTER) ! 254: ! 255: #define SCSI_NCR_TIMER_INTERVAL ((HZ+5-1)/5) ! 256: ! 257: #if 1 /* defined CONFIG_SCSI_MULTI_LUN */ ! 258: #define SCSI_NCR_MAX_LUN (8) ! 259: #else ! 260: #define SCSI_NCR_MAX_LUN (1) ! 261: #endif ! 262: ! 263: /* ! 264: ** Define Scsi_Host_Template parameters ! 265: ** ! 266: ** Used by hosts.c and ncr53c8xx.c with module configuration. ! 267: */ ! 268: ! 269: #if defined(HOSTS_C) || defined(MODULE) ! 270: ! 271: #if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,98) ! 272: #include <scsi/scsicam.h> ! 273: #else ! 274: #include <linux/scsicam.h> ! 275: #endif ! 276: ! 277: int ncr53c8xx_abort(Scsi_Cmnd *); ! 278: int ncr53c8xx_detect(Scsi_Host_Template *tpnt); ! 279: int ncr53c8xx_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)); ! 280: ! 281: #if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,98) ! 282: int ncr53c8xx_reset(Scsi_Cmnd *, unsigned int); ! 283: #else ! 284: int ncr53c8xx_reset(Scsi_Cmnd *); ! 285: #endif ! 286: ! 287: #ifdef MODULE ! 288: int ncr53c8xx_release(struct Scsi_Host *); ! 289: #else ! 290: #define ncr53c8xx_release NULL ! 291: #endif ! 292: ! 293: #if LINUX_VERSION_CODE >= LinuxVersionCode(2,1,75) ! 294: ! 295: #define NCR53C8XX { name: SCSI_NCR_DRIVER_NAME, \ ! 296: detect: ncr53c8xx_detect, \ ! 297: release: ncr53c8xx_release, \ ! 298: queuecommand: ncr53c8xx_queue_command,\ ! 299: abort: ncr53c8xx_abort, \ ! 300: reset: ncr53c8xx_reset, \ ! 301: bios_param: scsicam_bios_param, \ ! 302: can_queue: SCSI_NCR_CAN_QUEUE, \ ! 303: this_id: 7, \ ! 304: sg_tablesize: SCSI_NCR_SG_TABLESIZE, \ ! 305: cmd_per_lun: SCSI_NCR_CMD_PER_LUN, \ ! 306: use_clustering: DISABLE_CLUSTERING} ! 307: ! 308: #elif LINUX_VERSION_CODE >= LinuxVersionCode(1,3,0) ! 309: ! 310: #define NCR53C8XX { NULL, NULL, NULL, NULL, \ ! 311: SCSI_NCR_DRIVER_NAME, ncr53c8xx_detect, \ ! 312: ncr53c8xx_release, NULL, NULL, \ ! 313: ncr53c8xx_queue_command,ncr53c8xx_abort, \ ! 314: ncr53c8xx_reset, NULL, scsicam_bios_param, \ ! 315: SCSI_NCR_CAN_QUEUE, 7, \ ! 316: SCSI_NCR_SG_TABLESIZE, SCSI_NCR_CMD_PER_LUN, \ ! 317: 0, 0, DISABLE_CLUSTERING} ! 318: ! 319: #else ! 320: ! 321: #define NCR53C8XX { NULL, NULL, \ ! 322: SCSI_NCR_DRIVER_NAME, ncr53c8xx_detect, \ ! 323: ncr53c8xx_release, NULL, NULL, \ ! 324: ncr53c8xx_queue_command,ncr53c8xx_abort, \ ! 325: ncr53c8xx_reset, NULL, scsicam_bios_param, \ ! 326: SCSI_NCR_CAN_QUEUE, 7, \ ! 327: SCSI_NCR_SG_TABLESIZE, SCSI_NCR_CMD_PER_LUN, \ ! 328: 0, 0, DISABLE_CLUSTERING} ! 329: ! 330: #endif /* LINUX_VERSION_CODE */ ! 331: ! 332: #endif /* defined(HOSTS_C) || defined(MODULE) */ ! 333: ! 334: ! 335: #ifndef HOSTS_C ! 336: ! 337: /* ! 338: ** IO functions definition for big/little endian support. ! 339: ** For now, the NCR is only supported in little endian addressing mode, ! 340: ** and big endian byte ordering is only supported for the PPC. ! 341: ** MMIO is not used on PPC. ! 342: */ ! 343: ! 344: #ifdef __BIG_ENDIAN ! 345: ! 346: #if LINUX_VERSION_CODE < LinuxVersionCode(2,1,0) ! 347: #error "BIG ENDIAN byte ordering needs kernel version >= 2.1.0" ! 348: #endif ! 349: ! 350: #ifdef __powerpc__ ! 351: #define inw_l2b inw ! 352: #define inl_l2b inl ! 353: #define outw_b2l outw ! 354: #define outl_b2l outl ! 355: #else ! 356: #error "Support for BIG ENDIAN is only available for the PowerPC" ! 357: #endif ! 358: ! 359: #else /* Assumed x86 or alpha */ ! 360: ! 361: #define inw_raw inw ! 362: #define inl_raw inl ! 363: #define outw_raw outw ! 364: #define outl_raw outl ! 365: #define readw_raw readw ! 366: #define readl_raw readl ! 367: #define writew_raw writew ! 368: #define writel_raw writel ! 369: ! 370: #endif ! 371: ! 372: #ifdef SCSI_NCR_BIG_ENDIAN ! 373: #error "The NCR in BIG ENDIAN adressing mode is not (yet) supported" ! 374: #endif ! 375: ! 376: /* ! 377: ** NCR53C8XX Device Ids ! 378: */ ! 379: ! 380: #ifndef PCI_DEVICE_ID_NCR_53C810 ! 381: #define PCI_DEVICE_ID_NCR_53C810 1 ! 382: #endif ! 383: ! 384: #ifndef PCI_DEVICE_ID_NCR_53C810AP ! 385: #define PCI_DEVICE_ID_NCR_53C810AP 5 ! 386: #endif ! 387: ! 388: #ifndef PCI_DEVICE_ID_NCR_53C815 ! 389: #define PCI_DEVICE_ID_NCR_53C815 4 ! 390: #endif ! 391: ! 392: #ifndef PCI_DEVICE_ID_NCR_53C820 ! 393: #define PCI_DEVICE_ID_NCR_53C820 2 ! 394: #endif ! 395: ! 396: #ifndef PCI_DEVICE_ID_NCR_53C825 ! 397: #define PCI_DEVICE_ID_NCR_53C825 3 ! 398: #endif ! 399: ! 400: #ifndef PCI_DEVICE_ID_NCR_53C860 ! 401: #define PCI_DEVICE_ID_NCR_53C860 6 ! 402: #endif ! 403: ! 404: #ifndef PCI_DEVICE_ID_NCR_53C875 ! 405: #define PCI_DEVICE_ID_NCR_53C875 0xf ! 406: #endif ! 407: ! 408: #ifndef PCI_DEVICE_ID_NCR_53C875J ! 409: #define PCI_DEVICE_ID_NCR_53C875J 0x8f ! 410: #endif ! 411: ! 412: #ifndef PCI_DEVICE_ID_NCR_53C885 ! 413: #define PCI_DEVICE_ID_NCR_53C885 0xd ! 414: #endif ! 415: ! 416: #ifndef PCI_DEVICE_ID_NCR_53C895 ! 417: #define PCI_DEVICE_ID_NCR_53C895 0xc ! 418: #endif ! 419: ! 420: #ifndef PCI_DEVICE_ID_NCR_53C896 ! 421: #define PCI_DEVICE_ID_NCR_53C896 0xb ! 422: #endif ! 423: ! 424: /* ! 425: ** NCR53C8XX devices features table. ! 426: */ ! 427: typedef struct { ! 428: unsigned short device_id; ! 429: unsigned short revision_id; ! 430: char *name; ! 431: unsigned char burst_max; ! 432: unsigned char offset_max; ! 433: unsigned char nr_divisor; ! 434: unsigned int features; ! 435: #define FE_LED0 (1<<0) ! 436: #define FE_WIDE (1<<1) ! 437: #define FE_ULTRA (1<<2) ! 438: #define FE_ULTRA2 (1<<3) ! 439: #define FE_DBLR (1<<4) ! 440: #define FE_QUAD (1<<5) ! 441: #define FE_ERL (1<<6) ! 442: #define FE_CLSE (1<<7) ! 443: #define FE_WRIE (1<<8) ! 444: #define FE_ERMP (1<<9) ! 445: #define FE_BOF (1<<10) ! 446: #define FE_DFS (1<<11) ! 447: #define FE_PFEN (1<<12) ! 448: #define FE_LDSTR (1<<13) ! 449: #define FE_RAM (1<<14) ! 450: #define FE_CLK80 (1<<15) ! 451: #define FE_CACHE_SET (FE_ERL|FE_CLSE|FE_WRIE|FE_ERMP) ! 452: #define FE_SCSI_SET (FE_WIDE|FE_ULTRA|FE_ULTRA2|FE_DBLR|FE_QUAD|F_CLK80) ! 453: #define FE_SPECIAL_SET (FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM) ! 454: } ncr_chip; ! 455: ! 456: /* ! 457: ** DEL 397 - 53C875 Rev 3 - Part Number 609-0392410 - ITEM 3. ! 458: ** Memory Read transaction terminated by a retry followed by ! 459: ** Memory Read Line command. ! 460: */ ! 461: #define FE_CACHE0_SET (FE_CACHE_SET & ~FE_ERL) ! 462: ! 463: /* ! 464: ** DEL 397 - 53C875 Rev 3 - Part Number 609-0392410 - ITEM 5. ! 465: ** On paper, this errata is harmless. But it is a good reason for ! 466: ** using a shorter programmed burst length (64 DWORDS instead of 128). ! 467: */ ! 468: ! 469: #define SCSI_NCR_CHIP_TABLE \ ! 470: { \ ! 471: {PCI_DEVICE_ID_NCR_53C810, 0x0f, "810", 4, 8, 4, \ ! 472: FE_ERL} \ ! 473: , \ ! 474: {PCI_DEVICE_ID_NCR_53C810, 0xff, "810a", 4, 8, 4, \ ! 475: FE_CACHE_SET|FE_LDSTR|FE_PFEN|FE_BOF} \ ! 476: , \ ! 477: {PCI_DEVICE_ID_NCR_53C815, 0xff, "815", 4, 8, 4, \ ! 478: FE_ERL|FE_BOF} \ ! 479: , \ ! 480: {PCI_DEVICE_ID_NCR_53C820, 0xff, "820", 4, 8, 4, \ ! 481: FE_WIDE|FE_ERL} \ ! 482: , \ ! 483: {PCI_DEVICE_ID_NCR_53C825, 0x0f, "825", 4, 8, 4, \ ! 484: FE_WIDE|FE_ERL|FE_BOF} \ ! 485: , \ ! 486: {PCI_DEVICE_ID_NCR_53C825, 0xff, "825a", 6, 8, 4, \ ! 487: FE_WIDE|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM} \ ! 488: , \ ! 489: {PCI_DEVICE_ID_NCR_53C860, 0xff, "860", 4, 8, 5, \ ! 490: FE_ULTRA|FE_CLK80|FE_CACHE_SET|FE_BOF|FE_LDSTR|FE_PFEN} \ ! 491: , \ ! 492: {PCI_DEVICE_ID_NCR_53C875, 0x01, "875", 6, 16, 5, \ ! 493: FE_WIDE|FE_ULTRA|FE_CLK80|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\ ! 494: , \ ! 495: {PCI_DEVICE_ID_NCR_53C875, 0xff, "875", 6, 16, 5, \ ! 496: FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\ ! 497: , \ ! 498: {PCI_DEVICE_ID_NCR_53C875J,0xff, "875J", 6, 16, 5, \ ! 499: FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\ ! 500: , \ ! 501: {PCI_DEVICE_ID_NCR_53C885, 0xff, "885", 6, 16, 5, \ ! 502: FE_WIDE|FE_ULTRA|FE_DBLR|FE_CACHE0_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\ ! 503: , \ ! 504: {PCI_DEVICE_ID_NCR_53C895, 0xff, "895", 7, 31, 7, \ ! 505: FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\ ! 506: , \ ! 507: {PCI_DEVICE_ID_NCR_53C896, 0xff, "896", 7, 31, 7, \ ! 508: FE_WIDE|FE_ULTRA2|FE_QUAD|FE_CACHE_SET|FE_BOF|FE_DFS|FE_LDSTR|FE_PFEN|FE_RAM}\ ! 509: } ! 510: ! 511: /* ! 512: * List of supported NCR chip ids ! 513: */ ! 514: #define SCSI_NCR_CHIP_IDS \ ! 515: { \ ! 516: PCI_DEVICE_ID_NCR_53C810, \ ! 517: PCI_DEVICE_ID_NCR_53C815, \ ! 518: PCI_DEVICE_ID_NCR_53C820, \ ! 519: PCI_DEVICE_ID_NCR_53C825, \ ! 520: PCI_DEVICE_ID_NCR_53C860, \ ! 521: PCI_DEVICE_ID_NCR_53C875, \ ! 522: PCI_DEVICE_ID_NCR_53C875J, \ ! 523: PCI_DEVICE_ID_NCR_53C885, \ ! 524: PCI_DEVICE_ID_NCR_53C895, \ ! 525: PCI_DEVICE_ID_NCR_53C896 \ ! 526: } ! 527: ! 528: /* ! 529: ** Initial setup. ! 530: ** Can be overriden at startup by a command line. ! 531: */ ! 532: #define SCSI_NCR_DRIVER_SETUP \ ! 533: { \ ! 534: SCSI_NCR_SETUP_MASTER_PARITY, \ ! 535: SCSI_NCR_SETUP_SCSI_PARITY, \ ! 536: SCSI_NCR_SETUP_DISCONNECTION, \ ! 537: SCSI_NCR_SETUP_SPECIAL_FEATURES, \ ! 538: SCSI_NCR_SETUP_ULTRA_SCSI, \ ! 539: SCSI_NCR_SETUP_FORCE_SYNC_NEGO, \ ! 540: 0, \ ! 541: 0, \ ! 542: 1, \ ! 543: 1, \ ! 544: SCSI_NCR_SETUP_DEFAULT_TAGS, \ ! 545: SCSI_NCR_SETUP_DEFAULT_SYNC, \ ! 546: 0x00, \ ! 547: 7, \ ! 548: SCSI_NCR_SETUP_LED_PIN, \ ! 549: 1, \ ! 550: SCSI_NCR_SETUP_SETTLE_TIME, \ ! 551: SCSI_NCR_SETUP_DIFF_SUPPORT, \ ! 552: 0, \ ! 553: 1 \ ! 554: } ! 555: ! 556: /* ! 557: ** Boot fail safe setup. ! 558: ** Override initial setup from boot command line: ! 559: ** ncr53c8xx=safe:y ! 560: */ ! 561: #define SCSI_NCR_DRIVER_SAFE_SETUP \ ! 562: { \ ! 563: 0, \ ! 564: 1, \ ! 565: 0, \ ! 566: 0, \ ! 567: 0, \ ! 568: 0, \ ! 569: 0, \ ! 570: 0, \ ! 571: 1, \ ! 572: 2, \ ! 573: 0, \ ! 574: 255, \ ! 575: 0x00, \ ! 576: 255, \ ! 577: 0, \ ! 578: 0, \ ! 579: 10, \ ! 580: 1, \ ! 581: 1, \ ! 582: 1 \ ! 583: } ! 584: ! 585: /* ! 586: ** Define the table of target capabilities by host and target ! 587: ** ! 588: ** If you have problems with a scsi device, note the host unit and the ! 589: ** corresponding target number. ! 590: ** ! 591: ** Edit the corresponding entry of the table below and try successively: ! 592: ** NQ7_Questionnable ! 593: ** NQ7_IdeLike ! 594: ** ! 595: ** This bitmap is anded with the byte 7 of inquiry data on completion of ! 596: ** INQUIRY command. ! 597: ** The driver never see the zeroed bits and will ignore the corresponding ! 598: ** capabilities of the target. ! 599: */ ! 600: ! 601: #define INQ7_SftRe 1 ! 602: #define INQ7_CmdQueue (1<<1) /* Tagged Command */ ! 603: #define INQ7_Reserved (1<<2) ! 604: #define INQ7_Linked (1<<3) ! 605: #define INQ7_Sync (1<<4) /* Synchronous Negotiation */ ! 606: #define INQ7_WBus16 (1<<5) ! 607: #define INQ7_WBus32 (1<<6) ! 608: #define INQ7_RelAdr (1<<7) ! 609: ! 610: #define INQ7_IdeLike 0 ! 611: #define INQ7_Scsi1Like INQ7_IdeLike ! 612: #define INQ7_Perfect 0xff ! 613: #define INQ7_Questionnable ~(INQ7_CmdQueue|INQ7_Sync) ! 614: #define INQ7_VeryQuestionnable \ ! 615: ~(INQ7_CmdQueue|INQ7_Sync|INQ7_WBus16|INQ7_WBus32) ! 616: ! 617: #define INQ7_Default INQ7_Perfect ! 618: ! 619: #define NCR53C8XX_TARGET_CAPABILITIES \ ! 620: /* Host 0 */ \ ! 621: { \ ! 622: { \ ! 623: /* Target 0 */ INQ7_Default, \ ! 624: /* Target 1 */ INQ7_Default, \ ! 625: /* Target 2 */ INQ7_Default, \ ! 626: /* Target 3 */ INQ7_Default, \ ! 627: /* Target 4 */ INQ7_Default, \ ! 628: /* Target 5 */ INQ7_Default, \ ! 629: /* Target 6 */ INQ7_Default, \ ! 630: /* Target 7 */ INQ7_Default, \ ! 631: /* Target 8 */ INQ7_Default, \ ! 632: /* Target 9 */ INQ7_Default, \ ! 633: /* Target 10 */ INQ7_Default, \ ! 634: /* Target 11 */ INQ7_Default, \ ! 635: /* Target 12 */ INQ7_Default, \ ! 636: /* Target 13 */ INQ7_Default, \ ! 637: /* Target 14 */ INQ7_Default, \ ! 638: /* Target 15 */ INQ7_Default, \ ! 639: } \ ! 640: }, \ ! 641: /* Host 1 */ \ ! 642: { \ ! 643: { \ ! 644: /* Target 0 */ INQ7_Default, \ ! 645: /* Target 1 */ INQ7_Default, \ ! 646: /* Target 2 */ INQ7_Default, \ ! 647: /* Target 3 */ INQ7_Default, \ ! 648: /* Target 4 */ INQ7_Default, \ ! 649: /* Target 5 */ INQ7_Default, \ ! 650: /* Target 6 */ INQ7_Default, \ ! 651: /* Target 7 */ INQ7_Default, \ ! 652: /* Target 8 */ INQ7_Default, \ ! 653: /* Target 9 */ INQ7_Default, \ ! 654: /* Target 10 */ INQ7_Default, \ ! 655: /* Target 11 */ INQ7_Default, \ ! 656: /* Target 12 */ INQ7_Default, \ ! 657: /* Target 13 */ INQ7_Default, \ ! 658: /* Target 14 */ INQ7_Default, \ ! 659: /* Target 15 */ INQ7_Default, \ ! 660: } \ ! 661: } ! 662: ! 663: /* ! 664: ** Replace the proc_dir_entry of the standard ncr driver. ! 665: */ ! 666: ! 667: #if LINUX_VERSION_CODE >= LinuxVersionCode(1,3,0) ! 668: #if defined(CONFIG_SCSI_NCR53C7xx) || !defined(CONFIG_SCSI_NCR53C8XX) ! 669: #define PROC_SCSI_NCR53C8XX PROC_SCSI_NCR53C7xx ! 670: #endif ! 671: #endif ! 672: ! 673: /**************** ORIGINAL CONTENT of ncrreg.h from FreeBSD ******************/ ! 674: ! 675: /*----------------------------------------------------------------- ! 676: ** ! 677: ** The ncr 53c810 register structure. ! 678: ** ! 679: **----------------------------------------------------------------- ! 680: */ ! 681: ! 682: struct ncr_reg { ! 683: /*00*/ u_char nc_scntl0; /* full arb., ena parity, par->ATN */ ! 684: ! 685: /*01*/ u_char nc_scntl1; /* no reset */ ! 686: #define ISCON 0x10 /* connected to scsi */ ! 687: #define CRST 0x08 /* force reset */ ! 688: ! 689: /*02*/ u_char nc_scntl2; /* no disconnect expected */ ! 690: #define SDU 0x80 /* cmd: disconnect will raise error */ ! 691: #define CHM 0x40 /* sta: chained mode */ ! 692: #define WSS 0x08 /* sta: wide scsi send [W]*/ ! 693: #define WSR 0x01 /* sta: wide scsi received [W]*/ ! 694: ! 695: /*03*/ u_char nc_scntl3; /* cnf system clock dependent */ ! 696: #define EWS 0x08 /* cmd: enable wide scsi [W]*/ ! 697: #define ULTRA 0x80 /* cmd: ULTRA enable */ ! 698: ! 699: /*04*/ u_char nc_scid; /* cnf host adapter scsi address */ ! 700: #define RRE 0x40 /* r/w:e enable response to resel. */ ! 701: #define SRE 0x20 /* r/w:e enable response to select */ ! 702: ! 703: /*05*/ u_char nc_sxfer; /* ### Sync speed and count */ ! 704: ! 705: /*06*/ u_char nc_sdid; /* ### Destination-ID */ ! 706: ! 707: /*07*/ u_char nc_gpreg; /* ??? IO-Pins */ ! 708: ! 709: /*08*/ u_char nc_sfbr; /* ### First byte in phase */ ! 710: ! 711: /*09*/ u_char nc_socl; ! 712: #define CREQ 0x80 /* r/w: SCSI-REQ */ ! 713: #define CACK 0x40 /* r/w: SCSI-ACK */ ! 714: #define CBSY 0x20 /* r/w: SCSI-BSY */ ! 715: #define CSEL 0x10 /* r/w: SCSI-SEL */ ! 716: #define CATN 0x08 /* r/w: SCSI-ATN */ ! 717: #define CMSG 0x04 /* r/w: SCSI-MSG */ ! 718: #define CC_D 0x02 /* r/w: SCSI-C_D */ ! 719: #define CI_O 0x01 /* r/w: SCSI-I_O */ ! 720: ! 721: /*0a*/ u_char nc_ssid; ! 722: ! 723: /*0b*/ u_char nc_sbcl; ! 724: ! 725: /*0c*/ u_char nc_dstat; ! 726: #define DFE 0x80 /* sta: dma fifo empty */ ! 727: #define MDPE 0x40 /* int: master data parity error */ ! 728: #define BF 0x20 /* int: script: bus fault */ ! 729: #define ABRT 0x10 /* int: script: command aborted */ ! 730: #define SSI 0x08 /* int: script: single step */ ! 731: #define SIR 0x04 /* int: script: interrupt instruct. */ ! 732: #define IID 0x01 /* int: script: illegal instruct. */ ! 733: ! 734: /*0d*/ u_char nc_sstat0; ! 735: #define ILF 0x80 /* sta: data in SIDL register lsb */ ! 736: #define ORF 0x40 /* sta: data in SODR register lsb */ ! 737: #define OLF 0x20 /* sta: data in SODL register lsb */ ! 738: #define AIP 0x10 /* sta: arbitration in progress */ ! 739: #define LOA 0x08 /* sta: arbitration lost */ ! 740: #define WOA 0x04 /* sta: arbitration won */ ! 741: #define IRST 0x02 /* sta: scsi reset signal */ ! 742: #define SDP 0x01 /* sta: scsi parity signal */ ! 743: ! 744: /*0e*/ u_char nc_sstat1; ! 745: #define FF3210 0xf0 /* sta: bytes in the scsi fifo */ ! 746: ! 747: /*0f*/ u_char nc_sstat2; ! 748: #define ILF1 0x80 /* sta: data in SIDL register msb[W]*/ ! 749: #define ORF1 0x40 /* sta: data in SODR register msb[W]*/ ! 750: #define OLF1 0x20 /* sta: data in SODL register msb[W]*/ ! 751: #define DM 0x04 /* sta: DIFFSENS mismatch (895/6 only) */ ! 752: #define LDSC 0x02 /* sta: disconnect & reconnect */ ! 753: ! 754: /*10*/ u_int32 nc_dsa; /* --> Base page */ ! 755: ! 756: /*14*/ u_char nc_istat; /* --> Main Command and status */ ! 757: #define CABRT 0x80 /* cmd: abort current operation */ ! 758: #define SRST 0x40 /* mod: reset chip */ ! 759: #define SIGP 0x20 /* r/w: message from host to ncr */ ! 760: #define SEM 0x10 /* r/w: message between host + ncr */ ! 761: #define CON 0x08 /* sta: connected to scsi */ ! 762: #define INTF 0x04 /* sta: int on the fly (reset by wr)*/ ! 763: #define SIP 0x02 /* sta: scsi-interrupt */ ! 764: #define DIP 0x01 /* sta: host/script interrupt */ ! 765: ! 766: /*15*/ u_char nc_15_; ! 767: /*16*/ u_char nc_16_; ! 768: /*17*/ u_char nc_17_; ! 769: ! 770: /*18*/ u_char nc_ctest0; ! 771: /*19*/ u_char nc_ctest1; ! 772: ! 773: /*1a*/ u_char nc_ctest2; ! 774: #define CSIGP 0x40 ! 775: ! 776: /*1b*/ u_char nc_ctest3; ! 777: #define FLF 0x08 /* cmd: flush dma fifo */ ! 778: #define CLF 0x04 /* cmd: clear dma fifo */ ! 779: #define FM 0x02 /* mod: fetch pin mode */ ! 780: #define WRIE 0x01 /* mod: write and invalidate enable */ ! 781: ! 782: /*1c*/ u_int32 nc_temp; /* ### Temporary stack */ ! 783: ! 784: /*20*/ u_char nc_dfifo; ! 785: /*21*/ u_char nc_ctest4; ! 786: #define BDIS 0x80 /* mod: burst disable */ ! 787: #define MPEE 0x08 /* mod: master parity error enable */ ! 788: ! 789: /*22*/ u_char nc_ctest5; ! 790: #define DFS 0x20 /* mod: dma fifo size */ ! 791: /*23*/ u_char nc_ctest6; ! 792: ! 793: /*24*/ u_int32 nc_dbc; /* ### Byte count and command */ ! 794: /*28*/ u_int32 nc_dnad; /* ### Next command register */ ! 795: /*2c*/ u_int32 nc_dsp; /* --> Script Pointer */ ! 796: /*30*/ u_int32 nc_dsps; /* --> Script pointer save/opcode#2 */ ! 797: /*34*/ u_int32 nc_scratcha; /* ??? Temporary register a */ ! 798: ! 799: /*38*/ u_char nc_dmode; ! 800: #define BL_2 0x80 /* mod: burst length shift value +2 */ ! 801: #define BL_1 0x40 /* mod: burst length shift value +1 */ ! 802: #define ERL 0x08 /* mod: enable read line */ ! 803: #define ERMP 0x04 /* mod: enable read multiple */ ! 804: #define BOF 0x02 /* mod: burst op code fetch */ ! 805: ! 806: /*39*/ u_char nc_dien; ! 807: /*3a*/ u_char nc_dwt; ! 808: ! 809: /*3b*/ u_char nc_dcntl; /* --> Script execution control */ ! 810: ! 811: #define CLSE 0x80 /* mod: cache line size enable */ ! 812: #define PFF 0x40 /* cmd: pre-fetch flush */ ! 813: #define PFEN 0x20 /* mod: pre-fetch enable */ ! 814: #define SSM 0x10 /* mod: single step mode */ ! 815: #define IRQM 0x08 /* mod: irq mode (1 = totem pole !) */ ! 816: #define STD 0x04 /* cmd: start dma mode */ ! 817: #define IRQD 0x02 /* mod: irq disable */ ! 818: #define NOCOM 0x01 /* cmd: protect sfbr while reselect */ ! 819: ! 820: /*3c*/ u_int32 nc_adder; ! 821: ! 822: /*40*/ u_short nc_sien; /* -->: interrupt enable */ ! 823: /*42*/ u_short nc_sist; /* <--: interrupt status */ ! 824: #define SBMC 0x1000/* sta: SCSI Bus Mode Change (895/6 only) */ ! 825: #define STO 0x0400/* sta: timeout (select) */ ! 826: #define GEN 0x0200/* sta: timeout (general) */ ! 827: #define HTH 0x0100/* sta: timeout (handshake) */ ! 828: #define MA 0x80 /* sta: phase mismatch */ ! 829: #define CMP 0x40 /* sta: arbitration complete */ ! 830: #define SEL 0x20 /* sta: selected by another device */ ! 831: #define RSL 0x10 /* sta: reselected by another device*/ ! 832: #define SGE 0x08 /* sta: gross error (over/underflow)*/ ! 833: #define UDC 0x04 /* sta: unexpected disconnect */ ! 834: #define RST 0x02 /* sta: scsi bus reset detected */ ! 835: #define PAR 0x01 /* sta: scsi parity error */ ! 836: ! 837: /*44*/ u_char nc_slpar; ! 838: /*45*/ u_char nc_swide; ! 839: /*46*/ u_char nc_macntl; ! 840: /*47*/ u_char nc_gpcntl; ! 841: /*48*/ u_char nc_stime0; /* cmd: timeout for select&handshake*/ ! 842: /*49*/ u_char nc_stime1; /* cmd: timeout user defined */ ! 843: /*4a*/ u_short nc_respid; /* sta: Reselect-IDs */ ! 844: ! 845: /*4c*/ u_char nc_stest0; ! 846: ! 847: /*4d*/ u_char nc_stest1; ! 848: #define DBLEN 0x08 /* clock doubler running */ ! 849: #define DBLSEL 0x04 /* clock doubler selected */ ! 850: ! 851: ! 852: /*4e*/ u_char nc_stest2; ! 853: #define ROF 0x40 /* reset scsi offset (after gross error!) */ ! 854: #define EXT 0x02 /* extended filtering */ ! 855: ! 856: /*4f*/ u_char nc_stest3; ! 857: #define TE 0x80 /* c: tolerAnt enable */ ! 858: #define HSC 0x20 /* c: Halt SCSI Clock */ ! 859: #define CSF 0x02 /* c: clear scsi fifo */ ! 860: ! 861: /*50*/ u_short nc_sidl; /* Lowlevel: latched from scsi data */ ! 862: /*52*/ u_char nc_stest4; ! 863: #define SMODE 0xc0 /* SCSI bus mode (895/6 only) */ ! 864: #define SMODE_HVD 0x40 /* High Voltage Differential */ ! 865: #define SMODE_SE 0x80 /* Single Ended */ ! 866: #define SMODE_LVD 0xc0 /* Low Voltage Differential */ ! 867: #define LCKFRQ 0x20 /* Frequency Lock (895/6 only) */ ! 868: ! 869: /*53*/ u_char nc_53_; ! 870: /*54*/ u_short nc_sodl; /* Lowlevel: data out to scsi data */ ! 871: /*56*/ u_short nc_56_; ! 872: /*58*/ u_short nc_sbdl; /* Lowlevel: data from scsi data */ ! 873: /*5a*/ u_short nc_5a_; ! 874: /*5c*/ u_char nc_scr0; /* Working register B */ ! 875: /*5d*/ u_char nc_scr1; /* */ ! 876: /*5e*/ u_char nc_scr2; /* */ ! 877: /*5f*/ u_char nc_scr3; /* */ ! 878: /*60*/ ! 879: }; ! 880: ! 881: /*----------------------------------------------------------- ! 882: ** ! 883: ** Utility macros for the script. ! 884: ** ! 885: **----------------------------------------------------------- ! 886: */ ! 887: ! 888: #define REGJ(p,r) (offsetof(struct ncr_reg, p ## r)) ! 889: #define REG(r) REGJ (nc_, r) ! 890: ! 891: #ifndef TARGET_MODE ! 892: #define TARGET_MODE 0 ! 893: #endif ! 894: ! 895: typedef u_int32 ncrcmd; ! 896: ! 897: /*----------------------------------------------------------- ! 898: ** ! 899: ** SCSI phases ! 900: ** ! 901: **----------------------------------------------------------- ! 902: */ ! 903: ! 904: #define SCR_DATA_OUT 0x00000000 ! 905: #define SCR_DATA_IN 0x01000000 ! 906: #define SCR_COMMAND 0x02000000 ! 907: #define SCR_STATUS 0x03000000 ! 908: #define SCR_ILG_OUT 0x04000000 ! 909: #define SCR_ILG_IN 0x05000000 ! 910: #define SCR_MSG_OUT 0x06000000 ! 911: #define SCR_MSG_IN 0x07000000 ! 912: ! 913: /*----------------------------------------------------------- ! 914: ** ! 915: ** Data transfer via SCSI. ! 916: ** ! 917: **----------------------------------------------------------- ! 918: ** ! 919: ** MOVE_ABS (LEN) ! 920: ** <<start address>> ! 921: ** ! 922: ** MOVE_IND (LEN) ! 923: ** <<dnad_offset>> ! 924: ** ! 925: ** MOVE_TBL ! 926: ** <<dnad_offset>> ! 927: ** ! 928: **----------------------------------------------------------- ! 929: */ ! 930: ! 931: #define SCR_MOVE_ABS(l) ((0x08000000 ^ (TARGET_MODE << 1ul)) | (l)) ! 932: #define SCR_MOVE_IND(l) ((0x28000000 ^ (TARGET_MODE << 1ul)) | (l)) ! 933: #define SCR_MOVE_TBL (0x18000000 ^ (TARGET_MODE << 1ul)) ! 934: ! 935: struct scr_tblmove { ! 936: u_int32 size; ! 937: u_int32 addr; ! 938: }; ! 939: ! 940: /*----------------------------------------------------------- ! 941: ** ! 942: ** Selection ! 943: ** ! 944: **----------------------------------------------------------- ! 945: ** ! 946: ** SEL_ABS | SCR_ID (0..7) [ | REL_JMP] ! 947: ** <<alternate_address>> ! 948: ** ! 949: ** SEL_TBL | << dnad_offset>> [ | REL_JMP] ! 950: ** <<alternate_address>> ! 951: ** ! 952: **----------------------------------------------------------- ! 953: */ ! 954: ! 955: #define SCR_SEL_ABS 0x40000000 ! 956: #define SCR_SEL_ABS_ATN 0x41000000 ! 957: #define SCR_SEL_TBL 0x42000000 ! 958: #define SCR_SEL_TBL_ATN 0x43000000 ! 959: ! 960: struct scr_tblsel { ! 961: u_char sel_0; ! 962: u_char sel_sxfer; ! 963: u_char sel_id; ! 964: u_char sel_scntl3; ! 965: }; ! 966: ! 967: #define SCR_JMP_REL 0x04000000 ! 968: #define SCR_ID(id) (((u_int32)(id)) << 16) ! 969: ! 970: /*----------------------------------------------------------- ! 971: ** ! 972: ** Waiting for Disconnect or Reselect ! 973: ** ! 974: **----------------------------------------------------------- ! 975: ** ! 976: ** WAIT_DISC ! 977: ** dummy: <<alternate_address>> ! 978: ** ! 979: ** WAIT_RESEL ! 980: ** <<alternate_address>> ! 981: ** ! 982: **----------------------------------------------------------- ! 983: */ ! 984: ! 985: #define SCR_WAIT_DISC 0x48000000 ! 986: #define SCR_WAIT_RESEL 0x50000000 ! 987: ! 988: /*----------------------------------------------------------- ! 989: ** ! 990: ** Bit Set / Reset ! 991: ** ! 992: **----------------------------------------------------------- ! 993: ** ! 994: ** SET (flags {|.. }) ! 995: ** ! 996: ** CLR (flags {|.. }) ! 997: ** ! 998: **----------------------------------------------------------- ! 999: */ ! 1000: ! 1001: #define SCR_SET(f) (0x58000000 | (f)) ! 1002: #define SCR_CLR(f) (0x60000000 | (f)) ! 1003: ! 1004: #define SCR_CARRY 0x00000400 ! 1005: #define SCR_TRG 0x00000200 ! 1006: #define SCR_ACK 0x00000040 ! 1007: #define SCR_ATN 0x00000008 ! 1008: ! 1009: ! 1010: ! 1011: ! 1012: /*----------------------------------------------------------- ! 1013: ** ! 1014: ** Memory to memory move ! 1015: ** ! 1016: **----------------------------------------------------------- ! 1017: ** ! 1018: ** COPY (bytecount) ! 1019: ** << source_address >> ! 1020: ** << destination_address >> ! 1021: ** ! 1022: ** SCR_COPY sets the NO FLUSH option by default. ! 1023: ** SCR_COPY_F does not set this option. ! 1024: ** ! 1025: ** For chips which do not support this option, ! 1026: ** ncr_copy_and_bind() will remove this bit. ! 1027: **----------------------------------------------------------- ! 1028: */ ! 1029: ! 1030: #define SCR_NO_FLUSH 0x01000000 ! 1031: ! 1032: #define SCR_COPY(n) (0xc0000000 | SCR_NO_FLUSH | (n)) ! 1033: #define SCR_COPY_F(n) (0xc0000000 | (n)) ! 1034: ! 1035: /*----------------------------------------------------------- ! 1036: ** ! 1037: ** Register move and binary operations ! 1038: ** ! 1039: **----------------------------------------------------------- ! 1040: ** ! 1041: ** SFBR_REG (reg, op, data) reg = SFBR op data ! 1042: ** << 0 >> ! 1043: ** ! 1044: ** REG_SFBR (reg, op, data) SFBR = reg op data ! 1045: ** << 0 >> ! 1046: ** ! 1047: ** REG_REG (reg, op, data) reg = reg op data ! 1048: ** << 0 >> ! 1049: ** ! 1050: **----------------------------------------------------------- ! 1051: */ ! 1052: ! 1053: #define SCR_REG_OFS(ofs) ((ofs) << 16ul) ! 1054: ! 1055: #define SCR_SFBR_REG(reg,op,data) \ ! 1056: (0x68000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul)) ! 1057: ! 1058: #define SCR_REG_SFBR(reg,op,data) \ ! 1059: (0x70000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul)) ! 1060: ! 1061: #define SCR_REG_REG(reg,op,data) \ ! 1062: (0x78000000 | (SCR_REG_OFS(REG(reg))) | (op) | ((data)<<8ul)) ! 1063: ! 1064: ! 1065: #define SCR_LOAD 0x00000000 ! 1066: #define SCR_SHL 0x01000000 ! 1067: #define SCR_OR 0x02000000 ! 1068: #define SCR_XOR 0x03000000 ! 1069: #define SCR_AND 0x04000000 ! 1070: #define SCR_SHR 0x05000000 ! 1071: #define SCR_ADD 0x06000000 ! 1072: #define SCR_ADDC 0x07000000 ! 1073: ! 1074: /*----------------------------------------------------------- ! 1075: ** ! 1076: ** FROM_REG (reg) reg = SFBR ! 1077: ** << 0 >> ! 1078: ** ! 1079: ** TO_REG (reg) SFBR = reg ! 1080: ** << 0 >> ! 1081: ** ! 1082: ** LOAD_REG (reg, data) reg = <data> ! 1083: ** << 0 >> ! 1084: ** ! 1085: ** LOAD_SFBR(data) SFBR = <data> ! 1086: ** << 0 >> ! 1087: ** ! 1088: **----------------------------------------------------------- ! 1089: */ ! 1090: ! 1091: #define SCR_FROM_REG(reg) \ ! 1092: SCR_REG_SFBR(reg,SCR_OR,0) ! 1093: ! 1094: #define SCR_TO_REG(reg) \ ! 1095: SCR_SFBR_REG(reg,SCR_OR,0) ! 1096: ! 1097: #define SCR_LOAD_REG(reg,data) \ ! 1098: SCR_REG_REG(reg,SCR_LOAD,data) ! 1099: ! 1100: #define SCR_LOAD_SFBR(data) \ ! 1101: (SCR_REG_SFBR (gpreg, SCR_LOAD, data)) ! 1102: ! 1103: /*----------------------------------------------------------- ! 1104: ** ! 1105: ** Waiting for Disconnect or Reselect ! 1106: ** ! 1107: **----------------------------------------------------------- ! 1108: ** ! 1109: ** JUMP [ | IFTRUE/IFFALSE ( ... ) ] ! 1110: ** <<address>> ! 1111: ** ! 1112: ** JUMPR [ | IFTRUE/IFFALSE ( ... ) ] ! 1113: ** <<distance>> ! 1114: ** ! 1115: ** CALL [ | IFTRUE/IFFALSE ( ... ) ] ! 1116: ** <<address>> ! 1117: ** ! 1118: ** CALLR [ | IFTRUE/IFFALSE ( ... ) ] ! 1119: ** <<distance>> ! 1120: ** ! 1121: ** RETURN [ | IFTRUE/IFFALSE ( ... ) ] ! 1122: ** <<dummy>> ! 1123: ** ! 1124: ** INT [ | IFTRUE/IFFALSE ( ... ) ] ! 1125: ** <<ident>> ! 1126: ** ! 1127: ** INT_FLY [ | IFTRUE/IFFALSE ( ... ) ] ! 1128: ** <<ident>> ! 1129: ** ! 1130: ** Conditions: ! 1131: ** WHEN (phase) ! 1132: ** IF (phase) ! 1133: ** CARRY ! 1134: ** DATA (data, mask) ! 1135: ** ! 1136: **----------------------------------------------------------- ! 1137: */ ! 1138: ! 1139: #define SCR_NO_OP 0x80000000 ! 1140: #define SCR_JUMP 0x80080000 ! 1141: #define SCR_JUMPR 0x80880000 ! 1142: #define SCR_CALL 0x88080000 ! 1143: #define SCR_CALLR 0x88880000 ! 1144: #define SCR_RETURN 0x90080000 ! 1145: #define SCR_INT 0x98080000 ! 1146: #define SCR_INT_FLY 0x98180000 ! 1147: ! 1148: #define IFFALSE(arg) (0x00080000 | (arg)) ! 1149: #define IFTRUE(arg) (0x00000000 | (arg)) ! 1150: ! 1151: #define WHEN(phase) (0x00030000 | (phase)) ! 1152: #define IF(phase) (0x00020000 | (phase)) ! 1153: ! 1154: #define DATA(D) (0x00040000 | ((D) & 0xff)) ! 1155: #define MASK(D,M) (0x00040000 | (((M ^ 0xff) & 0xff) << 8ul)|((D) & 0xff)) ! 1156: ! 1157: #define CARRYSET (0x00200000) ! 1158: ! 1159: /*----------------------------------------------------------- ! 1160: ** ! 1161: ** SCSI constants. ! 1162: ** ! 1163: **----------------------------------------------------------- ! 1164: */ ! 1165: ! 1166: /* ! 1167: ** Messages ! 1168: */ ! 1169: ! 1170: #define M_COMPLETE (0x00) ! 1171: #define M_EXTENDED (0x01) ! 1172: #define M_SAVE_DP (0x02) ! 1173: #define M_RESTORE_DP (0x03) ! 1174: #define M_DISCONNECT (0x04) ! 1175: #define M_ID_ERROR (0x05) ! 1176: #define M_ABORT (0x06) ! 1177: #define M_REJECT (0x07) ! 1178: #define M_NOOP (0x08) ! 1179: #define M_PARITY (0x09) ! 1180: #define M_LCOMPLETE (0x0a) ! 1181: #define M_FCOMPLETE (0x0b) ! 1182: #define M_RESET (0x0c) ! 1183: #define M_ABORT_TAG (0x0d) ! 1184: #define M_CLEAR_QUEUE (0x0e) ! 1185: #define M_INIT_REC (0x0f) ! 1186: #define M_REL_REC (0x10) ! 1187: #define M_TERMINATE (0x11) ! 1188: #define M_SIMPLE_TAG (0x20) ! 1189: #define M_HEAD_TAG (0x21) ! 1190: #define M_ORDERED_TAG (0x22) ! 1191: #define M_IGN_RESIDUE (0x23) ! 1192: #define M_IDENTIFY (0x80) ! 1193: ! 1194: #define M_X_MODIFY_DP (0x00) ! 1195: #define M_X_SYNC_REQ (0x01) ! 1196: #define M_X_WIDE_REQ (0x03) ! 1197: ! 1198: /* ! 1199: ** Status ! 1200: */ ! 1201: ! 1202: #define S_GOOD (0x00) ! 1203: #define S_CHECK_COND (0x02) ! 1204: #define S_COND_MET (0x04) ! 1205: #define S_BUSY (0x08) ! 1206: #define S_INT (0x10) ! 1207: #define S_INT_COND_MET (0x14) ! 1208: #define S_CONFLICT (0x18) ! 1209: #define S_TERMINATED (0x20) ! 1210: #define S_QUEUE_FULL (0x28) ! 1211: #define S_ILLEGAL (0xff) ! 1212: #define S_SENSE (0x80) ! 1213: ! 1214: /* ! 1215: * End of ncrreg from FreeBSD ! 1216: */ ! 1217: ! 1218: #endif /* !defined HOSTS_C */ ! 1219: ! 1220: #endif /* defined NCR53C8XX_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.