ngle_rom_t ngle_rom;
struct sti_struct *sti;
int deviceSpecificConfig;
- u32 pseudo_palette[16];
+ u32 pseudo_palette[256];
};
-static int __initdata bpp = 8; /* parameter from modprobe */
-static int __initdata stifb_force_bpp[MAX_STI_ROMS];
+static int __initdata stifb_bpp_pref[MAX_STI_ROMS];
/* ------------------- chipset specific functions -------------------------- */
#define REG_44 0x210030
#define REG_45 0x210034
-#define READ_BYTE(fb,reg) __raw_readb((fb)->info.fix.mmio_start + (reg))
-#define READ_WORD(fb,reg) __raw_readl((fb)->info.fix.mmio_start + (reg))
+#define READ_BYTE(fb,reg) gsc_readb((fb)->info.fix.mmio_start + (reg))
+#define READ_WORD(fb,reg) gsc_readl((fb)->info.fix.mmio_start + (reg))
#ifndef DEBUG_STIFB_REGS
# define DEBUG_OFF()
# define DEBUG_ON()
-# define WRITE_BYTE(value,fb,reg) __raw_writeb((value),(fb)->info.fix.mmio_start + (reg))
-# define WRITE_WORD(value,fb,reg) __raw_writel((value),(fb)->info.fix.mmio_start + (reg))
+# define WRITE_BYTE(value,fb,reg) gsc_writeb((value),(fb)->info.fix.mmio_start + (reg))
+# define WRITE_WORD(value,fb,reg) gsc_writel((value),(fb)->info.fix.mmio_start + (reg))
#else
static int debug_on = 1;
# define DEBUG_OFF() debug_on=0
# define WRITE_BYTE(value,fb,reg) do { if (debug_on) \
printk(KERN_DEBUG "%30s: WRITE_BYTE(0x%06x) = 0x%02x (old=0x%02x)\n", \
__FUNCTION__, reg, value, READ_BYTE(fb,reg)); \
- __raw_writeb((value),(fb)->info.fix.mmio_start + (reg)); } while (0)
+ gsc_writeb((value),(fb)->info.fix.mmio_start + (reg)); } while (0)
# define WRITE_WORD(value,fb,reg) do { if (debug_on) \
printk(KERN_DEBUG "%30s: WRITE_WORD(0x%06x) = 0x%08x (old=0x%08x)\n", \
__FUNCTION__, reg, value, READ_WORD(fb,reg)); \
- __raw_writel((value),(fb)->info.fix.mmio_start + (reg)); } while (0)
+ gsc_writel((value),(fb)->info.fix.mmio_start + (reg)); } while (0)
#endif /* DEBUG_STIFB_REGS */
(blue));
}
+ if (info->var.bits_per_pixel == 32) {
+ ((u32 *)(info->pseudo_palette))[regno] =
+ (red << info->var.red.offset) |
+ (green << info->var.green.offset) |
+ (blue << info->var.blue.offset);
+ } else {
+ ((u32 *)(info->pseudo_palette))[regno] = regno;
+ }
+
WRITE_IMAGE_COLOR(fb, regno, color);
if (fb->id == S9000_ID_HCRX) {
/* 0x100 is same as used in WRITE_IMAGE_COLOR() */
START_COLORMAPLOAD(fb, lutBltCtl.all);
SETUP_FB(fb);
-
- /* info->var.bits_per_pixel == 32 */
- if (regno < 16)
- ((u32 *)(info->pseudo_palette))[regno] =
- (red << info->var.red.offset) |
- (green << info->var.green.offset) |
- (blue << info->var.blue.offset);
-
} else {
/* cleanup colormap hardware */
FINISH_IMAGE_COLORMAP_ACCESS(fb);
*/
int __init
-stifb_init_fb(struct sti_struct *sti, int force_bpp)
+stifb_init_fb(struct sti_struct *sti, int bpp_pref)
{
struct fb_fix_screeninfo *fix;
struct fb_var_screeninfo *var;
#ifdef __LP64__
sti_rom_address |= 0xffffffff00000000;
#endif
- fb->deviceSpecificConfig = __raw_readl(sti_rom_address);
+ fb->deviceSpecificConfig = gsc_readl(sti_rom_address);
if (IS_24_DEVICE(fb)) {
- if (force_bpp == 8 || force_bpp == 32)
- bpp = force_bpp;
+ if (bpp_pref == 8 || bpp_pref == 32)
+ bpp = bpp_pref;
else
bpp = 32;
} else
def_sti = sti_get_rom(0);
if (def_sti) {
- for (i = 1; i < MAX_STI_ROMS; i++) {
+ for (i = 1; i <= MAX_STI_ROMS; i++) {
sti = sti_get_rom(i);
- if (sti == def_sti && bpp > 0)
- stifb_force_bpp[i] = bpp;
+ if (!sti)
+ break;
+ if (sti == def_sti) {
+ stifb_init_fb(sti, stifb_bpp_pref[i - 1]);
+ break;
+ }
}
- stifb_init_fb(def_sti, stifb_force_bpp[i]);
}
- for (i = 1; i < MAX_STI_ROMS; i++) {
+ for (i = 1; i <= MAX_STI_ROMS; i++) {
sti = sti_get_rom(i);
- if (!sti || sti==def_sti)
+ if (!sti)
break;
- if (bpp > 0)
- stifb_force_bpp[i] = bpp;
- stifb_init_fb(sti, stifb_force_bpp[i]);
+ if (sti == def_sti)
+ continue;
+ stifb_init_fb(sti, stifb_bpp_pref[i - 1]);
}
return 0;
}
struct sti_struct *sti;
int i;
- for (i = 1; i < MAX_STI_ROMS; i++) {
+ for (i = 1; i <= MAX_STI_ROMS; i++) {
sti = sti_get_rom(i);
if (!sti)
break;
if (strncmp(options, "bpp", 3) == 0) {
options += 3;
for (i = 0; i < MAX_STI_ROMS; i++) {
- if (*options++ == ':') {
- stifb_force_bpp[i] = simple_strtoul(options, &options, 10);
- bpp = -1;
- } else
+ if (*options++ != ':')
break;
+ stifb_bpp_pref[i] = simple_strtoul(options, &options, 10);
}
}
return 0;