1 | /*
|
---|
2 | * Copyright IBM Corporation 1987,1988,1989
|
---|
3 | *
|
---|
4 | * All Rights Reserved
|
---|
5 | *
|
---|
6 | * Permission to use, copy, modify, and distribute this software and its
|
---|
7 | * documentation for any purpose and without fee is hereby granted,
|
---|
8 | * provided that the above copyright notice appear in all copies and that
|
---|
9 | * both that copyright notice and this permission notice appear in
|
---|
10 | * supporting documentation, and that the name of IBM not be
|
---|
11 | * used in advertising or publicity pertaining to distribution of the
|
---|
12 | * software without specific, written prior permission.
|
---|
13 | *
|
---|
14 | * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
---|
15 | * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
---|
16 | * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
---|
17 | * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
---|
18 | * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
---|
19 | * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
20 | * SOFTWARE.
|
---|
21 | *
|
---|
22 | */
|
---|
23 |
|
---|
24 | #define SET_BYTE_REGISTER( ioport, value ) outb( ioport, value )
|
---|
25 | #define SET_INDEX_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value )
|
---|
26 | #define SET_DATA_REGISTER( ioport, value ) SET_BYTE_REGISTER( ioport, value )
|
---|
27 | /* GJA -- deleted RTIO and ATRIO case here, so that a PCIO #define became
|
---|
28 | * superfluous.
|
---|
29 | */
|
---|
30 | #define SET_INDEXED_REGISTER(RegGroup, Index, Value) \
|
---|
31 | (SET_BYTE_REGISTER(RegGroup, Index), \
|
---|
32 | SET_BYTE_REGISTER((RegGroup) + 1, Value))
|
---|
33 |
|
---|
34 | /* There is a jumper on the ega to change this to 0x200 instead !! */
|
---|
35 | #ifdef HAVE_XORG_CONFIG_H
|
---|
36 | #include <xorg-config.h>
|
---|
37 | #endif
|
---|
38 |
|
---|
39 | #if 0 /* This is now a stack variable, as needed */
|
---|
40 | #define REGBASE 0x300
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #define AttributeIndexRegister REGBASE + 0xC0
|
---|
44 | #define AttributeDataWriteRegister REGBASE + 0xC0
|
---|
45 | #define AttributeDataReadRegister REGBASE + 0xC1
|
---|
46 | #define AttributeRegister AttributeIndexRegister
|
---|
47 | #define AttributeModeIndex 0x30
|
---|
48 | #define OverScanColorIndex 0x31
|
---|
49 | #define ColorPlaneEnableIndex 0x32
|
---|
50 | #define HorizPelPanIndex 0x33
|
---|
51 | #define ColorSelectIndex 0x34
|
---|
52 | #ifndef PC98_EGC
|
---|
53 | #define SetVideoAttributeIndex( index ) \
|
---|
54 | SET_INDEX_REGISTER( AttributeIndexRegister, index )
|
---|
55 | #define SetVideoAttribute( index, value ) \
|
---|
56 | SetVideoAttributeIndex( index ) ; \
|
---|
57 | SET_BYTE_REGISTER( AttributeDataWriteRegister, value )
|
---|
58 | #endif
|
---|
59 |
|
---|
60 | /* Graphics Registers 03CE & 03CF */
|
---|
61 | #define GraphicsIndexRegister REGBASE + 0xCE
|
---|
62 | #define GraphicsDataRegister REGBASE + 0xCF
|
---|
63 | #define GraphicsRegister GraphicsIndexRegister
|
---|
64 | #define Set_ResetIndex 0x00
|
---|
65 | #define Enb_Set_ResetIndex 0x01
|
---|
66 | #define Color_CompareIndex 0x02
|
---|
67 | #define Data_RotateIndex 0x03
|
---|
68 | #define Read_Map_SelectIndex 0x04
|
---|
69 | #define Graphics_ModeIndex 0x05
|
---|
70 | #define MiscellaneousIndex 0x06
|
---|
71 | #define Color_Dont_CareIndex 0x07
|
---|
72 | #define Bit_MaskIndex 0x08
|
---|
73 | #ifndef PC98_EGC
|
---|
74 | #define SetVideoGraphicsIndex( index ) \
|
---|
75 | SET_INDEX_REGISTER( GraphicsIndexRegister, index )
|
---|
76 | #define SetVideoGraphicsData( value ) \
|
---|
77 | SET_INDEX_REGISTER( GraphicsDataRegister, value )
|
---|
78 | #define SetVideoGraphics( index, value ) \
|
---|
79 | SET_INDEXED_REGISTER( GraphicsRegister, index, value )
|
---|
80 | #endif
|
---|
81 |
|
---|
82 | /* Sequencer Registers 03C4 & 03C5 */
|
---|
83 | #define SequencerIndexRegister REGBASE + 0xC4
|
---|
84 | #define SequencerDataRegister REGBASE + 0xC5
|
---|
85 | #define SequencerRegister SequencerIndexRegister
|
---|
86 | #define Seq_ResetIndex 00
|
---|
87 | #define Clock_ModeIndex 01
|
---|
88 | #define Mask_MapIndex 02
|
---|
89 | #define Char_Map_SelectIndex 03
|
---|
90 | #define Memory_ModeIndex 04
|
---|
91 | #ifndef PC98_EGC
|
---|
92 | #define SetVideoSequencerIndex( index ) \
|
---|
93 | SET_INDEX_REGISTER( SequencerIndexRegister, index )
|
---|
94 | #define SetVideoSequencer( index, value ) \
|
---|
95 | SET_INDEXED_REGISTER( SequencerRegister, index, value )
|
---|
96 | #endif
|
---|
97 |
|
---|
98 | /* BIT CONSTANTS FOR THE VGA/EGA HARDWARE */
|
---|
99 | /* for the Graphics' Data_Rotate Register */
|
---|
100 | #define VGA_ROTATE_FUNC_SHIFT 3
|
---|
101 | #define VGA_COPY_MODE ( 0 << VGA_ROTATE_FUNC_SHIFT ) /* 0x00 */
|
---|
102 | #define VGA_AND_MODE ( 1 << VGA_ROTATE_FUNC_SHIFT ) /* 0x08 */
|
---|
103 | #define VGA_OR_MODE ( 2 << VGA_ROTATE_FUNC_SHIFT ) /* 0x10 */
|
---|
104 | #define VGA_XOR_MODE ( 3 << VGA_ROTATE_FUNC_SHIFT ) /* 0x18 */
|
---|
105 | /* for the Graphics' Graphics_Mode Register */
|
---|
106 | #define VGA_READ_MODE_SHIFT 3
|
---|
107 | #define VGA_WRITE_MODE_0 0
|
---|
108 | #define VGA_WRITE_MODE_1 1
|
---|
109 | #define VGA_WRITE_MODE_2 2
|
---|
110 | #define VGA_WRITE_MODE_3 3
|
---|
111 | #define VGA_READ_MODE_0 ( 0 << VGA_READ_MODE_SHIFT )
|
---|
112 | #define VGA_READ_MODE_1 ( 1 << VGA_READ_MODE_SHIFT )
|
---|
113 |
|
---|
114 | #ifdef PC98_EGC
|
---|
115 | /* I/O port address define for extended EGC */
|
---|
116 | #define EGC_PLANE 0x4a0 /* EGC active plane select */
|
---|
117 | #define EGC_READ 0x4a2 /* EGC FGC,EGC,Read Plane */
|
---|
118 | #define EGC_MODE 0x4a4 /* EGC Mode register & ROP */
|
---|
119 | #define EGC_FGC 0x4a6 /* EGC Forground color */
|
---|
120 | #define EGC_MASK 0x4a8 /* EGC Mask register */
|
---|
121 | #define EGC_BGC 0x4aa /* EGC Background color */
|
---|
122 | #define EGC_ADD 0x4ac /* EGC Dest/Source address */
|
---|
123 | #define EGC_LENGTH 0x4ae /* EGC Bit length */
|
---|
124 |
|
---|
125 | #define PALETTE_ADD 0xa8 /* Palette address */
|
---|
126 | #define PALETTE_GRE 0xaa /* Palette Green */
|
---|
127 | #define PALETTE_RED 0xac /* Palette Red */
|
---|
128 | #define PALETTE_BLU 0xae /* Palette Blue */
|
---|
129 |
|
---|
130 | #define EGC_AND_MODE 0x2c8c /* (S&P&D)|(~S&D) */
|
---|
131 | #define EGC_AND_INV_MODE 0x2c2c /* (S&P&~D)|(~S&D) */
|
---|
132 | #define EGC_OR_MODE 0x2cec /* S&(P|D)|(~S&D) */
|
---|
133 | #define EGC_OR_INV_MODE 0x2cbc /* S&(P|~D)|(~S&D) */
|
---|
134 | #define EGC_XOR_MODE 0x2c6c /* (S&(P&~D|~P&D))|(~S&D) */
|
---|
135 | #define EGC_XOR_INV_MODE 0x2c9c /* (S&(P&D)|(~P&~D))|(~S&D) */
|
---|
136 | #define EGC_COPY_MODE 0x2cac /* (S&P)|(~S&D) */
|
---|
137 | #endif
|
---|