📄 mkioconf.c
字号:
}/* *dump out vector for each name device "str" which is connected to nexus */dump_vec_adapt(str,fpb)register char *str;register FILE *fpb;{ register struct device *dp, *mp; for (dp = dtab; dp != 0; dp = dp->d_next) { if(eq(dp->d_name,str)) { if ((mp = dp->d_conn) == TO_NEXUS && (dp->d_unit != -1)) { switch (machine) { case MACHINE_VAX: if(eq(dp->d_name,"ci")) { fprintf(fpb, "\t.globl\t_X%sint%d\n\t.align\t2\n_X%sint%d:\n\tpushr\t$0x3f\n", str,dp->d_unit, str,dp->d_unit); fprintf(fpb,"\tpushl\t_ci_isr+((%d*8)+4)\n",dp->d_unit); fprintf(fpb, "\tcalls\t$1,*_ci_isr+(%d*8)\n",dp->d_unit); fprintf(fpb, "#if defined(VAX750) || defined(VAX730) || defined(VAX8200) || defined(MVAX) || defined(VAX420) || defined(VAX3600) || defined(VAX60) || defined(VAX8800) || defined(VAX6200) || defined(VAX6400)\n"); fprintf(fpb,"\tmfpr\t$1,r0\n"); fprintf(fpb,"\tincl\tCPU_INTR(r0)\n"); fprintf(fpb,"#endif\n\tpopr\t$0x3f\n\trei\n\n"); } else { fprintf(fpb, "\t.globl\t_X%serr%d\n\t.align\t2\n_X%serr%d:\n\tpushr\t$0x3f\n", str,dp->d_unit, str,dp->d_unit); fprintf(fpb,"\tpushal\t6*4(sp)\n\tpushl\t$%d\n",dp->d_unit); fprintf(fpb, "\tcalls\t$2,_%serrors\n\tpopr\t$0x3f\n",str); fprintf(fpb, "\trei\n\n"); } break; case MACHINE_MIPS: if(eq(dp->d_name,"ci")) { if(dp->d_unit == 0) { fprintf(fpb, "#include \"../h/types.h\"\n"); fprintf(fpb, "#include \"../io/ci/ciadapter.h\"\n"); } fprintf(fpb,"X%sint%d(stray_arg)\n",str,dp->d_unit); fprintf(fpb,"int stray_arg;\n"); fprintf(fpb,"{\n"); fprintf(fpb,"/* stray_arg is not used here but locore calls it with\n"); fprintf(fpb," * an argument that is the offset into the scb data structure;\n"); fprintf(fpb," * which the stray interrupt routine uses to find where the\n"); fprintf(fpb," * stray came from. The unused arg keeps everything consistent.\n"); fprintf(fpb," */\n"); fprintf(fpb,"\textern CIISR ci_isr[];\n"); fprintf(fpb,"\t(*ci_isr[%d].isr)(ci_isr[%d].pccb);\n",dp->d_unit,dp->d_unit); fprintf(fpb,"}\n"); } else { fprintf(fpb,"X%serr%d(stray_arg)\n",str,dp->d_unit); fprintf(fpb,"int stray_arg;\n"); fprintf(fpb,"{\n"); fprintf(fpb,"/* stray_arg is not used here but locore calls it with\n"); fprintf(fpb," * an argument that is the offset into the scb data structure;\n"); fprintf(fpb," * which the stray interrupt routine uses to find where the\n"); fprintf(fpb," * stray came from. The unused arg keeps everything consistent.\n"); fprintf(fpb," */\n"); fprintf(fpb,"\textern %serrors();\n",str); fprintf(fpb,"\t%serrors(%d);\n",str,dp->d_unit); fprintf(fpb,"}\n"); } break; } /* End Switch */ } } } /* End for loop */ }dump_dispatch(str,fpb)register char *str;register FILE *fpb;{ register struct device *dp, *mp; for (dp = dtab; dp != 0; dp = dp->d_next) { if(eq(dp->d_name,str)) { if ((mp = dp->d_conn) == TO_NEXUS && (dp->d_unit != -1)) { if( eq(str, "ci") ) { fprintf(fpb,"extern int X%sint%d();\n",str,dp->d_unit); } else { fprintf(fpb,"extern int X%serr%d();\n",str,dp->d_unit); } } } } if( eq(str, "ci") ) { fprintf(fpb,"int\t(*%sintv[])() = {\n",str ); } else { fprintf(fpb,"\nstruct bus_dispatch %serr_dispatch[] = {\n",str); } for (dp = dtab; dp != 0; dp = dp->d_next) { if(eq(dp->d_name,str)) { if ((mp = dp->d_conn) == TO_NEXUS && (dp->d_unit != -1)) { if( eq(str, "ci") ) { fprintf(fpb,"\t X%sint%d ,\n",str,dp->d_unit); } else { fprintf(fpb,"\t{0x%x,(int)X%serr%d},\n", dp->d_unit,str,dp->d_unit); } } } } if( eq(str, "ci") ) { fprintf(fpb,"\t 0 };\n\n"); } else { fprintf(fpb,"\t{-1,-1} };\n"); }}uba_num(dp)struct device *dp;{ if(eq(dp->d_name ,"uba")) return(dp->d_unit); if(dp->d_conn == TO_NEXUS || dp->d_conn == 0) return(UNKNOWN); return(uba_num(dp->d_conn));}/* this code was used by the MIPS CO. machine and we do not support the VME * bus. The code is here just in case we need to reff. it someday. */#if MACHINE_MIPSmips_ioconf(){ register struct device *dp, *mp, *np; register int slave; FILE *fp; char buf1[64], buf2[64]; char *concat3(); unlink(path("ioconf.c")); fp = fopen(path("ioconf.c"), "w"); if (fp == 0) { perror(path("ioconf.c")); exit(1); } fprintf(fp, "#include \"../machine/pte.h\"\n"); fprintf(fp, "#include \"../h/param.h\"\n"); fprintf(fp, "#include \"../h/buf.h\"\n"); fprintf(fp, "#include \"../h/map.h\"\n"); fprintf(fp, "#include \"../h/vm.h\"\n"); fprintf(fp, "#include \"../h/config.h\"\n"); fprintf(fp, "\n"); fprintf(fp, "#include \"../io/mba/vax/mbavar.h\"\n"); fprintf(fp, "\n");#ifdef notdef if (seen_mbii && seen_vme) { printf("can't have both vme and mbii devices\n"); exit(1); } if (seen_mbii) fprintf(fp, "#include \"../mipsmbii/mbiivar.h\"\n"); if (seen_vme) fprintf(fp, "#include \"../mipsvme/vmevar.h\"\n"); fprintf(fp, "\n");#endif notdef fprintf(fp, "#define C (caddr_t)\n"); fprintf(fp, "#define NULL 0\n\n"); fprintf(fp, "int nulldev();\n");#ifdef notdef if (!seen_mbii) goto checkvme; /* * MBII stuff should go here */checkvme: if (!seen_vme) goto closefile; /* * Now generate interrupt vectors for the vme bus */ for (dp = dtab; dp != 0; dp = dp->d_next) { if (dp->d_vec != 0) { struct idlst *ip; mp = dp->d_conn; if (mp == 0 || mp == TO_NEXUS || !eq(mp->d_name, "vme")) continue; if (is_declared(dp->d_name)) continue; declare(dp->d_name); fprintf(fp, "extern struct vme_driver %sdriver;\n", dp->d_name); fprintf(fp, "extern "); ip = dp->d_vec; for (;;) { fprintf(fp, "%s()", ip->id); ip = ip->id_next; if (ip == 0) break; fprintf(fp, ", "); } fprintf(fp, ";\n"); fprintf(fp, "int (*_%sint[])() = { ", dp->d_name, dp->d_unit); ip = dp->d_vec; for (;;) { fprintf(fp, "%s", ip->id); ip = ip->id_next; if (ip == 0) break; fprintf(fp, ", "); } fprintf(fp, ", 0 } ;\n\n"); } } fprintf(fp, "\nstruct vme_ctlr vmminit[] = {\n"); fprintf(fp," /* driver ctlr alive intr addr am */\n"); for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (dp->d_type != CONTROLLER || mp == TO_NEXUS || mp == 0 || !eq(mp->d_name, "vme")) continue; if (dp->d_vec == 0) { printf("must specify vector for %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_addr == 0) { printf("must specify csr address for %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_addrmod == 0) { printf("must specify address modifier for %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { printf("drives need their own entries; dont "); printf("specify drive or slave for %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_flags) { printf("controllers (e.g. %s%d) ", dp->d_name, dp->d_unit); printf("don't have flags, only devices do\n"); continue; } fprintf(fp," { %14s, %3d, 0, %11s, C 0x%08x, 0x%02x },\n", concat3(buf1, "&", dp->d_name, "driver"), dp->d_unit, concat3(buf2, "_", dp->d_name, "int"), dp->d_addr, dp->d_addrmod); } fprintf(fp, " { NULL }\n};\n"); /* * vme devices */ fprintf(fp, "\nstruct vme_device vmdinit[] = {\n"); fprintf(fp,"/* driver unit ctlr slave intr addr am dk flags */\n" ); for (dp = dtab; dp != 0; dp = dp->d_next) { mp = dp->d_conn; if (dp->d_unit == QUES || dp->d_type != DEVICE || mp == 0 || mp == TO_NEXUS || mp->d_type == MASTER) continue; for (np = mp; np && np != TO_NEXUS; np = np->d_conn) if (eq(np->d_name, "vme")) break; if (np != 0 && np != TO_NEXUS && !eq(np->d_name, "vme")) continue; np = 0; if (eq(mp->d_name, "vme")) { if (dp->d_vec == 0) { printf("must specify vector for device %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_addr == 0) { printf("must specify csr for device %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_addrmod == 0) { printf( "must specify address modifier for device %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_drive != UNKNOWN || dp->d_slave != UNKNOWN) { printf("drives/slaves can be specified "); printf("only for controllers, "); printf("not for device %s%d\n", dp->d_name, dp->d_unit); continue; } slave = QUES; } else { if ((np = mp->d_conn) == 0) { printf("%s%d isn't connected to anything ", mp->d_name, mp->d_unit); printf(", so %s%d is unattached\n", dp->d_name, dp->d_unit); continue; } if (dp->d_drive == UNKNOWN) { printf("must specify ``drive number'' "); printf("for %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_slave != UNKNOWN) { printf("slave numbers should be given only "); printf("for massbus tapes, not for %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_vec != 0) { printf("interrupt vectors should not be "); printf("given for drive %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_addr != 0) { printf("csr addresses should be given only "); printf("on controllers, not on %s%d\n", dp->d_name, dp->d_unit); continue; } if (dp->d_addrmod != 0) { printf("address modifiers should be given only "); printf("on controllers, not on %s%d\n", dp->d_name, dp->d_unit); continue; } slave = dp->d_drive; } fprintf(fp,"{%14s, %3d, %3s, %4d,%10s, C 0x%08x, 0x%02x, %1d, 0x%08x },\n", concat3(buf1, "&", eq(mp->d_name, "vme") ? dp->d_name : mp->d_name, "driver"), dp->d_unit, eq(mp->d_name, "vme") ? "-1" : qu(mp->d_unit), slave, intv2(dp), dp->d_addr, dp->d_addrmod, dp->d_dk, dp->d_flags); } fprintf(fp, "{ NULL }\n};\n");#endif notdefclosefile: (void) fclose(fp); return;}char *intv2(dev)register struct device *dev;{ static char buf[20]; if (dev->d_vec == 0) return ("NULL"); return (sprintf(buf, "_%sint", dev->d_name));}char *concat3(buf, p1, p2, p3)char *p1, *p2, *p3;{ return(sprintf(buf, "%s%s%s", p1, p2, p3));}#define MAXDEVS 100#define DEVLEN 10char decl_devices[MAXDEVS][DEVLEN];declare(cp)register char *cp;{ register i; for (i = 0; i < MAXDEVS; i++) if (decl_devices[i][0] == 0) { strncpy(decl_devices, cp, DEVLEN); return; } printf("device table full, fix mkioconf.c\n"); exit(1);}is_declared(cp)register char *cp;{ register i; for (i = 0; i < MAXDEVS; i++) { if (decl_devices[i][0] == 0) return(0); if (strncmp(decl_devices[i], cp, DEVLEN) == 0) return(1); } return(0);}#endif MACHINE_MIPSis_cpu_declared(cp)register char *cp;{ struct cputype *cpup; for (cpup = cputype; cpup; cpup = cpup->cpu_next) if (strcmp(cpup->cpu_name, cp) == 0) return(1); return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -