aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/sis
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2007-05-08 03:39:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:15:33 -0400
commit0959f0ca29244ae983b406fba313816a29244be7 (patch)
tree1dd6c165a9298418eab3965eaec4d5c6727e6b50 /drivers/video/sis
parentc831c338f0ad299fcd1592c6e4f30657480f39af (diff)
drivers/video/sis/: remove more kernel 2.4 code
Signed-off-by: Adrian Bunk <bunk@stusta.de> Cc: Thomas Winischhofer <thomas@winischhofer.net> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/sis')
-rw-r--r--drivers/video/sis/osdef.h5
-rw-r--r--drivers/video/sis/sis.h50
-rw-r--r--drivers/video/sis/sis_main.c105
3 files changed, 22 insertions, 138 deletions
diff --git a/drivers/video/sis/osdef.h b/drivers/video/sis/osdef.h
index d048bd39961b..c1492782cb18 100644
--- a/drivers/video/sis/osdef.h
+++ b/drivers/video/sis/osdef.h
@@ -58,9 +58,6 @@
58#define SIS_LINUX_KERNEL /* Linux kernel framebuffer */ 58#define SIS_LINUX_KERNEL /* Linux kernel framebuffer */
59#undef SIS_XORG_XF86 /* XFree86/X.org */ 59#undef SIS_XORG_XF86 /* XFree86/X.org */
60 60
61#undef SIS_LINUX_KERNEL_24
62#undef SIS_LINUX_KERNEL_26
63
64#ifdef OutPortByte 61#ifdef OutPortByte
65#undef OutPortByte 62#undef OutPortByte
66#endif 63#endif
@@ -100,8 +97,6 @@
100#define SIS315H 97#define SIS315H
101#endif 98#endif
102 99
103#define SIS_LINUX_KERNEL_26
104
105#if !defined(SIS300) && !defined(SIS315H) 100#if !defined(SIS300) && !defined(SIS315H)
106#warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set 101#warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set
107#warning sisfb will not work! 102#warning sisfb will not work!
diff --git a/drivers/video/sis/sis.h b/drivers/video/sis/sis.h
index b1826d3c5222..d5e2d9c27847 100644
--- a/drivers/video/sis/sis.h
+++ b/drivers/video/sis/sis.h
@@ -27,11 +27,7 @@
27#include <linux/version.h> 27#include <linux/version.h>
28 28
29#include "osdef.h" 29#include "osdef.h"
30#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
31#include <video/sisfb.h> 30#include <video/sisfb.h>
32#else
33#include <linux/sisfb.h>
34#endif
35 31
36#include "vgatypes.h" 32#include "vgatypes.h"
37#include "vstruct.h" 33#include "vstruct.h"
@@ -40,12 +36,8 @@
40#define VER_MINOR 8 36#define VER_MINOR 8
41#define VER_LEVEL 9 37#define VER_LEVEL 9
42 38
43#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
44#include <linux/spinlock.h> 39#include <linux/spinlock.h>
45#define SIS_PCI_GET_CLASS(a, b) pci_get_class(a, b) 40
46#define SIS_PCI_GET_DEVICE(a,b,c) pci_get_device(a,b,c)
47#define SIS_PCI_GET_SLOT(a,b) pci_get_slot(a,b)
48#define SIS_PCI_PUT_DEVICE(a) pci_dev_put(a)
49#ifdef CONFIG_COMPAT 41#ifdef CONFIG_COMPAT
50#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,10) 42#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,10)
51#include <linux/ioctl32.h> 43#include <linux/ioctl32.h>
@@ -54,18 +46,7 @@
54#define SIS_NEW_CONFIG_COMPAT 46#define SIS_NEW_CONFIG_COMPAT
55#endif 47#endif
56#endif /* CONFIG_COMPAT */ 48#endif /* CONFIG_COMPAT */
57#else /* 2.4 */ 49
58#define SIS_PCI_GET_CLASS(a, b) pci_find_class(a, b)
59#define SIS_PCI_GET_DEVICE(a,b,c) pci_find_device(a,b,c)
60#define SIS_PCI_GET_SLOT(a,b) pci_find_slot(a,b)
61#define SIS_PCI_PUT_DEVICE(a)
62#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,19)
63#ifdef __x86_64__ /* Shouldn't we check for CONFIG_IA32_EMULATION here? */
64#include <asm/ioctl32.h>
65#define SIS_OLD_CONFIG_COMPAT
66#endif
67#endif
68#endif /* 2.4 */
69#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8) 50#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,8)
70#define SIS_IOTYPE1 void __iomem 51#define SIS_IOTYPE1 void __iomem
71#define SIS_IOTYPE2 __iomem 52#define SIS_IOTYPE2 __iomem
@@ -497,26 +478,8 @@ struct sis_video_info {
497 478
498 struct fb_var_screeninfo default_var; 479 struct fb_var_screeninfo default_var;
499 480
500#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
501 struct fb_fix_screeninfo sisfb_fix; 481 struct fb_fix_screeninfo sisfb_fix;
502 u32 pseudo_palette[17]; 482 u32 pseudo_palette[17];
503#endif
504
505#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
506 struct display sis_disp;
507 struct display_switch sisfb_sw;
508 struct {
509 u16 red, green, blue, pad;
510 } sis_palette[256];
511 union {
512#ifdef FBCON_HAS_CFB16
513 u16 cfb16[16];
514#endif
515#ifdef FBCON_HAS_CFB32
516 u32 cfb32[16];
517#endif
518 } sis_fbcon_cmap;
519#endif
520 483
521 struct sisfb_monitor { 484 struct sisfb_monitor {
522 u16 hmin; 485 u16 hmin;
@@ -537,10 +500,6 @@ struct sis_video_info {
537 500
538 int mni; /* Mode number index */ 501 int mni; /* Mode number index */
539 502
540#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
541 int currcon;
542#endif
543
544 unsigned long video_size; 503 unsigned long video_size;
545 unsigned long video_base; 504 unsigned long video_base;
546 unsigned long mmio_size; 505 unsigned long mmio_size;
@@ -577,9 +536,6 @@ struct sis_video_info {
577 int sisfb_tvplug; 536 int sisfb_tvplug;
578 int sisfb_tvstd; 537 int sisfb_tvstd;
579 int sisfb_nocrt2rate; 538 int sisfb_nocrt2rate;
580#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
581 int sisfb_inverse;
582#endif
583 539
584 u32 heapstart; /* offset */ 540 u32 heapstart; /* offset */
585 SIS_IOTYPE1 *sisfb_heap_start; /* address */ 541 SIS_IOTYPE1 *sisfb_heap_start; /* address */
@@ -645,9 +601,7 @@ struct sis_video_info {
645 int modechanged; 601 int modechanged;
646 unsigned char modeprechange; 602 unsigned char modeprechange;
647 603
648#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
649 u8 sisfb_lastrates[128]; 604 u8 sisfb_lastrates[128];
650#endif
651 605
652 int newrom; 606 int newrom;
653 int haveXGIROM; 607 int haveXGIROM;
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
index 6e094688a637..a30e1e13d8be 100644
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -1947,7 +1947,7 @@ sisfb_get_northbridge(int basechipid)
1947 default: return NULL; 1947 default: return NULL;
1948 } 1948 }
1949 for(i = 0; i < nbridgenum; i++) { 1949 for(i = 0; i < nbridgenum; i++) {
1950 if((pdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 1950 if((pdev = pci_get_device(PCI_VENDOR_ID_SI,
1951 nbridgeids[nbridgeidx+i], NULL))) 1951 nbridgeids[nbridgeidx+i], NULL)))
1952 break; 1952 break;
1953 } 1953 }
@@ -4612,9 +4612,9 @@ sisfb_find_host_bridge(struct sis_video_info *ivideo, struct pci_dev *mypdev,
4612 unsigned short temp; 4612 unsigned short temp;
4613 int ret = 0; 4613 int ret = 0;
4614 4614
4615 while((pdev = SIS_PCI_GET_CLASS(PCI_CLASS_BRIDGE_HOST, pdev))) { 4615 while((pdev = pci_get_class(PCI_CLASS_BRIDGE_HOST, pdev))) {
4616 temp = pdev->vendor; 4616 temp = pdev->vendor;
4617 SIS_PCI_PUT_DEVICE(pdev); 4617 pci_dev_put(pdev);
4618 if(temp == pcivendor) { 4618 if(temp == pcivendor) {
4619 ret = 1; 4619 ret = 1;
4620 break; 4620 break;
@@ -5153,24 +5153,24 @@ sisfb_post_xgi(struct pci_dev *pdev)
5153 if(reg & 0x80) v2 |= 0x80; 5153 if(reg & 0x80) v2 |= 0x80;
5154 v2 |= 0x01; 5154 v2 |= 0x01;
5155 5155
5156 if((mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0730, NULL))) { 5156 if((mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0730, NULL))) {
5157 SIS_PCI_PUT_DEVICE(mypdev); 5157 pci_dev_put(mypdev);
5158 if(((v2 & 0x06) == 2) || ((v2 & 0x06) == 4)) 5158 if(((v2 & 0x06) == 2) || ((v2 & 0x06) == 4))
5159 v2 &= 0xf9; 5159 v2 &= 0xf9;
5160 v2 |= 0x08; 5160 v2 |= 0x08;
5161 v1 &= 0xfe; 5161 v1 &= 0xfe;
5162 } else { 5162 } else {
5163 mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0735, NULL); 5163 mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0735, NULL);
5164 if(!mypdev) 5164 if(!mypdev)
5165 mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0645, NULL); 5165 mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0645, NULL);
5166 if(!mypdev) 5166 if(!mypdev)
5167 mypdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0650, NULL); 5167 mypdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0650, NULL);
5168 if(mypdev) { 5168 if(mypdev) {
5169 pci_read_config_dword(mypdev, 0x94, &regd); 5169 pci_read_config_dword(mypdev, 0x94, &regd);
5170 regd &= 0xfffffeff; 5170 regd &= 0xfffffeff;
5171 pci_write_config_dword(mypdev, 0x94, regd); 5171 pci_write_config_dword(mypdev, 0x94, regd);
5172 v1 &= 0xfe; 5172 v1 &= 0xfe;
5173 SIS_PCI_PUT_DEVICE(mypdev); 5173 pci_dev_put(mypdev);
5174 } else if(sisfb_find_host_bridge(ivideo, pdev, PCI_VENDOR_ID_SI)) { 5174 } else if(sisfb_find_host_bridge(ivideo, pdev, PCI_VENDOR_ID_SI)) {
5175 v1 &= 0xfe; 5175 v1 &= 0xfe;
5176 } else if(sisfb_find_host_bridge(ivideo, pdev, 0x1106) || 5176 } else if(sisfb_find_host_bridge(ivideo, pdev, 0x1106) ||
@@ -5193,13 +5193,13 @@ sisfb_post_xgi(struct pci_dev *pdev)
5193 if( (!(v1 & 0x02)) && (v2 & 0x30) && (regd < 0xcf) ) 5193 if( (!(v1 & 0x02)) && (v2 & 0x30) && (regd < 0xcf) )
5194 setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01); 5194 setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01);
5195 5195
5196 if((mypdev = SIS_PCI_GET_DEVICE(0x10de, 0x01e0, NULL))) { 5196 if((mypdev = pci_get_device(0x10de, 0x01e0, NULL))) {
5197 /* TODO: set CR5f &0xf1 | 0x01 for version 6570 5197 /* TODO: set CR5f &0xf1 | 0x01 for version 6570
5198 * of nforce 2 ROM 5198 * of nforce 2 ROM
5199 */ 5199 */
5200 if(0) 5200 if(0)
5201 setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01); 5201 setSISIDXREG(SISCR, 0x5f, 0xf1, 0x01);
5202 SIS_PCI_PUT_DEVICE(mypdev); 5202 pci_dev_put(mypdev);
5203 } 5203 }
5204 } 5204 }
5205 5205
@@ -5235,9 +5235,9 @@ sisfb_post_xgi(struct pci_dev *pdev)
5235 setSISIDXREG(SISCR, 0x75, 0xe0, bios[0x4ff] & 0x1f); 5235 setSISIDXREG(SISCR, 0x75, 0xe0, bios[0x4ff] & 0x1f);
5236 setSISIDXREG(SISCR, 0x76, 0xe0, bios[0x500] & 0x1f); 5236 setSISIDXREG(SISCR, 0x76, 0xe0, bios[0x500] & 0x1f);
5237 v1 = bios[0x501]; 5237 v1 = bios[0x501];
5238 if((mypdev = SIS_PCI_GET_DEVICE(0x8086, 0x2530, NULL))) { 5238 if((mypdev = pci_get_device(0x8086, 0x2530, NULL))) {
5239 v1 = 0xf0; 5239 v1 = 0xf0;
5240 SIS_PCI_PUT_DEVICE(mypdev); 5240 pci_dev_put(mypdev);
5241 } 5241 }
5242 outSISIDXREG(SISCR, 0x77, v1); 5242 outSISIDXREG(SISCR, 0x77, v1);
5243 } 5243 }
@@ -5946,7 +5946,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5946 5946
5947 if(!ivideo->sisvga_enabled) { 5947 if(!ivideo->sisvga_enabled) {
5948 if(pci_enable_device(pdev)) { 5948 if(pci_enable_device(pdev)) {
5949 if(ivideo->nbridge) SIS_PCI_PUT_DEVICE(ivideo->nbridge); 5949 if(ivideo->nbridge) pci_dev_put(ivideo->nbridge);
5950 pci_set_drvdata(pdev, NULL); 5950 pci_set_drvdata(pdev, NULL);
5951 kfree(sis_fb_info); 5951 kfree(sis_fb_info);
5952 return -EIO; 5952 return -EIO;
@@ -5973,7 +5973,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5973 "requiring Chrontel/GPIO setup\n", 5973 "requiring Chrontel/GPIO setup\n",
5974 mychswtable[i].vendorName, 5974 mychswtable[i].vendorName,
5975 mychswtable[i].cardName); 5975 mychswtable[i].cardName);
5976 ivideo->lpcdev = SIS_PCI_GET_DEVICE(PCI_VENDOR_ID_SI, 0x0008, NULL); 5976 ivideo->lpcdev = pci_get_device(PCI_VENDOR_ID_SI, 0x0008, NULL);
5977 break; 5977 break;
5978 } 5978 }
5979 i++; 5979 i++;
@@ -5983,7 +5983,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
5983 5983
5984#ifdef CONFIG_FB_SIS_315 5984#ifdef CONFIG_FB_SIS_315
5985 if((ivideo->chip == SIS_760) && (ivideo->nbridge)) { 5985 if((ivideo->chip == SIS_760) && (ivideo->nbridge)) {
5986 ivideo->lpcdev = SIS_PCI_GET_SLOT(ivideo->nbridge->bus, (2 << 3)); 5986 ivideo->lpcdev = pci_get_slot(ivideo->nbridge->bus, (2 << 3));
5987 } 5987 }
5988#endif 5988#endif
5989 5989
@@ -6148,9 +6148,9 @@ error_1: release_mem_region(ivideo->video_base, ivideo->video_size);
6148error_2: release_mem_region(ivideo->mmio_base, ivideo->mmio_size); 6148error_2: release_mem_region(ivideo->mmio_base, ivideo->mmio_size);
6149error_3: vfree(ivideo->bios_abase); 6149error_3: vfree(ivideo->bios_abase);
6150 if(ivideo->lpcdev) 6150 if(ivideo->lpcdev)
6151 SIS_PCI_PUT_DEVICE(ivideo->lpcdev); 6151 pci_dev_put(ivideo->lpcdev);
6152 if(ivideo->nbridge) 6152 if(ivideo->nbridge)
6153 SIS_PCI_PUT_DEVICE(ivideo->nbridge); 6153 pci_dev_put(ivideo->nbridge);
6154 pci_set_drvdata(pdev, NULL); 6154 pci_set_drvdata(pdev, NULL);
6155 if(!ivideo->sisvga_enabled) 6155 if(!ivideo->sisvga_enabled)
6156 pci_disable_device(pdev); 6156 pci_disable_device(pdev);
@@ -6330,70 +6330,6 @@ error_3: vfree(ivideo->bios_abase);
6330 6330
6331 sisfb_set_vparms(ivideo); 6331 sisfb_set_vparms(ivideo);
6332 6332
6333#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
6334
6335 /* ---------------- For 2.4: Now switch the mode ------------------ */
6336
6337 printk(KERN_INFO "sisfb: Setting mode %dx%dx%d (%dHz)\n",
6338 ivideo->video_width, ivideo->video_height, ivideo->video_bpp,
6339 ivideo->refresh_rate);
6340
6341 /* Determine whether or not acceleration is to be
6342 * used. Need to know before pre/post_set_mode()
6343 */
6344 ivideo->accel = 0;
6345 ivideo->default_var.accel_flags &= ~FB_ACCELF_TEXT;
6346 if(ivideo->sisfb_accel) {
6347 ivideo->accel = -1;
6348 ivideo->default_var.accel_flags |= FB_ACCELF_TEXT;
6349 }
6350
6351 /* Now switch the mode */
6352 sisfb_pre_setmode(ivideo);
6353
6354 if(SiSSetMode(&ivideo->SiS_Pr, ivideo->mode_no) == 0) {
6355 printk(KERN_ERR "sisfb: Fatal error: Setting mode[0x%x] failed\n",
6356 ivideo->mode_no);
6357 ret = -EINVAL;
6358 iounmap(ivideo->mmio_vbase);
6359 goto error_0;
6360 }
6361
6362 outSISIDXREG(SISSR, IND_SIS_PASSWORD, SIS_PASSWORD);
6363
6364 sisfb_post_setmode(ivideo);
6365
6366 /* Maximize regardless of sisfb_max at startup */
6367 ivideo->default_var.yres_virtual = 32767;
6368
6369 /* Force reset of x virtual in crtc_to_var */
6370 ivideo->default_var.xres_virtual = 0;
6371
6372 /* Copy mode timing to var */
6373 sisfb_crtc_to_var(ivideo, &ivideo->default_var);
6374
6375 /* Find out about screen pitch */
6376 sisfb_calc_pitch(ivideo, &ivideo->default_var);
6377 sisfb_set_pitch(ivideo);
6378
6379 /* Init the accelerator (does nothing currently) */
6380 sisfb_initaccel(ivideo);
6381
6382 /* Init some fbinfo entries */
6383 sis_fb_info->node = -1;
6384 sis_fb_info->flags = FBINFO_FLAG_DEFAULT;
6385 sis_fb_info->fbops = &sisfb_ops;
6386 sis_fb_info->disp = &ivideo->sis_disp;
6387 sis_fb_info->blank = &sisfb_blank;
6388 sis_fb_info->switch_con = &sisfb_switch;
6389 sis_fb_info->updatevar = &sisfb_update_var;
6390 sis_fb_info->changevar = NULL;
6391 strcpy(sis_fb_info->fontname, sisfb_fontname);
6392
6393 sisfb_set_disp(-1, &ivideo->default_var, sis_fb_info);
6394
6395#else /* --------- For 2.6: Setup a somewhat sane default var ------------ */
6396
6397 printk(KERN_INFO "sisfb: Default mode is %dx%dx%d (%dHz)\n", 6333 printk(KERN_INFO "sisfb: Default mode is %dx%dx%d (%dHz)\n",
6398 ivideo->video_width, ivideo->video_height, ivideo->video_bpp, 6334 ivideo->video_width, ivideo->video_height, ivideo->video_bpp,
6399 ivideo->refresh_rate); 6335 ivideo->refresh_rate);
@@ -6453,7 +6389,6 @@ error_3: vfree(ivideo->bios_abase);
6453 sis_fb_info->pseudo_palette = ivideo->pseudo_palette; 6389 sis_fb_info->pseudo_palette = ivideo->pseudo_palette;
6454 6390
6455 fb_alloc_cmap(&sis_fb_info->cmap, 256 , 0); 6391 fb_alloc_cmap(&sis_fb_info->cmap, 256 , 0);
6456#endif /* 2.6 */
6457 6392
6458 printk(KERN_DEBUG "sisfb: Initial vbflags 0x%x\n", (int)ivideo->vbflags); 6393 printk(KERN_DEBUG "sisfb: Initial vbflags 0x%x\n", (int)ivideo->vbflags);
6459 6394
@@ -6563,10 +6498,10 @@ static void __devexit sisfb_remove(struct pci_dev *pdev)
6563 vfree(ivideo->bios_abase); 6498 vfree(ivideo->bios_abase);
6564 6499
6565 if(ivideo->lpcdev) 6500 if(ivideo->lpcdev)
6566 SIS_PCI_PUT_DEVICE(ivideo->lpcdev); 6501 pci_dev_put(ivideo->lpcdev);
6567 6502
6568 if(ivideo->nbridge) 6503 if(ivideo->nbridge)
6569 SIS_PCI_PUT_DEVICE(ivideo->nbridge); 6504 pci_dev_put(ivideo->nbridge);
6570 6505
6571#ifdef CONFIG_MTRR 6506#ifdef CONFIG_MTRR
6572 /* Release MTRR region */ 6507 /* Release MTRR region */