ncr.c (6460) | ncr.c (6526) |
---|---|
1/************************************************************************** 2** | 1/************************************************************************** 2** |
3** $Id: ncr.c,v 1.23 1995/02/14 23:33:36 se Exp $ | 3** $Id: ncr.c,v 1.24 1995/02/15 20:06:38 se Exp $ |
4** 5** Device driver for the NCR 53C810 PCI-SCSI-Controller. 6** 7** 386bsd / FreeBSD / NetBSD 8** 9**------------------------------------------------------------------------- 10** 11** Written for 386bsd and FreeBSD by --- 27 unchanged lines hidden (view full) --- 39** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 40** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 41** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 42** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43** 44*************************************************************************** 45*/ 46 | 4** 5** Device driver for the NCR 53C810 PCI-SCSI-Controller. 6** 7** 386bsd / FreeBSD / NetBSD 8** 9**------------------------------------------------------------------------- 10** 11** Written for 386bsd and FreeBSD by --- 27 unchanged lines hidden (view full) --- 39** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 40** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 41** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 42** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43** 44*************************************************************************** 45*/ 46 |
47#define NCR_PATCHLEVEL "pl14 95/02/15" | 47#define NCR_PATCHLEVEL "pl15 95/02/15" |
48 49#define NCR_VERSION (2) 50#define MAX_UNITS (16) 51 52 53/*========================================================== 54** 55** Configuration and Debugging --- 80 unchanged lines hidden (view full) --- 136#define MAX_SCATTER (33) 137 138/* 139** The maximum transfer length (should be >= 64k). 140** MUST NOT be greater than (MAX_SCATTER-1) * NBPG. 141*/ 142 143#define MAX_SIZE ((MAX_SCATTER-1) * NBPG) | 48 49#define NCR_VERSION (2) 50#define MAX_UNITS (16) 51 52 53/*========================================================== 54** 55** Configuration and Debugging --- 80 unchanged lines hidden (view full) --- 136#define MAX_SCATTER (33) 137 138/* 139** The maximum transfer length (should be >= 64k). 140** MUST NOT be greater than (MAX_SCATTER-1) * NBPG. 141*/ 142 143#define MAX_SIZE ((MAX_SCATTER-1) * NBPG) |
144 145/* 146** other 147*/ 148 149#define NCR_SNOOP_TIMEOUT (1000000) |
|
144 145/*========================================================== 146** 147** Include files 148** 149**========================================================== 150*/ 151 --- 1018 unchanged lines hidden (view full) --- 1170 ncrcmd reselect2 [ 6]; 1171 ncrcmd resel_tmp [ 5]; 1172 ncrcmd resel_lun [ 18]; 1173 ncrcmd resel_tag [ 24]; 1174 ncrcmd data_in [MAX_SCATTER * 4 + 7]; 1175 ncrcmd data_out [MAX_SCATTER * 4 + 7]; 1176 ncrcmd aborttag [ 4]; 1177 ncrcmd abort [ 22]; | 150 151/*========================================================== 152** 153** Include files 154** 155**========================================================== 156*/ 157 --- 1018 unchanged lines hidden (view full) --- 1176 ncrcmd reselect2 [ 6]; 1177 ncrcmd resel_tmp [ 5]; 1178 ncrcmd resel_lun [ 18]; 1179 ncrcmd resel_tag [ 24]; 1180 ncrcmd data_in [MAX_SCATTER * 4 + 7]; 1181 ncrcmd data_out [MAX_SCATTER * 4 + 7]; 1182 ncrcmd aborttag [ 4]; 1183 ncrcmd abort [ 22]; |
1178 ncrcmd snooptest [ 11]; | 1184 ncrcmd snooptest [ 9]; 1185 ncrcmd snoopend [ 2]; |
1179}; 1180 1181/*========================================================== 1182** 1183** 1184** Function headers. 1185** 1186** --- 52 unchanged lines hidden (view full) --- 1239** Global static data. 1240** 1241** 1242**========================================================== 1243*/ 1244 1245 1246static char ident[] = | 1186}; 1187 1188/*========================================================== 1189** 1190** 1191** Function headers. 1192** 1193** --- 52 unchanged lines hidden (view full) --- 1246** Global static data. 1247** 1248** 1249**========================================================== 1250*/ 1251 1252 1253static char ident[] = |
1247 "\n$Id: ncr.c,v 1.23 1995/02/14 23:33:36 se Exp $\n"; | 1254 "\n$Id: ncr.c,v 1.24 1995/02/15 20:06:38 se Exp $\n"; |
1248 1249u_long ncr_version = NCR_VERSION 1250 + (u_long) sizeof (struct ncb) 1251 * (u_long) sizeof (struct ccb) 1252 * (u_long) sizeof (struct lcb) 1253 * (u_long) sizeof (struct tcb); 1254 1255#ifdef KERNEL --- 1617 unchanged lines hidden (view full) --- 2873 RADDR (temp), 2874 (ncrcmd) &ncr_cache, 2875 /* 2876 ** Read back the variable. 2877 */ 2878 SCR_COPY (4), 2879 (ncrcmd) &ncr_cache, 2880 RADDR (temp), | 1255 1256u_long ncr_version = NCR_VERSION 1257 + (u_long) sizeof (struct ncb) 1258 * (u_long) sizeof (struct ccb) 1259 * (u_long) sizeof (struct lcb) 1260 * (u_long) sizeof (struct tcb); 1261 1262#ifdef KERNEL --- 1617 unchanged lines hidden (view full) --- 2880 RADDR (temp), 2881 (ncrcmd) &ncr_cache, 2882 /* 2883 ** Read back the variable. 2884 */ 2885 SCR_COPY (4), 2886 (ncrcmd) &ncr_cache, 2887 RADDR (temp), |
2888}/*-------------------------< SNOOPEND >-------------------*/,{ |
|
2881 /* 2882 ** And stop. 2883 */ 2884 SCR_INT, 2885 99, 2886}/*--------------------------------------------------------*/ 2887}; 2888 --- 3560 unchanged lines hidden (view full) --- 6449 }; 6450 return (0); 6451} 6452#endif 6453 6454static int ncr_snooptest (struct ncb* np) 6455{ 6456 u_long ncr_rd, ncr_wr, ncr_bk, host_rd, host_wr, pc, err=0; | 2889 /* 2890 ** And stop. 2891 */ 2892 SCR_INT, 2893 99, 2894}/*--------------------------------------------------------*/ 2895}; 2896 --- 3560 unchanged lines hidden (view full) --- 6457 }; 6458 return (0); 6459} 6460#endif 6461 6462static int ncr_snooptest (struct ncb* np) 6463{ 6464 u_long ncr_rd, ncr_wr, ncr_bk, host_rd, host_wr, pc, err=0; |
6465 int i; |
|
6457#ifndef NCR_IOMAPPED 6458 err |= ncr_regtest (np); 6459 if (err) return (err); 6460#endif 6461 /* 6462 ** init 6463 */ 6464 pc = vtophys (&np->script->snooptest); --- 4 unchanged lines hidden (view full) --- 6469 */ 6470 ncr_cache = host_wr; 6471 OUTL (nc_temp, ncr_wr); 6472 /* 6473 ** Start script (exchange values) 6474 */ 6475 OUTL (nc_dsp, pc); 6476 /* | 6466#ifndef NCR_IOMAPPED 6467 err |= ncr_regtest (np); 6468 if (err) return (err); 6469#endif 6470 /* 6471 ** init 6472 */ 6473 pc = vtophys (&np->script->snooptest); --- 4 unchanged lines hidden (view full) --- 6478 */ 6479 ncr_cache = host_wr; 6480 OUTL (nc_temp, ncr_wr); 6481 /* 6482 ** Start script (exchange values) 6483 */ 6484 OUTL (nc_dsp, pc); 6485 /* |
6477 ** Wait 'til done | 6486 ** Wait 'til done (with timeout) |
6478 */ | 6487 */ |
6479 while (!(INB(nc_istat) & (INTF|SIP|DIP))); | 6488 for (i=0; i<NCR_SNOOP_TIMEOUT; i++) 6489 if (INB(nc_istat) & (INTF|SIP|DIP)) 6490 break; |
6480 /* | 6491 /* |
6492 ** Save termination position. 6493 */ 6494 pc = INL (nc_dsp); 6495 /* |
|
6481 ** Read memory and register. 6482 */ 6483 host_rd = ncr_cache; 6484 ncr_rd = INL (nc_scratcha); 6485 ncr_bk = INL (nc_temp); 6486 /* 6487 ** Reset ncr chip 6488 */ 6489 OUTB (nc_istat, SRST); 6490 OUTB (nc_istat, 0 ); 6491 /* | 6496 ** Read memory and register. 6497 */ 6498 host_rd = ncr_cache; 6499 ncr_rd = INL (nc_scratcha); 6500 ncr_bk = INL (nc_temp); 6501 /* 6502 ** Reset ncr chip 6503 */ 6504 OUTB (nc_istat, SRST); 6505 OUTB (nc_istat, 0 ); 6506 /* |
6507 ** check for timeout 6508 */ 6509 if (i>=NCR_SNOOP_TIMEOUT) { 6510 printf ("CACHE TEST FAILED: timeout.\n"); 6511 return (0x20); 6512 }; 6513 /* 6514 ** Check termination position. 6515 */ 6516 if (pc != vtophys (&np->script->snoopend)+8) { 6517 printf ("CACHE TEST FAILED: script execution failed.\n"); 6518 return (0x40); 6519 }; 6520 /* |
|
6492 ** Show results. 6493 */ 6494 if (host_wr != ncr_rd) { 6495 printf ("CACHE TEST FAILED: host wrote %d, ncr read %d.\n", 6496 (int) host_wr, (int) ncr_rd); 6497 err |= 1; 6498 }; 6499 if (host_rd != ncr_wr) { --- 188 unchanged lines hidden --- | 6521 ** Show results. 6522 */ 6523 if (host_wr != ncr_rd) { 6524 printf ("CACHE TEST FAILED: host wrote %d, ncr read %d.\n", 6525 (int) host_wr, (int) ncr_rd); 6526 err |= 1; 6527 }; 6528 if (host_rd != ncr_wr) { --- 188 unchanged lines hidden --- |