comparison drivers/mga_vid.c @ 95:2c2d82db06ef

mga_force_memsize->mga_ram_size
author arpi_esp
date Mon, 12 Mar 2001 01:57:14 +0000
parents fbd99740af99
children 7fe6855f19cd
comparison
equal deleted inserted replaced
94:fbd99740af99 95:2c2d82db06ef
151 151
152 static int mga_src_base = 0; // YUV buffer position in video memory 152 static int mga_src_base = 0; // YUV buffer position in video memory
153 153
154 static uint32_t mga_ram_size = 0; // how much megabytes videoram we have 154 static uint32_t mga_ram_size = 0; // how much megabytes videoram we have
155 155
156 static int mga_force_memsize = 0; 156 //static int mga_force_memsize = 0;
157 157
158 MODULE_PARM(mga_force_memsize, "i"); 158 MODULE_PARM(mga_ram_size, "i");
159 159
160 160
161 static struct pci_dev *pci_dev; 161 static struct pci_dev *pci_dev;
162 162
163 static mga_vid_config_t mga_config; 163 static mga_vid_config_t mga_config;
736 #ifdef MGA_MEMORY_SIZE 736 #ifdef MGA_MEMORY_SIZE
737 mga_ram_size = MGA_MEMORY_SIZE; 737 mga_ram_size = MGA_MEMORY_SIZE;
738 printk(KERN_INFO "mga_vid: hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size); 738 printk(KERN_INFO "mga_vid: hard-coded RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
739 739
740 #else 740 #else
741 if (mga_force_memsize) { 741 if (mga_ram_size) {
742 printk(KERN_INFO "mga_vid: memsize forced to %d MB\n", mga_force_memsize); 742 printk(KERN_INFO "mga_vid: RAMSIZE forced to %d MB\n", mga_ram_size);
743 /* we need the size in bytes */
744 mga_ram_size = ((unsigned long) mga_force_memsize);
745 } else { 743 } else {
746 744
747 if (is_g400){ 745 if (is_g400){
748 switch((card_option>>10)&0x17){ 746 switch((card_option>>10)&0x17){
749 // SDRAM: 747 // SDRAM:
750 case 0x00: 748 case 0x00:
751 case 0x04: mga_ram_size = 16; break; 749 case 0x04: mga_ram_size = 16; break;
752 case 0x03: 750 case 0x03:
758 case 0x12: mga_ram_size = 16; break; 756 case 0x12: mga_ram_size = 16; break;
759 default: 757 default:
760 mga_ram_size = 16; 758 mga_ram_size = 16;
761 printk(KERN_INFO "mga_vid: Couldn't detect RAMSIZE, assuming 16MB!"); 759 printk(KERN_INFO "mga_vid: Couldn't detect RAMSIZE, assuming 16MB!");
762 } 760 }
763 #if 0 761 }else{
764 switch((card_option>>10)&7){
765 case 0:
766 case 4: mga_ram_size = ((card_option>>14)&1)? 32:16; break;
767 case 1:
768 case 2: mga_ram_size = 16; break; // SGRAM
769 case 3:
770 case 5: mga_ram_size = 64; break; // SDRAM
771 // case 4: mga_ram_size = 32; break; // SGRAM
772 default: mga_ram_size = 16;
773 }
774 #endif
775 }else{
776 switch((card_option>>11)&3){ 762 switch((card_option>>11)&3){
777 case 0: mga_ram_size = 8; break; 763 case 0: mga_ram_size = 8; break;
778 default: mga_ram_size = 16; 764 default: mga_ram_size = 16;
779 } 765 }
780 } } 766 }
781 #if 0 767 #if 0
782 // printk("List resources -----------\n"); 768 // printk("List resources -----------\n");
783 for(temp=0;temp<DEVICE_COUNT_RESOURCE;temp++){ 769 for(temp=0;temp<DEVICE_COUNT_RESOURCE;temp++){
784 struct resource *res=&pci_dev->resource[temp]; 770 struct resource *res=&pci_dev->resource[temp];
785 if(res->flags){ 771 if(res->flags){
786 int size=(1+res->end-res->start)>>20; 772 int size=(1+res->end-res->start)>>20;
787 printk(KERN_DEBUG "res %d: start: 0x%X end: 0x%X (%d MB) flags=0x%X\n",temp,res->start,res->end,size,res->flags); 773 printk(KERN_DEBUG "res %d: start: 0x%X end: 0x%X (%d MB) flags=0x%X\n",temp,res->start,res->end,size,res->flags);
788 if(res->flags&(IORESOURCE_MEM|IORESOURCE_PREFETCH)){ 774 if(res->flags&(IORESOURCE_MEM|IORESOURCE_PREFETCH)){
789 if(size>mga_ram_size && size<=64) mga_ram_size=size; 775 if(size>mga_ram_size && size<=64) mga_ram_size=size;
790 } 776 }
777 }
791 } 778 }
792 } 779 #endif
793 #endif 780 printk(KERN_INFO "mga_vid: detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size);
794 781 }
795 printk(KERN_INFO "mga_vid: detected RAMSIZE is %d MB\n", (unsigned int) mga_ram_size); 782
796 #endif 783 #endif
797 784
798 #ifdef MGA_ALLOW_IRQ 785 #ifdef MGA_ALLOW_IRQ
799 if ( mga_irq != -1 ) { 786 if ( mga_irq != -1 ) {
800 int tmp = request_irq(mga_irq, mga_handle_irq, SA_INTERRUPT | SA_SHIRQ, "Syncfb Time Base", &mga_irq); 787 int tmp = request_irq(mga_irq, mga_handle_irq, SA_INTERRUPT | SA_SHIRQ, "Syncfb Time Base", &mga_irq);
912 mga_vid_in_use = 0; 899 mga_vid_in_use = 0;
913 900
914 // printk(KERN_INFO "Matrox MGA G200/G400 YUV Video interface v0.01 (c) Aaron Holtzman \n"); 901 // printk(KERN_INFO "Matrox MGA G200/G400 YUV Video interface v0.01 (c) Aaron Holtzman \n");
915 printk(KERN_INFO "Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n"); 902 printk(KERN_INFO "Matrox MGA G200/G400/G450 YUV Video interface v2.01 (c) Aaron Holtzman & A'rpi\n");
916 903
917 if (mga_force_memsize) { 904 if (mga_ram_size) {
918 if (mga_force_memsize != 16 && mga_force_memsize != 32 && 905 if (mga_ram_size<4 || mga_ram_size>64) {
919 mga_force_memsize != 64) { 906 printk(KERN_ERR "mga_vid: invalid RAMSIZE: %d MB\n", mga_ram_size);
920 printk(KERN_ERR "mga_vid: invalid memsize: %dMB\n", mga_force_memsize);
921 return -EINVAL; 907 return -EINVAL;
922 } 908 }
923 } 909 }
924 910
925 if(register_chrdev(MGA_VID_MAJOR, "mga_vid", &mga_vid_fops)) 911 if(register_chrdev(MGA_VID_MAJOR, "mga_vid", &mga_vid_fops))