Skip to contentSkip to conversation

atyfb: disable linear aperture register access

PATCH New Ville Syrjälä 1 participant 1 message Feb 14, 2004 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atyfb: disable linear aperture register access

This atyfb patch disables register access through the linear aperture if the auxiliary aperture is used. This allows access to the full 8 MB of memory. Tested on 3D Rage LT Pro.

Signature · 3 lines
Ville Syrjälä
[email protected]
http://www.sci.fi/~syrjala/
drivers/video/aty/atyfb.h +1 -0
diff -urN linux-2.4.24/drivers/video/aty/atyfb.h linux-2.4.24/drivers/video/aty/atyfb.h
@@ -179,6 +179,7 @@
     unsigned char *save_framebuffer;
     unsigned long save_pll[64];
 #endif
+    int aux_app;
 };
 
 
drivers/video/aty/atyfb_base.c +17 -10
diff -urN linux-2.4.24/drivers/video/aty/atyfb_base.c linux-2.4.24/drivers/video/aty/atyfb_base.c
@@ -1006,11 +1006,13 @@
             aty_st_le32(BUS_CNTL, 0x680000f9, info);
         }  else if (M64_HAS(MOBIL_BUS)) {
             aty_st_le32(DAC_CNTL, 0x80010102, info);
-            aty_st_le32(BUS_CNTL, 0x7b33a040, info);
+            aty_st_le32(BUS_CNTL, 0x7b33a040 |
+                        (info->aux_app ? BUS_APER_REG_DIS : 0), info);
         } else {
             /* GT */
             aty_st_le32(DAC_CNTL, 0x86010102, info);
-            aty_st_le32(BUS_CNTL, 0x7b23a040, info);
+            aty_st_le32(BUS_CNTL, 0x7b23a040 |
+                        (info->aux_app ? BUS_APER_REG_DIS : 0), info);
             aty_st_le32(EXT_MEM_CNTL,
                         aty_ld_le32(EXT_MEM_CNTL, info) | 0x5000001, info);
         }
@@ -2263,13 +2265,20 @@
 
     /*
      *  Last page of 8 MB (4 MB on ISA) aperture is MMIO
-     *  FIXME: we should use the auxiliary aperture instead so we can access
-     *  the full 8 MB of video RAM on 8 MB boards
      */
-    if (info->total_vram == 0x800000 ||
+    if ((!info->aux_app && info->total_vram == 0x800000) ||
         (info->bus_type == ISA && info->total_vram == 0x400000))
             info->total_vram -= GUI_RESERVE;
 
+    /*
+     *  Disable register access through the linear aperture
+     *  if the auxiliary aperture is used so we can access
+     *  the full 8 MB of video RAM on 8 MB boards.
+     */
+    if (info->aux_app)
+        aty_st_le32(BUS_CNTL, aty_ld_le32(BUS_CNTL, info) |
+                    BUS_APER_REG_DIS, info);
+
     /* Clear the video memory */
     fb_memset((void *)info->frame_buffer, 0, info->total_vram);
 
@@ -2439,7 +2448,6 @@
         return -ENXIO;
 #else
     u16 tmp;
-    int aux_app;
     unsigned long raddr;
 #endif
 #if defined(CONFIG_FB_ATY_GENERIC_LCD)
@@ -2687,13 +2695,12 @@
 
 #else /* __sparc__ */
 
-            aux_app = 0;
             raddr = addr + 0x7ff000UL;
             rrp = &pdev->resource[2];
             if ((rrp->flags & IORESOURCE_MEM)
                 && request_mem_region(rrp->start, rrp->end - rrp->start + 1,
                                       "atyfb")) {
-                    aux_app = 1;
+                    info->aux_app = 1;
                     raddr = rrp->start;
                     printk(KERN_INFO "atyfb: using auxiliary register aperture\n");
             }
@@ -2707,8 +2714,8 @@
                     return -ENOMEM;
             }
 
-            info->ati_regbase_phys += aux_app? 0x400: 0xc00;
-            info->ati_regbase += aux_app? 0x400: 0xc00;
+            info->ati_regbase_phys += info->aux_app ? 0x400 : 0xc00;
+            info->ati_regbase += info->aux_app ? 0x400 : 0xc00;
 
             /*
              * Enable memory-space accesses using config-space
drivers/video/aty/mach64.h +1 -0
diff -urN linux-2.4.24/drivers/video/aty/mach64.h linux-2.4.24/drivers/video/aty/mach64.h
@@ -635,6 +635,7 @@
 /* Mach64 engine bit constants - these are typically ORed together */
 
 /* BUS_CNTL register constants */
+#define BUS_APER_REG_DIS	0x00000010
 #define BUS_FIFO_ERR_ACK	0x00200000
 #define BUS_HOST_ERR_ACK	0x00800000