Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Aug 1996 16:59:33 -0700
From:      Julian Elischer <julian@whistle.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        hackers@FreeBSD.org, pst@shockwave.com
Subject:   Re: gdb remote
Message-ID:  <32278065.15FB7483@whistle.com>
References:  <199608302103.HAA21180@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <i386/isa/isa.h>
  #include <i386/isa/isa_device.h>
  #include <i386/isa/sioreg.h>
+ #include <machine/cons.h>
  
  #ifdef COM_ESP
  #include <i386/isa/ic/esp.h>
***************
*** 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 <machine/cons.h>
  
  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--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?32278065.15FB7483>