2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/*
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Hardware  accelerated  Matrox  Millennium  I ,  II ,  Mystique ,  G100 ,  G200  and  G400 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  ( c )  1998 - 2002  Petr  Vandrovec  < vandrove @ vc . cvut . cz > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Portions  Copyright  ( c )  2001  Matrox  Graphics  Inc . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Version :  1.65  2002 / 08 / 14 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  MTRR  stuff :  1998  Tom  Rini  < trini @ kernel . crashing . org > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Contributors :  " menion? "  < menion @ mindless . com > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Betatesting ,  fixes ,  ideas 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Kurt Garloff "  < garloff @ suse . de > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Betatesting ,  fixes ,  ideas ,  videomodes ,  videomodes  timmings 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Tom Rini "  < trini @ kernel . crashing . org > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      MTRR  stuff ,  PPC  cleanups ,  betatesting ,  fixes ,  ideas 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Bibek Sahu "  < scorpio @ dodds . net > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Access  device  through  readb | w | l  and  write  b | w | l 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Extensive  debugging  stuff 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Daniel Haun "  < haund @ usa . net > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Testing ,  hardware  cursor  fixes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Scott Wood "  < sawst46 + @ pitt . edu > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Fixes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Gerd Knorr "  < kraxel @ goldbach . isdn . cs . tu - berlin . de > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Betatesting 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Kelly French "  < targon @ hazmat . com > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Fernando Herrera "  < fherrera @ eurielec . etsit . upm . es > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Betatesting ,  bug  reporting 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Pablo Bianucci "  < pbian @ pccp . com . ar > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Fixes ,  ideas ,  betatesting 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Inaky Perez Gonzalez "  < inaky @ peloncho . fis . ucm . es > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Fixes ,  enhandcements ,  ideas ,  betatesting 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Ryuichi Oikawa "  < roikawa @ rr . iiij4u . or . jp > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      PPC  betatesting ,  PPC  support ,  backward  compatibility 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Paul Womar "  < Paul @ pwomar . demon . co . uk > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Owen Waller "  < O . Waller @ ee . qub . ac . uk > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      PPC  betatesting 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Thomas Pornin "  < pornin @ bolet . ens . fr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Alpha  betatesting 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Pieter van Leuven "  < pvl @ iae . nl > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Ulf Jaenicke-Roessler "  < ujr @ physik . phy . tu - dresden . de > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      G100  testing 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " H. Peter Arvin "  < hpa @ transmeta . com > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Ideas 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Cort Dougan "  < cort @ cs . nmt . edu > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      CHRP  fixes  and  PReP  cleanup 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Mark Vojkovich "  < mvojkovi @ ucsd . edu > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      G400  support 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Samuel Hocevar "  < sam @ via . ecp . fr > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Fixes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Anton Altaparmakov "  < AntonA @ bigfoot . com > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      G400  MAX / non - MAX  distinction 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Ken Aaker "  < kdaaker @ rchland . vnet . ibm . com > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      memtype  extension  ( needed  for  GXT130P  RS / 6000  adapter ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Uns Lider "  < unslider @ miranda . org > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      G100  PLNWT  fixes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Denis Zaitsev "  < zzz @ cd - club . ru > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      Fixes 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Mike Pieper "  < mike @ pieper - family . de > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      TVOut  enhandcements ,  V4L2  control  interface . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                " Diego Biurrun "  < diego @ biurrun . de > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *                      DFP  testing 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  ( following  author  is  not  in  any  relation  with  this  code ,  but  his  code 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *   is  included  in  this  driver ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Based  on  framebuffer  driver  for  VBE  2.0  compliant  graphic  boards 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *      ( c )  1998  Gerd  Knorr  < kraxel @ cs . tu - berlin . de > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  ( following  author  is  not  in  any  relation  with  this  code ,  but  his  ideas 
							 
						 
					
						
							
								
									
										
										
										
											2007-05-09 07:14:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 *   were  used  when  writing  this  driver ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 		 FreeVBE / AF  ( Matrox ) ,  " Shawn Hargreaves "  < shawn @ talula . demon . co . uk > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <linux/version.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "matroxfb_base.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "matroxfb_misc.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "matroxfb_accel.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "matroxfb_DAC1064.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "matroxfb_Ti3026.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "matroxfb_maven.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "matroxfb_crtc2.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "matroxfb_g450.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <linux/matroxfb.h> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  <linux/interrupt.h> 
 
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
  http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.
2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).
   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
											 
										 
										
											2010-03-24 17:04:11 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <linux/slab.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2007-10-16 01:29:04 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <linux/uaccess.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_PPC_PMAC 
 
							 
						 
					
						
							
								
									
										
										
										
											2006-03-28 23:15:54 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <asm/machdep.h> 
 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								unsigned  char  nvram_read_byte ( int ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  default_vmode  =  VMODE_NVRAM ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  default_cmode  =  CMODE_NVRAM ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  matroxfb_unregister_device ( struct  matrox_fb_info *  minfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* --------------------------------------------------------------------- */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  card  parameters 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* --------------------------------------------------------------------- */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  fb_var_screeninfo  vesafb_defined  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									640 , 480 , 640 , 480 , /* W,H, W, H (virtual) load xres,xres_virtual*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									0 , 0 , 		/* virtual -> visible no offset */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									8 , 		/* depth -> load bits_per_pixel */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									0 , 		/* greyscale ? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 0 , 0 , 0 } , 	/* R */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 0 , 0 , 0 } , 	/* G */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 0 , 0 , 0 } , 	/* B */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 0 , 0 , 0 } , 	/* transparency */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									0 , 		/* standard pixel format */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									FB_ACTIVATE_NOW , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									- 1 , - 1 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									FB_ACCELF_TEXT , 	/* accel flags */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									39721L , 48L , 16L , 33L , 10L , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									96L , 2L , ~ 0 , 	/* No sync info */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									FB_VMODE_NONINTERLACED , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* --------------------------------------------------------------------- */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  update_crtc2 ( struct  matrox_fb_info  * minfo ,  unsigned  int  pos ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  matroxfb_dh_fb_info  * info  =  minfo - > crtc2 . info ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* Make sure that displays are compatible */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( info  & &  ( info - > fbcon . var . bits_per_pixel  = =  minfo - > fbcon . var . bits_per_pixel ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 & &  ( info - > fbcon . var . xres_virtual  = =  minfo - > fbcon . var . xres_virtual ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 & &  ( info - > fbcon . var . green . length  = =  minfo - > fbcon . var . green . length ) 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										switch  ( minfo - > fbcon . var . bits_per_pixel )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											case  16 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											case  32 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												pos  =  pos  *  8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( info - > interlaced )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													mga_outl ( 0x3C2C ,  pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													mga_outl ( 0x3C28 ,  pos  +  minfo - > fbcon . var . xres_virtual  *  minfo - > fbcon . var . bits_per_pixel  /  8 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													mga_outl ( 0x3C28 ,  pos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  matroxfb_crtc1_panpos ( struct  matrox_fb_info  * minfo ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > crtc1 . panpos  > =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										unsigned  long  flags ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  panpos ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										matroxfb_DAC_lock_irqsave ( flags ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										panpos  =  minfo - > crtc1 . panpos ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										if  ( panpos  > =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											unsigned  int  extvga_reg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											minfo - > crtc1 . panpos  =  - 1 ;  /* No update pending anymore */ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											extvga_reg  =  mga_inb ( M_EXTVGA_INDEX ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											mga_setr ( M_EXTVGA_INDEX ,  0x00 ,  panpos ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( extvga_reg  ! =  0x00 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												mga_outb ( M_EXTVGA_INDEX ,  extvga_reg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										matroxfb_DAC_unlock_irqrestore ( flags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
											 
										 
										
											
												IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around.  On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable.  On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions.  Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller.  A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs.  Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
	struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
	set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
	-	update_process_times(user_mode(regs));
	-	profile_tick(CPU_PROFILING, regs);
	+	update_process_times(user_mode(get_irq_regs()));
	+	profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
 (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
     the input_dev struct.
 (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
     something different depending on whether it's been supplied with a regs
     pointer or not.
 (*) Various IRQ handler function pointers have been moved to type
     irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
											 
										 
										
											2006-10-05 14:55:46 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  irqreturn_t  matrox_irq ( int  irq ,  void  * dev_id ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									u_int32_t  status ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  handled  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:50 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info  * minfo  =  dev_id ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									status  =  mga_inl ( M_STATUS ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( status  &  0x20 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_outl ( M_ICLEAR ,  0x20 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > crtc1 . vsync . cnt + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										matroxfb_crtc1_panpos ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										wake_up_interruptible ( & minfo - > crtc1 . vsync . wait ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										handled  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( status  &  0x200 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_outl ( M_ICLEAR ,  0x200 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > crtc2 . vsync . cnt + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										wake_up_interruptible ( & minfo - > crtc2 . vsync . wait ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										handled  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  IRQ_RETVAL ( handled ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  matroxfb_enable_irq ( struct  matrox_fb_info  * minfo ,  int  reenable ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									u_int32_t  bm ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > devflags . accelerator  = =  FB_ACCEL_MATROX_MGAG400 ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										bm  =  0x220 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										bm  =  0x020 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! test_and_set_bit ( 0 ,  & minfo - > irq_flags ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( request_irq ( minfo - > pcidev - > irq ,  matrox_irq , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												IRQF_SHARED ,  " matroxfb " ,  minfo ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											clear_bit ( 0 ,  & minfo - > irq_flags ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											return  - EINVAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* Clear any pending field interrupts */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_outl ( M_ICLEAR ,  bm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_outl ( M_IEN ,  mga_inl ( M_IEN )  |  bm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( reenable )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										u_int32_t  ien ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										ien  =  mga_inl ( M_IEN ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ( ien  &  bm )  ! =  bm )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											printk ( KERN_DEBUG  " matroxfb: someone disabled IRQ [%08X] \n " ,  ien ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											mga_outl ( M_IEN ,  ien  |  bm ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  matroxfb_disable_irq ( struct  matrox_fb_info  * minfo ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( test_and_clear_bit ( 0 ,  & minfo - > irq_flags ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										/* Flush pending pan-at-vbl request... */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										matroxfb_crtc1_panpos ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( minfo - > devflags . accelerator  = =  FB_ACCEL_MATROX_MGAG400 ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											mga_outl ( M_IEN ,  mga_inl ( M_IEN )  &  ~ 0x220 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											mga_outl ( M_IEN ,  mga_inl ( M_IEN )  &  ~ 0x20 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										free_irq ( minfo - > pcidev - > irq ,  minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  matroxfb_wait_for_sync ( struct  matrox_fb_info  * minfo ,  u_int32_t  crtc ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									struct  matrox_vsync  * vs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  cnt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch  ( crtc )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  0 : 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											vs  =  & minfo - > crtc1 . vsync ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  1 : 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( minfo - > devflags . accelerator  ! =  FB_ACCEL_MATROX_MGAG400 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												return  - ENODEV ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											vs  =  & minfo - > crtc2 . vsync ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  - ENODEV ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									ret  =  matroxfb_enable_irq ( minfo ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( ret )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									cnt  =  vs - > cnt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ret  =  wait_event_interruptible_timeout ( vs - > wait ,  cnt  ! =  vs - > cnt ,  HZ / 10 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ret  <  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  ret ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ret  = =  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										matroxfb_enable_irq ( minfo ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return  - ETIMEDOUT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* --------------------------------------------------------------------- */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  matrox_pan_var ( struct  matrox_fb_info  * minfo , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											   struct  fb_var_screeninfo  * var ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  pos ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  short  p0 ,  p1 ,  p2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  p3 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  vbl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  long  flags ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CRITFLAGS 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > dead ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > fbcon . var . xoffset  =  var - > xoffset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . var . yoffset  =  var - > yoffset ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									pos  =  ( minfo - > fbcon . var . yoffset  *  minfo - > fbcon . var . xres_virtual  +  minfo - > fbcon . var . xoffset )  *  minfo - > curr . final_bppShift  /  32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									pos  + =  minfo - > curr . ydstorg . chunks ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p0  =  minfo - > hw . CRTC [ 0x0D ]  =  pos  &  0xFF ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p1  =  minfo - > hw . CRTC [ 0x0C ]  =  ( pos  &  0xFF00 )  > >  8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p2  =  minfo - > hw . CRTCEXT [ 0 ]  =  ( minfo - > hw . CRTCEXT [ 0 ]  &  0xB0 )  |  ( ( pos  > >  16 )  &  0x0F )  |  ( ( pos  > >  14 )  &  0x40 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									p3  =  minfo - > hw . CRTCEXT [ 8 ]  =  pos  > >  21 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* FB_ACTIVATE_VBL and we can acquire interrupts? Honor FB_ACTIVATE_VBL then... */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									vbl  =  ( var - > activate  &  FB_ACTIVATE_VBL )  & &  ( matroxfb_enable_irq ( minfo ,  0 )  = =  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CRITBEGIN 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									matroxfb_DAC_lock_irqsave ( flags ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mga_setr ( M_CRTC_INDEX ,  0x0D ,  p0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mga_setr ( M_CRTC_INDEX ,  0x0C ,  p1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > devflags . support32MB ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										mga_setr ( M_EXTVGA_INDEX ,  0x08 ,  p3 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( vbl )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > crtc1 . panpos  =  p2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* Abort any pending change */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > crtc1 . panpos  =  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										mga_setr ( M_EXTVGA_INDEX ,  0x00 ,  p2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									matroxfb_DAC_unlock_irqrestore ( flags ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									update_crtc2 ( minfo ,  pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CRITEND 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  matroxfb_remove ( struct  matrox_fb_info  * minfo ,  int  dummy ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* Currently we are holding big kernel lock on all dead & usecount updates.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  Destroy  everything  after  all  users  release  it .  Especially  do  not  unregister 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  framebuffer  and  iounmap  memory ,  neither  fbmem  nor  fbcon - cfb *  does  not  check 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  for  device  unplugged  when  in  use . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  In  future  we  should  point  mmio . vbase  &  video . vbase  somewhere  where  we  can 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  write  data  without  causing  too  much  damage . . . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > dead  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( minfo - > usecount )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										/* destroy it later */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matroxfb_unregister_device ( minfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unregister_framebuffer ( & minfo - > fbcon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matroxfb_g450_shutdown ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_MTRR 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > mtrr . vram_valid ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mtrr_del ( minfo - > mtrr . vram ,  minfo - > video . base ,  minfo - > video . len ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mga_iounmap ( minfo - > mmio . vbase ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mga_iounmap ( minfo - > video . vbase ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									release_mem_region ( minfo - > video . base ,  minfo - > video . len_maximum ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									release_mem_region ( minfo - > mmio . base ,  16384 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									kfree ( minfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/*
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  Open / Release  the  frame  buffer  device 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  matroxfb_open ( struct  fb_info  * info ,  int  user ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:50 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info  * minfo  =  info2minfo ( info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG_LOOP ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > dead )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return  - ENXIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > usecount + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( user )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > userusecount + + ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  matroxfb_release ( struct  fb_info  * info ,  int  user ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:50 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info  * minfo  =  info2minfo ( info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG_LOOP ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( user )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( 0  = =  - - minfo - > userusecount )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											matroxfb_disable_irq ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! ( - - minfo - > usecount )  & &  minfo - > dead )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										matroxfb_remove ( minfo ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  matroxfb_pan_display ( struct  fb_var_screeninfo  * var , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										struct  fb_info *  info )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:50 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info  * minfo  =  info2minfo ( info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matrox_pan_var ( minfo ,  var ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  matroxfb_get_final_bppShift ( const  struct  matrox_fb_info  * minfo , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												       int  bpp ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									int  bppshft2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									bppshft2  =  bpp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! bppshft2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( isInterleave ( minfo ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										bppshft2  > > =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > devflags . video64bits ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										bppshft2  > > =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  bppshft2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  matroxfb_test_and_set_rounding ( const  struct  matrox_fb_info  * minfo , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													  int  xres ,  int  bpp ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									int  over ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  rounding ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch  ( bpp )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  0 : 		return  xres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  4 : 		rounding  =  128 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  8 : 		rounding  =  64 ; 	/* doc says 64; 32 is OK for G400 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  16 : 	rounding  =  32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  24 : 	rounding  =  64 ; 	/* doc says 64; 32 is OK for G400 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										default : 	rounding  =  16 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												/* on G400, 16 really does not work */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( minfo - > devflags . accelerator  = =  FB_ACCEL_MATROX_MGAG400 ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
													rounding  =  32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( isInterleave ( minfo ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										rounding  * =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									over  =  xres  %  rounding ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( over ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										xres  + =  rounding - over ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  xres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  matroxfb_pitch_adjust ( const  struct  matrox_fb_info  * minfo ,  int  xres , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												 int  bpp ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									const  int *  width ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  xres_new ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! bpp )  return  xres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									width  =  minfo - > capable . vxres ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > devflags . precise_width )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										while  ( * width )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ( * width  > =  xres )  & &  ( matroxfb_test_and_set_rounding ( minfo ,  * width ,  bpp )  = =  * width ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											width + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										xres_new  =  * width ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										xres_new  =  matroxfb_test_and_set_rounding ( minfo ,  xres ,  bpp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  xres_new ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  matroxfb_get_cmap_len ( struct  fb_var_screeninfo  * var )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch  ( var - > bits_per_pixel )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  4 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  16 ; 	/* pseudocolor... 16 entries HW palette */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  8 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  256 ; 	/* pseudocolor... 256 entries HW palette */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  16 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  16 ; 	/* directcolor... 16 entries SW palette */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* Mystique: truecolor, 16 entries SW palette, HW palette hardwired into 1:1 mapping */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  24 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  16 ; 	/* directcolor... 16 entries SW palette */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* Mystique: truecolor, 16 entries SW palette, HW palette hardwired into 1:1 mapping */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  32 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											return  16 ; 	/* directcolor... 16 entries SW palette */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													/* Mystique: truecolor, 16 entries SW palette, HW palette hardwired into 1:1 mapping */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  16 ; 	/* return something reasonable... or panic()? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  matroxfb_decode_var ( const  struct  matrox_fb_info  * minfo , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											       struct  fb_var_screeninfo  * var ,  int  * visual , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											       int  * video_cmap_len ,  unsigned  int *  ydstorg ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									struct  RGBT  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										unsigned  char  bpp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										struct  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											unsigned  char  offset , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												      length ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  red , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										  green , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										  blue , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										  transp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										signed  char  visual ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									static  const  struct  RGBT  table [ ] =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{  8 , {  0 , 8 } , { 0 , 8 } , { 0 , 8 } , {  0 , 0 } , MX_VISUAL_PSEUDOCOLOR } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 15 , { 10 , 5 } , { 5 , 5 } , { 0 , 5 } , { 15 , 1 } , MX_VISUAL_DIRECTCOLOR } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 16 , { 11 , 5 } , { 5 , 6 } , { 0 , 5 } , {  0 , 0 } , MX_VISUAL_DIRECTCOLOR } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 24 , { 16 , 8 } , { 8 , 8 } , { 0 , 8 } , {  0 , 0 } , MX_VISUAL_DIRECTCOLOR } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{ 32 , { 16 , 8 } , { 8 , 8 } , { 0 , 8 } , { 24 , 8 } , MX_VISUAL_DIRECTCOLOR } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  RGBT  const  * rgbt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  bpp  =  var - > bits_per_pixel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  vramlen ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  memlen ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch  ( bpp )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										case  4 : 	 if  ( ! minfo - > capable . cfb4 )  return  - EINVAL ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											 break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  8 : 	 break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  16 :  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  24 :  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  32 :  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										default :  return  - EINVAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									* ydstorg  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									vramlen  =  minfo - > video . len_usable ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( var - > yres_virtual  <  var - > yres ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var - > yres_virtual  =  var - > yres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( var - > xres_virtual  <  var - > xres ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var - > xres_virtual  =  var - > xres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									var - > xres_virtual  =  matroxfb_pitch_adjust ( minfo ,  var - > xres_virtual ,  bpp ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									memlen  =  var - > xres_virtual  *  bpp  *  var - > yres_virtual  /  8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( memlen  >  vramlen )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var - > yres_virtual  =  vramlen  *  8  /  ( var - > xres_virtual  *  bpp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										memlen  =  var - > xres_virtual  *  bpp  *  var - > yres_virtual  /  8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* There is hardware bug that no line can cross 4MB boundary */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* give up for CFB24, it is impossible to easy workaround it */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* for other try to do something */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! minfo - > capable . cross4MB  & &  ( memlen  >  0x400000 ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										if  ( bpp  = =  24 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* sorry */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											unsigned  int  linelen ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											unsigned  int  m1  =  linelen  =  var - > xres_virtual  *  bpp  /  8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											unsigned  int  m2  =  PAGE_SIZE ; 	/* or 128 if you do not need PAGE ALIGNED address */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											unsigned  int  max_yres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											while  ( m1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												while  ( m2  > =  m1 )  m2  - =  m1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												t  =  m1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												m1  =  m2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												m2  =  t ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											m2  =  linelen  *  PAGE_SIZE  /  m2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											* ydstorg  =  m2  =  0x400000  %  m2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											max_yres  =  ( vramlen  -  m2 )  /  linelen ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( var - > yres_virtual  >  max_yres ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												var - > yres_virtual  =  max_yres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* YDSTLEN contains only signed 16bit value */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( var - > yres_virtual  >  32767 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var - > yres_virtual  =  32767 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* we must round yres/xres down, we already rounded y/xres_virtual up
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									   if  it  was  possible .  We  should  return  - EINVAL ,  but  I  disagree  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( var - > yres_virtual  <  var - > yres ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var - > yres  =  var - > yres_virtual ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( var - > xres_virtual  <  var - > xres ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var - > xres  =  var - > xres_virtual ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( var - > xoffset  +  var - > xres  >  var - > xres_virtual ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var - > xoffset  =  var - > xres_virtual  -  var - > xres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( var - > yoffset  +  var - > yres  >  var - > yres_virtual ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										var - > yoffset  =  var - > yres_virtual  -  var - > yres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( bpp  = =  16  & &  var - > green . length  = =  5 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-30 22:57:33 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										bpp - - ;  /* an artificial value - 15 */ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( rgbt  =  table ;  rgbt - > bpp  <  bpp ;  rgbt + + ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define	SETCLR(clr)\ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									var - > clr . offset  =  rgbt - > clr . offset ; \
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									var - > clr . length  =  rgbt - > clr . length 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SETCLR ( red ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SETCLR ( green ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SETCLR ( blue ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									SETCLR ( transp ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# undef	SETCLR 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									* visual  =  rgbt - > visual ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( bpp  >  8 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										dprintk ( " matroxfb: truecolor:  " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											" size=%d:%d:%d:%d, shift=%d:%d:%d:%d \n " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											var - > transp . length ,  var - > red . length ,  var - > green . length ,  var - > blue . length , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											var - > transp . offset ,  var - > red . offset ,  var - > green . offset ,  var - > blue . offset ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									* video_cmap_len  =  matroxfb_get_cmap_len ( var ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									dprintk ( KERN_INFO  " requested %d*%d/%dbpp (%d*%d) \n " ,  var - > xres ,  var - > yres ,  var - > bits_per_pixel , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												var - > xres_virtual ,  var - > yres_virtual ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  matroxfb_setcolreg ( unsigned  regno ,  unsigned  red ,  unsigned  green , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											      unsigned  blue ,  unsigned  transp , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											      struct  fb_info  * fb_info ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info *  minfo  =  container_of ( fb_info ,  struct  matrox_fb_info ,  fbcon ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/*
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *   Set  a  single  color  register .  The  values  supplied  are 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *   already  rounded  down  to  the  hardware ' s  capabilities 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *   ( according  to  the  entries  in  the  ` var '  structure ) .  Return 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *   ! =  0  for  invalid  regno . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( regno  > =  minfo - > curr . cmap_len ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > fbcon . var . grayscale )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										/* gray = 0.30*R + 0.59*G + 0.11*B */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										red  =  green  =  blue  =  ( red  *  77  +  green  *  151  +  blue  *  28 )  > >  8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									red  =  CNVT_TOHW ( red ,  minfo - > fbcon . var . red . length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									green  =  CNVT_TOHW ( green ,  minfo - > fbcon . var . green . length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									blue  =  CNVT_TOHW ( blue ,  minfo - > fbcon . var . blue . length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									transp  =  CNVT_TOHW ( transp ,  minfo - > fbcon . var . transp . length ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									switch  ( minfo - > fbcon . var . bits_per_pixel )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									case  4 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									case  8 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_outb ( M_DAC_REG ,  regno ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_outb ( M_DAC_VAL ,  red ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_outb ( M_DAC_VAL ,  green ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_outb ( M_DAC_VAL ,  blue ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									case  16 : 
							 
						 
					
						
							
								
									
										
										
										
											2007-07-17 04:05:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( regno  > =  16 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											u_int16_t  col  = 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												( red  < <  minfo - > fbcon . var . red . offset )      | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												( green  < <  minfo - > fbcon . var . green . offset )  | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												( blue  < <  minfo - > fbcon . var . blue . offset )    | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												( transp  < <  minfo - > fbcon . var . transp . offset ) ;  /* for 1:5:5:5 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											minfo - > cmap [ regno ]  =  col  |  ( col  < <  16 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									case  24 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									case  32 : 
							 
						 
					
						
							
								
									
										
										
										
											2007-07-17 04:05:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( regno  > =  16 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > cmap [ regno ]  = 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											( red    < <  minfo - > fbcon . var . red . offset )    | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											( green  < <  minfo - > fbcon . var . green . offset )  | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											( blue   < <  minfo - > fbcon . var . blue . offset )   | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											( transp  < <  minfo - > fbcon . var . transp . offset ) ; 	/* 8:8:8:8 */ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  matroxfb_init_fix ( struct  matrox_fb_info  * minfo ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  fb_fix_screeninfo  * fix  =  & minfo - > fbcon . fix ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									strcpy ( fix - > id , " MATROX " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fix - > xpanstep  =  8 ; 	/* 8 for 8bpp, 4 for 16bpp, 2 for 32bpp */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fix - > ypanstep  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fix - > ywrapstep  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									fix - > mmio_start  =  minfo - > mmio . base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fix - > mmio_len  =  minfo - > mmio . len ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fix - > accel  =  minfo - > devflags . accelerator ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  matroxfb_update_fix ( struct  matrox_fb_info  * minfo ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  fb_fix_screeninfo  * fix  =  & minfo - > fbcon . fix ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mutex_lock ( & minfo - > fbcon . mm_lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fix - > smem_start  =  minfo - > video . base  +  minfo - > curr . ydstorg . bytes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fix - > smem_len  =  minfo - > video . len_usable  -  minfo - > curr . ydstorg . bytes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mutex_unlock ( & minfo - > fbcon . mm_lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  matroxfb_check_var ( struct  fb_var_screeninfo  * var ,  struct  fb_info  * info ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  visual ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  cmap_len ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  ydstorg ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:50 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info  * minfo  =  info2minfo ( info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > dead )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return  - ENXIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ( err  =  matroxfb_decode_var ( minfo ,  var ,  & visual ,  & cmap_len ,  & ydstorg ) )  ! =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  matroxfb_set_par ( struct  fb_info  * info ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  visual ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  cmap_len ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  ydstorg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  fb_var_screeninfo  * var ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:50 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info  * minfo  =  info2minfo ( info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > dead )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return  - ENXIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									var  =  & info - > var ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ( err  =  matroxfb_decode_var ( minfo ,  var ,  & visual ,  & cmap_len ,  & ydstorg ) )  ! =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return  err ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > fbcon . screen_base  =  vaddr_va ( minfo - > video . vbase )  +  ydstorg ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matroxfb_update_fix ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > fbcon . fix . visual  =  visual ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . fix . type  =  FB_TYPE_PACKED_PIXELS ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . fix . type_aux  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . fix . line_length  =  ( var - > xres_virtual  *  var - > bits_per_pixel )  > >  3 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										unsigned  int  pos ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > curr . cmap_len  =  cmap_len ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										ydstorg  + =  minfo - > devflags . ydstorg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > curr . ydstorg . bytes  =  ydstorg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > curr . ydstorg . chunks  =  ydstorg  > >  ( isInterleave ( minfo )  ?  3  :  2 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										if  ( var - > bits_per_pixel  = =  4 ) 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											minfo - > curr . ydstorg . pixels  =  ydstorg ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										else 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											minfo - > curr . ydstorg . pixels  =  ( ydstorg  *  8 )  /  var - > bits_per_pixel ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > curr . final_bppShift  =  matroxfb_get_final_bppShift ( minfo ,  var - > bits_per_pixel ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										{ 	struct  my_timming  mt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											struct  matrox_hw_state *  hw ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											int  out ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											matroxfb_var2my ( var ,  & mt ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											mt . crtc  =  MATROXFB_SRC_CRTC1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* CRTC1 delays */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											switch  ( var - > bits_per_pixel )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case   0 : 	mt . delay  =  31  +  0 ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  16 : 	mt . delay  =  21  +  8 ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  24 : 	mt . delay  =  17  +  8 ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  32 : 	mt . delay  =  16  +  8 ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												default : 	mt . delay  =  31  +  8 ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											hw  =  & minfo - > hw ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											down_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											for  ( out  =  0 ;  out  <  MATROXFB_MAX_OUTPUTS ;  out + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( minfo - > outputs [ out ] . src  = =  MATROXFB_SRC_CRTC1  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												    minfo - > outputs [ out ] . output - > compute )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													minfo - > outputs [ out ] . output - > compute ( minfo - > outputs [ out ] . data ,  & mt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											up_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											minfo - > crtc1 . pixclock  =  mt . pixclock ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											minfo - > crtc1 . mnp  =  mt . mnp ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											minfo - > hw_switch - > init ( minfo ,  & mt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											pos  =  ( var - > yoffset  *  var - > xres_virtual  +  var - > xoffset )  *  minfo - > curr . final_bppShift  /  32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											pos  + =  minfo - > curr . ydstorg . chunks ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											hw - > CRTC [ 0x0D ]  =  pos  &  0xFF ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											hw - > CRTC [ 0x0C ]  =  ( pos  &  0xFF00 )  > >  8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											hw - > CRTCEXT [ 0 ]  =  ( hw - > CRTCEXT [ 0 ]  &  0xF0 )  |  ( ( pos  > >  16 )  &  0x0F )  |  ( ( pos  > >  14 )  &  0x40 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											hw - > CRTCEXT [ 8 ]  =  pos  > >  21 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											minfo - > hw_switch - > restore ( minfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											update_crtc2 ( minfo ,  pos ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											down_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											for  ( out  =  0 ;  out  <  MATROXFB_MAX_OUTPUTS ;  out + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( minfo - > outputs [ out ] . src  = =  MATROXFB_SRC_CRTC1  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												    minfo - > outputs [ out ] . output - > program )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													minfo - > outputs [ out ] . output - > program ( minfo - > outputs [ out ] . data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											for  ( out  =  0 ;  out  <  MATROXFB_MAX_OUTPUTS ;  out + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( minfo - > outputs [ out ] . src  = =  MATROXFB_SRC_CRTC1  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												    minfo - > outputs [ out ] . output - > start )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													minfo - > outputs [ out ] . output - > start ( minfo - > outputs [ out ] . data ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											up_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											matrox_cfbX_init ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > initialized  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  matroxfb_get_vblank ( struct  matrox_fb_info  * minfo , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											       struct  fb_vblank  * vblank ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  sts1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matroxfb_enable_irq ( minfo ,  0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									memset ( vblank ,  0 ,  sizeof ( * vblank ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vblank - > flags  =  FB_VBLANK_HAVE_VCOUNT  |  FB_VBLANK_HAVE_VSYNC  | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											FB_VBLANK_HAVE_VBLANK  |  FB_VBLANK_HAVE_HBLANK ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sts1  =  mga_inb ( M_INSTS1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vblank - > vcount  =  mga_inl ( M_VCOUNT ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* BTW, on my PIII/450 with G400, reading M_INSTS1
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									   byte  makes  this  call  about  12 %  slower  ( 1.70  vs .  2.05  us 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									   per  ioctl ( ) )  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( sts1  &  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vblank - > flags  | =  FB_VBLANK_HBLANKING ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( sts1  &  8 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vblank - > flags  | =  FB_VBLANK_VSYNCING ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( vblank - > vcount  > =  minfo - > fbcon . var . yres ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										vblank - > flags  | =  FB_VBLANK_VBLANKING ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( test_bit ( 0 ,  & minfo - > irq_flags ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										vblank - > flags  | =  FB_VBLANK_HAVE_COUNT ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* Only one writer, aligned int value...
 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										   it  should  work  without  lock  and  without  atomic_t  */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										vblank - > count  =  minfo - > crtc1 . vsync . cnt ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  matrox_altout  panellink_output  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. name 	 =  " Panellink output " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-01-14 13:21:25 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  matroxfb_ioctl ( struct  fb_info  * info , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											  unsigned  int  cmd ,  unsigned  long  arg ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									void  __user  * argp  =  ( void  __user  * ) arg ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:50 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info  * minfo  =  info2minfo ( info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > dead )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return  - ENXIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch  ( cmd )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  FBIOGET_VBLANK : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												struct  fb_vblank  vblank ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												err  =  matroxfb_get_vblank ( minfo ,  & vblank ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												if  ( err ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( copy_to_user ( argp ,  & vblank ,  sizeof ( vblank ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  FBIO_WAITFORVSYNC : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												u_int32_t  crt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( get_user ( crt ,  ( u_int32_t  __user  * ) arg ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												return  matroxfb_wait_for_sync ( minfo ,  crt ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  MATROXFB_SET_OUTPUT_MODE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												struct  matroxioc_output_mode  mom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												struct  matrox_altout  * oproc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  val ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( copy_from_user ( & mom ,  argp ,  sizeof ( mom ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( mom . output  > =  MATROXFB_MAX_OUTPUTS ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - ENXIO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												down_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												oproc  =  minfo - > outputs [ mom . output ] . output ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! oproc )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													val  =  - ENXIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  if  ( ! oproc - > verifymode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( mom . mode  = =  MATROXFB_OUTPUT_MODE_MONITOR )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														val  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														val  =  - EINVAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													val  =  oproc - > verifymode ( minfo - > outputs [ mom . output ] . data ,  mom . mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! val )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( minfo - > outputs [ mom . output ] . mode  ! =  mom . mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														minfo - > outputs [ mom . output ] . mode  =  mom . mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
														val  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												up_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												if  ( val  ! =  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  val ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												switch  ( minfo - > outputs [ mom . output ] . src )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
													case  MATROXFB_SRC_CRTC1 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														matroxfb_set_par ( info ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													case  MATROXFB_SRC_CRTC2 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															struct  matroxfb_dh_fb_info *  crtc2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															down_read ( & minfo - > crtc2 . lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															crtc2  =  minfo - > crtc2 . info ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
															if  ( crtc2 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
																crtc2 - > fbcon . fbops - > fb_set_par ( & crtc2 - > fbcon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															up_read ( & minfo - > crtc2 . lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  MATROXFB_GET_OUTPUT_MODE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												struct  matroxioc_output_mode  mom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												struct  matrox_altout  * oproc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  val ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( copy_from_user ( & mom ,  argp ,  sizeof ( mom ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( mom . output  > =  MATROXFB_MAX_OUTPUTS ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - ENXIO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												down_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												oproc  =  minfo - > outputs [ mom . output ] . output ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! oproc )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													val  =  - ENXIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													mom . mode  =  minfo - > outputs [ mom . output ] . mode ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
													val  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												up_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												if  ( val ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  val ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( copy_to_user ( argp ,  & mom ,  sizeof ( mom ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  MATROXFB_SET_OUTPUT_CONNECTION : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												u_int32_t  tmp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  changes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( copy_from_user ( & tmp ,  argp ,  sizeof ( tmp ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( i  =  0 ;  i  <  32 ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( tmp  &  ( 1  < <  i ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														if  ( i  > =  MATROXFB_MAX_OUTPUTS ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															return  - ENXIO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														if  ( ! minfo - > outputs [ i ] . output ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
															return  - ENXIO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														switch  ( minfo - > outputs [ i ] . src )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
															case  MATROXFB_SRC_NONE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															case  MATROXFB_SRC_CRTC1 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
																return  - EBUSY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( minfo - > devflags . panellink )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
													if  ( tmp  &  MATROXFB_OUTPUT_CONN_DFP )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														if  ( tmp  &  MATROXFB_OUTPUT_CONN_SECONDARY ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															return  - EINVAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														for  ( i  =  0 ;  i  <  MATROXFB_MAX_OUTPUTS ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															if  ( minfo - > outputs [ i ] . src  = =  MATROXFB_SRC_CRTC2 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
																return  - EBUSY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												changes  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( i  =  0 ;  i  <  MATROXFB_MAX_OUTPUTS ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( tmp  &  ( 1  < <  i ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														if  ( minfo - > outputs [ i ] . src  ! =  MATROXFB_SRC_CRTC1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
															changes  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
															minfo - > outputs [ i ] . src  =  MATROXFB_SRC_CRTC1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
														} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													}  else  if  ( minfo - > outputs [ i ] . src  = =  MATROXFB_SRC_CRTC1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
														changes  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
														minfo - > outputs [ i ] . src  =  MATROXFB_SRC_NONE ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! changes ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												matroxfb_set_par ( info ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  MATROXFB_GET_OUTPUT_CONNECTION : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												u_int32_t  conn  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( i  =  0 ;  i  <  MATROXFB_MAX_OUTPUTS ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( minfo - > outputs [ i ] . src  = =  MATROXFB_SRC_CRTC1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
														conn  | =  1  < <  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( put_user ( conn ,  ( u_int32_t  __user  * ) arg ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  MATROXFB_GET_AVAILABLE_OUTPUTS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												u_int32_t  conn  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( i  =  0 ;  i  <  MATROXFB_MAX_OUTPUTS ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( minfo - > outputs [ i ] . output )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														switch  ( minfo - > outputs [ i ] . src )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
															case  MATROXFB_SRC_NONE : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															case  MATROXFB_SRC_CRTC1 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
																conn  | =  1  < <  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
																break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												if  ( minfo - > devflags . panellink )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
													if  ( conn  &  MATROXFB_OUTPUT_CONN_DFP ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														conn  & =  ~ MATROXFB_OUTPUT_CONN_SECONDARY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													if  ( conn  &  MATROXFB_OUTPUT_CONN_SECONDARY ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
														conn  & =  ~ MATROXFB_OUTPUT_CONN_DFP ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( put_user ( conn ,  ( u_int32_t  __user  * ) arg ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  MATROXFB_GET_ALL_OUTPUTS : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												u_int32_t  conn  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												for  ( i  =  0 ;  i  <  MATROXFB_MAX_OUTPUTS ;  i + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
													if  ( minfo - > outputs [ i ] . output )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
														conn  | =  1  < <  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( put_user ( conn ,  ( u_int32_t  __user  * ) arg ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  VIDIOC_QUERYCAP : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												struct  v4l2_capability  r ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												memset ( & r ,  0 ,  sizeof ( r ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												strcpy ( r . driver ,  " matroxfb " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												strcpy ( r . card ,  " Matrox " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												sprintf ( r . bus_info ,  " PCI:%s " ,  pci_name ( minfo - > pcidev ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												r . version  =  KERNEL_VERSION ( 1 , 0 , 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												r . capabilities  =  V4L2_CAP_VIDEO_OUTPUT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( copy_to_user ( argp ,  & r ,  sizeof ( r ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  VIDIOC_QUERYCTRL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												struct  v4l2_queryctrl  qctrl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( copy_from_user ( & qctrl ,  argp ,  sizeof ( qctrl ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												down_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! minfo - > outputs [ 1 ] . output )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
													err  =  - ENXIO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												}  else  if  ( minfo - > outputs [ 1 ] . output - > getqueryctrl )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													err  =  minfo - > outputs [ 1 ] . output - > getqueryctrl ( minfo - > outputs [ 1 ] . data ,  & qctrl ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													err  =  - EINVAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												up_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												if  ( err  > =  0  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												    copy_to_user ( argp ,  & qctrl ,  sizeof ( qctrl ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  VIDIOC_G_CTRL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												struct  v4l2_control  ctrl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( copy_from_user ( & ctrl ,  argp ,  sizeof ( ctrl ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												down_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! minfo - > outputs [ 1 ] . output )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
													err  =  - ENXIO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												}  else  if  ( minfo - > outputs [ 1 ] . output - > getctrl )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													err  =  minfo - > outputs [ 1 ] . output - > getctrl ( minfo - > outputs [ 1 ] . data ,  & ctrl ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													err  =  - EINVAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												up_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												if  ( err  > =  0  & & 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												    copy_to_user ( argp ,  & ctrl ,  sizeof ( ctrl ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												return  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										case  VIDIOC_S_CTRL : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												struct  v4l2_control  ctrl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( copy_from_user ( & ctrl ,  argp ,  sizeof ( ctrl ) ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													return  - EFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												down_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( ! minfo - > outputs [ 1 ] . output )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
													err  =  - ENXIO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												}  else  if  ( minfo - > outputs [ 1 ] . output - > setctrl )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													err  =  minfo - > outputs [ 1 ] . output - > setctrl ( minfo - > outputs [ 1 ] . data ,  & ctrl ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													err  =  - EINVAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												up_read ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												return  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  - ENOTTY ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  matroxfb_blank ( int  blank ,  struct  fb_info  * info ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  seq ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  crtc ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CRITFLAGS 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:50 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info  * minfo  =  info2minfo ( info ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > dead ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									switch  ( blank )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									case  FB_BLANK_NORMAL :   seq  =  0x20 ;  crtc  =  0x00 ;  break ;  /* works ??? */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									case  FB_BLANK_VSYNC_SUSPEND :   seq  =  0x20 ;  crtc  =  0x10 ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									case  FB_BLANK_HSYNC_SUSPEND :   seq  =  0x20 ;  crtc  =  0x20 ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									case  FB_BLANK_POWERDOWN :   seq  =  0x20 ;  crtc  =  0x30 ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									default :  seq  =  0x00 ;  crtc  =  0x00 ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CRITBEGIN 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mga_outb ( M_SEQ_INDEX ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mga_outb ( M_SEQ_DATA ,  ( mga_inb ( M_SEQ_DATA )  &  ~ 0x20 )  |  seq ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mga_outb ( M_EXTVGA_INDEX ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mga_outb ( M_EXTVGA_DATA ,  ( mga_inb ( M_EXTVGA_DATA )  &  ~ 0x30 )  |  crtc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									CRITEND 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  fb_ops  matroxfb_ops  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. owner  = 	THIS_MODULE , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. fb_open  = 	matroxfb_open , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. fb_release  = 	matroxfb_release , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. fb_check_var  = 	matroxfb_check_var , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. fb_set_par  = 	matroxfb_set_par , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. fb_setcolreg  = 	matroxfb_setcolreg , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. fb_pan_display  = matroxfb_pan_display , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. fb_blank  = 	matroxfb_blank , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. fb_ioctl  = 	matroxfb_ioctl , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*	.fb_fillrect =	<set by matrox_cfbX_init>, */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*	.fb_copyarea =	<set by matrox_cfbX_init>, */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*	.fb_imageblit =	<set by matrox_cfbX_init>, */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*	.fb_cursor =	<set by matrox_cfbX_init>, */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RSDepth(X)	(((X) >> 8) & 0x0F) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS8bpp		0x1 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS15bpp		0x2 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS16bpp		0x3 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS32bpp		0x4 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS4bpp		0x5 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS24bpp		0x6 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RSText		0x7 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RSText8		0x8 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* 9-F */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  {  struct  fb_bitfield  red ,  green ,  blue ,  transp ;  int  bits_per_pixel ;  }  colors [ ]  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  {   0 ,  8 ,  0 } ,  {  0 ,  8 ,  0 } ,  {  0 ,  8 ,  0 } ,  {   0 ,  0 ,  0 } ,   8  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  {  10 ,  5 ,  0 } ,  {  5 ,  5 ,  0 } ,  {  0 ,  5 ,  0 } ,  {  15 ,  1 ,  0 } ,  16  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  {  11 ,  5 ,  0 } ,  {  5 ,  6 ,  0 } ,  {  0 ,  5 ,  0 } ,  {   0 ,  0 ,  0 } ,  16  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  {  16 ,  8 ,  0 } ,  {  8 ,  8 ,  0 } ,  {  0 ,  8 ,  0 } ,  {  24 ,  8 ,  0 } ,  32  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  {   0 ,  8 ,  0 } ,  {  0 ,  8 ,  0 } ,  {  0 ,  8 ,  0 } ,  {   0 ,  0 ,  0 } ,   4  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  {  16 ,  8 ,  0 } ,  {  8 ,  8 ,  0 } ,  {  0 ,  8 ,  0 } ,  {   0 ,  0 ,  0 } ,  24  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  {   0 ,  6 ,  0 } ,  {  0 ,  6 ,  0 } ,  {  0 ,  6 ,  0 } ,  {   0 ,  0 ,  0 } ,   0  } , 	/* textmode with (default) VGA8x16 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  {   0 ,  6 ,  0 } ,  {  0 ,  6 ,  0 } ,  {  0 ,  6 ,  0 } ,  {   0 ,  0 ,  0 } ,   0  } , 	/* textmode hardwired to VGA8x8 */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* initialized by setup, see explanation at end of file (search for MODULE_PARM_DESC) */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 00:54:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  unsigned  int  mem ; 		/* "matroxfb:mem:xxxxxM" */ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								static  int  option_precise_width  =  1 ; 	/* cannot be changed, option_precise_width==0 must imply noaccel */ 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 00:54:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  inv24 ; 			/* "matroxfb:inv24" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  cross4MB  =  - 1 ; 		/* "matroxfb:cross4MB" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  disabled ; 			/* "matroxfb:disabled" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  noaccel ; 			/* "matroxfb:noaccel" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  nopan ; 			/* "matroxfb:nopan" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  no_pci_retry ; 		/* "matroxfb:nopciretry" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  novga ; 			/* "matroxfb:novga" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  nobios ; 			/* "matroxfb:nobios" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  noinit  =  1 ; 			/* "matroxfb:init" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  inverse ; 			/* "matroxfb:inverse" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  sgram ; 			/* "matroxfb:sgram" */ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_MTRR 
 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 00:54:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  mtrr  =  1 ; 			/* "matroxfb:nomtrr" */ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 00:54:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  grayscale ; 			/* "matroxfb:grayscale" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  dev  =  - 1 ; 			/* "matroxfb:dev:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  vesa  =  ~ 0 ; 		/* "matroxfb:vesa:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  depth  =  - 1 ; 			/* "matroxfb:depth:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  xres ; 		/* "matroxfb:xres:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  yres ; 		/* "matroxfb:yres:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  upper  =  ~ 0 ; 		/* "matroxfb:upper:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  lower  =  ~ 0 ; 		/* "matroxfb:lower:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  vslen ; 		/* "matroxfb:vslen:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  left  =  ~ 0 ; 		/* "matroxfb:left:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  right  =  ~ 0 ; 		/* "matroxfb:right:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  hslen ; 		/* "matroxfb:hslen:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  pixclock ; 		/* "matroxfb:pixclock:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  sync  =  - 1 ; 			/* "matroxfb:sync:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  fv ; 			/* "matroxfb:fv:xxxxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  fh ; 			/* "matroxfb:fh:xxxxxk" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  unsigned  int  maxclk ; 		/* "matroxfb:maxclk:xxxxM" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  dfp ; 				/* "matroxfb:dfp */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  dfp_type  =  - 1 ; 		/* "matroxfb:dfp:xxx */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  memtype  =  - 1 ; 		/* "matroxfb:memtype:xxx" */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  char  outputs [ 8 ] ; 			/* "matroxfb:outputs:xxx" */ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifndef MODULE 
 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-08 00:54:26 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  char  videomode [ 64 ] ; 		/* "matroxfb:mode:xxxxx" or "matroxfb:xxxxx" */ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  matroxfb_getmemory ( struct  matrox_fb_info  * minfo , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											      unsigned  int  maxSize ,  unsigned  int  * realSize ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									vaddr_t  vm ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  offs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  offs2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-07 01:00:58 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									unsigned  char  orig ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									unsigned  char  bytes [ 32 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  char *  tmp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									vm  =  minfo - > video . vbase ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									maxSize  & =  ~ 0x1FFFFF ; 	/* must be X*2MB (really it must be 2 or X*4MB) */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* at least 2MB */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( maxSize  <  0x0200000 )  return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( maxSize  >  0x2000000 )  maxSize  =  0x2000000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mga_outb ( M_EXTVGA_INDEX ,  0x03 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-09-13 01:25:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									orig  =  mga_inb ( M_EXTVGA_DATA ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mga_outb ( M_EXTVGA_DATA ,  orig  |  0x80 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tmp  =  bytes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( offs  =  0x100000 ;  offs  <  maxSize ;  offs  + =  0x200000 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										* tmp + +  =  mga_readb ( vm ,  offs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( offs  =  0x100000 ;  offs  <  maxSize ;  offs  + =  0x200000 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_writeb ( vm ,  offs ,  0x02 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-07 01:00:58 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mga_outb ( M_CACHEFLUSH ,  0x00 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									for  ( offs  =  0x100000 ;  offs  <  maxSize ;  offs  + =  0x200000 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( mga_readb ( vm ,  offs )  ! =  0x02 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_writeb ( vm ,  offs ,  mga_readb ( vm ,  offs )  -  0x02 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( mga_readb ( vm ,  offs ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									tmp  =  bytes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( offs2  =  0x100000 ;  offs2  <  maxSize ;  offs2  + =  0x200000 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_writeb ( vm ,  offs2 ,  * tmp + + ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mga_outb ( M_EXTVGA_INDEX ,  0x03 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-09-13 01:25:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mga_outb ( M_EXTVGA_DATA ,  orig ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									* realSize  =  offs  -  0x100000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_FB_MATROX_MILLENIUM 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > interleave  =  ! ( ! isMillenium ( minfo )  | |  ( ( offs  -  0x100000 )  &  0x3FFFFF ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								struct  video_board  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  maxvram ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  maxdisplayable ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  accelID ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  matrox_switch *  lowlevel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_FB_MATROX_MILLENIUM 
 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-23 13:20:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  struct  video_board  vbMillennium  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxvram  =  0x0800000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxdisplayable  =  0x0800000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. accelID  =  FB_ACCEL_MATROX_MGA2064W , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. lowlevel  =  & matrox_millennium 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  video_board  vbMillennium2  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxvram  =  0x1000000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxdisplayable  =  0x0800000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. accelID  =  FB_ACCEL_MATROX_MGA2164W , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. lowlevel  =  & matrox_millennium 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  video_board  vbMillennium2A  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxvram  =  0x1000000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxdisplayable  =  0x0800000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. accelID  =  FB_ACCEL_MATROX_MGA2164W_AGP , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. lowlevel  =  & matrox_millennium 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# endif	 /* CONFIG_FB_MATROX_MILLENIUM */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_FB_MATROX_MYSTIQUE 
 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-23 13:20:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  struct  video_board  vbMystique  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxvram  =  0x0800000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxdisplayable  =  0x0800000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. accelID  =  FB_ACCEL_MATROX_MGA1064SG , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. lowlevel  =  & matrox_mystique 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# endif	 /* CONFIG_FB_MATROX_MYSTIQUE */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_FB_MATROX_G 
 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-23 13:20:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  struct  video_board  vbG100  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxvram  =  0x0800000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxdisplayable  =  0x0800000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. accelID  =  FB_ACCEL_MATROX_MGAG100 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. lowlevel  =  & matrox_G100 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  video_board  vbG200  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxvram  =  0x1000000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxdisplayable  =  0x1000000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. accelID  =  FB_ACCEL_MATROX_MGAG200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. lowlevel  =  & matrox_G100 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								/* from doc it looks like that accelerator can draw only to low 16MB :-( Direct accesses & displaying are OK for
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								   whole  32 MB  */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-08-23 13:20:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  struct  video_board  vbG400  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxvram  =  0x2000000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. maxdisplayable  =  0x1000000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. accelID  =  FB_ACCEL_MATROX_MGAG400 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. lowlevel  =  & matrox_G100 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_VIDEO64BIT		0x0001 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define	DEVF_SWAPS		0x0002 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_SRCORG		0x0004 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_DUALHEAD		0x0008 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_CROSS4MB		0x0010 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_TEXT4B		0x0020 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* #define DEVF_recycled	0x0040	*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* #define DEVF_recycled	0x0080	*/ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_SUPPORT32MB	0x0100 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_ANY_VXRES		0x0200 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_TEXT16B		0x0400 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_CRTC2		0x0800 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_MAVEN_CAPABLE	0x1000 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_PANELLINK_CAPABLE	0x2000 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_G450DAC		0x4000 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_GCORE	(DEVF_VIDEO64BIT | DEVF_SWAPS | DEVF_CROSS4MB) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_G2CORE	(DEVF_GCORE | DEVF_ANY_VXRES | DEVF_MAVEN_CAPABLE | DEVF_PANELLINK_CAPABLE | DEVF_SRCORG | DEVF_DUALHEAD) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_G100	(DEVF_GCORE)  /* no doc, no vxres... */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_G200	(DEVF_G2CORE) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_G400	(DEVF_G2CORE | DEVF_SUPPORT32MB | DEVF_TEXT16B | DEVF_CRTC2) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* if you'll find how to drive DFP... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_G450	(DEVF_GCORE | DEVF_ANY_VXRES | DEVF_SUPPORT32MB | DEVF_TEXT16B | DEVF_CRTC2 | DEVF_G450DAC | DEVF_SRCORG | DEVF_DUALHEAD) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define DEVF_G550	(DEVF_G450) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  board  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  short  vendor ,  device ,  rev ,  svid ,  sid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  flags ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  maxclk ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									enum  mga_chip  chip ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  video_board *  base ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  char *  name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  dev_list [ ]  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_FB_MATROX_MILLENIUM 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MIL , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_TEXT4B , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										230000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_2064 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbMillennium , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Millennium (PCI) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MIL_2 , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_SWAPS , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										220000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_2164 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbMillennium2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Millennium II (PCI) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MIL_2_AGP , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_SWAPS , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										250000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_2164 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbMillennium2A , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Millennium II (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_FB_MATROX_MYSTIQUE 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MYS , 	0x02 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_VIDEO64BIT  |  DEVF_CROSS4MB , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										180000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_1064 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbMystique , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Mystique (PCI) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MYS , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_VIDEO64BIT  |  DEVF_SWAPS  |  DEVF_CROSS4MB , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										220000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_1164 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbMystique , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Mystique 220 (PCI) " } , 
							 
						 
					
						
							
								
									
										
										
										
											2005-11-07 01:00:57 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MYS_AGP , 	0x02 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_VIDEO64BIT  |  DEVF_CROSS4MB , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										180000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_1064 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbMystique , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Mystique (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MYS_AGP , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_VIDEO64BIT  |  DEVF_SWAPS  |  DEVF_CROSS4MB , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										220000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_1164 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbMystique , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Mystique 220 (AGP) " } , 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_FB_MATROX_G 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G100_MM , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G100 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										230000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G100 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG100 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" MGA-G100 (PCI) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G100_AGP , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G100 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										230000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G100 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG100 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" MGA-G100 (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G200_PCI , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										250000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" MGA-G200 (PCI) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G200_AGP , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_SS_VENDOR_ID_MATROX , 	PCI_SS_ID_MATROX_GENERIC , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										220000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" MGA-G200 (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G200_AGP , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_SS_VENDOR_ID_MATROX , 	PCI_SS_ID_MATROX_MYSTIQUE_G200_AGP , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										230000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Mystique G200 (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G200_AGP , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_SS_VENDOR_ID_MATROX , 	PCI_SS_ID_MATROX_MILLENIUM_G200_AGP , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										250000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Millennium G200 (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G200_AGP , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_SS_VENDOR_ID_MATROX , 	PCI_SS_ID_MATROX_MARVEL_G200_AGP , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										230000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Marvel G200 (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G200_AGP , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_SS_VENDOR_ID_SIEMENS_NIXDORF , 	PCI_SS_ID_SIEMENS_MGA_G200_AGP , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										230000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" MGA-G200 (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G200_AGP , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										230000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG200 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" G200 (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G400 , 	0x80 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_SS_VENDOR_ID_MATROX , 	PCI_SS_ID_MATROX_MILLENNIUM_G400_MAX_AGP , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G400 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										360000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G400 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG400 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" Millennium G400 MAX (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G400 , 	0x80 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G400 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										300000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G400 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG400 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" G400 (AGP) " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G400 , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G450 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										360000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G450 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG400 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" G450 " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G550 , 	0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										DEVF_G550 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										360000 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										MGA_G550 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										& vbG400 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										" G550 " } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 0 , 			0 , 				0xFF , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										NULL , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										NULL } } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifndef MODULE 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  fb_videomode  defaultmode  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* 640x480 @ 60Hz, 31.5 kHz */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									NULL ,  60 ,  640 ,  480 ,  39721 ,  40 ,  24 ,  32 ,  11 ,  96 ,  2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									0 ,  FB_VMODE_NONINTERLACED 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif  /* !MODULE */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  hotplug  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  setDefaultOutputs ( struct  matrox_fb_info  * minfo ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  char *  ptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > outputs [ 0 ] . default_src  =  MATROXFB_SRC_CRTC1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( minfo - > devflags . g450dac )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > outputs [ 1 ] . default_src  =  MATROXFB_SRC_CRTC1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > outputs [ 2 ] . default_src  =  MATROXFB_SRC_CRTC1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( dfp )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > outputs [ 2 ] . default_src  =  MATROXFB_SRC_CRTC1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ptr  =  outputs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( i  =  0 ;  i  <  MATROXFB_MAX_OUTPUTS ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										char  c  =  * ptr + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( c  = =  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( c  = =  ' 0 ' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											minfo - > outputs [ i ] . default_src  =  MATROXFB_SRC_NONE ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( c  = =  ' 1 ' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											minfo - > outputs [ i ] . default_src  =  MATROXFB_SRC_CRTC1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( c  = =  ' 2 '  & &  minfo - > devflags . crtc2 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											minfo - > outputs [ i ] . default_src  =  MATROXFB_SRC_CRTC2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											printk ( KERN_ERR  " matroxfb: Unknown outputs setting \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* Nullify this option for subsequent adapters */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									outputs [ 0 ]  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  initMatrox2 ( struct  matrox_fb_info  * minfo ,  struct  board  * b ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									unsigned  long  ctrlptr_phys  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  long  video_base_phys  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									unsigned  int  memsize ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									static  struct  pci_device_id  intel_82437 [ ]  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{  PCI_DEVICE ( PCI_VENDOR_ID_INTEL ,  PCI_DEVICE_ID_INTEL_82437 )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										{  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* set default values... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vesafb_defined . accel_flags  =  FB_ACCELF_TEXT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > hw_switch  =  b - > base - > lowlevel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . accelerator  =  b - > base - > accelID ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > max_pixel_clock  =  b - > maxclk ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									printk ( KERN_INFO  " matroxfb: Matrox %s detected \n " ,  b - > name ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > capable . plnwt  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > chip  =  b - > chip ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > capable . srcorg  =  b - > flags  &  DEVF_SRCORG ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . video64bits  =  b - > flags  &  DEVF_VIDEO64BIT ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( b - > flags  &  DEVF_TEXT4B )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > devflags . vgastep  =  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . textmode  =  4 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . text_type_aux  =  FB_AUX_TEXT_MGA_STEP16 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									}  else  if  ( b - > flags  &  DEVF_TEXT16B )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > devflags . vgastep  =  16 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . textmode  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . text_type_aux  =  FB_AUX_TEXT_MGA_STEP16 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > devflags . vgastep  =  8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . textmode  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . text_type_aux  =  FB_AUX_TEXT_MGA_STEP8 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > devflags . support32MB  =  ( b - > flags  &  DEVF_SUPPORT32MB )  ! =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . precise_width  =  ! ( b - > flags  &  DEVF_ANY_VXRES ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . crtc2  =  ( b - > flags  &  DEVF_CRTC2 )  ! =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . maven_capable  =  ( b - > flags  &  DEVF_MAVEN_CAPABLE )  ! =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . dualhead  =  ( b - > flags  &  DEVF_DUALHEAD )  ! =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . dfp_type  =  dfp_type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . g450dac  =  ( b - > flags  &  DEVF_G450DAC )  ! =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . textstep  =  minfo - > devflags . vgastep  *  minfo - > devflags . textmode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . textvram  =  65536  /  minfo - > devflags . textmode ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									setDefaultOutputs ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( b - > flags  &  DEVF_PANELLINK_CAPABLE )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > outputs [ 2 ] . data  =  minfo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > outputs [ 2 ] . output  =  & panellink_output ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > outputs [ 2 ] . src  =  minfo - > outputs [ 2 ] . default_src ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > outputs [ 2 ] . mode  =  MATROXFB_OUTPUT_MODE_MONITOR ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . panellink  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( minfo - > capable . cross4MB  <  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > capable . cross4MB  =  b - > flags  &  DEVF_CROSS4MB ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( b - > flags  &  DEVF_SWAPS )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ctrlptr_phys  =  pci_resource_start ( minfo - > pcidev ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										video_base_phys  =  pci_resource_start ( minfo - > pcidev ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . fbResource  =  PCI_BASE_ADDRESS_0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										ctrlptr_phys  =  pci_resource_start ( minfo - > pcidev ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										video_base_phys  =  pci_resource_start ( minfo - > pcidev ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . fbResource  =  PCI_BASE_ADDRESS_1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									err  =  - EINVAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! ctrlptr_phys )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										printk ( KERN_ERR  " matroxfb: control registers are not available, matroxfb disabled \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										goto  fail ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! video_base_phys )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										printk ( KERN_ERR  " matroxfb: video RAM is not available in PCI address space, matroxfb disabled \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										goto  fail ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									memsize  =  b - > base - > maxvram ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! request_mem_region ( ctrlptr_phys ,  16384 ,  " matroxfb MMIO " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										goto  fail ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! request_mem_region ( video_base_phys ,  memsize ,  " matroxfb FB " ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										goto  failCtrlMR ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > video . len_maximum  =  memsize ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* convert mem (autodetect k, M) */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( mem  <  1024 )  mem  * =  1024 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( mem  <  0x00100000 )  mem  * =  1024 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( mem  & &  ( mem  <  memsize ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										memsize  =  mem ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									err  =  - ENOMEM ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( mga_ioremap ( ctrlptr_phys ,  16384 ,  MGA_IOREMAP_MMIO ,  & minfo - > mmio . vbase ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										printk ( KERN_ERR  " matroxfb: cannot ioremap(%lX, 16384), matroxfb disabled \n " ,  ctrlptr_phys ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										goto  failVideoMR ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > mmio . base  =  ctrlptr_phys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > mmio . len  =  16384 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > video . base  =  video_base_phys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( mga_ioremap ( video_base_phys ,  memsize ,  MGA_IOREMAP_FB ,  & minfo - > video . vbase ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										printk ( KERN_ERR  " matroxfb: cannot ioremap(%lX, %d), matroxfb disabled \n " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											video_base_phys ,  memsize ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										goto  failCtrlIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										u_int32_t  cmd ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										u_int32_t  mga_option ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										pci_read_config_dword ( minfo - > pcidev ,  PCI_OPTION_REG ,  & mga_option ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										pci_read_config_dword ( minfo - > pcidev ,  PCI_COMMAND ,  & cmd ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										mga_option  & =  0x7FFFFFFF ;  /* clear BIG_ENDIAN */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										mga_option  | =  MX_OPTION_BSWAP ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* disable palette snooping */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										cmd  & =  ~ PCI_COMMAND_VGA_PALETTE ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										if  ( pci_dev_present ( intel_82437 ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											if  ( ! ( mga_option  &  0x20000000 )  & &  ! minfo - > devflags . nopciretry )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												printk ( KERN_WARNING  " matroxfb: Disabling PCI retries due to i82437 present \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											mga_option  | =  0x20000000 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											minfo - > devflags . nopciretry  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										pci_write_config_dword ( minfo - > pcidev ,  PCI_COMMAND ,  cmd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										pci_write_config_dword ( minfo - > pcidev ,  PCI_OPTION_REG ,  mga_option ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > hw . MXoptionReg  =  mga_option ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* select non-DMA memory for PCI_MGA_DATA, otherwise dump of PCI cfg space can lock PCI bus */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* maybe preinit() candidate, but it is same... for all devices... at this time... */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										pci_write_config_dword ( minfo - > pcidev ,  PCI_MGA_INDEX ,  0x00003C00 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									err  =  - ENXIO ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matroxfb_read_pins ( minfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( minfo - > hw_switch - > preinit ( minfo ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										goto  failVideoIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									err  =  - ENOMEM ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! matroxfb_getmemory ( minfo ,  memsize ,  & minfo - > video . len )  | |  ! minfo - > video . len )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										printk ( KERN_ERR  " matroxfb: cannot determine memory size \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										goto  failVideoIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > devflags . ydstorg  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > video . base  =  video_base_phys ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > video . len_usable  =  minfo - > video . len ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( minfo - > video . len_usable  >  b - > base - > maxdisplayable ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > video . len_usable  =  b - > base - > maxdisplayable ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_MTRR 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( mtrr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > mtrr . vram  =  mtrr_add ( video_base_phys ,  minfo - > video . len ,  MTRR_TYPE_WRCOMB ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > mtrr . vram_valid  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										printk ( KERN_INFO  " matroxfb: MTRR's turned on \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif	 /* CONFIG_MTRR */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! minfo - > devflags . novga ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										request_region ( 0x3C0 ,  32 ,  " matrox " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matroxfb_g450_connect ( minfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > hw_switch - > reset ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > fbcon . monspecs . hfmin  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . monspecs . hfmax  =  fh ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . monspecs . vfmin  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . monspecs . vfmax  =  fv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . monspecs . dpms  =  0 ; 	/* TBD */ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* static settings */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vesafb_defined . red  =  colors [ depth - 1 ] . red ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vesafb_defined . green  =  colors [ depth - 1 ] . green ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vesafb_defined . blue  =  colors [ depth - 1 ] . blue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vesafb_defined . bits_per_pixel  =  colors [ depth - 1 ] . bits_per_pixel ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vesafb_defined . grayscale  =  grayscale ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vesafb_defined . vmode  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( noaccel ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . accel_flags  & =  ~ FB_ACCELF_TEXT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > fbops  =  matroxfb_ops ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . fbops  =  & minfo - > fbops ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . pseudo_palette  =  minfo - > cmap ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* after __init time we are like module... no logo */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > fbcon . flags  =  hotplug  ?  FBINFO_FLAG_MODULE  :  FBINFO_FLAG_DEFAULT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > fbcon . flags  | =  FBINFO_PARTIAL_PAN_OK  |  	 /* Prefer panning for scroll under MC viewer/edit */ 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
												      FBINFO_HWACCEL_COPYAREA  |   /* We have hw-assisted bmove */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												      FBINFO_HWACCEL_FILLRECT  |   /* And fillrect */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												      FBINFO_HWACCEL_IMAGEBLIT  |  /* And imageblit */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												      FBINFO_HWACCEL_XPAN  |       /* And we support both horizontal */ 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-23 14:38:11 -05:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												      FBINFO_HWACCEL_YPAN  |       /* And vertical panning */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												      FBINFO_READS_FAST ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > video . len_usable  & =  PAGE_MASK ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									fb_alloc_cmap ( & minfo - > fbcon . cmap ,  256 ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifndef MODULE 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* mode database is marked __init!!! */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! hotplug )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										fb_find_mode ( & vesafb_defined ,  & minfo - > fbcon ,  videomode [ 0 ]  ?  videomode  :  NULL , 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											NULL ,  0 ,  & defaultmode ,  vesafb_defined . bits_per_pixel ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif  /* !MODULE */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* mode modifiers */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( hslen ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . hsync_len  =  hslen ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( vslen ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . vsync_len  =  vslen ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( left  ! =  ~ 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . left_margin  =  left ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( right  ! =  ~ 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . right_margin  =  right ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( upper  ! =  ~ 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . upper_margin  =  upper ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( lower  ! =  ~ 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . lower_margin  =  lower ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( xres ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . xres  =  xres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( yres ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . yres  =  yres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( sync  ! =  - 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . sync  =  sync ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( vesafb_defined . sync  = =  ~ 0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . sync  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( yres  <  400 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											vesafb_defined . sync  | =  FB_SYNC_HOR_HIGH_ACT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( yres  <  480 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											vesafb_defined . sync  | =  FB_SYNC_VERT_HIGH_ACT ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* fv, fh, maxclk limits was specified */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										unsigned  int  tmp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( fv )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											tmp  =  fv  *  ( vesafb_defined . upper_margin  +  vesafb_defined . yres 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												  +  vesafb_defined . lower_margin  +  vesafb_defined . vsync_len ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											if  ( ( tmp  <  fh )  | |  ( fh  = =  0 ) )  fh  =  tmp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( fh )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											tmp  =  fh  *  ( vesafb_defined . left_margin  +  vesafb_defined . xres 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
												  +  vesafb_defined . right_margin  +  vesafb_defined . hsync_len ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
											if  ( ( tmp  <  maxclk )  | |  ( maxclk  = =  0 ) )  maxclk  =  tmp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										tmp  =  ( maxclk  +  499 )  /  500 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( tmp )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											tmp  =  ( 2000000000  +  tmp )  /  tmp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( tmp  >  pixclock )  pixclock  =  tmp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( pixclock )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( pixclock  <  2000 ) 		/* > 500MHz */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											pixclock  =  4000 ; 	/* 250MHz */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( pixclock  >  1000000 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											pixclock  =  1000000 ; 	/* 1MHz */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . pixclock  =  pixclock ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* FIXME: Where to move this?! */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# if defined(CONFIG_PPC_PMAC) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifndef MODULE 
 
							 
						 
					
						
							
								
									
										
										
										
											2006-03-28 23:15:54 +11:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( machine_is ( powermac ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										struct  fb_var_screeninfo  var ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( default_vmode  < =  0  | |  default_vmode  >  VMODE_MAX ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											default_vmode  =  VMODE_640_480_60 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_NVRAM 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( default_cmode  = =  CMODE_NVRAM ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											default_cmode  =  nvram_read_byte ( NV_CMODE ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( default_cmode  <  CMODE_8  | |  default_cmode  >  CMODE_32 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											default_cmode  =  CMODE_8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! mac_vmode_to_var ( default_vmode ,  default_cmode ,  & var ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											var . accel_flags  =  vesafb_defined . accel_flags ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											var . xoffset  =  var . yoffset  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											/* Note: mac_vmode_to_var() does not set all parameters */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											vesafb_defined  =  var ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif  /* !MODULE */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif  /* CONFIG_PPC_PMAC */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									vesafb_defined . xres_virtual  =  vesafb_defined . xres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( nopan )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . yres_virtual  =  vesafb_defined . yres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . yres_virtual  =  65536 ;  /* large enough to be INF, but small enough
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
															to  yres_virtual  *  xres_virtual  <  2 ^ 32  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matroxfb_init_fix ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > fbcon . screen_base  =  vaddr_va ( minfo - > video . vbase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* Normalize values (namely yres_virtual) */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matroxfb_check_var ( & vesafb_defined ,  & minfo - > fbcon ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* And put it into "current" var. Do NOT program hardware yet, or we'll not take over
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  vgacon  correctly .  fbcon_startup  will  call  fb_set_par  for  us ,  WITHOUT  check_var , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  and  unfortunately  it  will  do  it  BEFORE  vgacon  contents  is  saved ,  so  it  won ' t  work 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  anyway .  But  we  at  least  tried . . .  */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > fbcon . var  =  vesafb_defined ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									err  =  - EINVAL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									printk ( KERN_INFO  " matroxfb: %dx%dx%dbpp (virtual: %dx%d) \n " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . xres ,  vesafb_defined . yres ,  vesafb_defined . bits_per_pixel , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . xres_virtual ,  vesafb_defined . yres_virtual ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									printk ( KERN_INFO  " matroxfb: framebuffer at 0x%lX, mapped to 0x%p, size %d \n " , 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > video . base ,  vaddr_va ( minfo - > video . vbase ) ,  minfo - > video . len ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* We do not have to set currcon to 0... register_framebuffer do it for us on first console
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  and  we  do  not  want  currcon  = =  0  for  subsequent  framebuffers  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > fbcon . device  =  & minfo - > pcidev - > dev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( register_framebuffer ( & minfo - > fbcon )  <  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										goto  failVideoIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-19 18:35:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									fb_info ( & minfo - > fbcon ,  " %s frame buffer device \n " ,  minfo - > fbcon . fix . id ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* there is no console on this fb... but we have to initialize hardware
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  until  someone  tells  me  what  is  proper  thing  to  do  */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! minfo - > initialized )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-19 18:35:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										fb_info ( & minfo - > fbcon ,  " initializing hardware \n " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										/* We have to use FB_ACTIVATE_FORCE, as we had to put vesafb_defined to the fbcon.var
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										 *  already  before ,  so  register_framebuffer  works  correctly .  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesafb_defined . activate  | =  FB_ACTIVATE_FORCE ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										fb_set_var ( & minfo - > fbcon ,  & vesafb_defined ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								failVideoIO : ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matroxfb_g450_shutdown ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mga_iounmap ( minfo - > video . vbase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								failCtrlIO : ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mga_iounmap ( minfo - > mmio . vbase ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								failVideoMR : ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									release_mem_region ( video_base_phys ,  minfo - > video . len_maximum ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								failCtrlMR : ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									release_mem_region ( ctrlptr_phys ,  16384 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								fail : ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  LIST_HEAD ( matroxfb_list ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  LIST_HEAD ( matroxfb_driver_list ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define matroxfb_l(x) list_entry(x, struct matrox_fb_info, next_fb) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define matroxfb_driver_l(x) list_entry(x, struct matroxfb_driver, node) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								int  matroxfb_register_driver ( struct  matroxfb_driver *  drv )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info *  minfo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									list_add ( & drv - > node ,  & matroxfb_driver_list ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( minfo  =  matroxfb_l ( matroxfb_list . next ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									     minfo  ! =  matroxfb_l ( & matroxfb_list ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									     minfo  =  matroxfb_l ( minfo - > next_fb . next ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										void *  p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( minfo - > drivers_count  = =  MATROXFB_MAX_FB_DRIVERS ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										p  =  drv - > probe ( minfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( p )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											minfo - > drivers_data [ minfo - > drivers_count ]  =  p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											minfo - > drivers [ minfo - > drivers_count + + ]  =  drv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  matroxfb_unregister_driver ( struct  matroxfb_driver *  drv )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info *  minfo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									list_del ( & drv - > node ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( minfo  =  matroxfb_l ( matroxfb_list . next ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									     minfo  ! =  matroxfb_l ( & matroxfb_list ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									     minfo  =  matroxfb_l ( minfo - > next_fb . next ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										for  ( i  =  0 ;  i  <  minfo - > drivers_count ;  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( minfo - > drivers [ i ]  = =  drv )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( drv  & &  drv - > remove ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													drv - > remove ( minfo ,  minfo - > drivers_data [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												minfo - > drivers [ i ]  =  minfo - > drivers [ - - minfo - > drivers_count ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												minfo - > drivers_data [ i ]  =  minfo - > drivers_data [ minfo - > drivers_count ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											}  else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												i + + ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  matroxfb_register_device ( struct  matrox_fb_info *  minfo )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  matroxfb_driver *  drv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  i  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									list_add ( & minfo - > next_fb ,  & matroxfb_list ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									for  ( drv  =  matroxfb_driver_l ( matroxfb_driver_list . next ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									     drv  ! =  matroxfb_driver_l ( & matroxfb_driver_list ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									     drv  =  matroxfb_driver_l ( drv - > node . next ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( drv  & &  drv - > probe )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											void  * p  =  drv - > probe ( minfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( p )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												minfo - > drivers_data [ i ]  =  p ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												minfo - > drivers [ i + + ]  =  drv ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												if  ( i  = =  MATROXFB_MAX_FB_DRIVERS ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > drivers_count  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  matroxfb_unregister_device ( struct  matrox_fb_info *  minfo )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									list_del ( & minfo - > next_fb ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									for  ( i  =  0 ;  i  <  minfo - > drivers_count ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										struct  matroxfb_driver *  drv  =  minfo - > drivers [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( drv  & &  drv - > remove ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											drv - > remove ( minfo ,  minfo - > drivers_data [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  matroxfb_probe ( struct  pci_dev *  pdev ,  const  struct  pci_device_id *  dummy )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  board *  b ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									u_int16_t  svid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									u_int16_t  sid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info *  minfo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									u_int32_t  cmd ; 
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									svid  =  pdev - > subsystem_vendor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									sid  =  pdev - > subsystem_device ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( b  =  dev_list ;  b - > vendor ;  b + + )  { 
							 
						 
					
						
							
								
									
										
										
										
											2007-06-08 15:46:36 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ( b - > vendor  ! =  pdev - > vendor )  | |  ( b - > device  ! =  pdev - > device )  | |  ( b - > rev  <  pdev - > revision ) )  continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										if  ( b - > svid ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ( b - > svid  ! =  svid )  | |  ( b - > sid  ! =  sid ) )  continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* not match... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! b - > vendor ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-09-13 01:25:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  - ENODEV ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( dev  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										/* not requested one... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										dev - - ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-09-13 01:25:45 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  - ENODEV ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									pci_read_config_dword ( pdev ,  PCI_COMMAND ,  & cmd ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( pci_enable_device ( pdev ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-07-12 17:00:18 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo  =  kzalloc ( sizeof ( * minfo ) ,  GFP_KERNEL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! minfo ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > pcidev  =  pdev ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > dead  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > usecount  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > userusecount  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									pci_set_drvdata ( pdev ,  minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									/* DEVFLAGS */ 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									minfo - > devflags . memtype  =  memtype ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( memtype  ! =  - 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										noinit  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( cmd  &  PCI_COMMAND_MEMORY )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > devflags . novga  =  novga ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . nobios  =  nobios ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . noinit  =  noinit ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										/* subsequent heads always needs initialization and must not enable BIOS */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										novga  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										nobios  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										noinit  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										minfo - > devflags . novga  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . nobios  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										minfo - > devflags . noinit  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . nopciretry  =  no_pci_retry ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . mga_24bpp_fix  =  inv24 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . precise_width  =  option_precise_width ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > devflags . sgram  =  sgram ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > capable . cross4MB  =  cross4MB ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									spin_lock_init ( & minfo - > lock . DAC ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									spin_lock_init ( & minfo - > lock . accel ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									init_rwsem ( & minfo - > crtc2 . lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									init_rwsem ( & minfo - > altout . lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mutex_init ( & minfo - > fbcon . mm_lock ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > irq_flags  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									init_waitqueue_head ( & minfo - > crtc1 . vsync . wait ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									init_waitqueue_head ( & minfo - > crtc2 . vsync . wait ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo - > crtc1 . panpos  =  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									err  =  initMatrox2 ( minfo ,  b ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! err )  { 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:48 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										matroxfb_register_device ( minfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									kfree ( minfo ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  pci_remove_matrox ( struct  pci_dev *  pdev )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									struct  matrox_fb_info *  minfo ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									minfo  =  pci_get_drvdata ( pdev ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2009-09-22 16:47:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									matroxfb_remove ( minfo ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  pci_device_id  matroxfb_devices [ ]  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_FB_MATROX_MILLENIUM 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MIL , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_ANY_ID , 	PCI_ANY_ID , 	0 ,  0 ,  0 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MIL_2 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_ANY_ID , 	PCI_ANY_ID , 	0 ,  0 ,  0 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MIL_2_AGP , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_ANY_ID , 	PCI_ANY_ID , 	0 ,  0 ,  0 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_FB_MATROX_MYSTIQUE 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_MYS , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_ANY_ID , 	PCI_ANY_ID , 	0 ,  0 ,  0 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_FB_MATROX_G 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G100_MM , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_ANY_ID , 	PCI_ANY_ID , 	0 ,  0 ,  0 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G100_AGP , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_ANY_ID , 	PCI_ANY_ID , 	0 ,  0 ,  0 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G200_PCI , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_ANY_ID , 	PCI_ANY_ID , 	0 ,  0 ,  0 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G200_AGP , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_ANY_ID , 	PCI_ANY_ID , 	0 ,  0 ,  0 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G400 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_ANY_ID , 	PCI_ANY_ID , 	0 ,  0 ,  0 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ PCI_VENDOR_ID_MATROX , 	PCI_DEVICE_ID_MATROX_G550 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										PCI_ANY_ID , 	PCI_ANY_ID , 	0 ,  0 ,  0 } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 0 , 			0 , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										0 , 		0 , 		0 ,  0 ,  0 } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_DEVICE_TABLE ( pci ,  matroxfb_devices ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  pci_driver  matroxfb_driver  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. name  = 		" matroxfb " , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. id_table  = 	matroxfb_devices , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. probe  = 	matroxfb_probe , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									. remove  = 	pci_remove_matrox , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* **************************** init-time only **************************** */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RSResolution(X)	((X) & 0x0F) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS640x400	1 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS640x480	2 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS800x600	3 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS1024x768	4 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS1280x1024	5 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS1600x1200	6 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS768x576	7 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS960x720	8 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS1152x864	9 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS1408x1056	10 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS640x350	11 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS1056x344	12	 /* 132 x 43 text */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS1056x400	13	 /* 132 x 50 text */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RS1056x480	14	 /* 132 x 60 text */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RSNoxNo		15 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* 10-FF */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  {  int  xres ,  yres ,  left ,  right ,  upper ,  lower ,  hslen ,  vslen ,  vfreq ;  }  timmings [ ]  __initdata  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{   640 ,   400 ,   48 ,  16 ,  39 ,   8 ,   96 ,  2 ,  70  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{   640 ,   480 ,   48 ,  16 ,  33 ,  10 ,   96 ,  2 ,  60  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{   800 ,   600 ,  144 ,  24 ,  28 ,   8 ,  112 ,  6 ,  60  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  1024 ,   768 ,  160 ,  32 ,  30 ,   4 ,  128 ,  4 ,  60  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  1280 ,  1024 ,  224 ,  32 ,  32 ,   4 ,  136 ,  4 ,  60  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  1600 ,  1200 ,  272 ,  48 ,  32 ,   5 ,  152 ,  5 ,  60  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{   768 ,   576 ,  144 ,  16 ,  28 ,   6 ,  112 ,  4 ,  60  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{   960 ,   720 ,  144 ,  24 ,  28 ,   8 ,  112 ,  4 ,  60  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  1152 ,   864 ,  192 ,  32 ,  30 ,   4 ,  128 ,  4 ,  60  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  1408 ,  1056 ,  256 ,  40 ,  32 ,   5 ,  144 ,  5 ,  60  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{   640 ,   350 ,   48 ,  16 ,  39 ,   8 ,   96 ,  2 ,  70  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  1056 ,   344 ,   96 ,  24 ,  59 ,  44 ,  160 ,  2 ,  70  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  1056 ,   400 ,   96 ,  24 ,  39 ,   8 ,  160 ,  2 ,  70  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  1056 ,   480 ,   96 ,  24 ,  36 ,  12 ,  160 ,  3 ,  60  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{     0 ,     0 ,   ~ 0 ,  ~ 0 ,  ~ 0 ,  ~ 0 ,    0 ,  0 ,   0  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# define RSCreate(X,Y)	((X) | ((Y) << 8)) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  struct  {  unsigned  int  vesa ;  unsigned  int  info ;  }  * RSptr ,  vesamap [ ]  __initdata  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* default must be first */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{     ~ 0 ,  RSCreate ( RSNoxNo ,      RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x101 ,  RSCreate ( RS640x480 ,    RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x100 ,  RSCreate ( RS640x400 ,    RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x180 ,  RSCreate ( RS768x576 ,    RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x103 ,  RSCreate ( RS800x600 ,    RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x188 ,  RSCreate ( RS960x720 ,    RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x105 ,  RSCreate ( RS1024x768 ,   RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x190 ,  RSCreate ( RS1152x864 ,   RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x107 ,  RSCreate ( RS1280x1024 ,  RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x198 ,  RSCreate ( RS1408x1056 ,  RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x11C ,  RSCreate ( RS1600x1200 ,  RS8bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x110 ,  RSCreate ( RS640x480 ,    RS15bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x181 ,  RSCreate ( RS768x576 ,    RS15bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x113 ,  RSCreate ( RS800x600 ,    RS15bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x189 ,  RSCreate ( RS960x720 ,    RS15bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x116 ,  RSCreate ( RS1024x768 ,   RS15bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x191 ,  RSCreate ( RS1152x864 ,   RS15bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x119 ,  RSCreate ( RS1280x1024 ,  RS15bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x199 ,  RSCreate ( RS1408x1056 ,  RS15bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x11D ,  RSCreate ( RS1600x1200 ,  RS15bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x111 ,  RSCreate ( RS640x480 ,    RS16bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x182 ,  RSCreate ( RS768x576 ,    RS16bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x114 ,  RSCreate ( RS800x600 ,    RS16bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x18A ,  RSCreate ( RS960x720 ,    RS16bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x117 ,  RSCreate ( RS1024x768 ,   RS16bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x192 ,  RSCreate ( RS1152x864 ,   RS16bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x11A ,  RSCreate ( RS1280x1024 ,  RS16bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x19A ,  RSCreate ( RS1408x1056 ,  RS16bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x11E ,  RSCreate ( RS1600x1200 ,  RS16bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x1B2 ,  RSCreate ( RS640x480 ,    RS24bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x184 ,  RSCreate ( RS768x576 ,    RS24bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x1B5 ,  RSCreate ( RS800x600 ,    RS24bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x18C ,  RSCreate ( RS960x720 ,    RS24bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x1B8 ,  RSCreate ( RS1024x768 ,   RS24bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x194 ,  RSCreate ( RS1152x864 ,   RS24bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x1BB ,  RSCreate ( RS1280x1024 ,  RS24bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x19C ,  RSCreate ( RS1408x1056 ,  RS24bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x1BF ,  RSCreate ( RS1600x1200 ,  RS24bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x112 ,  RSCreate ( RS640x480 ,    RS32bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x183 ,  RSCreate ( RS768x576 ,    RS32bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x115 ,  RSCreate ( RS800x600 ,    RS32bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x18B ,  RSCreate ( RS960x720 ,    RS32bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x118 ,  RSCreate ( RS1024x768 ,   RS32bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x193 ,  RSCreate ( RS1152x864 ,   RS32bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x11B ,  RSCreate ( RS1280x1024 ,  RS32bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x19B ,  RSCreate ( RS1408x1056 ,  RS32bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x11F ,  RSCreate ( RS1600x1200 ,  RS32bpp )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x010 ,  RSCreate ( RS640x350 ,    RS4bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x012 ,  RSCreate ( RS640x480 ,    RS4bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x102 ,  RSCreate ( RS800x600 ,    RS4bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x104 ,  RSCreate ( RS1024x768 ,   RS4bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{  0x106 ,  RSCreate ( RS1280x1024 ,  RS4bpp  )  } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{      0 ,  0 				} } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  __init  matroxfb_init_params ( void )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* fh from kHz to Hz */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( fh  <  1000 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										fh  * =  1000 ; 	/* 1kHz minimum */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* maxclk */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( maxclk  <  1000 )  maxclk  * =  1000 ; 	/* kHz -> Hz, MHz -> kHz */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( maxclk  <  1000000 )  maxclk  * =  1000 ; 	/* kHz -> Hz, 1MHz minimum */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* fix VESA number */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( vesa  ! =  ~ 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vesa  & =  0x1DFF ; 		/* mask out clearscreen, acceleration and so on */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* static settings */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( RSptr  =  vesamap ;  RSptr - > vesa ;  RSptr + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( RSptr - > vesa  = =  vesa )  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! RSptr - > vesa )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										printk ( KERN_ERR  " Invalid vesa mode 0x%04X \n " ,  vesa ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										RSptr  =  vesamap ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  res  =  RSResolution ( RSptr - > info ) - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( left  = =  ~ 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											left  =  timmings [ res ] . left ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! xres ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											xres  =  timmings [ res ] . xres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( right  = =  ~ 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											right  =  timmings [ res ] . right ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! hslen ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											hslen  =  timmings [ res ] . hslen ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( upper  = =  ~ 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											upper  =  timmings [ res ] . upper ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! yres ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											yres  =  timmings [ res ] . yres ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( lower  = =  ~ 0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											lower  =  timmings [ res ] . lower ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! vslen ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											vslen  =  timmings [ res ] . vslen ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! ( fv | | fh | | maxclk | | pixclock ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fv  =  timmings [ res ] . vfreq ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( depth  = =  - 1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											depth  =  RSDepth ( RSptr - > info ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2006-10-03 01:14:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  int  __init  matrox_init ( void )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									int  err ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									matroxfb_init_params ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-10-03 01:14:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									err  =  pci_register_driver ( & matroxfb_driver ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									dev  =  - 1 ; 	/* accept all new devices... */ 
							 
						 
					
						
							
								
									
										
										
										
											2006-10-03 01:14:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  err ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* **************************** exit-time only **************************** */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  void  __exit  matrox_done ( void )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									pci_unregister_driver ( & matroxfb_driver ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifndef MODULE 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* ************************* init in-kernel code ************************** */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  __init  matroxfb_setup ( char  * options )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									char  * this_opt ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! options  | |  ! * options ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									while  ( ( this_opt  =  strsep ( & options ,  " , " ) )  ! =  NULL )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! * this_opt )  continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										dprintk ( " matroxfb_setup: option %s \n " ,  this_opt ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! strncmp ( this_opt ,  " dev: " ,  4 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											dev  =  simple_strtoul ( this_opt + 4 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " depth: " ,  6 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											switch  ( simple_strtoul ( this_opt + 6 ,  NULL ,  0 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  0 :  depth  =  RSText ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  4 :  depth  =  RS4bpp ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  8 :  depth  =  RS8bpp ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  15 : depth  =  RS15bpp ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  16 : depth  =  RS16bpp ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  24 : depth  =  RS24bpp ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  32 : depth  =  RS32bpp ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												default : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													printk ( KERN_ERR  " matroxfb: unsupported color depth \n " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( ! strncmp ( this_opt ,  " xres: " ,  5 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											xres  =  simple_strtoul ( this_opt + 5 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " yres: " ,  5 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											yres  =  simple_strtoul ( this_opt + 5 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " vslen: " ,  6 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											vslen  =  simple_strtoul ( this_opt + 6 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " hslen: " ,  6 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											hslen  =  simple_strtoul ( this_opt + 6 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " left: " ,  5 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											left  =  simple_strtoul ( this_opt + 5 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " right: " ,  6 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											right  =  simple_strtoul ( this_opt + 6 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " upper: " ,  6 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											upper  =  simple_strtoul ( this_opt + 6 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " lower: " ,  6 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											lower  =  simple_strtoul ( this_opt + 6 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " pixclock: " ,  9 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											pixclock  =  simple_strtoul ( this_opt + 9 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " sync: " ,  5 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											sync  =  simple_strtoul ( this_opt + 5 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " vesa: " ,  5 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											vesa  =  simple_strtoul ( this_opt + 5 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " maxclk: " ,  7 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											maxclk  =  simple_strtoul ( this_opt + 7 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " fh: " ,  3 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fh  =  simple_strtoul ( this_opt + 3 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " fv: " ,  3 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											fv  =  simple_strtoul ( this_opt + 3 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " mem: " ,  4 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											mem  =  simple_strtoul ( this_opt + 4 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " mode: " ,  5 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											strlcpy ( videomode ,  this_opt + 5 ,  sizeof ( videomode ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " outputs: " ,  8 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											strlcpy ( outputs ,  this_opt + 8 ,  sizeof ( outputs ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " dfp: " ,  4 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											dfp_type  =  simple_strtoul ( this_opt + 4 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											dfp  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-06-21 01:57:39 -03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_PPC_PMAC 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " vmode: " ,  6 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											unsigned  int  vmode  =  simple_strtoul ( this_opt + 6 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( vmode  >  0  & &  vmode  < =  VMODE_MAX ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												default_vmode  =  vmode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										}  else  if  ( ! strncmp ( this_opt ,  " cmode: " ,  6 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											unsigned  int  cmode  =  simple_strtoul ( this_opt + 6 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											switch  ( cmode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  0 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  8 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													default_cmode  =  CMODE_8 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  15 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  16 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													default_cmode  =  CMODE_16 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  24 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												case  32 : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													default_cmode  =  CMODE_32 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
													break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strcmp ( this_opt ,  " disabled " ) ) 	/* nodisabled does not exist */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											disabled  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strcmp ( this_opt ,  " enabled " ) ) 	/* noenabled does not exist */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											disabled  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strcmp ( this_opt ,  " sgram " ) ) 	/* nosgram == sdram */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											sgram  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strcmp ( this_opt ,  " sdram " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											sgram  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  if  ( ! strncmp ( this_opt ,  " memtype: " ,  8 ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											memtype  =  simple_strtoul ( this_opt + 8 ,  NULL ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											int  value  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! strncmp ( this_opt ,  " no " ,  2 ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												value  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												this_opt  + =  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( !  strcmp ( this_opt ,  " inverse " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												inverse  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " accel " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												noaccel  =  ! value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " pan " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												nopan  =  ! value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " pciretry " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												no_pci_retry  =  ! value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " vga " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												novga  =  ! value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " bios " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												nobios  =  ! value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " init " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												noinit  =  ! value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_MTRR 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " mtrr " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												mtrr  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " inv24 " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												inv24  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " cross4MB " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												cross4MB  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " grayscale " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												grayscale  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  if  ( ! strcmp ( this_opt ,  " dfp " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												dfp  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												strlcpy ( videomode ,  this_opt ,  sizeof ( videomode ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  __initdata  initialized  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  int  __init  matroxfb_init ( void ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									char  * option  =  NULL ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-10-03 01:14:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									int  err  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( fb_get_options ( " matroxfb " ,  & option ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  - ENODEV ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									matroxfb_setup ( option ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( disabled ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  - ENXIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! initialized )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										initialized  =  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2006-10-03 01:14:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										err  =  matrox_init ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									hotplug  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* never return failure, user can hotplug matrox later... */ 
							 
						 
					
						
							
								
									
										
										
										
											2006-10-03 01:14:52 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									return  err ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_init ( matroxfb_init ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# else 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/* *************************** init module code **************************** */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_AUTHOR ( " (c) 1998-2002 Petr Vandrovec <vandrove@vc.cvut.cz> " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_DESCRIPTION ( " Accelerated FBDev driver for Matrox Millennium/Mystique/G100/G200/G400/G450/G550 " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_LICENSE ( " GPL " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( mem ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( mem ,  " Size of available memory in MB, KB or B (2,4,8,12,16MB, default=autodetect) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( disabled ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( disabled ,  " Disabled (0 or 1=disabled) (default=0) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( noaccel ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( noaccel ,  " Do not use accelerating engine (0 or 1=disabled) (default=0) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( nopan ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( nopan ,  " Disable pan on startup (0 or 1=disabled) (default=0) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( no_pci_retry ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( no_pci_retry ,  " PCI retries enabled (0 or 1=disabled) (default=0) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( novga ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( novga ,  " VGA I/O (0x3C0-0x3DF) disabled (0 or 1=disabled) (default=0) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( nobios ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( nobios ,  " Disables ROM BIOS (0 or 1=disabled) (default=do not change BIOS state) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( noinit ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( noinit ,  " Disables W/SG/SD-RAM and bus interface initialization (0 or 1=do not initialize) (default=0) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( memtype ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( memtype ,  " Memory type for G200/G400 (see Documentation/fb/matroxfb.txt for explanation) (default=3 for G200, 0 for G400) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_MTRR 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( mtrr ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( mtrr ,  " This speeds up video memory accesses (0=disabled or 1) (default=1) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( sgram ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( sgram ,  " Indicates that G100/G200/G400 has SGRAM memory (0=SDRAM, 1=SGRAM) (default=0) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( inv24 ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( inv24 ,  " Inverts clock polarity for 24bpp and loop frequency > 100MHz (default=do not invert polarity) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( inverse ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( inverse ,  " Inverse (0 or 1) (default=0) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( dev ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( dev ,  " Multihead support, attach to device ID (0..N) (default=all working) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( vesa ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( vesa ,  " Startup videomode (0x000-0x1FF) (default=0x101) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( xres ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( xres ,  " Horizontal resolution (px), overrides xres from vesa (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( yres ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( yres ,  " Vertical resolution (scans), overrides yres from vesa (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( upper ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( upper ,  " Upper blank space (scans), overrides upper from vesa (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( lower ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( lower ,  " Lower blank space (scans), overrides lower from vesa (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( vslen ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( vslen ,  " Vertical sync length (scans), overrides lower from vesa (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( left ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( left ,  " Left blank space (px), overrides left from vesa (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( right ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( right ,  " Right blank space (px), overrides right from vesa (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( hslen ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( hslen ,  " Horizontal sync length (px), overrides hslen from vesa (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( pixclock ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( pixclock ,  " Pixelclock (ns), overrides pixclock from vesa (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( sync ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( sync ,  " Sync polarity, overrides sync from vesa (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( depth ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( depth ,  " Color depth (0=text,8,15,16,24,32) (default=vesa) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( maxclk ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( maxclk ,  " Startup maximal clock, 0-999MHz, 1000-999999kHz, 1000000-INF Hz " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( fh ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( fh ,  " Startup horizontal frequency, 0-999kHz, 1000-INF Hz " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( fv ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( fv ,  " Startup vertical frequency, 0-INF Hz \n " 
							 
						 
					
						
							
								
									
										
										
										
											2008-07-31 00:07:23 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								" You should specify  \" fv:max_monitor_vsync,fh:max_monitor_hsync,maxclk:max_monitor_dotclock \" " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								module_param ( grayscale ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( grayscale ,  " Sets display into grayscale. Works perfectly with paletized videomode (4, 8bpp), some limitations apply to 16, 24 and 32bpp videomodes (default=nograyscale) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( cross4MB ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( cross4MB ,  " Specifies that 4MB boundary can be in middle of line. (default=autodetected) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( dfp ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( dfp ,  " Specifies whether to use digital flat panel interface of G200/G400 (0 or 1) (default=0) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param ( dfp_type ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( dfp_type ,  " Specifies DFP interface type (0 to 255) (default=read from hardware) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param_string ( outputs ,  outputs ,  sizeof ( outputs ) ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( outputs ,  " Specifies which CRTC is mapped to which output (string of up to three letters, consisting of 0 (disabled), 1 (CRTC1), 2 (CRTC2)) (default=111 for Gx50, 101 for G200/G400 with DFP, and 100 for all other devices) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# ifdef CONFIG_PPC_PMAC 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param_named ( vmode ,  default_vmode ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( vmode ,  " Specify the vmode mode number that should be used (640x480 default) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_param_named ( cmode ,  default_cmode ,  int ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								MODULE_PARM_DESC ( cmode ,  " Specify the video depth that should be used (8bit default) " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								int  __init  init_module ( void ) { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2008-04-28 02:15:47 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									DBG ( __func__ ) 
							 
						 
					
						
							
								
									
										
										
										
											2005-04-16 15:20:36 -07:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( disabled ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return  - ENXIO ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( depth  = =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										depth  =  RSText ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( depth  = =  4 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										depth  =  RS4bpp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( depth  = =  8 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										depth  =  RS8bpp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( depth  = =  15 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										depth  =  RS15bpp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( depth  = =  16 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										depth  =  RS16bpp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( depth  = =  24 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										depth  =  RS24bpp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( depth  = =  32 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										depth  =  RS32bpp ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									else  if  ( depth  ! =  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										printk ( KERN_ERR  " matroxfb: depth %d is not supported, using default \n " ,  depth ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										depth  =  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									matrox_init ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* never return failure; user can hotplug matrox later... */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif	 /* MODULE */ 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								module_exit ( matrox_done ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								EXPORT_SYMBOL ( matroxfb_register_driver ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								EXPORT_SYMBOL ( matroxfb_unregister_driver ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								EXPORT_SYMBOL ( matroxfb_wait_for_sync ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								EXPORT_SYMBOL ( matroxfb_enable_irq ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								/*
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Overrides  for  Emacs  so  that  we  follow  Linus ' s  tabbing  style . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  Local  variables : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  c - basic - offset :  8 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 *  End : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								 */