[parisc-linux-cvs] STI code cleanup

Helge Deller deller@gmx.de
Sat, 17 Feb 2001 02:34:29 +0100


I'm committing now the following patch, which
- adds lots of comments to the STI-structs
- adds headers to all important files
- changes the return value of some [w|b]mode_xyz functions
- default_sti is now a pointer to a sti_struct in sti_rom[]
- sti_rom[] is now dynamically allocated
- enables the "sti=<no>" commandline
- cleaned up the TODO- and KNOWN ISSUES lists
- and maybe something more :-)

Helge


Index: sticon-bmode.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticon-bmode.c,v
retrieving revision 1.4
diff -u -r1.4 sticon-bmode.c
--- sticon-bmode.c	2001/02/13 23:11:11	1.4
+++ sticon-bmode.c	2001/02/17 01:20:46
@@ -1,11 +1,18 @@
+/*
+ *  linux/drivers/video/sti/sticon-bmode.c -
+ *	byte mode HP STI firmware driver
+ *
+ *	Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
+ *	Portions Copyright (C) 2001 Helge Deller <deller@gmx.de>
+ *
+ */
+
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/malloc.h>
 #include <linux/init.h>
 
-#include <asm/uaccess.h>
-#include <asm/pgalloc.h>
 #include <asm/io.h>
 
 #include "sticon-bmode.h"
@@ -121,7 +128,7 @@
 }
 
 	
-struct sti_struct * __init
+int __init
 bmode_sti_read_rom(struct sti_struct *sti, unsigned long address, unsigned 
long hpa)
 {
 	struct sti_cooked_rom *cooked;
@@ -222,10 +229,9 @@
 	sti->font_height = STI_U8(sti->font->height);
 	sti->font = (struct sti_rom_font *) virt_to_phys(sti->font);
 			 
-printk("Using font at %08lx, w=%d, h=%d\n",
-            (unsigned long)sti->font, sti->font_width, sti->font_height);
+	sti->sti_mem_request = STI_U32(raw->sti_mem_req);
 
-	return sti;
+	return 1;
 
 out_err:
 	if(raw)
@@ -233,5 +239,5 @@
 	if(cooked)
 		kfree(cooked);
 
-	return NULL;
+	return 0;
 }
Index: sticon-wmode.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticon-wmode.c,v
retrieving revision 1.6
diff -u -r1.6 sticon-wmode.c
--- sticon-wmode.c	2001/02/13 23:11:11	1.6
+++ sticon-wmode.c	2001/02/17 01:20:46
@@ -1,11 +1,18 @@
+/*
+ *  linux/drivers/video/sti/sticon-wmode.c -
+ *	word mode HP STI firmware driver
+ *
+ *	Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
+ *	Portions Copyright (C) 2001 Helge Deller <deller@gmx.de>
+ *
+ */
+
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/malloc.h>
 #include <linux/init.h>
 
-#include <asm/uaccess.h>
-#include <asm/pgalloc.h>
 #include <asm/io.h>
 
 #include "sticon-wmode.h"
@@ -83,7 +90,7 @@
 	return 0;
 }
 
-struct sti_struct * __init
+int __init
 wmode_sti_read_rom(struct sti_struct *sti, unsigned long address, unsigned 
long hpa)
 {
 	struct sti_cooked_rom *cooked;
@@ -126,15 +133,17 @@
 	sti->font_height = sti->font->height;
 	sti->font = (struct sti_rom_font *) virt_to_phys(sti->font);
 
-printk("Using font at %08lx, w=%d, h=%d\n", 
-	    (unsigned long)sti->font, sti->font_width, sti->font_height);
-	return sti;
+	sti->sti_mem_request = raw->sti_mem_req;
 
+	wmode_sti_dump_rom(raw);
+	
+	return 1;
+
 out_err:
 	if(raw)
 		kfree(raw);
 	if(cooked)
 		kfree(cooked);
 
-	return NULL;
+	return 0;
 }
Index: sticon.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticon.c,v
retrieving revision 1.5
diff -u -r1.5 sticon.c
--- sticon.c	2001/02/15 23:25:45	1.5
+++ sticon.c	2001/02/17 01:20:46
@@ -32,13 +32,6 @@
  *  License.  See the file COPYING in the main directory of this archive for
  *  more details.
  *
- *
- *  TODO:
- *   - call STI in virtual mode rather than in real mode
- *   - support for PCI-only STI ROMs (which don't have a traditional region
- *     list)
- *   - support for multiple STI devices in one machine
- *   - try to make it work on m68k hp workstations ;)
  */
 
 #include <linux/init.h>
@@ -72,14 +65,14 @@
 
 static void sticon_putc(struct vc_data *conp, int c, int ypos, int xpos)
 {
-    sti_putc(&default_sti, c, ypos, xpos);
+    sti_putc(default_sti, c, ypos, xpos);
 }
 
 static void sticon_putcs(struct vc_data *conp, const unsigned short *s,
 			 int count, int ypos, int xpos)
 {
     while (count--) {
-	sti_putc(&default_sti, *s++, ypos, xpos++);
+	sti_putc(default_sti, *s++, ypos, xpos++);
     }
 }
 
@@ -90,7 +83,7 @@
     car1 = conp->vc_screenbuf[conp->vc_x + conp->vc_y * conp->vc_cols];
     switch (mode) {
     case CM_ERASE:
-	sti_putc(&default_sti, car1, conp->vc_y, conp->vc_x);
+	sti_putc(default_sti, car1, conp->vc_y, conp->vc_x);
 	break;
     case CM_MOVE:
     case CM_DRAW:
@@ -100,7 +93,7 @@
 	case CUR_LOWER_HALF:
 	case CUR_TWO_THIRDS:
 	case CUR_BLOCK:
-	    sti_putc(&default_sti, (car1 & 255) + (0 << 8) + (7 << 11),
+	    sti_putc(default_sti, (car1 & 255) + (0 << 8) + (7 << 11),
 		     conp->vc_y, conp->vc_x);
 	    break;
 	}
@@ -111,7 +104,7 @@
 static int
 sticon_scroll(struct vc_data *conp, int t, int b, int dir, int count)
 {
-    struct sti_struct *sti = &default_sti;
+    struct sti_struct *sti = default_sti;
 
     if (console_blanked)
 	return 0;
@@ -137,12 +130,12 @@
 sticon_bmove(struct vc_data *conp, int sy, int sx, int dy, int dx,
 	     int height, int width)
 {
-    sti_bmove(&default_sti, sy, sx, dy, dx, height, width);
+    sti_bmove(default_sti, sy, sx, dy, dx, height, width);
 }
 
 static void sticon_init(struct vc_data *c, int init)
 {
-    struct sti_struct *sti = &default_sti;
+    struct sti_struct *sti = default_sti;
     int vc_cols, vc_rows;
 
     sti_set(sti, 0, 0, sti_onscreen_y(sti), sti_onscreen_x(sti), 0);
@@ -160,7 +153,7 @@
 static void sticon_clear(struct vc_data *conp, int sy, int sx, int height,
 			 int width)
 {
-    sti_clear(&default_sti, sy, sx, height, width);
+    sti_clear(default_sti, sy, sx, height, width);
 }
 
 static int sticon_switch(struct vc_data *conp)
Index: sticore.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticore.c,v
retrieving revision 1.6
diff -u -r1.6 sticore.c
--- sticore.c	2001/02/15 23:25:45	1.6
+++ sticore.c	2001/02/17 01:20:46
@@ -5,12 +5,23 @@
  *	Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
  *	Portions Copyright (C) 2001 Helge Deller <deller@gmx.de>
  *
- *  TODO:
- *   - call STI in virtual mode rather than in real mode
- *   - support for PCI-only STI ROMs (which don't have a traditional region
- *     list)
- *   - support for just using STI to switch to a colour fb (stifb ?)
- *   - try to make it work on m68k hp workstations ;)
+ * 
+ * TODO:
+ * - support 64bit parisc rom code
+ * - call STI in virtual mode rather than in real mode
+ * - use framebuffer-fonts for STI
+ * - support for PCI-only STI ROMs (which don't have a traditional region 
list)
+ * - colour fb (sticfb ?)
+ * - rename current stifb to stifb_mono ? 
+ * - support for multiple STI devices in one machine (not yet complete...)
+ * - screen blanking with state_mgmt() in text mode STI ? 
+ * - try to make it work on m68k hp workstations ;)
+ *
+ * 
+ * KNOWN ISSUES:
+ * - (monocrome) stifb doesn't work yet
+ * - byte-mode STI support is untested, please give feedback to 
<deller@gmx.de>
+ * 
  */
 
 #include <linux/module.h>
@@ -18,9 +29,7 @@
 #include <linux/kernel.h>
 #include <linux/malloc.h>
 #include <linux/init.h>
-#include <linux/delay.h>
 
-#include <asm/uaccess.h>
 #include <asm/pgalloc.h>
 #include <asm/io.h>
 #include <asm/hardware.h>
@@ -28,10 +37,11 @@
 #include "sticon-bmode.h"	/* HACK!! */
 #include "sticore.h"
 
-struct sti_struct default_sti;
+struct sti_struct *default_sti;
 
 static struct sti_font_flags default_font_flags = {
 	wait:	STI_WAIT,
+	non_text: 0,		/*XXX*/
 };
 
 /* The colour indices used by STI are
@@ -69,13 +79,12 @@
 void
 sti_init_graph(struct sti_struct *sti) 
 {
-	struct sti_init_inptr_ext inptr_ext = {
-		0, { 0 }, 0, NULL
-	};
+	struct sti_init_inptr_ext inptr_ext = { 0, };
 	struct sti_init_inptr inptr = {
-		3, STI_PTR(&inptr_ext)
+		3,	/* # of text planes (3 is maximum for STI) */ 
+		STI_PTR(&inptr_ext)
 	};
-	struct sti_init_outptr outptr = { 0 };
+	struct sti_init_outptr outptr = { 0, };
 	unsigned long flags;
 	int ret;
 
@@ -97,17 +106,15 @@
 sti_inq_conf(struct sti_struct *sti)
 {
 	struct sti_conf_inptr inptr = { NULL };
-	struct sti_conf_outptr_ext outptr_ext = { future_ptr: NULL };
-	struct sti_conf_outptr outptr = {
-		ext_ptr: STI_PTR(&outptr_ext)
-	};
 	unsigned long flags;
 	s32 ret;
+
+	sti->outptr.ext_ptr = STI_PTR(&sti->outptr_ext);
 	
 	do {
 		spin_lock_irqsave(&sti->lock, flags);
 		ret = STI_CALL(sti->inq_conf, &default_conf_flags,
-			&inptr, &outptr, sti->glob_cfg);
+			&inptr, &sti->outptr, sti->glob_cfg);
 		spin_unlock_irqrestore(&sti->lock, flags);
 	} while (ret == 1);
 }
@@ -264,23 +271,10 @@
 
 	
 void __init
-sti_dump_globcfg_ext(struct sti_glob_cfg_ext *cfg)
+sti_dump_globcfg(struct sti_glob_cfg *glob_cfg, unsigned int sti_mem_request)
 {
-	printk(	"monitor %d\n"
-		"in friendly mode: %d\n"
-		"power consumption %d watts\n"
-		"freq ref %d\n"
-		"sti_mem_addr %p\n",
-		cfg->curr_mon,
-		cfg->friendly_boot,
-		cfg->power,
-		cfg->freq_ref,
-		cfg->sti_mem_addr);
-}
-
-void __init
-sti_dump_globcfg(struct sti_glob_cfg *glob_cfg)
-{
+	struct sti_glob_cfg_ext *cfg;
+	
 	printk(	"%d text planes\n"
 		"%4d x %4d screen resolution\n"
 		"%4d x %4d offscreen\n"
@@ -299,8 +293,22 @@
 		glob_cfg->region_ptrs[6], glob_cfg->region_ptrs[7],
 		glob_cfg->reent_lvl,
 		glob_cfg->save_addr);
-	sti_dump_globcfg_ext(PTR_STI(glob_cfg->ext_ptr));
+
+	/* dump extended cfg */ 
+	cfg = PTR_STI(glob_cfg->ext_ptr);
+	printk(	"monitor %d\n"
+		"in friendly mode: %d\n"
+		"power consumption %d watts\n"
+		"freq ref %d\n"
+		"sti_mem_addr %p (size=%d bytes)\n",
+		cfg->curr_mon,
+		cfg->friendly_boot,
+		cfg->power,
+		cfg->freq_ref,
+		cfg->sti_mem_addr, sti_mem_request);
 }
+
+
 		
 int __init
 sti_init_glob_cfg(struct sti_struct *sti,
@@ -311,18 +319,21 @@
 	void *save_addr;
 	void *sti_mem_addr;
 
-	glob_cfg = kmalloc(sizeof *sti->glob_cfg, GFP_KERNEL);
-	glob_cfg_ext = kmalloc(sizeof *glob_cfg_ext, GFP_KERNEL);
+	if (!sti->sti_mem_request)
+		sti->sti_mem_request = 256; /* STI default */
+
+	glob_cfg = kmalloc(sizeof(*sti->glob_cfg), GFP_KERNEL);
+	glob_cfg_ext = kmalloc(sizeof(*glob_cfg_ext), GFP_KERNEL);
 	save_addr = kmalloc(1024 /*XXX*/, GFP_KERNEL);
-	sti_mem_addr = kmalloc(1024, GFP_KERNEL);
+	sti_mem_addr = kmalloc(sti->sti_mem_request, GFP_KERNEL);
 
 	if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr))
 		return -ENOMEM;
 
-	memset(glob_cfg, 0, sizeof *glob_cfg);
-	memset(glob_cfg_ext, 0, sizeof *glob_cfg_ext);
+	memset(glob_cfg, 0, sizeof(*glob_cfg));
+	memset(glob_cfg_ext, 0, sizeof(*glob_cfg_ext));
 	memset(save_addr, 0, 1024);
-	memset(sti_mem_addr, 0, 1024);
+	memset(sti_mem_addr, 0, sti->sti_mem_request);
 
 	glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext);
 	glob_cfg->save_addr = STI_PTR(save_addr);
@@ -363,48 +374,32 @@
 		return rom->font_start;
 }
 
+
 
-/*
-static unsigned long sti_address;
-static unsigned long sti_hpa;
+static unsigned int sti_index;
 
-static int __init sti_setup(char *str)
+static int __init 
+sti_setup(char *str)
 {
 	char *end;
-
-	if(strcmp(str, "pdc") == 0) {
-		sti_address = PAGE0->proc_sti;
-
-		return 1;
-	} else {
-		sti_address = simple_strtoul(str, &end, 16);
-
-		if((end == str) || (sti_address < 0xf0000000)) {
-			sti_address = 0;
-			return 0;
-		}
-
-		sti_hpa = sti_address;
-
-		return 1;
-	}
 
-	return 0;
+	sti_index = simple_strtoul(str, &end, 10);
+	return 1;
 }
 
 __setup("sti=", sti_setup);
-*/
+
 
 
-#define MAX_STI_ROMS 5
 static int num_sti_roms;
-static struct sti_struct sti_rom[MAX_STI_ROMS];
+static struct sti_struct *sti_rom[MAX_STI_ROMS];
 
 
 static struct sti_struct * __init
 sti_try_rom_generic(unsigned long address, unsigned long hpa)
 {
 	struct sti_struct *sti;
+	int ok;
 	u16 sig;
 	
 test_rom:
@@ -427,34 +422,48 @@
 	    return NULL;
 	}
 	
-	sti = &sti_rom[num_sti_roms];
+	sti = kmalloc(sizeof(*sti), GFP_KERNEL);
+	if (!sti) {
+	    printk(KERN_ERR "Not enough memory !\n");
+	    return NULL;
+	}
+		    
+	memset(sti, 0, sizeof(*sti));
 	sti->lock = SPIN_LOCK_UNLOCKED;
-
+	
+	ok = 0;
+	
 	if ((sig & 0xff) == 0x01) {
 		printk("STI byte mode ROM at %08lx, hpa=%08lx\n",
 		       address, hpa);
-		sti = bmode_sti_read_rom(sti, address, hpa);
+		ok = bmode_sti_read_rom(sti, address, hpa);
 	}
 
 	if (sig == 0x0303) {
 		printk("STI word mode ROM at %08lx, hpa=%08lx\n",
 		       address, hpa);
-		sti = wmode_sti_read_rom(sti, address, hpa);
+		ok = wmode_sti_read_rom(sti, address, hpa);
 	}
 
-	if (!sti)
+	if (!ok) {
+		kfree(sti);
 		return NULL;
+	}
 
 	if (sti_init_glob_cfg(sti, address, hpa)) {
 	    printk(KERN_ERR "Not enough memory !\n");
+	    kfree(sti);
 	    return NULL;
 	}
 
 	sti_init_graph(sti);
 
 	sti_inq_conf(sti);
-	sti_dump_globcfg(PTR_STI(sti->glob_cfg));
+	sti_dump_globcfg(PTR_STI(sti->glob_cfg), sti->sti_mem_request);
+	
+	printk("STI device: %s\n", sti->outptr.dev_name);
 
+	sti_rom[num_sti_roms] = sti;
 	num_sti_roms++;
 	
 	return sti;
@@ -473,9 +482,8 @@
     while ((pa_dev = get_pa_dev(index)) != NULL) {
     
 	if (((unsigned long)pa_dev->hpa == hpa) &&
-	    ((pa_dev->sversion == 0x85) || /* Gecko graphics */
-	     (pa_dev->sversion == 0x77)) ) /* Coral graphics */
-	    /* add more sversions here if needed... */
+	    ((pa_dev->sversion == 0x85) || /* Gecko graphics (WORD MODE) */
+	     (pa_dev->sversion == 0x77)) ) /* Coral graphics (BYTE MODE) */
 	{
 	    /* 
 		on newer systems PDC gives the address of the ROM 
@@ -514,31 +522,28 @@
 	    goto out;
 	initialized++;
 
-	/* XXX */ 
-	/* handle the command line */
-	/*
-	if (sti_address && sti_hpa) {
-		return search_sti(sti_address, sti_hpa);
-	}
-	*/
-
 	/* 712, 715 & some other boxes don't have a separate STI ROM,
 	 * but use part of the regular flash. Newer systems may
 	 * set this value to NULL */
 	flash_rom = PAGE0->proc_sti;
 
-	/* search the possible hpa locations (64bit ready, is this needed ?)
+	/* search the possible hpa locations (64bit ready)
 	   in the default order */
 	search_sti(flash_rom, (unsigned long) 0xfffffffff8000000);
 	search_sti(flash_rom, (unsigned long) 0xfffffffff4000000);
 	search_sti(flash_rom, (unsigned long) 0xfffffffff6000000);
 	search_sti(flash_rom, (unsigned long) 0xfffffffffa000000);
 
-	default_sti = sti_rom[0];  /* XXXX */
+	/* check boot-value from "sti=<index>" */
+	if (sti_index >= num_sti_roms)
+	    sti_index = 0;
+	    
+	default_sti = sti_rom[sti_index];
 
 out:
-	if (default_sti.init_graph) /* found at least one ? */
-	    return &default_sti;
+	/* return default STI if available */
+	if (num_sti_roms && default_sti && default_sti->init_graph)
+	    return default_sti;
 	else
 	    return NULL;
 }
Index: sticore.h
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticore.h,v
retrieving revision 1.5
diff -u -r1.5 sticore.h
--- sticore.h	2001/02/13 23:11:11	1.5
+++ sticore.h	2001/02/17 01:20:46
@@ -13,8 +13,11 @@
 #define DPRINTK(x) 
 #endif
 
-#define STI_REGION_MAX 8
+#define MAX_STI_ROMS 4		/* max no. of ROMs which this driver handles */
+
+#define STI_REGION_MAX 8	/* hardcoded STI constants */
 #define STI_DEV_NAME_LENGTH 32
+#define STI_MONITOR_MAX 256
 
 /* The latency of the STI functions cannot really be reduced by setting
  * this to 0;  STI doesn't seem to be designed to allow calling a different
@@ -63,7 +66,7 @@
 /* XXX: this probably should not be here, but we rely on STI being
    initialized early and independently of stifb at the moment, so
    there's no other way for stifb to find it. */
-extern struct sti_struct default_sti;
+extern struct sti_struct *default_sti;
 
 void sti_init_graph(struct sti_struct *sti);
 void sti_inq_conf(struct sti_struct *sti);
@@ -79,68 +82,68 @@
 /* STI function configuration structs */
 
 struct sti_glob_cfg_ext {
-	 u8 curr_mon;
-	 u8 friendly_boot;
-	s16 power;
-	s32 freq_ref;
-	s32 *sti_mem_addr;
-	s32 *future_ptr;
+	 u8 curr_mon;			/* current monitor configured */
+	 u8 friendly_boot;		/* in friendly boot mode */
+	s16 power;			/* power calculation (in Watts) */
+	s32 freq_ref;			/* frequency refrence */
+	s32 *sti_mem_addr;		/* pointer to global sti memory (size=sti_mem_request) 
*/
+	u32 *future_ptr;		/* pointer to future data */
 };
 
 struct sti_glob_cfg {
-	s32 text_planes;
-	s16 onscreen_x;
-	s16 onscreen_y;
-	s16 offscreen_x;
-	s16 offscreen_y;
-	s16 total_x;
-	s16 total_y;
-	u32 region_ptrs[STI_REGION_MAX];
-	s32 reent_lvl;
-	s32 *save_addr;
-	struct sti_glob_cfg_ext *ext_ptr;
+	s32 text_planes;		/* number of planes used for text */
+	s16 onscreen_x;			/* screen width in pixels */
+	s16 onscreen_y;			/* screen height in pixels */
+	s16 offscreen_x;		/* offset width in pixels */
+	s16 offscreen_y;		/* offset height in pixels */
+	s16 total_x;			/* frame buffer width in pixels */
+	s16 total_y;			/* frame buffer height in pixels */
+	u32 region_ptrs[STI_REGION_MAX]; /* region pointers */
+	s32 reent_lvl;			/* storage for reentry level value */
+	s32 *save_addr;			/* where to save or restore reentrant state */
+	struct sti_glob_cfg_ext *ext_ptr; /* pointer to extended glob_cfg data 
structure */
 };
 
 
 /* STI init function structs */
 
 struct sti_init_flags {
-	u32 wait : 1;
-	u32 reset : 1;
-	u32 text : 1;
-	u32 nontext : 1;
-	u32 clear : 1;
-	u32 cmap_blk : 1;
-	u32 enable_be_timer : 1;
-	u32 enable_be_int : 1;
-	u32 no_chg_tx : 1;
-	u32 no_chg_ntx : 1;
-	u32 no_chg_bet : 1;
-	u32 no_chg_bei : 1;
-	u32 init_cmap_tx : 1;
-	u32 cmt_chg : 1;
-	u32 retain_ie : 1;
-	u32 pad : 17;
-
-	s32 *future_ptr;
+	u32 wait : 1;		/* should routine idle wait or not */
+	u32 reset : 1;		/* hard reset the device? */
+	u32 text : 1;		/* turn on text display planes? */
+	u32 nontext : 1;	/* turn on non-text display planes? */
+	u32 clear : 1;		/* clear text display planes? */
+	u32 cmap_blk : 1;	/* non-text planes cmap black? */
+	u32 enable_be_timer : 1; /* enable bus error timer */
+	u32 enable_be_int : 1;	/* enable bus error timer interrupt */
+	u32 no_chg_tx : 1;	/* don't change text settings */
+	u32 no_chg_ntx : 1;	/* don't change non-text settings */
+	u32 no_chg_bet : 1;	/* don't change berr timer settings */
+	u32 no_chg_bei : 1;	/* don't change berr int settings */
+	u32 init_cmap_tx : 1;	/* initialize cmap for text planes */
+	u32 cmt_chg : 1;	/* change current monitor type */
+	u32 retain_ie : 1;	/* don't allow reset to clear int enables */
+	u32 pad : 17;		/* pad to word boundary */
+	u32 *future_ptr;	/* pointer to future data */
 };
 
 struct sti_init_inptr_ext {
-	u8  config_mon_type;
-	u8  pad[1];
-	u16 inflight_data;
-	s32 *future_ptr;
+	u8  config_mon_type;	/* configure to monitor type */
+	u8  pad[1];		/* pad to word boundary */
+	u16 inflight_data;	/* inflight data possible on PCI */
+	u32 *future_ptr;	/* pointer to future data */
 };
 
 struct sti_init_inptr {
-	s32 text_planes;
-	struct sti_init_inptr_ext *ext_ptr;
+	s32 text_planes;	/* number of planes to use for text */
+	struct sti_init_inptr_ext *ext_ptr; /* pointer to extended init_graph inptr 
data structure*/
 };
 
+
 struct sti_init_outptr {
-	s32 errno;
-	s32 text_planes;
-	s32 *future_ptr;
+	s32 errno;		/* error number on failure */
+	s32 text_planes;	/* number of planes used for text */
+	u32 *future_ptr;	/* pointer to future data */
 };
 
 
@@ -148,35 +151,35 @@
 /* STI configuration function structs */
 
 struct sti_conf_flags {
-	u32 wait : 1;
-	u32 pad : 31;
-	s32 *future_ptr;
+	u32 wait : 1;		/* should routine idle wait or not */
+	u32 pad : 31;		/* pad to word boundary */
+	u32 *future_ptr;	/* pointer to future data */
 };
 
 struct sti_conf_inptr {
-	s32 *future_ptr;
+	u32 *future_ptr;	/* pointer to future data */
 };
 
 struct sti_conf_outptr_ext {
-	u32 crt_config[3];
+	u32 crt_config[3];	/* hardware specific X11/OGL information */	
 	u32 crt_hdw[3];
-	s32 *future_ptr;
+	u32 *future_ptr;
 };
 
 struct sti_conf_outptr {
-	s32 errno;
-	s16 onscreen_x;
-	s16 onscreen_y;
-	s16 offscreen_x;
-	s16 offscreen_y;
-	s16 total_x;
-	s16 total_y;
-	s32 bits_per_pixel;
-	s32 bits_used;
-	s32 planes;
-	 u8 dev_name[STI_DEV_NAME_LENGTH];
-	u32 attributes;
-	struct sti_conf_outptr_ext *ext_ptr;
+	s32 errno;		/* error number on failure */
+	s16 onscreen_x;		/* screen width in pixels */
+	s16 onscreen_y;		/* screen height in pixels */
+	s16 offscreen_x;	/* offscreen width in pixels */
+	s16 offscreen_y;	/* offscreen height in pixels */
+	s16 total_x;		/* frame buffer width in pixels */
+	s16 total_y;		/* frame buffer height in pixels */
+	s32 bits_per_pixel;	/* bits/pixel device has configured */
+	s32 bits_used;		/* bits which can be accessed */
+	s32 planes;		/* number of fb planes in system */
+	 u8 dev_name[STI_DEV_NAME_LENGTH]; /* null terminated product name */
+	u32 attributes;		/* flags denoting attributes */
+	struct sti_conf_outptr_ext *ext_ptr; /* pointer to future data */
 };
 
 
@@ -195,54 +198,53 @@
 /* STI font printing function structs */
 
 struct sti_font_inptr {
-	u32 font_start_addr;
-	s16 index;
-	u8 fg_color;
-	u8 bg_color;
-	s16 dest_x;
-	s16 dest_y;
-	s32 *future_ptr;
+	u32 font_start_addr;	/* address of font start */
+	s16 index;		/* index into font table of character */
+	u8 fg_color;		/* foreground color of character */
+	u8 bg_color;		/* background color of character */
+	s16 dest_x;		/* X location of character upper left */
+	s16 dest_y;		/* Y location of character upper left */
+	u32 *future_ptr;	/* pointer to future data */
 };
 
 struct sti_font_flags {
-	u32 wait : 1;
-	u32 non_text : 1;
-	u32 pad : 30;
-
-	s32 *future_ptr;
+	u32 wait : 1;		/* should routine idle wait or not */
+	u32 non_text : 1;	/* font unpack/move in non_text planes =1, text =0 */
+	u32 pad : 30;		/* pad to word boundary */
+	u32 *future_ptr;	/* pointer to future data */
 };
 	
 struct sti_font_outptr {
-	s32 errno;
-	s32 *future_ptr;
+	s32 errno;		/* error number on failure */
+	u32 *future_ptr;	/* pointer to future data */
 };
 
 /* STI blockmove structs */
 
 struct sti_blkmv_flags {
-	u32 wait : 1;
-	u32 color : 1;
-	u32 clear : 1;
-	u32 non_text : 1;
-	u32 pad : 28;
-	s32 *future_ptr;
+	u32 wait : 1;		/* should routine idle wait or not */
+	u32 color : 1;		/* change color during move? */
+	u32 clear : 1;		/* clear during move? */
+	u32 non_text : 1;	/* block move in non_text planes =1, text =0 */
+	u32 pad : 28;		/* pad to word boundary */
+	u32 *future_ptr;	/* pointer to future data */
 };
 
 struct sti_blkmv_inptr {
-	u8 fg_color;
-	u8 bg_color;
-	s16 src_x;
-	s16 src_y;
-	s16 dest_x;
-	s16 dest_y;
-	s16 width;
-	s16 height;
-	s32 *future_ptr;
+	u8 fg_color;		/* foreground color after move */
+	u8 bg_color;		/* background color after move */
+	s16 src_x;		/* source upper left pixel x location */
+	s16 src_y;		/* source upper left pixel y location */
+	s16 dest_x;		/* dest upper left pixel x location */
+	s16 dest_y;		/* dest upper left pixel y location */
+	s16 width;		/* block width in pixels */
+	s16 height;		/* block height in pixels */
+	u32 *future_ptr;	/* pointer to future data */
 };
 
 struct sti_blkmv_outptr {
-	s32 errno;
-	s32 *future_ptr;
+	s32 errno;		/* error number on failure */
+	u32 *future_ptr;	/* pointer to future data */
 };
 
 
@@ -250,6 +252,12 @@
 
 struct sti_struct {
 	spinlock_t lock;
+		
+	/* the following fields needs to be filled in by the word/byte routines */
+	int font_width;	
+	int font_height;
+	/* char **mon_strings; */
+	int sti_mem_request;
 
 	struct sti_cooked_rom *rom;
 
@@ -258,17 +266,16 @@
 	unsigned long init_graph;
 	unsigned long inq_conf;
 
+	/* all following fields are initialized by the generic routines */
+	int text_planes;
+	u32 regions[STI_REGION_MAX];
+	/* u8 *pci_regions; */
+
 	struct sti_glob_cfg *glob_cfg;
 	struct sti_rom_font *font;	/* raw (byte/word) font ptr */
-
-	int font_width;	/* needs to be filled in by word/byte routines */
-	int font_height;
 
-	s32 text_planes;
-
-	char **mon_strings;
-	u32 regions[STI_REGION_MAX];
-	/* u8 *pci_regions; */
+	struct sti_conf_outptr outptr; /* configuration */
+	struct sti_conf_outptr_ext outptr_ext;
 };
 
 
@@ -280,18 +287,15 @@
 /* helper functions */
 struct sti_struct *sti_init_roms(void);
 void sti_rom_copy(unsigned long base, unsigned long count, void *dest);
-int  sti_init_glob_cfg(struct sti_struct *sti,
-	    unsigned long rom_address, unsigned long hpa);
-void sti_dump_globcfg(struct sti_glob_cfg *glob_cfg);
 struct sti_cooked_font *sti_select_font(struct sti_cooked_rom *rom,
 	    int (*search_font_fnc) (struct sti_cooked_rom *,int,int) );
 
 /* sti-wmode.c: */
-struct sti_struct *wmode_sti_read_rom(struct sti_struct *sti,
+int wmode_sti_read_rom(struct sti_struct *sti,
 	    unsigned long address, unsigned long hpa);
 
 /* sti-bmode.c: */
-struct sti_struct *bmode_sti_read_rom(struct sti_struct *sti,
+int bmode_sti_read_rom(struct sti_struct *sti,
 	    unsigned long address, unsigned long hpa);
 
 #endif	/* STICORE_H */