Deleted Added
full compact
ncr.c (33181) ncr.c (34961)
1/**************************************************************************
2**
1/**************************************************************************
2**
3** $Id: ncr.c,v 1.114 1998/02/04 03:47:16 eivind Exp $
3** $Id: ncr.c,v 1.115 1998/02/09 06:10:56 eivind Exp $
4**
5** Device driver for the NCR 53C810 PCI-SCSI-Controller.
6**
7** FreeBSD / NetBSD
8**
9**-------------------------------------------------------------------------
10**
11** Written for 386bsd and FreeBSD by

--- 481 unchanged lines hidden (view full) ---

493/*---------------------------------------
494**
495** Timestamps for profiling
496**
497**---------------------------------------
498*/
499
500struct tstamp {
4**
5** Device driver for the NCR 53C810 PCI-SCSI-Controller.
6**
7** FreeBSD / NetBSD
8**
9**-------------------------------------------------------------------------
10**
11** Written for 386bsd and FreeBSD by

--- 481 unchanged lines hidden (view full) ---

493/*---------------------------------------
494**
495** Timestamps for profiling
496**
497**---------------------------------------
498*/
499
500struct tstamp {
501 struct timeval start;
502 struct timeval end;
503 struct timeval select;
504 struct timeval command;
505 struct timeval data;
506 struct timeval status;
507 struct timeval disconnect;
508 struct timeval reselect;
501 int start;
502 int end;
503 int select;
504 int command;
505 int data;
506 int status;
507 int disconnect;
508 int reselect;
509};
510
511/*
512** profiling data (per device)
513*/
514
515struct profile {
516 u_long num_trans;

--- 765 unchanged lines hidden (view full) ---

1282**
1283**
1284**==========================================================
1285*/
1286
1287#ifdef KERNEL
1288static void ncr_alloc_ccb (ncb_p np, u_long target, u_long lun);
1289static void ncr_complete (ncb_p np, ccb_p cp);
509};
510
511/*
512** profiling data (per device)
513*/
514
515struct profile {
516 u_long num_trans;

--- 765 unchanged lines hidden (view full) ---

1282**
1283**
1284**==========================================================
1285*/
1286
1287#ifdef KERNEL
1288static void ncr_alloc_ccb (ncb_p np, u_long target, u_long lun);
1289static void ncr_complete (ncb_p np, ccb_p cp);
1290static int ncr_delta (struct timeval * from, struct timeval * to);
1290static int ncr_delta (int * from, int * to);
1291static void ncr_exception (ncb_p np);
1292static void ncr_free_ccb (ncb_p np, ccb_p cp, int flags);
1293static void ncr_selectclock (ncb_p np, u_char scntl3);
1294static void ncr_getclock (ncb_p np, u_char multiplier);
1295static ccb_p ncr_get_ccb (ncb_p np, u_long flags, u_long t,u_long l);
1296static u_int32_t ncr_info (int unit);
1297static void ncr_init (ncb_p np, char * msg, u_long code);
1298static void ncr_intr (void *vnp);

--- 38 unchanged lines hidden (view full) ---

1337** Global static data.
1338**
1339**
1340**==========================================================
1341*/
1342
1343
1344static char ident[] =
1291static void ncr_exception (ncb_p np);
1292static void ncr_free_ccb (ncb_p np, ccb_p cp, int flags);
1293static void ncr_selectclock (ncb_p np, u_char scntl3);
1294static void ncr_getclock (ncb_p np, u_char multiplier);
1295static ccb_p ncr_get_ccb (ncb_p np, u_long flags, u_long t,u_long l);
1296static u_int32_t ncr_info (int unit);
1297static void ncr_init (ncb_p np, char * msg, u_long code);
1298static void ncr_intr (void *vnp);

--- 38 unchanged lines hidden (view full) ---

1337** Global static data.
1338**
1339**
1340**==========================================================
1341*/
1342
1343
1344static char ident[] =
1345 "\n$Id: ncr.c,v 1.114 1998/02/04 03:47:16 eivind Exp $\n";
1345 "\n$Id: ncr.c,v 1.115 1998/02/09 06:10:56 eivind Exp $\n";
1346
1347static const u_long ncr_version = NCR_VERSION * 11
1348 + (u_long) sizeof (struct ncb) * 7
1349 + (u_long) sizeof (struct ccb) * 5
1350 + (u_long) sizeof (struct lcb) * 3
1351 + (u_long) sizeof (struct tcb) * 2;
1352
1353#ifdef KERNEL

--- 112 unchanged lines hidden (view full) ---

1466
1467#define NADDR(label) (RELOC_SOFTC | offsetof(struct ncb, label))
1468#define PADDR(label) (RELOC_LABEL | offsetof(struct script, label))
1469#define PADDRH(label) (RELOC_LABELH | offsetof(struct scripth, label))
1470#define RADDR(label) (RELOC_REGISTER | REG(label))
1471#define FADDR(label,ofs)(RELOC_REGISTER | ((REG(label))+(ofs)))
1472#define KVAR(which) (RELOC_KVAR | (which))
1473
1346
1347static const u_long ncr_version = NCR_VERSION * 11
1348 + (u_long) sizeof (struct ncb) * 7
1349 + (u_long) sizeof (struct ccb) * 5
1350 + (u_long) sizeof (struct lcb) * 3
1351 + (u_long) sizeof (struct tcb) * 2;
1352
1353#ifdef KERNEL

--- 112 unchanged lines hidden (view full) ---

1466
1467#define NADDR(label) (RELOC_SOFTC | offsetof(struct ncb, label))
1468#define PADDR(label) (RELOC_LABEL | offsetof(struct script, label))
1469#define PADDRH(label) (RELOC_LABELH | offsetof(struct scripth, label))
1470#define RADDR(label) (RELOC_REGISTER | REG(label))
1471#define FADDR(label,ofs)(RELOC_REGISTER | ((REG(label))+(ofs)))
1472#define KVAR(which) (RELOC_KVAR | (which))
1473
1474#define KVAR_TIME_TV_SEC (0)
1475#define KVAR_TIME (1)
1474#define KVAR_SECOND (0)
1475#define KVAR_TICKS (1)
1476#define KVAR_NCR_CACHE (2)
1477
1478#define SCRIPT_KVAR_FIRST (0)
1479#define SCRIPT_KVAR_LAST (3)
1480
1481/*
1482 * Kernel variables referenced in the scripts.
1483 * THESE MUST ALL BE ALIGNED TO A 4-BYTE BOUNDARY.
1484 */
1485static void *script_kvars[] =
1476#define KVAR_NCR_CACHE (2)
1477
1478#define SCRIPT_KVAR_FIRST (0)
1479#define SCRIPT_KVAR_LAST (3)
1480
1481/*
1482 * Kernel variables referenced in the scripts.
1483 * THESE MUST ALL BE ALIGNED TO A 4-BYTE BOUNDARY.
1484 */
1485static void *script_kvars[] =
1486 { &time.tv_sec, &time, &ncr_cache };
1486 { &time_second, &ticks, &ncr_cache };
1487
1488static struct script script0 = {
1489/*--------------------------< START >-----------------------*/ {
1490 /*
1491 ** Claim to be still alive ...
1492 */
1493 SCR_COPY (sizeof (((struct ncb *)0)->heartbeat)),
1487
1488static struct script script0 = {
1489/*--------------------------< START >-----------------------*/ {
1490 /*
1491 ** Claim to be still alive ...
1492 */
1493 SCR_COPY (sizeof (((struct ncb *)0)->heartbeat)),
1494 KVAR (KVAR_TIME_TV_SEC),
1494 KVAR (KVAR_SECOND),
1495 NADDR (heartbeat),
1496 /*
1497 ** Make data structure address invalid.
1498 ** clear SIGP.
1499 */
1500 SCR_LOAD_REG (dsa, 0xff),
1501 0,
1502 SCR_FROM_REG (ctest2),

--- 202 unchanged lines hidden (view full) ---

1705 */
1706 SCR_COPY (8),
1707 PADDR (idle),
1708 NADDR (header.launch),
1709 /*
1710 ** Set a time stamp for this selection
1711 */
1712 SCR_COPY (sizeof (struct timeval)),
1495 NADDR (heartbeat),
1496 /*
1497 ** Make data structure address invalid.
1498 ** clear SIGP.
1499 */
1500 SCR_LOAD_REG (dsa, 0xff),
1501 0,
1502 SCR_FROM_REG (ctest2),

--- 202 unchanged lines hidden (view full) ---

1705 */
1706 SCR_COPY (8),
1707 PADDR (idle),
1708 NADDR (header.launch),
1709 /*
1710 ** Set a time stamp for this selection
1711 */
1712 SCR_COPY (sizeof (struct timeval)),
1713 KVAR (KVAR_TIME),
1713 KVAR (KVAR_TICKS),
1714 NADDR (header.stamp.select),
1715 /*
1716 ** load the savep (saved pointer) into
1717 ** the TEMP register (actual pointer)
1718 */
1719 SCR_COPY (4),
1720 NADDR (header.savep),
1721 RADDR (temp),

--- 165 unchanged lines hidden (view full) ---

1887 SCR_FROM_REG (SS_REG),
1888 0,
1889/*<<<*/ SCR_JUMPR ^ IFTRUE (DATA (S_CHECK_COND)),
1890 28,
1891 /*
1892 ** ... set a timestamp ...
1893 */
1894 SCR_COPY (sizeof (struct timeval)),
1714 NADDR (header.stamp.select),
1715 /*
1716 ** load the savep (saved pointer) into
1717 ** the TEMP register (actual pointer)
1718 */
1719 SCR_COPY (4),
1720 NADDR (header.savep),
1721 RADDR (temp),

--- 165 unchanged lines hidden (view full) ---

1887 SCR_FROM_REG (SS_REG),
1888 0,
1889/*<<<*/ SCR_JUMPR ^ IFTRUE (DATA (S_CHECK_COND)),
1890 28,
1891 /*
1892 ** ... set a timestamp ...
1893 */
1894 SCR_COPY (sizeof (struct timeval)),
1895 KVAR (KVAR_TIME),
1895 KVAR (KVAR_TICKS),
1896 NADDR (header.stamp.command),
1897 /*
1898 ** ... and send the command
1899 */
1900 SCR_MOVE_TBL ^ SCR_COMMAND,
1901 offsetof (struct dsb, cmd),
1902 SCR_JUMP,
1903 PADDR (dispatch),

--- 5 unchanged lines hidden (view full) ---

1909 SCR_JUMP,
1910 PADDR (dispatch),
1911
1912}/*-------------------------< STATUS >--------------------*/,{
1913 /*
1914 ** set the timestamp.
1915 */
1916 SCR_COPY (sizeof (struct timeval)),
1896 NADDR (header.stamp.command),
1897 /*
1898 ** ... and send the command
1899 */
1900 SCR_MOVE_TBL ^ SCR_COMMAND,
1901 offsetof (struct dsb, cmd),
1902 SCR_JUMP,
1903 PADDR (dispatch),

--- 5 unchanged lines hidden (view full) ---

1909 SCR_JUMP,
1910 PADDR (dispatch),
1911
1912}/*-------------------------< STATUS >--------------------*/,{
1913 /*
1914 ** set the timestamp.
1915 */
1916 SCR_COPY (sizeof (struct timeval)),
1917 KVAR (KVAR_TIME),
1917 KVAR (KVAR_TICKS),
1918 NADDR (header.stamp.status),
1919 /*
1920 ** If this is a GETCC transfer,
1921 */
1922 SCR_FROM_REG (SS_REG),
1923 0,
1924/*<<<*/ SCR_JUMPR ^ IFFALSE (DATA (S_CHECK_COND)),
1925 40,

--- 288 unchanged lines hidden (view full) ---

2214 SCR_WAIT_DISC,
2215 0,
2216 /*
2217 ** Profiling:
2218 ** Set a time stamp,
2219 ** and count the disconnects.
2220 */
2221 SCR_COPY (sizeof (struct timeval)),
1918 NADDR (header.stamp.status),
1919 /*
1920 ** If this is a GETCC transfer,
1921 */
1922 SCR_FROM_REG (SS_REG),
1923 0,
1924/*<<<*/ SCR_JUMPR ^ IFFALSE (DATA (S_CHECK_COND)),
1925 40,

--- 288 unchanged lines hidden (view full) ---

2214 SCR_WAIT_DISC,
2215 0,
2216 /*
2217 ** Profiling:
2218 ** Set a time stamp,
2219 ** and count the disconnects.
2220 */
2221 SCR_COPY (sizeof (struct timeval)),
2222 KVAR (KVAR_TIME),
2222 KVAR (KVAR_TICKS),
2223 NADDR (header.stamp.disconnect),
2224 SCR_COPY (4),
2225 NADDR (disc_phys),
2226 RADDR (temp),
2227 SCR_REG_REG (temp, SCR_ADD, 0x01),
2228 0,
2229 SCR_COPY (4),
2230 RADDR (temp),

--- 226 unchanged lines hidden (view full) ---

2457/*
2458** Because the size depends on the
2459** #define MAX_SCATTER parameter,
2460** it is filled in at runtime.
2461**
2462** SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN)),
2463** PADDR (no_data),
2464** SCR_COPY (sizeof (struct timeval)),
2223 NADDR (header.stamp.disconnect),
2224 SCR_COPY (4),
2225 NADDR (disc_phys),
2226 RADDR (temp),
2227 SCR_REG_REG (temp, SCR_ADD, 0x01),
2228 0,
2229 SCR_COPY (4),
2230 RADDR (temp),

--- 226 unchanged lines hidden (view full) ---

2457/*
2458** Because the size depends on the
2459** #define MAX_SCATTER parameter,
2460** it is filled in at runtime.
2461**
2462** SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN)),
2463** PADDR (no_data),
2464** SCR_COPY (sizeof (struct timeval)),
2465** KVAR (KVAR_TIME),
2465** KVAR (KVAR_TICKS),
2466** NADDR (header.stamp.data),
2467** SCR_MOVE_TBL ^ SCR_DATA_IN,
2468** offsetof (struct dsb, data[ 0]),
2469**
2470** ##===========< i=1; i<MAX_SCATTER >=========
2471** || SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_IN)),
2472** || PADDR (checkatn),
2473** || SCR_MOVE_TBL ^ SCR_DATA_IN,

--- 10 unchanged lines hidden (view full) ---

2484/*
2485** Because the size depends on the
2486** #define MAX_SCATTER parameter,
2487** it is filled in at runtime.
2488**
2489** SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_OUT)),
2490** PADDR (no_data),
2491** SCR_COPY (sizeof (struct timeval)),
2466** NADDR (header.stamp.data),
2467** SCR_MOVE_TBL ^ SCR_DATA_IN,
2468** offsetof (struct dsb, data[ 0]),
2469**
2470** ##===========< i=1; i<MAX_SCATTER >=========
2471** || SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_IN)),
2472** || PADDR (checkatn),
2473** || SCR_MOVE_TBL ^ SCR_DATA_IN,

--- 10 unchanged lines hidden (view full) ---

2484/*
2485** Because the size depends on the
2486** #define MAX_SCATTER parameter,
2487** it is filled in at runtime.
2488**
2489** SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_OUT)),
2490** PADDR (no_data),
2491** SCR_COPY (sizeof (struct timeval)),
2492** KVAR (KVAR_TIME),
2492** KVAR (KVAR_TICKS),
2493** NADDR (header.stamp.data),
2494** SCR_MOVE_TBL ^ SCR_DATA_OUT,
2495** offsetof (struct dsb, data[ 0]),
2496**
2497** ##===========< i=1; i<MAX_SCATTER >=========
2498** || SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_OUT)),
2499** || PADDR (dispatch),
2500** || SCR_MOVE_TBL ^ SCR_DATA_OUT,

--- 552 unchanged lines hidden (view full) ---

3053
3054 assert ((u_long)p == (u_long)&scrh->tryloop + sizeof (scrh->tryloop));
3055
3056 p = scr->data_in;
3057
3058 *p++ =SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN));
3059 *p++ =PADDR (no_data);
3060 *p++ =SCR_COPY (sizeof (struct timeval));
2493** NADDR (header.stamp.data),
2494** SCR_MOVE_TBL ^ SCR_DATA_OUT,
2495** offsetof (struct dsb, data[ 0]),
2496**
2497** ##===========< i=1; i<MAX_SCATTER >=========
2498** || SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_OUT)),
2499** || PADDR (dispatch),
2500** || SCR_MOVE_TBL ^ SCR_DATA_OUT,

--- 552 unchanged lines hidden (view full) ---

3053
3054 assert ((u_long)p == (u_long)&scrh->tryloop + sizeof (scrh->tryloop));
3055
3056 p = scr->data_in;
3057
3058 *p++ =SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_IN));
3059 *p++ =PADDR (no_data);
3060 *p++ =SCR_COPY (sizeof (struct timeval));
3061 *p++ =(ncrcmd) KVAR (KVAR_TIME);
3061 *p++ =(ncrcmd) KVAR (KVAR_TICKS);
3062 *p++ =NADDR (header.stamp.data);
3063 *p++ =SCR_MOVE_TBL ^ SCR_DATA_IN;
3064 *p++ =offsetof (struct dsb, data[ 0]);
3065
3066 for (i=1; i<MAX_SCATTER; i++) {
3067 *p++ =SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_IN));
3068 *p++ =PADDR (checkatn);
3069 *p++ =SCR_MOVE_TBL ^ SCR_DATA_IN;

--- 7 unchanged lines hidden (view full) ---

3077
3078 assert ((u_long)p == (u_long)&scr->data_in + sizeof (scr->data_in));
3079
3080 p = scr->data_out;
3081
3082 *p++ =SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_OUT));
3083 *p++ =PADDR (no_data);
3084 *p++ =SCR_COPY (sizeof (struct timeval));
3062 *p++ =NADDR (header.stamp.data);
3063 *p++ =SCR_MOVE_TBL ^ SCR_DATA_IN;
3064 *p++ =offsetof (struct dsb, data[ 0]);
3065
3066 for (i=1; i<MAX_SCATTER; i++) {
3067 *p++ =SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_IN));
3068 *p++ =PADDR (checkatn);
3069 *p++ =SCR_MOVE_TBL ^ SCR_DATA_IN;

--- 7 unchanged lines hidden (view full) ---

3077
3078 assert ((u_long)p == (u_long)&scr->data_in + sizeof (scr->data_in));
3079
3080 p = scr->data_out;
3081
3082 *p++ =SCR_JUMP ^ IFFALSE (WHEN (SCR_DATA_OUT));
3083 *p++ =PADDR (no_data);
3084 *p++ =SCR_COPY (sizeof (struct timeval));
3085 *p++ =(ncrcmd) KVAR (KVAR_TIME);
3085 *p++ =(ncrcmd) KVAR (KVAR_TICKS);
3086 *p++ =NADDR (header.stamp.data);
3087 *p++ =SCR_MOVE_TBL ^ SCR_DATA_OUT;
3088 *p++ =offsetof (struct dsb, data[ 0]);
3089
3090 for (i=1; i<MAX_SCATTER; i++) {
3091 *p++ =SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_OUT));
3092 *p++ =PADDR (dispatch);
3093 *p++ =SCR_MOVE_TBL ^ SCR_DATA_OUT;

--- 1081 unchanged lines hidden (view full) ---

4175 /*---------------------------------------------------
4176 **
4177 ** timestamp
4178 **
4179 **----------------------------------------------------
4180 */
4181
4182 bzero (&cp->phys.header.stamp, sizeof (struct tstamp));
3086 *p++ =NADDR (header.stamp.data);
3087 *p++ =SCR_MOVE_TBL ^ SCR_DATA_OUT;
3088 *p++ =offsetof (struct dsb, data[ 0]);
3089
3090 for (i=1; i<MAX_SCATTER; i++) {
3091 *p++ =SCR_CALL ^ IFFALSE (WHEN (SCR_DATA_OUT));
3092 *p++ =PADDR (dispatch);
3093 *p++ =SCR_MOVE_TBL ^ SCR_DATA_OUT;

--- 1081 unchanged lines hidden (view full) ---

4175 /*---------------------------------------------------
4176 **
4177 ** timestamp
4178 **
4179 **----------------------------------------------------
4180 */
4181
4182 bzero (&cp->phys.header.stamp, sizeof (struct tstamp));
4183 gettime(&cp->phys.header.stamp.start);
4183 cp->phys.header.stamp.start = ticks;
4184
4185 /*----------------------------------------------------
4186 **
4187 ** Get device quirks from a speciality table.
4188 **
4189 **----------------------------------------------------
4190 */
4191

--- 278 unchanged lines hidden (view full) ---

4470 **----------------------------------------------------
4471 */
4472
4473 /*
4474 ** reselect pattern and activate this job.
4475 */
4476
4477 cp->jump_ccb.l_cmd = (SCR_JUMP ^ IFFALSE (DATA (cp->tag)));
4184
4185 /*----------------------------------------------------
4186 **
4187 ** Get device quirks from a speciality table.
4188 **
4189 **----------------------------------------------------
4190 */
4191

--- 278 unchanged lines hidden (view full) ---

4470 **----------------------------------------------------
4471 */
4472
4473 /*
4474 ** reselect pattern and activate this job.
4475 */
4476
4477 cp->jump_ccb.l_cmd = (SCR_JUMP ^ IFFALSE (DATA (cp->tag)));
4478 cp->tlimit = time.tv_sec + xp->timeout / 1000 + 2;
4478 cp->tlimit = time_second + xp->timeout / 1000 + 2;
4479 cp->magic = CCB_MAGIC;
4480
4481 /*
4482 ** insert into start queue.
4483 */
4484
4485 qidx = np->squeueput + 1;
4486 if (qidx >= MAX_START) qidx=0;

--- 951 unchanged lines hidden (view full) ---

5438** interrupts are not configured correctly.
5439**
5440**----------------------------------------------------------
5441*/
5442
5443static void ncr_timeout (void *arg)
5444{
5445 ncb_p np = arg;
4479 cp->magic = CCB_MAGIC;
4480
4481 /*
4482 ** insert into start queue.
4483 */
4484
4485 qidx = np->squeueput + 1;
4486 if (qidx >= MAX_START) qidx=0;

--- 951 unchanged lines hidden (view full) ---

5438** interrupts are not configured correctly.
5439**
5440**----------------------------------------------------------
5441*/
5442
5443static void ncr_timeout (void *arg)
5444{
5445 ncb_p np = arg;
5446 u_long thistime = time.tv_sec;
5446 u_long thistime = time_second;
5447 u_long step = np->ticks;
5448 u_long count = 0;
5449 long signed t;
5450 ccb_p cp;
5451
5452 if (np->lasttime != thistime) {
5453 /*
5454 ** block ncr interrupts

--- 300 unchanged lines hidden (view full) ---

5755
5756 ncr_log_hard_error(np, sist, dstat);
5757
5758 /*========================================
5759 ** do the register dump
5760 **========================================
5761 */
5762
5447 u_long step = np->ticks;
5448 u_long count = 0;
5449 long signed t;
5450 ccb_p cp;
5451
5452 if (np->lasttime != thistime) {
5453 /*
5454 ** block ncr interrupts

--- 300 unchanged lines hidden (view full) ---

5755
5756 ncr_log_hard_error(np, sist, dstat);
5757
5758 /*========================================
5759 ** do the register dump
5760 **========================================
5761 */
5762
5763 if (time.tv_sec - np->regtime.tv_sec>10) {
5763 if (time_second - np->regtime.tv_sec>10) {
5764 int i;
5764 int i;
5765 gettime(&np->regtime);
5765 getmicrotime(&np->regtime);
5766 for (i=0; i<sizeof(np->regdump); i++)
5767 ((char*)&np->regdump)[i] = INB_OFF(i);
5768 np->regdump.nc_dstat = dstat;
5769 np->regdump.nc_sist = sist;
5770 };
5771
5772
5773 /*----------------------------------------

--- 1547 unchanged lines hidden (view full) ---

7321**
7322**==========================================================
7323*/
7324
7325/*
7326** Compute the difference in milliseconds.
7327**/
7328
5766 for (i=0; i<sizeof(np->regdump); i++)
5767 ((char*)&np->regdump)[i] = INB_OFF(i);
5768 np->regdump.nc_dstat = dstat;
5769 np->regdump.nc_sist = sist;
5770 };
5771
5772
5773 /*----------------------------------------

--- 1547 unchanged lines hidden (view full) ---

7321**
7322**==========================================================
7323*/
7324
7325/*
7326** Compute the difference in milliseconds.
7327**/
7328
7329static int ncr_delta (struct timeval * from, struct timeval * to)
7329static int ncr_delta (int *from, int *to)
7330{
7330{
7331 if (!from->tv_sec) return (-1);
7332 if (!to ->tv_sec) return (-2);
7333 return ( (to->tv_sec - from->tv_sec - 2)*1000+
7334 +(to->tv_usec - from->tv_usec + 2000000)/1000);
7331 if (!from) return (-1);
7332 if (!to) return (-2);
7333 return ((to - from) * 1000 / hz);
7335}
7336
7337#define PROFILE cp->phys.header.stamp
7338static void ncb_profile (ncb_p np, ccb_p cp)
7339{
7340 int co, da, st, en, di, se, post,work,disc;
7341 u_long diff;
7342
7334}
7335
7336#define PROFILE cp->phys.header.stamp
7337static void ncb_profile (ncb_p np, ccb_p cp)
7338{
7339 int co, da, st, en, di, se, post,work,disc;
7340 u_long diff;
7341
7343 gettime(&PROFILE.end);
7342 PROFILE.end = ticks;
7344
7345 st = ncr_delta (&PROFILE.start,&PROFILE.status);
7346 if (st<0) return; /* status not reached */
7347
7348 da = ncr_delta (&PROFILE.start,&PROFILE.data);
7349 if (da<0) return; /* No data transfer phase */
7350
7351 co = ncr_delta (&PROFILE.start,&PROFILE.command);

--- 276 unchanged lines hidden ---
7343
7344 st = ncr_delta (&PROFILE.start,&PROFILE.status);
7345 if (st<0) return; /* status not reached */
7346
7347 da = ncr_delta (&PROFILE.start,&PROFILE.data);
7348 if (da<0) return; /* No data transfer phase */
7349
7350 co = ncr_delta (&PROFILE.start,&PROFILE.command);

--- 276 unchanged lines hidden ---