remove trailing whitespace
[coreboot.git] / src / drivers / ati / ragexl / xlinit.c
index 4ec637a6aab5ee7d30ca3cd8ebe1368e3d6fbb1f..747b343cc880587d44ccd120b6ae9b7d547c41d0 100644 (file)
@@ -7,7 +7,7 @@
  *             stevel@mvista.com or source@mvista.com
  *  Copyright (C) 2004 Tyan Computer.
  *  Auther: Yinghai Lu   yhlu@tyan.com
- *        move to LinuxBIOS
+ *        move to coreboot
  * This code is distributed without warranty under the GPL v2 (see COPYING) *
  */
 #include <delay.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
 
+// FIXME BTEXT console within coreboot has been obsoleted
+// and will go away. The BTEXT code in this file should be
+// fixed to export a framebuffer console through the coreboot
+// table (and possibly make it available for bootsplash use)
+// Hence do only remove this if you fix the code.
+#define CONFIG_CONSOLE_BTEXT 0
+
+#if CONFIG_CONSOLE_BTEXT==1
+
+#define PLL_CRTC_DECODE 0
+#define SUPPORT_8_BPP_ABOVE 0
+
 #include "fb.h"
 #include "fbcon.h"
-#include "mach64.h"
 
 struct aty_cmap_regs {
-    u8 windex;
-    u8 lut;
-    u8 mask;
-    u8 rindex;
-    u8 cntl;
+       u8 windex;
+       u8 lut;
+       u8 mask;
+       u8 rindex;
+       u8 cntl;
 };
 
-#include "atyfb.h"
-
 #include <console/btext.h>
 
+#endif /*CONFIG_CONSOLE_BTEXT*/
+
+#include "mach64.h"
+
+#include "atyfb.h"
+
 #include "mach64_ct.c"
 
 #define MPLL_GAIN       0xad
 #define VPLL_GAIN       0xd5
 
+#define HAS_VICTORIA 0
+
 enum {
+#if HAS_VICTORIA==1
        VICTORIA = 0,
        XPERT98,
+#else
+       XPERT98=0,
+#endif
        NUM_XL_CARDS
 };
 
@@ -67,12 +88,14 @@ static const struct xl_card_cfg_t {
        u8  dll2_cntl;
        u8  pll_yclk_cntl;
 } card_cfg[NUM_XL_CARDS] = {
+#if HAS_VICTORIA==1
        // VICTORIA
        {       2700, SDRAM, 0x800000,
                0x10757A3B, 0x64000C81, 0x00110202, 0x7b33A040,
                0x82010102, 0x48803800, 0x005E0179,
                0x50, 0x25
        },
+#endif
        // XPERT98
        {       1432,  WRAM, 0x800000,
                0x00165A2B, 0xE0000CF1, 0x00200213, 0x7333A001,
@@ -80,7 +103,7 @@ static const struct xl_card_cfg_t {
                0x10, 0x19
        }
 };
-         
+
 typedef struct {
        u8 lcd_reg;
        u32 val;
@@ -186,7 +209,7 @@ static int atyfb_xl_init(struct fb_info_aty *info)
        u32 temp;
        union aty_pll pll;
        const struct xl_card_cfg_t * card = &card_cfg[xl_card];
-       
+
        aty_st_8(CONFIG_STAT0, 0x85, info);
        mdelay(10);
 
@@ -198,13 +221,15 @@ static int atyfb_xl_init(struct fb_info_aty *info)
        info->ref_clk_per = 100000000UL/card->ref_crystal;
        info->ram_type = card->mem_type;
        info->total_vram = card->mem_size;
+#if HAS_VICTORIA == 1
        if (xl_card == VICTORIA) {
                // the MCLK, XCLK are 120MHz on victoria card
                info->mclk_per = 1000000/120;
                info->xclk_per = 1000000/120;
                info->features &= ~M64F_MFB_TIMES_4;
        }
-       
+#endif
+
        /*
         * Calculate mclk and xclk dividers, etc. The passed
         * pixclock and bpp values don't matter yet, the vclk
@@ -225,7 +250,7 @@ static int atyfb_xl_init(struct fb_info_aty *info)
        aty_st_pll(PLL_EXT_CNTL, pll.ct.pll_ext_cntl, info);
        aty_st_pll(SPLL_CNTL2, 0x03, info);
        aty_st_pll(PLL_GEN_CNTL, 0x44, info);
-       
+
        reset_clocks(info, &pll.ct, 0);
        mdelay(10);
 
@@ -263,7 +288,7 @@ static int atyfb_xl_init(struct fb_info_aty *info)
        aty_st_le32(0xEC, 0x00000000, info);
        aty_st_le32(0xFC, 0x00000000, info);
 
-       for (i=0; i<sizeof(lcd_tbl)/sizeof(lcd_tbl_t); i++) {
+       for (i=0; i<ARRAY_SIZE(lcd_tbl); i++) {
                aty_st_lcd(lcd_tbl[i].lcd_reg, lcd_tbl[i].val, info);
        }
 
@@ -284,7 +309,7 @@ static int atyfb_xl_init(struct fb_info_aty *info)
        aty_st_8(LCD_INDEX, 0x08, info);
        aty_st_8(LCD_DATA, 0x0B, info);
        mdelay(2);
-       
+
        // enable display requests, enable CRTC
        aty_st_8(CRTC_GEN_CNTL+3, 0x02, info);
        // disable display
@@ -367,12 +392,14 @@ static int atyfb_xl_init(struct fb_info_aty *info)
 static char m64n_xl_33[] = "3D RAGE (XL PCI-33MHz)";
 static char m64n_xl_66[] = "3D RAGE (XL PCI-66MHz)";
 
+
+#if CONFIG_CONSOLE_BTEXT==1
 static void aty_set_crtc(const struct fb_info_aty *info,
                          const struct crtc *crtc);
 static int aty_var_to_crtc(const struct fb_info_aty *info,
                            const struct fb_var_screeninfo *var,
                            struct crtc *crtc);
-#if 0
+#if PLL_CRTC_DECODE==1
 static int aty_crtc_to_var(const struct crtc *crtc,
                            struct fb_var_screeninfo *var);
 #endif
@@ -382,13 +409,13 @@ static void atyfb_set_par(const struct atyfb_par *par,
 static int atyfb_decode_var(const struct fb_var_screeninfo *var,
                             struct atyfb_par *par,
                             const struct fb_info_aty *info);
-#if 0
+#if PLL_CRTC_DECODE==1
 static int atyfb_encode_var(struct fb_var_screeninfo *var,
                             const struct atyfb_par *par,
                             const struct fb_info_aty *info);
 #endif
 
-static void do_install_cmap(int con, struct fb_info *fb);
+static void do_install_cmap(int con, struct fb_info_aty *info);
 
 #if 0
 static u32 default_vram  = 0;
@@ -407,29 +434,29 @@ int default_blu[] = {0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa,
 #endif
 
 struct fb_var_screeninfo default_var = {
-    /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
-    640, 480, 640, 480, 0, 0, 8, 0,
-    {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
-    0, 0, -1, -1, 0, 39722, 48, 16, 33, 10, 96, 2,
-    0, FB_VMODE_NONINTERLACED
+       /* 640x480, 60 Hz, Non-Interlaced (25.175 MHz dotclock) */
+       640, 480, 640, 480, 0, 0, 8, 0,
+       {0, 8, 0}, {0, 8, 0}, {0, 8, 0}, {0, 0, 0},
+       0, 0, -1, -1, 0, 39722, 48, 16, 33, 10, 96, 2,
+       0, FB_VMODE_NONINTERLACED
 };
 
+#endif /*CONFIG_CONSOLE_BTEXT*/
+
 static struct {
-    u16 pci_id, chip_type;
-    u8 rev_mask, rev_val;
-    const char *name;
-    int pll, mclk, xclk;
-    u32 features;
+       u16 pci_id, chip_type;
+       u8 rev_mask, rev_val;
+       const char *name;
+       int pll, mclk, xclk;
+       u32 features;
 } aty_chips[] = {
-    /* 3D RAGE XL PCI-66/BGA */
-    { 0x474f, 0x474f, 0x00, 0x00, m64n_xl_66, 230, 83, 63, M64F_GT | M64F_INTEGRATED | M64F_RESET_3D | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL | M64F_EXTRA_BRIGHT | M64F_XL_DLL | M64F_MFB_TIMES_4 },
-    /* 3D RAGE XL PCI-33/BGA */
-    { 0x4752, 0x4752, 0x00, 0x00, m64n_xl_33, 230, 83, 63, M64F_GT | M64F_INTEGRATED | M64F_RESET_3D | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL | M64F_EXTRA_BRIGHT | M64F_XL_DLL | M64F_MFB_TIMES_4 },
+       /* 3D RAGE XL PCI-66/BGA */
+       { 0x474f, 0x474f, 0x00, 0x00, m64n_xl_66, 230, 83, 63, M64F_GT | M64F_INTEGRATED | M64F_RESET_3D | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL | M64F_EXTRA_BRIGHT | M64F_XL_DLL | M64F_MFB_TIMES_4 },
+       /* 3D RAGE XL PCI-33/BGA */
+       { 0x4752, 0x4752, 0x00, 0x00, m64n_xl_33, 230, 83, 63, M64F_GT | M64F_INTEGRATED | M64F_RESET_3D | M64F_GTB_DSP | M64F_SDRAM_MAGIC_PLL | M64F_EXTRA_BRIGHT | M64F_XL_DLL | M64F_MFB_TIMES_4 },
 };
-#if 1
-static void aty_calc_mem_refresh(struct fb_info_aty *info,
-                                        u16 id,
-                                        int xclk)
+#if CONFIG_CONSOLE_BTEXT==1
+static void aty_calc_mem_refresh(struct fb_info_aty *info, u16 id, int xclk)
 {
         int i, size;
 #if 0
@@ -461,24 +488,26 @@ static void aty_calc_mem_refresh(struct fb_info_aty *info,
 
         info->mem_refresh_rate = i;
 }
-#endif
-static void ati_ragexl_init(device_t dev) {
+#endif /*CONFIG_CONSOLE_BTEXT */
+static void ati_ragexl_init(device_t dev)
+{
         u32 chip_id;
-       u32 i;
        int j;
        u16 type;
         u8 rev;
-       const char *chipname = NULL, *xtal;
+       const char *chipname = NULL;
+#if CONFIG_CONSOLE_BTEXT
+       u32 i;
+       const char *xtal;
+#endif
        int pll, mclk, xclk;
+
+#if CONFIG_CONSOLE_BTEXT==1
+
 #if 0
        int gtb_memsize, k;
 #endif
 
-       struct fb_info_aty *info;
-       struct fb_info_aty info_t;
-       struct resource *res;
-       info = &info_t;
-
         struct fb_var_screeninfo var;
 #if 0
         struct display *disp;
@@ -488,30 +517,49 @@ static void ati_ragexl_init(device_t dev) {
        u8 pll_ref_div;
 #endif
 
+#endif /*CONFIG_CONSOLE_BTEXT==1 */
+
+        struct fb_info_aty *info;
+        struct fb_info_aty info_t;
+        struct resource *res;
+        info = &info_t;
+
 #define USE_AUX_REG 1
 
-       res = &dev->resource[0];
+
+       res = dev->resource_list;
        if(res->flags & IORESOURCE_IO) {
-               res = &dev->resource[1];
+               res = res->next;
        }
+
+#if CONFIG_CONSOLE_BTEXT==1
        info->frame_buffer = res->base;
-#if USE_AUX_REG==0   
+#endif /* CONFIG_CONSOLE_BTEXT */
+
+#if USE_AUX_REG==0
         info->ati_regbase = res->base+0x7ff000+0xc00;
-#else 
-        res = &dev->resource[2];
+#else
+       /* Fix this to look for the correct index. */
+       //if (dev->resource_list && dev->resource_list->next)
+        res = dev->resource_list->next->next;
         if(res->flags & IORESOURCE_MEM) {
-                info->ati_regbase = res->base+0x400; //using auxiliary register 
+                info->ati_regbase = res->base+0x400; //using auxiliary register
         }
 
 #endif
-       printk_info("ati_regbase = 0x%08x, frame_buffer = 0x%08x\r\n", info->ati_regbase, info->frame_buffer);
 
-       info->aty_cmap_regs = (struct aty_cmap_regs *)(info->ati_regbase+0xc0);
+#if CONFIG_CONSOLE_BTEXT==1
+        info->aty_cmap_regs = (struct aty_cmap_regs *)(info->ati_regbase+0xc0);
+#endif
+
+#if 0
+       printk(BIOS_DEBUG, "ati_regbase = 0x%08x, frame_buffer = 0x%08x\n", info->ati_regbase, info->frame_buffer);
+#endif
 
        chip_id = aty_ld_le32(CONFIG_CHIP_ID, info);
        type = chip_id & CFG_CHIP_TYPE;
        rev = (chip_id & CFG_CHIP_REV)>>24;
-       for (j = 0; j < (sizeof(aty_chips)/sizeof(*aty_chips)); j++)
+       for (j = 0; j < ARRAY_SIZE(aty_chips); j++)
                if (type == aty_chips[j].chip_type &&
                        (rev & aty_chips[j].rev_mask) == aty_chips[j].rev_val) {
                        chipname = aty_chips[j].name;
@@ -521,19 +569,22 @@ static void ati_ragexl_init(device_t dev) {
                        info->features = aty_chips[j].features;
                        goto found;
         }
-       printk_debug("ati_ragexl_init: Unknown mach64 0x%04x rev 0x%04x\n", type, rev);
+       printk(BIOS_SPEW, "ati_ragexl_init: Unknown mach64 0x%04x rev 0x%04x\n", type, rev);
        return ;
 
 found:
-       printk_info("ati_ragexl_init: %s [0x%04x rev 0x%02x]\r\n", chipname, type, rev);
+       printk(BIOS_INFO, "ati_ragexl_init: %s [0x%04x rev 0x%02x]\n", chipname, type, rev);
 #if 0
        if (M64_HAS(INTEGRATED)) {
                /* for many chips, the mclk is 67 MHz for SDRAM, 63 MHz otherwise */
                if (mclk == 67 && info->ram_type < SDRAM)
                        mclk = 63;
-       }   
+       }
 #endif
+#if CONFIG_CONSOLE_BTEXT==1
         aty_calc_mem_refresh(info, type, xclk);
+#endif /* CONFIG_CONSOLE_BTEXT */
+
        info->pll_per = 1000000/pll;
        info->mclk_per = 1000000/mclk;
        info->xclk_per = 1000000/xclk;
@@ -541,12 +592,14 @@ found:
 //        info->dac_ops = &aty_dac_ct;
 //        info->pll_ops = &aty_pll_ct;
         info->bus_type = PCI;
-       
+
 
        atyfb_xl_init(info);
 
+#if CONFIG_CONSOLE_BTEXT==1
+
        info->ram_type = (aty_ld_le32(CONFIG_STAT0, info) & 0x07);
-       
+
         info->ref_clk_per = 1000000000000ULL/14318180;
        xtal = "14.31818";
 #if 0
@@ -675,7 +728,9 @@ found:
     }
 
     if (atyfb_decode_var(&var, &info->default_par, info)) {
-        printk_debug("atyfb: can't set default video mode\n");
+#if 0
+        printk(BIOS_DEBUG, "atyfb: can't set default video mode\n");
+#endif
         return ;
     }
 #if 0
@@ -697,16 +752,17 @@ found:
     }
 #endif
 
-#if 0
+#if PLL_CRTC_DECODE==1
        atyfb_set_var(&var, -1, &info->fb_info);
 #else
             atyfb_set_par(&info->default_par, info);
-            do_install_cmap(-1, &info->fb_info);
+//            do_install_cmap(-1, &info->fb_info);
+           do_install_cmap(-1, info);
 #endif
 
-#if 0
+#if PLL_CRTC_DECODE==1
 
-    printk_info("framebuffer=0x%08x, width=%d, height=%d, bpp=%d, pitch=%d\n",info->frame_buffer,
+    printk(BIOS_SPEW, "framebuffer=0x%08x, width=%d, height=%d, bpp=%d, pitch=%d\n",info->frame_buffer,
                          (((info->current_par.crtc.h_tot_disp>>16) & 0xff)+1)*8,
                          ((info->current_par.crtc.v_tot_disp>>16) & 0x7ff)+1,
                          info->current_par.crtc.bpp,
@@ -718,7 +774,7 @@ found:
                          info->current_par.crtc.bpp,
                          info->current_par.crtc.vxres*info->current_par.crtc.bpp/8,info->frame_buffer);
 #else
-    printk_debug("framebuffer=0x%08x, width=%d, height=%d, bpp=%d, pitch=%d\n",info->frame_buffer,
+    printk(BIOS_SPEW, "framebuffer=0x%08x, width=%d, height=%d, bpp=%d, pitch=%d\n",info->frame_buffer,
                          (((info->default_par.crtc.h_tot_disp>>16) & 0xff)+1)*8,
                          ((info->default_par.crtc.v_tot_disp>>16) & 0x7ff)+1,
                          info->default_par.crtc.bpp,
@@ -732,41 +788,23 @@ found:
 #endif
 
  btext_clearscreen();
+
  map_boot_text();
 
 #if 0
- btext_drawstring("1\n");
- btext_drawstring("2\n");
- btext_drawstring("3\n");
- btext_drawstring("4\n");
- btext_drawstring("test framebuffer 5\n");
- btext_drawstring("test framebuffer 6\n");
- btext_drawstring("test framebuffer 7\n");
- btext_drawstring("test framebuffer 8\n");
- btext_drawstring("test framebuffer 9\n");
- btext_drawstring("test framebuffer 10\n");
- btext_drawstring("test framebuffer 11\n");
- btext_drawstring("test framebuffer 12\n");
- btext_drawstring("test framebuffer 13\n");
- btext_drawstring("test framebuffer 14\n");
- btext_drawstring("test framebuffer 15\n");
- btext_drawstring("test framebuffer 16\n");
- btext_drawstring("test framebuffer 17\n");
- btext_drawstring("test framebuffer 18\n");
- btext_drawstring("test framebuffer 19\n");
- btext_drawstring("test framebuffer 20\n");
- btext_drawstring("test framebuffer 21\n");
- btext_drawstring("test framebuffer 22\n");
- btext_drawstring("test framebuffer 23\n");
- btext_drawstring("test framebuffer 24\n");
+
+ btext_drawstring("test framebuffer\n");
 
  mdelay(10000);
 // test end
 #endif
-       
+
+#endif /* CONFIG_CONSOLE_BTEXT */
+
 }
 
+#if CONFIG_CONSOLE_BTEXT==1
+
 static int atyfb_decode_var(const struct fb_var_screeninfo *var,
                             struct atyfb_par *par,
                             const struct fb_info_aty *info)
@@ -792,7 +830,7 @@ static int atyfb_decode_var(const struct fb_var_screeninfo *var,
 
     return 0;
 }
-#if 0
+#if PLL_CRTC_DECODE==1
 static int atyfb_encode_var(struct fb_var_screeninfo *var,
                             const struct atyfb_par *par,
                             const struct fb_info_aty *info)
@@ -827,13 +865,13 @@ static void aty_set_crtc(const struct fb_info_aty *info,
 static int aty_var_to_crtc(const struct fb_info_aty *info,
                            const struct fb_var_screeninfo *var,
                            struct crtc *crtc)
-{       
+{
     u32 xres, yres, vxres, vyres, xoffset, yoffset, bpp;
     u32 left, right, upper, lower, hslen, vslen, sync, vmode;
     u32 h_total, h_disp, h_sync_strt, h_sync_dly, h_sync_wid, h_sync_pol;
     u32 v_total, v_disp, v_sync_strt, v_sync_wid, v_sync_pol, c_sync;
     u32 pix_width, dp_pix_width, dp_chain_mask;
-        
+
     /* input */
     xres = var->xres;
     yres = var->yres;
@@ -848,9 +886,9 @@ static int aty_var_to_crtc(const struct fb_info_aty *info,
     lower = var->lower_margin;
     hslen = var->hsync_len;
     vslen = var->vsync_len;
-    sync = var->sync; 
+    sync = var->sync;
     vmode = var->vmode;
-        
+
     /* convert (and round up) and validate */
     xres = (xres+7) & ~7;
     xoffset = (xoffset+7) & ~7;
@@ -858,7 +896,7 @@ static int aty_var_to_crtc(const struct fb_info_aty *info,
     if (vxres < xres+xoffset)
         vxres = xres+xoffset;
     h_disp = xres/8-1;
-    if (h_disp > 0xff) 
+    if (h_disp > 0xff)
         FAIL("h_disp too large");
     h_sync_strt = h_disp+(right/8);
     if (h_sync_strt > 0x1ff)
@@ -895,8 +933,8 @@ static int aty_var_to_crtc(const struct fb_info_aty *info,
         pix_width = CRTC_PIX_WIDTH_8BPP;
         dp_pix_width = HOST_8BPP | SRC_8BPP | DST_8BPP | BYTE_ORDER_LSB_TO_MSB;
         dp_chain_mask = 0x8080;
-    } 
-#if 0
+    }
+#if SUPPORT_8_BPP_ABOVE==1
    else if (bpp <= 16) {
         bpp = 16;
         pix_width = CRTC_PIX_WIDTH_15BPP;
@@ -914,7 +952,7 @@ static int aty_var_to_crtc(const struct fb_info_aty *info,
         dp_pix_width = HOST_32BPP | SRC_32BPP | DST_32BPP |
                        BYTE_ORDER_LSB_TO_MSB;
         dp_chain_mask = 0x8080;
-    } 
+    }
 #endif
 else
         FAIL("invalid bpp");
@@ -948,7 +986,7 @@ else
 
     return 0;
 }
-#if 0
+#if PLL_CRTC_DECODE==1
 static int aty_crtc_to_var(const struct crtc *crtc,
                            struct fb_var_screeninfo *var)
 {
@@ -1011,7 +1049,7 @@ static int aty_crtc_to_var(const struct crtc *crtc,
             var->transp.offset = 0;
             var->transp.length = 0;
             break;
-#if 0
+#if SUPPORT_8_BPP_ABOVE==1
         case CRTC_PIX_WIDTH_15BPP:      /* RGB 555 */
             bpp = 16;
             var->red.offset = 10;
@@ -1023,8 +1061,6 @@ static int aty_crtc_to_var(const struct crtc *crtc,
             var->transp.offset = 0;
             var->transp.length = 0;
             break;
-#endif
-#if 0
         case CRTC_PIX_WIDTH_16BPP:      /* RGB 565 */
             bpp = 16;
             var->red.offset = 11;
@@ -1036,8 +1072,6 @@ static int aty_crtc_to_var(const struct crtc *crtc,
             var->transp.offset = 0;
             var->transp.length = 0;
             break;
-#endif
-#if 0
         case CRTC_PIX_WIDTH_24BPP:      /* RGB 888 */
             bpp = 24;
             var->red.offset = 16;
@@ -1098,7 +1132,7 @@ static int encode_fix(struct fb_fix_screeninfo *fix,
     fix->smem_start = info->frame_buffer;
     fix->smem_len = (u32)info->total_vram;
 
-    /* 
+    /*
      *  Reg Block 0 (CT-compatible block) is at ati_regbase_phys
      *  Reg Block 1 (multimedia extensions) is at ati_regbase_phys-0x400
      */
@@ -1133,11 +1167,11 @@ static int encode_fix(struct fb_fix_screeninfo *fix,
 #endif
    /*
      *  Set the User Defined Part of the Display
-     */ 
-#if 0     
+     */
+#if PLL_CRTC_DECODE==1
 static int atyfb_set_var(struct fb_var_screeninfo *var, int con,
                          struct fb_info *fb)
-{                        
+{
     struct fb_info_aty *info = (struct fb_info_aty *)fb;
     struct atyfb_par par;
 #if 0
@@ -1146,8 +1180,8 @@ static int atyfb_set_var(struct fb_var_screeninfo *var, int con,
 #endif
     int err;
     int activate = var->activate;
-   
-#if 0 
+
+#if 0
     if (con >= 0)
         display = &fb_display[con];
     else
@@ -1155,14 +1189,14 @@ static int atyfb_set_var(struct fb_var_screeninfo *var, int con,
 #if 0
         display = fb->disp;     /* used during initialization */
 #endif
-        
+
     if ((err = atyfb_decode_var(var, &par, info)))
         return err;
-        
+
     atyfb_encode_var(var, &par, (struct fb_info_aty *)info);
-   
-#if 0 
-    printk_info("atyfb_set_var: activate=%d\n", activate & FB_ACTIVATE_MASK);
+
+#if 0
+    printk(BIOS_INFO, "atyfb_set_var: activate=%d\n", activate & FB_ACTIVATE_MASK);
 #endif
 
     if ((activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
@@ -1214,7 +1248,7 @@ static int atyfb_set_var(struct fb_var_screeninfo *var, int con,
             if ((err = fb_alloc_cmap(&display->cmap, 0, 0)))
                 return err;
 #endif
-            do_install_cmap(con, &info->fb_info);
+            do_install_cmap(con, info);
 #if 0
         }
 #endif
@@ -1235,10 +1269,9 @@ static void atyfb_set_par(const struct atyfb_par *par,
 
     accelmode = par->accel_flags;  /* hack */
 
-#if 0
-//    We only use default_par
+#if PLL_CRTC_DECODE==1
     info->current_par = *par;
-#endif 
+#endif
 
     if (info->blitter_may_be_busy)
         wait_for_idle(info);
@@ -1260,7 +1293,7 @@ static void atyfb_set_par(const struct atyfb_par *par,
             case 8:
                 i |= 0x02000000;
                 break;
-#if 0
+#if SUPPORT_8_BPP_ABOVE==1
             case 16:
                 i |= 0x03000000;
                 break;
@@ -1276,10 +1309,12 @@ static void atyfb_set_par(const struct atyfb_par *par,
                 i |= info->mem_refresh_rate << 20;
         switch (par->crtc.bpp) {
             case 8:
-//            case 24:
+#if SUPPORT_8_BPP_ABOVE==1
+            case 24:
+#endif
                 i |= 0x00000000;
                break;
-#if 0
+#if SUPPORT_8_BPP_ABOVE==1
             case 16:
                 i |= 0x04000000;
                 break;
@@ -1316,16 +1351,9 @@ static void atyfb_set_par(const struct atyfb_par *par,
 #endif
 
 
-#if 0
-    btext_update_display(info->frame_buffer_phys,
-                         (((par->crtc.h_tot_disp>>16) & 0xff)+1)*8,
-                         ((par->crtc.v_tot_disp>>16) & 0x7ff)+1,
-                         par->crtc.bpp,
-                         par->crtc.vxres*par->crtc.bpp/8);
-#endif 
 }
 #if 0
-static u16 red2[] = { 
+static u16 red2[] = {
     0x0000, 0xaaaa
 };
 static u16 green2[] = {
@@ -1337,14 +1365,14 @@ static u16 blue2[] = {
 
 static u16 red4[] = {
     0x0000, 0xaaaa, 0x5555, 0xffff
-};      
+};
 static u16 green4[] = {
     0x0000, 0xaaaa, 0x5555, 0xffff
-};      
+};
 static u16 blue4[] = {
     0x0000, 0xaaaa, 0x5555, 0xffff
-};      
+};
+
 static u16 red8[] = {
     0x0000, 0x0000, 0x0000, 0x0000, 0xaaaa, 0xaaaa, 0xaaaa, 0xaaaa
 };
@@ -1385,14 +1413,13 @@ static struct fb_cmap default_16_colors = {
 
 
 static int atyfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
-                           u_int transp, struct fb_info *fb)
-{                          
-    struct fb_info_aty *info = (struct fb_info_aty *)fb;
+                           u_int transp, struct fb_info_aty *info)
+{
     int i, scale;
-    
+
     if (regno > 255)
         return 1;
-    red >>= 8; 
+    red >>= 8;
     green >>= 8;
     blue >>= 8;
 #if 0
@@ -1400,33 +1427,33 @@ static int atyfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
     info->palette[regno].red = red;
     info->palette[regno].green = green;
     info->palette[regno].blue = blue;
-#endif 
+#endif
     i = aty_ld_8(DAC_CNTL, info) & 0xfc;
     if (M64_HAS(EXTRA_BRIGHT))
         i |= 0x2;       /*DAC_CNTL|0x2 turns off the extra brightness for gt*/
     aty_st_8(DAC_CNTL, i, info);
     aty_st_8(DAC_MASK, 0xff, info);
-#if 0
+#if PLL_CRTC_DECODE==1
     scale = (M64_HAS(INTEGRATED) && info->current_par.crtc.bpp == 16) ? 3 : 0;
 #else
     scale = (M64_HAS(INTEGRATED) && info->default_par.crtc.bpp == 16) ? 3 : 0;
 #endif
-    writeb(regno << scale, &info->aty_cmap_regs->windex);
-    writeb(red, &info->aty_cmap_regs->lut);
-    writeb(green, &info->aty_cmap_regs->lut);
-    writeb(blue, &info->aty_cmap_regs->lut);
+    write8(&info->aty_cmap_regs->windex, regno << scale)
+    write8(&info->aty_cmap_regs->lut, red);
+    write8(&info->aty_cmap_regs->lut, green);
+    write8(&info->aty_cmap_regs->lut, blue);
     return 0;
 }
 
 int fb_set_cmap(struct fb_cmap *cmap, int kspc,
                 int (*setcolreg)(u_int, u_int, u_int, u_int, u_int,
-                                 struct fb_info *),
-                struct fb_info *fb)
-{   
+                                 struct fb_info_aty *),
+                struct fb_info_aty *info)
+{
     int i, start;
     u16 *red, *green, *blue, *transp;
     u_int hred, hgreen, hblue, htransp;
-    
+
     red = cmap->red;
     green = cmap->green;
     blue = cmap->blue;
@@ -1445,7 +1472,7 @@ int fb_set_cmap(struct fb_cmap *cmap, int kspc,
         blue++;
         if (transp)
             transp++;
-        if (setcolreg(start++, hred, hgreen, hblue, htransp, fb))
+        if (setcolreg(start++, hred, hgreen, hblue, htransp, info))
             return 0;
     }
     return 0;
@@ -1462,19 +1489,19 @@ struct fb_cmap *fb_default_cmap(int len)
         return &default_8_colors;
 #endif
     return &default_16_colors;
-}   
+}
 
-static void do_install_cmap(int con, struct fb_info *fb)
+static void do_install_cmap(int con, struct fb_info_aty *info)
 {
-#if 0
-       struct fb_info_aty *info = (struct fb_info_aty *)fb;
+#if PLL_CRTC_DECODE==1
         int size = info->current_par.crtc.bpp == 16 ? 32 : 256;
-#else 
+#else
        int size = 256;
 #endif
-        fb_set_cmap(fb_default_cmap(size), 1, atyfb_setcolreg, fb);
+        fb_set_cmap(fb_default_cmap(size), 1, atyfb_setcolreg, info);
 }
 
+#endif /*CONFIG_CONSOLE_BTEXT */
 
 static struct device_operations ati_ragexl_graph_ops  = {
         .read_resources   = pci_dev_read_resources,
@@ -1484,7 +1511,7 @@ static struct device_operations ati_ragexl_graph_ops  = {
         .scan_bus         = 0,
 };
 
-static struct pci_driver ati_ragexl_graph_driver __pci_driver = {
+static const struct pci_driver ati_ragexl_graph_driver __pci_driver = {
         .ops    = &ati_ragexl_graph_ops,
         .vendor = PCI_VENDOR_ID_ATI,
         .device = PCI_DEVICE_ID_ATI_215XL,