135523Sbostic /* 235523Sbostic * Copyright (c) 1988 The Regents of the University of California. 335523Sbostic * All rights reserved. 435523Sbostic * 535523Sbostic * This code is derived from software contributed to Berkeley by 635523Sbostic * Computer Consoles Inc. 735523Sbostic * 8*42795Sbostic * %sccs.include.redist.c% 935523Sbostic */ 1035523Sbostic 1132618Ssam #ifndef lint 1235523Sbostic char copyright[] = 1335523Sbostic "@(#) Copyright (c) 1988 The Regents of the University of California.\n\ 1435523Sbostic All rights reserved.\n"; 1535523Sbostic #endif /* not lint */ 1632618Ssam 1735523Sbostic #ifndef lint 18*42795Sbostic static char sccsid[] = "@(#)dlmpcc.c 5.5 (Berkeley) 06/01/90"; 1935523Sbostic #endif /* not lint */ 2035523Sbostic 2132618Ssam /* 2232618Ssam * MPCC Download and Configuration Program. 2332618Ssam */ 2432618Ssam #include <sys/ioctl.h> 2532618Ssam #include <sys/types.h> 2632618Ssam #include <tahoevba/mpreg.h> 2737978Sbostic #include <fcntl.h> 2837978Sbostic #include <errno.h> 2932618Ssam #include <stdio.h> 3037978Sbostic #include <ctype.h> 3132618Ssam #include "scnhdr.h" 3237978Sbostic #include "pathnames.h" 3332618Ssam 3432618Ssam #define MAXMPCC 16 3532618Ssam 3637978Sbostic char *MPCCTAB = _PATH_MPCCTAB; 3732618Ssam int resetflg = 0; 3832618Ssam 3932618Ssam main(argc, argv) 4032618Ssam char *argv[]; 4132618Ssam { 4232618Ssam int bd; 4332618Ssam 4432618Ssam if (argc == 1) { 4532618Ssam for (bd = 0; bd < MAXMPCC; bd++) 4632618Ssam if (bldmap(bd) != -1) 4732618Ssam download(bd); 4832618Ssam exit(0); 4932618Ssam } 5032618Ssam for (argc--, argv++; argc > 0; argc--, argv++) { 5132618Ssam bd = atoi(argv[0]); 5232618Ssam if (strcmp(argv[0], "-r") == 0) { 5332618Ssam resetflg = 1; 5432618Ssam continue; 5532618Ssam } 5632618Ssam if (bd > MAXMPCC || bd < 0) { 5732618Ssam printf("Illegal Board Number=> %d\n", bd); 5832618Ssam continue; 5932618Ssam } 6032618Ssam if (bldmap(bd) == -1) 6132618Ssam continue; 6232618Ssam download(bd); 6332618Ssam } 6432618Ssam exit(0); 6532618Ssam } 6632618Ssam 6732618Ssam /* 6832618Ssam * Build Load Module Map 6932618Ssam */ 7032618Ssam struct bdcf cf; 7132618Ssam struct abdcf bdasy; 7232618Ssam 7332618Ssam #define LINESIZE 128 7432618Ssam 7532618Ssam bldmap(dlbd) 7632618Ssam int dlbd; /* board to be downloaded */ 7732618Ssam { 7832618Ssam FILE *tabfp; 7932618Ssam int bd, port, count; 8032618Ssam char *bdstr, *strtok(), protocol, line[LINESIZE]; 8132618Ssam char *lptr, *lptr1, *lptr2; 8232618Ssam 8332618Ssam protocol = '\0'; 8432618Ssam /* open the configuration file for reading */ 8532618Ssam if ((tabfp = fopen(MPCCTAB, "r")) == NULL) { 8632618Ssam printf("No Configuration File: %s\n", MPCCTAB); 8732618Ssam return (-1); 8832618Ssam } 8932618Ssam for (;;) { 9032618Ssam if (fgets(&line[0], LINESIZE-1, tabfp) == NULL) { 9132618Ssam fclose(tabfp); 9232618Ssam return (-1); 9332618Ssam } 9432618Ssam count++; 9532618Ssam line[strlen(line)-1] = '\0'; 9632618Ssam lptr = strtok(line, ':'); 9732618Ssam if (tolower(*lptr) != 'm') 9832618Ssam continue; 9932618Ssam lptr = strtok((char *)0, ':'); 10032618Ssam bd = atoi(lptr); 10132618Ssam if (bd == dlbd) 10232618Ssam break; 10332618Ssam } 10432618Ssam cf.fccstimer = 20; /* default to 1 sec (20 * 50ms) */ 10532618Ssam cf.fccsports = 0; /* no ports are fccs */ 10632618Ssam cf.fccssoc = 0; /* no ports switch on close */ 10732618Ssam for (port = 0; port < MPMAXPORT; port++) 10832618Ssam cf.protoports[port] = MPPROTO_UNUSED; 10932618Ssam /* check for the keywords following the board number */ 11032618Ssam lptr1 = (char *)0; 11132618Ssam lptr2 = (char *)0; 11232618Ssam while (*lptr) { 11332618Ssam lptr = strtok((char *)0, ':'); 11432618Ssam if (!strncmp(lptr, "FCCS", 4)) { 11532618Ssam lptr1 = lptr; 11632618Ssam continue; 11732618Ssam } 11832618Ssam if (!strncmp(lptr, "SOC", 3)) { 11932618Ssam lptr2 = lptr; 12032618Ssam continue; 12132618Ssam } 12232618Ssam } 12332618Ssam /* process the board and port characteristics */ 12432618Ssam while (fgets(&line[0], LINESIZE-1, tabfp) != NULL) { 12532618Ssam count++; 12632618Ssam line[strlen(line)-1] = '\0'; 12732618Ssam if (!line[0]) /* if newline only */ 12832618Ssam continue; 12932618Ssam lptr = strtok(line, ':'); 13032618Ssam if (tolower(*lptr) == 'm') 13132618Ssam break; 13232618Ssam if (*lptr == '#') /* ignore comment */ 13332618Ssam continue; 13432618Ssam if (tolower(*lptr) == 'p' && tolower(*(lptr+1)) == 'o') { 13532618Ssam /* PORT */ 13632618Ssam port = atoi(lptr = strtok((char *)0, ':')); 13732618Ssam protocol = *(lptr = strtok((char *)0, ':')); 13832618Ssam switch (cf.protoports[port] = protocol) { 13932618Ssam case '3' : /* ASYNCH 32 port */ 14032618Ssam case 'A' : /* ASYNCH */ 14132618Ssam break; 14232618Ssam case 'B': /* BISYNCH */ 14332618Ssam break; 14432618Ssam case 'S': /* SDLC */ 14532618Ssam snapargs(port, lptr); 14632618Ssam break; 14732618Ssam case 'X': /* X25 */ 14832618Ssam x25pargs(port, lptr); 14932618Ssam break; 15032618Ssam default: 15132618Ssam printf( 15232618Ssam "No protocol specified on PROTOCOL line in configuration file %s:%d: %s\n", 15332618Ssam MPCCTAB, count, line); 15432618Ssam protocol = 'A'; 15532618Ssam break; 15632618Ssam } 15732618Ssam continue; 15832618Ssam } 15932618Ssam if (tolower(*lptr) == 'p' && tolower(*(lptr+1)) == 'r') { 16032618Ssam /* PROTOCOL */ 16132618Ssam #ifdef notdef 16232618Ssam if(protocol) { 16332618Ssam printf( 16432618Ssam "second protocol specified on PROTOCOL line in configuration file %s:%d: %s\n", 16532618Ssam MPCCTAB, count, line); 16632618Ssam continue; 16732618Ssam } 16832618Ssam #endif 16932618Ssam lptr = strtok((char *) 0, ':'); 17032618Ssam switch (protocol = *lptr) { 17132618Ssam case '3': /* ASYNCH 32 port */ 17232618Ssam case 'A': /* ASYNCH */ 17332618Ssam asybargs(lptr); 17432618Ssam break; 17532618Ssam case 'B': /* BISYNCH */ 17632618Ssam break; 17732618Ssam case 'S': /* SDLC */ 17832618Ssam snabargs(lptr); 17932618Ssam break; 18032618Ssam case 'X': /* X25 */ 18132618Ssam x25bargs(lptr); 18232618Ssam break; 18332618Ssam default: 18432618Ssam printf( 18532618Ssam "No protocol specified on PROTOCOL line in configuration file %s:%d: %s\n", 18632618Ssam MPCCTAB, count, line); 18732618Ssam protocol = 'A'; 18832618Ssam break; 18932618Ssam } 19032618Ssam continue; 19132618Ssam } 19232618Ssam printf("Error in configuration file %s,line %d, %s\n", 19332618Ssam MPCCTAB, count, line); 19432618Ssam } 19532618Ssam fclose(tabfp); 19632618Ssam mkldnm(); 19732618Ssam return (0); 19832618Ssam } 19932618Ssam 20032618Ssam /* 20132618Ssam * decode x25 arguments for board 20232618Ssam * 20332618Ssam * for X.25, the arguments are N1, N2, T1, T2, T3, T4, K). 20432618Ssam */ 20532618Ssam x25bargs(args) 20632618Ssam char *args; 20732618Ssam { 20832618Ssam } 20932618Ssam 21032618Ssam /* 21132618Ssam * decode sna arguments for board 21232618Ssam * for SNA, the arguments are N1, N2, T1, T2, T3, T4, K). 21332618Ssam */ 21432618Ssam snabargs(args) 21532618Ssam char *args; 21632618Ssam { 21732618Ssam } 21832618Ssam 21932618Ssam /* 22032618Ssam * decode async arguments for board 22132618Ssam */ 22232618Ssam asybargs(args) 22332618Ssam char *args; 22432618Ssam { 22532618Ssam 22632618Ssam bdasy.xmtbsz = atoi(strtok((char *)0, ':')); 22732618Ssam } 22832618Ssam 22932618Ssam /* 23032618Ssam * decode x25 arguments for port 23132618Ssam */ 23232618Ssam x25pargs(port,args) 23332618Ssam int port; 23432618Ssam char *args; 23532618Ssam { 23632618Ssam } 23732618Ssam 23832618Ssam /* 23932618Ssam * decode sna arguments for port 24032618Ssam */ 24132618Ssam snapargs(port, args) 24232618Ssam int port; 24332618Ssam char *args; 24432618Ssam { 24532618Ssam } 24632618Ssam 24732618Ssam gethi() 24832618Ssam { 24932618Ssam int i; 25032618Ssam 25132618Ssam for (i = MPMAXPORT-1; i >= 0 && cf.protoports[i] == 0; i--) 25232618Ssam ; 25332618Ssam return (i); 25432618Ssam } 25532618Ssam 25632618Ssam getlo() 25732618Ssam { 25832618Ssam int i; 25932618Ssam 26032618Ssam for (i = 0; i < MPMAXPORT && cf.protoports[i] == 0; i++) 26132618Ssam ; 26232618Ssam return (i); 26332618Ssam } 26432618Ssam 26532618Ssam prntmap(board) 26632618Ssam int board; 26732618Ssam { 26832618Ssam int j; 26932618Ssam 27032618Ssam printf("\nMPCC #: %d\n", board); 27132618Ssam for (j = 0; j < MPMAXPORT; j++) { 27232618Ssam printf("port: %d %c", j, cf.protoports[j]); 27332618Ssam switch (cf.protoports[j]) { 27432618Ssam case '3': case 'A': 27532618Ssam printf("\n"); 27632618Ssam break; 27732618Ssam case 'B': 27832618Ssam break; 27932618Ssam case 'S': 28032618Ssam break; 28132618Ssam case 'X': 28232618Ssam break; 28332618Ssam default: 28432618Ssam printf("Unused\n"); 28532618Ssam break; 28632618Ssam } 28732618Ssam } 28832618Ssam printf("ldname: %s, ", cf.loadname); 28932618Ssam printf("hiport: %d, loport: %d\n", gethi(), getlo()); 29032618Ssam if (cf.fccsports != 0) 29132618Ssam printf("FCCS\n"); 29232618Ssam switch (cf.protoports[0]) { 29332618Ssam case '3': case 'A': 29432618Ssam printf("xmtsize: %d\n", bdasy.xmtbsz); 29532618Ssam break; 29632618Ssam case 'B': 29732618Ssam break; 29832618Ssam case 'S': 29932618Ssam break; 30032618Ssam case 'X': 30132618Ssam break; 30232618Ssam } 30332618Ssam printf("protoports: %s\n", cf.protoports); 30432618Ssam } 30532618Ssam 30632618Ssam /* 30732618Ssam * Make Load Module Name 30832618Ssam * 30932618Ssam * if any port is 'ASYNCH" 31032618Ssam * add 'a' to load module name 31132618Ssam * if any port is 'BISYNCH' 31232618Ssam * add 'b' to load module name 31332618Ssam * if any port is 'SDLC' 31432618Ssam * add 's' to load module name 31532618Ssam * if any port is 'X25' 31632618Ssam * add 'x' to load module name 31732618Ssam */ 31832618Ssam mkldnm() 31932618Ssam { 32032618Ssam static char *pcols = "ABSX3"; 32132618Ssam char *proto; 32232618Ssam int j, offset; 32332618Ssam 32432618Ssam offset = 0; 32532618Ssam for (proto = pcols; *proto; proto++) { 32632618Ssam for (j = 0; j < MPMAXPORT; j++) { 32732618Ssam if (cf.protoports[j] == *proto) { 32832618Ssam if (*proto == '3') 32932618Ssam cf.loadname[offset] = '3'; 33032618Ssam else 33132618Ssam cf.loadname[offset] = tolower(*proto); 33232618Ssam offset++; 33332618Ssam break; 33432618Ssam } 33532618Ssam } 33632618Ssam cf.loadname[offset] = '\0'; 33732618Ssam } 33832618Ssam } 33932618Ssam 34032618Ssam /* 34132618Ssam * if a string is passed as an argument, 34232618Ssam * save it in the local string area 34332618Ssam * set the local index to the start of the string 34432618Ssam * else 34532618Ssam * set start to the current character in the string 34632618Ssam * while the character is not the separator, 34732618Ssam * and the character is not NULL 34832618Ssam * skip the character 34932618Ssam */ 35032618Ssam static 35132618Ssam char * 35232618Ssam strtok(s, c) 35332618Ssam char *s, c; 35432618Ssam { 35532618Ssam static char locals[LINESIZE]; 35632618Ssam static int i; 35732618Ssam char *start; 35832618Ssam 35932618Ssam if (s != 0) { 36032618Ssam strcpy(locals, s); 36132618Ssam i = 0; 36232618Ssam } 36332618Ssam for (start = &locals[i] ; locals[i] && locals[i] != c; i++) 36432618Ssam ; 36532618Ssam if (locals[i]) { 36632618Ssam locals[i] = '\0'; 36732618Ssam i++; 36832618Ssam } 36932618Ssam while (*start == ' ') 37032618Ssam start++; 37132618Ssam return (start); 37232618Ssam } 37332618Ssam 37432618Ssam short bits[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; 37532618Ssam fccs(line, tptr, pptr) 37632618Ssam char *line, *tptr, *pptr; 37732618Ssam { 37832618Ssam u_short ports, num, time; 37932618Ssam 38032618Ssam ports = 0; 38132618Ssam line = strtok(line, ','); 38232618Ssam while (*(line = strtok((char *) 0, ',')) != '\0') { 38332618Ssam num = (short) atoi(line); 38432618Ssam if (num >= 0 && num < 8) 38532618Ssam ports |= bits[num]; 38632618Ssam else if (num >= 50 && num < 6400) 38732618Ssam time = num / 50; 38832618Ssam else 38932618Ssam printf("bad value for FCCS: %d\n", num); 39032618Ssam } 39132618Ssam *pptr = ports; 39232618Ssam *tptr = time; 39332618Ssam } 39432618Ssam 39532618Ssam soc(line, sptr) 39632618Ssam char *line, *sptr; 39732618Ssam { 39832618Ssam u_short ports, num; 39932618Ssam 40032618Ssam ports = 0; 40132618Ssam line = strtok(line, ','); 40232618Ssam while (*(line = strtok((char *) 0, ',')) != '\0') { 40332618Ssam num = atoi(line); 40432618Ssam if (num >= 0 && num < 8) 40532618Ssam ports |= bits[num]; 40632618Ssam else 40732618Ssam printf("bad value for SOC: %d\n",num); 40832618Ssam } 40932618Ssam *sptr = ports; 41032618Ssam } 41132618Ssam 41232618Ssam char buffer[MPDLBUFSIZE]; 41332618Ssam extern int errno; 41432618Ssam struct head1 { 41532618Ssam long magic; 41632618Ssam long fill[12]; 41732618Ssam struct scnhdr text; 41832618Ssam struct scnhdr data; 41932618Ssam struct scnhdr bss; 42032618Ssam } header1; 42132618Ssam 42232618Ssam download(mpccnum) 42332618Ssam int mpccnum; 42432618Ssam { 42532618Ssam char dlname[LINESIZE], fullname[LINESIZE]; 42632618Ssam char *ldname, *ppmap; 42732618Ssam int dlfd, ldfd; 42832618Ssam char *it; 42932618Ssam short i; 43032618Ssam char hilo[2]; 43132618Ssam long realsize; 43232618Ssam 43337978Sbostic sprintf(dlname, "%s/mpcc%d", _PATH_DEV, mpccnum); 43432618Ssam if (*cf.loadname == '3') 43537978Sbostic sprintf(fullname, _PATH_MPCC32); 43632618Ssam else 43737978Sbostic sprintf(fullname, _PATH_MPCCDL); 43832618Ssam if ((cf.loadname[0]) == '\0') 43932618Ssam return (-1); 44032618Ssam if ((dlfd = open(dlname, O_RDWR)) == MP_DLERROR) { 44132618Ssam printf("Can not open %s\n",dlname); 44232618Ssam return (-1); 44332618Ssam } 44432618Ssam if ((ldfd = open(fullname, O_RDONLY)) == MP_DLERROR) { 44532618Ssam close(dlfd); 44632618Ssam printf("Can not access protocol code file: %s\n", fullname); 44732618Ssam return (-1); 44832618Ssam } 44932618Ssam if (dlokay(dlfd,mpccnum) == MP_DLERROR) { 45032618Ssam close(ldfd); 45132618Ssam close(dlfd); 45232618Ssam return (-1); 45332618Ssam } 45432618Ssam printf("Downloading MPCC #%x\n", mpccnum); 45532618Ssam /* read executable file header */ 45632618Ssam if (read(ldfd, &header1, sizeof(header1)) != sizeof(header1)) { 45732618Ssam printf("Can not read %s\n", fullname); 45832618Ssam return (-1); 45932618Ssam } 46032618Ssam /* place at start of text space */ 46132618Ssam if (lseek(ldfd, header1.text.s_scnptr , (int) 0) == -1) { 46232618Ssam printf("lseek error(text): %d", errno); 46332618Ssam return (-1); 46432618Ssam } 46532618Ssam /* send text */ 46632618Ssam realsize = header1.data.s_paddr - header1.text.s_paddr; 46732618Ssam if (dl(ldfd, dlfd, realsize) == -1) { 46832618Ssam ioctl(dlfd, MPIORESETBOARD, 0L); 46932618Ssam return (-1); 47032618Ssam } 47132618Ssam /* place at start of data space */ 47232618Ssam if (lseek(ldfd, header1.data.s_scnptr , (int) 0) == -1) { 47332618Ssam printf("lseek error(data): %d", errno); 47432618Ssam return (-1); 47532618Ssam } 47632618Ssam /* send initialized data */ 47732618Ssam realsize = header1.bss.s_paddr - header1.data.s_paddr; 47832618Ssam if (dl(ldfd, dlfd, realsize) == -1) { 47932618Ssam ioctl(dlfd, MPIORESETBOARD, 0L); 48032618Ssam return (-1); 48132618Ssam } 48232618Ssam /* signal end of code */ 48332618Ssam if (ioctl(dlfd, MPIOENDCODE, (char *) 0) == MP_DLERROR) { 48432618Ssam printf("MPIOENDCODE ioctl failed\n"); 48532618Ssam ioctl(dlfd, MPIORESETBOARD, 0L); 48632618Ssam return (-1); 48732618Ssam } 48832618Ssam /* download configuration information */ 48932618Ssam if (config(dlfd) == -1) { 49032618Ssam ioctl(dlfd, MPIORESETBOARD, 0L); 49132618Ssam return (-1); 49232618Ssam } 49332618Ssam /* write port/protocol map */ 49432618Ssam ppmap = (char *)&cf.protoports[0]; 49532618Ssam tknzmap(ppmap); 49632618Ssam if (ioctl(dlfd, MPIOPORTMAP, ppmap) == MP_DLERROR) { 49732618Ssam printf("MPIOPORTMAP ioctl failed\n"); 49832618Ssam ioctl(dlfd, MPIORESETBOARD, 0L); 49932618Ssam return (-1); 50032618Ssam } 50132618Ssam /* signal end of download */ 50232618Ssam if (ioctl(dlfd, MPIOENDDL, (char *) 0) == MP_DLERROR) { 50332618Ssam printf("MPIOENDDL ioctl failed\n"); 50432618Ssam ioctl(dlfd, MPIORESETBOARD, 0L); 50532618Ssam return (-1); 50632618Ssam } 50732618Ssam close(dlfd); 50832618Ssam close(ldfd); 50932618Ssam printf("Download Complete and Successful\n"); 51032618Ssam return (0); 51132618Ssam } 51232618Ssam 51332618Ssam dlokay(bdfd, mpccnum) 51432618Ssam int bdfd, mpccnum; 51532618Ssam { 51632618Ssam char answer; 51732618Ssam 51832618Ssam if (resetflg) { 51932618Ssam printf("Reseting MPCC #%x\n",mpccnum); 52032618Ssam ioctl(bdfd, MPIORESETBOARD, 0L); 52132618Ssam sleep(10); 52232618Ssam } 52332618Ssam if (ioctl(bdfd, MPIOSTARTDL, 0) == MP_DLERROR) { 52432618Ssam if (errno == EBUSY) { 52532618Ssam printf("MPCC #%x has already been downloaded.\n", 52632618Ssam mpccnum); 52732618Ssam printf("Do you want to re-download it?: "); 52832618Ssam fscanf(stdin,"%c",&answer); 52932618Ssam while (getchar() != '\n') 53032618Ssam ; 53132618Ssam if ((answer | 0x60) != 'y') 53232618Ssam return (MP_DLERROR); 53332618Ssam ioctl(bdfd, MPIORESETBOARD, 0L); 53432618Ssam sleep(10); 53532618Ssam if (ioctl(bdfd, MPIOSTARTDL, (char *) 0) == MP_DLERROR) { 53632618Ssam printf("Can't download MPCC #%x\n", mpccnum); 53732618Ssam return (MP_DLERROR); 53832618Ssam } 53932618Ssam } else { 54032618Ssam switch (errno) { 54132618Ssam case ENODEV: 54232618Ssam printf("MPCC #%x not in system\n", mpccnum); 54332618Ssam break; 54432618Ssam case EACCES: 54532618Ssam printf("Download area in use, try later\n"); 54632618Ssam break; 54732618Ssam case ENOSPC: 54832618Ssam printf("MPCC #%x already being downloaded\n", 54932618Ssam mpccnum); 55032618Ssam break; 55132618Ssam default: 55232618Ssam printf("Unknown response from MPCC #%x\n", 55332618Ssam mpccnum); 55432618Ssam break; 55532618Ssam } 55632618Ssam return (MP_DLERROR); 55732618Ssam } 55832618Ssam } 55932618Ssam return (0); 56032618Ssam } 56132618Ssam 56232618Ssam dl(dskfd, bdfd, size) 56332618Ssam int dskfd, bdfd; 56432618Ssam long size; 56532618Ssam { 56632618Ssam int bytes; 56732618Ssam 56832618Ssam while (size > 0) { 56932618Ssam bytes = (size < MPDLBUFSIZE) ? (int) size : MPDLBUFSIZE; 57032618Ssam if ((bytes = read(dskfd, buffer, bytes)) == MP_DLERROR) { 57132618Ssam close(dskfd); 57232618Ssam close(bdfd); 57332618Ssam printf("Download-Can't read buffer\n"); 57432618Ssam return (-1); 57532618Ssam } 57632618Ssam if (write(bdfd, buffer, bytes) == MP_DLERROR) { 57732618Ssam close(dskfd); 57832618Ssam close(bdfd); 57932618Ssam printf("Download-Can't write buffer\n"); 58032618Ssam return (-1); 58132618Ssam } 58232618Ssam size -= bytes; 58332618Ssam } 58432618Ssam return (0); 58532618Ssam } 58632618Ssam 58732618Ssam /* 58832618Ssam * download each protocol's configuration data 58932618Ssam * and the configuration data for tboard. 59032618Ssam */ 59132618Ssam config(dlfd) 59232618Ssam int dlfd; 59332618Ssam { 59432618Ssam register int i; 59532618Ssam char *ldname; 59632618Ssam 59732618Ssam for (ldname = cf.loadname; *ldname; ldname++) { 59832618Ssam switch (*ldname) { 59932618Ssam case '3': case 'a': 60032618Ssam if (ioctl(dlfd, MPIOASYNCNF, &bdasy) == MP_DLERROR) { 60132618Ssam printf("async ioctl failed\n"); 60232618Ssam return (-1); 60332618Ssam } 60432618Ssam break; 60532618Ssam case 'b': 60632618Ssam break; 60732618Ssam case 'x': 60832618Ssam break; 60932618Ssam 61032618Ssam case 's': 61132618Ssam break; 61232618Ssam } 61332618Ssam } 61432618Ssam } 61532618Ssam 61632618Ssam /* 61732618Ssam * tokenize the protoport string, 61832618Ssam * (change from the letter to the corresponding number). 61932618Ssam */ 62032618Ssam tknzmap(map) 62132618Ssam char *map; 62232618Ssam { 62332618Ssam short i; 62432618Ssam 62532618Ssam for (i = 0; i < MPMAXPORT; i++) { 62632618Ssam switch (*map) { 62732618Ssam case '3' : *map = MPPROTO_ASYNC; break; 62832618Ssam case 'A' : *map = MPPROTO_ASYNC; break; 62932618Ssam case 'B' : *map = MPPROTO_BISYNC; break; 63032618Ssam case 'S' : *map = MPPROTO_SNA; break; 63132618Ssam case 'X' : *map = MPPROTO_X25; break; 63232618Ssam default: *map = MPPROTO_UNUSED; break; 63332618Ssam } 63432618Ssam map++; 63532618Ssam } 63632618Ssam } 637