diff options
Diffstat (limited to 'drivers/video/sis/sis_main.c')
-rw-r--r-- | drivers/video/sis/sis_main.c | 38 |
1 files changed, 11 insertions, 27 deletions
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index b52f8e4ef1fd..7e3370f115b6 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -60,6 +60,11 @@ | |||
60 | #include "sis.h" | 60 | #include "sis.h" |
61 | #include "sis_main.h" | 61 | #include "sis_main.h" |
62 | 62 | ||
63 | #if !defined(CONFIG_FB_SIS_300) && !defined(CONFIG_FB_SIS_315) | ||
64 | #warning Neither CONFIG_FB_SIS_300 nor CONFIG_FB_SIS_315 is set | ||
65 | #warning sisfb will not work! | ||
66 | #endif | ||
67 | |||
63 | static void sisfb_handle_command(struct sis_video_info *ivideo, | 68 | static void sisfb_handle_command(struct sis_video_info *ivideo, |
64 | struct sisfb_cmd *sisfb_command); | 69 | struct sisfb_cmd *sisfb_command); |
65 | 70 | ||
@@ -4114,14 +4119,6 @@ sisfb_find_rom(struct pci_dev *pdev) | |||
4114 | if(sisfb_check_rom(rom_base, ivideo)) { | 4119 | if(sisfb_check_rom(rom_base, ivideo)) { |
4115 | 4120 | ||
4116 | if((myrombase = vmalloc(65536))) { | 4121 | if((myrombase = vmalloc(65536))) { |
4117 | |||
4118 | /* Work around bug in pci/rom.c: Folks forgot to check | ||
4119 | * whether the size retrieved from the BIOS image eventually | ||
4120 | * is larger than the mapped size | ||
4121 | */ | ||
4122 | if(pci_resource_len(pdev, PCI_ROM_RESOURCE) < romsize) | ||
4123 | romsize = pci_resource_len(pdev, PCI_ROM_RESOURCE); | ||
4124 | |||
4125 | memcpy_fromio(myrombase, rom_base, | 4122 | memcpy_fromio(myrombase, rom_base, |
4126 | (romsize > 65536) ? 65536 : romsize); | 4123 | (romsize > 65536) ? 65536 : romsize); |
4127 | } | 4124 | } |
@@ -4155,23 +4152,6 @@ sisfb_find_rom(struct pci_dev *pdev) | |||
4155 | 4152 | ||
4156 | } | 4153 | } |
4157 | 4154 | ||
4158 | #else | ||
4159 | |||
4160 | pci_read_config_dword(pdev, PCI_ROM_ADDRESS, &temp); | ||
4161 | pci_write_config_dword(pdev, PCI_ROM_ADDRESS, | ||
4162 | (ivideo->video_base & PCI_ROM_ADDRESS_MASK) | PCI_ROM_ADDRESS_ENABLE); | ||
4163 | |||
4164 | rom_base = ioremap(ivideo->video_base, 65536); | ||
4165 | if(rom_base) { | ||
4166 | if(sisfb_check_rom(rom_base, ivideo)) { | ||
4167 | if((myrombase = vmalloc(65536))) | ||
4168 | memcpy_fromio(myrombase, rom_base, 65536); | ||
4169 | } | ||
4170 | iounmap(rom_base); | ||
4171 | } | ||
4172 | |||
4173 | pci_write_config_dword(pdev, PCI_ROM_ADDRESS, temp); | ||
4174 | |||
4175 | #endif | 4155 | #endif |
4176 | 4156 | ||
4177 | return myrombase; | 4157 | return myrombase; |
@@ -4181,6 +4161,9 @@ static void __devinit | |||
4181 | sisfb_post_map_vram(struct sis_video_info *ivideo, unsigned int *mapsize, | 4161 | sisfb_post_map_vram(struct sis_video_info *ivideo, unsigned int *mapsize, |
4182 | unsigned int min) | 4162 | unsigned int min) |
4183 | { | 4163 | { |
4164 | if (*mapsize < (min << 20)) | ||
4165 | return; | ||
4166 | |||
4184 | ivideo->video_vbase = ioremap(ivideo->video_base, (*mapsize)); | 4167 | ivideo->video_vbase = ioremap(ivideo->video_base, (*mapsize)); |
4185 | 4168 | ||
4186 | if(!ivideo->video_vbase) { | 4169 | if(!ivideo->video_vbase) { |
@@ -4514,7 +4497,7 @@ sisfb_post_sis300(struct pci_dev *pdev) | |||
4514 | } else { | 4497 | } else { |
4515 | #endif | 4498 | #endif |
4516 | /* Need to map max FB size for finding out about RAM size */ | 4499 | /* Need to map max FB size for finding out about RAM size */ |
4517 | mapsize = 64 << 20; | 4500 | mapsize = ivideo->video_size; |
4518 | sisfb_post_map_vram(ivideo, &mapsize, 4); | 4501 | sisfb_post_map_vram(ivideo, &mapsize, 4); |
4519 | 4502 | ||
4520 | if(ivideo->video_vbase) { | 4503 | if(ivideo->video_vbase) { |
@@ -4680,7 +4663,7 @@ sisfb_post_xgi_ramsize(struct sis_video_info *ivideo) | |||
4680 | orSISIDXREG(SISSR, 0x20, (0x80 | 0x04)); | 4663 | orSISIDXREG(SISSR, 0x20, (0x80 | 0x04)); |
4681 | 4664 | ||
4682 | /* Need to map max FB size for finding out about RAM size */ | 4665 | /* Need to map max FB size for finding out about RAM size */ |
4683 | mapsize = 256 << 20; | 4666 | mapsize = ivideo->video_size; |
4684 | sisfb_post_map_vram(ivideo, &mapsize, 32); | 4667 | sisfb_post_map_vram(ivideo, &mapsize, 32); |
4685 | 4668 | ||
4686 | if(!ivideo->video_vbase) { | 4669 | if(!ivideo->video_vbase) { |
@@ -5936,6 +5919,7 @@ sisfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
5936 | } | 5919 | } |
5937 | 5920 | ||
5938 | ivideo->video_base = pci_resource_start(pdev, 0); | 5921 | ivideo->video_base = pci_resource_start(pdev, 0); |
5922 | ivideo->video_size = pci_resource_len(pdev, 0); | ||
5939 | ivideo->mmio_base = pci_resource_start(pdev, 1); | 5923 | ivideo->mmio_base = pci_resource_start(pdev, 1); |
5940 | ivideo->mmio_size = pci_resource_len(pdev, 1); | 5924 | ivideo->mmio_size = pci_resource_len(pdev, 1); |
5941 | ivideo->SiS_Pr.RelIO = pci_resource_start(pdev, 2) + 0x30; | 5925 | ivideo->SiS_Pr.RelIO = pci_resource_start(pdev, 2) + 0x30; |