+ register unit;
+ static int failed;
+
+ unit = minor(tp->t_dev);
+ current = &consout[unit];
+ current->cp_hdr.cp_comm = CPRESET;
+ current->cp_hdr.cp_count = 0;
+ current->cp_hdr.cp_unit = unit;
+ mtpr(CPMDCB, vtoph((struct proc *)0, (unsigned)current));
+ cnlast = ¤t->cp_hdr;
+ timo = 10000;
+ do
+ uncache(¤t->cp_hdr.cp_unit);
+ while ((current->cp_hdr.cp_unit&CPTAKE) == 0 && --timo);
+ if (current->cp_hdr.cp_unit & CPTAKE) {
+ cnparams(tp, &tp->t_termios);
+ failed = 0;
+ } else {
+ if (failed++ == 0)
+ log(LOG_ERR, "Console wedged, reset failed.\n");
+ ttyflush(tp, FWRITE);
+ }
+}