Commit 4c1e49dc authored by James Simmons's avatar James Simmons

Code cleanups and bug fixes.

parent fcc694c7
...@@ -103,6 +103,7 @@ struct atyfb_par { ...@@ -103,6 +103,7 @@ struct atyfb_par {
int open; int open;
#endif #endif
#ifdef CONFIG_PMAC_PBOOK #ifdef CONFIG_PMAC_PBOOK
struct fb_info *next;
unsigned char *save_framebuffer; unsigned char *save_framebuffer;
unsigned long save_pll[64]; unsigned long save_pll[64];
#endif #endif
...@@ -286,7 +287,7 @@ extern void atyfb_fillrect(struct fb_info *info, struct fb_fillrect *rect); ...@@ -286,7 +287,7 @@ extern void atyfb_fillrect(struct fb_info *info, struct fb_fillrect *rect);
* Text console acceleration * Text console acceleration
*/ */
extern const struct display_switch fbcon_aty8; extern struct display_switch fbcon_aty8;
extern const struct display_switch fbcon_aty16; extern struct display_switch fbcon_aty16;
extern const struct display_switch fbcon_aty24; extern struct display_switch fbcon_aty24;
extern const struct display_switch fbcon_aty32; extern struct display_switch fbcon_aty32;
This diff is collapsed.
...@@ -340,7 +340,7 @@ static void name(struct vc_data *conp, struct display *p, args) \ ...@@ -340,7 +340,7 @@ static void name(struct vc_data *conp, struct display *p, args) \
fbcon_cfb##width##_clear_margins(conp, p, bottom_only), \ fbcon_cfb##width##_clear_margins(conp, p, bottom_only), \
int bottom_only) \ int bottom_only) \
\ \
const struct display_switch fbcon_aty##width = { \ struct display_switch fbcon_aty##width = { \
setup: fbcon_cfb##width##_setup, \ setup: fbcon_cfb##width##_setup, \
bmove: fbcon_aty_bmove, \ bmove: fbcon_aty_bmove, \
clear: fbcon_aty_clear, \ clear: fbcon_aty_clear, \
......
...@@ -28,6 +28,14 @@ ...@@ -28,6 +28,14 @@
#include <asm/io.h> #include <asm/io.h>
#include <video/fbcon.h> #include <video/fbcon.h>
#if BITS_PER_LONG == 32
#define FB_READ fb_readl
#define FB_WRITE fb_writel
#else
#define FB_READ fb_readq
#define FB_WRITE fb_writeq
#endif
void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
{ {
int x2, y2, lineincr, shift, shift_right, shift_left, old_dx, old_dy; int x2, y2, lineincr, shift, shift_right, shift_left, old_dx, old_dy;
...@@ -137,19 +145,19 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) ...@@ -137,19 +145,19 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
dst = (unsigned long *) dst1; dst = (unsigned long *) dst1;
src = (unsigned long *) src1; src = (unsigned long *) src1;
last = (fb_readl(src) & start_mask); last = (FB_READ(src) & start_mask);
if (shift > 0) if (shift > 0)
fb_writel(fb_readl(dst) | (last >> shift_right), dst); FB_WRITE(FB_READ(dst) | (last >> shift_right), dst);
for (j = 0; j < n; j++) { for (j = 0; j < n; j++) {
dst++; dst++;
tmp = fb_readl(src); tmp = FB_READ(src);
src++; src++;
fb_writel((last << shift_left) | (tmp >> shift_right), dst); FB_WRITE((last << shift_left) | (tmp >> shift_right), dst);
last = tmp; last = tmp;
src++; src++;
} }
fb_writel(fb_readl(dst) | (last << shift_left), dst); FB_WRITE(FB_READ(dst) | (last << shift_left), dst);
src1 += lineincr; src1 += lineincr;
dst1 += lineincr; dst1 += lineincr;
} while (--height); } while (--height);
...@@ -161,19 +169,19 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) ...@@ -161,19 +169,19 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
dst = (unsigned long *) dst1; dst = (unsigned long *) dst1;
src = (unsigned long *) src1; src = (unsigned long *) src1;
last = (fb_readl(src) & end_mask); last = (FB_READ(src) & end_mask);
if (shift < 0) if (shift < 0)
fb_writel(fb_readl(dst) | (last >> shift_right), dst); FB_WRITE(FB_READ(dst) | (last >> shift_right), dst);
for (j = 0; j < n; j++) { for (j = 0; j < n; j++) {
dst--; dst--;
tmp = fb_readl(src); tmp = FB_READ(src);
src--; src--;
fb_writel((tmp << shift_left) | (last >> shift_right), dst); FB_WRITE((tmp << shift_left) | (last >> shift_right), dst);
last = tmp; last = tmp;
src--; src--;
} }
fb_writel(fb_readl(dst) | (last >> shift_right), dst); FB_WRITE(FB_READ(dst) | (last >> shift_right), dst);
src1 += lineincr; src1 += lineincr;
dst1 += lineincr; dst1 += lineincr;
} while (--height); } while (--height);
...@@ -187,16 +195,16 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) ...@@ -187,16 +195,16 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
src = (unsigned long *) (src1 - start_index); src = (unsigned long *) (src1 - start_index);
if (start_mask) if (start_mask)
fb_writel(fb_readl(src) | start_mask, dst); FB_WRITE(FB_READ(src) | start_mask, dst);
for (j = 0; j < n; j++) { for (j = 0; j < n; j++) {
fb_writel(fb_readl(src), dst); FB_WRITE(FB_READ(src), dst);
dst++; dst++;
src++; src++;
} }
if (end_mask) if (end_mask)
fb_writel(fb_readl(src) | end_mask, dst); FB_WRITE(FB_READ(src) | end_mask, dst);
src1 += lineincr; src1 += lineincr;
dst1 += lineincr; dst1 += lineincr;
} while (--height); } while (--height);
...@@ -207,9 +215,9 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area) ...@@ -207,9 +215,9 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
src = (unsigned long *) src1; src = (unsigned long *) src1;
if (start_mask) if (start_mask)
fb_writel(fb_readl(src) | start_mask, dst); FB_WRITE(FB_READ(src) | start_mask, dst);
for (j = 0; j < n; j++) { for (j = 0; j < n; j++) {
fb_writel(fb_readl(src), dst); FB_WRITE(FB_READ(src), dst);
dst--; dst--;
src--; src--;
} }
......
...@@ -22,6 +22,14 @@ ...@@ -22,6 +22,14 @@
#include <asm/types.h> #include <asm/types.h>
#include <video/fbcon.h> #include <video/fbcon.h>
#if BITS_PER_LONG == 32
#define FB_READ fb_readl
#define FB_WRITE fb_writel
#else
#define FB_READ fb_readq
#define FB_WRITE fb_writeq
#endif
void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect) void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect)
{ {
unsigned long start_index, end_index, start_mask = 0, end_mask = 0; unsigned long start_index, end_index, start_mask = 0, end_mask = 0;
...@@ -93,33 +101,19 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect) ...@@ -93,33 +101,19 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect)
dst = (unsigned long *) (dst1 - start_index); dst = (unsigned long *) (dst1 - start_index);
if (start_mask) { if (start_mask) {
#if BITS_PER_LONG == 32 FB_WRITE(FB_READ(dst) |
fb_writel(fb_readl(dst) |
start_mask, dst);
#else
fb_writeq(fb_readq(dst) |
start_mask, dst); start_mask, dst);
#endif
dst++; dst++;
} }
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
#if BITS_PER_LONG == 32 FB_WRITE(fg, dst);
fb_writel(fg, dst);
#else
fb_writeq(fg, dst);
#endif
dst++; dst++;
} }
if (end_mask) if (end_mask)
#if BITS_PER_LONG == 32 FB_WRITE(FB_READ(dst) | end_mask,
fb_writel(fb_readl(dst) | end_mask,
dst);
#else
fb_writeq(fb_readq(dst) | end_mask,
dst); dst);
#endif
dst1 += linesize; dst1 += linesize;
} while (--height); } while (--height);
break; break;
...@@ -128,33 +122,19 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect) ...@@ -128,33 +122,19 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect)
dst = (unsigned long *) (dst1 - start_index); dst = (unsigned long *) (dst1 - start_index);
if (start_mask) { if (start_mask) {
#if BITS_PER_LONG == 32 FB_WRITE(FB_READ(dst) ^
fb_writel(fb_readl(dst) ^
start_mask, dst); start_mask, dst);
#else
fb_writeq(fb_readq(dst) ^
start_mask, dst);
#endif
dst++; dst++;
} }
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
#if BITS_PER_LONG == 32 FB_WRITE(FB_READ(dst) ^ fg, dst);
fb_writel(fb_readl(dst) ^ fg, dst);
#else
fb_writeq(fb_readq(dst) ^ fg, dst);
#endif
dst++; dst++;
} }
if (end_mask) { if (end_mask) {
#if BITS_PER_LONG == 32 FB_WRITE(FB_READ(dst) ^ end_mask,
fb_writel(fb_readl(dst) ^ end_mask,
dst); dst);
#else
fb_writeq(fb_readq(dst) ^ end_mask,
dst);
#endif
} }
dst1 += linesize; dst1 += linesize;
} while (--height); } while (--height);
......
...@@ -397,7 +397,6 @@ static void __init offb_init_fb(const char *name, const char *full_name, ...@@ -397,7 +397,6 @@ static void __init offb_init_fb(const char *name, const char *full_name,
struct fb_fix_screeninfo *fix; struct fb_fix_screeninfo *fix;
struct fb_var_screeninfo *var; struct fb_var_screeninfo *var;
struct fb_info *info; struct fb_info *info;
int i;
if (!request_mem_region(res_start, res_size, "offb")) if (!request_mem_region(res_start, res_size, "offb"))
return; return;
...@@ -412,14 +411,15 @@ static void __init offb_init_fb(const char *name, const char *full_name, ...@@ -412,14 +411,15 @@ static void __init offb_init_fb(const char *name, const char *full_name,
return; return;
} }
info = size = sizeof(struct fb_info) + sizeof(struct display) + sizeof(u32) * 17;
kmalloc(sizeof(struct fb_info) + sizeof(struct display) +
sizeof(u32) * 17, GFP_ATOMIC); info = kmalloc(size, GFP_ATOMIC);
if (info == 0) { if (info == 0) {
release_mem_region(res_start, res_size); release_mem_region(res_start, res_size);
return; return;
} }
memset(info, 0, sizeof(*info)); memset(info, 0, size);
fix = &info->fix; fix = &info->fix;
var = &info->var; var = &info->var;
...@@ -463,7 +463,7 @@ static void __init offb_init_fb(const char *name, const char *full_name, ...@@ -463,7 +463,7 @@ static void __init offb_init_fb(const char *name, const char *full_name,
unsigned long base = address & 0xff000000UL; unsigned long base = address & 0xff000000UL;
par->cmap_adr = par->cmap_adr =
ioremap(base + 0x7ff000, 0x1000) + 0xcc0; ioremap(base + 0x7ff000, 0x1000) + 0xcc0;
par->cmap_data = info->cmap_adr + 1; par->cmap_data = par->cmap_adr + 1;
par->cmap_type = cmap_m64; par->cmap_type = cmap_m64;
} else if (device_is_compatible(dp, "pci1014,b7")) { } else if (device_is_compatible(dp, "pci1014,b7")) {
unsigned long regbase = dp->addrs[0].address; unsigned long regbase = dp->addrs[0].address;
...@@ -553,7 +553,7 @@ static void __init offb_init_fb(const char *name, const char *full_name, ...@@ -553,7 +553,7 @@ static void __init offb_init_fb(const char *name, const char *full_name,
} }
printk(KERN_INFO "fb%d: Open Firmware frame buffer device on %s\n", printk(KERN_INFO "fb%d: Open Firmware frame buffer device on %s\n",
GET_FB_IDX(info->info.node), full_name); GET_FB_IDX(info->node), full_name);
} }
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -1281,4 +1281,4 @@ do { \ ...@@ -1281,4 +1281,4 @@ do { \
} \ } \
} while (0) } while (0)
#endif PM3FB_H #endif /* PM3FB_H */
...@@ -73,7 +73,6 @@ struct display { ...@@ -73,7 +73,6 @@ struct display {
#endif #endif
/* Filled in by the low-level console driver */ /* Filled in by the low-level console driver */
struct vc_data *conp; /* pointer to console data */ struct vc_data *conp; /* pointer to console data */
struct fb_info *fb_info; /* frame buffer for this console */ struct fb_info *fb_info; /* frame buffer for this console */
int vrows; /* number of virtual rows */ int vrows; /* number of virtual rows */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment