diff options
Diffstat (limited to 'drivers/video/amifb.c')
-rw-r--r-- | drivers/video/amifb.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/video/amifb.c b/drivers/video/amifb.c index d549e215f3c5..3033c72dea20 100644 --- a/drivers/video/amifb.c +++ b/drivers/video/amifb.c | |||
@@ -590,6 +590,8 @@ static u_short maxfmode, chipset; | |||
590 | #define highw(x) ((u_long)(x)>>16 & 0xffff) | 590 | #define highw(x) ((u_long)(x)>>16 & 0xffff) |
591 | #define loww(x) ((u_long)(x) & 0xffff) | 591 | #define loww(x) ((u_long)(x) & 0xffff) |
592 | 592 | ||
593 | #define custom amiga_custom | ||
594 | |||
593 | #define VBlankOn() custom.intena = IF_SETCLR|IF_COPER | 595 | #define VBlankOn() custom.intena = IF_SETCLR|IF_COPER |
594 | #define VBlankOff() custom.intena = IF_COPER | 596 | #define VBlankOff() custom.intena = IF_COPER |
595 | 597 | ||
@@ -1129,9 +1131,7 @@ static void amifb_copyarea(struct fb_info *info, | |||
1129 | const struct fb_copyarea *region); | 1131 | const struct fb_copyarea *region); |
1130 | static void amifb_imageblit(struct fb_info *info, | 1132 | static void amifb_imageblit(struct fb_info *info, |
1131 | const struct fb_image *image); | 1133 | const struct fb_image *image); |
1132 | static int amifb_ioctl(struct inode *inode, struct file *file, | 1134 | static int amifb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg); |
1133 | unsigned int cmd, unsigned long arg, | ||
1134 | struct fb_info *info); | ||
1135 | 1135 | ||
1136 | 1136 | ||
1137 | /* | 1137 | /* |
@@ -1164,8 +1164,8 @@ static void ami_update_display(void); | |||
1164 | static void ami_init_display(void); | 1164 | static void ami_init_display(void); |
1165 | static void ami_do_blank(void); | 1165 | static void ami_do_blank(void); |
1166 | static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix); | 1166 | static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix); |
1167 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data); | 1167 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data); |
1168 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data); | 1168 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data); |
1169 | static int ami_get_cursorstate(struct fb_cursorstate *state); | 1169 | static int ami_get_cursorstate(struct fb_cursorstate *state); |
1170 | static int ami_set_cursorstate(struct fb_cursorstate *state); | 1170 | static int ami_set_cursorstate(struct fb_cursorstate *state); |
1171 | static void ami_set_sprite(void); | 1171 | static void ami_set_sprite(void); |
@@ -2170,15 +2170,15 @@ static void amifb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
2170 | * Amiga Frame Buffer Specific ioctls | 2170 | * Amiga Frame Buffer Specific ioctls |
2171 | */ | 2171 | */ |
2172 | 2172 | ||
2173 | static int amifb_ioctl(struct inode *inode, struct file *file, | 2173 | static int amifb_ioctl(struct fb_info *info, |
2174 | unsigned int cmd, unsigned long arg, | 2174 | unsigned int cmd, unsigned long arg) |
2175 | struct fb_info *info) | ||
2176 | { | 2175 | { |
2177 | union { | 2176 | union { |
2178 | struct fb_fix_cursorinfo fix; | 2177 | struct fb_fix_cursorinfo fix; |
2179 | struct fb_var_cursorinfo var; | 2178 | struct fb_var_cursorinfo var; |
2180 | struct fb_cursorstate state; | 2179 | struct fb_cursorstate state; |
2181 | } crsr; | 2180 | } crsr; |
2181 | void __user *argp = (void __user *)arg; | ||
2182 | int i; | 2182 | int i; |
2183 | 2183 | ||
2184 | switch (cmd) { | 2184 | switch (cmd) { |
@@ -2186,33 +2186,32 @@ static int amifb_ioctl(struct inode *inode, struct file *file, | |||
2186 | i = ami_get_fix_cursorinfo(&crsr.fix); | 2186 | i = ami_get_fix_cursorinfo(&crsr.fix); |
2187 | if (i) | 2187 | if (i) |
2188 | return i; | 2188 | return i; |
2189 | return copy_to_user((void *)arg, &crsr.fix, | 2189 | return copy_to_user(argp, &crsr.fix, |
2190 | sizeof(crsr.fix)) ? -EFAULT : 0; | 2190 | sizeof(crsr.fix)) ? -EFAULT : 0; |
2191 | 2191 | ||
2192 | case FBIOGET_VCURSORINFO: | 2192 | case FBIOGET_VCURSORINFO: |
2193 | i = ami_get_var_cursorinfo(&crsr.var, | 2193 | i = ami_get_var_cursorinfo(&crsr.var, |
2194 | ((struct fb_var_cursorinfo *)arg)->data); | 2194 | ((struct fb_var_cursorinfo __user *)arg)->data); |
2195 | if (i) | 2195 | if (i) |
2196 | return i; | 2196 | return i; |
2197 | return copy_to_user((void *)arg, &crsr.var, | 2197 | return copy_to_user(argp, &crsr.var, |
2198 | sizeof(crsr.var)) ? -EFAULT : 0; | 2198 | sizeof(crsr.var)) ? -EFAULT : 0; |
2199 | 2199 | ||
2200 | case FBIOPUT_VCURSORINFO: | 2200 | case FBIOPUT_VCURSORINFO: |
2201 | if (copy_from_user(&crsr.var, (void *)arg, | 2201 | if (copy_from_user(&crsr.var, argp, sizeof(crsr.var))) |
2202 | sizeof(crsr.var))) | ||
2203 | return -EFAULT; | 2202 | return -EFAULT; |
2204 | return ami_set_var_cursorinfo(&crsr.var, | 2203 | return ami_set_var_cursorinfo(&crsr.var, |
2205 | ((struct fb_var_cursorinfo *)arg)->data); | 2204 | ((struct fb_var_cursorinfo __user *)arg)->data); |
2206 | 2205 | ||
2207 | case FBIOGET_CURSORSTATE: | 2206 | case FBIOGET_CURSORSTATE: |
2208 | i = ami_get_cursorstate(&crsr.state); | 2207 | i = ami_get_cursorstate(&crsr.state); |
2209 | if (i) | 2208 | if (i) |
2210 | return i; | 2209 | return i; |
2211 | return copy_to_user((void *)arg, &crsr.state, | 2210 | return copy_to_user(argp, &crsr.state, |
2212 | sizeof(crsr.state)) ? -EFAULT : 0; | 2211 | sizeof(crsr.state)) ? -EFAULT : 0; |
2213 | 2212 | ||
2214 | case FBIOPUT_CURSORSTATE: | 2213 | case FBIOPUT_CURSORSTATE: |
2215 | if (copy_from_user(&crsr.state, (void *)arg, | 2214 | if (copy_from_user(&crsr.state, argp, |
2216 | sizeof(crsr.state))) | 2215 | sizeof(crsr.state))) |
2217 | return -EFAULT; | 2216 | return -EFAULT; |
2218 | return ami_set_cursorstate(&crsr.state); | 2217 | return ami_set_cursorstate(&crsr.state); |
@@ -3325,7 +3324,7 @@ static int ami_get_fix_cursorinfo(struct fb_fix_cursorinfo *fix) | |||
3325 | return 0; | 3324 | return 0; |
3326 | } | 3325 | } |
3327 | 3326 | ||
3328 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | 3327 | static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data) |
3329 | { | 3328 | { |
3330 | struct amifb_par *par = ¤tpar; | 3329 | struct amifb_par *par = ¤tpar; |
3331 | register u_short *lspr, *sspr; | 3330 | register u_short *lspr, *sspr; |
@@ -3347,14 +3346,14 @@ static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3347 | var->yspot = par->crsr.spot_y; | 3346 | var->yspot = par->crsr.spot_y; |
3348 | if (size > var->height*var->width) | 3347 | if (size > var->height*var->width) |
3349 | return -ENAMETOOLONG; | 3348 | return -ENAMETOOLONG; |
3350 | if (!access_ok(VERIFY_WRITE, (void *)data, size)) | 3349 | if (!access_ok(VERIFY_WRITE, data, size)) |
3351 | return -EFAULT; | 3350 | return -EFAULT; |
3352 | delta = 1<<par->crsr.fmode; | 3351 | delta = 1<<par->crsr.fmode; |
3353 | lspr = lofsprite + (delta<<1); | 3352 | lspr = lofsprite + (delta<<1); |
3354 | if (par->bplcon0 & BPC0_LACE) | 3353 | if (par->bplcon0 & BPC0_LACE) |
3355 | sspr = shfsprite + (delta<<1); | 3354 | sspr = shfsprite + (delta<<1); |
3356 | else | 3355 | else |
3357 | sspr = 0; | 3356 | sspr = NULL; |
3358 | for (height = (short)var->height-1; height >= 0; height--) { | 3357 | for (height = (short)var->height-1; height >= 0; height--) { |
3359 | bits = 0; words = delta; datawords = 0; | 3358 | bits = 0; words = delta; datawords = 0; |
3360 | for (width = (short)var->width-1; width >= 0; width--) { | 3359 | for (width = (short)var->width-1; width >= 0; width--) { |
@@ -3400,7 +3399,7 @@ static int ami_get_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3400 | return 0; | 3399 | return 0; |
3401 | } | 3400 | } |
3402 | 3401 | ||
3403 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | 3402 | static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char __user *data) |
3404 | { | 3403 | { |
3405 | struct amifb_par *par = ¤tpar; | 3404 | struct amifb_par *par = ¤tpar; |
3406 | register u_short *lspr, *sspr; | 3405 | register u_short *lspr, *sspr; |
@@ -3427,7 +3426,7 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3427 | return -EINVAL; | 3426 | return -EINVAL; |
3428 | if (!var->height) | 3427 | if (!var->height) |
3429 | return -EINVAL; | 3428 | return -EINVAL; |
3430 | if (!access_ok(VERIFY_READ, (void *)data, var->width*var->height)) | 3429 | if (!access_ok(VERIFY_READ, data, var->width*var->height)) |
3431 | return -EFAULT; | 3430 | return -EFAULT; |
3432 | delta = 1<<fmode; | 3431 | delta = 1<<fmode; |
3433 | lofsprite = shfsprite = (u_short *)spritememory; | 3432 | lofsprite = shfsprite = (u_short *)spritememory; |
@@ -3442,13 +3441,13 @@ static int ami_set_var_cursorinfo(struct fb_var_cursorinfo *var, u_char *data) | |||
3442 | if (((var->height+2)<<fmode<<2) > SPRITEMEMSIZE) | 3441 | if (((var->height+2)<<fmode<<2) > SPRITEMEMSIZE) |
3443 | return -EINVAL; | 3442 | return -EINVAL; |
3444 | memset(lspr, 0, (var->height+2)<<fmode<<2); | 3443 | memset(lspr, 0, (var->height+2)<<fmode<<2); |
3445 | sspr = 0; | 3444 | sspr = NULL; |
3446 | } | 3445 | } |
3447 | for (height = (short)var->height-1; height >= 0; height--) { | 3446 | for (height = (short)var->height-1; height >= 0; height--) { |
3448 | bits = 16; words = delta; datawords = 0; | 3447 | bits = 16; words = delta; datawords = 0; |
3449 | for (width = (short)var->width-1; width >= 0; width--) { | 3448 | for (width = (short)var->width-1; width >= 0; width--) { |
3450 | unsigned long tdata = 0; | 3449 | unsigned long tdata = 0; |
3451 | get_user(tdata, (char *)data); | 3450 | get_user(tdata, data); |
3452 | data++; | 3451 | data++; |
3453 | #ifdef __mc68000__ | 3452 | #ifdef __mc68000__ |
3454 | asm volatile ( | 3453 | asm volatile ( |