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

Code cleanups and bug fixes.

parent fcc694c7
......@@ -103,6 +103,7 @@ struct atyfb_par {
int open;
#endif
#ifdef CONFIG_PMAC_PBOOK
struct fb_info *next;
unsigned char *save_framebuffer;
unsigned long save_pll[64];
#endif
......@@ -286,7 +287,7 @@ extern void atyfb_fillrect(struct fb_info *info, struct fb_fillrect *rect);
* Text console acceleration
*/
extern const struct display_switch fbcon_aty8;
extern const struct display_switch fbcon_aty16;
extern const struct display_switch fbcon_aty24;
extern const struct display_switch fbcon_aty32;
extern struct display_switch fbcon_aty8;
extern struct display_switch fbcon_aty16;
extern struct display_switch fbcon_aty24;
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) \
fbcon_cfb##width##_clear_margins(conp, p, bottom_only), \
int bottom_only) \
\
const struct display_switch fbcon_aty##width = { \
struct display_switch fbcon_aty##width = { \
setup: fbcon_cfb##width##_setup, \
bmove: fbcon_aty_bmove, \
clear: fbcon_aty_clear, \
......
......@@ -28,6 +28,14 @@
#include <asm/io.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)
{
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)
dst = (unsigned long *) dst1;
src = (unsigned long *) src1;
last = (fb_readl(src) & start_mask);
last = (FB_READ(src) & start_mask);
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++) {
dst++;
tmp = fb_readl(src);
tmp = FB_READ(src);
src++;
fb_writel((last << shift_left) | (tmp >> shift_right), dst);
FB_WRITE((last << shift_left) | (tmp >> shift_right), dst);
last = tmp;
src++;
}
fb_writel(fb_readl(dst) | (last << shift_left), dst);
FB_WRITE(FB_READ(dst) | (last << shift_left), dst);
src1 += lineincr;
dst1 += lineincr;
} while (--height);
......@@ -161,19 +169,19 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
dst = (unsigned long *) dst1;
src = (unsigned long *) src1;
last = (fb_readl(src) & end_mask);
last = (FB_READ(src) & end_mask);
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++) {
dst--;
tmp = fb_readl(src);
tmp = FB_READ(src);
src--;
fb_writel((tmp << shift_left) | (last >> shift_right), dst);
FB_WRITE((tmp << shift_left) | (last >> shift_right), dst);
last = tmp;
src--;
}
fb_writel(fb_readl(dst) | (last >> shift_right), dst);
FB_WRITE(FB_READ(dst) | (last >> shift_right), dst);
src1 += lineincr;
dst1 += lineincr;
} while (--height);
......@@ -187,16 +195,16 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
src = (unsigned long *) (src1 - start_index);
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++) {
fb_writel(fb_readl(src), dst);
FB_WRITE(FB_READ(src), dst);
dst++;
src++;
}
if (end_mask)
fb_writel(fb_readl(src) | end_mask, dst);
FB_WRITE(FB_READ(src) | end_mask, dst);
src1 += lineincr;
dst1 += lineincr;
} while (--height);
......@@ -207,9 +215,9 @@ void cfb_copyarea(struct fb_info *p, struct fb_copyarea *area)
src = (unsigned long *) src1;
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++) {
fb_writel(fb_readl(src), dst);
FB_WRITE(FB_READ(src), dst);
dst--;
src--;
}
......
......@@ -22,6 +22,14 @@
#include <asm/types.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)
{
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)
dst = (unsigned long *) (dst1 - start_index);
if (start_mask) {
#if BITS_PER_LONG == 32
fb_writel(fb_readl(dst) |
start_mask, dst);
#else
fb_writeq(fb_readq(dst) |
FB_WRITE(FB_READ(dst) |
start_mask, dst);
#endif
dst++;
}
for (i = 0; i < n; i++) {
#if BITS_PER_LONG == 32
fb_writel(fg, dst);
#else
fb_writeq(fg, dst);
#endif
FB_WRITE(fg, dst);
dst++;
}
if (end_mask)
#if BITS_PER_LONG == 32
fb_writel(fb_readl(dst) | end_mask,
dst);
#else
fb_writeq(fb_readq(dst) | end_mask,
FB_WRITE(FB_READ(dst) | end_mask,
dst);
#endif
dst1 += linesize;
} while (--height);
break;
......@@ -128,33 +122,19 @@ void cfb_fillrect(struct fb_info *p, struct fb_fillrect *rect)
dst = (unsigned long *) (dst1 - start_index);
if (start_mask) {
#if BITS_PER_LONG == 32
fb_writel(fb_readl(dst) ^
FB_WRITE(FB_READ(dst) ^
start_mask, dst);
#else
fb_writeq(fb_readq(dst) ^
start_mask, dst);
#endif
dst++;
}
for (i = 0; i < n; i++) {
#if BITS_PER_LONG == 32
fb_writel(fb_readl(dst) ^ fg, dst);
#else
fb_writeq(fb_readq(dst) ^ fg, dst);
#endif
FB_WRITE(FB_READ(dst) ^ fg, dst);
dst++;
}
if (end_mask) {
#if BITS_PER_LONG == 32
fb_writel(fb_readl(dst) ^ end_mask,
FB_WRITE(FB_READ(dst) ^ end_mask,
dst);
#else
fb_writeq(fb_readq(dst) ^ end_mask,
dst);
#endif
}
dst1 += linesize;
} while (--height);
......
......@@ -397,7 +397,6 @@ static void __init offb_init_fb(const char *name, const char *full_name,
struct fb_fix_screeninfo *fix;
struct fb_var_screeninfo *var;
struct fb_info *info;
int i;
if (!request_mem_region(res_start, res_size, "offb"))
return;
......@@ -412,14 +411,15 @@ static void __init offb_init_fb(const char *name, const char *full_name,
return;
}
info =
kmalloc(sizeof(struct fb_info) + sizeof(struct display) +
sizeof(u32) * 17, GFP_ATOMIC);
size = sizeof(struct fb_info) + sizeof(struct display) + sizeof(u32) * 17;
info = kmalloc(size, GFP_ATOMIC);
if (info == 0) {
release_mem_region(res_start, res_size);
return;
}
memset(info, 0, sizeof(*info));
memset(info, 0, size);
fix = &info->fix;
var = &info->var;
......@@ -463,7 +463,7 @@ static void __init offb_init_fb(const char *name, const char *full_name,
unsigned long base = address & 0xff000000UL;
par->cmap_adr =
ioremap(base + 0x7ff000, 0x1000) + 0xcc0;
par->cmap_data = info->cmap_adr + 1;
par->cmap_data = par->cmap_adr + 1;
par->cmap_type = cmap_m64;
} else if (device_is_compatible(dp, "pci1014,b7")) {
unsigned long regbase = dp->addrs[0].address;
......@@ -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",
GET_FB_IDX(info->info.node), full_name);
GET_FB_IDX(info->node), full_name);
}
MODULE_LICENSE("GPL");
......@@ -1281,4 +1281,4 @@ do { \
} \
} while (0)
#endif PM3FB_H
#endif /* PM3FB_H */
......@@ -73,7 +73,6 @@ struct display {
#endif
/* Filled in by the low-level console driver */
struct vc_data *conp; /* pointer to console data */
struct fb_info *fb_info; /* frame buffer for this console */
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