From owner-freebsd-hackers Fri Aug 30 17:01:56 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id RAA08641 for hackers-outgoing; Fri, 30 Aug 1996 17:01:56 -0700 (PDT) Received: from whistle.com (s205m131.whistle.com [207.76.205.131]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id RAA08636 for ; Fri, 30 Aug 1996 17:01:53 -0700 (PDT) Received: (from smap@localhost) by whistle.com (8.7.5/8.6.12) id RAA09801; Fri, 30 Aug 1996 17:00:59 -0700 (PDT) Received: from current1.whistle.com(207.76.205.22) by whistle.com via smap (V1.3) id sma009797; Fri Aug 30 17:00:40 1996 Message-ID: <32278065.15FB7483@whistle.com> Date: Fri, 30 Aug 1996 16:59:33 -0700 From: Julian Elischer Organization: Whistle Communications X-Mailer: Mozilla 3.0b6 (X11; I; FreeBSD 2.2-CURRENT i386) MIME-Version: 1.0 To: Bruce Evans CC: hackers@FreeBSD.org, pst@shockwave.com Subject: Re: gdb remote References: <199608302103.HAA21180@godzilla.zeta.org.au> Content-Type: multipart/mixed; boundary="------------3F54BC7E1CFBAE3959E2B600" Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk This is a multi-part message in MIME format. --------------3F54BC7E1CFBAE3959E2B600 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Bruce Evans wrote: > > >> The retries might be caused by UART bugs. sio context switches the > >> UART registers on every `cn' i/o so that TCIOSETA on the debugger > >> port can be single stepped and don't wipe out the debugger's settings. > >> This works OK at typing speeds but can't work for input at high speeds > >> unless the context switching is a no-op. > > >Can you suggest a patch to nobble this? > > I skip writing to the divisor registers if the divisor is already correct, > but it doesn't seem to make any difference for gdb. > OK bruce, here is a patch for sio.c that solves my part of the problem... the cnxxx code doesn't initialise the registers unless the port is open, (except the first time) though you may want to modify the patch. I'd like to commit this unless you have a better version :) julian --------------3F54BC7E1CFBAE3959E2B600 Content-Type: text/plain; charset=us-ascii; name="sio.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sio.diff" Index: sio.c =================================================================== RCS file: /cvs/freebsd/src/sys/i386/isa/sio.c,v retrieving revision 1.144 diff -c -r1.144 sio.c *** 1.144 1996/07/17 22:07:23 --- sio.c 1996/08/30 23:49:24 *************** *** 71,76 **** --- 71,77 ---- #include #include #include + #include #ifdef COM_ESP #include *************** *** 267,272 **** --- 268,275 ---- void *devfs_token_cuai; #endif }; + static int cn_initialised = -2; + struct siocnstate sp; /* * XXX public functions in drivers should be declared in headers produced *************** *** 1051,1056 **** --- 1054,1063 ---- #else tp = com->tp = &sio_tty[unit]; #endif + if( unit == comconsole ) + if ( cn_initialised == -1 ) + cn_initialised = 0; + s = spltty(); /* * We jump to this label after all non-interrupted sleeps to pick *************** *** 1280,1287 **** com->active_out = FALSE; wakeup(&com->active_out); wakeup(TSA_CARR_ON(tp)); /* restart any wopeners */ ! if (!(com->state & CS_DTR_OFF) && unit != comconsole) kdc_sio[unit].kdc_state = DC_IDLE; splx(s); } --- 1287,1297 ---- com->active_out = FALSE; wakeup(&com->active_out); wakeup(TSA_CARR_ON(tp)); /* restart any wopeners */ ! if (!(com->state & CS_DTR_OFF) && unit != comconsole) { kdc_sio[unit].kdc_state = DC_IDLE; + } + if( unit == comconsole ) + cn_initialised = -1; splx(s); } *************** *** 2348,2354 **** /* * Following are all routines needed for SIO to act as console */ - #include struct siocnstate { u_char dlbl; --- 2358,2363 ---- *************** *** 2387,2392 **** --- 2396,2403 ---- int divisor; Port_t iobase; + /* -2 = initial -1 = don't bother, 1 = done */ + if((cn_initialised != 0) && (cn_initialised != -2)) return; /* * Save all the device control registers except the fifo register * and set our default ones (cs8 -parenb speed=comdefaultrate). *************** *** 2411,2416 **** --- 2422,2428 ---- * an interrupt by floating the IRQ line. */ outb(iobase + com_mcr, (sp->mcr & MCR_IENABLE) | MCR_DTR | MCR_RTS); + cn_initialised++ ; } static void *************** *** 2419,2424 **** --- 2431,2437 ---- { Port_t iobase; + if(cn_initialised < 0) return; /* * Restore the device control registers. */ *************** *** 2433,2438 **** --- 2446,2452 ---- */ outb(iobase + com_mcr, sp->mcr | MCR_DTR | MCR_RTS); outb(iobase + com_ier, sp->ier); + cn_initialised--; } void *************** *** 2470,2476 **** int c; Port_t iobase; int s; - struct siocnstate sp; iobase = siocniobase; s = spltty(); --- 2484,2489 ---- *************** *** 2492,2498 **** int c; Port_t iobase; int s; - struct siocnstate sp; iobase = siocniobase; s = spltty(); --- 2505,2510 ---- *************** *** 2511,2517 **** int c; { int s; - struct siocnstate sp; s = spltty(); siocnopen(&sp); --- 2523,2528 ---- --------------3F54BC7E1CFBAE3959E2B600--