/*
* vreset.c
*
* Initialize the VGA control registers to 80x25 text mode.
*
* Adapted from a program by:
* Steve Sellgren
* San Francisco Indigo Company
* sfindigo!sellgren@uunet.uu.net
*
* Original concept by:
* Gary Thomas <gdt@linuxppc.org>
* Adapted for Moto boxes by:
* Pat Kane & Mark Scott, 1996
* Adapted for IBM portables by:
* Takeshi Ishimoto
* Multi-console support:
* Terje Malmedal <terje.malmedal@usit.uio.no>
*/
#include "iso_font.h"
#include "nonstdio.h"
extern char *vidmem;
extern int lines, cols;
struct VaRegs;
/*
* VGA Register
*/
struct VgaRegs
{
unsigned short io_port;
unsigned char io_index;
unsigned char io_value;
};
void unlockVideo(int slot);
void setTextRegs(struct VgaRegs *svp);
void setTextCLUT(int shift);
void clearVideoMemory(void);
void loadFont(unsigned char *ISA_mem);
static void mdelay(int ms)
{
for (; ms > 0; --ms)
udelay(1000);
}
/*
* Default console text mode registers used to reset
* graphics adapter.
*/
#define NREGS 54
#define ENDMK 0xFFFF /* End marker */
#define S3Vendor 0x5333
#define CirrusVendor 0x1013
#define DiamondVendor 0x100E
#define MatroxVendor 0x102B
#define ParadiseVendor 0x101C
struct VgaRegs GenVgaTextRegs[NREGS+1] = {
/* port index value */
/* SR Regs */
{ 0x3c4, 0x1, 0x0 },
{ 0x3c4, 0x2, 0x3 },
{ 0x3c4, 0x3, 0x0 },
{ 0x3c4, 0x4, 0x2 },
/* CR Regs */
{ 0x3d4, 0x0, 0x5f },
{ 0x3d4, 0x1, 0x4f },
{ 0x3d4, 0x2, 0x50 },
{ 0x3d4, 0x3, 0x82 },
{ 0x3d4, 0x4, 0x55 },
{ 0x3d4, 0x5, 0x81 },
{ 0x3d4, 0x6, 0xbf },
{ 0x3d4, 0x7, 0x1f },
{ 0x3d4, 0x8, 0x00 },
{ 0x3d4, 0x9, 0x4f },
{ 0x3d4, 0xa, 0x0d },
{ 0x3d4, 0xb, 0x0e },
{ 0x3d4, 0xc, 0x00 },
{ 0x3d4, 0xd, 0x00 },
{ 0x3d4, 0xe, 0x00 },
{ 0x3d4, 0xf, 0x00 },
{ 0x3d4, 0x10, 0x9c },
{ 0x3d4, 0x11, 0x8e },
{ 0x3d4, 0x12, 0x8f },
{ 0x3d4, 0x13, 0x28 },
{ 0x3d4, 0x14, 0x1f },
{ 0x3d4, 0x15, 0x96 },
{ 0x3d4, 0x16, 0xb9 },
{ 0x3d4, 0x17, 0xa3 },
/* GR Regs */
{ 0x3ce, 0x0, 0x0 },
{ 0x3ce, 0x1, 0x0 },
{ 0x3ce, 0x2, 0x0 },
{ 0x3ce, 0x3, 0x0 },
{ 0x3ce, 0x4, 0x0 },
{ 0x3ce, 0x5, 0x10 },
{ 0x3ce, 0x6, 0xe },
{ 0x3ce, 0x7, 0x0 },
{ 0x3ce, 0x8, 0xff },
{ ENDMK }
};
struct RGBColors
{
unsigned char r, g, b;
};
/*
* Default console text mode color table.
* These values were obtained by booting Linux with
* text mode firmware & then dumping the registers.
*/
struct RGBColors TextCLUT[256] =
{
/* red green blue */
{ 0x0, 0x0, 0x0 },
{ 0x0, 0x0, 0x2a },
{ 0x0, 0x2a, 0x0 },
{ 0x0, 0x2a, 0x2a },
{ 0x2a, 0x0, 0x0 },
{ 0x2a, 0x0, 0x2a },
{ 0x2a, 0x2a, 0x0 },
{ 0x2a, 0x2a, 0x2a },
{ 0x0, 0x0, 0x15 },
{ 0x0, 0x0, 0x3f },
{ 0x0, 0x2a, 0x15 },
{ 0x0, 0x2a, 0x3f },
{ 0x2a, 0x0, 0x15 },
{ 0x2a, 0x0, 0x3f },
{ 0x2a, 0x2a, 0x15 },
{ 0x2a, 0x2a, 0x3f },
{ 0x0, 0x15, 0x0 },
{ 0x0, 0x15, 0x2a },
{ 0x0, 0x3f, 0x0 },
{ 0x0, 0x3f, 0x2a },
{ 0x2a, 0x15, 0x0 },
{ 0x2a, 0x15, 0x2a },
{ 0x2a, 0x3f, 0x0 },
{ 0x2a, 0x3f, 0x2a },
{ 0x0, 0x15, 0x15 },
{ 0x0, 0x15, 0x3f },
{ 0x0, 0x3f, 0x15 },
{ 0x0, 0x3f, 0x3f },
{ 0x2a, 0x15, 0x15 },
{ 0x2a, 0x15, 0x3f },
{ 0x2a, 0x3f, 0x15 },
{ 0x2a, 0x3f, 0x3f },
{ 0x15, 0x0, 0x0 },
{ 0x15, 0x0, 0x2a },
{ 0x15, 0x2a, 0x0 },
{ 0x15, 0x2a, 0x2a },
{ 0x3f, 0x0, 0x0 },
{ 0x3f, 0x0, 0x2a },
{ 0x3f, 0x2a, 0x0 },
{ 0x3f, 0x2a,