trying fbdev drive, root ,liux系统#时,怎么办

Setting the default root password: Some Live Linux distributions are created without a root password by default (the root account is inactive). This is particularly true with Debian based distributions like Ubuntu. Setting a root password enables us to access some essential tools such as the synaptic installer. In most cases, having no root password is fine when your running from a Live CD and don't need to do administration tasks, make changes or install additional packages. But for those of us who do want to make administrative changes and save them back to a USB device or local storage device on for example a properly created "casper-rw" partition. Setting the root password might then be necessary.
How to set the default root password:
This process is known to work on most Debian based LIVE distributions like Ubuntu or Pendrivelinux releases previous to Pendrivelinux 2008. Other distributions may vary.
Open up a terminal and type sudo passwd root
Follow the onscreen instructions to set and confirm your new password
Similar Portable Linux Posts:
What is the default root password? published under &
, , , , , , , , , , , ,
Pendrive Linux Posts
USB Linux Help查看: 1124|回复: 7
注册时间最后登录阅读权限10积分15精华0帖子
自定义头衔
新手上路, 积分 15, 距离下一级还需 35 积分
日志主题精华0帖子提交 BUG0 确认 BUG0 编辑维基0
请问这个驱动怎么安装linux-fbdev-kernel-bin_2.6.00.02a.tgz?
各位大大:小弟最近在学习Linux,有一问题请教:我在网上下了一个主板的驱动文件名如下:linux-fbdev-kernel-bin_2.6.00.02a.tgz。从字面上看是一个需要编译的压缩文件。问题如下:1 如何在命令行下面从u盘里把这个文件copy到硬盘上?
2 把这个文件copy到哪个目录下面?
3 编译好了以后直接make install就能安装完成了吗?请解答一下,我最近在网上也搜索了一些资料,但是是总有点出入,希望能得到指点!谢谢!
注册时间最后登录阅读权限90积分4833精华0帖子
自定义头衔
日志主题精华0帖子提交 BUG0 确认 BUG0 编辑维基0
Re: 请问这个驱动怎么安装linux-fbdev-kernel-bin_2.6.00.02a.tgz?
如果是桌面版5.0,U盘直接插上,然后拷入用户主目录下,然后双击桌面上的终端,执行tar zxvf linux-fbdev-kernel-bin_2.6.00.02a.tgz,然后进解压得到的目录里面去看说明文件。
注册时间最后登录阅读权限10积分15精华0帖子
自定义头衔
新手上路, 积分 15, 距离下一级还需 35 积分
日志主题精华0帖子提交 BUG0 确认 BUG0 编辑维基0
Re: 请问这个驱动怎么安装linux-fbdev-kernel-bin_2.6.00.02a.tgz?
再问几个问题:1 我安装红旗5.0的时候没有设置用户,直接用的root,现在想添加一个用户,但是在桌面上和菜单里都找过了,好象没有类似于“用户帐户”的程序。是不是只能在命令行模式下面输入命令来添加用户?2 我在图形界面模式下把Linux-FBDev-kernel-bin-2.6.00.02a.tgz粘贴到/usr/scr/linux-2.6.9-5.34DT/ 中,然后解包生成了这个文件夹,下面有viafb.ko, viafb-install,viafb.modes,我不知道这几个文件应该怎么用?3 我看了readme.txt了,里面说"make sure you have the kernel sources installed in /usr/src/.
copy viafb to any directory"这段话里说的"viafb"是我问题2里面的哪个文件啊?copy到任意目录都可以?4 我登陆终端之后系统提示Localhost#,怎么进入到/usr/scr目录下面啊?我打了cd /usr/scr 为什么系统报错啊?
注册时间最后登录阅读权限10积分15精华0帖子
自定义头衔
新手上路, 积分 15, 距离下一级还需 35 积分
日志主题精华0帖子提交 BUG0 确认 BUG0 编辑维基0
Re: 请问这个驱动怎么安装linux-fbdev-kernel-bin_2.6.00.02a.tgz?
注册时间最后登录阅读权限70积分1650精华0帖子
自定义头衔
金牌会员, 积分 1650, 距离下一级还需 1350 积分
日志主题精华0帖子提交 BUG0 确认 BUG0 编辑维基0
Re: 请问这个驱动怎么安装linux-fbdev-kernel-bin_2.6.00.02a.tgz?
‘用户设置’在在‘控制面板’里有!第四个问题是cd后面要加空格键,不要用dos的习惯来输。linux的命令后面都是要加空格的。
注册时间最后登录阅读权限90积分4833精华0帖子
自定义头衔
日志主题精华0帖子提交 BUG0 确认 BUG0 编辑维基0
Re: 请问这个驱动怎么安装linux-fbdev-kernel-bin_2.6.00.02a.tgz?
220k 写道:-------------------------------------------------------> ‘用户设置’在在‘控制面板’里有!> 第四个问题是cd后面要加空格键,不要用dos的习惯来输?> ?inux的命令后面都是要加空格的。不需要加空格。
注册时间最后登录阅读权限90积分4833精华0帖子
自定义头衔
日志主题精华0帖子提交 BUG0 确认 BUG0 编辑维基0
Re: 请问这个驱动怎么安装linux-fbdev-kernel-bin_2.6.00.02a.tgz?
那个viafb-install可能是个脚本文件,进入相应目录执行sh viafb-install试试看。copy viafb to any directory.拷贝viafb到任意目录。这个viafb是指你解压得到的文件夹。打了cd /usr/scr 为什么系统报错啊?因为只有/usr/src没有/usr/scr,所以系统报错。
注册时间最后登录阅读权限10积分20精华0帖子
自定义头衔
新手上路, 积分 20, 距离下一级还需 30 积分
日志主题精华0帖子提交 BUG0 确认 BUG0 编辑维基0
Re: 请问这个驱动怎么安装linux-fbdev-kernel-bin_2.6.00.02a.tgz?
‘用户设置’在在‘控制面板’里有
Powered bywinxp换成win7系统后一切正常,在备份系统时要求重启,结果重启后显示trying fbdev_百度知道
winxp换成win7系统后一切正常,在备份系统时要求重启,结果重启后显示trying fbdev
&,怎么解决;fbdev&nbsp,求高手帮忙://f,在备份系统时要求重启;[root@LiuX~]#&nbsp.jpg" esrc="http.jpg" target="_blank" title="点击查看大图" class="ikqb_img_alink"><img class="ikqb_img" src="/zhidao/pic/item/d788d43f775c7a08f41bd5ad6e390e://f.com/zhidao/wh%3D600%2C800/sign=dd4b31cf0699cbdb7e60b47/d788d43f775c7a08f41bd5ad6e390e?<a href="http.baidu://f,结果重启后显示trying&nbsp.driver&nbsp.baidu.hiphotos,然后就没反应了。如图示winxp换成win7系统后一切正常.com/zhidao/wh%3D450%2C600/sign=9ce209bfa00c512/d788d43f775c7a08f41bd5ad6e390e.baidu
提问者采纳
&#128514;准备重装吧
提问者评价
太给力了,你的回答完美地解决了我的问题,非常感谢!
其他类似问题
为您推荐:
其他1条回答
莫把还原系统当成备份系统
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁当前位置: &
& 查看源码
fbdev.c:源码内容
&*&linux/drivers/video/riva/fbdev.c&-&nVidia&RIVA&128/TNT/TNT2&fb&driver
&*&Maintained&by&Ani&Joshi&&ajoshi@&
&*&Copyright&&Jeff&Garzik
&*&Contributors:
&* Ani&Joshi:&&Lots&of&debugging&and&cleanup&work,&really&helped
&* get&the&driver&going
&* Ferenc&Bakonyi:&&Bug&fixes,&cleanup,&modularization
&*&Initial&template&from&skeletonfb.c,&created&28&Dec&1997&by&Geert&Uytterhoeven
&*&Includes&riva_hw.c&from&nVidia,&see&copyright&below.
&*&KGI&code&provided&the&basis&for&state&storage,&init,&and&mode&switching.
&*&This&file&is&subject&to&the&terms&and&conditions&of&the&GNU&General&Public
&*&License.&&See&the&file&COPYING&in&the&main&directory&of&this&archive
&*&for&more&details.
/*&version&number&of&this&driver&*/
#define&RIVAFB_VERSION&&0.7.3&
#include&&linux/config.h&
#include&&linux/module.h&
#include&&linux/kernel.h&
#include&&linux/errno.h&
#include&&linux/string.h&
#include&&linux/mm.h&
#include&&linux/selection.h&
#include&&linux/tty.h&
#include&&linux/malloc.h&
#include&&linux/delay.h&
#include&&linux/fb.h&
#include&&linux/init.h&
#include&&linux/pci.h&
#include&&video/fbcon.h&
#include&&riva_hw.h&
#include&&nv4ref.h&
#include&&nvreg.h&
#include&&../vga.h&
#include&&video/fbcon-cfb4.h&
#include&&video/fbcon-cfb8.h&
#include&&video/fbcon-cfb16.h&
#include&&video/fbcon-cfb32.h&
#ifndef&CONFIG_PCI
/*&sanity&check&*/
#error&This&driver&requires&PCI&support.
/*****************************************************************
&*&various&helpful&macros&and&constants
/*&#define&RIVAFBDEBUG&*/
#ifdef&RIVAFBDEBUG
#define&DPRINTK(fmt,&args...)&printk(KERN_DEBUG&&%s:&&&fmt,&__FUNCTION__&,&##&args)
#define&DPRINTK(fmt,&args...)
#ifndef&RIVA_NDEBUG
#define&assert(expr)&
if(!(expr))&{&
&&&&&&&&printk(&&Assertion&failed!&%s,%s,%s,line=%dn&,
&&&&&&&&#expr,__FILE__,__FUNCTION__,__LINE__);&
#define&assert(expr)
/*&GGI&compatibility&macros&*/
#define&io_out8
#define&io_in8
#define&NUM_SEQ_REGS
#define&NUM_CRT_REGS
#define&NUM_GRC_REGS
#define&NUM_ATC_REGS
#define&PFX&&rivafb:&&
#define&CNVT_TOHW(val,width) ((((val)&&(width))+0x7FFF-(val))&&16)
/*&macro&that&allows&you&to&set&overflow&bits&*/
#define&SetBitField(value,from,to)&SetBF(to,GetBF(value,from))
#define&SetBit(n)
#define&Set8Bits(value)
((value)&0xff)
enum&riva_chips&{
CH_RIVA_128&=&0,
CH_RIVA_TNT,
CH_RIVA_TNT2,
CH_RIVA_UTNT2, /*&UTNT2&*/
CH_RIVA_VTNT2, /*&VTNT2&*/
CH_RIVA_UVTNT2, /*&VTNT2&*/
CH_RIVA_ITNT2, /*&ITNT2&*/
/*&directly&indexed&by&riva_chips&enum,&above&*/
static&struct&riva_chip_info&{
const&char&*
unsigned&arch_
}&riva_chip_info[]&__devinitdata&=&{
{&&RIVA-128&,&3&},
{&&RIVA-TNT&,&4&},
{&&RIVA-TNT2&,&5&},
{&&RIVA-UTNT2&,&5&},
{&&RIVA-VTNT2&,&5&},
{&&RIVA-UVTNT2&,&5&},
{&&RIVA-ITNT2&,&5&},
static&struct&pci_device_id&rivafb_pci_tbl[]&__devinitdata&=&{
{&PCI_VENDOR_ID_NVIDIA_SGS,&PCI_DEVICE_ID_NVIDIA_SGS_RIVA128,&PCI_ANY_ID,&PCI_ANY_ID,&0,&0,&CH_RIVA_128&},
{&PCI_VENDOR_ID_NVIDIA,&PCI_DEVICE_ID_NVIDIA_TNT,&PCI_ANY_ID,&PCI_ANY_ID,&0,&0,&CH_RIVA_TNT&},
{&PCI_VENDOR_ID_NVIDIA,&PCI_DEVICE_ID_NVIDIA_TNT2,&PCI_ANY_ID,&PCI_ANY_ID,&0,&0,&CH_RIVA_TNT2&},
{&PCI_VENDOR_ID_NVIDIA,&PCI_DEVICE_ID_NVIDIA_UTNT2,&PCI_ANY_ID,&PCI_ANY_ID,&0,&0,&CH_RIVA_UTNT2&},
{&PCI_VENDOR_ID_NVIDIA,&PCI_DEVICE_ID_NVIDIA_VTNT2,&PCI_ANY_ID,&PCI_ANY_ID,&0,&0,&CH_RIVA_VTNT2&},
{&PCI_VENDOR_ID_NVIDIA,&PCI_DEVICE_ID_NVIDIA_UVTNT2,&PCI_ANY_ID,&PCI_ANY_ID,&0,&0,&CH_RIVA_VTNT2&},
{&PCI_VENDOR_ID_NVIDIA,&PCI_DEVICE_ID_NVIDIA_ITNT2,&PCI_ANY_ID,&PCI_ANY_ID,&0,&0,&CH_RIVA_ITNT2&},
{&0,&}&/*&terminate&list&*/
MODULE_DEVICE_TABLE(pci,&rivafb_pci_tbl);
/*&holds&the&state&of&the&VGA&core&and&extended&Riva&hw&state&from&riva_hw.c.
&*&From&KGI&originally.&*/
struct&riva_regs&{
u8&attr[NUM_ATC_REGS];
u8&crtc[NUM_CRT_REGS];
u8&gra[NUM_GRC_REGS];
u8&seq[NUM_SEQ_REGS];
RIVA_HW_STATE&
&*&describes&the&state&of&a&Riva&board
struct&rivafb_par&{
struct&riva_regs& /*&state&of&hw&board&*/
/*&FB_VISUAL_xxx&*/
/*&bpp&of&current&mode&*/
typedef&struct&{
unsigned&char&red,&green,&blue,&
}&riva_cfb8_cmap_t;
struct&rivafb_
struct&rivafb_info&{
struct&fb_info& /*&kernel&framebuffer&info&*/
RIVA_HW_INST& /*&interface&to&riva_hw.c&*/
const&char&*drvr_ /*&Riva&hardware&board&type&*/
unsigned&long&ctrl_base_ /*&physical&control&register&base&addr&*/
unsigned&long&fb_base_ /*&physical&framebuffer&base&addr&*/
caddr_t&ctrl_ /*&virtual&control&register&base&addr&*/
caddr_t&fb_ /*&virtual&framebuffer&base&addr&*/
unsigned&ram_ /*&amount&of&RAM&on&card,&in&bytes&*/
unsigned&dclk_ /*&max&DCLK&*/
struct&riva_regs&initial_ /*&initial&startup&video&mode&*/
struct&display&
struct&display&*currcon_
struct&rivafb_info&*
struct&pci_dev&* /*&pointer&to&board's&pci&info&*/
unsigned&base0_region_ /*&size&of&control&register&region&*/
unsigned&base1_region_ /*&size&of&framebuffer&region&*/
riva_cfb8_cmap_t&palette[256]; /*&VGA&DAC&palette&cache&*/
#if&defined(FBCON_HAS_CFB16)&||&defined(FBCON_HAS_CFB32)
#ifdef&FBCON_HAS_CFB16
u_int16_t&cfb16[16];
#ifdef&FBCON_HAS_CFB32
u_int32_t&cfb32[16];
/*&FBCON_HAS_CFB16&|&FBCON_HAS_CFB32&*/
/*&-------------------&global&variables&------------------------&*/
static&struct&rivafb_info&*riva_boards&=&NULL;
/*&command&line&data,&set&in&rivafb_setup()&*/
static&char&fontname[40]&__initdata&=&{&0&};
#ifndef&MODULE
static&char&noaccel&__initdata&=&0; /*&unused&*/
static&const&char&*mode_option&__initdata&=&NULL;
static&struct&fb_var_screeninfo&rivafb_default_var&=&{
/*&640x480-8@60,&yres_virtual=2400&(fits&for&all&Riva&cards&*/
640,&480,&640,&,&8,&0,
{0,&6,&0},&{0,&6,&0},&{0,&6,&0},&{0,&0,&0},
0,&0,&-1,&-1,&0,&3,&32,&11,&96,&2,
0,&FB_VMODE_NONINTERLACED
/*&-------------------&prototypes&------------------------------&*/
static&int&rivafb_get_fix&(struct&fb_fix_screeninfo&*fix,&int&con,
&&&&struct&fb_info&*info);
static&int&rivafb_get_var&(struct&fb_var_screeninfo&*var,&int&con,
&&&&struct&fb_info&*info);
static&int&rivafb_set_var&(struct&fb_var_screeninfo&*var,&int&con,
&&&&struct&fb_info&*info);
static&int&rivafb_get_cmap&(struct&fb_cmap&*cmap,&int&kspc,&int&con,
&&&&&struct&fb_info&*info);
static&int&rivafb_set_cmap&(struct&fb_cmap&*cmap,&int&kspc,&int&con,
&&&&&struct&fb_info&*info);
static&int&rivafb_pan_display&(struct&fb_var_screeninfo&*var,&int&con,
struct&fb_info&*info);
static&int&rivafb_ioctl&(struct&inode&*inode,&struct&file&*file,&unsigned&int&cmd,
&&unsigned&long&arg,&int&con,&struct&fb_info&*info);
static&int&rivafb_switch&(int&con,&struct&fb_info&*info);
static&int&rivafb_updatevar&(int&con,&struct&fb_info&*info);
static&void&rivafb_blank&(int&blank,&struct&fb_info&*info);
static&void&riva_load_video_mode&(struct&rivafb_info&*rivainfo,
&&struct&fb_var_screeninfo&*video_mode);
static&int&riva_getcolreg&(unsigned&regno,&unsigned&*red,&unsigned&*green,
&&&unsigned&*blue,&unsigned&*transp,
&&&struct&fb_info&*info);
static&int&riva_setcolreg&(unsigned&regno,&unsigned&red,&unsigned&green,
&&&unsigned&blue,&unsigned&transp,
&&&struct&fb_info&*info);
static&int&riva_get_cmap_len&(const&struct&fb_var_screeninfo&*var);
static&int&riva_set_fbinfo&(struct&rivafb_info&*rinfo);
static&void&riva_save_state&(struct&rivafb_info&*rinfo,&struct&riva_regs&*regs);
static&void&riva_load_state&(struct&rivafb_info&*rinfo,&struct&riva_regs&*regs);
static&struct&rivafb_info&*riva_board_list_add&(struct&rivafb_info&*board_list,
&struct&rivafb_info&*new_node);
static&struct&rivafb_info&*riva_board_list_del&(struct&rivafb_info&*board_list,
&struct&rivafb_info&*del_node);
static&void&riva_wclut&(unsigned&char&regnum,&unsigned&char&red,
unsigned&char&green,&unsigned&char&blue);
/*&kernel&interface&*/
static&struct&fb_ops&riva_fb_ops&=&{
THIS_MODULE,
fb_get_fix: rivafb_get_fix,
fb_get_var: rivafb_get_var,
fb_set_var: rivafb_set_var,
fb_get_cmap: rivafb_get_cmap,
fb_set_cmap: rivafb_set_cmap,
fb_pan_display: rivafb_pan_display,
fb_ioctl: rivafb_ioctl,
/*&from&GGI&*/
static&const&struct&riva_regs&reg_template&=&{
{0x00,&0x01,&0x02,&0x03,&0x04,&0x05,&0x06,&0x07, /*&ATTR&*/
&0x08,&0x09,&0x0A,&0x0B,&0x0C,&0x0D,&0x0E,&0x0F,
&0x41,&0x01,&0x0F,&0x00,&0x00},
{0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00, /*&CRT&&*/
&0x00,&0x00,&0x20,&0x00,&0x00,&0x00,&0x00,&0x00,
&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0xE3, /*&0x10&*/
&0xFF,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,
&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00, /*&0x20&*/
&0x40,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,
&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00, /*&0x30&*/
&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,&0x00,
/*&0x40&*/
{0x00,&0x00,&0x00,&0x00,&0x00,&0x40,&0x05,&0x0F, /*&GRA&&*/
{0x03,&0x01,&0x0F,&0x00,&0x0E}, /*&SEQ&&*/
/*&MISC&*/
/*&-------------------&general&utility&functions&--------------------------&*/
&*&riva_set_dispsw
&*&@rinfo:&pointer&to&internal&driver&struct&for&a&given&Riva&card
&*&DESCRIPTION:
&*&Sets&up&console&Low&level&operations&depending&on&the&current?&color&depth
&*&of&the&display
static&void&riva_set_dispsw&(struct&rivafb_info&*rinfo)
struct&display&*disp&=&&rinfo-&
DPRINTK&(&ENTERn&);
assert&(rinfo&!=&NULL);
disp-&dispsw_data&=&NULL;
switch&(disp-&var.bits_per_pixel)&{
#ifdef&FBCON_HAS_MFB
disp-&dispsw&=&&fbcon_
#ifdef&FBCON_HAS_CFB4
disp-&dispsw&=&&fbcon_cfb4;
#ifdef&FBCON_HAS_CFB8
disp-&dispsw&=&&fbcon_cfb8;
#ifdef&FBCON_HAS_CFB16
disp-&dispsw&=&&fbcon_cfb16;
disp-&dispsw_data&=&&rinfo-&con_cmap.cfb16;
#ifdef&FBCON_HAS_CFB24
disp-&dispsw&=&&fbcon_cfb24;
disp-&dispsw_data&=&rinfo-&con_cmap.cfb24;
#ifdef&FBCON_HAS_CFB32
disp-&dispsw&=&&fbcon_cfb32;
disp-&dispsw_data&=&rinfo-&con_cmap.cfb32;
DPRINTK&(&Setting&fbcon_dummy&renderern&);
disp-&dispsw&=&&fbcon_
DPRINTK&(&EXITn&);
static&int&riva_init_disp_var&(struct&rivafb_info&*rinfo)
#ifndef&MODULE
if&(mode_option)
fb_find_mode&(&rinfo-&disp.var,&&rinfo-&info,&mode_option,
&&&&&&NULL,&0,&NULL,&8);
/*&!MODULE&*/
static&int&__devinit&riva_init_disp&(struct&rivafb_info&*rinfo)
struct&fb_info&*
struct&display&*
DPRINTK&(&ENTERn&);
assert&(rinfo&!=&NULL);
info&=&&rinfo-&
disp&=&&rinfo-&
disp-&var&=&rivafb_default_
info-&disp&=&
/*&FIXME:&assure&that&disp-&cmap&is&completely&filled&out&*/
disp-&screen_base&=&rinfo-&fb_
disp-&visual&=&FB_VISUAL_PSEUDOCOLOR;
disp-&type&=&FB_TYPE_PACKED_PIXELS;
disp-&type_aux&=&0;
disp-&ypanstep&=&1;
disp-&ywrapstep&=&0;
disp-&next_line&=&disp-&line_length&=
&&&&(disp-&var.xres_virtual&*&disp-&var.bits_per_pixel)&&&&3;
disp-&can_soft_blank&=&1;
disp-&inverse&=&0;
riva_set_dispsw&(rinfo);
disp-&scrollmode&=&0;
rinfo-&currcon_display&=&
if&((riva_init_disp_var&(rinfo))&&&0)&{ /*&must&be&done&last&*/
DPRINTK&(&EXIT,&returning&-1n&);
return&-1;
DPRINTK&(&EXIT,&returning&0n&);
static&int&__devinit&riva_set_fbinfo&(struct&rivafb_info&*rinfo)
struct&fb_info&*
assert&(rinfo&!=&NULL);
info&=&&rinfo-&
strcpy&(info-&modename,&rinfo-&drvr_name);
info-&node&=&-1;
info-&flags&=&FBINFO_FLAG_DEFAULT;
info-&fbops&=&&riva_fb_
/*&FIXME:&set&monspecs&to&what???&*/
info-&display_fg&=&NULL;
strncpy&(info-&fontname,&fontname,&sizeof&(info-&fontname));
info-&fontname[sizeof&(info-&fontname)&-&1]&=&0;
info-&changevar&=&NULL;
info-&switch_con&=&rivafb_
info-&updatevar&=&rivafb_
info-&blank&=&rivafb_
if&(riva_init_disp&(rinfo)&&&0) /*&must&be&done&last&*/
return&-1;
/*&-----------------------------&PCI&bus&-----------------------------&*/
static&int&__devinit&rivafb_init_one&(struct&pci_dev&*pd,
&&&&&&const&struct&pci_device_id&*ent)
struct&rivafb_info&*
struct&riva_chip_info&*rci&=&&riva_chip_info[ent-&driver_data];
assert&(pd&!=&NULL);
assert&(rci&!=&NULL);
rinfo&=&kmalloc&(sizeof&(struct&rivafb_info),&GFP_KERNEL);
if&(!rinfo)
memset&(rinfo,&0,&sizeof&(struct&rivafb_info));
rinfo-&drvr_name&=&rci-&
rinfo-&riva.Architecture&=&rci-&arch_
rinfo-&pd&=&
rinfo-&base0_region_size&=&pci_resource_len&(pd,&0);
rinfo-&base1_region_size&=&pci_resource_len&(pd,&1);
assert&(rinfo-&base0_region_size&&=&0x); /*&from&GGI&*/
assert&(rinfo-&base1_region_size&&=&0x); /*&from&GGI&*/
rinfo-&ctrl_base_phys&=&pci_resource_start&(rinfo-&pd,&0);
rinfo-&fb_base_phys&=&pci_resource_start&(rinfo-&pd,&1);
if&(!request_mem_region&(rinfo-&ctrl_base_phys,
&rinfo-&base0_region_size,&&rivafb&))&{
printk&(KERN_ERR&PFX&&cannot&reserve&MMIO&regionn&);
goto&err_out_
if&(!request_mem_region&(rinfo-&fb_base_phys,
&rinfo-&base1_region_size,&&rivafb&))&{
printk&(KERN_ERR&PFX&&cannot&reserve&FB&regionn&);
goto&err_out_free_base0;
rinfo-&ctrl_base&=&ioremap&(rinfo-&ctrl_base_phys,
&&&&rinfo-&base0_region_size);
if&(!rinfo-&ctrl_base)&{
printk&(KERN_ERR&PFX&&cannot&ioremap&MMIO&basen&);
goto&err_out_free_base1;
rinfo-&fb_base&=&ioremap&(rinfo-&fb_base_phys,
&&rinfo-&base1_region_size);
if&(!rinfo-&fb_base)&{
printk&(KERN_ERR&PFX&&cannot&ioremap&FB&basen&);
goto&err_out_iounmap_
rinfo-&riva.EnableIRQ&=&0;
rinfo-&riva.IO&=&(inb&(0x3CC)&&&0x01)&?&0x3D0&:&0x3B0;
rinfo-&riva.PRAMDAC&=&(unsigned&*)&(rinfo-&ctrl_base&+&0x);
rinfo-&riva.PFB&=&(unsigned&*)&(rinfo-&ctrl_base&+&0x);
rinfo-&riva.PFIFO&=&(unsigned&*)&(rinfo-&ctrl_base&+&0x);
rinfo-&riva.PGRAPH&=&(unsigned&*)&(rinfo-&ctrl_base&+&0x);
rinfo-&riva.PEXTDEV&=&(unsigned&*)&(rinfo-&ctrl_base&+&0x);
rinfo-&riva.PTIMER&=&(unsigned&*)&(rinfo-&ctrl_base&+&0x);
rinfo-&riva.PMC&=&(unsigned&*)&(rinfo-&ctrl_base&+&0x);
rinfo-&riva.FIFO&=&(unsigned&*)&(rinfo-&ctrl_base&+&0x);
switch&(rinfo-&riva.Architecture)&{
rinfo-&riva.PRAMIN&=
&&&&(unsigned&*)&(rinfo-&fb_base&+&0x00C00000);
rinfo-&riva.PCRTC&=
&&&&(unsigned&*)&(rinfo-&ctrl_base&+&0x);
rinfo-&riva.PRAMIN&=
&&&&(unsigned&*)&(rinfo-&ctrl_base&+&0x);
RivaGetConfig&(&rinfo-&riva);
/*&back&to&normal&*/
assert&(rinfo-&pd&!=&NULL);
/*&unlock&io&*/
vga_io_wcrt&(0x11,&0xFF); /*&vgaHWunlock()&+&riva&unlock&(0x7F)&*/
outb&(rinfo-&riva.LockUnlockIndex,&rinfo-&riva.LockUnlockIO);
outb&(0x57,&rinfo-&riva.LockUnlockIO&+&1);
memcpy&(&rinfo-&initial_state,&&reg_template,
sizeof&(reg_template));
riva_save_state&(rinfo,&&rinfo-&initial_state);
rinfo-&ram_amount&=&rinfo-&riva.RamAmountKBytes&*&1024;
rinfo-&dclk_max&=&rinfo-&riva.MaxVClockFreqKHz&*&1000;
riva_set_fbinfo&(rinfo);
fb_memset&(rinfo-&fb_base,&0,&rinfo-&ram_amount);
riva_load_video_mode&(rinfo,&&rinfo-&disp.var);
if&(register_framebuffer&((struct&fb_info&*)&rinfo)&&&0)&{
printk&(KERN_ERR&PFX
&error&registering&riva&framebuffern&);
goto&err_out_iounmap_
riva_boards&=&riva_board_list_add(riva_boards,&rinfo);
pci_set_drvdata&(pd,&rinfo);
printk&(KERN_INFO&PFX
&PCI&Riva&NV%d&framebuffer&ver&%s&(%s,&%dMB&@&0x%lX)n&,
rinfo-&riva.Architecture,
RIVAFB_VERSION,
rinfo-&drvr_name,
rinfo-&ram_amount&/&(1024&*&1024)&+&1,
rinfo-&fb_base_phys);
err_out_iounmap_fb:
iounmap&(rinfo-&fb_base);
err_out_iounmap_ctrl:
iounmap&(rinfo-&ctrl_base);
err_out_free_base1:
release_mem_region&(rinfo-&fb_base_phys,&rinfo-&base1_region_size);
err_out_free_base0:
release_mem_region&(rinfo-&ctrl_base_phys,&rinfo-&base0_region_size);
err_out_kfree:
kfree&(rinfo);
return&-ENODEV;
static&void&__devexit&rivafb_remove_one&(struct&pci_dev&*pd)
struct&rivafb_info&*board&=&pci_get_drvdata&(pd);
if&(!board)
riva_boards&=&riva_board_list_del(riva_boards,&board);
riva_load_state&(board,&&board-&initial_state);
unregister_framebuffer&((struct&fb_info&*)&board);
iounmap&(board-&ctrl_base);
iounmap&(board-&fb_base);
release_mem_region&(board-&ctrl_base_phys,
&&&&board-&base0_region_size);
release_mem_region&(board-&fb_base_phys,
&&&&board-&base1_region_size);
kfree&(board);
pci_set_drvdata&(pd,&NULL);
/***&riva_wclut&-&set&CLUT&entry&***/
static&void&riva_wclut&(unsigned&char&regnum,&unsigned&char&red,
unsigned&char&green,&unsigned&char&blue)
unsigned&int&data&=&VGA_PEL_D;
/*&address&write&mode&register&is&not&translated..&*/
vga_io_w&(VGA_PEL_IW,&regnum);
vga_io_w&(data,&red);
vga_io_w&(data,&green);
vga_io_w&(data,&blue);
/*&------------&Hardware&Independent&Functions&------------&*/
#ifndef&MODULE
int&__init&rivafb_setup&(char&*options)
char&*this_
if&(!options&||&!*options)
for&(this_opt&=&strtok&(options,&&,&);&this_
&&&&&this_opt&=&strtok&(NULL,&&,&))&{
if&(!strncmp&(this_opt,&&font:&,&5))&{
p&=&this_opt&+&5;
for&(i&=&0;&i&&&sizeof&(fontname)&-&1;&i++)
if&(!*p&||&*p&==&'&'&||&*p&==&',')
memcpy&(fontname,&this_opt&+&5,&i);
fontname[i]&=&0;
else&if&(!strncmp&(this_opt,&&noaccel&,&7))&{
noaccel&=&1;
mode_option&=&this_
/*&!MODULE&*/
&&&&&*&&Initialization
/*&-------------------------------------------------------------------------&*/
&&&&&*&&Frame&buffer&operations
static&int&rivafb_get_fix&(struct&fb_fix_screeninfo&*fix,&int&con,
&&&&struct&fb_info&*info)
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
struct&display&*p;
DPRINTK&(&ENTERn&);
assert&(fix&!=&NULL);
assert&(info&!=&NULL);
assert&(rivainfo-&drvr_name&&&&rivainfo-&drvr_name[0]);
assert&(rivainfo-&fb_base_phys&&&0);
assert&(rivainfo-&ram_amount&&&0);
p&=&(con&&&0)&?&rivainfo-&info.disp&:&&fb_display[con];
memset&(fix,&0,&sizeof&(struct&fb_fix_screeninfo));
sprintf&(fix-&id,&&Riva&%s&,&rivainfo-&drvr_name);
fix-&smem_start&=&rivainfo-&fb_base_
fix-&smem_len&=&rivainfo-&ram_
fix-&type&=&p-&
fix-&type_aux&=&p-&type_
fix-&visual&=&p-&
fix-&xpanstep&=&1;
fix-&ypanstep&=&1;
fix-&ywrapstep&=&0; /*&FIXME:&no&ywrap&for&now&*/
fix-&line_length&=&p-&line_
/*&FIXME:&set&up&MMIO&region,&export&via&FB_ACCEL_xxx&*/
fix-&mmio_start&=&0;
fix-&mmio_len&=&0;
fix-&accel&=&FB_ACCEL_NONE;
DPRINTK&(&EXIT,&returning&0n&);
static&int&rivafb_get_var&(struct&fb_var_screeninfo&*var,&int&con,
&&&&struct&fb_info&*info)
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
DPRINTK&(&ENTERn&);
assert&(info&!=&NULL);
assert&(var&!=&NULL);
*var&=&(con&&&0)&?&rivainfo-&disp.var&:&fb_display[con].
DPRINTK&(&EXIT,&returning&0n&);
static&int&rivafb_set_var&(struct&fb_var_screeninfo&*var,&int&con,
&&&&struct&fb_info&*info)
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
struct&display&*
struct&fb_var_screeninfo&v;
/*&translating&from&pixels-&bytes&*/
unsigned&chgvar&=&0;
static&struct&{
int&xres,&
}&modes[]&=&{
800,&600},&{
640,&480},&{
DPRINTK&(&ENTERn&);
assert&(info&!=&NULL);
assert&(var&!=&NULL);
DPRINTK&(&Requested:&%dx%dx%dn&,&var-&xres,&var-&yres,
&var-&bits_per_pixel);
DPRINTK&(&&&virtual:&%dx%dn&,&var-&xres_virtual,
&var-&yres_virtual);
DPRINTK&(&&&&offset:&(%d,%d)n&,&var-&xoffset,&var-&yoffset);
DPRINTK&(&grayscale:&%dn&,&var-&grayscale);
dsp&=&(con&&&0)&?&rivainfo-&info.disp&:&&fb_display[con];
assert&(dsp&!=&NULL);
/*&if&var&has&changed,&we&should&call&changevar()&later&*/
if&(con&&=&0)&{
chgvar&=&((dsp-&var.xres&!=&var-&xres)&||
&&(dsp-&var.yres&!=&var-&yres)&||
&&(dsp-&var.xres_virtual&!=&var-&xres_virtual)&||
&&(dsp-&var.yres_virtual&!=&var-&yres_virtual)&||
&&(dsp-&var.bits_per_pixel&!=&var-&bits_per_pixel)
&&||&memcmp&(&dsp-&var.red,&&var-&red,
&&&&&sizeof&(var-&red))
&&||&memcmp&(&dsp-&var.green,&&var-&green,
&&&&&sizeof&(var-&green))
&&||&memcmp&(&dsp-&var.blue,&&var-&blue,
&&&&&sizeof&(var-&blue)));
memcpy&(&v,&var,&sizeof&(v));
switch&(v.bits_per_pixel)&{
#ifdef&FBCON_HAS_MFB
dsp-&dispsw&=&&fbcon_
dsp-&line_length&=&v.xres_virtual&/&8;
dsp-&visual&=&FB_VISUAL_MONO10;
#ifdef&FBCON_HAS_CFB8
case&2&...&8:
v.bits_per_pixel&=&8;
dsp-&dispsw&=&&fbcon_cfb8;
dsp-&line_length&=&v.xres_
dsp-&visual&=&FB_VISUAL_PSEUDOCOLOR;
v.red.offset&=&0;
v.red.length&=&6;
v.green.offset&=&0;
v.green.length&=&6;
v.blue.offset&=&0;
v.blue.length&=&6;
#ifdef&FBCON_HAS_CFB16
case&9&...&16:
v.bits_per_pixel&=&16;
dsp-&dispsw&=&&fbcon_cfb16;
dsp-&dispsw_data&=&&rivainfo-&con_cmap.cfb16;
dsp-&line_length&=&v.xres_virtual&*&2;
dsp-&visual&=&FB_VISUAL_DIRECTCOLOR;
#ifdef&CONFIG_PREP
v.red.offset&=&2;
v.green.offset&=&-3;
v.blue.offset&=&8;
v.red.offset&=&10;
v.green.offset&=&5;
v.blue.offset&=&0;
v.red.length&=&5;
v.green.length&=&5;
v.blue.length&=&5;
#ifdef&FBCON_HAS_CFB32
case&17&...&32:
v.bits_per_pixel&=&32;
dsp-&dispsw&=&&fbcon_cfb32;
dsp-&dispsw_data&=&rivainfo-&con_cmap.cfb32;
dsp-&line_length&=&v.xres_virtual&*&4;
dsp-&visual&=&FB_VISUAL_DIRECTCOLOR;
#ifdef&CONFIG_PREP
v.red.offset&=&8;
v.green.offset&=&16;
v.blue.offset&=&24;
v.red.offset&=&16;
v.green.offset&=&8;
v.blue.offset&=&0;
v.red.length&=&8;
v.green.length&=&8;
v.blue.length&=&8;
printk&(KERN_ERR&PFX
&mode&%dx%dx%d&rejected...color&depth&not&supported.n&,
var-&xres,&var-&yres,&var-&bits_per_pixel);
DPRINTK&(&EXIT,&returning&-EINVALn&);
return&-EINVAL;
if&(v.xres&*&nom&/&den&*&v.yres&&&rivainfo-&ram_amount)&{
printk&(KERN_ERR&PFX
&mode&%dx%dx%d&rejected...resolution&too&high&to&fit&into&video&memory!n&,
var-&xres,&var-&yres,&var-&bits_per_pixel);
DPRINTK&(&EXIT&-&EINVAL&errorn&);
return&-EINVAL;
/*&use&highest&possible&virtual&resolution&*/
if&(v.xres_virtual&==&-1&&&&v.yres_virtual&==&-1)&{
printk&(KERN_WARNING&PFX
&using&maximum&available&virtual&resolutionn&);
for&(i&=&0;&modes[i].xres&!=&-1;&i++)&{
if&(modes[i].xres&*&nom&/&den&*&modes[i].yres&&
&&&&rivainfo-&ram_amount&/&2)
if&(modes[i].xres&==&-1)&{
printk&(KERN_ERR&PFX
&could&not&find&a&virtual&resolution&that&fits&into&video&memory!!n&);
DPRINTK&(&EXIT&-&EINVAL&errorn&);
return&-EINVAL;
v.xres_virtual&=&modes[i].
v.yres_virtual&=&modes[i].
printk&(KERN_INFO&PFX
&virtual&resolution&set&to&maximum&of&%dx%dn&,
v.xres_virtual,&v.yres_virtual);
}&else&if&(v.xres_virtual&==&-1)&{
/*&FIXME:&maximize&X&virtual&resolution&only&*/
}&else&if&(v.yres_virtual&==&-1)&{
/*&FIXME:&maximize&Y&virtual&resolution&only&*/
if&(v.xoffset&&&0)
v.xoffset&=&0;
if&(v.yoffset&&&0)
v.yoffset&=&0;
/*&truncate&xoffset&and&yoffset&to&maximum&if&too&high&*/
if&(v.xoffset&&&v.xres_virtual&-&v.xres)
v.xoffset&=&v.xres_virtual&-&v.xres&-&1;
if&(v.yoffset&&&v.yres_virtual&-&v.yres)
v.yoffset&=&v.yres_virtual&-&v.yres&-&1;
v.red.msb_right&=
&&&&v.green.msb_right&=
&&&&v.blue.msb_right&=
&&&&v.transp.offset&=&v.transp.length&=&v.transp.msb_right&=&0;
switch&(v.activate&&&FB_ACTIVATE_MASK)&{
case&FB_ACTIVATE_TEST:
DPRINTK&(&EXIT&-&FB_ACTIVATE_TESTn&);
case&FB_ACTIVATE_NXTOPEN: /*&??&*/
case&FB_ACTIVATE_NOW:
/*&continue&*/
DPRINTK&(&EXIT&-&unknown&activation&typen&);
return&-EINVAL; /*&unknown&*/
dsp-&type&=&FB_TYPE_PACKED_PIXELS;
/*&FIXME:&verify&that&the&above&code&sets&dsp-&*&fields&correctly&*/
memcpy&(&dsp-&var,&&v,&sizeof&(v));
riva_load_video_mode&(rivainfo,&&v);
if&(chgvar&&&&info&&&&info-&changevar)
info-&changevar&(con);
DPRINTK&(&EXIT,&returning&0n&);
static&int&rivafb_get_cmap&(struct&fb_cmap&*cmap,&int&kspc,&int&con,
&&&&&struct&fb_info&*info)
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
struct&display&*
DPRINTK&(&ENTERn&);
assert&(rivainfo&!=&NULL);
assert&(cmap&!=&NULL);
dsp&=&(con&&&0)&?&rivainfo-&info.disp&:&&fb_display[con];
if&(con&==&rivainfo-&currcon)&{ /*&current&console?&*/
int&rc&=&fb_get_cmap&(cmap,&kspc,&riva_getcolreg,&info);
DPRINTK&(&EXIT&-&returning&%dn&,&rc);
}&else&if&(dsp-&cmap.len) /*&non&default&colormap?&*/
fb_copy_cmap&(&dsp-&cmap,&cmap,&kspc&?&0&:&2);
fb_copy_cmap&(fb_default_cmap
&&&&&&(riva_get_cmap_len&(&dsp-&var)),&cmap,
&&&&&&kspc&?&0&:&2);
DPRINTK&(&EXIT,&returning&0n&);
static&int&rivafb_set_cmap&(struct&fb_cmap&*cmap,&int&kspc,&int&con,
&&&&&struct&fb_info&*info)
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
struct&display&*
unsigned&int&cmap_
DPRINTK&(&ENTERn&);
assert&(rivainfo&!=&NULL);
assert&(cmap&!=&NULL);
dsp&=&(con&&&0)&?&rivainfo-&info.disp&:&&fb_display[con];
cmap_len&=&riva_get_cmap_len&(&dsp-&var);
if&(dsp-&cmap.len&!=&cmap_len)&{
int&err&=&fb_alloc_cmap&(&dsp-&cmap,&cmap_len,&0);
if&(err)&{
DPRINTK&(&EXIT&-&returning&%dn&,&err);
if&(con&==&rivainfo-&currcon)&{ /*&current&console?&*/
int&rc&=&fb_set_cmap&(cmap,&kspc,&riva_setcolreg,&info);
DPRINTK&(&EXIT&-&returning&%dn&,&rc);
fb_copy_cmap&(cmap,&&dsp-&cmap,&kspc&?&0&:&1);
DPRINTK&(&EXIT,&returning&0n&);
&*&rivafb_pan_display
&*&@var:&standard&kernel&fb&changeable&data
&*&@info:&pointer&to&rivafb_info&object&containing&info&for&current&riva&board
&*&DESCRIPTION:
&*&Pan&(or&wrap,&depending&on&the&`vmode'&field)&the&display&using&the
&*&`xoffset'&and&`yoffset'&fields&of&the&`var'&structure.
&*&If&the&values&don't&fit,&return&-EINVAL.
&*&This&call&looks&only&at&xoffset,&yoffset&and&the&FB_VMODE_YWRAP&flag
static&int&rivafb_pan_display&(struct&fb_var_screeninfo&*var,&int&con,
struct&fb_info&*info)
unsigned&int&
struct&display&*
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
DPRINTK&(&ENTERn&);
assert&(rivainfo&!=&NULL);
if&(var-&xoffset&&&(var-&xres_virtual&-&var-&xres))
return&-EINVAL;
if&(var-&yoffset&&&(var-&yres_virtual&-&var-&yres))
return&-EINVAL;
dsp&=&(con&&&0)&?&rivainfo-&info.disp&:&&fb_display[con];
if&(var-&vmode&&&FB_VMODE_YWRAP)&{
if&(var-&yoffset&&&0
&&&&||&var-&yoffset&&=&dsp-&var.yres_virtual
&&&&||&var-&xoffset)&return&-EINVAL;
if&(var-&xoffset&+&dsp-&var.xres&&&dsp-&var.xres_virtual&||
&&&&var-&yoffset&+&dsp-&var.yres&&&dsp-&var.yres_virtual)
return&-EINVAL;
base&=&var-&yoffset&*&dsp-&line_length&+&var-&
if&(con&==&rivainfo-&currcon)&{
rivainfo-&riva.SetStartAddress&(&rivainfo-&riva,&base);
dsp-&var.xoffset&=&var-&
dsp-&var.yoffset&=&var-&
if&(var-&vmode&&&FB_VMODE_YWRAP)
dsp-&var.vmode&|=&FB_VMODE_YWRAP;
dsp-&var.vmode&&=&~FB_VMODE_YWRAP;
DPRINTK&(&EXIT,&returning&0n&);
static&int&rivafb_ioctl&(struct&inode&*inode,&struct&file&*file,&unsigned&int&cmd,
&&unsigned&long&arg,&int&con,&struct&fb_info&*info)
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
DPRINTK&(&ENTERn&);
assert&(rivainfo&!=&NULL);
/*&no&rivafb-specific&ioctls&*/
DPRINTK&(&EXIT,&returning&-EINVALn&);
return&-EINVAL;
static&int&rivafb_switch&(int&con,&struct&fb_info&*info)
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
struct&fb_cmap&*
struct&display&*
DPRINTK&(&ENTERn&);
assert&(rivainfo&!=&NULL);
dsp&=&(con&&&0)&?&rivainfo-&info.disp&:&&fb_display[con];
if&(rivainfo-&currcon&&=&0)&{
/*&Do&we&have&to&save&the&colormap?&*/
cmap&=&&(rivainfo-&currcon_display-&cmap);
DPRINTK&(&switch1:&con&=&%d,&cmap.len&=&%dn&,
&rivainfo-&currcon,&cmap-&len);
if&(cmap-&len)&{
DPRINTK&(&switch1a:&%p&%p&%p&%pn&,&cmap-&red,
&cmap-&green,&cmap-&blue,&cmap-&transp);
fb_get_cmap&(cmap,&1,&riva_getcolreg,&info);
#ifdef&DEBUG
if&(cmap-&red)&{
DPRINTK&(&switch1r:&%Xn&,&cmap-&red[0]);
rivainfo-&currcon&=&
rivainfo-&currcon_display&=&
dsp-&var.activate&=&FB_ACTIVATE_NOW;
#ifdef&riva_DEBUG
cmap&=&&dsp-&
DPRINTK&(&switch2:&con&=&%d,&cmap.len&=&%dn&,&con,&cmap-&len);
DPRINTK&(&switch2a:&%p&%p&%p&%pn&,&cmap-&red,&cmap-&green,
&cmap-&blue,&cmap-&transp);
if&(dsp-&cmap.red)&{
DPRINTK&(&switch2r:&%Xn&,&cmap-&red[0]);
rivafb_set_var&(&dsp-&var,&con,&info);
#ifdef&riva_DEBUG
DPRINTK&(&switch3:&con&=&%d,&cmap.len&=&%dn&,&con,&cmap-&len);
DPRINTK&(&switch3a:&%p&%p&%p&%pn&,&cmap-&red,&cmap-&green,
&cmap-&blue,&cmap-&transp);
if&(dsp-&cmap.red)&{
DPRINTK&(&switch3r:&%Xn&,&cmap-&red[0]);
DPRINTK&(&EXIT,&returning&0n&);
static&int&rivafb_updatevar&(int&con,&struct&fb_info&*info)
DPRINTK&(&ENTERn&);
rc&=&(con&&
0)&?&-EINVAL&:&rivafb_pan_display&(&fb_display[con].var,
&&&con,&info);
DPRINTK&(&EXIT,&returning&%dn&,&rc);
static&void&rivafb_blank&(int&blank,&struct&fb_info&*info)
unsigned&char&
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
DPRINTK&(&ENTERn&);
assert&(rivainfo&!=&NULL);
tmp&=&vga_io_rseq&(VGA_SEQ_CLOCK_MODE)&&&~VGA_SR01_SCREEN_OFF;
if&(blank)
tmp&|=&VGA_SR01_SCREEN_OFF;
vga_io_wseq&(VGA_SEQ_CLOCK_MODE,&tmp);
DPRINTK&(&EXITn&);
/*&-------------------------------------------------------------------------
&*&internal&fb_ops&helper&functions
&*&-------------------------------------------------------------------------
&*&riva_get_cmap_len
&*&DESCRIPTION:
static&int&riva_get_cmap_len&(const&struct&fb_var_screeninfo&*var)
int&rc&=&16;
/*&reasonable&default&*/
assert&(var&!=&NULL);
switch&(var-&bits_per_pixel)&{
#ifdef&FBCON_HAS_CFB4
rc&=&16; /*&pseudocolor...&16&entries&HW&palette&*/
#ifdef&FBCON_HAS_CFB8
rc&=&256; /*&pseudocolor...&256&entries&HW&palette&*/
#ifdef&FBCON_HAS_CFB16
rc&=&16; /*&directcolor...&16&entries&SW&palette&*/
/*&Mystique:&truecolor,&16&entries&SW&palette,&HW&palette&hardwired&into&1:1&mapping&*/
#ifdef&FBCON_HAS_CFB32
rc&=&16; /*&directcolor...&16&entries&SW&palette&*/
/*&Mystique:&truecolor,&16&entries&SW&palette,&HW&palette&hardwired&into&1:1&mapping&*/
assert&(0);
/*&should&not&occur&*/
&*&riva_getcolreg
&*&@regno:
&*&@green:
&*&@transp:
&*&@info:&pointer&to&rivafb_info&object&containing&info&for&current&riva&board
&*&DESCRIPTION:
&*&Read&a&single&color&register&and&split&it&into&colors/transparent.
&*&The&return&values&must&have&a&16&bit&magnitude.
&*&Return&!=&0&for&invalid&regno.
&*&CALLED&FROM:
&*&fbcmap.c:fb_get_cmap()
&* fbgen.c:fbgen_get_cmap()
&* fbgen.c:fbgen_switch()
static&int&riva_getcolreg&(unsigned&regno,&unsigned&*red,&unsigned&*green,
&&&unsigned&*blue,&unsigned&*transp,
&&&struct&fb_info&*info)
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
if&(regno&&=&riva_get_cmap_len(&rivainfo-&currcon_display-&var))
*red&=&rivainfo-&palette[regno].
*green&=&rivainfo-&palette[regno].
*blue&=&rivainfo-&palette[regno].
*transp&=&0;
&*&riva_setcolreg
&*&@regno:
&*&@green:
&*&@transp:
&*&@info:&pointer&to&rivafb_info&object&containing&info&for&current&riva&board
&*&DESCRIPTION:
&*&Set&a&single&color&register.&The&values&supplied&have&a&16&bit
&*&magnitude.
&*&Return&!=&0&for&invalid&regno.
&*&CALLED&FROM:
&*&fbcmap.c:fb_set_cmap()
&* fbgen.c:fbgen_get_cmap()
&* fbgen.c:fbgen_install_cmap()
fbgen.c:fbgen_set_var()
fbgen.c:fbgen_switch()
fbgen.c:fbgen_blank()
&* fbgen.c:fbgen_blank()
static&int&riva_setcolreg&(unsigned&regno,&unsigned&red,&unsigned&green,
&&&unsigned&blue,&unsigned&transp,
&&&struct&fb_info&*info)
struct&rivafb_info&*rivainfo&=&(struct&rivafb_info&*)&
struct&display&*p;
unsigned&shift&=&8;
DPRINTK&(&ENTERn&);
assert&(rivainfo&!=&NULL);
assert&(rivainfo-&currcon_display&!=&NULL);
p&=&rivainfo-&currcon_
if&(regno&&=&riva_get_cmap_len(&p-&var))
return&-EINVAL;
rivainfo-&palette[regno].red&=&
rivainfo-&palette[regno].green&=&
rivainfo-&palette[regno].blue&=&
if&(p-&var.grayscale)&{
/*&gray&=&0.30*R&+&0.59*G&+&0.11*B&*/
red&=&green&=&blue&=
&&&&(red&*&77&+&green&*&151&+&blue&*&28)&&&&8;
switch&(rivainfo-&riva.Architecture)&{
shift&=&10;
shift&=&8;
switch&(p-&var.bits_per_pixel)&{
#ifdef&FBCON_HAS_CFB8
/*&&transparent&&stuff&is&completely&ignored.&*/
riva_wclut&(regno,&red&&&&shift,&green&&&&shift,&blue&&&&shift);
/*&FBCON_HAS_CFB8&*/
#ifdef&FBCON_HAS_CFB16
assert&(regno&&&16);
#ifdef&CONFIG_PREP
rivainfo-&con_cmap.cfb16[regno]&=
&&&&((red&&&0xf800)&&&&9)&|
&&&&((green&&&0xf800)&&&&14)&|
&&&&((green&&&0xf800)&&&&2)&|&((blue&&&0xf800)&&&&3);
rivainfo-&con_cmap.cfb16[regno]&=
&&&&((red&&&0xf800)&&&&1)&|
&&&&((green&&&0xf800)&&&&6)&|&((blue&&&0xf800)&&&&11);
/*&FBCON_HAS_CFB16&*/
#ifdef&FBCON_HAS_CFB32
assert&(regno&&&16);
#ifdef&CONFIG_PREP
rivainfo-&con_cmap.cfb32[regno]&=
&&&&((red&&&0xff00))&|
&&&&((green&&&0xff00)&&&&8)&|&((blue&&&0xff00)&&&&16);
rivainfo-&con_cmap.cfb32[regno]&=
&&&&((red&&&0xff00)&&&&8)&|
&&&&((green&&&0xff00))&|&((blue&&&0xff00)&&&&8);
/*&FBCON_HAS_CFB32&*/
/*&do&nothing&*/
&*&riva_load_video_mode()
&*&calculate&some&timings&and&then&send&em&off&to&riva_load_state()
static&void&riva_load_video_mode&(struct&rivafb_info&*rinfo,
&&struct&fb_var_screeninfo&*video_mode)
struct&riva_regs&
int&bpp,&width,&hDisplaySize,&hDisplay,&hStart,
&&&&hEnd,&hTotal,&height,&vDisplay,&vStart,&vEnd,&vTotal,&dotC
/*&time&to&calculate&*/
bpp&=&video_mode-&bits_per_
width&=&hDisplaySize&=&video_mode-&
hDisplay&=&(hDisplaySize&/&8)&-&1;
hStart&=&(hDisplaySize&+&video_mode-&right_margin)&/&8&+&2;
hEnd&=&(hDisplaySize&+&video_mode-&right_margin&+
video_mode-&hsync_len)&/&8&-&1;
hTotal&=&(hDisplaySize&+&video_mode-&right_margin&+
&&video_mode-&hsync_len&+&video_mode-&left_margin)&/&8&-&1;
height&=&video_mode-&
vDisplay&=&video_mode-&yres&-&1;
vStart&=&video_mode-&yres&+&video_mode-&lower_margin&-&1;
vEnd&=&video_mode-&yres&+&video_mode-&lower_margin&+
&&&&video_mode-&vsync_len&-&1;
vTotal&=&video_mode-&yres&+&video_mode-&lower_margin&+
&&&&video_mode-&vsync_len&+&video_mode-&upper_margin&+&2;
dotClock&=&&/&video_mode-&
memcpy&(&newmode,&&reg_template,&sizeof&(struct&riva_regs));
newmode.crtc[0x0]&=&Set8Bits&(hTotal&-&4);
newmode.crtc[0x1]&=&Set8Bits&(hDisplay);
newmode.crtc[0x2]&=&Set8Bits&(hDisplay);
newmode.crtc[0x3]&=&SetBitField&(hTotal,&4:&0,&4:0)&|&SetBit&(7);
newmode.crtc[0x4]&=&Set8Bits&(hStart);
newmode.crtc[0x5]&=&SetBitField&(hTotal,&5:&5,&7:7)
|&SetBitField&(hEnd,&4:&0,&4:0);
newmode.crtc[0x6]&=&SetBitField&(vTotal,&7:&0,&7:0);
newmode.crtc[0x7]&=&SetBitField&(vTotal,&8:&8,&0:0)
|&SetBitField&(vDisplay,&8:&8,&1:1)
|&SetBitField&(vStart,&8:&8,&2:2)
|&SetBitField&(vDisplay,&8:&8,&3:3)
|&SetBit&(4)
|&SetBitField&(vTotal,&9:&9,&5:5)
|&SetBitField&(vDisplay,&9:&9,&6:6)
|&SetBitField&(vStart,&9:&9,&7:7);
newmode.crtc[0x9]&=&SetBitField&(vDisplay,&9:&9,&5:5)
|&SetBit&(6);
newmode.crtc[0x10]&=&Set8Bits&(vStart);
newmode.crtc[0x11]&=&SetBitField&(vEnd,&3:&0,&3:0)
|&SetBit&(5);
newmode.crtc[0x12]&=&Set8Bits&(vDisplay);
newmode.crtc[0x13]&=&((width&/&8)&*&(bpp&/&8))&&&0xFF;
newmode.crtc[0x15]&=&Set8Bits&(vDisplay);
newmode.crtc[0x16]&=&Set8Bits&(vTotal&+&1);
newmode.ext.bpp&=&
newmode.ext.width&=&
newmode.ext.height&=&
rinfo-&riva.CalcStateExt&(&rinfo-&riva,&&newmode.ext,&bpp,&width,
&&hDisplaySize,&hDisplay,&hStart,&hEnd,
&&hTotal,&height,&vDisplay,&vStart,&vEnd,
&&vTotal,&dotClock);
rinfo-&initial_state&=&
riva_load_state&(rinfo,&&newmode);
/*&-------------------------------------------------------------------------&*/
&&&&&*&&Modularization
static&struct&pci_driver&rivafb_driver&=&{
id_table: rivafb_pci_tbl,
rivafb_init_one,
rivafb_remove_one,
int&__init&rivafb_init&(void)
return&pci_module_init&(&rivafb_driver);
static&void&__exit&rivafb_exit&(void)
pci_unregister_driver&(&rivafb_driver);
#ifdef&MODULE
module_init(rivafb_init);
/*&MODULE&*/
module_exit(rivafb_exit);
MODULE_AUTHOR(&Ani&Joshi,&maintainer&);
MODULE_DESCRIPTION(&Framebuffer&driver&for&nVidia&Riva&128,&TNT,&TNT2&);
/*&from&GGI&*/
static&void&riva_save_state&(struct&rivafb_info&*rinfo,&struct&riva_regs&*regs)
outb&(rinfo-&riva.LockUnlockIndex,&rinfo-&riva.LockUnlockIO);
outb&(0x57,&rinfo-&riva.LockUnlockIO&+&1);
rinfo-&riva.UnloadStateExt&(&rinfo-&riva,&&regs-&ext);
regs-&misc_output&=&io_in8&(0x3CC);
for&(i&=&0;&i&&&NUM_CRT_REGS;&i++)&{
io_out8&(i,&0x3D4);
regs-&crtc[i]&=&io_in8&(0x3D5);
for&(i&=&0;&i&&&NUM_ATC_REGS;&i++)&{
io_out8&(i,&0x3C0);
regs-&attr[i]&=&io_in8&(0x3C1);
for&(i&=&0;&i&&&NUM_GRC_REGS;&i++)&{
io_out8&(i,&0x3CE);
regs-&gra[i]&=&io_in8&(0x3CF);
for&(i&=&0;&i&&&NUM_SEQ_REGS;&i++)&{
io_out8&(i,&0x3C4);
regs-&seq[i]&=&io_in8&(0x3C5);
/*&from&GGI&*/
void&riva_load_state&(struct&rivafb_info&*rinfo,&struct&riva_regs&*regs)
RIVA_HW_STATE&*state&=&&regs-&
io_out8&(0x11,&0x3D4);
io_out8&(0x00,&0x3D5);
outb&(rinfo-&riva.LockUnlockIndex,&rinfo-&riva.LockUnlockIO);
outb&(0x57,&rinfo-&riva.LockUnlockIO&+&1);
rinfo-&riva.LoadStateExt&(&rinfo-&riva,&state);
io_out8&(regs-&misc_output,&0x3C2);
for&(i&=&0;&i&&&NUM_CRT_REGS;&i++)&{
if&(i&&&0x19)&{
io_out8&(i,&0x3D4);
io_out8&(regs-&crtc[i],&0x3D5);
switch&(i)&{
case&0x19:
case&0x20:
case&0x21:
case&0x22:
case&0x23:
case&0x24:
case&0x25:
case&0x26:
case&0x27:
case&0x28:
case&0x29:
case&0x2a:
case&0x2b:
case&0x2c:
case&0x2d:
case&0x2e:
case&0x2f:
case&0x30:
case&0x31:
case&0x32:
case&0x33:
case&0x34:
case&0x35:
case&0x36:
case&0x37:
case&0x38:
case&0x39:
case&0x3a:
case&0x3b:
case&0x3c:
case&0x3d:
case&0x3e:
case&0x3f:
case&0x40:
io_out8&(i,&0x3D4);
io_out8&(regs-&crtc[i],&0x3D5);
for&(i&=&0;&i&&&NUM_ATC_REGS;&i++)&{
io_out8&(i,&0x3C0);
io_out8&(regs-&attr[i],&0x3C0);
for&(i&=&0;&i&&&NUM_GRC_REGS;&i++)&{
io_out8&(i,&0x3CE);
io_out8&(regs-&gra[i],&0x3CF);
for&(i&=&0;&i&&&NUM_SEQ_REGS;&i++)&{
io_out8&(i,&0x3C4);
io_out8&(regs-&seq[i],&0x3C5);
&*&riva_board_list_add
&*&@board_list:&Root&node&of&list&of&boards
&*&@new_node:&New&node&to&be&added
&*&DESCRIPTION:
&*&Adds&@new_node&to&the&list&referenced&by&@board_list
&*&RETURNS:
&*&New&root&node
struct&rivafb_info&*riva_board_list_add&(struct&rivafb_info&*board_list,
&struct&rivafb_info&*new_node)
struct&rivafb_info&*i_p&=&board_
new_node-&next&=&NULL;
if&(board_list&==&NULL)
return&new_
while&(i_p-&next&!=&NULL)
i_p&=&i_p-&
i_p-&next&=&new_
return&board_
&*&riva_board_list_del
&*&@board_list:&Root&node&of&list&of&boards
&*&@del_node:&Node&to&be&removed
&*&DESCRIPTION:
&*&Removes&@del_node&from&the&list&referenced&by&@board_list
&*&RETURNS:
&*&New&root&node
struct&rivafb_info&*riva_board_list_del&(struct&rivafb_info&*board_list,
&struct&rivafb_info&*del_node)
struct&rivafb_info&*i_p&=&board_
if&(board_list&==&del_node)
return&del_node-&
while&(i_p-&next&!=&del_node)
i_p&=&i_p-&
i_p-&next&=&del_node-&
return&board_
CopyRight & 2008- All Rights reserved. 苏ICP备
号 京公网安备:95

我要回帖

更多关于 trying fbdev driver 的文章

 

随机推荐