r2019 - trunk/kernel/source/kernel-source-2.6.9-2.6.9/debian/patches

Andres Salomon dilinger-guest@haydn.debian.org
Wed, 22 Dec 2004 21:37:50 -0700


Author: dilinger-guest
Date: 2004-12-22 21:37:44 -0700 (Wed, 22 Dec 2004)
New Revision: 2019

Added:
   trunk/kernel/source/kernel-source-2.6.9-2.6.9/debian/patches/modular-vesafb-2.dpatch
Log:
Rework modular-vesafb patch a bit (see patch for changelog); will include this
in series once it's been tested a bit.  Should fix #282234 and a few other
problems; and maybe even make it suitable for upstream submission...


Added: trunk/kernel/source/kernel-source-2.6.9-2.6.9/debian/patches/modular-vesafb-2.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.9-2.6.9/debian/patches/modular-vesafb-2.dpatch	2004-12-22 14:20:25 UTC (rev 2018)
+++ trunk/kernel/source/kernel-source-2.6.9-2.6.9/debian/patches/modular-vesafb-2.dpatch	2004-12-23 04:37:44 UTC (rev 2019)
@@ -0,0 +1,227 @@
+#! /bin/sh -e
+## <PATCHNAME>.dpatch by <PATCH_AUTHOR@EMAI>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Description: modularised VESA FB
+## DP: Patch author: initial author unknown, fixed up by Andres Salomon
+## DP: Upstream status: not submitted
+
+. $(dirname $0)/DPATCH
+
+@DPATCH@
+
+base-0
+    tag of dilinger@voxel.net--2004-public/linux-drivers-video--mainline--0--base-0
+patch-1
+    pull in debian's modular-vesafb.dpatch from k-s-2.6.9 -3.
+patch-2
+    add missing vesafb_remove registration in device_driver struct
+patch-3
+    vesafb_init() should be called regardless of whether CONFIG_MODULE == y
+patch-4
+    drop 'inverse'; it's not used.
+patch-5
+    there's no need to include moduleparam.h; already icnluded by module.h
+patch-6
+    add struct vesafb_info, and move mtrr handle to it (vs. global)
+patch-7
+    add missing framebuffer_release() call
+patch-8
+    turn mtrr into initdata; that's 4 bytes saved, baby!
+patch-9
+    proper module arg handling; don't require a single "options=" string
+patch-10
+    ah, module_param_named() certainly is handy..
+
+--- orig/drivers/video/Kconfig
++++ mod/drivers/video/Kconfig
+@@ -311,7 +311,7 @@
+ 	  cards. Say Y if you have one of those.
+ 
+ config FB_VESA
+-	bool "VESA VGA graphics support"
++	tristate "VESA VGA graphics support"
+ 	depends on FB && (X86 || X86_64)
+ 	help
+ 	  This is the frame buffer device driver for generic VESA 2.0
+
+
+--- orig/drivers/video/vesafb.c
++++ mod/drivers/video/vesafb.c
+@@ -28,6 +28,12 @@
+ #define dac_reg	(0x3c8)
+ #define dac_val	(0x3c9)
+ 
++struct vesafb_info
++{
++	u32 pseudo_palette[256];
++	int mtrr_hdl;
++};
++
+ /* --------------------------------------------------------------------- */
+ 
+ static struct fb_var_screeninfo vesafb_defined __initdata = {
+@@ -47,15 +53,30 @@
+ 	.accel	= FB_ACCEL_NONE,
+ };
+ 
+-static int             inverse   = 0;
+-static int             mtrr      = 1;
++static int             mtrr __initdata = 1;
+ static int	       vram __initdata = 0; /* Set amount of memory to be used */
+ static int             pmi_setpal = 0;	/* pmi for palette changes ??? */
++static int             redraw __initdata = 0;
+ static int             ypan       = 0;  /* 0..nothing, 1..ypan, 2..ywrap */
++static int             ywrap __initdata = 0;
+ static unsigned short  *pmi_base  = NULL;
+ static void            (*pmi_start)(void);
+ static void            (*pmi_pal)(void);
+ 
++module_param(redraw, bool, 0);
++module_param(ypan, bool, 0);
++module_param(ywrap, bool, 0);
++module_param_named(vgapal, pmi_setpal, invbool, 0);
++MODULE_PARM_DESC(vgapal, "Use VGA for setting palette (default)");
++module_param_named(pmipal, pmi_setpal, bool, 0);
++MODULE_PARM_DESC(pmipal, "Use PMI for setting palette");
++module_param(mtrr, bool, 0);
++MODULE_PARM_DESC(mtrr, "Enable MTRR support (default)");
++module_param_named(nomtrr, mtrr, invbool, 0);
++MODULE_PARM_DESC(nomtrr, "Disable MTRR support");
++module_param(vram, int, 0);
++MODULE_PARM_DESC(vram, "System RAM to allocate to framebuffer");
++
+ /* --------------------------------------------------------------------- */
+ 
+ static int vesafb_pan_display(struct fb_var_screeninfo *var,
+@@ -183,6 +204,7 @@
+ 	.fb_cursor	= soft_cursor,
+ };
+ 
++#ifndef MODULE
+ int __init vesafb_setup(char *options)
+ {
+ 	char *this_opt;
+@@ -193,9 +215,7 @@
+ 	while ((this_opt = strsep(&options, ",")) != NULL) {
+ 		if (!*this_opt) continue;
+ 		
+-		if (! strcmp(this_opt, "inverse"))
+-			inverse=1;
+-		else if (! strcmp(this_opt, "redraw"))
++		if (! strcmp(this_opt, "redraw"))
+ 			ypan=0;
+ 		else if (! strcmp(this_opt, "ypan"))
+ 			ypan=1;
+@@ -214,11 +234,13 @@
+ 	}
+ 	return 0;
+ }
++#endif
+ 
+ static int __init vesafb_probe(struct device *device)
+ {
+ 	struct platform_device *dev = to_platform_device(device);
+ 	struct fb_info *info;
++	struct vesafb_info *vfb_info;
+ 	int i, err;
+ 
+ 	if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB)
+@@ -264,13 +286,14 @@
+ 		   spaces our resource handlers simply don't know about */
+ 	}
+ 
+-	info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
++	info = framebuffer_alloc(sizeof(struct vesafb_info), &dev->dev);
+ 	if (!info) {
+ 		release_mem_region(vesafb_fix.smem_start, vesafb_fix.smem_len);
+ 		return -ENOMEM;
+ 	}
+-	info->pseudo_palette = info->par;
+-	info->par = NULL;
++	vfb_info = (struct vesafb_info *) info->par;
++	vfb_info->mtrr_hdl = -1;
++	info->pseudo_palette = vfb_info->pseudo_palette;
+ 
+         info->screen_base = ioremap(vesafb_fix.smem_start, vesafb_fix.smem_len);
+ 	if (!info->screen_base) {
+@@ -368,7 +391,7 @@
+                 	temp_size &= (temp_size - 1);
+                         
+                 /* Try and find a power of two to add */
+-		while (temp_size && mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) {
++		while (temp_size && (vfb_info->mtrr_hdl = mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)) == -EINVAL) {
+ 			temp_size >>= 1;
+ 		}
+ 	}
+@@ -390,6 +413,7 @@
+ 	}
+ 	printk(KERN_INFO "fb%d: %s frame buffer device\n",
+ 	       info->node, info->fix.id);
++	dev_set_drvdata(device, info);
+ 	return 0;
+ err:
+ 	framebuffer_release(info);
+@@ -397,10 +421,24 @@
+ 	return err;
+ }
+ 
++static void __exit vesafb_remove(struct device *device)
++{
++	struct fb_info *info = dev_get_drvdata(device);
++	struct vesafb_info *vfb_info = (struct vesafb_info *) info->par;
++
++	unregister_framebuffer(info);
++	if (vfb_info->mtrr_hdl >= 0)
++		mtrr_del(vfb_info->mtrr_hdl, 0, 0);
++	iounmap(info->screen_base);
++	framebuffer_release(info);
++	release_mem_region(vesafb_fix.smem_start, vesafb_fix.smem_len);
++}
++
+ static struct device_driver vesafb_driver = {
+ 	.name	= "vesafb",
+ 	.bus	= &platform_bus_type,
+ 	.probe	= vesafb_probe,
++	.remove = vesafb_remove,
+ };
+ 
+ static struct platform_device vesafb_device = {
+@@ -410,11 +448,18 @@
+ int __init vesafb_init(void)
+ {
+ 	int ret;
++#ifndef MODULE
+ 	char *option = NULL;
+ 
+ 	/* ignore error return of fb_get_options */
+ 	fb_get_options("vesafb", &option);
+ 	vesafb_setup(option);
++#else
++	if (redraw)
++		ypan = 0;
++	if (ywrap)
++		ypan = 2;
++#endif
+ 	ret = driver_register(&vesafb_driver);
+ 
+ 	if (!ret) {
+@@ -426,6 +471,15 @@
+ }
+ module_init(vesafb_init);
+ 
++#ifdef MODULE
++static void __exit vesafb_exit(void)
++{
++	platform_device_unregister(&vesafb_device);
++	driver_unregister(&vesafb_driver);
++}
++module_exit(vesafb_exit);
++#endif
++
+ /*
+  * Overrides for Emacs so that we follow Linus's tabbing style.
+  * ---------------------------------------------------------------------------
+
+
+