[parisc-linux-cvs] STI console now supports framebuffer-fonts...

Helge Deller deller@gmx.de
Sun, 18 Feb 2001 23:29:18 +0100


Hi,

the following (really big!) patch changes lot's of code in the STI-console 
code.

The most important change is, that the byte- and word-mode structs now have 
their own names (which could give really strange results with the old code if 
you by accident included wrong headers).

The second important change is, that the STI console now supports linux 
framebuffer fonts in addition to the built-in HP STI fonts (which are not 
very sufficient for linux-applications). This can be defined in the palo 
Makefile with "sti_font=<font1>,<font2>, ...", where <fontx> can be one of 
VGA8x8, VGA8x16, SUN12x22 or any other linux-provided font. The fonts, which 
should be supported can be selected in the normal framebuffer configure-menu.

Ok, that's all for now...

Helge.


Index: Makefile
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- Makefile	2001/02/04 21:22:58	1.15
+++ Makefile	2001/02/18 22:08:43
@@ -80,7 +80,7 @@
 obj-$(CONFIG_FB_LEO)              += leofb.o sbusfb.o

 subdir-$(CONFIG_STI_CONSOLE)	  += sti
-obj-$(CONFIG_STI_CONSOLE)	  += sti/sti.o
+obj-$(CONFIG_STI_CONSOLE)	  += sti/sti.o fonts.o
 subdir-$(CONFIG_FB_STI)		  += sti
 obj-$(CONFIG_FB_STI)		  += sti/sti.o fbgen.o

Index: sti/sticon-bmode.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticon-bmode.c,v
retrieving revision 1.5
diff -u -r1.5 sticon-bmode.c
--- sticon-bmode.c	2001/02/17 01:29:23	1.5
+++ sticon-bmode.c	2001/02/18 22:08:43
@@ -20,7 +20,7 @@
 

 void __init
-bmode_sti_dump_rom(struct sti_rom *rom)
+bmode_sti_dump_rom(struct sti_rom_bmode *rom)
 {
 	printk("STI byte mode ROM type %d\n", STI_U8(rom->type));
 	printk(" supports %d monitors\n", STI_U8(rom->num_mons));
@@ -45,15 +45,14 @@
 
 void __init
 bmode_sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
-			  struct sti_rom *raw_rom)
+			  struct sti_rom_bmode *raw_rom)
 {
-	struct sti_rom_font *raw_font;
+	struct sti_rom_font_bmode *raw_font, *font_start;
 	struct sti_cooked_font *cooked_font;
-	struct sti_rom_font *font_start;

 	cooked_font =
-		kmalloc(sizeof *cooked_font, GFP_KERNEL);
-	if(!cooked_font)
+		kmalloc(sizeof(*cooked_font), GFP_KERNEL);
+	if (!cooked_font)
 		return;

 	cooked_rom->font_start = cooked_font;
@@ -66,25 +65,23 @@
 	raw_font = ((void *)raw_rom) + STI_U32(raw_rom->font_start) - 3;

 	font_start = raw_font;
-	cooked_font->raw = raw_font;
+	cooked_font->raw.bmode = raw_font;

 	DPRINTK(("next font %08x\n", STI_U32(raw_font->next_font)));

-	while(0 && STI_U32(raw_font->next_font)) {
+	while (0/*XXX*/ && STI_U32(raw_font->next_font)) {
 		raw_font = ((void *)font_start) + STI_U32(raw_font->next_font);

 		cooked_font->next_font =
-			kmalloc(sizeof *cooked_font, GFP_KERNEL);
+			kmalloc(sizeof(*cooked_font), GFP_KERNEL);
 		if(!cooked_font->next_font)
 			return;

 		cooked_font = cooked_font->next_font;
+		cooked_font->raw.bmode = raw_font;
 
-//		cooked_font->raw = raw_font;
-
-		DPRINTK(("raw_font %p\n",
-		       raw_font));
-		DPRINTK(("next_font %08x %p\n",
+		DPRINTK(("raw_font %p\nnext_font %08x %p\n",
+		       raw_font,
 		       STI_U32(raw_font->next_font),
 		       ((void *)font_start) + STI_U32(raw_font->next_font)));
 	}
@@ -100,17 +97,17 @@
 	int i;

 	ret = kmalloc(size, GFP_KERNEL);
-	if(!ret) {
+	if (!ret) {
 		printk(KERN_ERR __FILE__ ": could not get memory.\n");
 		return 0;
 	}
 
-	for(i=0; i<(size/4); i++)
+	for (i=0; i<(size/4); i++)
 	    ret[i] = STI_U32(func[i]);
 
-	flush_all_caches();
+	sti_flush((unsigned long)ret, (size/4)); /* XXXX */

-	return virt_to_phys(ret);
+	return (unsigned long) STI_PTR(ret);
 }

 
@@ -120,8 +117,9 @@
 	struct sti_cooked_font *font;
 	int i = 0;
 	
-	for(font = rom->font_start; font; font = font->next_font, i++) {
-	    if((STI_U8(font->raw->width) == width) && (STI_U8(font->raw->height) == 
height))
+	for (font = rom->font_start; font; font = font->next_font, i++) {
+	    if ((STI_U8(font->raw.bmode->width) == width) && 
+			    (STI_U8(font->raw.bmode->height) == height))
 			return i;
 	}
 	return 0;
@@ -132,7 +130,7 @@
 bmode_sti_read_rom(struct sti_struct *sti, unsigned long address, unsigned 
long hpa)
 {
 	struct sti_cooked_rom *cooked;
-	struct sti_rom *raw = NULL;
+	struct sti_rom_bmode *raw = NULL;
 	unsigned long size;
 	sti_u32 sizetmp;

@@ -140,15 +138,14 @@
 	if (!cooked)
 		goto out_err;
 		
-	sti_rom_copy(address + offsetof(struct sti_rom,last_addr),
+	sti_rom_copy(address + offsetof(struct sti_rom_bmode, last_addr),
 		sizeof(sizetmp), &sizetmp);
 	size = STI_U32(sizetmp);

 //	bmode_sti_dump_rom(raw); // NO DATA....
 
-//	DPRINTK(("font_start %08x\n", STI_U32(raw->font_start)));
 	raw = kmalloc(size, GFP_KERNEL);
-	if(!raw)
+	if (!raw)
 		goto out_err;
 	sti_rom_copy(address, size, raw);

@@ -156,8 +153,8 @@
 
 	sti->regions[0] = hpa;	/* ?? */
 		
-	if(STI_U32(raw->region_list)) {
-		struct sti_rom_region *region =
+	if (STI_U32(raw->region_list)) {
+		struct sti_rom_region_bmode *region =
 			((void *)raw) + STI_U32(raw->region_list) - 3;
 
 //		DPRINTK(("region_list %08x\n", STI_U32(raw->region_list)));
@@ -171,7 +168,7 @@
 		sti->regions[7] = STI_U32(region[7].region);
 	}

-	address = virt_to_phys(raw);
+	address = (unsigned long) STI_PTR(raw);
 
 #if 1
 	DPRINTK(("init_graph %08x %08x\n"
@@ -222,21 +219,21 @@
 					  STI_U32(raw->inq_conf));

 	sti->rom = cooked;
-	sti->rom->raw = raw;
+	sti->rom->raw.bmode = raw;

-	sti->font = sti_select_font(sti->rom, bmode_sti_search_font)->raw;
-        sti->font_width = STI_U8(sti->font->width);
-	sti->font_height = STI_U8(sti->font->height);
-	sti->font = (struct sti_rom_font *) virt_to_phys(sti->font);
+	sti->font = sti_select_font(sti->rom, bmode_sti_search_font);
+        sti->font_width = STI_U8(sti->font->raw.bmode->width);
+	sti->font_height = STI_U8(sti->font->raw.bmode->height);
+	sti->font->raw.bmode = STI_PTR(sti->font->raw.bmode);

 	sti->sti_mem_request = STI_U32(raw->sti_mem_req);

 	return 1;

 out_err:
-	if(raw)
+	if (raw)
 		kfree(raw);
-	if(cooked)
+	if (cooked)
 		kfree(cooked);
 
 	return 0;
Index: sti/sticon-bmode.h
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticon-bmode.h,v
retrieving revision 1.2
diff -u -r1.2 sticon-bmode.h
--- sticon-bmode.h	2001/02/15 23:25:45	1.2
+++ sticon-bmode.h	2001/02/18 22:08:43
@@ -23,11 +23,11 @@
 		      (STI_U8((u32).data[2])<< 8) | \
 		      (STI_U8((u32).data[3])<< 0))
 
-struct sti_rom_region {
+struct sti_rom_region_bmode {
 	sti_u32 region;
 };

-struct sti_rom_font {
+struct sti_rom_font_bmode {
 	sti_u16 first_char;
 	sti_u16 last_char;
 	 sti_u8 width;
@@ -40,7 +40,7 @@
 	 sti_u8 res008[2];
 };
 
-struct sti_rom {
+struct sti_rom_bmode {
 	 sti_u8 type;
 	 sti_u8 num_mons;
 	 sti_u8 revno[2];
Index: sti/sticon-wmode.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticon-wmode.c,v
retrieving revision 1.7
diff -u -r1.7 sticon-wmode.c
--- sticon-wmode.c	2001/02/17 01:29:23	1.7
+++ sticon-wmode.c	2001/02/18 22:08:43
@@ -15,11 +15,10 @@
 
 #include <asm/io.h>
 
-#include "sticon-wmode.h"
 #include "sticore.h"

 void __init 
-wmode_sti_dump_rom(struct sti_rom *rom)
+wmode_sti_dump_rom(struct sti_rom_wmode *rom)
 {
 	printk("STI word mode ROM type %d\n", rom->type[3]);
 	printk(" supports %d monitors\n", rom->num_mons);
@@ -43,11 +42,10 @@

 static int __init 
 wmode_sti_cook_fonts(struct sti_cooked_rom *cooked_rom,
-			struct sti_rom *raw_rom)
+			struct sti_rom_wmode *raw_rom)
 {
-	struct sti_rom_font *raw_font;
+	struct sti_rom_font_wmode *raw_font, *font_start;
 	struct sti_cooked_font *cooked_font;
-	struct sti_rom_font *font_start;

 	cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL);
 	if (!cooked_font)
@@ -58,7 +56,7 @@
 	raw_font = ((void *)raw_rom) + (raw_rom->font_start);
 
 	font_start = raw_font;
-	cooked_font->raw = raw_font;
+	cooked_font->raw.wmode = raw_font;
 
 	while (raw_font->next_font) {
 		raw_font = ((void *)font_start) + (raw_font->next_font);
@@ -69,7 +67,7 @@
 
 		cooked_font = cooked_font->next_font;
 
-		cooked_font->raw = raw_font;
+		cooked_font->raw.wmode = raw_font;
 	}
 
 	cooked_font->next_font = NULL;
@@ -84,7 +82,7 @@
 	int i = 0;
 	
 	for(font = rom->font_start; font; font = font->next_font, i++) {
-	    if((font->raw->width == width) && (font->raw->height == height))
+	    if((font->raw.wmode->width == width) && (font->raw.wmode->height == 
height))
 			return i;
 	}
 	return 0;
@@ -94,7 +92,7 @@
 wmode_sti_read_rom(struct sti_struct *sti, unsigned long address, unsigned 
long hpa)
 {
 	struct sti_cooked_rom *cooked;
-	struct sti_rom *raw = NULL;
+	struct sti_rom_wmode *raw = NULL;
 	unsigned long size;
 
 	cooked = kmalloc(sizeof *cooked, GFP_KERNEL);
@@ -102,7 +100,7 @@
 		goto out_err;
 
 	/* read the ROM size directly from the struct in ROM */
-	size = gsc_readl(address + offsetof(struct sti_rom,last_addr));
+	size = gsc_readl(address + offsetof(struct sti_rom_wmode,last_addr));
 
 	raw = kmalloc(size, GFP_KERNEL);
 	if(!raw)
@@ -118,7 +116,7 @@
 	if (raw->region_list)
 		memcpy(sti->regions, ((void *)raw)+raw->region_list, sizeof(sti->regions));
 
-	address = virt_to_phys(raw);
+	address = (unsigned long) STI_PTR(raw);

 	sti->font_unpmv = address+(raw->font_unpmv & 0x03ffffff);
 	sti->block_move = address+(raw->block_move & 0x03ffffff);
@@ -126,12 +124,12 @@
 	sti->inq_conf = address+(raw->inq_conf     & 0x03ffffff);
 
 	sti->rom = cooked;
-	sti->rom->raw = raw;
+	sti->rom->raw.wmode = raw;
 	
-	sti->font = sti_select_font(sti->rom, wmode_sti_search_font)->raw;
-	sti->font_width = sti->font->width;
-	sti->font_height = sti->font->height;
-	sti->font = (struct sti_rom_font *) virt_to_phys(sti->font);
+	sti->font = sti_select_font(sti->rom, wmode_sti_search_font);
+	sti->font_width = sti->font->raw.wmode->width;
+	sti->font_height = sti->font->raw.wmode->height;
+	sti->font->raw.wmode = STI_PTR(sti->font->raw.wmode);

 	sti->sti_mem_request = raw->sti_mem_req;

@@ -147,3 +145,6 @@

 	return 0;
 }
+
+
+
Index: sti/sticon-wmode.h
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticon-wmode.h,v
retrieving revision 1.2
diff -u -r1.2 sticon-wmode.h
--- sticon-wmode.h	2001/02/15 23:25:45	1.2
+++ sticon-wmode.h	2001/02/18 22:08:43
@@ -3,7 +3,7 @@

 /* word mode STI ROM definitions */

-struct sti_rom_font {
+struct sti_rom_font_wmode {
 	u16 first_char;
 	u16 last_char;
 	 u8 width;
@@ -16,7 +16,7 @@
 	 u8 res008[2];
 };
 
-struct sti_rom {
+struct sti_rom_wmode {
 	 u8 type[4];
 	 u8 res004;
 	 u8 num_mons;
Index: sti/sticore.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticore.c,v
retrieving revision 1.7
diff -u -r1.7 sticore.c
--- sticore.c	2001/02/17 01:29:23	1.7
+++ sticore.c	2001/02/18 22:08:44
@@ -16,6 +16,8 @@
  * - 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 ;)
+ * - clean up the cache flushing functions
+ * - create a linked list for fb-fonts & HP-fonts
  *
  * 
  * KNOWN ISSUES:
@@ -29,6 +31,7 @@
 #include <linux/kernel.h>
 #include <linux/malloc.h>
 #include <linux/init.h>
+#include <video/font.h>

 #include <asm/pgalloc.h>
 #include <asm/io.h>
@@ -123,7 +126,8 @@
 sti_putc(struct sti_struct *sti, int c, int y, int x)
 {
 	struct sti_font_inptr inptr = {
-		(u32) sti->font, c_index(sti, c), c_fg(sti, c), c_bg(sti, c),
+		(u32) sti->font->raw.wmode,
+		c_index(sti, c), c_fg(sti, c), c_bg(sti, c),
 		x * sti->font_width, y * sti->font_height, NULL
 	};
 	struct sti_font_outptr outptr = {
@@ -223,7 +227,8 @@
 void __init
 sti_rom_copy(unsigned long base, unsigned long count, void *dest)
 {
-	unsigned long orgcount = count;
+	unsigned long dest_len = count;
+	unsigned long dest_start = (unsigned long) dest;

 	/* this still needs to be revisited (see arch/parisc/mm/init.c:246 ! */
 	while (count >= 4) {
@@ -239,28 +244,63 @@
 		dest++;
 	}

-	flush_data_cache();
-	flush_kernel_dcache_range((unsigned long)dest, orgcount);
-	flush_icache_range((unsigned long)dest, (unsigned long)dest + orgcount); /* 
XXXX ? */
+	sti_flush(dest_start, dest_len); /* XXX */
 }

 

 
-int font_index, font_height, font_width;
+static unsigned int sti_index[MAX_STI_ROMS];

+static int __init 
+sti_setup(char *str)
+{
+	char *end;
+	int i = 0;
+
+	while (i<MAX_STI_ROMS && str && *str) {
+		sti_index[i] = simple_strtoul(str, &end, 10);
+		str = end;
+		i++;
+	}
+	
+	return 0;
+}
+
+__setup("sti=", sti_setup);
+
+
+
+static char	*font_name[MAX_STI_ROMS] = { "VGA8x16", };
+static int	font_index[MAX_STI_ROMS],
+		font_height[MAX_STI_ROMS],
+		font_width[MAX_STI_ROMS];
+
 static int __init sti_font_setup(char *str)
 {
 	char *x;
+	int i = 0;

-	/* we accept sti_font=10x20, sti_font=10*20 or sti_font=7 style
-	 * command lines. */
+	/* we accept sti_font=VGA8x16, sti_font=10x20, sti_font=10*20
+	 * or sti_font=7 style command lines. */

-	if((x = strchr(str, 'x')) || (x = strchr(str, '*'))) {
-		font_height = simple_strtoul(str, NULL, 0);
-		font_width = simple_strtoul(x+1, NULL, 0);
-	} else {
-		font_index = simple_strtoul(str, NULL, 0);
+	while (i<MAX_STI_ROMS && str && *str) {
+		if (*str>='0' && *str<='9') {
+			if ((x = strchr(str, 'x')) || (x = strchr(str, '*'))) {
+				font_height[i] = simple_strtoul(str, NULL, 0);
+				font_width[i] = simple_strtoul(x+1, NULL, 0);
+			} else {
+				font_index[i] = simple_strtoul(str, NULL, 0);
+			}
+		} else {
+			font_name[i] = str;	/* fb font name */
+		}
+
+		if ((x = strchr(str, ',')))
+			*x++ = 0;
+		str = x;
+
+		i++;
 	}

 	return 0;
@@ -355,16 +395,79 @@
 

 struct sti_cooked_font * __init
+sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
+{
+	struct fbcon_font_desc *fbfont;
+	unsigned int size, bpc;
+	void *dest;
+	struct sti_rom_font_wmode *nf;
+	struct sti_cooked_font *cooked_font;
+	
+	if (!fbfont_name || !strlen(fbfont_name))
+	    return NULL;
+	fbfont = fbcon_find_font(fbfont_name);
+	/*	
+	if (!fbfont)
+	    fbfont = fbcon_get_default_font(1280,1024); // XXX 
+	*/
+	if (!fbfont)
+	    return NULL;
+
+	printk("selected %dx%d fb-font %s\n",
+			fbfont->width, fbfont->height, fbfont->name);
+
+	bpc = ((fbfont->width+7)/8) * fbfont->height; 
+	size = bpc * 256;
+	size += sizeof(struct sti_rom_font_wmode);
+
+	nf = kmalloc(size, GFP_KERNEL);
+	if (!nf)
+	    return NULL;
+	memset(nf, 0, size);
+
+	nf->first_char = 0;
+	nf->last_char = 255;
+	nf->width = fbfont->width;
+	nf->height = fbfont->height;
+	nf->font_type = STI_FONT_HPROMAN8;
+	nf->bytes_per_char = bpc;
+	nf->next_font = 0;
+	nf->underline_height = 1;
+	nf->underline_pos = fbfont->height - nf->underline_height;
+
+	dest = nf;
+	dest += sizeof(struct sti_rom_font_wmode);
+	memcpy(dest, fbfont->data, bpc*256);
+
+	cooked_font = kmalloc(sizeof(*cooked_font), GFP_KERNEL);
+	if (!cooked_font) {
+	    kfree(nf);
+	    return NULL;
+	}
+	
+	cooked_font->raw.wmode = nf;
+	cooked_font->next_font = NULL;
+
+	cooked_rom->font_start = cooked_font;
+
+	return cooked_font;
+}
+
+struct sti_cooked_font * __init
 sti_select_font(struct sti_cooked_rom *rom,
 	    int (*search_font_fnc) (struct sti_cooked_rom *,int,int) )
 {
 	struct sti_cooked_font *font;
 	int i;

-	if (font_width && font_height)
-		font_index = search_font_fnc(rom, font_height, font_width);
+	/* check for framebuffer-font first */
+	if ((font = sti_select_fbfont(rom, font_name[0/*XXX*/])))
+		return font;
+
+	if (font_width[0] && font_height[0])
+		font_index[0] = search_font_fnc(rom, font_height[0], font_width[0]);
 
-	for (font = rom->font_start, i = font_index;
+	for (font = rom->font_start, i = font_index[0];
 	    font && (i > 0);
 	    font = font->next_font, i--);

@@ -376,21 +479,6 @@

 

-static unsigned int sti_index;
-
-static int __init 
-sti_setup(char *str)
-{
-	char *end;
-
-	sti_index = simple_strtoul(str, &end, 10);
-	return 1;
-}
-
-__setup("sti=", sti_setup);
-
-
-
 static int num_sti_roms;
 static struct sti_struct *sti_rom[MAX_STI_ROMS];

@@ -535,10 +623,10 @@
 	search_sti(flash_rom, (unsigned long) 0xfffffffffa000000);
 
 	/* check boot-value from "sti=<index>" */
-	if (sti_index >= num_sti_roms)
-	    sti_index = 0;
+	if (sti_index[0] >= num_sti_roms)
+	    sti_index[0] = 0;
 	    
-	default_sti = sti_rom[sti_index];
+	default_sti = sti_rom[sti_index[0]];

 out:
 	/* return default STI if available */
Index: sti/sticore.h
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticore.h,v
retrieving revision 1.6
diff -u -r1.6 sticore.h
--- sticore.h	2001/02/17 01:29:23	1.6
+++ sticore.h	2001/02/18 22:08:44
@@ -3,22 +3,24 @@
 
 /* generic STI structures & functions */
 
-/* NOTE: include sti-bmode.h (byte-mode) *OR* sti-wmode.h (word-mode)
-	 prior including this file, depending on which mode you want to use */
-
-
 #if 1
 #define DPRINTK(x)	printk x
 #else
 #define DPRINTK(x) 
 #endif
 
+#include "sticon-bmode.h"
+#include "sticon-wmode.h"
+
 #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

+#define STI_FONT_HPROMAN8 1
+#define STI_FONT_KANA8 2
+
 /* 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
  * function (or the same function with different arguments) after a
@@ -68,6 +70,7 @@
    there's no other way for stifb to find it. */
 extern struct sti_struct *default_sti;

+
 void sti_init_graph(struct sti_struct *sti);
 void sti_inq_conf(struct sti_struct *sti);
 void sti_putc(struct sti_struct *sti, int c, int y, int x);
@@ -183,15 +186,21 @@
 };
 

-/* internal font handling */
+/* sticore internal font handling */
 
 struct sti_cooked_font {
-	struct sti_rom_font *raw;
+	union {
+		struct sti_rom_font_bmode *bmode;
+		struct sti_rom_font_wmode *wmode;
+	} raw;
 	struct sti_cooked_font *next_font;
 };

 struct sti_cooked_rom {
-	struct sti_rom *raw;
+	union {
+		struct sti_rom_bmode *bmode;
+		struct sti_rom_wmode *wmode;
+	} raw;
 	struct sti_cooked_font *font_start;
 };
 
@@ -272,7 +281,7 @@
 	/* u8 *pci_regions; */

 	struct sti_glob_cfg *glob_cfg;
-	struct sti_rom_font *font;	/* raw (byte/word) font ptr */
+	struct sti_cooked_font *font;	/* ptr to selected font (cooked) */

 	struct sti_conf_outptr outptr; /* configuration */
 	struct sti_conf_outptr_ext outptr_ext;
@@ -280,10 +289,6 @@

 

-
-extern int font_index, font_height, font_width;
-
-
 /* helper functions */
 struct sti_struct *sti_init_roms(void);
 void sti_rom_copy(unsigned long base, unsigned long count, void *dest);
@@ -297,5 +302,17 @@
 /* sti-bmode.c: */
 int bmode_sti_read_rom(struct sti_struct *sti,
 	    unsigned long address, unsigned long hpa);
+
+
+/* FIXME: Do we have another solution for this ? */
+#include <linux/kernel.h>
+#include <linux/malloc.h>
+#include <asm/pgalloc.h>
+static inline void sti_flush(unsigned long from, unsigned long len)
+{
+	flush_data_cache();
+	flush_kernel_dcache_range(from, len);
+	flush_icache_range(from, from+len);
+}

 #endif	/* STICORE_H */