Path: utzoo!utgpu!watmath!att!rutgers!ucsd!usc!samsung!uunet!ibmpa!dolphin.tcspa.ibm.com!mlewis From: mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis) Newsgroups: comp.sys.ibm.pc.rt Subject: Fix for 6152 token-ring DOS Lan Support (part 3) IBM/4.3 Keywords: V1.19_kit.3 token-ring lan support 6152 IBM/4.3 Message-ID: <2932@ibmpa.UUCP> Date: 15 Nov 89 19:26:48 GMT Sender: news@ibmpa.UUCP Reply-To: mlewis@ibmsupt.UUCP () Organization: IBM AWD, Palo Alto Lines: 211 Subject: Fix for 6152 token-ring DOS Lan Support (part 3) IBM/4.3 Index: read.me, makefile, shutlan.c, tokclose.asm (DOS source files) Description: After using the DOS Lan facilities, the token-ring adapter is not closed. When Unix boots, it gets interrupts prior to completing the token-ring probe, attach, and open sequence. This results in Unix hanging during boot, which persists until the power is cycled. After suspending Unix and using the DOS Lan, the token-ring adapter is not reset properly during restart. This results in a failure of the open routine and leaves the network unreachable. This persists until Unix is rebooted. part 1 patch to the file /sys/ca_atr/if_lan.c part 2 uuencoded DOS executable shutlan.exe part 3 shar file containing read.me, and shutlan sources Fix: Unpack the following shar file. Make shutlan.exe and install it as described in part 2 of this kit. # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # # read.me # makefile # shutlan.c # tokclose.asm # echo x - read.me sed 's/^X//' >read.me << 'END-of-read.me' X X--------------------------------------------------------- X Make/Installation Instructions - Shutlan.exe X November 14, 1989 X--------------------------------------------------------- X X XIncluded are the files to make the DOS executable program Xshutlan.exe. These are: X X read.me This file X makefile DOS makefile X shutlan.c Main C routine X tokclose.asm Assembly routine to close adapter X XThe tools used to produce shutlan.exe are: X X IBM C/2 version 1.0 X IBM Macro Assembler/2 version 1.0 X XWith the make utility included in C/2 1.0, you may build Xshutlan.exe with the following command: X X make makefile X XInstall shutlan.exe somewhere in your DOS search path. X XIt is suggested that you modify all batch files that start Xor restart Unix. In each case, you should execute shutlan Xbefore Unix. In other words, add the line shutlan before Xthe Unix line in all such batch files. X XNote: If you are not using the DOS Lan Support, you do X not need to use shutlan. X END-of-read.me echo x - makefile sed 's/^X//' >makefile << 'END-of-makefile' X# X# (C) COPYRIGHT IBM CORPORATION 1989 X# LICENSED MATERIALS - PROPERTY OF IBM X# REFER TO COPYRIGHT INSTRUCTIONS FROM NUMBER G120-2083 X# X# if using codeview uncomment the following: X#CCOPTS=/Zi/Od X#LKOPTS=/CO X Xshutlan.obj: shutlan.c X cc shutlan/AS$(CCOPTS); X Xtokclose.obj: tokclose.asm X masm tokclose; X Xshutlan.exe: shutlan.obj tokclose.obj X link shutlan$(LKOPTS)+tokclose$(LKOPTS),shutlan,,slibc3; END-of-makefile echo x - shutlan.c sed 's/^X//' >shutlan.c << 'END-of-shutlan.c' X/* X * (C) COPYRIGHT IBM CORPORATION 1989 X * LICENSED MATERIALS - PROPERTY OF IBM X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 X * X * shutlan - shut down token ring adapters for call to Unix X * Note: shuts both adapters located at the normal places. X */ X X/* $Header: shutlan.c,v 1.2 89/11/14 15:52:08 mlewis Exp $ */ Xstatic char *rcsid = "$Header: shutlan.c,v 1.2 89/11/14 15:52:08 mlewis Exp $"; X X#include X Xextern far tokclose(); X Xchar *trstd[] = { (char *) 0x00000a20, (char *) 0x00000a24, 0}; X Xstruct trdevice { X unsigned char switch_read; /* ROM/MMIO domain switches */ X unsigned char reset; /* write causes adapter reset */ X unsigned char release_reset; /* write releases adapter reset */ X unsigned char clear_interrupt; /* write clears adapter X * interrupt */ X}; X Xmain(argc,argv) X int argc; X char **argv; X{ X register struct trdevice *addr; X int error, i; X X for (i=0;i<2;i++) X { X printf("Closing token ring adapter %d ...",i); X if (error = tokclose(i)) /* Close adapter i */ X printf (" CCB1 error=0x%x",error); X addr = (struct trdevice *) (0xffff & (unsigned int) trstd[i]); X /* Generate interrupt */ X outp(&addr->reset, 0); /* latch adapter reset */ X delay(50); /* delay 50ms */ X /* turn off adapter reset, generate interrupt */ X outp(&addr->release_reset, 0); X printf(" done.\n"); X } X} X Xdelay(n) X int n; X{ X int i; X int dcount = 800; X X while ( n-- ) X for (i = 0; i < dcount; i++) X { }; X} END-of-shutlan.c echo x - tokclose.asm sed 's/^X//' >tokclose.asm << 'END-of-tokclose.asm' X; X; (C) COPYRIGHT IBM CORPORATION 1989 X; LICENSED MATERIALS - PROPERTY OF IBM X; REFER TO COPYRIGHT INSTRUCTIONS FORM G120-2803 X; X; TOKCLOSE - CLOSE TOKEN RING ADAPTER X; PARAMETER: ADAPTER NUMBER (0|1) X; X; $Header: tokclose.asm,v 1.2 89/11/14 16:07:50 mlewis Exp $ X; XPUBLIC _TOKCLOSE X XEXTRA SEGMENT WORD PUBLIC 'DATA' XADAPTER DB 0 ;ADAPTER NUMBER XCOMMAND DB 04H ;COMMAND FIELD (DIR.CLOSE.ADAPTER) XRETCODE DB 0FFH ;RETURN CODE XWORK DB 0 ;WORK AREA XPOINTER DD 0 ;POINTER WORK AREA XCMD_CMPL DD 0 ;COMMAND COMPLETION APPENDAGE XPARM_TAB DD 0 ;PARM/POINTER TO CCB TABLE XEXTRA ENDS X X_TEXT SEGMENT WORD PUBLIC 'CODE' X ASSUME CS:_TEXT,ES:EXTRA X_TOKCLOSE PROC FAR X PUSH BP X MOV BP,SP X PUSH DI X PUSH SI X MOV AX,EXTRA ;SETUP ES X MOV ES,AX X MOV AX,[BP+6] ;GET ADAPTER NUMBER X MOV ADAPTER,AL X MOV BX,OFFSET EXTRA:ADAPTER ;SETUP BX X INT 5CH ;DIRECT/NETBIOS INTERRUPT X MOV AH,0FFH XLP: CMP RETCODE,AH ;WAIT FOR VALID RETCODE X JE LP X MOV AH,0 X MOV AL,RETCODE ;SAVE IT FOR RETURN X POP SI X POP DI X MOV SP,BP X POP BP X RET X_TOKCLOSE ENDP X_TEXT ENDS X END END-of-tokclose.asm exit =====----- Mark S. Lewis, IBM AWD Palo Alto -----====== inet: mlewis%ibmsupt@uunet.uu.net (415) 855-4486 uucp: uunet!ibmsupt!mlewis IBM Tie Line: 465-4486