Commit 4737042c authored by James Simmons's avatar James Simmons

VGA text mode handling cleanup. Rusty's janitoral cleanups.

parent b4e5e606
This diff is collapsed.
...@@ -1967,8 +1967,7 @@ static void pm2fb_set_disp(const void* par, struct display* disp, ...@@ -1967,8 +1967,7 @@ static void pm2fb_set_disp(const void* par, struct display* disp,
struct pm2fb_par* p=(struct pm2fb_par* )par; struct pm2fb_par* p=(struct pm2fb_par* )par;
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
#ifdef __alpha__ #ifdef __alpha__
disp->screen_base=i->regions.v_fb + dense_mem(i->regions.v_fb); disp->screen_base=i->regions.v_fb + dense_mem(i->regions.v_fb);
#else #else
...@@ -2014,7 +2013,7 @@ static void pm2fb_set_disp(const void* par, struct display* disp, ...@@ -2014,7 +2013,7 @@ static void pm2fb_set_disp(const void* par, struct display* disp,
disp->dispsw=&fbcon_dummy; disp->dispsw=&fbcon_dummy;
break; break;
} }
restore_flags(flags); local_irq_restore(flags);
} }
#ifdef PM2FB_HW_CURSOR #ifdef PM2FB_HW_CURSOR
......
...@@ -3297,8 +3297,7 @@ static void pm3fb_set_disp(const void *par, struct display *disp, ...@@ -3297,8 +3297,7 @@ static void pm3fb_set_disp(const void *par, struct display *disp,
DTRACE; DTRACE;
save_flags(flags); local_irq_save(flags);
cli();
info->info.screen_base = l_fb_info->v_fb; info->info.screen_base = l_fb_info->v_fb;
switch (p->depth) { switch (p->depth) {
#ifdef FBCON_HAS_CFB8 #ifdef FBCON_HAS_CFB8
...@@ -3356,7 +3355,7 @@ static void pm3fb_set_disp(const void *par, struct display *disp, ...@@ -3356,7 +3355,7 @@ static void pm3fb_set_disp(const void *par, struct display *disp,
DPRINTK(1, "Invalid depth, using fbcon_dummy\n"); DPRINTK(1, "Invalid depth, using fbcon_dummy\n");
break; break;
} }
restore_flags(flags); local_irq_restore(flags);
} }
/* */ /* */
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/console.h>
#ifdef CONFIG_MTRR #ifdef CONFIG_MTRR
#include <asm/mtrr.h> #include <asm/mtrr.h>
#endif #endif
...@@ -50,13 +49,9 @@ ...@@ -50,13 +49,9 @@
#error This driver requires PCI support. #error This driver requires PCI support.
#endif #endif
/* version number of this driver */ /* version number of this driver */
#define RIVAFB_VERSION "0.9.3" #define RIVAFB_VERSION "0.9.3"
/* ------------------------------------------------------------------------- * /* ------------------------------------------------------------------------- *
* *
* various helpful macros and constants * various helpful macros and constants
...@@ -1166,12 +1161,12 @@ static int rivafb_open(struct fb_info *info, int user) ...@@ -1166,12 +1161,12 @@ static int rivafb_open(struct fb_info *info, int user)
int cnt = atomic_read(&par->ref_count); int cnt = atomic_read(&par->ref_count);
if (!cnt) { if (!cnt) {
memset(&par->state, 0, sizeof(struct fb_vgastate)); memset(&par->state, 0, sizeof(struct vgastate));
par->state.flags = VGA_SAVE_MODE | VGA_SAVE_FONTS; par->state.flags = VGA_SAVE_MODE | VGA_SAVE_FONTS;
/* save the DAC for Riva128 */ /* save the DAC for Riva128 */
if (par->riva.Architecture == NV_ARCH_03) if (par->riva.Architecture == NV_ARCH_03)
par->state.flags |= VGA_SAVE_CMAP; par->state.flags |= VGA_SAVE_CMAP;
fb_save_vga(&par->state); save_vga(&par->state);
RivaGetConfig(&par->riva); RivaGetConfig(&par->riva);
riva_save_state(par, &par->initial_state); riva_save_state(par, &par->initial_state);
...@@ -1192,7 +1187,7 @@ static int rivafb_release(struct fb_info *info, int user) ...@@ -1192,7 +1187,7 @@ static int rivafb_release(struct fb_info *info, int user)
par->riva.LockUnlock(&par->riva, 0); par->riva.LockUnlock(&par->riva, 0);
par->riva.LoadStateExt(&par->riva, &par->initial_state.ext); par->riva.LoadStateExt(&par->riva, &par->initial_state.ext);
fb_restore_vga(&par->state); restore_vga(&par->state);
par->riva.LockUnlock(&par->riva, 1); par->riva.LockUnlock(&par->riva, 1);
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <video/vga.h>
#include "riva_hw.h" #include "riva_hw.h"
/* GGI compatibility macros */ /* GGI compatibility macros */
...@@ -34,7 +35,7 @@ struct riva_par { ...@@ -34,7 +35,7 @@ struct riva_par {
struct riva_regs initial_state; /* initial startup video mode */ struct riva_regs initial_state; /* initial startup video mode */
struct riva_regs current_state; struct riva_regs current_state;
struct fb_vgastate state; struct vgastate state;
atomic_t ref_count; atomic_t ref_count;
riva_cfb8_cmap_t cmap[256]; /* VGA DAC palette cache */ riva_cfb8_cmap_t cmap[256]; /* VGA DAC palette cache */
u32 riva_palette[16]; u32 riva_palette[16];
......
...@@ -780,8 +780,7 @@ static int tgafb_blank(int blank, struct fb_info_gen *info) ...@@ -780,8 +780,7 @@ static int tgafb_blank(int blank, struct fb_info_gen *info)
u32 vhcr, vvcr, vvvr; u32 vhcr, vvcr, vvvr;
unsigned long flags; unsigned long flags;
save_flags(flags); local_irq_save(flags);
cli();
vhcr = TGA_READ_REG(TGA_HORIZ_REG); vhcr = TGA_READ_REG(TGA_HORIZ_REG);
vvcr = TGA_READ_REG(TGA_VERT_REG); vvcr = TGA_READ_REG(TGA_VERT_REG);
...@@ -821,7 +820,7 @@ static int tgafb_blank(int blank, struct fb_info_gen *info) ...@@ -821,7 +820,7 @@ static int tgafb_blank(int blank, struct fb_info_gen *info)
break; break;
} }
restore_flags(flags); local_irq_restore(flags);
return 0; return 0;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <asm/io.h> #include <asm/io.h>
#include "vga.h" #include <video/vga.h>
#define GRAPHICS_ADDR_REG VGA_GFX_I /* Graphics address register. */ #define GRAPHICS_ADDR_REG VGA_GFX_I /* Graphics address register. */
#define GRAPHICS_DATA_REG VGA_GFX_D /* Graphics data register. */ #define GRAPHICS_DATA_REG VGA_GFX_D /* Graphics data register. */
...@@ -70,7 +70,7 @@ static struct vga16fb_par { ...@@ -70,7 +70,7 @@ static struct vga16fb_par {
unsigned char ModeControl; /* CRT-Controller:17h */ unsigned char ModeControl; /* CRT-Controller:17h */
unsigned char ClockingMode; /* Seq-Controller:01h */ unsigned char ClockingMode; /* Seq-Controller:01h */
} vga_state; } vga_state;
struct fb_vgastate state; struct vgastate state;
atomic_t ref_count; atomic_t ref_count;
int palette_blanked, vesa_blanked, mode, isVGA; int palette_blanked, vesa_blanked, mode, isVGA;
u8 misc, pel_msk, vss, clkdiv; u8 misc, pel_msk, vss, clkdiv;
...@@ -304,9 +304,9 @@ static int vga16fb_open(struct fb_info *info, int user) ...@@ -304,9 +304,9 @@ static int vga16fb_open(struct fb_info *info, int user)
int cnt = atomic_read(&par->ref_count); int cnt = atomic_read(&par->ref_count);
if (!cnt) { if (!cnt) {
memset(&par->state, 0, sizeof(struct fb_vgastate)); memset(&par->state, 0, sizeof(struct vgastate));
par->state.flags = 8; par->state.flags = 8;
fb_save_vga(&par->state); save_vga(&par->state);
} }
atomic_inc(&par->ref_count); atomic_inc(&par->ref_count);
return 0; return 0;
...@@ -320,7 +320,7 @@ static int vga16fb_release(struct fb_info *info, int user) ...@@ -320,7 +320,7 @@ static int vga16fb_release(struct fb_info *info, int user)
if (!cnt) if (!cnt)
return -EINVAL; return -EINVAL;
if (cnt == 1) if (cnt == 1)
fb_restore_vga(&par->state); restore_vga(&par->state);
atomic_dec(&par->ref_count); atomic_dec(&par->ref_count);
return 0; return 0;
......
This diff is collapsed.
...@@ -321,37 +321,6 @@ struct fb_cursor { ...@@ -321,37 +321,6 @@ struct fb_cursor {
struct fb_image image; /* Cursor image */ struct fb_image image; /* Cursor image */
}; };
/* VGA State Save and Restore */
#define VGA_SAVE_FONT0 1 /* save/restore plane 2 fonts */
#define VGA_SAVE_FONT1 2 /* save/restore plane 3 fonts */
#define VGA_SAVE_TEXT 4 /* save/restore plane 0/1 fonts */
#define VGA_SAVE_FONTS 7 /* save/restore all fonts */
#define VGA_SAVE_MODE 8 /* save/restore video mode */
#define VGA_SAVE_CMAP 16 /* save/restore color map/DAC */
struct fb_vgastate {
caddr_t vgabase; /* mmio base, if supported */
__u32 flags; /* what state/s to save (see VGA_SAVE_*) */
__u32 depth; /* current fb depth, not important */
__u32 num_attr; /* number of att registers, 0 for default */
__u32 num_crtc; /* number of crt registers, 0 for default */
__u32 num_gfx; /* number of gfx registers, 0 for default */
__u32 num_seq; /* number of seq registers, 0 for default */
caddr_t fbbase; /* -- DO NOT ALTER STARTING HERE -- */
__u8 *vga_font0;
__u8 *vga_font1;
__u8 *vga_text;
__u8 *vga_cmap;
__u8 *attr;
__u8 *crtc;
__u8 *gfx;
__u8 *seq;
__u8 misc;
};
extern int fb_save_vga(struct fb_vgastate *state);
extern int fb_restore_vga(struct fb_vgastate *state);
#ifdef __KERNEL__ #ifdef __KERNEL__
#include <linux/fs.h> #include <linux/fs.h>
......
...@@ -187,6 +187,29 @@ ...@@ -187,6 +187,29 @@
#define VGA_OUTW_WRITE #define VGA_OUTW_WRITE
#endif #endif
/* VGA State Save and Restore */
#define VGA_SAVE_FONT0 1 /* save/restore plane 2 fonts */
#define VGA_SAVE_FONT1 2 /* save/restore plane 3 fonts */
#define VGA_SAVE_TEXT 4 /* save/restore plane 0/1 fonts */
#define VGA_SAVE_FONTS 7 /* save/restore all fonts */
#define VGA_SAVE_MODE 8 /* save/restore video mode */
#define VGA_SAVE_CMAP 16 /* save/restore color map/DAC */
struct vgastate {
caddr_t vgabase; /* mmio base, if supported */
__u32 flags; /* what state[s] to save (see VGA_SAVE_*) */
__u32 membase; /* VGA window base, 0 for default - 0xA000 */
__u32 memsize; /* VGA window size, 0 for default 64K */
__u32 depth; /* current fb depth, not important */
__u32 num_attr; /* number of att registers, 0 for default */
__u32 num_crtc; /* number of crt registers, 0 for default */
__u32 num_gfx; /* number of gfx registers, 0 for default */
__u32 num_seq; /* number of seq registers, 0 for default */
void *vidstate;
};
extern int save_vga(struct vgastate *state);
extern int restore_vga(struct vgastate *state);
/* /*
* generic VGA port read/write * generic VGA port read/write
......
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