Feb 24, 1999 frc7v-cl1: Server Solaris 2.6、cc ドライバのテスト --- クライアントシステム上での cc ドライバのデバッグ#01(その3) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (http://www-online.kek.jp/~inoue/CAMAC/onl8v1-sol2.6-serv/ Cli1-CAMAC/debug-step03.txt) 高エネルギー加速器研究機構 素粒子原子核研究所 物理、オンライングループ 井上 栄二 (1). 現状確認 (A). 株式会社ロジックハウスの白田様より SPARC CPU-8VT と、VMEドライバ v2.3.1 を借用した。 (B). 株式会社ロジックハウスの白田様より Server Solaris 2.6 のシステム がインストールされているハードディスクを借用した。 (C). 借用したハードディスクのサーバ側のシステム設定を変更して、KEK の FP クラスタ上で立ち上げた。 (D). ファイルを直接修正する方法で、クライアント(その1)側のシステム 設定を変更したがクライアントは立ち上がれなかった。 (E). Solsticeを起動してホストマネージャを使って、frc7v-cl1ディスクレス クライアントの設定をやり直した。 (F). ディスクレス・クライアントのシステム、frc7v-cl1 が起動できること を確認した。 (G). frc7v-cl1 のシステムにVMEドライバ、FRCvme-2.3.1 をインストールし、 その後、frc7v-cl1 のシステム設定をやり直した。 (H). Solsticeを起動してホストマネージャを使って、frc7v-cl2ディスクレス クライアントの設定をやり直した。 (I). ディスクレス・クライアントのシステム、frc7v-cl2 が起動できること を確認した。 (J). frc7v-cl1、クライアントのシステムに ccドライバをインストールした。 (K). frc7v-cl1、クライアントのシステム上でサンプル・プログラムを実行 シングルアクションの 24ビットread/write は ok. LAM割り込み処理は、ok. ブロック転送 read/write は NG. (L). CPU-7Vのボードで FRCvme2.3.1 が正しく動作できることを確認した。 (M). frc8vt、サーバ・システムに ccドライバをインストールした。 (N). frc8vt、サーバ・システム上でンプル・プログラムを実行 シングルアクションの 24ビットread/write は ok. LAM割り込み処理は、ok. ブロック転送 read/write は 16 および 24ビットとも、ok. (O). 株式会社ロジックハウスの高橋様の修正された ccドライバを実行したが 状況に変化はなかった。 (P). 株式会社ロジックハウスの白田様の提案より、デスクレス・クライアント のシステムにローカル・ディスクをつなぎ、マウントした後で ccドライバ を実行したが状況に変化はなかった。 (2). ここでやるべきこと frc7v-cl1、ディスクレス・クライアント・システムは cc.cプログラム中の どの命令を実行した時にパニックを起こすのか調べる。 (3). cc.cプログラムにトレースのための文を追記して実行する (3-1). デバッグのための文を追記する frc7v-cl1[56]% pwd /export/home/frc7v-cl1/inoue/CAMAC/Driver/FORCE-5V-sol2.5 frc7v-cl1[57]% vi cc.c : : static void cc_minphys(struct buf *bp) { if (bp->b_bcount > CC_MINPHYS_SIZE) bp->b_bcount = CC_MINPHYS_SIZE; return; } /* change logichouse */ /* setup DMA limit */ /* static ddi_dma_lim_t dma_lim = { 0, 0xffffffff, 0xffff, 0x2, 0x2, 1024 }; */ /* end */ static int cc_strategy(struct buf *bp) { register struct cc_device *cc = &ccdevice[0]; register struct K_REG *k = cc->k; register u_long dma_addr; register mode = cc->mode; register naf = cc->naf; register int wc = (mode & CC_BIT16) ? cc->len : cc->len * 2; register u_int flags; /* E.Inoue: from */ uprintf(" cc_strategy: debug step03. --- enter cc_strategy()\n"); /* E.Inoue: end */ /* check DMA mode and set flags */ switch (cc->naf & 0x0018) { case 0x0000: /* CAMAC read */ /* E.Inoue: from */ uprintf(" cc_strategy: debug step04. --- found the camac read\n"); /* E.Inoue: end */ flags = DDI_DMA_READ; break; case 0x0010: /* CAMAC write */ flags = DDI_DMA_WRITE; break; default: cc->status = CC_STA_BLOCK_INVFUNC; return 0; } /* change logichouse */ /* setup DMA bufer */ if((ddi_dma_buf_bind_handle(cc->handle, bp , flags | DDI_DMA_CONSISTENT, DDI_DMA_SLEEP, (caddr_t)0, &cc->dma_cookie, &cc->ccount) != DDI_DMA_MAPPED)){ cmn_err(CE_WARN,"cc_strategy: ddi_dma_buf_bind_handle failed"); bp->b_flags |= B_ERROR; bp->b_error = EIO; return bp->b_flags; } /* if (ddi_dma_buf_setup(cc->dip, bp, flags, DDI_DMA_SLEEP, NULL, &dma_lim, &cc->handle) != DDI_DMA_MAPPED) { bp->b_error |= EIO; bp->b_flags |= B_ERROR; return bp->b_flags; } */ /* get a virtual address to hand to our device */ /* if (ddi_dma_htoc(cc->handle, NULL, &cc->dma_cookie) != DDI_SUCCESS) { bp->b_error |= EIO; bp->b_flags |= B_ERROR; return bp->b_flags; } */ /* end */ /* set up variables */ cc->bp = bp; dma_addr = cc->dma_cookie.dmac_address; /* count = cc->dma_cookie.dmac_size; */ /* */ uprintf("count in 32bit=%d\n", cc->dma_cookie.dmac_size); /* */ cc->retlen = 0; /* k->csr = CC_RST; */ /* K2917 Reset */ if (cc->klist == CC_KLIST_NO) { k->cma = CC_CMA_INIT; /* Initialize memory pointer */ k->cmr = mode | (cc->cur_crate << 8); k->cmr = naf; k->cmr = -(cc->len & 0xFFFF); /* Max len = 1MWord */ k->cmr = 0xFFFF; k->cmr = CC_HALT; k->cma = CC_CMA_INIT; /* Reset memory pointer */ k->maclo = dma_addr & 0xFFFF; /* Set DMA base address */ k->machi = dma_addr >> 16; k->amr = CC_AMR_INIT; /* Set VME AM code */ k->mtc = wc; k->cser = CC_DMA_RESET; /* DMA reset */ switch (cc->naf & 0x0018) { case 0x0000: /* CAMAC read */ k->docr = CC_DOCR_INIT | CC_DMA_READ; k->sccr = CC_DMA_START; k->csr |= CC_DMA; /* DMA mode */ k->csr &= ~CC_WRITE; break; case 0x0010: /* CAMAC write */ k->docr = CC_DOCR_INIT | CC_DMA_WRITE; k->sccr = CC_DMA_START; k->csr |= CC_DMA; /* DMA mode */ k->csr |= CC_WRITE; break; default: /* ERROR */ cc->status = CC_STA_BLOCK_INVFUNC; return 0; } } /* Kinetic list-processing */ else { k->cma = now_cma; /* Initialize memory pointer */ k->maclo = dma_addr & 0xFFFF; /* Set DMA base address */ k->machi = dma_addr >> 16; k->amr = CC_AMR_INIT; /* Set VME AM code */ k->mtc = now_wc; k->cser = CC_DMA_RESET; /* DMA reset */ k->docr = CC_DOCR_INIT | CC_DMA_READ; k->sccr = CC_DMA_START; k->csr |= CC_DMA; /* DMA mode */ k->csr &= ~CC_WRITE; } /* E.Inoue: from */ uprintf(" cc_strategy: debug step05. --- start DMA\n"); /* E.Inoue: end */ /* start DMA */ cc->executing_dma_flag = 1; cc->timeout_id = timeout(cc_timeout, NULL, CC_TIMEOUT_DMA * hz); k->csr |= CC_GO; /* Go! */ k->donc = CC_INT_AUTO_CLEAR | CC_INT_ENABLE | intrpri; /* wait at physio() */ return 0; } static int camac_b(struct cc_device *cc, u_short mode, u_short naf, int len, int *retlen) { register dev_t dev = cc->dev; register struct K_REG *k = cc->k; register struct uio *uio = cc->uio; /* E.Inoue: from */ uprintf(" camac_b: debug step01. --- enter camac_b()\n"); /* E.Inoue: end */ cc->klist = CC_KLIST_NO; cc->mode = mode; cc->naf = naf; cc->len = len; /* set uio for DMA */ uio->uio_iov->iov_base = (caddr_t)cc->ptr_udata; uio->uio_iov->iov_len = (mode & CC_BIT16) ? len * 2: len * 4; uio->uio_iovcnt = 1; uio->uio_segflg = UIO_USERSPACE; uio->uio_offset = 0; /* */ uprintf(" in: 0x%x %d %d %d %d %d\n", uio->uio_iov->iov_base, uio->uio_iov->iov_len, uio->uio_iovcnt, uio->uio_resid, uio->uio_segflg, uio->uio_offset); /* */ /* execute DMA transfer */ switch (cc->naf & 0x0018) { case 0x0000: /* CAMAC read */ /* E.Inoue: from */ uprintf(" camac_b: debug step02. --- call physio()\n"); /* E.Inoue: end */ physio(cc_strategy, NULL, dev, B_READ, cc_minphys, uio); break; case 0x0010: /* CAMAC write */ physio(cc_strategy, NULL, dev, B_WRITE, cc_minphys, uio); break; default: cc->status = CC_STA_BLOCK_INVFUNC; return 0; } k->donc = CC_INT_AUTO_CLEAR | intrpri; cc->camac_qx = k->csr; cc_sys_status = cc->bp->b_error; /* check timeout */ if (cc->interrupt & CC_INT_TIMEOUT ) { cc->interrupt &= ~CC_INT_TIMEOUT; cc->status = CC_STA_BLOCK_TIMEOUT; *retlen = 0; return cc->status; } /* uprintf("out: %d %d %d %d %d\n", uio->uio_iov->iov_len, uio->uio_iovcnt, uio->uio_resid, uio->uio_segflg, uio->uio_offset); */ /* Q-STOP mode or no error */ if ((mode & CC_QSCAN) == 0 || (k->csr & CC_ERR) == 0) { if ((mode & CC_BIT16) == 0) { cc->retlen = cc->len - k->mtc / 2; /* retlen=number of transfer */ if ((mode & CC_QSCAN) == 0 && (k->csr & CC_ERR) != 0) /* Q-STOP */ cc->retlen = cc->retlen - 2; /* delete the data of Q=0 */ cc->ptr_udata += cc->retlen * 2; /* ptr(2bytes),retlen(4bytes) */ cc->len_udata += cc->retlen * 2; } else { cc->retlen = cc->len - k->mtc; if ((mode & CC_QSCAN) == 0 && (k->csr & CC_ERR) != 0) /* Q-STOP */ cc->retlen--; /* delete the data of Q=0 */ cc->ptr_udata += cc->retlen; /* ptr(2bytes),retlen(2bytes) */ cc->len_udata += cc->retlen; } } /* return */ *retlen = cc->retlen; return cc->status; } : frc7v-cl1[58]% (3-2). cc.c をコンパイルし直す frc7v-cl1[58]% make ./script/cc_build.sh [Building for sun4m] rm -f cc.o frc7v-cl1[59]% (3-3). cc および cc.confファイル /usr/kernel/drv ディレクトリにコピーする frc8vt# pwd /usr/kernel/drv frc8vt# ls -l cc* -rw-r--r-- 1 root other 54940 Feb 18 16:58 cc -rw-r--r-- 1 root other 288 Feb 18 17:00 cc.conf frc8vt# rcp frc7v-cl1:/export/home/frc7v-cl1/inoue/CAMAC/Driver/FORCE-5V-sol2.5/ cc . frc8vt# rcp frc7v-cl1:/export/home/frc7v-cl1/inoue/CAMAC/Driver/FORCE-5V-sol2.5/ cc.conf . frc8vt# ls -l cc* -rw-r--r-- 1 root other 55552 Feb 24 14:25 cc -rw-r--r-- 1 root other 288 Feb 24 14:26 cc.conf frc8vt# (3-4). ccドライバをロードし直す frc7v-cl1# pwd /export/home/frc7v-cl1/inoue/CAMAC/Driver/FORCE-5V-sol2.5 frc7v-cl1# make unload ./script/cc_unload.sh [Removing CAMAC device driver] [Removing CAMAC device driver from system] [Deleting CAMAC device files] frc7v-cl1# make load ./script/cc_load.sh [Installing CAMAC device driver] cp: cannot create /usr/kernel/drv/cc: Read-only file system cp: cannot create /usr/kernel/drv/cc.conf: Read-only file system [Adding CAMAC device driver to system] [Configuring CAMAC device driver] [Making CAMAC device files] frc7v-cl1# ls -l /dev/cc lrwxrwxrwx 1 root other 69 Feb 24 1999 /dev/cc -> /devices/iommu@ 0,10000000/sbus@0,10001000/VME@5,ffffe00/cc@2d,ff00:cc frc7v-cl1# (3-5). の例題プログラムを実行する (3-5-1). cam1、シングル・アクション 24ビット camac read/write の実行 frc7v-cl1[65]% cam1 Input n a f (data)>3 0 0 N=3 A=0 F=0 Q=1 X=1 Data:000000(Hex) 00000000(Dec) Input n a f (data)>3 0 16 555 N=3 A=0 F=16 Q=1 X=1 Data:00022B(Hex) 00000555(Dec) Input n a f (data)>3 0 0 N=3 A=0 F=0 Q=1 X=1 Data:00022B(Hex) 00000555(Dec) Input n a f (data)>3 0 16 0 N=3 A=0 F=16 Q=1 X=1 Data:000000(Hex) 00000000(Dec) Input n a f (data)>3 0 0 N=3 A=0 F=0 Q=1 X=1 Data:000000(Hex) 00000000(Dec) Input n a f (data)>^Cfrc7v-cl1[66]% frc7v-cl1[66]% ok. 正常終了した。 (3-5-2). cam3、camac LAM割り込み処理の実行 frc7v-cl1[66]% cam3 *** Now waiting LAM ... N=3 Loop=10 Timeout=0 sec Interrupted !! count=1 Interrupted !! count=2 Interrupted !! count=3 Interrupted !! count=4 Interrupted !! count=5 Interrupted !! count=6 Interrupted !! count=7 Interrupted !! count=8 Interrupted !! count=9 Interrupted !! count=10 *** cam3 nomal end. frc7v-cl1[67]% ok. 正常終了した。 (3-5-3). cam2、ブロック転送 16ビット read/write の実行 frc7v-cl1[67]% cam2 Input transfer mode (1:word 2:long word) >1 Input loop >5 Input mode (0:QSTOP 1:QIGNORE 2:QREPEAT 3:QSCAN) >1 Input data counts >5 Input n a f >3 0 0 camac_b: debug step01. --- enter camac_b() in: 0x3f53c0 10 1 34 0 0 camac_b: debug step02. --- call physio() cc_strategy: debug step03. --- enter cc_strategy() cc_strategy: debug step04. --- found the camac read count in 32bit=10 cc_strategy: debug step05. --- start DMA BAD TRAP: type=9 rp=fc09c8ec addr=f6108f5c mmu_fsr=326 rw=1 cam2: Data fault kernel read fault at addr=0xf6108f5c, pme=0x0 MMU sfsr=326: Invalid Address on supv data fetch at level 3 pte addr = 0xf6073820, level = 3 wrong ctx/as ctx 0, as 0xf59145b0 wrong ctx/as 2 ctx 0, as 0xc8 pid=691, pc=0xf5fdc45c, sp=0xfc09c938, psr=0x44010c2, context=0 g1-g7: f5900000, f026f0bc, a00, c00, 200, 1, f5e4e840 Begin traceback... sp = fc09c938 Called from f5fd4dd0, fp=fc09c9a0, args=f5ee59d0 2a 600 fc09cad8 f6071f00 f00000 Called from f00bd3ac, fp=fc09ca70, args=f00000 5 600 2a fc09cb08 f5ee59d0 Called from f0068900, fp=fc09cb80, args=f5937ab8 f5f5750c 22 3 22 3 Called from 11f30, fp=effff8c0, args=1 600 3f53c0 5 24a70 24a80 End traceback... panic: Data fault syncing file systems... 2 done 2734 static and sysmap kernel pages 96 dynamic kernel data pages 494 kernel-pageable pages 0 segkmap kernel pages 0 segvn kernel pages 287 current user process pages 3611 total pages (3611 chunks) dumping to vp f5bebdec, offset 36624 - nfs_dump: bindresvport failed: Permission denied 0 total pages, dump i/o error rebooting... Resetting ... screen not found. Can't open input device. Keyboard not present. Using tty for input and output. SPARC CPU-7V, No Keyboard ROM Rev. 2.15.1, 64 MB memory installed, Serial #9157050. Ethernet address 0:80:42:b:49:ba, Host ID: 808bb9ba. apply failed. Rebooting with command: Boot device: /iommu/sbus/ledma@5,8400010/le@5,8c00000 File and args: 2dc00 hostname: frc7v-cl1 domainname: kek.jp root server: frc8vt root directory: /export/root/frc7v-cl1 | Type 'go' to resume Type help for more information ok ok boot kadb net Resetting ... screen not found. Can't open input device. Keyboard not present. Using tty for input and output. SPARC CPU-7V, No Keyboard ROM Rev. 2.15.1, 64 MB memory installed, Serial #9157050. Ethernet address 0:80:42:b:49:ba, Host ID: 808bb9ba. apply failed. Rebooting with command: kadb net Boot device: /iommu/sbus/ledma@5,8400010/le@5,8c00000 File and args: kadb net 2dc00 hostname: frc7v-cl1 domainname: kek.jp root server: frc8vt root directory: /export/root/frc7v-cl1 kadb: kernel/unix Size: 243560+176918+41926 Bytes /platform/sun4m/kernel/unix loaded - 0xa1000 bytes used SunOS Release 5.6 Version Generic_105181-05 [UNIX(R) System V Release 4.0] Copyright (c) 1983-1997, Sun Microsystems, Inc. configuring network interfaces: le0. Hostname: frc7v-cl1 Mounting /dev/swap for swap Configuring the /devices directory FRCvme V2.3.1 VME Nexus (FGA-5000 FGA-5100) NOTICE: VME: slavewin at vme=0x0, size=0x100000 space=0x2d020617 CAMAC device driver V1.3x, 1991-1993 by Y.TAKEUCHI (T.I.T.) cc0 at VME0: vme16d16 0xff00 VME level 4 vector 0xff sparc ipl 7 vmemem0 at VME0: vme32d16 0x0 vmemem1 at VME0: vme16d16 0x0 vmemem2 at VME0: vme24d16 0x0 vmemem3 at VME0: vme32d32 0x0 vmemem4 at VME0: vme16d32 0x0 vmemem5 at VME0: vme24d32 0x0 vmeplus0 at VME0: vme16d16 0x0 and vme24d16 0x0 and vme32d16 0x0 and vme16d32 0x 0 and vme24d32 0x0 and vme32d32 0x0 and space 0x2f offset 0x0 and space 0x6f offset 0x0 and space 0x10 offset 0x0 and space 0x11 offset 0x0 and space 0x50 offset 0x0 and space 0x51 offset 0x0 vmedma0 at VME0 vmefdma0 at VME0 vmedvma0 at VME0 vmectl0 at VME0 Configuring the /dev directory Configuring the /dev directory (compatibility devices) The system is coming up. Please wait. default ICCFP1.kek.jp done add net default: gateway ICCFP1 NIS domainname is kek.jp starting rpc services: rpcbind keyserv done. Setting netmask of le0 to 255.255.252.0 Setting default interface for multicast: add net 224.0.0.0: gateway frc7v-cl1 syslog service starting. syslogd: line 24: unexpected getnetconfig failure Print services started. volume management starting. Wnn6: Key License Server started.... Nihongo Multi Client Server (Wnn6 R2.30) Finished Reading Files The system is ready. frc7v-cl1 console login: onlsun1[37]% !! rlogin frc7v-cl1 Password: No directory! Logging in with home=/ Last login: Wed Feb 24 14:06:51 from onlax2.kek.jp Sun Microsystems Inc. SunOS 5.6 Generic August 1997 frc7v-cl1% su Password: # mount frc8vt:/export/home/frc8vt /export/home/frc7v-cl1 # frc7v-cl1% logout Connection closed. onlsun1[38]% !! rlogin frc7v-cl1 Last login: Wed Feb 24 14:49:06 from onlsun1.kek.jp Sun Microsystems Inc. SunOS 5.6 Generic August 1997 frc7v-cl1[33]% ls -l total 6 drwxr-xr-x 3 inoue staff 512 Feb 9 15:34 CAMAC/ drwxr-xr-x 3 inoue staff 512 Nov 6 11:07 FORCE/ drwxr-xr-x 2 inoue staff 512 Feb 18 10:29 Ktaka/ frc7v-cl1[34]% (4). トレース結果の考察 frc7v-cl1[67]% cam2 Input transfer mode (1:word 2:long word) >1 Input loop >5 Input mode (0:QSTOP 1:QIGNORE 2:QREPEAT 3:QSCAN) >1 Input data counts >5 Input n a f >3 0 0 camac_b: debug step01. --- enter camac_b() in: 0x3f53c0 10 1 34 0 0 camac_b: debug step02. --- call physio() cc_strategy: debug step03. --- enter cc_strategy() cc_strategy: debug step04. --- found the camac read count in 32bit=10 cc_strategy: debug step05. --- start DMA トレースの結果、cam2 の実行は DMA の開始時点までは正常に実行できている のを確認できた。 この後ろの部分は、いまのところトレースのための文が 入れてないので確認できていない。 camac_b() (1). DMA用の uio の設定 i/o ベクター・ベースの設定 i/o ベクター長の設定 i/o ベクター・カウントの設定 uio セグメント・フラッグ --- UIO_USERSPACE を使用 uio オフセット --- オフセットなし (2). physio() | | +-> cc_strategy() (1). camac ブロック read であることを確認 (2). DMAバッファをセットアップ (3). K2917 をリセット (4). Command Memory Address Register を設定 K2917 のメモリ・ポインタを初期化 (5). Command Memory Register を設定 (6). Memory Address Counter Low を設定 DMA base address を設定 (7). Memory Address Counter High を設定 DMA base address を設定 (8). Address Modifier Register を設定 VME AMコードを設定 (9). Memory Transfer Count Register を設定 (10). Channel Status/Error Register を設定 (11). Device/Operation Control Register を設定 (12). Sequence/Channel Control Register を設定 (13). Control Status Register を設定 この時点までは実行されている。 (14). スタート DMA (15). cc_strategyルーチンからリターン ----xxxx ここまでやった。  継続中。 --- (6). セクション (6-1). サブセクション (6-1-1). サブサブセクション