[MPlayer-dev-eng] [PATCH] svgalib_helper support for libdha (fixed)

Matan Ziv-Av matan at svgalib.org
Tue Dec 17 23:09:22 CET 2002



Sorry, the previous patch was the wrong one. This is the correct patch.



Date: Wed, 18 Dec 2002 00:00:04 +0200 (IST)
From: Matan Ziv-Av <matan at svgalib.org>
To: mplayer-dev-eng at mplayerhq.hu
Subject: [PATCH] svgalib_helper support for libdha


Hello,

The attached patch adds to dha the option to use svgalib kernel helper
instead of dha helper. The helper is used in order to access the
hardware without root privileges.

The problem with the current patch is that there is no
autoconfiguration, so libdha/Makefile nneds to be editted to use this.
There is also no runtime detection, so vidix will not work if compiled
for svgalib helper but the module is not loaded. 

-- 
Matan Ziv-Av.                         matan at svgalib.org

-------------- next part --------------
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/arch/sh/boot/compressed/misc.c linux/arch/sh/boot/compressed/misc.c
--- kernel-2001.10.05/arch/sh/boot/compressed/misc.c	Thu Jul 20 18:55:00 2000
+++ linux/arch/sh/boot/compressed/misc.c	Tue Oct  9 15:25:47 2001
@@ -148,9 +148,23 @@
 	sh_bios_console_write(s, strlen(s));
 }
 #else
+#define TDFE 0x20
 void puts(const char *s)
 {
-  /* This should be updated to use the sh-sci routines */
+    char *SCFTDR2;
+    volatile unsigned short *SCFSR2;
+
+    while (*s) {
+
+        SCFTDR2 = (char *)0xffe8000c;
+        SCFSR2 = (unsigned short *)0xffe80010;
+    
+        while ( ((*SCFSR2) & TDFE) == 0 );
+    
+        *SCFTDR2 = *s;
+        *SCFSR2 = ~TDFE;
+        s++;
+    }
 }
 #endif
 
@@ -234,5 +248,5 @@
 	makecrc();
 	puts("Uncompressing Linux... ");
 	gunzip();
-	puts("Ok, booting the kernel.\n");
+	puts("Ok, booting the kernel.\r\n");
 }
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/arch/sh/kernel/head.S linux/arch/sh/kernel/head.S
--- kernel-2001.10.05/arch/sh/kernel/head.S	Fri Jul 27 14:48:29 2001
+++ linux/arch/sh/kernel/head.S	Sun Oct 14 21:23:39 2001
@@ -36,6 +36,19 @@
  *
  */
 ENTRY(_stext)
+
+	mov.l   icr, r10	! Ignore external interruputs
+	mov.w @r10 , r11
+	mov #0x40, r12
+	shll r12
+	or r12, r11
+	mov.w r11, @r10
+
+	mov.l   iprd, r10
+	mov #0, r11
+	mov.w r11, @r10
+
+
 	!			Initialize Status Register
 	mov.l	1f, r0		! MD=1, RB=0, BL=0, IMASK=0xF
 	ldc	r0, sr
@@ -83,3 +96,5 @@
 #if defined(__SH4__)
 7:	.long   SYMBOL_NAME(fpu_init)
 #endif
+iprd:	.long 0xffd00010
+icr:	.long 0xffd00000
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/arch/sh/kernel/io_unknown.c linux/arch/sh/kernel/io_unknown.c
--- kernel-2001.10.05/arch/sh/kernel/io_unknown.c	Fri Oct 27 04:36:06 2000
+++ linux/arch/sh/kernel/io_unknown.c	Tue Oct  9 15:23:50 2001
@@ -35,12 +35,50 @@
 UNKNOWN_ALIAS(outsb)
 UNKNOWN_ALIAS(outsw)
 UNKNOWN_ALIAS(outsl)
+
+#if 0
+
 UNKNOWN_ALIAS(readb)
 UNKNOWN_ALIAS(readw)
 UNKNOWN_ALIAS(readl)
 UNKNOWN_ALIAS(writeb)
 UNKNOWN_ALIAS(writew)
 UNKNOWN_ALIAS(writel)
+
+#else
+
+unsigned long unknown_readb(unsigned long addr)
+{
+	return *(volatile unsigned char*)addr;
+}
+
+unsigned long unknown_readw(unsigned long addr)
+{
+	return *(volatile unsigned short*)addr;
+}
+
+unsigned long unknown_readl(unsigned long addr)
+{
+	return *(volatile unsigned long*)addr;
+}
+
+void unknown_writeb(unsigned char b, unsigned long addr)
+{
+	*(volatile unsigned char*)addr = b;
+}
+
+void unknown_writew(unsigned short b, unsigned long addr)
+{
+	*(volatile unsigned short*)addr = b;
+}
+
+void unknown_writel(unsigned int b, unsigned long addr)
+{
+        *(volatile unsigned long*)addr = b;
+}
+
+#endif
+
 UNKNOWN_ALIAS(isa_port2addr)
 UNKNOWN_ALIAS(ioremap)
 UNKNOWN_ALIAS(iounmap)
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/arch/sh/kernel/irq_ipr.c linux/arch/sh/kernel/irq_ipr.c
--- kernel-2001.10.05/arch/sh/kernel/irq_ipr.c	Mon Jul 16 02:26:56 2001
+++ linux/arch/sh/kernel/irq_ipr.c	Tue Oct 16 20:49:10 2001
@@ -225,6 +225,11 @@
 	make_ipr_irq(IRDA_TXI_IRQ, IRDA_IPR_ADDR, IRDA_IPR_POS, IRDA_PRIORITY);
 #endif
 
+    	make_ipr_irq(2, INTC_IPRD, 3, 3);
+    	make_ipr_irq(5, INTC_IPRD, 2, 3);
+    	make_ipr_irq(8, INTC_IPRD, 1, 3);
+    	make_ipr_irq(11, INTC_IPRD, 0, 0);
+
 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709)
 	/*
 	 * Initialize the Interrupt Controller (INTC)
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/arch/sh/kernel/process.c linux/arch/sh/kernel/process.c
--- kernel-2001.10.05/arch/sh/kernel/process.c	Mon Jul 30 15:42:11 2001
+++ linux/arch/sh/kernel/process.c	Sun Nov 25 12:12:10 2001
@@ -36,6 +36,9 @@
 /*
  * The idle loop on a uniprocessor i386..
  */ 
+
+int leds=0xffff;
+
 void cpu_idle(void *unused)
 {
 	/* endless idle loop with no priority at all */
@@ -44,6 +47,10 @@
 	current->counter = -100;
 
 	while (1) {
+            	unsigned short *PTDRA;
+                PTDRA = (unsigned short *)0xff800030;
+                leds |=2;
+                *PTDRA=leds;
 		if (hlt_counter) {
 			if (current->need_resched)
 				break;
@@ -56,6 +63,8 @@
 			}
 			__sti();
 		}
+                leds &=~2;
+                *PTDRA= leds;
 		schedule();
 		check_pgt_cache();
 	}
@@ -64,6 +73,11 @@
 void machine_restart(char * __unused)
 {
 	/* SR.BL=1 and invoke address error to let CPU reset (manual reset) */
+
+volatile unsigned int *rom = 0xa0000000;
+
+    	*rom=0xffffffff;
+
 	asm volatile("ldc %0, sr\n\t"
 		     "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001));
 }
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/arch/sh/kernel/setup.c linux/arch/sh/kernel/setup.c
--- kernel-2001.10.05/arch/sh/kernel/setup.c	Thu Aug 23 19:36:40 2001
+++ linux/arch/sh/kernel/setup.c	Thu Jan 24 17:34:33 2002
@@ -281,6 +281,14 @@
 	unsigned long bootmap_size;
 	unsigned long start_pfn, max_pfn, max_low_pfn;
 
+MOUNT_ROOT_RDONLY = 1;
+RAMDISK_FLAGS=0;
+ORIG_ROOT_DEV=0x100;
+LOADER_TYPE=1;
+INITRD_START=0x300000;
+INITRD_SIZE=0x600000;
+strcpy(COMMAND_LINE, "console=ttySC1,115200");
+
 #ifdef CONFIG_SH_EARLY_PRINTK
 	sh_console_init();
 #endif
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/arch/sh/kernel/sh_ksyms.c linux/arch/sh/kernel/sh_ksyms.c
--- kernel-2001.10.05/arch/sh/kernel/sh_ksyms.c	Sat Aug 11 13:18:29 2001
+++ linux/arch/sh/kernel/sh_ksyms.c	Sun Oct 14 22:04:02 2001
@@ -104,3 +104,4 @@
 EXPORT_SYMBOL(flush_dcache_page);
 #endif
 EXPORT_SYMBOL(flush_tlb_page);
+EXPORT_SYMBOL(sh_mv);
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/drivers/char/sh-sci.c linux/drivers/char/sh-sci.c
--- kernel-2001.10.05/drivers/char/sh-sci.c	Mon Oct  1 04:21:53 2001
+++ linux/drivers/char/sh-sci.c	Mon Oct 15 18:09:39 2001
@@ -1034,7 +1034,7 @@
 	sci_driver.subtype = SERIAL_TYPE_NORMAL;
 	sci_driver.init_termios = tty_std_termios;
 	sci_driver.init_termios.c_cflag =
-		B9600 | CS8 | CREAD | HUPCL | CLOCAL | CRTSCTS;
+		B115200 | CS8 | CREAD | HUPCL | CLOCAL | CRTSCTS;
 	sci_driver.flags = TTY_DRIVER_REAL_RAW;
 	sci_driver.refcount = &sci_refcount;
 	sci_driver.table = sci_table;
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/drivers/mtd/maps/physmap.c linux/drivers/mtd/maps/physmap.c
--- kernel-2001.10.05/drivers/mtd/maps/physmap.c	Tue Jun 19 11:14:54 2001
+++ linux/drivers/mtd/maps/physmap.c	Wed Feb 13 14:40:15 2002
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
 #include <linux/config.h>
 
 
@@ -76,6 +77,40 @@
 	copy_to: physmap_copy_to
 };
 
+static struct mtd_partition marius_partitions[] = {
+        {
+                name: "blob",
+                size: 0x00040000,
+                offset: MTDPART_OFS_APPEND,
+        },{
+                name: "kernel",
+                size: 0x000c0000,
+                offset: MTDPART_OFS_APPEND,
+        },{
+                name: "initrd",
+                size: 0x00600000,
+                offset: MTDPART_OFS_APPEND,
+        },{
+                name: "opt",
+                size: 0x00680000,
+                offset: MTDPART_OFS_APPEND,
+        },{
+                name: "etc1",
+                size: 0x00140000,
+                offset: MTDPART_OFS_APPEND,
+        },{
+                name: "etc2",
+                size: 0x00140000,
+                offset: MTDPART_OFS_APPEND,
+        },{
+                name: "extra",
+                size: MTDPART_SIZ_FULL,
+                offset: MTDPART_OFS_APPEND,
+        }
+};
+
+#define NB_OF(x)  (sizeof(x)/sizeof(x[0]))
+
 #if LINUX_VERSION_CODE < 0x20212 && defined(MODULE)
 #define init_physmap init_module
 #define cleanup_physmap cleanup_module
@@ -83,9 +118,11 @@
 
 int __init init_physmap(void)
 {
-       	printk(KERN_NOTICE "physmap flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
-	physmap_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+    	int nb_parts;
 
+       	printk(KERN_NOTICE "physmap flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
+//	physmap_map.map_priv_1 = (unsigned long)ioremap(WINDOW_ADDR, WINDOW_SIZE);
+physmap_map.map_priv_1 = 0xa0000000;
 	if (!physmap_map.map_priv_1) {
 		printk("Failed to ioremap\n");
 		return -EIO;
@@ -94,11 +131,15 @@
 	if (mymtd) {
 		mymtd->module = THIS_MODULE;
 
+                nb_parts = NB_OF(marius_partitions);
+                if(nb_parts) {
+                    add_mtd_partitions(mymtd, marius_partitions, nb_parts);
+                } else 
 		add_mtd_device(mymtd);
 		return 0;
 	}
 
-	iounmap((void *)physmap_map.map_priv_1);
+//	iounmap((void *)physmap_map.map_priv_1);
 	return -ENXIO;
 }
 
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/include/asm/irq.h linux/include/asm/irq.h
--- kernel-2001.10.05/include/asm/irq.h	Fri Oct  5 19:25:35 2001
+++ linux/include/asm/irq.h	Sun Nov 25 12:27:14 2001
@@ -21,6 +21,7 @@
 #define INTC_IPRA	0xffd00004UL
 #define INTC_IPRB	0xffd00008UL
 #define INTC_IPRC	0xffd0000cUL
+#define INTC_IPRD	0xffd00010UL
 #endif
 
 #define TIMER_IRQ	16
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/include/asm-sh/irq.h linux/include/asm-sh/irq.h
--- kernel-2001.10.05/include/asm-sh/irq.h	Fri Oct  5 19:25:35 2001
+++ linux/include/asm-sh/irq.h	Sun Nov 25 12:27:14 2001
@@ -21,6 +21,7 @@
 #define INTC_IPRA	0xffd00004UL
 #define INTC_IPRB	0xffd00008UL
 #define INTC_IPRC	0xffd0000cUL
+#define INTC_IPRD	0xffd00010UL
 #endif
 
 #define TIMER_IRQ	16
diff -ubBrN -x .* -x *.bak -x jffs2 -x CVS -x jffs2.old -x config -x autoconf.h -x jffs2*.h -x Makefile -x Config.in kernel-2001.10.05/kernel/timer.c linux/kernel/timer.c
--- kernel-2001.10.05/kernel/timer.c	Tue Jun 19 11:11:51 2001
+++ linux/kernel/timer.c	Tue Oct  9 15:12:50 2001
@@ -665,8 +665,20 @@
 	calc_load(ticks);
 }
 
+extern int leds;
+
 void timer_bh(void)
 {
+#if 1
+unsigned short *PTDRA;
+    PTDRA=0xff800030;
+    if(jiffies & 31) {
+        int i;
+        i=(jiffies&32)>>5;
+        leds=(leds&~1) | i;
+        *PTDRA= leds;
+    }
+#endif
 	update_times();
 	run_timer_list();
 }


More information about the MPlayer-dev-eng mailing list