aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/atafb.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c
index e21d1f58554c..4953b657635e 100644
--- a/drivers/video/fbdev/atafb.c
+++ b/drivers/video/fbdev/atafb.c
@@ -191,7 +191,7 @@ static struct fb_info fb_info = {
191}; 191};
192 192
193static void *screen_base; /* base address of screen */ 193static void *screen_base; /* base address of screen */
194static void *real_screen_base; /* (only for Overscan) */ 194static unsigned long phys_screen_base; /* (only for Overscan) */
195 195
196static int screen_len; 196static int screen_len;
197 197
@@ -213,7 +213,8 @@ static unsigned int external_yres;
213 */ 213 */
214static unsigned int external_depth; 214static unsigned int external_depth;
215static int external_pmode; 215static int external_pmode;
216static void *external_addr; 216static void *external_screen_base;
217static unsigned long external_addr;
217static unsigned long external_len; 218static unsigned long external_len;
218static unsigned long external_vgaiobase; 219static unsigned long external_vgaiobase;
219static unsigned int external_bitspercol = 6; 220static unsigned int external_bitspercol = 6;
@@ -592,7 +593,7 @@ static int tt_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par)
592 int mode; 593 int mode;
593 594
594 strcpy(fix->id, "Atari Builtin"); 595 strcpy(fix->id, "Atari Builtin");
595 fix->smem_start = (unsigned long)real_screen_base; 596 fix->smem_start = phys_screen_base;
596 fix->smem_len = screen_len; 597 fix->smem_len = screen_len;
597 fix->type = FB_TYPE_INTERLEAVED_PLANES; 598 fix->type = FB_TYPE_INTERLEAVED_PLANES;
598 fix->type_aux = 2; 599 fix->type_aux = 2;
@@ -790,7 +791,7 @@ static void tt_get_par(struct atafb_par *par)
790 addr = ((shifter.bas_hi & 0xff) << 16) | 791 addr = ((shifter.bas_hi & 0xff) << 16) |
791 ((shifter.bas_md & 0xff) << 8) | 792 ((shifter.bas_md & 0xff) << 8) |
792 ((shifter.bas_lo & 0xff)); 793 ((shifter.bas_lo & 0xff));
793 par->screen_base = phys_to_virt(addr); 794 par->screen_base = atari_stram_to_virt(addr);
794} 795}
795 796
796static void tt_set_par(struct atafb_par *par) 797static void tt_set_par(struct atafb_par *par)
@@ -888,7 +889,7 @@ static int falcon_encode_fix(struct fb_fix_screeninfo *fix,
888 struct atafb_par *par) 889 struct atafb_par *par)
889{ 890{
890 strcpy(fix->id, "Atari Builtin"); 891 strcpy(fix->id, "Atari Builtin");
891 fix->smem_start = (unsigned long)real_screen_base; 892 fix->smem_start = phys_screen_base;
892 fix->smem_len = screen_len; 893 fix->smem_len = screen_len;
893 fix->type = FB_TYPE_INTERLEAVED_PLANES; 894 fix->type = FB_TYPE_INTERLEAVED_PLANES;
894 fix->type_aux = 2; 895 fix->type_aux = 2;
@@ -1584,7 +1585,7 @@ static void falcon_get_par(struct atafb_par *par)
1584 addr = (shifter.bas_hi & 0xff) << 16 | 1585 addr = (shifter.bas_hi & 0xff) << 16 |
1585 (shifter.bas_md & 0xff) << 8 | 1586 (shifter.bas_md & 0xff) << 8 |
1586 (shifter.bas_lo & 0xff); 1587 (shifter.bas_lo & 0xff);
1587 par->screen_base = phys_to_virt(addr); 1588 par->screen_base = atari_stram_to_virt(addr);
1588 1589
1589 /* derived parameters */ 1590 /* derived parameters */
1590 hw->ste_mode = (hw->f_shift & 0x510) == 0 && hw->st_shift == 0x100; 1591 hw->ste_mode = (hw->f_shift & 0x510) == 0 && hw->st_shift == 0x100;
@@ -1814,7 +1815,7 @@ static int stste_encode_fix(struct fb_fix_screeninfo *fix,
1814 int mode; 1815 int mode;
1815 1816
1816 strcpy(fix->id, "Atari Builtin"); 1817 strcpy(fix->id, "Atari Builtin");
1817 fix->smem_start = (unsigned long)real_screen_base; 1818 fix->smem_start = phys_screen_base;
1818 fix->smem_len = screen_len; 1819 fix->smem_len = screen_len;
1819 fix->type = FB_TYPE_INTERLEAVED_PLANES; 1820 fix->type = FB_TYPE_INTERLEAVED_PLANES;
1820 fix->type_aux = 2; 1821 fix->type_aux = 2;
@@ -1980,7 +1981,7 @@ static void stste_get_par(struct atafb_par *par)
1980 ((shifter.bas_md & 0xff) << 8); 1981 ((shifter.bas_md & 0xff) << 8);
1981 if (ATARIHW_PRESENT(EXTD_SHIFTER)) 1982 if (ATARIHW_PRESENT(EXTD_SHIFTER))
1982 addr |= (shifter.bas_lo & 0xff); 1983 addr |= (shifter.bas_lo & 0xff);
1983 par->screen_base = phys_to_virt(addr); 1984 par->screen_base = atari_stram_to_virt(addr);
1984} 1985}
1985 1986
1986static void stste_set_par(struct atafb_par *par) 1987static void stste_set_par(struct atafb_par *par)
@@ -2039,7 +2040,7 @@ static int stste_detect(void)
2039static void stste_set_screen_base(void *s_base) 2040static void stste_set_screen_base(void *s_base)
2040{ 2041{
2041 unsigned long addr; 2042 unsigned long addr;
2042 addr = virt_to_phys(s_base); 2043 addr = atari_stram_to_phys(s_base);
2043 /* Setup Screen Memory */ 2044 /* Setup Screen Memory */
2044 shifter.bas_hi = (unsigned char)((addr & 0xff0000) >> 16); 2045 shifter.bas_hi = (unsigned char)((addr & 0xff0000) >> 16);
2045 shifter.bas_md = (unsigned char)((addr & 0x00ff00) >> 8); 2046 shifter.bas_md = (unsigned char)((addr & 0x00ff00) >> 8);
@@ -2113,7 +2114,7 @@ static void st_ovsc_switch(void)
2113static int ext_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par) 2114static int ext_encode_fix(struct fb_fix_screeninfo *fix, struct atafb_par *par)
2114{ 2115{
2115 strcpy(fix->id, "Unknown Extern"); 2116 strcpy(fix->id, "Unknown Extern");
2116 fix->smem_start = (unsigned long)external_addr; 2117 fix->smem_start = external_addr;
2117 fix->smem_len = PAGE_ALIGN(external_len); 2118 fix->smem_len = PAGE_ALIGN(external_len);
2118 if (external_depth == 1) { 2119 if (external_depth == 1) {
2119 fix->type = FB_TYPE_PACKED_PIXELS; 2120 fix->type = FB_TYPE_PACKED_PIXELS;
@@ -2213,7 +2214,7 @@ static int ext_encode_var(struct fb_var_screeninfo *var, struct atafb_par *par)
2213 2214
2214static void ext_get_par(struct atafb_par *par) 2215static void ext_get_par(struct atafb_par *par)
2215{ 2216{
2216 par->screen_base = external_addr; 2217 par->screen_base = external_screen_base;
2217} 2218}
2218 2219
2219static void ext_set_par(struct atafb_par *par) 2220static void ext_set_par(struct atafb_par *par)
@@ -2286,7 +2287,7 @@ static void set_screen_base(void *s_base)
2286{ 2287{
2287 unsigned long addr; 2288 unsigned long addr;
2288 2289
2289 addr = virt_to_phys(s_base); 2290 addr = atari_stram_to_phys(s_base);
2290 /* Setup Screen Memory */ 2291 /* Setup Screen Memory */
2291 shifter.bas_hi = (unsigned char)((addr & 0xff0000) >> 16); 2292 shifter.bas_hi = (unsigned char)((addr & 0xff0000) >> 16);
2292 shifter.bas_md = (unsigned char)((addr & 0x00ff00) >> 8); 2293 shifter.bas_md = (unsigned char)((addr & 0x00ff00) >> 8);
@@ -2433,7 +2434,9 @@ static void atafb_set_disp(struct fb_info *info)
2433 atafb_get_var(&info->var, info); 2434 atafb_get_var(&info->var, info);
2434 atafb_get_fix(&info->fix, info); 2435 atafb_get_fix(&info->fix, info);
2435 2436
2436 info->screen_base = (void *)info->fix.smem_start; 2437 /* Note: smem_start derives from phys_screen_base, not screen_base! */
2438 info->screen_base = (external_addr ? external_screen_base :
2439 atari_stram_to_virt(info->fix.smem_start));
2437} 2440}
2438 2441
2439static int atafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue, 2442static int atafb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
@@ -2904,7 +2907,7 @@ static void __init atafb_setup_ext(char *spec)
2904 external_yres = yres; 2907 external_yres = yres;
2905 external_depth = depth; 2908 external_depth = depth;
2906 external_pmode = planes; 2909 external_pmode = planes;
2907 external_addr = (void *)addr; 2910 external_addr = addr;
2908 external_len = len; 2911 external_len = len;
2909 2912
2910 if (external_card_type == IS_MV300) { 2913 if (external_card_type == IS_MV300) {
@@ -3166,30 +3169,30 @@ int __init atafb_init(void)
3166 memset(screen_base, 0, mem_req); 3169 memset(screen_base, 0, mem_req);
3167 pad = -(unsigned long)screen_base & (PAGE_SIZE - 1); 3170 pad = -(unsigned long)screen_base & (PAGE_SIZE - 1);
3168 screen_base += pad; 3171 screen_base += pad;
3169 real_screen_base = screen_base + ovsc_offset; 3172 phys_screen_base = atari_stram_to_phys(screen_base + ovsc_offset);
3170 screen_len = (mem_req - pad - ovsc_offset) & PAGE_MASK; 3173 screen_len = (mem_req - pad - ovsc_offset) & PAGE_MASK;
3171 st_ovsc_switch(); 3174 st_ovsc_switch();
3172 if (CPU_IS_040_OR_060) { 3175 if (CPU_IS_040_OR_060) {
3173 /* On a '040+, the cache mode of video RAM must be set to 3176 /* On a '040+, the cache mode of video RAM must be set to
3174 * write-through also for internal video hardware! */ 3177 * write-through also for internal video hardware! */
3175 cache_push(virt_to_phys(screen_base), screen_len); 3178 cache_push(atari_stram_to_phys(screen_base), screen_len);
3176 kernel_set_cachemode(screen_base, screen_len, 3179 kernel_set_cachemode(screen_base, screen_len,
3177 IOMAP_WRITETHROUGH); 3180 IOMAP_WRITETHROUGH);
3178 } 3181 }
3179 printk("atafb: screen_base %p real_screen_base %p screen_len %d\n", 3182 printk("atafb: screen_base %p phys_screen_base %lx screen_len %d\n",
3180 screen_base, real_screen_base, screen_len); 3183 screen_base, phys_screen_base, screen_len);
3181#ifdef ATAFB_EXT 3184#ifdef ATAFB_EXT
3182 } else { 3185 } else {
3183 /* Map the video memory (physical address given) to somewhere 3186 /* Map the video memory (physical address given) to somewhere
3184 * in the kernel address space. 3187 * in the kernel address space.
3185 */ 3188 */
3186 external_addr = ioremap_writethrough((unsigned long)external_addr, 3189 external_screen_base = ioremap_writethrough(external_addr,
3187 external_len); 3190 external_len);
3188 if (external_vgaiobase) 3191 if (external_vgaiobase)
3189 external_vgaiobase = 3192 external_vgaiobase =
3190 (unsigned long)ioremap(external_vgaiobase, 0x10000); 3193 (unsigned long)ioremap(external_vgaiobase, 0x10000);
3191 screen_base = 3194 screen_base = external_screen_base;
3192 real_screen_base = external_addr; 3195 phys_screen_base = external_addr;
3193 screen_len = external_len & PAGE_MASK; 3196 screen_len = external_len & PAGE_MASK;
3194 memset (screen_base, 0, external_len); 3197 memset (screen_base, 0, external_len);
3195 } 3198 }
@@ -3235,8 +3238,8 @@ int __init atafb_init(void)
3235 if (register_framebuffer(&fb_info) < 0) { 3238 if (register_framebuffer(&fb_info) < 0) {
3236#ifdef ATAFB_EXT 3239#ifdef ATAFB_EXT
3237 if (external_addr) { 3240 if (external_addr) {
3238 iounmap(external_addr); 3241 iounmap(external_screen_base);
3239 external_addr = NULL; 3242 external_addr = 0;
3240 } 3243 }
3241 if (external_vgaiobase) { 3244 if (external_vgaiobase) {
3242 iounmap((void*)external_vgaiobase); 3245 iounmap((void*)external_vgaiobase);