Mercurial > mplayer.hg
comparison drivers/radeon/radeonfb.c @ 1951:b2b85982fc0e
MTRR autoconfigure
author | nick |
---|---|
date | Tue, 25 Sep 2001 07:20:42 +0000 |
parents | 7c36fd5e6d22 |
children | 9d528800f110 |
comparison
equal
deleted
inserted
replaced
1950:940c467eae09 | 1951:b2b85982fc0e |
---|---|
29 * Minor code cleanup (by NK), | 29 * Minor code cleanup (by NK), |
30 * Enable CRT port on VE (by NK), | 30 * Enable CRT port on VE (by NK), |
31 * Disable SURFACE_CNTL because mplayer doesn't work | 31 * Disable SURFACE_CNTL because mplayer doesn't work |
32 * propertly (by NK) | 32 * propertly (by NK) |
33 * 0.1.0-ve.1 | 33 * 0.1.0-ve.1 |
34 * | 34 * 2001-09-25 MTRR support (by NK) |
35 * Special thanks to ATI DevRel team for their hardware donations. | 35 * Special thanks to ATI DevRel team for their hardware donations. |
36 * | 36 * |
37 * LIMITATIONS: on dualhead Radeons (VE, M6, M7) driver doesn't work in | 37 * LIMITATIONS: on dualhead Radeons (VE, M6, M7) driver doesn't work in |
38 * dual monitor configuration. TVout is not supported too. | 38 * dual monitor configuration. TVout is not supported too. |
39 * Probably these problems can be solved by importing XFree86 code, which | 39 * Probably these problems can be solved by importing XFree86 code, which |
72 #include <video/fbcon.h> | 72 #include <video/fbcon.h> |
73 #include <video/fbcon-cfb8.h> | 73 #include <video/fbcon-cfb8.h> |
74 #include <video/fbcon-cfb16.h> | 74 #include <video/fbcon-cfb16.h> |
75 #include <video/fbcon-cfb24.h> | 75 #include <video/fbcon-cfb24.h> |
76 #include <video/fbcon-cfb32.h> | 76 #include <video/fbcon-cfb32.h> |
77 | |
78 #ifdef CONFIG_MTRR | |
79 #include <asm/mtrr.h> | |
80 #endif | |
77 | 81 |
78 #include "radeon.h" | 82 #include "radeon.h" |
79 | 83 |
80 | 84 |
81 #define DEBUG 0 | 85 #define DEBUG 0 |
279 | 283 |
280 struct ram_info ram; | 284 struct ram_info ram; |
281 | 285 |
282 u32 hack_crtc_ext_cntl; | 286 u32 hack_crtc_ext_cntl; |
283 u32 hack_crtc_v_sync_strt_wid; | 287 u32 hack_crtc_v_sync_strt_wid; |
284 | 288 #ifdef CONFIG_MTRR |
289 struct { int vram; int vram_valid; } mtrr; | |
290 #endif | |
285 #if defined(FBCON_HAS_CFB16) || defined(FBCON_HAS_CFB32) | 291 #if defined(FBCON_HAS_CFB16) || defined(FBCON_HAS_CFB32) |
286 union { | 292 union { |
287 #if defined(FBCON_HAS_CFB16) | 293 #if defined(FBCON_HAS_CFB16) |
288 u_int16_t cfb16[16]; | 294 u_int16_t cfb16[16]; |
289 #endif | 295 #endif |
527 */ | 533 */ |
528 | 534 |
529 static char fontname[40] __initdata; | 535 static char fontname[40] __initdata; |
530 static char *mode_option __initdata; | 536 static char *mode_option __initdata; |
531 static char noaccel __initdata = 0; | 537 static char noaccel __initdata = 0; |
538 static int nomtrr __initdata = 0; | |
532 | 539 |
533 #if 0 | 540 #if 0 |
534 #ifdef FBCON_HAS_CFB8 | 541 #ifdef FBCON_HAS_CFB8 |
535 static struct display_switch fbcon_radeon8; | 542 static struct display_switch fbcon_radeon8; |
536 #endif | 543 #endif |
544 #endif | |
545 | |
546 #ifdef CONFIG_MTRR | |
547 static int mtrr = 1; | |
537 #endif | 548 #endif |
538 | 549 |
539 /* | 550 /* |
540 * prototypes | 551 * prototypes |
541 */ | 552 */ |
604 }; | 615 }; |
605 | 616 |
606 | 617 |
607 int __init radeonfb_init (void) | 618 int __init radeonfb_init (void) |
608 { | 619 { |
609 return pci_module_init (&radeonfb_driver); | 620 #ifdef CONFIG_MTRR |
621 if (nomtrr) { | |
622 mtrr = 0; | |
623 printk("radeonfb: Parameter NOMTRR set\n"); | |
624 } | |
625 #endif | |
626 return pci_module_init (&radeonfb_driver); | |
610 } | 627 } |
611 | 628 |
612 | 629 |
613 void __exit radeonfb_exit (void) | 630 void __exit radeonfb_exit (void) |
614 { | 631 { |
635 break; | 652 break; |
636 memcpy(fontname, this_opt + 5, i); | 653 memcpy(fontname, this_opt + 5, i); |
637 } else if (!strncmp(this_opt, "noaccel", 7)) { | 654 } else if (!strncmp(this_opt, "noaccel", 7)) { |
638 noaccel = 1; | 655 noaccel = 1; |
639 } | 656 } |
657 #ifdef CONFIG_MTRR | |
658 else if(!strncmp(this_opt, "nomtrr", 6)) { | |
659 mtrr = 0; | |
660 } | |
661 #endif | |
640 else mode_option = this_opt; | 662 else mode_option = this_opt; |
641 } | 663 } |
642 | 664 |
643 return 0; | 665 return 0; |
644 } | 666 } |
649 #endif | 671 #endif |
650 | 672 |
651 | 673 |
652 MODULE_AUTHOR("Ani Joshi. (Radeon VE extensions by Nick Kurshev)"); | 674 MODULE_AUTHOR("Ani Joshi. (Radeon VE extensions by Nick Kurshev)"); |
653 MODULE_DESCRIPTION("framebuffer driver for ATI Radeon chipset. Ver: "RADEON_VERSION); | 675 MODULE_DESCRIPTION("framebuffer driver for ATI Radeon chipset. Ver: "RADEON_VERSION); |
676 #ifdef CONFIG_MTRR | |
677 MODULE_PARM(nomtrr, "i"); | |
678 MODULE_PARM_DESC(nomtrr, "Don't touch MTRR (touch=0(default))"); | |
679 #endif | |
654 | 680 |
655 static char * GET_MON_NAME(int type) | 681 static char * GET_MON_NAME(int type) |
656 { | 682 { |
657 char *pret; | 683 char *pret; |
658 switch(type) | 684 switch(type) |
949 printk("radeonfb: CRT port has %s monitor connected\n",GET_MON_NAME(rinfo->crtDispType)); | 975 printk("radeonfb: CRT port has %s monitor connected\n",GET_MON_NAME(rinfo->crtDispType)); |
950 } | 976 } |
951 else | 977 else |
952 printk("radeonfb: CRT port has %s monitor connected\n",GET_MON_NAME(rinfo->crtDispType)); | 978 printk("radeonfb: CRT port has %s monitor connected\n",GET_MON_NAME(rinfo->crtDispType)); |
953 printk("radeonfb: This card has %sTVout\n",rinfo->hasTVout ? "" : "no "); | 979 printk("radeonfb: This card has %sTVout\n",rinfo->hasTVout ? "" : "no "); |
980 #ifdef CONFIG_MTRR | |
981 if (mtrr) { | |
982 rinfo->mtrr.vram = mtrr_add(rinfo->fb_base_phys, | |
983 rinfo->video_ram, MTRR_TYPE_WRCOMB, 1); | |
984 rinfo->mtrr.vram_valid = 1; | |
985 /* let there be speed */ | |
986 printk("radeonfb: MTRR set to ON\n"); | |
987 } | |
988 #endif /* CONFIG_MTRR */ | |
954 | 989 |
955 return 0; | 990 return 0; |
956 } | 991 } |
957 | 992 |
958 | 993 |
966 | 1001 |
967 /* restore original state */ | 1002 /* restore original state */ |
968 radeon_write_mode (rinfo, &rinfo->init_state); | 1003 radeon_write_mode (rinfo, &rinfo->init_state); |
969 | 1004 |
970 unregister_framebuffer ((struct fb_info *) rinfo); | 1005 unregister_framebuffer ((struct fb_info *) rinfo); |
971 | 1006 #ifdef CONFIG_MTRR |
1007 if (rinfo->mtrr.vram_valid) | |
1008 mtrr_del(rinfo->mtrr.vram, rinfo->fb_base_phys, | |
1009 rinfo->video_ram); | |
1010 #endif /* CONFIG_MTRR */ | |
972 iounmap ((void*)rinfo->mmio_base); | 1011 iounmap ((void*)rinfo->mmio_base); |
973 iounmap ((void*)rinfo->fb_base); | 1012 iounmap ((void*)rinfo->fb_base); |
974 | 1013 |
975 release_mem_region (rinfo->mmio_base_phys, | 1014 release_mem_region (rinfo->mmio_base_phys, |
976 pci_resource_len(pdev, 2)); | 1015 pci_resource_len(pdev, 2)); |
1938 newmode.crtc_ext_cntl = VGA_ATI_LINEAR | XCRT_CNT_EN | CRTC_CRT_ON; | 1977 newmode.crtc_ext_cntl = VGA_ATI_LINEAR | XCRT_CNT_EN | CRTC_CRT_ON; |
1939 else newmode.crtc_ext_cntl = VGA_ATI_LINEAR | XCRT_CNT_EN; | 1978 else newmode.crtc_ext_cntl = VGA_ATI_LINEAR | XCRT_CNT_EN; |
1940 newmode.dac_cntl = INREG(DAC_CNTL) | DAC_MASK_ALL | DAC_VGA_ADR_EN | | 1979 newmode.dac_cntl = INREG(DAC_CNTL) | DAC_MASK_ALL | DAC_VGA_ADR_EN | |
1941 DAC_8BIT_EN; | 1980 DAC_8BIT_EN; |
1942 | 1981 |
1943 newmode.crtc_h_total_disp = ((((hTotal / 8) - 1) & 0xffff) | | 1982 newmode.crtc_h_total_disp = ((((hTotal / 8) - 1) & 0x3ff) | |
1944 (((mode->xres / 8) - 1) << 16)); | 1983 ((((mode->xres / 8) - 1) & 0x1ff) << 16)); |
1945 | 1984 |
1946 newmode.crtc_h_sync_strt_wid = ((hsync_start & 0x1fff) | | 1985 newmode.crtc_h_sync_strt_wid = ((hsync_start & 0x1fff) | |
1947 (hsync_wid << 16) | (h_sync_pol << 23)); | 1986 (hsync_wid << 16) | (h_sync_pol << 23)); |
1948 | 1987 |
1949 newmode.crtc_v_total_disp = ((vTotal - 1) & 0xffff) | | 1988 newmode.crtc_v_total_disp = ((vTotal - 1) & 0xffff) | |
2059 if(rinfo->hasCRTC2 && rinfo->crtDispType == MT_CRT && | 2098 if(rinfo->hasCRTC2 && rinfo->crtDispType == MT_CRT && |
2060 (rinfo->dviDispType == MT_NONE || rinfo->dviDispType == MT_STV)) { | 2099 (rinfo->dviDispType == MT_NONE || rinfo->dviDispType == MT_STV)) { |
2061 OUTREG(CRTC_EXT_CNTL, rinfo->hack_crtc_ext_cntl); | 2100 OUTREG(CRTC_EXT_CNTL, rinfo->hack_crtc_ext_cntl); |
2062 OUTREG(CRTC_V_SYNC_STRT_WID, rinfo->hack_crtc_v_sync_strt_wid); | 2101 OUTREG(CRTC_V_SYNC_STRT_WID, rinfo->hack_crtc_v_sync_strt_wid); |
2063 } | 2102 } |
2064 | |
2065 return; | 2103 return; |
2066 } | 2104 } |
2067 | 2105 |
2068 | 2106 |
2069 /***** | 2107 /***** |