Subject: sfb (PMAGB-BB) patch for alternate fixed-frequencies
To: None <port-pmax@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 07/02/1998 14:23:35
Could someone test this patch out on an SFB?

Any kind would do, but one of the PMAGB-BB cards jumpered for an
alternate crystal -- 1024x876 or 1024x768, compatible with fixed-freq
monitors for CFB or Persnal Decstation, respectively -- would be most
useful.  It might even get rcons working on those machines, unless I
made yet another dyslexic horizontal/vertical boo-booo...


Index: src/sys/arch/pmax/dev/sfb.c
===================================================================
RCS file: /cvsroot/src/sys/arch/pmax/dev/sfb.c,v
retrieving revision 1.24
diff -c -r1.24 sfb.c
*** sfb.c	1998/03/31 11:32:53	1.24
--- sfb.c	1998/07/02 21:20:44
***************
*** 105,110 ****
--- 105,111 ----
  #include <machine/pmioctl.h>
  #include <pmax/dev/fbreg.h>
  
+ #define SFBDEBUG
  /*
   * These need to be mapped into user space.
   */
***************
*** 223,228 ****
--- 224,231 ----
  	int silent;
  {
  
+ 	int h_setup, v_setup;
+ 
  	/*
  	 * If this device is being intialized as the console, malloc()
  	 * is not yet up and we must use statically-allocated space.
***************
*** 243,248 ****
--- 246,254 ----
  	if (badaddr(base + SFB_OFFSET_VRAM, 4))
  		return (0);
  
+ 	h_setup = * (u_int32_t*) ( ((caddr_t)fi->fi_base) + 0x0064);
+ 	v_setup = * (u_int32_t*) ( ((caddr_t)fi->fi_base) + 0x0068);
+ 
  	/* Fill in main frame buffer info struct. */
  	fi->fi_unit = unit;
  	fi->fi_pixels = (caddr_t)(base + SFB_OFFSET_VRAM);
***************
*** 256,267 ****
  
  	/* Fill in Frame Buffer Type struct. */
  	fi->fi_type.fb_boardtype = PMAX_FBTYPE_SFB;
! 	fi->fi_type.fb_height = 1024;
! 	fi->fi_type.fb_width = 1280;
  	fi->fi_type.fb_depth = 8;
  	fi->fi_type.fb_cmsize = 256;
  	fi->fi_type.fb_size = SFB_FB_SIZE;
  
  	/* Initialize the RAMDAC. */
  	bt459init (fi);
  
--- 262,281 ----
  
  	/* Fill in Frame Buffer Type struct. */
  	fi->fi_type.fb_boardtype = PMAX_FBTYPE_SFB;
! 	fi->fi_type.fb_height = (v_setup & 0x07ff);
! 	fi->fi_type.fb_width = 	(h_setup & 0x01ff) << 2;
  	fi->fi_type.fb_depth = 8;
  	fi->fi_type.fb_cmsize = 256;
  	fi->fi_type.fb_size = SFB_FB_SIZE;
  
+ #if defined(DEBUG) || defined(SFBDEBUG)
+ 	printf(" (%d x %d pixels) ", fi->fi_type.fb_height,
+ 	       	fi->fi_type.fb_width);
+ #endif
+ 
+  	/* Initialize the RAMDAC. */
+   	bt459init (fi);
+   
  	/* Initialize the RAMDAC. */
  	bt459init (fi);
  
***************
*** 282,290 ****
  		MIPS_PHYS_TO_KSEG1(MIPS_KSEG0_TO_PHYS(&sfbu));
  
  	/* This is glass-tty state but it's in the shared structure. Ick. */
! 	fi->fi_fbu->scrInfo.max_row = 67;
  	fi->fi_fbu->scrInfo.max_col = 80;
  
  	init_pmaxfbu(fi);
  
  	/*
--- 296,308 ----
  		MIPS_PHYS_TO_KSEG1(MIPS_KSEG0_TO_PHYS(&sfbu));
  
  	/* This is glass-tty state but it's in the shared structure. Ick. */
! 	fi->fi_fbu->scrInfo.max_row = /*67*/ fi->fi_type.fb_width / 15;
  	fi->fi_fbu->scrInfo.max_col = 80;
  
+ #if defined(DEBUG) || defined(SFBDEBUG)
+ 	printf(" (tty %d rows by %d cols) ", 
+ 	       fi->fi_fbu->scrInfo.max_row, fi->fi_fbu->scrInfo.max_col);
+ #endif
  	init_pmaxfbu(fi);
  
  	/*