📄 fc.c
字号:
fbp->f_range = 0x80080008 | FRANGE_ENA; break; case FMOD_GRAPHICS: ka60_mbfillin(mbp, fbp, (i + MB_FBIC_OFFSET), 0); nxaccess((long *)i, FGMEMmap[0], NMEMSIZEFG); /* * Initialize the FBIC */ fbp->f_busaddr = 0; fbp->f_busctl = 0; fbp->f_buscsr = FBCSR_CLEAR; fbp->f_fbicsr |= FFCSR_IRQE_X | FFCSR_IRQD_X | FFCSR_PRI0EN | FFCSR_NORMAL; fbp->f_ipdvint = (u_long)(FIPD_DEVUNIT | (0x100 + (MBUS_SLOT(i) * 0x20))); break; case FMOD_IO: ka60_mbfillin(mbp, fbp, (i + MB_FBIC_OFFSET), 0); /* * Map the Console DZ */ nxaccess((long *)(i + FF_DZ_OFF), FFCONSmap, (512 * 3)); /* * Map the SSC */ nxaccess((long *)cpup->nexaddr(0,4), CVQSSCmap, (512 * 3)); /* * Map the SII Registers */ nxaccess((long *)(i + FF_SI_OFF), CVQMSImap, 512); /* * Map the SII buffer */ nxaccess((long *)(i + FF_SIB_OFF), CVQMSIRBmap, (512 * 256)); /* * Map the NI Registers * The nxaccess calls for the NI registers, station * address ROM, and RAM buffer must be in the following * order so that the ni_regs structure can be used. */ nxaccess((long *)(i + FF_NI_OFF), CVQNImap, 512); nxaccess((long *)(i + FF_SAROM_OFF), (int)CVQNImap + sizeof(struct pte), 512); nxaccess((long *)(i + FF_NIBUF_OFF), (int)CVQNImap + (2 * sizeof(struct pte)), (512 * 256)); /* * Map the IOCSR Register. * The NI station address is read through the IOCSR * register. The IOCSR register is already mapped as * part of CVQNImap (FF_SAROM_OFF), but for maintainability * we will map the IOCSR register again as FFIOCSR. One * pte seems a small price to pay for maintainability */ nxaccess((long *)(i + FF_IOCSR_OFF), FFIOCSRmap, 512); /* * Initiaize the FBIC */ fbp->f_busaddr = 0; fbp->f_busctl = 0; fbp->f_buscsr = FBCSR_CLEAR; fbp->f_fbicsr |= FFCSR_IRQE_X | FFCSR_IRQD_X | FFCSR_PRI0EN | FFCSR_NORMAL; fbp->f_range = 0x80140000 | FRANGE_ENA; fbp->f_ipdvint = (u_long)(FIPD_DEVUNIT | (0x100 + (MBUS_SLOT(i) * 0x20))); /* * Map the CTSIA. We map all of the CTSIA, but not all of * the driver segments, and we use only the external driver * state. This must be done AFTER initializing the FBIC * f_range register. */ nxaccess((long *)cvqssc->ssc_ctsi_addr,CTSImap,512); if ((ctsi->ct_std_out.ctcb_dvatr & 0x7) == FF_LEGSS) { nxaccess((long *)ctsi->ct_std_out.ctcb_extdvrstate_p, FGCTSIXSmap,512); } else if ((ctsi->ct_fb_out.ctcb_dvatr & 0x7) == FF_LEGSS) { nxaccess((long *)ctsi->ct_fb_out.ctcb_extdvrstate_p, FGCTSIXSmap,512); } /* * Enable clocks, Console halts, and MRUN only on the * I/O module the Console program is using. Write only * the high order byte. */ iocsraddr = (char *)((int)ffiocsr + 3); *iocsraddr = 0xe0; break; case FMOD_CPU: ka60_mbfillin(mbp, fbp, (i + MB_FBIC_OFFSET), 0); /******************************************* * This is where to map the cache tags if we * ever need to disable cache.. *******************************************/ ka60_initcpufbic(fbp); /* * Look for another CPU on this module */ nxaccess((long)(i + MB_2ND_FBIC_OFFSET), pteptr++, 512); fbp++; if((*cpup->badaddr)((caddr_t)fbp, 4)) { continue; } mbp++; ka60_mbfillin(mbp, fbp, (i + MB_2ND_FBIC_OFFSET), 0); /******************************************* * This is where to map the cache tags if we * ever need to disable cache.. *******************************************/ ka60_initcpufbic(fbp); break; case FMOD_MEM: memctlr++; ka60_mbfillin(mbp, fbp, (i + MB_FBIC_OFFSET), memctlr); /* * Initiaize the FBIC */ if (fbp->f_modtype & FMOD_INTERFACE != FMOD_FIRESTARTER) { fbp->f_busaddr = 0; fbp->f_busctl = 0; } fbp->f_buscsr = FBCSR_CLEAR; break; default: break; } fbp++; mbp++; } /* * Determine console device and inititialize it. * If L3CON is set use the diagnostic console, * if not use the console_id from NVR or the CFGTST register MULTU bit, * if console_id says unknown we guess based on the * VIDOPT and CURTEST bits in the configuration register. * Order of precedence is: * Diagnostic console on SLU port 3 (BCC08 cable). * Terminal on SLU port 0 (if MULTU bit set). * Keyboard on SLU port 0 (color video, MULTU bit clear). * Keyboard on SLU port 0 (base monochrome video, MULTU bit clear). * The BCC08 cable enables halt on break. * * The VAXstar SLU is always present and must always be * initialized, even if the console is the bitmap or color * display. So, we inititialize it here. */ fcaddr = ffcons; fcaddr->fccsr = FC_CLR; for(i=0; i<100000; i++) if((fcaddr->fccsr&FC_CLR) == 0) break; fcaddr->fccsr = FC_MSE; i = (FC_RE | FC_B9600 | BITS8); if(ff_diagcons) i |= 0x3; fcaddr->fclpr = i; cdevsw[0] = cdevsw[FCMAJOR]; /* * point v_consputc and v_consgetc at fcputc and fcgetc for now, * and if the LEGSS graphics exists, call fgcons_init which will * overwrite v_consputc and v_consgetc. */ v_consputc = fcputc; v_consgetc = fcgetc; if (!ff_diagcons) fgcons_init(); return(1);}/* * VAXstar SLU (dzq like) console putc routine. * Calls fc_putc() to output each character. */fcputc(c) register int c;{ fc_putc(c); if (c == '\n') fc_putc('\r');}/* * This routine outputs one character to the console * on line 0 or 3 depending on the state of L3CON * in the VAXstar configuration and test register. * Characters must be printed without disturbing * output in progress on other lines! * This routines works with the SLU in interrupt or * non-interrupt mode of operation. * Characters are output as follows: * spl6, remember if console line active. * set console line tcr bit. * wait for TRDY on console line (save status if wrong line). * start output of character. * wait for output complete. * if any lines were active, set their tcr bits, * otherwise clear the xmit ready interrupt. * *//* * Physical address of Firefox ffcons. * Used to access SLU and interrupt cntlr registers * when the machine is on physical mode (during crash dump). */fc_putc(c) register int c;{ register struct fc_regs *fcaddr; int s, tcr, ln, tln, timo, tim2; int physmode; if( (mfpr(MAPEN) & 1) == 0 ) { physmode = 1; fcaddr = (struct fc_regs *)(MBUS_BASEADDR(mb_slot) + FF_DZ_OFF); } else { physmode = 0; fcaddr = (struct fc_regs *)ffcons; } if(physmode == 0) s = spl6(); tln = (ff_diagcons) ? 0x3 : 0x0; tcr = (fcaddr->fctcr & (1<<tln)); fcaddr->fctcr |= (1<<tln); while (1) { timo = 1000000; while ((fcaddr->fccsr&FC_TRDY) == 0) if(--timo == 0) break; if(timo == 0) { /* * Bit failed to clear. Rather than hanging forever * give up after logging an error. */ if (fcbail1 < 10) mprintf("fc_putc: FC_TRDY failed to set\n"); fcbail1++; break; } ln = (fcaddr->fccsr>>8) & 3; if (ln != tln) { tcr |= (1 << ln); fcaddr->fctcr &= ~(1 << ln); continue; } fcaddr->fctbuf = c&0xff; while (1) { tim2 = 1000000; while ((fcaddr->fccsr&FC_TRDY) == 0) if(--tim2 == 0) break; if(tim2 == 0) { /* * Bit failed to clear. Rather than hanging * forever give up after logging an error. */ if (fcbail2 < 10) mprintf("fc_putc: FC_TRDY 2 failed to set\n"); fcbail2++; break; } ln = (fcaddr->fccsr>>8) & 3; if (ln != tln) { tcr |= (1 << ln); fcaddr->fctcr &= ~(1 << ln); continue; } break; } break; } fcaddr->fctcr &= ~(1<<tln); if (tcr == 0) { ; } else fcaddr->fctcr |= tcr; if(physmode == 0) splx(s);}/* * This routine operates on the following assumptions: * 1. putc must have happened first, so SLU already inited. * 2. getc will happed before slu reveive interrupt enabled so * don't need to worry about int_req or int_msk registers. */fcgetc(){ register struct fc_regs *fcaddr = (struct fc_regs *)ffcons; register int c, line, timo; /* * Line number we expect input from. */ if(ff_diagcons) line = 3; else line = 0; while (1) { timo = 1000000; while ((fcaddr->fccsr&FC_RDONE) == 0) if(--timo == 0) break; if(timo == 0) { /* * Bit failed to clear. Rather than hanging forever * give up after logging an error. */ if (fcbail3 < 10) mprintf("fcgetc: FC_RDONE failed to set\n"); fcbail3++; break; } c = fcaddr->fcrbuf; if(((c >> 8) & 3) != line) /* wrong line mumber */ continue; if(c&(FC_DO|FC_FE|FC_PE)) /* error */ continue; break; } return(c & 0xff);}/* * Modem Control Routines *//* * * Function: * * fc_cd_drop * * Functional description: * * Determine if carrier has dropped. If so call fc_tty_drop to terminate * the connection. * * Arguements: * * register struct tty *tp - terminal pointer ( for terminal attributes ) * * Return value: * * none * */fc_cd_drop(tp)register struct tty *tp;{ register struct fc_regs *fcaddr = (struct fc_regs *)ffcons; register int unit = minor(tp->t_dev); if ((tp->t_state&TS_CARR_ON) && ((fcaddr->fcmsr&FC_RCD) == 0)) {# ifdef DEBUG if (fcdebug) cprintf("fc_cd: no CD, tp=%x\n", tp);# endif DEBUG fc_tty_drop(tp); return; } fcmodem |= MODEM_CD;# ifdef DEBUG if (fcdebug) cprintf("fc_cd: CD is up, tp=%x\n", tp);# endif DEBUG}/* * * Function: * * fc_dsr_check * * Functional description: * * DSR must be asserted for a connection to be established. Here we either * start or terminate a connection on the basis of DSR. * * Arguements: * * register struct tty *tp - terminal pointer ( for terminal attributes ) * * Return value: * * none * */fc_dsr_check(tp)register struct tty *tp;{ int unit = minor(tp->t_dev); register struct fc_regs *fcaddr = (struct fc_regs *)ffcons; if (fcmodem&MODEM_DSR_START) {# ifdef DEBUG if (fcdebug) cprintf("fc_dsr_check0: tp=%x\n", tp);# endif DEBUG fcmodem &= ~MODEM_DSR_START; /* * If fcdsr is set look for DSR|CTS|CD, otherwise look * for CD|CTS only. */ if (fcdsr) { if ((fcaddr->fcmsr&FC_XMIT) == FC_XMIT) fc_start_tty(tp); } else { if ((fcaddr->fcmsr&FC_NODSR) == FC_NODSR) fc_start_tty(tp); } return; } if ((tp->t_state&TS_CARR_ON)==0) fc_tty_drop(tp);}/* * * Function: * * fc_cd_down * * Functional description: * * Determine whether or not carrier has been down for > 2 sec. * * Arguements: * * register struct tty *tp - terminal pointer ( for terminal attributes ) * * Return value: * * 1 - if carrier was down for > 2 sec. * 0 - if carrier down <= 2 sec. * */fc_cd_down(tp)struct tty *tp;{ int msecs; int unit = minor(tp->t_dev); msecs = 1000000 * (time.tv_sec - fctimestamp.tv_sec) + (time.tv_usec - fctimestamp.tv_usec); if (msecs > 2000000){# ifdef DEBUG if (fcdebug) cprintf("fc_cd_down: msecs > 20000000\n");# endif DEBUG return(1); } else{# ifdef DEBUG if (fcdebug) cprintf("fc_cd_down: msecs < 20000000\n");# endif DEBUG return(0); }}/* * * Function: * * fc_tty_drop * * Functional description: * * Terminate a connection. * * Arguements: * * register struct tty *tp - terminal pointer ( for terminal attributes ) * * Return value: * * none * */fc_tty_drop(tp)struct tty *tp;{ register struct fc_regs *fcaddr = (struct fc_regs *)ffcons; register int unit; if (tp->t_flags&NOHANG) return; unit = minor(tp->t_dev);# ifdef DEBUG if (fcdebug) cprintf("fc_tty_drop: unit=%d\n",unit);# endif DEBUG /* * Notify any processes waiting to open this line. Useful in the * case of a false start. */ fcmodem = MODEM_BADCALL; tp->t_state &= ~(TS_CARR_ON|TS_TTSTOP|TS_BUSY|TS_ISUSP); wakeup((caddr_t)&tp->t_rawq); gsignal(tp->t_pgrp, SIGHUP); gsignal(tp->t_pgrp, SIGCONT); fcaddr->fcdtr &= ~(FC_RDTR|FC_RRTS);}/* * * Function: * * fc_start_tty * * Functional description: * * Establish a connection. * * Arguements: * * register struct tty *tp - terminal pointer ( for terminal attributes ) * * Return value: * * none * */fc_start_tty(tp) register struct tty *tp;{ int unit = minor(tp->t_dev); tp->t_state &= ~(TS_ONDELAY); tp->t_state |= TS_CARR_ON;# ifdef DEBUG if (fcdebug) cprintf("fc_start_tty: tp=%x\n", tp);# endif DEBUG if (fcmodem&MODEM_DSR) untimeout(fc_dsr_check, tp); fcmodem |= MODEM_CD|MODEM_CTS|MODEM_DSR; fctimestamp.tv_sec = fctimestamp.tv_usec = 0; wakeup((caddr_t)&tp->t_rawq);}fcbaudrate(speed)register int speed;{ if (fc_valid_speeds & (1 << speed)) return (1); else return (0);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -