Subject: port-powerpc/23623: OPENBLOCKS266 console broken
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <kiyohara@kk.iij4u.or.jp>
List: netbsd-bugs
Date: 12/02/2003 17:02:34
>Number:         23623
>Category:       port-powerpc
>Synopsis:       OPENBLOCKS266 console broken
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-powerpc-maintainer
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 02 17:03:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     KIYOHARA Takashi
>Release:        NetBSD 1.6ZF
>Organization:
>Environment:
NetBSD evbppc.fool 1.6ZF NetBSD 1.6ZF (OPENBLOCKS266) #0: Sun Nov 23 18:27:42 JST 2003 lance@hierophant.fool:/usr/src/sys/arch/evbppc/compile/OPENBLOCKS266 evbppc

>Description:
Kernel output charactor is clean at boot time. But init(8) output charator is breaking.
Its problem is to set other value to console frequency. kernel is COM_FREQ * 4, init is COM_FREQ * 6.

>How-To-Repeat:
NetBSD/evbppc-1.6ZF (OPENBLOCKS266) work & look at console.

>Fix:
Index: arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c,v
retrieving revision 1.1
diff -c -r1.1 ibm4xxgpx_autoconf.c
*** arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c	2003/09/24 11:47:02	1.1
--- arch/powerpc/ibm4xx/ibm4xxgpx_autoconf.c	2003/11/30 15:48:10
***************
*** 46,51 ****
--- 46,52 ----
  
  struct device *booted_device;
  int booted_partition;
+ int com_freq;
  
  /*
   * List of port-specific devices to attach to the processor local bus.
***************
*** 101,110 ****
  	if (strcmp(dev->dv_cfdata->cf_name, "com") == 0 &&
  	    strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
  		/* Set the frequency of the on-chip UART. */
- 		int freq = COM_FREQ * 6;
- 
  		if (prop_set(dev_propdb, dev, "frequency",
! 			     &freq, sizeof(freq), PROP_INT, 0) != 0)
  			printf("WARNING: unable to set frequency "
  			    "property for %s\n", dev->dv_xname);
  		return;
--- 102,109 ----
  	if (strcmp(dev->dv_cfdata->cf_name, "com") == 0 &&
  	    strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
  		/* Set the frequency of the on-chip UART. */
  		if (prop_set(dev_propdb, dev, "frequency",
! 			     &com_freq, sizeof(com_freq), PROP_INT, 0) != 0)
  			printf("WARNING: unable to set frequency "
  			    "property for %s\n", dev->dv_xname);
  		return;
Index: arch/evbppc/obs405/consinit.c
===================================================================
RCS file: /cvsroot/src/sys/arch/evbppc/obs405/consinit.c,v
retrieving revision 1.1
diff -c -r1.1 consinit.c
*** arch/evbppc/obs405/consinit.c	2003/09/23 14:45:14	1.1
--- arch/evbppc/obs405/consinit.c	2003/11/30 15:50:18
***************
*** 64,69 ****
--- 64,70 ----
  #define CONMODE ((TTYDEF_CFLAG & ~(CSIZE | CSTOPB | PARENB)) | CS8) /* 8N1 */
  #endif
  int comcnmode = CONMODE;
+ extern int com_freq;
  #endif /* NCOM */
  
  #ifdef KGDB
***************
*** 109,120 ****
  	if (initted)
  		return;
  	initted = 1;
  
  #if (NCOM > 0)
  	/* We *know* the com-console attaches to opb */
  	tag = opb_get_bus_space_tag();
  
! 	if (comcnattach(tag, CONADDR, CONSPEED, COM_FREQ*4,
  	    COM_TYPE_NORMAL, comcnmode))
  		panic("can't init serial console @%x", CONADDR);
  	else
--- 110,122 ----
  	if (initted)
  		return;
  	initted = 1;
+ 	com_freq = COM_FREQ * 4;
  
  #if (NCOM > 0)
  	/* We *know* the com-console attaches to opb */
  	tag = opb_get_bus_space_tag();
  
! 	if (comcnattach(tag, CONADDR, CONSPEED, com_freq,
  	    COM_TYPE_NORMAL, comcnmode))
  		panic("can't init serial console @%x", CONADDR);
  	else
***************
*** 131,137 ****
  #if (NCOM > 0)
  	if(!strcmp(kgdb_devname, "com")) {
  		bus_space_tag_t tag = opb_get_bus_space_tag();
! 		com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, COM_FREQ * 4,
  		    COM_TYPE_NORMAL, comkgdbmode);
  	}
  #endif
--- 133,139 ----
  #if (NCOM > 0)
  	if(!strcmp(kgdb_devname, "com")) {
  		bus_space_tag_t tag = opb_get_bus_space_tag();
! 		com_kgdb_attach(tag, comkgdbaddr, comkgdbrate, com_freq,
  		    COM_TYPE_NORMAL, comkgdbmode);
  	}
  #endif

>Release-Note:
>Audit-Trail:
>Unformatted: