[parisc-linux-cvs] VisEG PCI STI support

Helge Deller deller@gmx.de
Thu, 21 Feb 2002 18:24:40 +0100


--------------Boundary-00=_4D8WWJP6D819E4201D4I
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

On Thursday 21 February 2002 18:26, Helge Deller wrote:
> CVSROOT:	/var/cvs
> Module name:	linux
> Changes by:	deller	02/02/21 10:26:50
>
> Modified files:
> 	drivers/video/sti: sticore.c sticore.h
>
> Log message:
> VisEG PCI on c3000 works now, remove the ugly work-around
> and clean up some printk()s.


--------------Boundary-00=_4D8WWJP6D819E4201D4I
Content-Type: text/plain;
  charset="iso-8859-1";
  name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="diff"

Index: sticore.c
===================================================================
RCS file: /var/cvs/linux/drivers/video/sti/sticore.c,v
retrieving revision 1.35
diff -u -p -r1.35 sticore.c
--- sticore.c	2002/02/20 23:25:01	1.35
+++ sticore.c	2002/02/21 17:22:34
@@ -7,10 +7,7 @@
  *	Portions Copyright (C) 2001 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
  * 
  * TODO:
- * - support 64bit parisc rom code
  * - 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 (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
@@ -88,7 +85,7 @@ sti_init_graph(struct sti_struct *sti) 
 	spin_unlock_irqrestore(&sti->lock, flags);
 
 	if (ret < 0) {
-		printk (KERN_ERR "STI init_graph failed (ret %d, errno %d)\n",ret,outptr.errno);
+		printk(KERN_ERR "STI init_graph failed (ret %d, errno %d)\n",ret,outptr.errno);
 		return -1;
 	}
 	
@@ -809,7 +806,7 @@ test_rom:
 		u32 *rm;
 		i = __raw_readl(address+0x04);
 		if (i != 1) {
-			/* FIXME: The ROM could have multiple architecture 
+			/* The ROM could have multiple architecture 
 			 * dependent images (e.g. i386, parisc,...) */
 			printk(KERN_WARNING 
 				"%s: PCI ROM is not a STI ROM type image (0x%8x)\n",
@@ -838,8 +835,7 @@ test_rom:
 		}
 
 		address += le32_to_cpu(__raw_readl(address+8));
-		printk("sig %04x, PCI STI ROM at %08lx\n",
-		       sig, address);
+		DPRINTK(("sig %04x, PCI STI ROM at %08lx\n", sig, address));
 		goto test_rom;
 	}
 	
@@ -863,6 +859,16 @@ test_rom:
 	if (sti_init_glob_cfg(sti, address, hpa))
 		goto out_err; /* not enough memory */
 
+	/* disable STI PCI ROM. ROM and card RAM overlap and
+	 * leaving it enabled would force HPMCs
+	 */
+	if (sti->pd) {
+		unsigned long rom_base;
+		rom_base = pci_resource_start(sti->pd, PCI_ROM_RESOURCE);	
+		pci_write_config_dword(sti->pd, PCI_ROM_ADDRESS, rom_base & ~PCI_ROM_ADDRESS_ENABLE);
+		printk(KERN_DEBUG "STI PCI ROM disabled\n");
+	}
+
 	if (sti_init_graph(sti))
 		goto out_err;
 
@@ -937,57 +943,34 @@ static int __devinit sticore_pci_init(st
 	rom_len = pci_resource_len(pd, PCI_ROM_RESOURCE);
 	if (rom_base) {
 		pci_write_config_dword(pd, PCI_ROM_ADDRESS, rom_base | PCI_ROM_ADDRESS_ENABLE);
-		printk("STI PCI ROM enabled at 0x%08lx\n", rom_base);
+		printk(KERN_DEBUG "STI PCI ROM enabled at 0x%08lx\n", rom_base);
 	}
 
-	printk("PCI graphic ROM found at %08lx (%u kB), fb @ %08lx (%u MB)\n",
+	printk(KERN_INFO "PCI graphic ROM found at %08lx (%u kB), fb @ %08lx (%u MB)\n",
 		rom_base, rom_len/1024, fb_base, fb_len/1024/1024);
 
 	for (i=0; i<DEVICE_COUNT_RESOURCE; i++)
-		printk("PCI region %d: %08lx with %lu kB\n",
+		printk(KERN_DEBUG "PCI region %d: %08lx with %lu kB\n",
 				i,
 				pci_resource_start(pd,i),
 				pci_resource_len(pd,i)/1024);
 
-	printk("Trying PCI STI ROM at %08lx, PCI hpa at %08lx\n",
+	printk(KERN_DEBUG "Trying PCI STI ROM at %08lx, PCI hpa at %08lx\n",
 		    rom_base, fb_base);
 
-	/* XXX */
-	/* A Visualize EG PCI graphics card in a c3000 would crash the machine. */
-	/* This is an ugly work-around */
-	switch (CPU_HVERSION) {
-	case 0x5BB:
-	case 0x5BC:
-#if 1
-#warning "FIXME: VisEG PCI graphic card crashes c3000"
-		if (pd->device == 0x1005) { /* "A4977A Visualize EG" */
-			printk("I'm not trying to set up the PCI graphic card now... "
-				"It would freeze your machine !\n");
-			sti = NULL;
-			break;
-		}
-		/* fall through */
-#endif
-	default:
-		sti = sti_try_rom_generic(rom_base, fb_base, pd);
-		if (sti) {
-			char pa_path[30];
-			print_pci_hwpath(pd, pa_path);
-			sticore_check_for_default_sti(sti, pa_path);
-		}
-		if (rom_base) {
-			pci_write_config_dword(pd, PCI_ROM_ADDRESS, rom_base & ~PCI_ROM_ADDRESS_ENABLE);
-			printk("STI PCI ROM disabled\n");
-		}
-		break;
+	sti = sti_try_rom_generic(rom_base, fb_base, pd);
+	if (sti) {
+		char pa_path[30];
+		print_pci_hwpath(pd, pa_path);
+		sticore_check_for_default_sti(sti, pa_path);
 	}
-
 	
 	if (!sti) {
 		printk(KERN_WARNING "Unable to handle STI device '%s'\n",
 			pd->name);
 		return -ENODEV;
 	}
+
 	return 0;
 }
 
Index: sticore.h
===================================================================
RCS file: /var/cvs/linux/drivers/video/sti/sticore.h,v
retrieving revision 1.21
diff -u -p -r1.21 sticore.h
--- sticore.h	2002/02/20 23:25:01	1.21
+++ sticore.h	2002/02/21 17:22:34
@@ -155,7 +155,10 @@ struct sti_init_flags {
 	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 caller_bootrom : 1;	/* set only by bootrom for each call */
+	u32 caller_kernel : 1;	/* set only by kernel for each call */
+	u32 caller_other : 1;	/* set only by non-[BR/K] caller */
+	u32 pad	: 14;		/* pad to word boundary */
 	u32 *future_ptr;	/* pointer to future data */
 };
 
@@ -251,14 +254,16 @@ struct sti_rom {
 	u32 dma_ctrl;
 	 u8 res040[7 * 4];
 	
-	u32 init_graph_m68k;
-	u32 flow_ctrl;
-	u32 user_timing;
-	u32 process_mgr;
-	u32 sti_util;
-	u32 end_addr;
-	u32 res0b8;
-	u32 res0bc;
+	u32 init_graph_addr;
+	u32 state_mgmt_addr;
+	u32 font_unp_addr;
+	u32 block_move_addr;
+	u32 self_test_addr;
+	u32 excep_hdlr_addr;
+	u32 inq_conf_addr;
+	u32 set_cm_entry_addr;
+	u32 image_unpack_addr;
+	u32 pa_risx_addrs[7];
 };
 
 struct sti_rom_font {
@@ -266,7 +271,7 @@ struct sti_rom_font {
 	u16 last_char;
 	 u8 width;
 	 u8 height;
-	 u8 font_type;
+	 u8 font_type;		/* language type */
 	 u8 bytes_per_char;
 	u32 next_font;
 	 u8 underline_height;

--------------Boundary-00=_4D8WWJP6D819E4201D4I--