Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/drivers/video/fbmem.c |
| 3 | * |
| 4 | * Copyright (C) 1994 Martin Schaller |
| 5 | * |
| 6 | * 2001 - Documented with DocBook |
| 7 | * - Brad Douglas <brad@neruo.com> |
| 8 | * |
| 9 | * This file is subject to the terms and conditions of the GNU General Public |
| 10 | * License. See the file COPYING in the main directory of this archive |
| 11 | * for more details. |
| 12 | */ |
| 13 | |
| 14 | #include <linux/config.h> |
| 15 | #include <linux/module.h> |
| 16 | |
| 17 | #include <linux/types.h> |
| 18 | #include <linux/errno.h> |
| 19 | #include <linux/sched.h> |
| 20 | #include <linux/smp_lock.h> |
| 21 | #include <linux/kernel.h> |
| 22 | #include <linux/major.h> |
| 23 | #include <linux/slab.h> |
| 24 | #include <linux/mm.h> |
| 25 | #include <linux/mman.h> |
| 26 | #include <linux/tty.h> |
| 27 | #include <linux/init.h> |
| 28 | #include <linux/linux_logo.h> |
| 29 | #include <linux/proc_fs.h> |
| 30 | #include <linux/console.h> |
| 31 | #ifdef CONFIG_KMOD |
| 32 | #include <linux/kmod.h> |
| 33 | #endif |
| 34 | #include <linux/devfs_fs_kernel.h> |
| 35 | #include <linux/err.h> |
| 36 | #include <linux/kernel.h> |
| 37 | #include <linux/device.h> |
| 38 | #include <linux/efi.h> |
| 39 | |
| 40 | #if defined(__mc68000__) || defined(CONFIG_APUS) |
| 41 | #include <asm/setup.h> |
| 42 | #endif |
| 43 | |
| 44 | #include <asm/io.h> |
| 45 | #include <asm/uaccess.h> |
| 46 | #include <asm/page.h> |
| 47 | #include <asm/pgtable.h> |
| 48 | |
| 49 | #include <linux/fb.h> |
| 50 | |
| 51 | /* |
| 52 | * Frame buffer device initialization and setup routines |
| 53 | */ |
| 54 | |
| 55 | #define FBPIXMAPSIZE (1024 * 8) |
| 56 | |
| 57 | static struct notifier_block *fb_notifier_list; |
| 58 | struct fb_info *registered_fb[FB_MAX]; |
| 59 | int num_registered_fb; |
| 60 | |
| 61 | /* |
| 62 | * Helpers |
| 63 | */ |
| 64 | |
Antonino A. Daplas | b8c9094 | 2005-09-09 13:04:37 -0700 | [diff] [blame] | 65 | int fb_get_color_depth(struct fb_var_screeninfo *var, |
| 66 | struct fb_fix_screeninfo *fix) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | { |
Antonino A. Daplas | b8c9094 | 2005-09-09 13:04:37 -0700 | [diff] [blame] | 68 | int depth = 0; |
| 69 | |
| 70 | if (fix->visual == FB_VISUAL_MONO01 || |
| 71 | fix->visual == FB_VISUAL_MONO10) |
| 72 | depth = 1; |
| 73 | else { |
| 74 | if (var->green.length == var->blue.length && |
| 75 | var->green.length == var->red.length && |
| 76 | var->green.offset == var->blue.offset && |
| 77 | var->green.offset == var->red.offset) |
| 78 | depth = var->green.length; |
| 79 | else |
| 80 | depth = var->green.length + var->red.length + |
| 81 | var->blue.length; |
| 82 | } |
| 83 | |
| 84 | return depth; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | } |
| 86 | EXPORT_SYMBOL(fb_get_color_depth); |
| 87 | |
| 88 | /* |
James Simmons | f5a9951 | 2005-06-21 17:16:58 -0700 | [diff] [blame] | 89 | * Data padding functions. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 90 | */ |
James Simmons | f1ab5da | 2005-06-21 17:17:07 -0700 | [diff] [blame] | 91 | void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | { |
Antonino A. Daplas | 829e79b | 2005-09-09 13:10:04 -0700 | [diff] [blame] | 93 | __fb_pad_aligned_buffer(dst, d_pitch, src, s_pitch, height); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | } |
James Simmons | f1ab5da | 2005-06-21 17:17:07 -0700 | [diff] [blame] | 95 | EXPORT_SYMBOL(fb_pad_aligned_buffer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | |
James Simmons | f1ab5da | 2005-06-21 17:17:07 -0700 | [diff] [blame] | 97 | void fb_pad_unaligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 idx, u32 height, |
| 98 | u32 shift_high, u32 shift_low, u32 mod) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | { |
| 100 | u8 mask = (u8) (0xfff << shift_high), tmp; |
| 101 | int i, j; |
| 102 | |
| 103 | for (i = height; i--; ) { |
| 104 | for (j = 0; j < idx; j++) { |
| 105 | tmp = dst[j]; |
| 106 | tmp &= mask; |
| 107 | tmp |= *src >> shift_low; |
| 108 | dst[j] = tmp; |
| 109 | tmp = *src << shift_high; |
| 110 | dst[j+1] = tmp; |
| 111 | src++; |
| 112 | } |
| 113 | tmp = dst[idx]; |
| 114 | tmp &= mask; |
| 115 | tmp |= *src >> shift_low; |
| 116 | dst[idx] = tmp; |
| 117 | if (shift_high < mod) { |
| 118 | tmp = *src << shift_high; |
| 119 | dst[idx+1] = tmp; |
| 120 | } |
| 121 | src++; |
| 122 | dst += d_pitch; |
| 123 | } |
| 124 | } |
James Simmons | f1ab5da | 2005-06-21 17:17:07 -0700 | [diff] [blame] | 125 | EXPORT_SYMBOL(fb_pad_unaligned_buffer); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | |
| 127 | /* |
| 128 | * we need to lock this section since fb_cursor |
| 129 | * may use fb_imageblit() |
| 130 | */ |
| 131 | char* fb_get_buffer_offset(struct fb_info *info, struct fb_pixmap *buf, u32 size) |
| 132 | { |
| 133 | u32 align = buf->buf_align - 1, offset; |
| 134 | char *addr = buf->addr; |
| 135 | |
| 136 | /* If IO mapped, we need to sync before access, no sharing of |
| 137 | * the pixmap is done |
| 138 | */ |
| 139 | if (buf->flags & FB_PIXMAP_IO) { |
| 140 | if (info->fbops->fb_sync && (buf->flags & FB_PIXMAP_SYNC)) |
| 141 | info->fbops->fb_sync(info); |
| 142 | return addr; |
| 143 | } |
| 144 | |
| 145 | /* See if we fit in the remaining pixmap space */ |
| 146 | offset = buf->offset + align; |
| 147 | offset &= ~align; |
| 148 | if (offset + size > buf->size) { |
| 149 | /* We do not fit. In order to be able to re-use the buffer, |
| 150 | * we must ensure no asynchronous DMA'ing or whatever operation |
| 151 | * is in progress, we sync for that. |
| 152 | */ |
| 153 | if (info->fbops->fb_sync && (buf->flags & FB_PIXMAP_SYNC)) |
| 154 | info->fbops->fb_sync(info); |
| 155 | offset = 0; |
| 156 | } |
| 157 | buf->offset = offset + size; |
| 158 | addr += offset; |
| 159 | |
| 160 | return addr; |
| 161 | } |
| 162 | |
| 163 | #ifdef CONFIG_LOGO |
| 164 | #include <linux/linux_logo.h> |
| 165 | |
| 166 | static inline unsigned safe_shift(unsigned d, int n) |
| 167 | { |
| 168 | return n < 0 ? d >> -n : d << n; |
| 169 | } |
| 170 | |
| 171 | static void fb_set_logocmap(struct fb_info *info, |
| 172 | const struct linux_logo *logo) |
| 173 | { |
| 174 | struct fb_cmap palette_cmap; |
| 175 | u16 palette_green[16]; |
| 176 | u16 palette_blue[16]; |
| 177 | u16 palette_red[16]; |
| 178 | int i, j, n; |
| 179 | const unsigned char *clut = logo->clut; |
| 180 | |
| 181 | palette_cmap.start = 0; |
| 182 | palette_cmap.len = 16; |
| 183 | palette_cmap.red = palette_red; |
| 184 | palette_cmap.green = palette_green; |
| 185 | palette_cmap.blue = palette_blue; |
| 186 | palette_cmap.transp = NULL; |
| 187 | |
| 188 | for (i = 0; i < logo->clutsize; i += n) { |
| 189 | n = logo->clutsize - i; |
| 190 | /* palette_cmap provides space for only 16 colors at once */ |
| 191 | if (n > 16) |
| 192 | n = 16; |
| 193 | palette_cmap.start = 32 + i; |
| 194 | palette_cmap.len = n; |
| 195 | for (j = 0; j < n; ++j) { |
| 196 | palette_cmap.red[j] = clut[0] << 8 | clut[0]; |
| 197 | palette_cmap.green[j] = clut[1] << 8 | clut[1]; |
| 198 | palette_cmap.blue[j] = clut[2] << 8 | clut[2]; |
| 199 | clut += 3; |
| 200 | } |
| 201 | fb_set_cmap(&palette_cmap, info); |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | static void fb_set_logo_truepalette(struct fb_info *info, |
| 206 | const struct linux_logo *logo, |
| 207 | u32 *palette) |
| 208 | { |
| 209 | unsigned char mask[9] = { 0,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff }; |
| 210 | unsigned char redmask, greenmask, bluemask; |
| 211 | int redshift, greenshift, blueshift; |
| 212 | int i; |
| 213 | const unsigned char *clut = logo->clut; |
| 214 | |
| 215 | /* |
| 216 | * We have to create a temporary palette since console palette is only |
| 217 | * 16 colors long. |
| 218 | */ |
| 219 | /* Bug: Doesn't obey msb_right ... (who needs that?) */ |
| 220 | redmask = mask[info->var.red.length < 8 ? info->var.red.length : 8]; |
| 221 | greenmask = mask[info->var.green.length < 8 ? info->var.green.length : 8]; |
| 222 | bluemask = mask[info->var.blue.length < 8 ? info->var.blue.length : 8]; |
| 223 | redshift = info->var.red.offset - (8 - info->var.red.length); |
| 224 | greenshift = info->var.green.offset - (8 - info->var.green.length); |
| 225 | blueshift = info->var.blue.offset - (8 - info->var.blue.length); |
| 226 | |
| 227 | for ( i = 0; i < logo->clutsize; i++) { |
| 228 | palette[i+32] = (safe_shift((clut[0] & redmask), redshift) | |
| 229 | safe_shift((clut[1] & greenmask), greenshift) | |
| 230 | safe_shift((clut[2] & bluemask), blueshift)); |
| 231 | clut += 3; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | static void fb_set_logo_directpalette(struct fb_info *info, |
| 236 | const struct linux_logo *logo, |
| 237 | u32 *palette) |
| 238 | { |
| 239 | int redshift, greenshift, blueshift; |
| 240 | int i; |
| 241 | |
| 242 | redshift = info->var.red.offset; |
| 243 | greenshift = info->var.green.offset; |
| 244 | blueshift = info->var.blue.offset; |
| 245 | |
| 246 | for (i = 32; i < logo->clutsize; i++) |
| 247 | palette[i] = i << redshift | i << greenshift | i << blueshift; |
| 248 | } |
| 249 | |
| 250 | static void fb_set_logo(struct fb_info *info, |
| 251 | const struct linux_logo *logo, u8 *dst, |
| 252 | int depth) |
| 253 | { |
Antonino A. Daplas | b8c9094 | 2005-09-09 13:04:37 -0700 | [diff] [blame] | 254 | int i, j, k; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | const u8 *src = logo->data; |
Antonino A. Daplas | b8c9094 | 2005-09-09 13:04:37 -0700 | [diff] [blame] | 256 | u8 xor = (info->fix.visual == FB_VISUAL_MONO01) ? 0xff : 0; |
| 257 | u8 fg = 1, d; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | |
Antonino A. Daplas | b8c9094 | 2005-09-09 13:04:37 -0700 | [diff] [blame] | 259 | if (fb_get_color_depth(&info->var, &info->fix) == 3) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | fg = 7; |
| 261 | |
Antonino A. Daplas | b8c9094 | 2005-09-09 13:04:37 -0700 | [diff] [blame] | 262 | if (info->fix.visual == FB_VISUAL_MONO01 || |
| 263 | info->fix.visual == FB_VISUAL_MONO10) |
| 264 | fg = ~((u8) (0xfff << info->var.green.length)); |
| 265 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 266 | switch (depth) { |
| 267 | case 4: |
| 268 | for (i = 0; i < logo->height; i++) |
| 269 | for (j = 0; j < logo->width; src++) { |
| 270 | *dst++ = *src >> 4; |
| 271 | j++; |
| 272 | if (j < logo->width) { |
| 273 | *dst++ = *src & 0x0f; |
| 274 | j++; |
| 275 | } |
| 276 | } |
| 277 | break; |
| 278 | case 1: |
| 279 | for (i = 0; i < logo->height; i++) { |
| 280 | for (j = 0; j < logo->width; src++) { |
| 281 | d = *src ^ xor; |
| 282 | for (k = 7; k >= 0; k--) { |
| 283 | *dst++ = ((d >> k) & 1) ? fg : 0; |
| 284 | j++; |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | break; |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | /* |
| 293 | * Three (3) kinds of logo maps exist. linux_logo_clut224 (>16 colors), |
| 294 | * linux_logo_vga16 (16 colors) and linux_logo_mono (2 colors). Depending on |
| 295 | * the visual format and color depth of the framebuffer, the DAC, the |
| 296 | * pseudo_palette, and the logo data will be adjusted accordingly. |
| 297 | * |
| 298 | * Case 1 - linux_logo_clut224: |
| 299 | * Color exceeds the number of console colors (16), thus we set the hardware DAC |
| 300 | * using fb_set_cmap() appropriately. The "needs_cmapreset" flag will be set. |
| 301 | * |
| 302 | * For visuals that require color info from the pseudo_palette, we also construct |
| 303 | * one for temporary use. The "needs_directpalette" or "needs_truepalette" flags |
| 304 | * will be set. |
| 305 | * |
| 306 | * Case 2 - linux_logo_vga16: |
| 307 | * The number of colors just matches the console colors, thus there is no need |
| 308 | * to set the DAC or the pseudo_palette. However, the bitmap is packed, ie, |
| 309 | * each byte contains color information for two pixels (upper and lower nibble). |
| 310 | * To be consistent with fb_imageblit() usage, we therefore separate the two |
| 311 | * nibbles into separate bytes. The "depth" flag will be set to 4. |
| 312 | * |
| 313 | * Case 3 - linux_logo_mono: |
| 314 | * This is similar with Case 2. Each byte contains information for 8 pixels. |
| 315 | * We isolate each bit and expand each into a byte. The "depth" flag will |
| 316 | * be set to 1. |
| 317 | */ |
| 318 | static struct logo_data { |
| 319 | int depth; |
| 320 | int needs_directpalette; |
| 321 | int needs_truepalette; |
| 322 | int needs_cmapreset; |
| 323 | const struct linux_logo *logo; |
| 324 | } fb_logo; |
| 325 | |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 326 | static void fb_rotate_logo_ud(const u8 *in, u8 *out, u32 width, u32 height) |
| 327 | { |
| 328 | u32 size = width * height, i; |
| 329 | |
| 330 | out += size - 1; |
| 331 | |
| 332 | for (i = size; i--; ) |
| 333 | *out-- = *in++; |
| 334 | } |
| 335 | |
| 336 | static void fb_rotate_logo_cw(const u8 *in, u8 *out, u32 width, u32 height) |
| 337 | { |
| 338 | int i, j, w = width - 1; |
| 339 | |
| 340 | for (i = 0; i < height; i++) |
| 341 | for (j = 0; j < width; j++) |
| 342 | out[height * j + w - i] = *in++; |
| 343 | } |
| 344 | |
| 345 | static void fb_rotate_logo_ccw(const u8 *in, u8 *out, u32 width, u32 height) |
| 346 | { |
| 347 | int i, j, w = width - 1; |
| 348 | |
| 349 | for (i = 0; i < height; i++) |
| 350 | for (j = 0; j < width; j++) |
| 351 | out[height * (w - j) + i] = *in++; |
| 352 | } |
| 353 | |
| 354 | static void fb_rotate_logo(struct fb_info *info, u8 *dst, |
| 355 | struct fb_image *image, int rotate) |
| 356 | { |
| 357 | u32 tmp; |
| 358 | |
| 359 | if (rotate == FB_ROTATE_UD) { |
| 360 | image->dx = info->var.xres - image->width; |
| 361 | image->dy = info->var.yres - image->height; |
| 362 | fb_rotate_logo_ud(image->data, dst, image->width, |
| 363 | image->height); |
| 364 | } else if (rotate == FB_ROTATE_CW) { |
| 365 | tmp = image->width; |
| 366 | image->width = image->height; |
| 367 | image->height = tmp; |
| 368 | image->dx = info->var.xres - image->height; |
| 369 | fb_rotate_logo_cw(image->data, dst, image->width, |
| 370 | image->height); |
| 371 | } else if (rotate == FB_ROTATE_CCW) { |
| 372 | tmp = image->width; |
| 373 | image->width = image->height; |
| 374 | image->height = tmp; |
| 375 | image->dy = info->var.yres - image->width; |
| 376 | fb_rotate_logo_ccw(image->data, dst, image->width, |
| 377 | image->height); |
| 378 | } |
| 379 | |
| 380 | image->data = dst; |
| 381 | } |
| 382 | |
| 383 | static void fb_do_show_logo(struct fb_info *info, struct fb_image *image, |
| 384 | int rotate) |
| 385 | { |
| 386 | int x; |
| 387 | |
| 388 | if (rotate == FB_ROTATE_UR) { |
| 389 | for (x = 0; x < num_online_cpus() && |
| 390 | x * (fb_logo.logo->width + 8) <= |
| 391 | info->var.xres - fb_logo.logo->width; x++) { |
| 392 | info->fbops->fb_imageblit(info, image); |
| 393 | image->dx += fb_logo.logo->width + 8; |
| 394 | } |
| 395 | } else if (rotate == FB_ROTATE_UD) { |
| 396 | for (x = 0; x < num_online_cpus() && |
| 397 | x * (fb_logo.logo->width + 8) <= |
| 398 | info->var.xres - fb_logo.logo->width; x++) { |
| 399 | info->fbops->fb_imageblit(info, image); |
| 400 | image->dx -= fb_logo.logo->width + 8; |
| 401 | } |
| 402 | } else if (rotate == FB_ROTATE_CW) { |
| 403 | for (x = 0; x < num_online_cpus() && |
| 404 | x * (fb_logo.logo->width + 8) <= |
| 405 | info->var.yres - fb_logo.logo->width; x++) { |
| 406 | info->fbops->fb_imageblit(info, image); |
| 407 | image->dy += fb_logo.logo->width + 8; |
| 408 | } |
| 409 | } else if (rotate == FB_ROTATE_CCW) { |
| 410 | for (x = 0; x < num_online_cpus() && |
| 411 | x * (fb_logo.logo->width + 8) <= |
| 412 | info->var.yres - fb_logo.logo->width; x++) { |
| 413 | info->fbops->fb_imageblit(info, image); |
| 414 | image->dy -= fb_logo.logo->width + 8; |
| 415 | } |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | int fb_prepare_logo(struct fb_info *info, int rotate) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 420 | { |
Antonino A. Daplas | b8c9094 | 2005-09-09 13:04:37 -0700 | [diff] [blame] | 421 | int depth = fb_get_color_depth(&info->var, &info->fix); |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 422 | int yres; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 423 | |
| 424 | memset(&fb_logo, 0, sizeof(struct logo_data)); |
| 425 | |
| 426 | if (info->flags & FBINFO_MISC_TILEBLITTING) |
| 427 | return 0; |
| 428 | |
| 429 | if (info->fix.visual == FB_VISUAL_DIRECTCOLOR) { |
| 430 | depth = info->var.blue.length; |
| 431 | if (info->var.red.length < depth) |
| 432 | depth = info->var.red.length; |
| 433 | if (info->var.green.length < depth) |
| 434 | depth = info->var.green.length; |
| 435 | } |
| 436 | |
| 437 | if (depth >= 8) { |
| 438 | switch (info->fix.visual) { |
| 439 | case FB_VISUAL_TRUECOLOR: |
| 440 | fb_logo.needs_truepalette = 1; |
| 441 | break; |
| 442 | case FB_VISUAL_DIRECTCOLOR: |
| 443 | fb_logo.needs_directpalette = 1; |
| 444 | fb_logo.needs_cmapreset = 1; |
| 445 | break; |
| 446 | case FB_VISUAL_PSEUDOCOLOR: |
| 447 | fb_logo.needs_cmapreset = 1; |
| 448 | break; |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | /* Return if no suitable logo was found */ |
| 453 | fb_logo.logo = fb_find_logo(depth); |
| 454 | |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 455 | if (rotate == FB_ROTATE_UR || rotate == FB_ROTATE_UD) |
| 456 | yres = info->var.yres; |
| 457 | else |
| 458 | yres = info->var.xres; |
| 459 | |
| 460 | if (fb_logo.logo && fb_logo.logo->height > yres) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 461 | fb_logo.logo = NULL; |
| 462 | return 0; |
| 463 | } |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 464 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | /* What depth we asked for might be different from what we get */ |
| 466 | if (fb_logo.logo->type == LINUX_LOGO_CLUT224) |
| 467 | fb_logo.depth = 8; |
| 468 | else if (fb_logo.logo->type == LINUX_LOGO_VGA16) |
| 469 | fb_logo.depth = 4; |
| 470 | else |
| 471 | fb_logo.depth = 1; |
| 472 | return fb_logo.logo->height; |
| 473 | } |
| 474 | |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 475 | int fb_show_logo(struct fb_info *info, int rotate) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 476 | { |
| 477 | u32 *palette = NULL, *saved_pseudo_palette = NULL; |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 478 | unsigned char *logo_new = NULL, *logo_rotate = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 479 | struct fb_image image; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | |
| 481 | /* Return if the frame buffer is not mapped or suspended */ |
| 482 | if (fb_logo.logo == NULL || info->state != FBINFO_STATE_RUNNING) |
| 483 | return 0; |
| 484 | |
| 485 | image.depth = 8; |
| 486 | image.data = fb_logo.logo->data; |
| 487 | |
| 488 | if (fb_logo.needs_cmapreset) |
| 489 | fb_set_logocmap(info, fb_logo.logo); |
| 490 | |
| 491 | if (fb_logo.needs_truepalette || |
| 492 | fb_logo.needs_directpalette) { |
| 493 | palette = kmalloc(256 * 4, GFP_KERNEL); |
| 494 | if (palette == NULL) |
| 495 | return 0; |
| 496 | |
| 497 | if (fb_logo.needs_truepalette) |
| 498 | fb_set_logo_truepalette(info, fb_logo.logo, palette); |
| 499 | else |
| 500 | fb_set_logo_directpalette(info, fb_logo.logo, palette); |
| 501 | |
| 502 | saved_pseudo_palette = info->pseudo_palette; |
| 503 | info->pseudo_palette = palette; |
| 504 | } |
| 505 | |
| 506 | if (fb_logo.depth <= 4) { |
| 507 | logo_new = kmalloc(fb_logo.logo->width * fb_logo.logo->height, |
| 508 | GFP_KERNEL); |
| 509 | if (logo_new == NULL) { |
| 510 | kfree(palette); |
| 511 | if (saved_pseudo_palette) |
| 512 | info->pseudo_palette = saved_pseudo_palette; |
| 513 | return 0; |
| 514 | } |
| 515 | image.data = logo_new; |
| 516 | fb_set_logo(info, fb_logo.logo, logo_new, fb_logo.depth); |
| 517 | } |
| 518 | |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 519 | image.dx = 0; |
| 520 | image.dy = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | image.width = fb_logo.logo->width; |
| 522 | image.height = fb_logo.logo->height; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 524 | if (rotate) { |
| 525 | logo_rotate = kmalloc(fb_logo.logo->width * |
| 526 | fb_logo.logo->height, GFP_KERNEL); |
| 527 | if (logo_rotate) |
| 528 | fb_rotate_logo(info, logo_rotate, &image, rotate); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 529 | } |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 530 | |
| 531 | fb_do_show_logo(info, &image, rotate); |
| 532 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | kfree(palette); |
| 534 | if (saved_pseudo_palette != NULL) |
| 535 | info->pseudo_palette = saved_pseudo_palette; |
| 536 | kfree(logo_new); |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 537 | kfree(logo_rotate); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | return fb_logo.logo->height; |
| 539 | } |
| 540 | #else |
Antonino A. Daplas | 9c44e5f | 2005-11-08 21:39:10 -0800 | [diff] [blame] | 541 | int fb_prepare_logo(struct fb_info *info, int rotate) { return 0; } |
| 542 | int fb_show_logo(struct fb_info *info, int rotate) { return 0; } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 543 | #endif /* CONFIG_LOGO */ |
| 544 | |
| 545 | static int fbmem_read_proc(char *buf, char **start, off_t offset, |
| 546 | int len, int *eof, void *private) |
| 547 | { |
| 548 | struct fb_info **fi; |
| 549 | int clen; |
| 550 | |
| 551 | clen = 0; |
| 552 | for (fi = registered_fb; fi < ®istered_fb[FB_MAX] && len < 4000; fi++) |
| 553 | if (*fi) |
| 554 | clen += sprintf(buf + clen, "%d %s\n", |
| 555 | (*fi)->node, |
| 556 | (*fi)->fix.id); |
| 557 | *start = buf + offset; |
| 558 | if (clen > offset) |
| 559 | clen -= offset; |
| 560 | else |
| 561 | clen = 0; |
| 562 | return clen < len ? clen : len; |
| 563 | } |
| 564 | |
| 565 | static ssize_t |
| 566 | fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
| 567 | { |
| 568 | unsigned long p = *ppos; |
| 569 | struct inode *inode = file->f_dentry->d_inode; |
| 570 | int fbidx = iminor(inode); |
| 571 | struct fb_info *info = registered_fb[fbidx]; |
| 572 | u32 *buffer, *dst; |
| 573 | u32 __iomem *src; |
| 574 | int c, i, cnt = 0, err = 0; |
| 575 | unsigned long total_size; |
| 576 | |
| 577 | if (!info || ! info->screen_base) |
| 578 | return -ENODEV; |
| 579 | |
| 580 | if (info->state != FBINFO_STATE_RUNNING) |
| 581 | return -EPERM; |
| 582 | |
| 583 | if (info->fbops->fb_read) |
| 584 | return info->fbops->fb_read(file, buf, count, ppos); |
| 585 | |
| 586 | total_size = info->screen_size; |
| 587 | if (total_size == 0) |
| 588 | total_size = info->fix.smem_len; |
| 589 | |
| 590 | if (p >= total_size) |
| 591 | return 0; |
| 592 | if (count >= total_size) |
| 593 | count = total_size; |
| 594 | if (count + p > total_size) |
| 595 | count = total_size - p; |
| 596 | |
| 597 | cnt = 0; |
| 598 | buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, |
| 599 | GFP_KERNEL); |
| 600 | if (!buffer) |
| 601 | return -ENOMEM; |
| 602 | |
| 603 | src = (u32 __iomem *) (info->screen_base + p); |
| 604 | |
| 605 | if (info->fbops->fb_sync) |
| 606 | info->fbops->fb_sync(info); |
| 607 | |
| 608 | while (count) { |
| 609 | c = (count > PAGE_SIZE) ? PAGE_SIZE : count; |
| 610 | dst = buffer; |
| 611 | for (i = c >> 2; i--; ) |
| 612 | *dst++ = fb_readl(src++); |
| 613 | if (c & 3) { |
| 614 | u8 *dst8 = (u8 *) dst; |
| 615 | u8 __iomem *src8 = (u8 __iomem *) src; |
| 616 | |
| 617 | for (i = c & 3; i--;) |
| 618 | *dst8++ = fb_readb(src8++); |
| 619 | |
| 620 | src = (u32 __iomem *) src8; |
| 621 | } |
| 622 | |
| 623 | if (copy_to_user(buf, buffer, c)) { |
| 624 | err = -EFAULT; |
| 625 | break; |
| 626 | } |
| 627 | *ppos += c; |
| 628 | buf += c; |
| 629 | cnt += c; |
| 630 | count -= c; |
| 631 | } |
| 632 | |
| 633 | kfree(buffer); |
| 634 | return (err) ? err : cnt; |
| 635 | } |
| 636 | |
| 637 | static ssize_t |
| 638 | fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) |
| 639 | { |
| 640 | unsigned long p = *ppos; |
| 641 | struct inode *inode = file->f_dentry->d_inode; |
| 642 | int fbidx = iminor(inode); |
| 643 | struct fb_info *info = registered_fb[fbidx]; |
| 644 | u32 *buffer, *src; |
| 645 | u32 __iomem *dst; |
| 646 | int c, i, cnt = 0, err; |
| 647 | unsigned long total_size; |
| 648 | |
| 649 | if (!info || !info->screen_base) |
| 650 | return -ENODEV; |
| 651 | |
| 652 | if (info->state != FBINFO_STATE_RUNNING) |
| 653 | return -EPERM; |
| 654 | |
| 655 | if (info->fbops->fb_write) |
| 656 | return info->fbops->fb_write(file, buf, count, ppos); |
| 657 | |
| 658 | total_size = info->screen_size; |
| 659 | if (total_size == 0) |
| 660 | total_size = info->fix.smem_len; |
| 661 | |
| 662 | if (p > total_size) |
| 663 | return -ENOSPC; |
| 664 | if (count >= total_size) |
| 665 | count = total_size; |
| 666 | err = 0; |
| 667 | if (count + p > total_size) { |
| 668 | count = total_size - p; |
| 669 | err = -ENOSPC; |
| 670 | } |
| 671 | cnt = 0; |
| 672 | buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count, |
| 673 | GFP_KERNEL); |
| 674 | if (!buffer) |
| 675 | return -ENOMEM; |
| 676 | |
| 677 | dst = (u32 __iomem *) (info->screen_base + p); |
| 678 | |
| 679 | if (info->fbops->fb_sync) |
| 680 | info->fbops->fb_sync(info); |
| 681 | |
| 682 | while (count) { |
| 683 | c = (count > PAGE_SIZE) ? PAGE_SIZE : count; |
| 684 | src = buffer; |
| 685 | if (copy_from_user(src, buf, c)) { |
| 686 | err = -EFAULT; |
| 687 | break; |
| 688 | } |
| 689 | for (i = c >> 2; i--; ) |
| 690 | fb_writel(*src++, dst++); |
| 691 | if (c & 3) { |
| 692 | u8 *src8 = (u8 *) src; |
| 693 | u8 __iomem *dst8 = (u8 __iomem *) dst; |
| 694 | |
| 695 | for (i = c & 3; i--; ) |
| 696 | fb_writeb(*src8++, dst8++); |
| 697 | |
| 698 | dst = (u32 __iomem *) dst8; |
| 699 | } |
| 700 | *ppos += c; |
| 701 | buf += c; |
| 702 | cnt += c; |
| 703 | count -= c; |
| 704 | } |
| 705 | kfree(buffer); |
| 706 | |
| 707 | return (err) ? err : cnt; |
| 708 | } |
| 709 | |
| 710 | #ifdef CONFIG_KMOD |
| 711 | static void try_to_load(int fb) |
| 712 | { |
| 713 | request_module("fb%d", fb); |
| 714 | } |
| 715 | #endif /* CONFIG_KMOD */ |
| 716 | |
| 717 | int |
| 718 | fb_pan_display(struct fb_info *info, struct fb_var_screeninfo *var) |
| 719 | { |
| 720 | int xoffset = var->xoffset; |
| 721 | int yoffset = var->yoffset; |
| 722 | int err; |
| 723 | |
| 724 | if (xoffset < 0 || yoffset < 0 || !info->fbops->fb_pan_display || |
| 725 | xoffset + info->var.xres > info->var.xres_virtual || |
| 726 | yoffset + info->var.yres > info->var.yres_virtual) |
| 727 | return -EINVAL; |
| 728 | if ((err = info->fbops->fb_pan_display(var, info))) |
| 729 | return err; |
| 730 | info->var.xoffset = var->xoffset; |
| 731 | info->var.yoffset = var->yoffset; |
| 732 | if (var->vmode & FB_VMODE_YWRAP) |
| 733 | info->var.vmode |= FB_VMODE_YWRAP; |
| 734 | else |
| 735 | info->var.vmode &= ~FB_VMODE_YWRAP; |
| 736 | return 0; |
| 737 | } |
| 738 | |
| 739 | int |
| 740 | fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var) |
| 741 | { |
Antonino A. Daplas | 3edea48 | 2005-08-15 21:29:11 +0800 | [diff] [blame] | 742 | int err, flags = info->flags; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 743 | |
| 744 | if (var->activate & FB_ACTIVATE_INV_MODE) { |
| 745 | struct fb_videomode mode1, mode2; |
| 746 | int ret = 0; |
| 747 | |
| 748 | fb_var_to_videomode(&mode1, var); |
| 749 | fb_var_to_videomode(&mode2, &info->var); |
| 750 | /* make sure we don't delete the videomode of current var */ |
| 751 | ret = fb_mode_is_equal(&mode1, &mode2); |
| 752 | |
| 753 | if (!ret) { |
| 754 | struct fb_event event; |
| 755 | |
| 756 | event.info = info; |
| 757 | event.data = &mode1; |
| 758 | ret = notifier_call_chain(&fb_notifier_list, |
| 759 | FB_EVENT_MODE_DELETE, &event); |
| 760 | } |
| 761 | |
| 762 | if (!ret) |
| 763 | fb_delete_videomode(&mode1, &info->modelist); |
| 764 | |
| 765 | return ret; |
| 766 | } |
| 767 | |
| 768 | if ((var->activate & FB_ACTIVATE_FORCE) || |
| 769 | memcmp(&info->var, var, sizeof(struct fb_var_screeninfo))) { |
| 770 | if (!info->fbops->fb_check_var) { |
| 771 | *var = info->var; |
| 772 | return 0; |
| 773 | } |
| 774 | |
| 775 | if ((err = info->fbops->fb_check_var(var, info))) |
| 776 | return err; |
| 777 | |
| 778 | if ((var->activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) { |
| 779 | struct fb_videomode mode; |
| 780 | int err = 0; |
| 781 | |
| 782 | info->var = *var; |
| 783 | if (info->fbops->fb_set_par) |
| 784 | info->fbops->fb_set_par(info); |
| 785 | |
| 786 | fb_pan_display(info, &info->var); |
| 787 | |
| 788 | fb_set_cmap(&info->cmap, info); |
| 789 | |
| 790 | fb_var_to_videomode(&mode, &info->var); |
| 791 | |
| 792 | if (info->modelist.prev && info->modelist.next && |
| 793 | !list_empty(&info->modelist)) |
| 794 | err = fb_add_videomode(&mode, &info->modelist); |
| 795 | |
Antonino A. Daplas | 3edea48 | 2005-08-15 21:29:11 +0800 | [diff] [blame] | 796 | if (!err && (flags & FBINFO_MISC_USEREVENT)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 797 | struct fb_event event; |
Antonino A. Daplas | 7726e9e | 2005-09-09 13:04:29 -0700 | [diff] [blame] | 798 | int evnt = (var->activate & FB_ACTIVATE_ALL) ? |
| 799 | FB_EVENT_MODE_CHANGE_ALL : |
| 800 | FB_EVENT_MODE_CHANGE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 801 | |
| 802 | info->flags &= ~FBINFO_MISC_USEREVENT; |
| 803 | event.info = info; |
Antonino A. Daplas | 7726e9e | 2005-09-09 13:04:29 -0700 | [diff] [blame] | 804 | notifier_call_chain(&fb_notifier_list, evnt, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 805 | &event); |
| 806 | } |
| 807 | } |
| 808 | } |
| 809 | return 0; |
| 810 | } |
| 811 | |
| 812 | int |
| 813 | fb_blank(struct fb_info *info, int blank) |
| 814 | { |
| 815 | int ret = -EINVAL; |
| 816 | |
| 817 | if (blank > FB_BLANK_POWERDOWN) |
| 818 | blank = FB_BLANK_POWERDOWN; |
| 819 | |
| 820 | if (info->fbops->fb_blank) |
| 821 | ret = info->fbops->fb_blank(blank, info); |
| 822 | |
| 823 | if (!ret) { |
| 824 | struct fb_event event; |
| 825 | |
| 826 | event.info = info; |
| 827 | event.data = ␣ |
| 828 | notifier_call_chain(&fb_notifier_list, FB_EVENT_BLANK, &event); |
| 829 | } |
| 830 | |
| 831 | return ret; |
| 832 | } |
| 833 | |
| 834 | static int |
| 835 | fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd, |
| 836 | unsigned long arg) |
| 837 | { |
| 838 | int fbidx = iminor(inode); |
| 839 | struct fb_info *info = registered_fb[fbidx]; |
| 840 | struct fb_ops *fb = info->fbops; |
| 841 | struct fb_var_screeninfo var; |
| 842 | struct fb_fix_screeninfo fix; |
| 843 | struct fb_con2fbmap con2fb; |
| 844 | struct fb_cmap_user cmap; |
| 845 | struct fb_event event; |
| 846 | void __user *argp = (void __user *)arg; |
| 847 | int i; |
| 848 | |
| 849 | if (!fb) |
| 850 | return -ENODEV; |
| 851 | switch (cmd) { |
| 852 | case FBIOGET_VSCREENINFO: |
| 853 | return copy_to_user(argp, &info->var, |
| 854 | sizeof(var)) ? -EFAULT : 0; |
| 855 | case FBIOPUT_VSCREENINFO: |
| 856 | if (copy_from_user(&var, argp, sizeof(var))) |
| 857 | return -EFAULT; |
| 858 | acquire_console_sem(); |
| 859 | info->flags |= FBINFO_MISC_USEREVENT; |
| 860 | i = fb_set_var(info, &var); |
| 861 | info->flags &= ~FBINFO_MISC_USEREVENT; |
| 862 | release_console_sem(); |
| 863 | if (i) return i; |
| 864 | if (copy_to_user(argp, &var, sizeof(var))) |
| 865 | return -EFAULT; |
| 866 | return 0; |
| 867 | case FBIOGET_FSCREENINFO: |
| 868 | return copy_to_user(argp, &info->fix, |
| 869 | sizeof(fix)) ? -EFAULT : 0; |
| 870 | case FBIOPUTCMAP: |
| 871 | if (copy_from_user(&cmap, argp, sizeof(cmap))) |
| 872 | return -EFAULT; |
| 873 | return (fb_set_user_cmap(&cmap, info)); |
| 874 | case FBIOGETCMAP: |
| 875 | if (copy_from_user(&cmap, argp, sizeof(cmap))) |
| 876 | return -EFAULT; |
| 877 | return fb_cmap_to_user(&info->cmap, &cmap); |
| 878 | case FBIOPAN_DISPLAY: |
| 879 | if (copy_from_user(&var, argp, sizeof(var))) |
| 880 | return -EFAULT; |
| 881 | acquire_console_sem(); |
| 882 | i = fb_pan_display(info, &var); |
| 883 | release_console_sem(); |
| 884 | if (i) |
| 885 | return i; |
| 886 | if (copy_to_user(argp, &var, sizeof(var))) |
| 887 | return -EFAULT; |
| 888 | return 0; |
| 889 | case FBIO_CURSOR: |
| 890 | return -EINVAL; |
| 891 | case FBIOGET_CON2FBMAP: |
| 892 | if (copy_from_user(&con2fb, argp, sizeof(con2fb))) |
| 893 | return -EFAULT; |
| 894 | if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) |
| 895 | return -EINVAL; |
| 896 | con2fb.framebuffer = -1; |
| 897 | event.info = info; |
| 898 | event.data = &con2fb; |
| 899 | notifier_call_chain(&fb_notifier_list, |
| 900 | FB_EVENT_GET_CONSOLE_MAP, &event); |
| 901 | return copy_to_user(argp, &con2fb, |
| 902 | sizeof(con2fb)) ? -EFAULT : 0; |
| 903 | case FBIOPUT_CON2FBMAP: |
| 904 | if (copy_from_user(&con2fb, argp, sizeof(con2fb))) |
| 905 | return - EFAULT; |
| 906 | if (con2fb.console < 0 || con2fb.console > MAX_NR_CONSOLES) |
| 907 | return -EINVAL; |
| 908 | if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX) |
| 909 | return -EINVAL; |
| 910 | #ifdef CONFIG_KMOD |
| 911 | if (!registered_fb[con2fb.framebuffer]) |
| 912 | try_to_load(con2fb.framebuffer); |
| 913 | #endif /* CONFIG_KMOD */ |
| 914 | if (!registered_fb[con2fb.framebuffer]) |
| 915 | return -EINVAL; |
| 916 | event.info = info; |
| 917 | event.data = &con2fb; |
| 918 | return notifier_call_chain(&fb_notifier_list, |
| 919 | FB_EVENT_SET_CONSOLE_MAP, |
| 920 | &event); |
| 921 | case FBIOBLANK: |
| 922 | acquire_console_sem(); |
| 923 | info->flags |= FBINFO_MISC_USEREVENT; |
| 924 | i = fb_blank(info, arg); |
| 925 | info->flags &= ~FBINFO_MISC_USEREVENT; |
| 926 | release_console_sem(); |
| 927 | return i; |
| 928 | default: |
| 929 | if (fb->fb_ioctl == NULL) |
| 930 | return -EINVAL; |
| 931 | return fb->fb_ioctl(inode, file, cmd, arg, info); |
| 932 | } |
| 933 | } |
| 934 | |
| 935 | #ifdef CONFIG_COMPAT |
| 936 | static long |
| 937 | fb_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
| 938 | { |
| 939 | int fbidx = iminor(file->f_dentry->d_inode); |
| 940 | struct fb_info *info = registered_fb[fbidx]; |
| 941 | struct fb_ops *fb = info->fbops; |
| 942 | long ret; |
| 943 | |
| 944 | if (fb->fb_compat_ioctl == NULL) |
| 945 | return -ENOIOCTLCMD; |
| 946 | lock_kernel(); |
| 947 | ret = fb->fb_compat_ioctl(file, cmd, arg, info); |
| 948 | unlock_kernel(); |
| 949 | return ret; |
| 950 | } |
| 951 | #endif |
| 952 | |
| 953 | static int |
| 954 | fb_mmap(struct file *file, struct vm_area_struct * vma) |
| 955 | { |
| 956 | int fbidx = iminor(file->f_dentry->d_inode); |
| 957 | struct fb_info *info = registered_fb[fbidx]; |
| 958 | struct fb_ops *fb = info->fbops; |
| 959 | unsigned long off; |
| 960 | #if !defined(__sparc__) || defined(__sparc_v9__) |
| 961 | unsigned long start; |
| 962 | u32 len; |
| 963 | #endif |
| 964 | |
| 965 | if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) |
| 966 | return -EINVAL; |
| 967 | off = vma->vm_pgoff << PAGE_SHIFT; |
| 968 | if (!fb) |
| 969 | return -ENODEV; |
| 970 | if (fb->fb_mmap) { |
| 971 | int res; |
| 972 | lock_kernel(); |
| 973 | res = fb->fb_mmap(info, file, vma); |
| 974 | unlock_kernel(); |
| 975 | return res; |
| 976 | } |
| 977 | |
| 978 | #if defined(__sparc__) && !defined(__sparc_v9__) |
| 979 | /* Should never get here, all fb drivers should have their own |
| 980 | mmap routines */ |
| 981 | return -EINVAL; |
| 982 | #else |
| 983 | /* !sparc32... */ |
| 984 | lock_kernel(); |
| 985 | |
| 986 | /* frame buffer memory */ |
| 987 | start = info->fix.smem_start; |
| 988 | len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.smem_len); |
| 989 | if (off >= len) { |
| 990 | /* memory mapped io */ |
| 991 | off -= len; |
| 992 | if (info->var.accel_flags) { |
| 993 | unlock_kernel(); |
| 994 | return -EINVAL; |
| 995 | } |
| 996 | start = info->fix.mmio_start; |
| 997 | len = PAGE_ALIGN((start & ~PAGE_MASK) + info->fix.mmio_len); |
| 998 | } |
| 999 | unlock_kernel(); |
| 1000 | start &= PAGE_MASK; |
| 1001 | if ((vma->vm_end - vma->vm_start + off) > len) |
| 1002 | return -EINVAL; |
| 1003 | off += start; |
| 1004 | vma->vm_pgoff = off >> PAGE_SHIFT; |
| 1005 | /* This is an IO map - tell maydump to skip this VMA */ |
| 1006 | vma->vm_flags |= VM_IO | VM_RESERVED; |
| 1007 | #if defined(__sparc_v9__) |
| 1008 | if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, |
| 1009 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
| 1010 | return -EAGAIN; |
| 1011 | #else |
| 1012 | #if defined(__mc68000__) |
| 1013 | #if defined(CONFIG_SUN3) |
| 1014 | pgprot_val(vma->vm_page_prot) |= SUN3_PAGE_NOCACHE; |
| 1015 | #elif defined(CONFIG_MMU) |
| 1016 | if (CPU_IS_020_OR_030) |
| 1017 | pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE030; |
| 1018 | if (CPU_IS_040_OR_060) { |
| 1019 | pgprot_val(vma->vm_page_prot) &= _CACHEMASK040; |
| 1020 | /* Use no-cache mode, serialized */ |
| 1021 | pgprot_val(vma->vm_page_prot) |= _PAGE_NOCACHE_S; |
| 1022 | } |
| 1023 | #endif |
| 1024 | #elif defined(__powerpc__) |
Roland Dreier | 8b15047 | 2005-10-28 17:46:18 -0700 | [diff] [blame] | 1025 | vma->vm_page_prot = phys_mem_access_prot(file, off >> PAGE_SHIFT, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1026 | vma->vm_end - vma->vm_start, |
| 1027 | vma->vm_page_prot); |
| 1028 | #elif defined(__alpha__) |
| 1029 | /* Caching is off in the I/O space quadrant by design. */ |
| 1030 | #elif defined(__i386__) || defined(__x86_64__) |
| 1031 | if (boot_cpu_data.x86 > 3) |
| 1032 | pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; |
| 1033 | #elif defined(__mips__) |
| 1034 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
| 1035 | #elif defined(__hppa__) |
| 1036 | pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; |
| 1037 | #elif defined(__arm__) || defined(__sh__) || defined(__m32r__) |
| 1038 | vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); |
| 1039 | #elif defined(__ia64__) |
| 1040 | if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start)) |
| 1041 | vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); |
| 1042 | else |
| 1043 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
| 1044 | #else |
| 1045 | #warning What do we have to do here?? |
| 1046 | #endif |
| 1047 | if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, |
| 1048 | vma->vm_end - vma->vm_start, vma->vm_page_prot)) |
| 1049 | return -EAGAIN; |
| 1050 | #endif /* !__sparc_v9__ */ |
| 1051 | return 0; |
| 1052 | #endif /* !sparc32 */ |
| 1053 | } |
| 1054 | |
| 1055 | static int |
| 1056 | fb_open(struct inode *inode, struct file *file) |
| 1057 | { |
| 1058 | int fbidx = iminor(inode); |
| 1059 | struct fb_info *info; |
| 1060 | int res = 0; |
| 1061 | |
| 1062 | if (fbidx >= FB_MAX) |
| 1063 | return -ENODEV; |
| 1064 | #ifdef CONFIG_KMOD |
| 1065 | if (!(info = registered_fb[fbidx])) |
| 1066 | try_to_load(fbidx); |
| 1067 | #endif /* CONFIG_KMOD */ |
| 1068 | if (!(info = registered_fb[fbidx])) |
| 1069 | return -ENODEV; |
| 1070 | if (!try_module_get(info->fbops->owner)) |
| 1071 | return -ENODEV; |
| 1072 | if (info->fbops->fb_open) { |
| 1073 | res = info->fbops->fb_open(info,1); |
| 1074 | if (res) |
| 1075 | module_put(info->fbops->owner); |
| 1076 | } |
| 1077 | return res; |
| 1078 | } |
| 1079 | |
| 1080 | static int |
| 1081 | fb_release(struct inode *inode, struct file *file) |
| 1082 | { |
| 1083 | int fbidx = iminor(inode); |
| 1084 | struct fb_info *info; |
| 1085 | |
| 1086 | lock_kernel(); |
| 1087 | info = registered_fb[fbidx]; |
| 1088 | if (info->fbops->fb_release) |
| 1089 | info->fbops->fb_release(info,1); |
| 1090 | module_put(info->fbops->owner); |
| 1091 | unlock_kernel(); |
| 1092 | return 0; |
| 1093 | } |
| 1094 | |
| 1095 | static struct file_operations fb_fops = { |
| 1096 | .owner = THIS_MODULE, |
| 1097 | .read = fb_read, |
| 1098 | .write = fb_write, |
| 1099 | .ioctl = fb_ioctl, |
| 1100 | #ifdef CONFIG_COMPAT |
| 1101 | .compat_ioctl = fb_compat_ioctl, |
| 1102 | #endif |
| 1103 | .mmap = fb_mmap, |
| 1104 | .open = fb_open, |
| 1105 | .release = fb_release, |
| 1106 | #ifdef HAVE_ARCH_FB_UNMAPPED_AREA |
| 1107 | .get_unmapped_area = get_fb_unmapped_area, |
| 1108 | #endif |
| 1109 | }; |
| 1110 | |
gregkh@suse.de | 56b2293 | 2005-03-23 10:01:41 -0800 | [diff] [blame] | 1111 | static struct class *fb_class; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1112 | |
| 1113 | /** |
| 1114 | * register_framebuffer - registers a frame buffer device |
| 1115 | * @fb_info: frame buffer info structure |
| 1116 | * |
| 1117 | * Registers a frame buffer device @fb_info. |
| 1118 | * |
| 1119 | * Returns negative errno on error, or zero for success. |
| 1120 | * |
| 1121 | */ |
| 1122 | |
| 1123 | int |
| 1124 | register_framebuffer(struct fb_info *fb_info) |
| 1125 | { |
| 1126 | int i; |
| 1127 | struct fb_event event; |
Antonino A. Daplas | 96fe6a2 | 2005-09-09 13:09:58 -0700 | [diff] [blame] | 1128 | struct fb_videomode mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1129 | |
| 1130 | if (num_registered_fb == FB_MAX) |
| 1131 | return -ENXIO; |
| 1132 | num_registered_fb++; |
| 1133 | for (i = 0 ; i < FB_MAX; i++) |
| 1134 | if (!registered_fb[i]) |
| 1135 | break; |
| 1136 | fb_info->node = i; |
| 1137 | |
Greg Kroah-Hartman | 53f4654 | 2005-10-27 22:25:43 -0700 | [diff] [blame] | 1138 | fb_info->class_device = class_device_create(fb_class, NULL, MKDEV(FB_MAJOR, i), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1139 | fb_info->device, "fb%d", i); |
| 1140 | if (IS_ERR(fb_info->class_device)) { |
| 1141 | /* Not fatal */ |
| 1142 | printk(KERN_WARNING "Unable to create class_device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->class_device)); |
| 1143 | fb_info->class_device = NULL; |
| 1144 | } else |
| 1145 | fb_init_class_device(fb_info); |
| 1146 | |
| 1147 | if (fb_info->pixmap.addr == NULL) { |
| 1148 | fb_info->pixmap.addr = kmalloc(FBPIXMAPSIZE, GFP_KERNEL); |
| 1149 | if (fb_info->pixmap.addr) { |
| 1150 | fb_info->pixmap.size = FBPIXMAPSIZE; |
| 1151 | fb_info->pixmap.buf_align = 1; |
| 1152 | fb_info->pixmap.scan_align = 1; |
James Simmons | 58a6064 | 2005-06-21 17:17:08 -0700 | [diff] [blame] | 1153 | fb_info->pixmap.access_align = 32; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1154 | fb_info->pixmap.flags = FB_PIXMAP_DEFAULT; |
| 1155 | } |
| 1156 | } |
| 1157 | fb_info->pixmap.offset = 0; |
| 1158 | |
Antonino A. Daplas | 96fe6a2 | 2005-09-09 13:09:58 -0700 | [diff] [blame] | 1159 | if (!fb_info->modelist.prev || !fb_info->modelist.next) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1160 | INIT_LIST_HEAD(&fb_info->modelist); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1161 | |
Antonino A. Daplas | 96fe6a2 | 2005-09-09 13:09:58 -0700 | [diff] [blame] | 1162 | fb_var_to_videomode(&mode, &fb_info->var); |
| 1163 | fb_add_videomode(&mode, &fb_info->modelist); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1164 | registered_fb[i] = fb_info; |
| 1165 | |
| 1166 | devfs_mk_cdev(MKDEV(FB_MAJOR, i), |
| 1167 | S_IFCHR | S_IRUGO | S_IWUGO, "fb/%d", i); |
| 1168 | event.info = fb_info; |
| 1169 | notifier_call_chain(&fb_notifier_list, |
| 1170 | FB_EVENT_FB_REGISTERED, &event); |
| 1171 | return 0; |
| 1172 | } |
| 1173 | |
| 1174 | |
| 1175 | /** |
| 1176 | * unregister_framebuffer - releases a frame buffer device |
| 1177 | * @fb_info: frame buffer info structure |
| 1178 | * |
| 1179 | * Unregisters a frame buffer device @fb_info. |
| 1180 | * |
| 1181 | * Returns negative errno on error, or zero for success. |
| 1182 | * |
| 1183 | */ |
| 1184 | |
| 1185 | int |
| 1186 | unregister_framebuffer(struct fb_info *fb_info) |
| 1187 | { |
| 1188 | int i; |
| 1189 | |
| 1190 | i = fb_info->node; |
| 1191 | if (!registered_fb[i]) |
| 1192 | return -EINVAL; |
| 1193 | devfs_remove("fb/%d", i); |
| 1194 | |
| 1195 | if (fb_info->pixmap.addr && (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) |
| 1196 | kfree(fb_info->pixmap.addr); |
| 1197 | fb_destroy_modelist(&fb_info->modelist); |
| 1198 | registered_fb[i]=NULL; |
| 1199 | num_registered_fb--; |
| 1200 | fb_cleanup_class_device(fb_info); |
gregkh@suse.de | 56b2293 | 2005-03-23 10:01:41 -0800 | [diff] [blame] | 1201 | class_device_destroy(fb_class, MKDEV(FB_MAJOR, i)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1202 | return 0; |
| 1203 | } |
| 1204 | |
| 1205 | /** |
| 1206 | * fb_register_client - register a client notifier |
| 1207 | * @nb: notifier block to callback on events |
| 1208 | */ |
| 1209 | int fb_register_client(struct notifier_block *nb) |
| 1210 | { |
| 1211 | return notifier_chain_register(&fb_notifier_list, nb); |
| 1212 | } |
| 1213 | |
| 1214 | /** |
| 1215 | * fb_unregister_client - unregister a client notifier |
| 1216 | * @nb: notifier block to callback on events |
| 1217 | */ |
| 1218 | int fb_unregister_client(struct notifier_block *nb) |
| 1219 | { |
| 1220 | return notifier_chain_unregister(&fb_notifier_list, nb); |
| 1221 | } |
| 1222 | |
| 1223 | /** |
| 1224 | * fb_set_suspend - low level driver signals suspend |
| 1225 | * @info: framebuffer affected |
| 1226 | * @state: 0 = resuming, !=0 = suspending |
| 1227 | * |
| 1228 | * This is meant to be used by low level drivers to |
| 1229 | * signal suspend/resume to the core & clients. |
| 1230 | * It must be called with the console semaphore held |
| 1231 | */ |
| 1232 | void fb_set_suspend(struct fb_info *info, int state) |
| 1233 | { |
| 1234 | struct fb_event event; |
| 1235 | |
| 1236 | event.info = info; |
| 1237 | if (state) { |
| 1238 | notifier_call_chain(&fb_notifier_list, FB_EVENT_SUSPEND, &event); |
| 1239 | info->state = FBINFO_STATE_SUSPENDED; |
| 1240 | } else { |
| 1241 | info->state = FBINFO_STATE_RUNNING; |
| 1242 | notifier_call_chain(&fb_notifier_list, FB_EVENT_RESUME, &event); |
| 1243 | } |
| 1244 | } |
| 1245 | |
| 1246 | /** |
| 1247 | * fbmem_init - init frame buffer subsystem |
| 1248 | * |
| 1249 | * Initialize the frame buffer subsystem. |
| 1250 | * |
| 1251 | * NOTE: This function is _only_ to be called by drivers/char/mem.c. |
| 1252 | * |
| 1253 | */ |
| 1254 | |
| 1255 | static int __init |
| 1256 | fbmem_init(void) |
| 1257 | { |
| 1258 | create_proc_read_entry("fb", 0, NULL, fbmem_read_proc, NULL); |
| 1259 | |
| 1260 | devfs_mk_dir("fb"); |
| 1261 | if (register_chrdev(FB_MAJOR,"fb",&fb_fops)) |
| 1262 | printk("unable to get major %d for fb devs\n", FB_MAJOR); |
| 1263 | |
gregkh@suse.de | 56b2293 | 2005-03-23 10:01:41 -0800 | [diff] [blame] | 1264 | fb_class = class_create(THIS_MODULE, "graphics"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1265 | if (IS_ERR(fb_class)) { |
| 1266 | printk(KERN_WARNING "Unable to create fb class; errno = %ld\n", PTR_ERR(fb_class)); |
| 1267 | fb_class = NULL; |
| 1268 | } |
| 1269 | return 0; |
| 1270 | } |
| 1271 | |
| 1272 | #ifdef MODULE |
| 1273 | module_init(fbmem_init); |
| 1274 | static void __exit |
| 1275 | fbmem_exit(void) |
| 1276 | { |
gregkh@suse.de | 56b2293 | 2005-03-23 10:01:41 -0800 | [diff] [blame] | 1277 | class_destroy(fb_class); |
Jon Smirl | 5a340cc | 2005-07-27 11:46:04 -0700 | [diff] [blame] | 1278 | unregister_chrdev(FB_MAJOR, "fb"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1279 | } |
| 1280 | |
| 1281 | module_exit(fbmem_exit); |
| 1282 | MODULE_LICENSE("GPL"); |
| 1283 | MODULE_DESCRIPTION("Framebuffer base"); |
| 1284 | #else |
| 1285 | subsys_initcall(fbmem_init); |
| 1286 | #endif |
| 1287 | |
| 1288 | int fb_new_modelist(struct fb_info *info) |
| 1289 | { |
| 1290 | struct fb_event event; |
| 1291 | struct fb_var_screeninfo var = info->var; |
| 1292 | struct list_head *pos, *n; |
| 1293 | struct fb_modelist *modelist; |
| 1294 | struct fb_videomode *m, mode; |
| 1295 | int err = 1; |
| 1296 | |
| 1297 | list_for_each_safe(pos, n, &info->modelist) { |
| 1298 | modelist = list_entry(pos, struct fb_modelist, list); |
| 1299 | m = &modelist->mode; |
| 1300 | fb_videomode_to_var(&var, m); |
| 1301 | var.activate = FB_ACTIVATE_TEST; |
| 1302 | err = fb_set_var(info, &var); |
| 1303 | fb_var_to_videomode(&mode, &var); |
| 1304 | if (err || !fb_mode_is_equal(m, &mode)) { |
| 1305 | list_del(pos); |
| 1306 | kfree(pos); |
| 1307 | } |
| 1308 | } |
| 1309 | |
| 1310 | err = 1; |
| 1311 | |
| 1312 | if (!list_empty(&info->modelist)) { |
| 1313 | event.info = info; |
| 1314 | err = notifier_call_chain(&fb_notifier_list, |
| 1315 | FB_EVENT_NEW_MODELIST, |
| 1316 | &event); |
| 1317 | } |
| 1318 | |
| 1319 | return err; |
| 1320 | } |
| 1321 | |
Antonino A. Daplas | a812c94 | 2005-11-08 21:39:15 -0800 | [diff] [blame^] | 1322 | /** |
| 1323 | * fb_con_duit - user<->fbcon passthrough |
| 1324 | * @info: struct fb_info |
| 1325 | * @event: notification event to be passed to fbcon |
| 1326 | * @data: private data |
| 1327 | * |
| 1328 | * DESCRIPTION |
| 1329 | * This function is an fbcon-user event passing channel |
| 1330 | * which bypasses fbdev. This is hopefully temporary |
| 1331 | * until a user interface for fbcon is created |
| 1332 | */ |
| 1333 | int fb_con_duit(struct fb_info *info, int event, void *data) |
| 1334 | { |
| 1335 | struct fb_event evnt; |
| 1336 | |
| 1337 | evnt.info = info; |
| 1338 | evnt.data = data; |
| 1339 | |
| 1340 | return notifier_call_chain(&fb_notifier_list, event, &evnt); |
| 1341 | } |
| 1342 | EXPORT_SYMBOL(fb_con_duit); |
| 1343 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1344 | static char *video_options[FB_MAX]; |
| 1345 | static int ofonly; |
| 1346 | |
Pavel Pisa | 4dc3b16 | 2005-05-01 08:59:25 -0700 | [diff] [blame] | 1347 | extern const char *global_mode_option; |
| 1348 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1349 | /** |
| 1350 | * fb_get_options - get kernel boot parameters |
| 1351 | * @name: framebuffer name as it would appear in |
| 1352 | * the boot parameter line |
| 1353 | * (video=<name>:<options>) |
| 1354 | * @option: the option will be stored here |
| 1355 | * |
| 1356 | * NOTE: Needed to maintain backwards compatibility |
| 1357 | */ |
| 1358 | int fb_get_options(char *name, char **option) |
| 1359 | { |
| 1360 | char *opt, *options = NULL; |
| 1361 | int opt_len, retval = 0; |
| 1362 | int name_len = strlen(name), i; |
| 1363 | |
| 1364 | if (name_len && ofonly && strncmp(name, "offb", 4)) |
| 1365 | retval = 1; |
| 1366 | |
| 1367 | if (name_len && !retval) { |
| 1368 | for (i = 0; i < FB_MAX; i++) { |
| 1369 | if (video_options[i] == NULL) |
| 1370 | continue; |
| 1371 | opt_len = strlen(video_options[i]); |
| 1372 | if (!opt_len) |
| 1373 | continue; |
| 1374 | opt = video_options[i]; |
| 1375 | if (!strncmp(name, opt, name_len) && |
| 1376 | opt[name_len] == ':') |
| 1377 | options = opt + name_len + 1; |
| 1378 | } |
| 1379 | } |
| 1380 | if (options && !strncmp(options, "off", 3)) |
| 1381 | retval = 1; |
| 1382 | |
| 1383 | if (option) |
| 1384 | *option = options; |
| 1385 | |
| 1386 | return retval; |
| 1387 | } |
| 1388 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1389 | /** |
| 1390 | * video_setup - process command line options |
| 1391 | * @options: string of options |
| 1392 | * |
| 1393 | * Process command line options for frame buffer subsystem. |
| 1394 | * |
| 1395 | * NOTE: This function is a __setup and __init function. |
| 1396 | * It only stores the options. Drivers have to call |
| 1397 | * fb_get_options() as necessary. |
| 1398 | * |
| 1399 | * Returns zero. |
| 1400 | * |
| 1401 | */ |
Adrian Bunk | 75c96f8 | 2005-05-05 16:16:09 -0700 | [diff] [blame] | 1402 | static int __init video_setup(char *options) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1403 | { |
| 1404 | int i, global = 0; |
| 1405 | |
| 1406 | if (!options || !*options) |
| 1407 | global = 1; |
| 1408 | |
| 1409 | if (!global && !strncmp(options, "ofonly", 6)) { |
| 1410 | ofonly = 1; |
| 1411 | global = 1; |
| 1412 | } |
| 1413 | |
| 1414 | if (!global && !strstr(options, "fb:")) { |
| 1415 | global_mode_option = options; |
| 1416 | global = 1; |
| 1417 | } |
| 1418 | |
| 1419 | if (!global) { |
| 1420 | for (i = 0; i < FB_MAX; i++) { |
| 1421 | if (video_options[i] == NULL) { |
| 1422 | video_options[i] = options; |
| 1423 | break; |
| 1424 | } |
| 1425 | |
| 1426 | } |
| 1427 | } |
| 1428 | |
| 1429 | return 0; |
| 1430 | } |
| 1431 | __setup("video=", video_setup); |
| 1432 | |
| 1433 | /* |
| 1434 | * Visible symbols for modules |
| 1435 | */ |
| 1436 | |
| 1437 | EXPORT_SYMBOL(register_framebuffer); |
| 1438 | EXPORT_SYMBOL(unregister_framebuffer); |
| 1439 | EXPORT_SYMBOL(num_registered_fb); |
| 1440 | EXPORT_SYMBOL(registered_fb); |
| 1441 | EXPORT_SYMBOL(fb_prepare_logo); |
| 1442 | EXPORT_SYMBOL(fb_show_logo); |
| 1443 | EXPORT_SYMBOL(fb_set_var); |
| 1444 | EXPORT_SYMBOL(fb_blank); |
| 1445 | EXPORT_SYMBOL(fb_pan_display); |
| 1446 | EXPORT_SYMBOL(fb_get_buffer_offset); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1447 | EXPORT_SYMBOL(fb_set_suspend); |
| 1448 | EXPORT_SYMBOL(fb_register_client); |
| 1449 | EXPORT_SYMBOL(fb_unregister_client); |
| 1450 | EXPORT_SYMBOL(fb_get_options); |
| 1451 | EXPORT_SYMBOL(fb_new_modelist); |
| 1452 | |
| 1453 | MODULE_LICENSE("GPL"); |