diff options
-rw-r--r-- | drivers/video/console/fbcon.c | 26 | ||||
-rw-r--r-- | drivers/video/console/fbcon.h | 1 | ||||
-rw-r--r-- | include/linux/fb.h | 13 |
3 files changed, 40 insertions, 0 deletions
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index b0a3fa00706d..3b3f5749af92 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -2342,6 +2342,30 @@ static int fbcon_blank(struct vc_data *vc, int blank, int mode_switch) | |||
2342 | return 0; | 2342 | return 0; |
2343 | } | 2343 | } |
2344 | 2344 | ||
2345 | static int fbcon_debug_enter(struct vc_data *vc) | ||
2346 | { | ||
2347 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; | ||
2348 | struct fbcon_ops *ops = info->fbcon_par; | ||
2349 | |||
2350 | ops->save_graphics = ops->graphics; | ||
2351 | ops->graphics = 0; | ||
2352 | if (info->fbops->fb_debug_enter) | ||
2353 | info->fbops->fb_debug_enter(info); | ||
2354 | fbcon_set_palette(vc, color_table); | ||
2355 | return 0; | ||
2356 | } | ||
2357 | |||
2358 | static int fbcon_debug_leave(struct vc_data *vc) | ||
2359 | { | ||
2360 | struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]]; | ||
2361 | struct fbcon_ops *ops = info->fbcon_par; | ||
2362 | |||
2363 | ops->graphics = ops->save_graphics; | ||
2364 | if (info->fbops->fb_debug_leave) | ||
2365 | info->fbops->fb_debug_leave(info); | ||
2366 | return 0; | ||
2367 | } | ||
2368 | |||
2345 | static int fbcon_get_font(struct vc_data *vc, struct console_font *font) | 2369 | static int fbcon_get_font(struct vc_data *vc, struct console_font *font) |
2346 | { | 2370 | { |
2347 | u8 *fontdata = vc->vc_font.data; | 2371 | u8 *fontdata = vc->vc_font.data; |
@@ -3276,6 +3300,8 @@ static const struct consw fb_con = { | |||
3276 | .con_screen_pos = fbcon_screen_pos, | 3300 | .con_screen_pos = fbcon_screen_pos, |
3277 | .con_getxy = fbcon_getxy, | 3301 | .con_getxy = fbcon_getxy, |
3278 | .con_resize = fbcon_resize, | 3302 | .con_resize = fbcon_resize, |
3303 | .con_debug_enter = fbcon_debug_enter, | ||
3304 | .con_debug_leave = fbcon_debug_leave, | ||
3279 | }; | 3305 | }; |
3280 | 3306 | ||
3281 | static struct notifier_block fbcon_event_notifier = { | 3307 | static struct notifier_block fbcon_event_notifier = { |
diff --git a/drivers/video/console/fbcon.h b/drivers/video/console/fbcon.h index 89a346880ec0..6bd2e0c7f209 100644 --- a/drivers/video/console/fbcon.h +++ b/drivers/video/console/fbcon.h | |||
@@ -74,6 +74,7 @@ struct fbcon_ops { | |||
74 | int cursor_reset; | 74 | int cursor_reset; |
75 | int blank_state; | 75 | int blank_state; |
76 | int graphics; | 76 | int graphics; |
77 | int save_graphics; /* for debug enter/leave */ | ||
77 | int flags; | 78 | int flags; |
78 | int rotate; | 79 | int rotate; |
79 | int cur_rotate; | 80 | int cur_rotate; |
diff --git a/include/linux/fb.h b/include/linux/fb.h index e7445df44d6c..0c5659c41b01 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -3,6 +3,9 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/i2c.h> | 5 | #include <linux/i2c.h> |
6 | #ifdef __KERNEL__ | ||
7 | #include <linux/kgdb.h> | ||
8 | #endif /* __KERNEL__ */ | ||
6 | 9 | ||
7 | /* Definitions of frame buffers */ | 10 | /* Definitions of frame buffers */ |
8 | 11 | ||
@@ -607,6 +610,12 @@ struct fb_deferred_io { | |||
607 | * LOCKING NOTE: those functions must _ALL_ be called with the console | 610 | * LOCKING NOTE: those functions must _ALL_ be called with the console |
608 | * semaphore held, this is the only suitable locking mechanism we have | 611 | * semaphore held, this is the only suitable locking mechanism we have |
609 | * in 2.6. Some may be called at interrupt time at this point though. | 612 | * in 2.6. Some may be called at interrupt time at this point though. |
613 | * | ||
614 | * The exception to this is the debug related hooks. Putting the fb | ||
615 | * into a debug state (e.g. flipping to the kernel console) and restoring | ||
616 | * it must be done in a lock-free manner, so low level drivers should | ||
617 | * keep track of the initial console (if applicable) and may need to | ||
618 | * perform direct, unlocked hardware writes in these hooks. | ||
610 | */ | 619 | */ |
611 | 620 | ||
612 | struct fb_ops { | 621 | struct fb_ops { |
@@ -676,6 +685,10 @@ struct fb_ops { | |||
676 | 685 | ||
677 | /* teardown any resources to do with this framebuffer */ | 686 | /* teardown any resources to do with this framebuffer */ |
678 | void (*fb_destroy)(struct fb_info *info); | 687 | void (*fb_destroy)(struct fb_info *info); |
688 | |||
689 | /* called at KDB enter and leave time to prepare the console */ | ||
690 | int (*fb_debug_enter)(struct fb_info *info); | ||
691 | int (*fb_debug_leave)(struct fb_info *info); | ||
679 | }; | 692 | }; |
680 | 693 | ||
681 | #ifdef CONFIG_FB_TILEBLITTING | 694 | #ifdef CONFIG_FB_TILEBLITTING |