Subject: port-amiga/1559: Changes for grf/ite_ul dictated by -Wall, one of them urgent
To: None <gnats-bugs@gnats.netbsd.org>
From: Ignatios Souvatzis <is@beverly.rhein.de>
List: netbsd-bugs
Date: 10/02/1995 13:33:51
>Number:         1559
>Category:       port-amiga
>Synopsis:       compiling sys/arch/amiga/dev/*ul.c with -Wall detects problems
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Oct  2 15:50:27 1995
>Last-Modified:
>Originator:     Ignatios Souvatzis
>Organization:
	private site
>Release:        950922
>Environment:
System: NetBSD beverly 1.0A NetBSD 1.0A (BEVERLY) #: Sun Oct 1 15:23:56 MET 1995 is@beverly:/usr/src/sys/arch/amiga/compile/BEVERLY amiga


>Description:
	Compiling *ul* stuff with -Wall detects some minor glitches and a 
	editing error resulting in accessing the wrong structure element.
>How-To-Repeat:
	Compile with -Wall
>Fix:

apply:


*** /monster/src/sys/arch/amiga/dev/grf_ulreg.h	Sat Aug 19 09:11:55 1995
--- grf_ulreg.h	Sat Sep 30 11:19:10 1995
***************
*** 99,103 ****
--- 99,105 ----
  
  #ifdef _KERNEL
  void gsp_write(struct gspregs *gsp, u_int16_t *data, size_t size);
+ int grful_cnprobe(void);
+ void grful_iteinit(struct grf_softc *);
  #endif
  

*** /monster/src/sys/arch/amiga/dev/grf_ul.c	Sat Aug 19 09:11:54 1995
--- grf_ul.c	Sat Sep 30 11:22:48 1995
***************
*** 37,42 ****
--- 37,43 ----
     using the TMS34010 processor. */
  
  #include <sys/param.h>
+ #include <sys/systm.h>
  #include <sys/errno.h>
  #include <sys/ioctl.h>
  #include <sys/device.h>
***************
*** 53,59 ****
  #include <amiga/dev/grf_ulreg.h>
  #include <amiga/dev/grf_ultmscode.h>
  
! int ul_ioctl __P((struct grf_softc *gp, u_long, void *, dev_t));
  
  /*
   * marked true early so that ulowell_cnprobe() can tell if we are alive. 
--- 54,63 ----
  #include <amiga/dev/grf_ulreg.h>
  #include <amiga/dev/grf_ultmscode.h>
  
! int ul_ioctl __P((struct grf_softc *, u_long, void *, dev_t));
! int ul_getcmap __P((struct grf_softc *, struct grf_colormap *, dev_t));
! int ul_putcmap __P((struct grf_softc *, struct grf_colormap *, dev_t));
! int ul_bitblt __P((struct grf_softc *, struct grf_bitblt *, dev_t));
  
  /*
   * marked true early so that ulowell_cnprobe() can tell if we are alive. 
***************
*** 213,219 ****
  	gi->gd_fbheight	= 1024;
  	gi->gd_colors	= 256;
  
! 	ba->ctrl = ba->ctrl & ~INCR | (LBL|INCW);
  	ba->hstadrh = 0xC000;
  	ba->hstadrl = 0x0080;
  	ba->data = 0x0;		/* disable screen refresh and video output */
--- 217,223 ----
  	gi->gd_fbheight	= 1024;
  	gi->gd_colors	= 256;
  
! 	ba->ctrl = (ba->ctrl & ~INCR) | (LBL|INCW);
  	ba->hstadrh = 0xC000;
  	ba->hstadrl = 0x0080;
  	ba->data = 0x0;		/* disable screen refresh and video output */
***************
*** 221,227 ****
  	ba->data = 0xFFFF;	/* no display int possible */
  	ba->data = 0x000C;	/* CAS before RAS refresh each 64 local clks */
  
! 	ba->ctrl = ba->ctrl & ~INCW | LBL;
  	ba->hstadrh = 0xfe80;
  	ba->hstadrl = 0;
  	ba->data = 4;
--- 225,231 ----
  	ba->data = 0xFFFF;	/* no display int possible */
  	ba->data = 0x000C;	/* CAS before RAS refresh each 64 local clks */
  
! 	ba->ctrl = (ba->ctrl & ~INCW) | LBL;
  	ba->hstadrh = 0xfe80;
  	ba->hstadrl = 0;
  	ba->data = 4;
***************
*** 350,356 ****
  	gi->gd_dyn.gdi_dx	= 0;
  	gi->gd_dyn.gdi_dy	= 0;
  
! 	ba->ctrl = ba->ctrl & ~INCR | (LBL|INCW);
  
  	ba->hstadrh = 0xC000;
  	ba->hstadrl = 0x0000;
--- 354,360 ----
  	gi->gd_dyn.gdi_dx	= 0;
  	gi->gd_dyn.gdi_dy	= 0;
  
! 	ba->ctrl = (ba->ctrl & ~INCR) | (LBL|INCW);
  
  	ba->hstadrh = 0xC000;
  	ba->hstadrl = 0x0000;
***************
*** 370,380 ****
  	if (abs(md->pixel_clock - ulowell_clock[0]) >
  	    abs(md->pixel_clock - ulowell_clock[1])) {
  
! 		ba->data = ba->data & 0xFC | 2 | 1;
  		md->pixel_clock = ulowell_clock[1];
  
  	} else {
! 		ba->data = ba->data & 0xFC | 2 | 0;
  		md->pixel_clock = ulowell_clock[0];
  	}
  
--- 374,384 ----
  	if (abs(md->pixel_clock - ulowell_clock[0]) >
  	    abs(md->pixel_clock - ulowell_clock[1])) {
  
! 		ba->data = (ba->data & 0xFC) | 2 | 1;
  		md->pixel_clock = ulowell_clock[1];
  
  	} else {
! 		ba->data = (ba->data & 0xFC) | 2 | 0;
  		md->pixel_clock = ulowell_clock[0];
  	}
  
***************
*** 473,479 ****
  	void *auxp;
  {
  	static struct grf_ul_softc congrf;
- 	static int coninited;
  	struct zbus_args *zap;
  	struct grf_softc *gp;
  	struct grf_ul_softc *gup;
--- 477,482 ----
***************
*** 555,561 ****
  		vm->mode_num = current_mon - ul_monitor_defs + 1;
  
  	md = ul_monitor_defs + vm->mode_num - 1;
! 	strncpy (vm->mode_descr, md, 
  		sizeof (vm->mode_descr));
  
  	/* XXX should tell TMS to measure it */
--- 558,564 ----
  		vm->mode_num = current_mon - ul_monitor_defs + 1;
  
  	md = ul_monitor_defs + vm->mode_num - 1;
! 	strncpy (vm->mode_descr, md->mode_descr, 
  		sizeof (vm->mode_descr));
  
  	/* XXX should tell TMS to measure it */
***************
*** 593,599 ****
  	struct grf_softc *gp;
  	unsigned mode;
  {
- 	struct grfvideo_mode *md;
  	struct grf_ul_softc *gup;
  	struct gspregs *ba;
  	int error;
--- 596,601 ----
***************
*** 752,758 ****
  {
  	struct grf_ul_softc *gup;
  	u_int8_t *mymap;
! 	int i, mxidx, error;
  
  	gup = (struct grf_ul_softc *)gp;
  
--- 754,760 ----
  {
  	struct grf_ul_softc *gup;
  	u_int8_t *mymap;
! 	int mxidx, error;
  
  	gup = (struct grf_ul_softc *)gp;
  
***************
*** 885,891 ****
  	u_short put, new_put, next, oc;
  	u_long put_hi, oa;
  	size_t n;
- 	int s;
  
  	if (size == 0 || size > 8)
  	        return;
--- 887,892 ----
***************
*** 895,912 ****
  	oc = gsp->ctrl;
  	oa = GSPGETHADRS(gsp);
  
! 	gsp->ctrl = oc & ~INCR | LBL | INCW;
! 	GSPSETHADRS(gsp,GSP_MODE_ADRS);
  	gsp->data &= ~GMODE_FLUSH;
  
! 	GSPSETHADRS(gsp,PUT_HI_PTR_ADRS);
  	put_hi = gsp->data << 16;
  
! 	GSPSETHADRS(gsp,PUT_PTR_ADRS);
  	put = gsp->data;
  	new_put = put + (8<<4);
  
! 	GSPSETHADRS(gsp,GET_PTR_ADRS);
  	next = gsp->data;
  	
  	while (next == new_put) {
--- 896,913 ----
  	oc = gsp->ctrl;
  	oa = GSPGETHADRS(gsp);
  
! 	gsp->ctrl = (oc & ~INCR) | LBL | INCW;
! 	GSPSETHADRS(gsp, GSP_MODE_ADRS);
  	gsp->data &= ~GMODE_FLUSH;
  
! 	GSPSETHADRS(gsp, PUT_HI_PTR_ADRS);
  	put_hi = gsp->data << 16;
  
! 	GSPSETHADRS(gsp, PUT_PTR_ADRS);
  	put = gsp->data;
  	new_put = put + (8<<4);
  
! 	GSPSETHADRS(gsp, GET_PTR_ADRS);
  	next = gsp->data;
  	
  	while (next == new_put) {


*** /monster/src/sys/arch/amiga/dev/ite_ul.c	Sat Aug 19 09:11:58 1995
--- ite_ul.c	Sat Sep 30 11:30:21 1995
***************
*** 226,232 ****
  {
  	struct gspregs *ba;
  	u_int16_t cmd[7];
- 	int pos;
  
  	ba = (struct gspregs *)ip->grf->g_regkva;
  
--- 226,231 ----
***************
*** 375,381 ****
  void ulowell_putc(struct ite_softc *ip, int c, int dy, int dx, int mode)
  {
  	struct gspregs *ba;
- 	register u_int8_t attr;
  	u_int16_t cmd[8];
  	
  	ba = (struct gspregs *)ip->grf->g_regkva;
--- 374,379 ----
***************
*** 416,423 ****
  void ulowell_scroll(struct ite_softc *ip, int sy, int sx, int count, int dir)
  {
  	struct gspregs *ba;
- 
- 	register int height, dy, i;
  	u_int16_t cmd[7];
  
  	ba = (struct gspregs *)ip->grf->g_regkva;
--- 414,419 ----
>Audit-Trail:
>Unformatted:
Ignatios Souvatzis