home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 8.ddi / usr / include / sys / kd.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  49.0 KB  |  1,307 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ident    "@(#)/usr/include/sys/kd.h.sl 1.1 4.0 12/08/90 45962 AT&T-USL"
  11.  
  12. #ifndef    _SYS_KD_H
  13. #define    _SYS_KD_H
  14.  
  15. /*
  16.  * Types of displays supported
  17.  */
  18. #define    KD_MONO        01    /* monochrome display adapter */
  19. #define    KD_HERCULES    02    /* Hercules monochrome graphics adapter */
  20. #define    KD_CGA        03    /* color graphics adapter */
  21. #define    KD_EGA        04    /* enhanced graphics adapter */
  22. #define KD_VGA        05    /* video graphics array */
  23. #define KD_VDC400    06    /* VDC 400 adapter */
  24. #define KD_VDC750    07    /* VDC 750 adapter */
  25. #define KD_VDC600    010    /* VDC 600 adapter */
  26.  
  27. #ifdef EVGA
  28.  
  29. #define KD_EVGA        011    /* extended vga. Used for Vdc.v_info.cntlr */    
  30.  
  31. /*
  32.  * Specific evga card types
  33.  */
  34.  
  35. #define EVGA_VGA    0    
  36. #define EVGA_VEGA    1
  37. #define EVGA_STBGA    2
  38. #define EVGA_SIGMAH    3
  39. #define EVGA_PVGA1A    4
  40. #define EVGA_DELL    5
  41. #define EVGA_VRAM    6
  42. #define EVGA_ORVGA    7
  43. #define EVGA_ORVGAni    8
  44. #define EVGA_TVGA    9
  45. #define EVGA_TVGAni    10
  46. #define EVGA_GVGA    11
  47. #define EVGA_EGA    12
  48. #define EVGA_PEGA    13
  49. #define EVGA_GEGA    14
  50. #define EVGA_FASTWRITE    15
  51. #define EVGA_WON    16
  52. #define EVGA_PVGA1024    17
  53.  
  54. #endif    /*EVGA*/
  55.  
  56. /*
  57.  * Types of monitors supported
  58.  */
  59.  
  60. #define KD_UNKNOWN    0
  61. #define KD_STAND_M    1    /* standard monochrome monitor */
  62. #define KD_STAND_C    2    /* standard color monitor */
  63. #define KD_MULTI_M    3    /* multi-mode monochrome monitor */
  64. #define KD_MULTI_C    4    /* multi-mode color monitor */
  65.  
  66. /* Xenix display/adapter definitions */
  67. #define MONO    1        /* Xenix value for monochrome */
  68. #define CGA    2        /* Xenix value for color graphics */
  69. #define PGA    3        /* Xenix value for professional graphics */
  70. #define EGA    4        /* Xenix value for enhanced graphics */
  71. #define VGA    5        /* Xenix value for Video Graphics Array */
  72. #define    S_ADAP    100        /* special adapter which has no definition */
  73.  
  74. /*
  75.  * Virtual display constants
  76.  */
  77. #define    KD_WIDTH    80        /* normal screen width */
  78. #define    KD_NARROWWIDTH    40        /* narrow screen width */
  79. #define    KD_EXTRAWIDTH    132        /* wide screen width */
  80. #define    KD_HEIGHT    25        /* screen height */
  81. #define    KD_TALLHEIGHT    43        /* tall screen height */
  82. #define    KD_MAXSCRSIZE    (KD_EXTRAWIDTH * KD_TALLHEIGHT)    /* max screen size */
  83. #define    KD_SCRTOBUF    0        /* transfer from screen to buffer */
  84. #define    KD_BUFTOSCR    1        /* transfer from buffer to screen */
  85.  
  86. /*
  87.  * keyboard controller I/O port addresses
  88.  */
  89. #define KB_OUT    0x60        /* output buffer R/O */
  90. #define KB_IDAT 0x60        /* input buffer data write W/O */
  91. #define KB_STAT 0x64        /* keyboard controller status R/O */
  92. #define KB_ICMD 0x64        /* input buffer command write W/O */
  93.  
  94. /*
  95.  * keyboard controller commands and flags
  96.  */
  97. #define KB_INBF        0x02    /* input buffer full flag */
  98. #define KB_OUTBF    0x01    /* output buffer full flag */
  99. #define KB_GATE20    0x02    /* set this bit to allow addresses > 1Mb */
  100. #define KB_ROP        0xD0    /* read output port command */
  101. #define KB_WOP        0xD1    /* write output port command */
  102. #define    KB_RCB        0x20    /* read command byte command */
  103. #define    KB_WCB        0x60    /* write command byte command */
  104. #define    KB_ENAB        0xae    /* enable keyboard interface */
  105. #define    KB_DISAB    0x10    /* disable keyboard */
  106. #define    KB_EOBFI    0x01    /* enable interrupt on output buffer full */
  107. #define KB_ACK        0xFA    /* Acknowledgement byte from keyboard */
  108. #define    KB_RESETCPU    0xFE    /* command to reset AT386 cpu */
  109. #define KB_READID    0xF2    /* command to read keyboard id */
  110. #define    KB_RESEND    0xFE    /* response from keyboard to resend data */
  111. #define    KB_ERROR    0xFF    /* response from keyboard to resend data */
  112. #define    KB_RESET    0xFF    /* command to reset keyboard */
  113. #define    KB_ENABLE    0xF4    /* command to to enable keyboard
  114.                  * this is different from KB_ENAB above in
  115.                  * that KB_ENAB is a command to the 8042 to
  116.                  * enable the keyboard interface, not the
  117.                  * keyboard itself */
  118.  
  119. /*
  120.  * Structure of keyboard translation table
  121.  */
  122. #define NUM_KEYS    256        /* Maximum number of keys */
  123. #define NUM_STATES    8        /* Number of key states */
  124. #pragma pack(2)
  125. typedef struct {
  126.     short  n_keys ;            /* Number of entries in table */
  127.     struct key_t {
  128.         unsigned char map[NUM_STATES];    /* Key code for each state */
  129.         unsigned char spcl;    /* Bits marking states as special */
  130.         unsigned char flgs;    /* Flags */
  131.     } key[NUM_KEYS+1];        /* One entry for each key */
  132. } keymap_t;
  133. #pragma pack()
  134. /*
  135.  * Keyboard translation modes
  136.  */
  137. #define    K_RAW        0x00        /* Just send raw up/down scan codes */
  138. #define    K_XLATE        0x01        /* Translate scan codes to ASCII */
  139. /*
  140.  * character table flag bits.
  141.  */
  142. #define    NUMLCK        0x8000    /* flag key as affected by num lock key */
  143. #define    CAPLCK        0x4000    /* flag key as affected by caps lock key */
  144. #define    CTLKEY        0x2000    /* flag key as afected by control keys */
  145. /*
  146.  * character table key types
  147.  */
  148. #define    NORMKEY        0x0000    /* key is a normal key, send with no prefix */
  149. #define    SHIFTKEY    0x0100    /* key is a shift key */
  150. #define    BREAKKEY    0x0200    /* key is a break key */
  151. #define    SS2PFX        0x0300    /* prefix key with <ESC> N */
  152. #define    SS3PFX        0x0400    /* prefix key with <ESC> O */
  153. #define    CSIPFX        0x0500    /* prefix key with <ESC> [ */
  154. #define    SPECIALKEY    0x0600    /* special key type */
  155. #define    NOKEY        0x0f00    /* flag a key as nonexistant */
  156. #define    TYPEMASK    0x0f00    /* select key type bits */
  157.  
  158.  
  159. /*
  160.  * Table selectors for KDSKBENT/KDGKBENT ioctl's
  161.  */
  162. #define    K_NORMTAB    0x00        /* Select unaugmented keyboard table */
  163. #define    K_SHIFTTAB    0x01        /* Select shifted keyboard table */
  164. #define    K_ALTTAB    0x02        /* Select alted keyboard table */
  165. #define    K_ALTSHIFTTAB    0x03        /* Select alt-shifted keyboard table */
  166. #define    K_SRQTAB    0x04        /* select sysreq table */
  167. /*
  168.  * Make/break distinctions
  169.  */
  170. #define    KBD_BREAK    0x80        /* Key make/break bit (break=1) */
  171. /*
  172.  * Flags for key state calculation.
  173.  */
  174. #define SHIFTED    0x01            /* Keys are shifted */
  175. #define CTRLED    0x02            /* Keys are ctrl'd */
  176. #define ALTED     0x04            /* Keys are alt'd */
  177. /*
  178.  * Possible key states.  Used as index into translation entry for key.
  179.  */
  180. #define NORMAL        0        /* Unmodified */
  181. #define SHIFT        SHIFTED        /* Shift key depressed */
  182. #define CNTRL        CTRLED        /* Ctrl key depressed */
  183. #define    SHFCTL        (CTRLED|SHIFTED)    /* Shift and ctrl keys */
  184. #define ALT        ALTED        /* Alt key depressed */
  185. #define    ALTSHF        (ALTED|SHIFTED)    /* Shift and alt keys depressed */
  186. #define    ALTCTL        (ALTED|CTRLED)    /* Ctrl and alt keys depressed */
  187. #define    ALTSHFCTL    (ALTED|CTRLED|SHIFTED)    /* Shift, ctrl, and alt keys */
  188. /*
  189.  * Key map table flags
  190.  */
  191. #define    KMF_CLOCK    0x01        /* Key affected by caps lock */
  192. #define    KMF_NLOCK    0x02        /* Key affected by num lock */
  193. /*
  194.  * kb_state bit definitions
  195.  */
  196. #define LEFT_SHIFT    0x0001    /* left shift key depressed */
  197. #define    LEFT_ALT    0x0002    /* left alt key depressed */
  198. #define    LEFT_CTRL    0x0004    /* left control key depressed */
  199. #define    RIGHT_SHIFT    0x0008    /* right shift key depressed */
  200. #define    RIGHT_ALT    0x0010    /* right alt key depressed */
  201. #define    RIGHT_CTRL    0x0020    /* right control key depressed */
  202. #define    CAPS_LOCK    0x0040    /* caps lock key down */
  203. #define    NUM_LOCK    0x0080    /* num lock key down */
  204. #define    SCROLL_LOCK    0x0100    /* scroll lock key down */
  205. #define    ALTSET        (LEFT_ALT|RIGHT_ALT)
  206. #define    SHIFTSET    (LEFT_SHIFT|RIGHT_SHIFT)
  207. #define    CTRLSET        (LEFT_CTRL|RIGHT_CTRL)
  208. #define    NONTOGGLES    (ALTSET|SHIFTSET|CTRLSET)
  209. /*
  210.  * Keyboard scan codes
  211.  */
  212. #define    SCROLLLOCK    0x46        /* Scroll lock key */
  213. /*
  214.  * Number of entries in 0xe0 prefix translation table
  215.  */
  216. #define    ESCTBLSIZ    18        /* Entries in 101/102 key table */
  217. /*
  218.  * Character flags.  Should not conflict with FRERROR and friends in tty.h
  219.  */
  220. #define NO_CHAR        0x8000        /* Do not generate a char */
  221. #define GEN_ESCLSB    0x0800        /* Generate <ESC> [ prefix to char */
  222. #define GEN_ESCN    0x0400        /* Generate <ESC> N prefix to char */
  223. #define GEN_ZERO    0x0200        /* Generate 0 prefix to char */
  224. #define    GEN_FUNC    0x0100        /* Generate function key */
  225. #define GEN_ESCO    0x1000        /* Generate <ESC> O prefix to char */
  226. /*
  227.  * Special key code definitions
  228.  */
  229. #define    K_NOP    0            /* Keys with no function */
  230. #define K_LSH    2            /* Left shift */
  231. #define K_RSH    3            /* Right shift */
  232. #define K_CLK    4            /* Caps lock */
  233. #define K_NLK    5            /* Num lock */
  234. #define K_SLK    6            /* Scroll lock */
  235. #define K_ALT    7            /* Alt */
  236. #define    K_BTAB    8            /* Back tab */
  237. #define K_CTL    9            /* Control */
  238. #define    K_LAL    10            /* Left alt */
  239. #define    K_RAL    11            /* Right alt */
  240. #define    K_LCT    12            /* Left control */
  241. #define    K_RCT    13            /* Right control */
  242. #define K_AGR    14            /* ALT-GR key  -- 102 keyboard only */
  243. #define    K_FUNF    27            /* First function key */
  244. #define    K_FUNL    122            /* Last function key */
  245. #define    K_SRQ    123            /* System request */
  246. #define    K_BRK    124            /* Break */
  247. #define    K_ESN    125            /* <ESC> N <unalt'd value> sequence */
  248. #define    K_ESO    126
  249. #define    K_ESL    127
  250. #define    K_RBT    128            /* Reboot system */
  251. #define    K_DBG    129            /* Invoke debugger */
  252. #define    K_NEXT    130
  253. #define    K_PREV    131
  254. #define    K_FRCNEXT 132
  255. #define    K_FRCPREV 133
  256. #define K_VTF    134
  257. #define    K_VTL    148
  258. #define K_MGRF    149
  259. #define    K_MGRL    191
  260. #define    K_PFXF    192
  261. #define    K_PFXL    255
  262.  
  263.  
  264.  
  265. /*
  266.  * Macro for recognizing scan codes for special keys
  267.  */
  268. #define    IS_SPECIAL(s,i)    (kdkeymap.key[(s)].spcl & (0x80>>(i)))    /* Special? */
  269. #define    IS_SPECKEY(k,s,i)    ((k)->key[(s)].spcl & (0x80>>(i)))    /* Special? */
  270. #define    IS_NPKEY(s)    (((s) >= 71) && ((s) <=83))    /* Number pad? */
  271. /*
  272.  * Function key constants and macros
  273.  */
  274. #define    NSTRKEYS    (K_FUNL-K_FUNF+1)    /* Number of string keys */
  275. #define STRTABLN    512        /* Max length of sum of all strings */
  276. #define STRTABLN_21    256        /* Max length of sum in version 2.1 */
  277. #define    IS_FUNKEY(c)    (((int)(c) >= K_FUNF) && ((int)(c) <= K_FUNL) || ((int)(c) >= K_PFXF) && ((int)(c) <= K_PFXL))    /* Function? */
  278. typedef unchar strmap_t[STRTABLN];    /* String map table type */
  279. typedef ushort stridx_t[NSTRKEYS + 1];    /* String map index type */
  280.  
  281. typedef unsigned char    srqtab_t[NUM_KEYS + 1];
  282.  
  283. /* Shorthand for constants so columns line up neatly */
  284. #define    KF    K_FUNF            /* First function key */
  285. #define    L_O    0            /* Key not affected by locks */
  286. #define    L_C    KMF_CLOCK        /* Key affected by caps lock */
  287. #define    L_N    KMF_NLOCK        /* Key affected by num lock */
  288. #define    L_B    (KMF_CLOCK|KMF_NLOCK)    /* Key affected by caps and num lock */
  289.  
  290. /*
  291.  * Structure used for SETFKEY and GETFKEY ioctls
  292.  */
  293. #define MAXFK    30            /* Maximum length of string */
  294. #pragma pack(2)
  295. struct fkeyarg {
  296.     unsigned short    keynum;        /* Function key number */
  297.     unchar         keydef[MAXFK];    /* Key definition */
  298.     char        flen;        /* Length of key definition */
  299. };
  300. #pragma pack()
  301. /*
  302.  * Constants for extended keys
  303.  */
  304. #define    NUMEXTSTATES    4        /* Number of extended states */
  305.  
  306. /* Commands for LED and typematic start/rate on the AT */
  307. #define    KDCQMAX        8    /* length of keyboard command queue */
  308. #define LED_WARN    0xED    /* Tell kbd that following byte is led status */
  309. #define LED_SCR        0x01    /* Flag bit for scroll lock */
  310. #define LED_CAP        0x04    /* Flag bit for cap lock */
  311. #define LED_NUM        0x02    /* Flag bit for num lock */
  312. #define    ACK_WAIT    0x01    /* flag for waiting for kbd response */
  313. #define    TYPE_WARN    0xF3    /* command--next byte is typematic values */
  314. #define    TYPE_VALS    0x20    /* max speed (30/s) and 1/2 sec delay */
  315. #define    SCAN_WARN    0xF0    /* kbd command to set scan code set */
  316.  
  317.  
  318. /*
  319.  * Screen mapping constants and types
  320.  */
  321. #define NUM_ASCII    256        /* Number of ASCII characters */
  322. typedef unsigned char scrnmap_t[NUM_ASCII];    /* Screen map type */
  323. typedef unsigned char *scrnmapp_t;    /* Pointer to screen map type */
  324.  
  325.  
  326. /*
  327.  * defines for KDDFLTKEYMAP, KDDFLTSTRMAP and KDDFLTSCRNMAP ioctls
  328.  */
  329. #define    KD_DFLTSET    1
  330. #define    KD_DFLTGET    2
  331.  
  332. /*
  333.  * structure for KDDFLTSTRMAP ioctl 
  334.  */
  335. struct str_dflt {
  336.     int    str_direction;
  337.     strmap_t    str_map;
  338. };
  339.  
  340. /*
  341.  * structure for KDDFLTSCRNMAP ioctl 
  342.  */
  343. struct scrn_dflt {
  344.     int    scrn_direction;
  345.     scrnmap_t    scrn_map;
  346. };
  347.  
  348. /*
  349.  * structure for KDDFLTKEYMAP ioctl 
  350.  */
  351. struct key_dflt {
  352.     int    key_direction;
  353.     keymap_t    key_map;
  354. };
  355.  
  356.  
  357. /*
  358.  * defines and structures for WS_PIO_ROMFONT ioctl
  359.  */
  360.  
  361. #define F8x8_SIZE    2048
  362. #define F8x14_SIZE    3072
  363. #define F8x16_SIZE    4096
  364.  
  365. #define    F8x8_BPC    8
  366. #define    F8x14_BPC    14
  367. #define    F8x16_BPC    16
  368. #define    F9x16_BPC    16
  369.  
  370. #define    MAX_ROM_CHAR    256    /* Current EGA/VGA support only 256 chars */
  371.  
  372. struct char_def {
  373.     int cd_index;
  374.     unchar cd_map_8x8[F8x8_BPC];
  375.     unchar cd_map_8x14[F8x14_BPC];
  376.     unchar cd_map_8x16[F8x16_BPC];
  377.     unchar cd_map_9x16[F9x16_BPC];
  378. };
  379.  
  380. typedef struct rom_font_arg {
  381.     unsigned int fnt_numchar;
  382.     struct char_def    fnt_chars[MAX_ROM_CHAR];
  383. } rom_font_t;
  384.  
  385. /*
  386.  * type of adapter installed, matches bits in CMOS ram
  387.  */
  388. #define    MCAP_UNK    0xff    /* adapter not determined yet */
  389. #define MCAP_MONO    0x03    /* mono adapter installed */
  390. #define MCAP_COLOR    0x02    /* color adapter installed in 80 column mode */
  391. #define MCAP_COLOR40    0x01    /* color adapter installed in 40 column mode */
  392. #define MCAP_EGA    0x00    /* EGA adapter installed */
  393.  
  394. /* 6845 base addresses */
  395. #define    MONO_REGBASE    0x03b4    /* Base register address for mono modes */
  396. #define    COLOR_REGBASE    0x03d4    /* Base register address for color modes */
  397.  
  398. /* offsets from 6845 base address for various registers */
  399. #define DATA_REG    0x1
  400. #define MODE_REG    0x4
  401. #define MODE2_REG    0x0A    /* rite-vu card only */
  402. #define COLOR_REG    0x5    /* color adapter only */
  403. #define STATUS_REG    0x6
  404.  
  405. /* definitions for bits in the color adapter mode register */
  406. #define M_ALPHA40    0x00    /* 40 by 25 alphanumeric */
  407. #define M_ALPHA80    0x01    /* 80 by 25 alphanumeric */
  408. #define M_GRAPH        0x02    /* 320x200 or 640x200 graphics */
  409. #define M_BW        0x04    /* black & white */
  410. #define M_ENABLE    0x08    /* video enable */
  411. #define M_HIGHRES    0x10    /* 640x200 B&W graphics */
  412. #define M_BLINK        0x20    /* enable blink attribute */
  413.  
  414. /* definitions for bits in the color adapter mode2 register ( rite-vu card )*/
  415. #define    M_GRAPH2    0x01    /* 640x400 graphics AT&T mode */
  416. #define    M_DEGAUSS    0x02    /* degauss color monitor */
  417. #define    M_ALTCHAR    0x04    /* rite-vu card alternate character set */
  418. #define    M_PGSEL        0x08    /* switch to 2nd 16kbytes of memory */
  419. #define    M_UNDRLINE    0x40    /* underline white chars, not blue */
  420.  
  421.  
  422. /* definitions for bits in the color adapter status register */
  423. #define S_UPDATEOK    0x01    /* safe to update regen buffer */
  424. #define S_VSYNC        0x08    /* raster is in vertical retrace mode */
  425.  
  426. /* definitions for loading data into CRT controller registers */
  427. #define R_STARTADRH    12    /* start address, high word */
  428. #define R_STARTADRL    13    /* start address, low word */
  429. #define R_CURADRH    14    /* cursor address, high word */
  430. #define R_CURADRL    15    /* cursor address, low word */
  431.  
  432. /* definitions for the EGA */
  433. #define IN_STAT_0    0x3c2    /* input status register zero */
  434. #define MISC_OUT    0x3c2    /* miscellaneous output register */
  435. #define IN_STAT_1    6    /* offset of input status register 1 */
  436. #define FEAT_CTRL    6    /* offset of feature control register */
  437. #define SW_SENSE    0x10    /* switch sense bit in input status zero */
  438. #define CLKSEL        2    /* shift to select switch number */
  439. #define GRAPH_1_POS    0x3cc    /* graphics 1 position */
  440. #define GRAPH_2_POS    0x3ca    /* graphics 2 position */
  441. #define GRAPHICS1    0    /* value for graphics 1 */
  442. #define GRAPHICS2    1    /* value for graphics 2 */
  443. #define SEQ_RST        0x01    /* reset sequencer */
  444. #define SEQ_RUN        0x03    /* start sequencer */
  445. #define PALETTE_ENABLE    0x20    /* palette address source in attribute reg */
  446. #define CHGEN_BASE    0xa0000    /* base address for character generator */
  447. #define CHGEN_SIZE    8192    /* character generator is 8K */
  448. #define MONO_BASE    0xb0000    /* Location of monochrome display memory */
  449. #define MONO_SIZE    0x8000    /* Monochrome has 32K of memory available */
  450. #define MONO_SCRMASK    0x7ff    /* Mono text memory wraps at 4K */
  451. #define COLOR_BASE    0xb8000    /* Location of color display memory */
  452. #define COLOR_SIZE    0x8000    /* Color has up to 32K of memory available */
  453. #define COLOR_SCRMASK    0x1fff    /* Color text memory wraps at 16K */
  454. #define    EGA_BASE    0xa0000    /* Location of enhanced display memory */
  455. #define EGA_SIZE    0x10000    /* EGA has at 64K of memory available */
  456. #define EGA_LGSIZE    0x20000    /* Larger EGA has 128K of memory available */
  457. #define EGA_SCRMASK    0x3fff    /* EGA text memory wraps at 32K (minimum) */
  458. #define NSEQ        5    /* number of sequencer registers */
  459. #define NATTR        20    /* number of attribute registers */
  460. #define NGRAPH        9    /* number of graphics registers */
  461. #define LOAD_COLOR    8    /* mode number for loading color characters */
  462. #define LOAD_MONO    9    /* mode number for loading mono characters */
  463.  
  464. /* Font types supported */
  465. #define    FONTINV        0
  466. #define    FONT8x8        1        /* 8x8 font */
  467. #define    FONT8x14    2        /* 8x14 font */
  468. #define    FONT8x14m    3        /* 8x14 font for monochrome */
  469. #define    FONT8x16    4        /* 8x16 font (VGA) */
  470. #define    FONT9x16    5        /* 9x16 font (VGA) */
  471. #define FONT7x9        6        /* 7x9 font (VDC-600) */
  472. #define FONT7x16    7        /* 7x16 font (VDC-600) */
  473.  
  474. /* Offsets of font tables in ROM */
  475. #define F8x8_OFF    0xf30        /* Offset of 8x8 font table */
  476. #define    F8x8_BPC    8        /* Bytes per character in 8x8 font */
  477. #define    F8x8_NCH    256        /* Number of characters in 8x8 font */
  478.  
  479. #define    F8x14_OFF    0        /* Offset of 8x14 font table */
  480. #define F8x14m_OFF    0xe00        /* Offset of 8x14 mono fudge table */
  481. #define    F8x14_BPC    14        /* Bytes per character in 8x14 font */
  482. #define    F8x14_NCH    256        /* Number of characters in 8x14 font */
  483. #define    F8x16_BPC    16        /* Bytes per character in 8x16 font */
  484. #define    F8x16_NCH    256        /* Number of characters in 8x16 font */
  485.  
  486. #define    F8x8_INDX    0        /* Index of 8x8 font pointer */
  487. #define F8x14_INDX    1        /* Index of 8x14 font pointer */
  488. #define F9x14_INDX    2        /* Index of 9x14 font pointer */
  489. #define F8x16_INDX    3        /* Index of 8x16 font pointer */
  490. #define F9x16_INDX    4        /* Index of 9x16 font pointer */
  491.  
  492. #define    FONT_TAB_LIM    0x172f        /* Total size of all font tables */
  493.  
  494. /* definitions for bits in the attribute byte */
  495. #define BLINK        0x80
  496. #define BRIGHT        0x08
  497. #define REVERSE        0x70
  498. #define NORM        0x07
  499. #define UNDERLINE    0x01    /* underline on mono, blue on color */
  500.  
  501. #define CLEAR        (NORM<<8|0x20)
  502. #define BCLEAR        (NORM|BRIGHT<<8|0x20)
  503. #define ALLATTR        (BLINK|BRIGHT|REVERSE|NORM|UNDERLINE)
  504. #define NOTBGRND    (ALLATTR&(~REVERSE))
  505. #define NOTFGRND    (ALLATTR&(~NORM))
  506.  
  507. /* definitions for ringing the bell */
  508. #define NORMBELL    1331    /* initial value loaded into timer */
  509. #define BELLLEN        (HZ/10)    /* ring for 1/10 sec. between checks */
  510. #define BELLCNT        2    /* check bell twice before turning off */
  511. #define TONE_ON        3    /* 8254 gate 2 and speaker and-gate enabled */
  512. #define TIMER        0x40    /* 8254.2 timer address */
  513. #define TIMERCR        TIMER+3    /* timer control register address */
  514. #define TIMER2        TIMER+2    /* timer tone generation port */
  515. #define T_CTLWORD    0xB6    /* value for timer control word */
  516. #define TONE_CTL    0x61    /* address for enabling timer port 2 */
  517.  
  518.  
  519. struct adtstruct {
  520.     ushort    *ad_scraddr;    /* address of adaptor memory */
  521.     ushort    ad_scrmask;    /* mask for fitting text into screen memory */
  522.     ushort    ad_address;    /* address of corresponding M6845 or EGA */
  523.     unchar    ad_type;    /* adapter type */
  524.     unchar    ad_colsel;    /* color select register byte */
  525.     unchar    ad_modesel;    /* mode register byte */
  526.     unchar    ad_mode2sel;    /* mode2 register byte (rite-vu card ) */
  527.     unchar    ad_undattr;    /* attribute to use when underlining */
  528. };
  529.  
  530.  
  531. #define    KD_TEXT        0    /* ansi x3.64 emulation mode */
  532. #define KD_TEXT0    0    /* same as above */
  533. #define KD_TEXT1    2    /* new text mode doesnt load char generator */
  534. #define    KD_GRAPHICS    1    /* graphics mode */
  535.  
  536. /*
  537.  * Values for kv_flags
  538.  */
  539. #define    KD_MAPPED    0x01        /* Display is mapped */
  540. #define    KD_LOCKED    0x02        /* Keyboard is locked */
  541. #define    KD_QRESERVE    0x04        /* Queue mode init in progress */
  542.  
  543. /*
  544.  * Types for indexing into reginfo table.
  545.  */
  546. #define I_6845MONO    0
  547. #define I_6845COLOR    1
  548. #define I_EGAMONO    2
  549. #define I_EGACOLOR    3
  550. #define I_SEQ        4
  551. #define I_GRAPH        5
  552. #define I_ATTR        6
  553.  
  554. /*
  555.  * Macro for setting a particular EGA register.
  556.  */
  557. #define out_reg(riptr, index, data)    outb((riptr)->ri_address, (index)); \
  558.                     outb((riptr)->ri_data, (data));
  559.  
  560. #ifdef EVGA
  561. #define in_reg(riptr, index, data)    outb((riptr)->ri_address, (index)); \
  562.                     (data) = inb((riptr)->ri_data);
  563. #endif    /*EVGA*/
  564.  
  565. struct reginfo {
  566.     ushort    ri_count;    /* number of registers */
  567.     ushort    ri_address;    /* address register */
  568.     ushort    ri_data;    /* data register */
  569. };
  570.  
  571. struct m6845init {
  572.     unchar  mi_hortot;    /* Reg  0: Horizontal Total     (chars) */
  573.     unchar  mi_hordsp;    /* Reg  1: Horizontal Displayed (chars) */
  574.     unchar  mi_hsnpos;    /* Reg  2: Hsync Position       (chars) */
  575.     unchar  mi_hsnwid;    /* Reg  3: Hsync Width          (chars) */
  576.     unchar  mi_vertot;    /* Reg  4: Vertical Total   (char rows) */
  577.     unchar  mi_veradj;    /* Reg  5: Vtotal Adjust   (scan lines) */
  578.     unchar  mi_vsndsp;    /* Reg  6: Vertical Display (char rows) */
  579.     unchar  mi_vsnpos;    /* Reg  7: Vsync Position   (char rows) */
  580.     unchar  mi_intlac;    /* Reg  8: Interlace Mode               */
  581.     unchar  mi_maxscn;    /* Reg  9: Max Scan Line   (scan lines) */
  582.     unchar  mi_curbeg;    /* Reg 10: Cursor Start    (scan lines) */
  583.     unchar  mi_curend;    /* Reg 11: Cursor End      (scan lines) */
  584.     unchar  mi_stadh;    /* Reg 12: Start Address (H)            */
  585.     unchar  mi_stadl;    /* Reg 13: Start Address (L)            */
  586.     unchar  mi_cursh;    /* Reg 14: Cursor (H)                   */
  587.     unchar  mi_cursl;    /* Reg 15: Cursor (L)                   */
  588. };
  589.  
  590. struct egainit {
  591.     unchar  ei_hortot;    /* Reg  0: Horizontal Total */
  592.     unchar  ei_hde;        /* Reg  1: Horizontal Display End */
  593.     unchar  ei_shb;        /* Reg  2: Start horizontal blank */
  594.     unchar  ei_ehb;        /* Reg  3: End horizontal blank */
  595.     unchar  ei_shr;        /* Reg  4: Start horizontal retrace */
  596.     unchar  ei_ehr;        /* Reg  5: End horizontal retrace */
  597.     unchar  ei_vertot;    /* Reg  6: Vertical total */
  598.     unchar  ei_ovflow;    /* Reg  7: Overflow */
  599.     unchar  ei_prs;        /* Reg  8: Preset row scan */
  600.     unchar  ei_maxscn;    /* Reg  9: Max Scan Line */
  601.     unchar  ei_curbeg;    /* Reg 10: Cursor Start */
  602.     unchar  ei_curend;    /* Reg 11: Cursor End */
  603.     unchar  ei_stadh;    /* Reg 12: Start Address (H) */
  604.     unchar  ei_stadl;    /* Reg 13: Start Address (L) */
  605.     unchar  ei_cursh;    /* Reg 14: Cursor location (H) */
  606.     unchar  ei_cursl;    /* Reg 15: Cursor location (L) */
  607.     unchar    ei_vrs;        /* Reg 16: Vertical retrace start */
  608.     unchar    ei_vre;        /* Reg 17: Vertical retrace end */
  609.     unchar    ei_vde;        /* Reg 18: Vertical display end */
  610.     unchar    ei_offset;    /* Reg 19: Offset */
  611.     unchar    ei_undloc;    /* Reg 20: Underline location */
  612.     unchar    ei_svb;        /* Reg 21: Start vertical blank */
  613.     unchar    ei_evb;        /* Reg 22: End vertical blank */
  614.     unchar    ei_mode;    /* Reg 23: Mode control */
  615.     unchar    ei_lcomp;    /* Reg 24: Line compare */
  616. };
  617.  
  618. struct reginit {
  619.     unchar        seqtab[NSEQ];
  620.     unchar        miscreg;
  621.     struct egainit    egatab;
  622.     unchar        attrtab[NATTR];
  623.     unchar        graphtab[NGRAPH];
  624. };
  625.  
  626.  
  627. struct adtmode {
  628.     unchar    am_capability;
  629.     unchar    am_colmode;
  630.     unchar    am_colsel;
  631. };
  632.  
  633. struct kd_dispinfo {
  634.     char    *vaddr;        /* display memory address */
  635.     paddr_t    physaddr;    /* display memory address */
  636.     unsigned long size;    /* display memory size */
  637. };
  638.  
  639. /* Display mode definitions */
  640. #define DM_B40x25    0        /* 40x25 black & white text */
  641. #define DM_C40x25    1        /* 40x25 color text */
  642. #define DM_B80x25    2        /* 80x25 black & white text */
  643. #define DM_C80x25    3        /* 80x25 color text */
  644. #define DM_BG320    4        /* 320x200 black & white graphics */
  645. #define DM_CG320    5        /* 320x200 color graphics */
  646. #define DM_BG640    6        /* 640x200 black & white graphics */
  647. #define DM_EGAMONO80x25    7        /* EGA mode 7 */
  648. #define LOAD_COLOR    8        /* mode for loading color characters */
  649. #define LOAD_MONO    9        /* mode for loading mono characters */
  650. #define DM_ENH_B80x43    10        /* 80x43 black & white text */
  651. #define DM_ENH_C80x43    11        /* 80x43 color text */
  652. #define DM_CG320_D    13        /* EGA mode D */
  653. #define DM_CG640_E    14        /* EGA mode E */
  654. #define DM_EGAMONOAPA    15        /* EGA mode F */
  655. #define DM_CG640x350    16        /* EGA mode 10 */
  656. #define DM_ENHMONOAPA2    17        /* EGA mode F with extended memory */
  657. #define DM_ENH_CG640    18        /* EGA mode 10* */
  658. #define DM_ENH_B40x25    19        /* enhanced 40x25 black & white text */
  659. #define DM_ENH_C40x25    20        /* enhanced 40x25 color text */
  660. #define DM_ENH_B80x25    21        /* enhanced 80x25 black & white text */
  661. #define DM_ENH_C80x25    22        /* enhanced 80x25 color text */
  662. #define    DM_VGA_C40x25    23        /* VGA 40x25 color text */
  663. #define    DM_VGA_C80x25    24        /* VGA 80x25 color text */
  664. #define    DM_VGAMONO80x25    25        /* VGA mode 7 */
  665. #define DM_VGA640x480C    26        /* VGA 640x480 2 color graphics */
  666. #define    DM_VGA640x480E    27        /* VGA 640x480 16 color graphics */
  667. #define    DM_VGA320x200    28        /* VGA 320x200 256 color graphics */
  668. #define    DM_VGA_B40x25    29        /* VGA 40x25 black & white text */
  669. #define    DM_VGA_B80x25    30        /* VGA 80x25 black & white text */
  670. #define    DM_VGAMONOAPA    31        /* VGA mode F+ */
  671. #define    DM_VGA_CG640    32        /* VGA mode 10+ */
  672. #define    DM_ENH_CGA    33        /* AT&T 640x400 CGA hw emulation mode */
  673. #define DM_ATT_640    34        /* AT&T 640x400 16 color graphics */
  674. #define DM_VGA_B132x25    35        /* VGA 132x25 black & white text */
  675. #define DM_VGA_C132x25    36        /* VGA 132x25 color text */
  676. #define DM_VGA_B132x43    37        /* VGA 132x43 black & white text */
  677. #define DM_VGA_C132x43    38        /* VGA 132x43 color text */
  678. #define DM_VDC800x600E    39        /* VDC-600 800x600 16 color graphics */
  679. #define DM_VDC640x400V    40        /* VDC-600 640x400 256 color graphics */
  680. #ifdef    EVC
  681. #define DM_EVC640x480V    41        /* EVC 640x480 256 color graphics */
  682. #define DM_EVC1024x768E 42        /* EVC 1024x768 16 color graphics */
  683. #define DM_EVC1024x768D 43        /* EVC 1024x768 256 color graphics */
  684. #endif    /*EVC*/
  685.  
  686. #ifdef EVGA
  687.  
  688. /*  THE FOLLOWING VALUES SHOULD REFLECT THE NUMBER OF NON-EVGA MODE
  689.  *  DEFINITIONS AND ENTRIES IN KD_INITTAB, RESPECTIVELY. IF THESE
  690.  *  ARE CHANGED THEN ENDNONEVGAMODE AND STEVGA SHOULD BE ADJUSTED
  691.  *  ACCORDINGLY.
  692.  */
  693. #ifndef EVC
  694.  
  695. #define ENDNONEVGAMODE 40
  696. #define STEVGA 7
  697.  
  698. #else /* EVC defined */
  699.  
  700. #define ENDNONEVGAMODE 43
  701. #define STEVGA 9
  702.  
  703. #endif /* EVC */ 
  704. #endif /* EVGA */
  705.  
  706.  
  707. /* Xenix display mode definitions.  Most are identical to the internal
  708.    definitions above. */
  709. #define M_B40x25    DM_B40x25    /* black & white 40 columns */
  710. #define M_C40x25    DM_C40x25    /* color 40 columns */
  711. #define M_B80x25    DM_B80x25    /* black & white 80 columns */
  712. #define M_C80x25    DM_C80x25    /* color 80 columns */
  713. #define M_BG320        DM_BG320    /* black & white graphics 320x200 */
  714. #define M_CG320        DM_CG320    /* color graphics 320x200 */
  715. #define M_BG640        DM_BG640    /* black & white graphics 640x200 */
  716. #define M_EGAMONO80x25  DM_EGAMONO80x25    /* ega-mono 80x25 */
  717. #define M_CG320_D    DM_CG320_D    /* ega mode D */
  718. #define M_CG640_E    DM_CG640_E    /* ega mode E */
  719. #define M_EGAMONOAPA    DM_EGAMONOAPA    /* ega mode F */
  720. #define M_CG640x350    DM_CG640x350    /* ega mode 10 */
  721. #define M_ENHMONOAPA2    DM_ENHMONOAPA2    /* ega mode F with extended memory */
  722. #define M_ENH_CG640    DM_ENH_CG640    /* ega mode 10* */
  723. #define M_ENH_B40x25    DM_ENH_B40x25    /* enhanced black & white 40 columns */
  724. #define M_ENH_C40x25    DM_ENH_C40x25    /* enhanced color 40 columns */
  725. #define M_ENH_B80x25    DM_ENH_B80x25    /* enhanced black & white 80 columns */
  726. #define M_ENH_C80x25    DM_ENH_C80x25    /* enhanced color 80 columns */
  727. #define M_VGA_40x25    DM_VGA_C40x25    /* vga 8x16 font on color */
  728. #define M_VGA_80x25    DM_VGA_C80x25    /* vga 8x16 font on color */
  729. #define M_VGA_M80x25    DM_VGAMONO80x25    /* vga 8x16 font on mono */
  730. #define M_VGA11        DM_VGA640x480C    /* vga 640x480 2 colors */
  731. #define M_VGA12        DM_VGA640x480E    /* vga 640x480 16 colors */
  732. #define M_VGA13        DM_VGA320x200    /* vga 640x200 256 colors */
  733.                     /* "640" because double scan */
  734. #define M_HGC_P0    0xe0    /* hercules graphics - page 0 @ B0000 */
  735. #define M_HGC_P1    0xe1    /* hercules graphics - page 1 @ B8000 */
  736. #define M_ENH_B80x43    0x70        /* ega black & white 80x43 */
  737. #define M_ENH_C80x43    0x71        /* ega color 80x43 */
  738. #define M_MCA_MODE    0xff        /* monochrome adapter mode */
  739. #define    OFFSET_80x43    (M_ENH_B80x43-DM_ENH_B80x43)    /* Offset for converting 80x43 numbers */
  740. #define M_ENH_CGA    DM_ENH_CGA    /* AT&T 640x400 CGA hardware mode - (Super-VU adapter) */
  741.  
  742. /* Defines for keyboard and display ioctl's */
  743. #define KIOC        ('K'<<8)
  744. #define    KDDISPTYPE    (KIOC|1)    /* return display type to user */
  745. #define    KDMAPDISP    (KIOC|2)    /* map display into user space */
  746. #define    KDUNMAPDISP    (KIOC|3)    /* unmap display from user space */
  747. #define    KDGKBENT    (KIOC|4)    /* get keyboard table entry */
  748. #define    KDSKBENT    (KIOC|5)    /* set keyboard table entry */
  749. #define    KDGKBMODE    (KIOC|6)    /* get keyboard translation mode */
  750. #define    KDSKBMODE    (KIOC|7)    /* set keyboard translation mode */
  751. #define    KDMKTONE    (KIOC|8)    /* sound tone */
  752. #define    KDGETMODE    (KIOC|9)    /* get text/graphics mode */
  753. #define    KDSETMODE    (KIOC|10)    /* set text/graphics mode */
  754. #define    KDADDIO        (KIOC|11)    /* add I/O address to list */
  755. #define    KDDELIO        (KIOC|12)    /* delete I/O address from list */
  756. #define KDSBORDER    (KIOC|13)    /* set ega color border */
  757. #define KDQUEMODE    (KIOC|15)    /* enable/disable queue mode */
  758. #define KIOCDOSMODE     (KIOC | 16)     /* obsolete -- set DOSMODE        */
  759. #define KIOCNONDOSMODE  (KIOC | 17)     /* obsolete -- clear DOSMODE        */
  760. #define KDDISPINFO    (KIOC | 18)    /* get display start and size        */
  761. #define KDGKBSTATE    (KIOC | 19)    /* get state of keyboard shift keys */
  762. #define KDSETRAD        (KIOC|20)       /* set keyboard typematic rate/delay */
  763. #define KDSCROLL        (KIOC|21)       /* set hardware scrolling on/off */
  764.  
  765. /* VP/ix reserved ioctls */
  766. #define KDENABIO    (KIOC|60)    /* enable direct I/O to ports */
  767. #define KDDISABIO    (KIOC|61)    /* disable direct I/O to ports */
  768. #define KIOCINFO    (KIOC|62)    /* tell user what device we are */
  769. #define KIOCSOUND    (KIOC|63)    /* start sound generation */
  770. #define KDGKBTYPE    (KIOC|64)    /* get keyboard type */
  771. #define KDGETLED    (KIOC|65)    /* get keyboard LED status */
  772. #define KDSETLED    (KIOC|66)    /* set keyboard LED status */
  773.  
  774.  
  775. /* New ioctls for UNIX System V Release 4.0. 0-50 reserved for base system */
  776. /* 50-100 reserved for AT&T-DSG */
  777.  
  778. #define    WSIOC        (('w' << 24) | ('s' << 16))
  779. #define    KDVDCTYPE    (WSIOC|1)    /* VDC controller/display information */
  780. #define KDDFLTKEYMAP    (WSIOC|2)    /* set/get default keyboard map for
  781.                      * this workstation */
  782. #define KDDFLTSCRNMAP    (WSIOC|3)    /* set/get default screen map for
  783.                      * this workstation */
  784. #define KDDFLTSTRMAP    (WSIOC|4)    /* set/get default function key map for
  785.                      * this workstation */
  786. #define WS_PIO_ROMFONT    (WSIOC|5)    /* add user-supplied font overlays */
  787. #define WS_CLRXXCOMPAT    (WSIOC|6)    /* add user-supplied font overlays */
  788. #define WS_GETXXCOMPAT    (WSIOC|7)    /* add user-supplied font overlays */
  789. #define WS_SETXXCOMPAT    (WSIOC|8)    /* add user-supplied font overlays */
  790. #define KDEVGA            (WSIOC|9)       /* set evga card type */
  791.  
  792. /* Defines for Xenix keyboard and display ioctl's */
  793. #define MIOC        ('k' << 8)    /* Upper byte of mapping ioctl's */
  794. #define GETFKEY       (MIOC | 0)    /* Get function key */
  795. #define SETFKEY       (MIOC | 1)    /* Set function key */
  796. #define GIO_SCRNMAP    (MIOC | 2)    /* Get screen output map table */
  797. #define PIO_SCRNMAP    (MIOC | 3)    /* Set screen output map table */
  798. #define    GIO_STRMAP_21    (MIOC | 4)    /* Get 2.1 function key string table */
  799. #define    PIO_STRMAP_21    (MIOC | 5)    /* Put 2.1 function key string table */
  800. #define GIO_KEYMAP    (MIOC | 6)    /* Get keyboard map table */
  801. #define PIO_KEYMAP    (MIOC | 7)    /* Set keyboard map table */
  802. #define SETLOCKLOCK    (MIOC|10)    /* global cap/num lock on/off */
  803. #define GIO_STRMAP    (MIOC | 11)    /* Get function key string table */
  804. #define PIO_STRMAP    (MIOC | 12)    /* Set function key string table */
  805. #define    KBIO_SETMODE    (MIOC|13)    /* Put AT keyboard into XT | AT mode */
  806. #define    KBIO_GETMODE    (MIOC|14)    /* Get the AT/XT keyboard mode */
  807.  
  808. /* keyboard mode -- set by KBIO_MODE */
  809. #define    KBM_XT    0    /* XT keyboard mode */
  810. #define    KBM_AT    1    /* AT keyboard mode */
  811.  
  812. #define GIO_ATTR    ('a' << 8)    /* Get present screen attribute */
  813. #define GIO_COLOR    ('c' << 8)    /* Get whether adaptor is color */
  814.  
  815. #define MODESWITCH    ('x' << 8)    /* Upper byte of mode switch ioctl's */
  816. #define KDMODEMASK    0xff        /* Lower byte of mode switch ioctl's */
  817. #define SW_B40x25    (MODESWITCH | DM_B40x25)    /* Select 40x25 b&w */
  818. #define SW_C40x25    (MODESWITCH | DM_C40x25)    /* Select 40x25 clr */
  819. #define SW_B80x25    (MODESWITCH | DM_B80x25)    /* Select 80x25 b&w */
  820. #define SW_C80x25    (MODESWITCH | DM_C80x25)    /* Select 80x25 clr */
  821. #define SW_BG320    (MODESWITCH | DM_BG320)    /* Select 320x200 b&w */
  822. #define SW_CG320    (MODESWITCH | DM_CG320)    /* Select 320x200 color */
  823. #define SW_BG640    (MODESWITCH | DM_BG640)    /* Select 640x200 b&w */
  824. #define SW_EGAMONO80x25    (MODESWITCH | DM_EGAMONO80x25)    /* Select EGA mode 7 */
  825. #define SW_CG320_D    (MODESWITCH | DM_CG320_D)    /* Select EGA mode D */
  826. #define SW_CG640_E    (MODESWITCH | DM_CG640_E)    /* Select EGA mode E */
  827. #define SW_EGAMONOAPA    (MODESWITCH | DM_EGAMONOAPA)    /* Select EGA mode F */
  828. #define SW_CG640x350    (MODESWITCH | DM_CG640x350)    /* EGA mode 10 */
  829. #define SW_ENH_MONOAPA2    (MODESWITCH | DM_ENHMONOAPA2)    /* EGA mode F* */
  830. #define SW_ENH_CG640    (MODESWITCH | DM_ENH_CG640)    /* EGA mode 16 */
  831. #define SW_ENHB40x25    (MODESWITCH | DM_ENH_B40x25)    /* 40x25 b&w */
  832. #define SW_ENHC40x25    (MODESWITCH | DM_ENH_C40x25)    /* 40x25 color */
  833. #define SW_ENHB80x25    (MODESWITCH | DM_ENH_B80x25)    /* 80x25 b&w */
  834. #define SW_ENHC80x25    (MODESWITCH | DM_ENH_C80x25)    /* 80x25 color */
  835. #define SW_ENHB80x43    (MODESWITCH | M_ENH_B80x43)    /* 80x43 b&w */
  836. #define SW_ENHC80x43    (MODESWITCH | M_ENH_C80x43)    /* 80x43 color */
  837. #define SW_MCAMODE    (MODESWITCH | M_MCA_MODE)    /* Reinitialize mono */
  838. #define SW_ATT640    (MODESWITCH | DM_ATT_640)    /* 640x400 16 color */
  839. #define    SW_VGAC40x25    (MODESWITCH | DM_VGA_C40x25)    /* VGA 40x25 color */
  840. #define    SW_VGAC80x25    (MODESWITCH | DM_VGA_C80x25)    /* VGA 80x25 color */
  841. #define    SW_VGAMONO80x25    (MODESWITCH | DM_VGAMONO80x25)    /* VGA mode 7 */
  842. #define    SW_VGA640x480C    (MODESWITCH | DM_VGA640x480C)    /* VGA mode 11 */
  843. #define    SW_VGA640x480E    (MODESWITCH | DM_VGA640x480E)    /* VGA mode 12 */
  844. #define    SW_VGA320x200    (MODESWITCH | DM_VGA320x200)    /* VGA mode 13 */
  845. #define SW_VDC800x600E    (MODESWITCH | DM_VDC800x600E)    /* 800x600 16 color */
  846. #define SW_VDC640x400V    (MODESWITCH | DM_VDC640x400V)    /* 640x400 256 color */
  847. #define    SW_VGAB40x25    (MODESWITCH | DM_VGA_B40x25)    /* VGA 40x25 b&w */
  848. #define    SW_VGAB80x25    (MODESWITCH | DM_VGA_B80x25)    /* VGA 80x25 b&w */
  849. #define    SW_VGAMONOAPA    (MODESWITCH | DM_VGAMONOAPA)    /* VGA mode F+ */
  850. #define    SW_VGA_CG640    (MODESWITCH | DM_VGA_CG640)    /* VGA mode 10+ */
  851. #define    SW_VGA_B132x25    (MODESWITCH | DM_VGA_B132x25)    /* VGA 132x25 b&w */
  852. #define    SW_VGA_C132x25    (MODESWITCH | DM_VGA_C132x25)    /* VGA 132x25 color */
  853. #define    SW_VGA_B132x43    (MODESWITCH | DM_VGA_B132x43)    /* VGA 132x43 b&w */
  854. #define    SW_VGA_C132x43    (MODESWITCH | DM_VGA_C132x43)    /* VGA 132x43 color */
  855. #ifdef    EVC
  856. #define SW_EVC640x480V    (MODESWITCH | DM_EVC640x480V)    /* 640x480 256 color */
  857. #define SW_EVC1024x768E (MODESWITCH | DM_EVC1024x768E)    /* 1024x768 16 color */
  858. #define SW_EVC1024x768D (MODESWITCH | DM_EVC1024x768D)  /* 1024x768 256 color*/
  859. #endif    /*EVC*/
  860.  
  861. /* XENIX names for VGA modes */
  862. #define    SW_VGA40x25    SW_VGAC40x25
  863. #define    SW_VGA80x25    SW_VGAC80x25
  864. #define    SW_VGAM80x25    SW_VGAMONO80x25
  865. #define    SW_VGA11    SW_VGA640x480C
  866. #define    SW_VGA12    SW_VGA640x480E
  867. #define    SW_VGA13    SW_VGA320x200
  868. #define SW_VGA_C40x25   SW_VGAC40x25
  869. #define SW_BG640x480    SW_VGA640x480C
  870. #define SW_CG640x480    SW_VGA640x480E
  871. #define SW_VGA_CG320    SW_VGA320x200
  872. #define SW_VGA_B40x25   SW_VGAB40x25
  873.  
  874.  
  875. #ifdef EVGA
  876. /* display modes for evga */
  877.  
  878. #define    VT_EGA        0    /* EGA         640x350 16 colors */
  879. #define    VT_PEGA        1    /* PEGA2     640x480 16 colors*/
  880. #define    VT_VGA        2    /* VGA         640x480 16 colors*/
  881. #define    VT_VEGA720    3    /* VEGA VGA     720x540    16 colors */
  882. #define    VT_VEGA800    4    /* VEGA VGA     800x600    16 colors */
  883. #define    VT_TSL8005_16    5    /* Tseng Labs    800x560    16 colors */
  884. #define    VT_TSL8006_16    6    /* Tseng Labs    800x600    16 colors */
  885. #define    VT_TSL960    7    /* Tseng Labs    960x720    16 colors */
  886. #define    VT_TSL1024    8    /* Tseng Labs  1024x768 16 colors */
  887. #define VT_TSL1024ni    9    /* Tseng Labs  1024x768 16 colors NI */
  888. #define    VT_SIGMAH    10    /* Sigma VGA/H  800x600 16 colors */
  889. #define VT_PVGA1A    11    /* Paradise PVGA1A 800x600 16 colors */
  890. #define VT_V7VRAM6    12    /* Video 7 VRAM    640x480 16 colors */
  891. #define VT_V7VRAM7    13    /* Video 7 VRAM    720x540 16 colors */
  892. #define VT_V7VRAM8    14    /* Video 7 VRAM    800x600 16 colors */
  893. #define VT_V7VRAM1_2    15    /* Video 7 VRAM 1024x768  2 colors */
  894. #define VT_V7VRAM1_4    16    /* Video 7 VRAM 1024x768  4 colors */
  895. #define VT_V7VRAM1_16    17    /* Video 7 VRAM 1024x768 16 colors */
  896. #define VT_GENEGA_6    18    /* Genoa EGA    640x480 16 colors */
  897. #define VT_GENEGA_8    19    /* Genoa EGA    800x600 16 colors */
  898. #define VT_ORVGA8    20    /* Orchid VGA   800x600 16 colors */
  899. #define VT_GVGA8_6    21    /* Genoa VGA    800x600 16 colors */
  900. #define VT_DELL7    22    /* Dell VGA (Video 7)    720x540 16 colors */
  901. #define VT_DELL8    23    /* Dell VGA (Video 7)    800x600 16 colors */
  902. #define VT_VGAWON    24    /* ATI VGA Wonder    800x600 16 colors */
  903. #define VT_PVGA1024    25    /* WD Paradise VGA 1024 1024x768 16 colors */
  904. #define VT_PVGA1024_8    26    /* WD Paradise VGA 1024 800x600 16 colors */
  905. /* 
  906.  * NOTICE:  Insert new types here.  FastWrite goes at end so we can save
  907.  * space in the register initialization table.  These are dummy entries
  908.  */
  909. #define VT_V7FW6    27    /* Video 7 FastWrite 640x480 16 colors */
  910. #define VT_V7FW7    28    /* Video 7 FastWrite 720x540 16 colors */
  911. #define VT_V7FW8    29    /* Video 7 FastWrite 800x600 16 colors */
  912. #define VT_V7FW1_2    30    /* Video 7 FastWrite 1024x768  2 colors */
  913. #define VT_V7FW1_4    31    /* Video 7 FastWrite 1024x768  4 colors */
  914.  
  915. #endif    /*EVGA*/
  916.  
  917. #define EVGAIOC (('E'<<24)|('V'<<16))
  918. #define EVGAMODEMASK    0xffff    
  919.  
  920. #ifdef EVGA
  921. /* generic mode constants for evga */
  922.  
  923. #define GEN_640x350        0
  924. #define GEN_640x480        1
  925. #define GEN_720x540        2
  926. #define GEN_800x560        3
  927. #define GEN_800x600        4
  928. #define GEN_960x720        5
  929. #define GEN_1024x768        6
  930. #define GEN_1024x768x2        7
  931. #define GEN_1024x768x4        8
  932.  
  933. /*
  934.  * generic mode switches for evga. Currently these values
  935.  * are just supported for the card types for which evga support
  936.  * has been implemented. Eventually these mode switching constants 
  937.  * will be supported for other card types as well.
  938.  */
  939.  
  940. #define SW_GEN_640x350        (EVGAIOC | GEN_640x350)
  941. #define SW_GEN_640x480        (EVGAIOC | GEN_640x480)
  942. #define SW_GEN_720x540        (EVGAIOC | GEN_720x540)
  943. #define SW_GEN_800x560        (EVGAIOC | GEN_800x560)
  944. #define SW_GEN_800x600        (EVGAIOC | GEN_800x600)
  945. #define SW_GEN_960x720        (EVGAIOC | GEN_960x720)
  946. #define SW_GEN_1024x768        (EVGAIOC | GEN_1024x768)
  947. #define SW_GEN_1024x768x2    (EVGAIOC | GEN_1024x768x2)
  948. #define SW_GEN_1024x768x4    (EVGAIOC | GEN_1024x768x4)
  949.  
  950. /* temporary kludge for X server */
  951. #define TEMPEVC1024x768E    (MODESWITCH | 42)
  952.  
  953. #define MISC_OUT_READ     0x3cc
  954. #define IO_ADDR_SEL    1
  955.  
  956. /*
  957.  * General adaptor information for evga such as size of display, 
  958.  * pixels per inch, etc.
  959.  */
  960. struct at_disp_info {
  961.     int     type;        /* controller type, EVGA_VRAM */
  962.     int    vt_type;    /* mode, VT_V7VRAM7 */
  963.     int    is_vga;        /* true if adapter supports VGA write modes */
  964.     int    xpix;        /* pixels per scanline */
  965.     int    ypix;        /* number of scanlines */
  966.     int    planes;        /* number of planes of memory */
  967.     int    colors;        /* number of colors available */
  968.     int    buf_size;    /* size of screen memory */
  969.     int    map_size;    /* size of one plane of memory */
  970.     int    slbytes;    /* number of bytes in a scanline */
  971.     int    (*ext_init)();    /* called to initialize 'extended' modes */
  972.     int    (*ext_rest)();    /* called to recover from 'extended' modes */
  973.     struct b_param *regs;    /* registers for mode */
  974. };
  975.  
  976. /* end of evga stuff */
  977. #endif    /*EVGA*/
  978.  
  979.  
  980. /* Hercules support */
  981. #define SW_HGC_P0  (MODESWITCH | M_HGC_P0)
  982. #define SW_HGC_P1  (MODESWITCH | M_HGC_P1)
  983.  
  984. #define O_MODESWITCH    ('S' << 8)    /* Upper byte of mode switch ioctl's */
  985. #define O_SW_B40x25    (O_MODESWITCH | DM_B40x25)    /* Select 40x25 b&w */
  986. #define O_SW_C40x25    (O_MODESWITCH | DM_C40x25)    /* Select 40x25 clr */
  987. #define O_SW_B80x25    (O_MODESWITCH | DM_B80x25)    /* Select 80x25 b&w */
  988. #define O_SW_C80x25    (O_MODESWITCH | DM_C80x25)    /* Select 80x25 clr */
  989. #define O_SW_BG320    (O_MODESWITCH | DM_BG320)    /* Select 320x200 b&w */
  990. #define O_SW_CG320    (O_MODESWITCH | DM_CG320)    /* Select 320x200 color */
  991. #define O_SW_BG640    (O_MODESWITCH | DM_BG640)    /* Select 640x200 b&w */
  992. #define O_SW_EGAMONO80x25    (O_MODESWITCH | DM_EGAMONO80x25)    /* Select EGA mode 7 */
  993. #define O_SW_CG320_D    (O_MODESWITCH | DM_CG320_D)    /* Select EGA mode D */
  994. #define O_SW_CG640_E    (O_MODESWITCH | DM_CG640_E)    /* Select EGA mode E */
  995. #define O_SW_EGAMONOAPA    (O_MODESWITCH | DM_EGAMONOAPA)    /* Select EGA mode F */
  996. #define O_SW_CG640x350    (O_MODESWITCH | DM_CG640x350)    /* EGA mode 10 */
  997. #define O_SW_ENH_MONOAPA2    (O_MODESWITCH | DM_ENHMONOAPA2)    /* EGA mode F* */
  998. #define O_SW_ENH_CG640    (O_MODESWITCH | DM_ENH_CG640)    /* EGA mode 16 */
  999. #define O_SW_ENHB40x25    (O_MODESWITCH | DM_ENH_B40x25)    /* 40x25 b&w */
  1000. #define O_SW_ENHC40x25    (O_MODESWITCH | DM_ENH_C40x25)    /* 40x25 color */
  1001. #define O_SW_ENHB80x25    (O_MODESWITCH | DM_ENH_B80x25)    /* 80x25 b&w */
  1002. #define O_SW_ENHC80x25    (O_MODESWITCH | DM_ENH_C80x25)    /* 80x25 color */
  1003. #define O_SW_ENHB80x43    (O_MODESWITCH | M_ENH_B80x43)    /* 80x43 b&w */
  1004. #define O_SW_ENHC80x43    (O_MODESWITCH | M_ENH_C80x43)    /* 80x43 color */
  1005. #define O_SW_MCAMODE    (O_MODESWITCH | M_MCA_MODE)    /* Reinitialize mono */
  1006. #define O_SW_ATT640    (O_MODESWITCH | DM_ATT_640)    /* 640x400 16 color */
  1007. #define    O_SW_VGA40x25    (O_MODESWITCH | M_VGA_40x25)
  1008. #define    O_SW_VGA80x25    (O_MODESWITCH | M_VGA_80x25)
  1009. #define    O_SW_VGAM80x25    (O_MODESWITCH | M_VGA_M80x25)
  1010. #define    O_SW_VGA11    (O_MODESWITCH | M_VGA11)
  1011. #define    O_SW_VGA12    (O_MODESWITCH | M_VGA12)
  1012. #define    O_SW_VGA13    (O_MODESWITCH | M_VGA13)
  1013. #define O_SW_VGA_C40x25 (O_MODESWITCH | M_VGA_40x25)
  1014. #define O_SW_BG640x480  (O_MODESWITCH | M_VGA11)
  1015. #define O_SW_CG640x480  (O_MODESWITCH | M_VGA12)
  1016. #define O_SW_VGA_CG320  (O_MODESWITCH | M_VGA13)
  1017. #define O_SW_VGA_B40x25 (O_MODESWITCH | DM_VGA_B40x25)
  1018. #define O_SW_VGA_B80x25 (O_MODESWITCH | DM_VGA_B80x25)
  1019.  
  1020. #define    CGAIOC        ('C' << 8)    /* Upper byte of CGA ioctl's */
  1021. #define CGAMODE        (CGAIOC | 1)    /* Obsolete */
  1022. #define CGAIO        (CGAIOC | 2)    /* Do I/O on CGA port */
  1023. #define CGA_GET     (CGAIOC | 3)    /* Get CGA mode setting */
  1024. #define INTERNAL_VID    (CGAIOC|72)    /* internal plasma monitor    */
  1025. #define EXTERNAL_VID    (CGAIOC|73)    /* external plasma monitor    */
  1026.  
  1027. #define PGAIOC        ('P' << 8)    /* Upper byte of PGA ioctl's */
  1028. #define PGAMODE        (PGAIOC | 1)    /* Obsolete */
  1029. #define PGAIO        (PGAIOC | 2)    /* Do I/O on PGA port */
  1030. #define PGA_GET     (PGAIOC | 3)    /* Get PGA mode setting */
  1031.  
  1032. #define EGAIOC        ('E' << 8)    /* Upper byte of EGA ioctl's */
  1033. #define EGAMODE        (EGAIOC | 1)    /* Obsolete */
  1034. #define EGAIO        (EGAIOC | 2)    /* Do I/O on EGA port */
  1035. #define EGA_GET     (EGAIOC | 3)    /* Get EGA mode setting */
  1036. #define EGA_IOPRIVL (EGAIOC | 4)    /* get in/out privilege for ega ports */
  1037.  
  1038. #define MCAIOC        ('M' << 8)    /* Upper byte of MCA ioctl's */
  1039. #define MCAMODE        (MCAIOC | 1)    /* Obsolete */
  1040. #define MCAIO        (MCAIOC | 2)    /* Do I/O on MCA port */
  1041. #define MCA_GET     (MCAIOC | 3)    /* Get MCA mode setting */
  1042.  
  1043. /* PC/AT Vga adapter control */
  1044. #define VGAIOC    ('E' << 8)
  1045. #define VGAMODE (VGAIOC | 65)        /* change vga mode */
  1046. #define VGAIO    (VGAIOC | 66)        /* do inb/outb on vga port */
  1047. #define VGA_GET (VGAIOC | 67)        /* get vga mode setting */
  1048. #define VGA_IOPRIVL (VGAIOC | 68)    /* get in/out privilege for vga ports */
  1049.  
  1050. /* The following ioctl conflicts with the ioctls TCGETX in termiox.h
  1051.  * and STSET in stermio.h. The ioctl is defined only for source
  1052.  * compatibility and is only valid if SCO compatibility mode is turned
  1053.  * on -- see WS_GETXXCOMPAT
  1054.  */
  1055. /* PC/AT Special Adapter Support */
  1056. #define    S_IOC    ('X' << 8)
  1057. #define    SPECIAL_IOPRIVL (S_IOC | 1)    /* get IO privl on special board.
  1058.                        using  vid_iop[] */
  1059.  
  1060. #define CONSIOC        ('c' << 8)    /* Upper byte of console ioctl's */
  1061. #define CONS_CURRENT     (CONSIOC | 1)    /* Get display adapter type */
  1062. #define CONS_GET    (CONSIOC | 2)    /* Get display mode setting */
  1063. #define CONSIO        (CONSIOC | 3)    /* do inb/outb on console port */
  1064.  
  1065. #define PIO_FONT8x8    (CONSIOC|64)
  1066. #define GIO_FONT8x8    (CONSIOC|65)
  1067. #define PIO_FONT8x14    (CONSIOC|66)
  1068. #define GIO_FONT8x14    (CONSIOC|67)
  1069. #define PIO_FONT8x16    (CONSIOC|68)
  1070. #define GIO_FONT8x16    (CONSIOC|69)
  1071.  
  1072. #define CONSADP        (CONSIOC|72)    /* get specific adapter screen */
  1073. #define CONS_GETINFO    (CONSIOC|73)    /* get vid_info struct S001 */
  1074. #define CONS_6845INFO    (CONSIOC|74)    /* get m6845_info struct S001 */
  1075.  
  1076. struct colors {
  1077.     char fore;            /* foreground colors    */
  1078.     char back;            /* background colors    */
  1079. };
  1080.  
  1081. #define    BLACK        0x0
  1082. #define    BLUE        0x1
  1083. #define    GREEN        0x2
  1084. #define    CYAN        0x3
  1085. #define    RED        0x4
  1086. #define    MAGENTA        0x5
  1087. #define    BROWN        0x6
  1088. #define    WHITE        0x7
  1089. #define    GRAY        0x8
  1090. #define    LT_BLUE        0x9
  1091. #define    LT_GREEN    0xA
  1092. #define    LT_CYAN        0xB
  1093. #define    LT_RED        0xC
  1094. #define    LT_MAGENTA    0xD
  1095. #define    YELLOW        0xE
  1096. #define    HI_WHITE    0xF
  1097.  
  1098. /*
  1099.  * flag definitions for mk_keylock
  1100.  */
  1101. #define    CLKED    0x01        /* caps   locked */
  1102. #define    NLKED    0x02        /* num    locked */
  1103. #define    SLKED    0x04        /* scroll locked */
  1104.  
  1105. struct vid_info
  1106. {
  1107.     short    size;            /* must be first field        */
  1108.     short    m_num;            /* multiscreen number, 0 based    */
  1109.     ushort    mv_row, mv_col;        /* cursor position        */
  1110.     ushort    mv_rsz, mv_csz;        /* text screen size        */
  1111.     struct colors    mv_norm,    /* normal attributes        */
  1112.             mv_rev,        /* reverse video attributes    */
  1113.             mv_grfc;    /* graphic character attributes    */
  1114.     uchar_t mv_ovscan;        /* border color            */
  1115.     uchar_t mk_keylock;        /* caps/num/scroll lock        */
  1116. };
  1117.  
  1118. struct m6845_info
  1119. {
  1120.     short    size;        /* must be first field */
  1121.     ushort    screen_top;    /* offset of screen in video    */
  1122.     ushort    cursor_type;    /* cursor shape            */
  1123. };
  1124.  
  1125. typedef struct {
  1126.     int cmd, flg;        /* weird data structure to make loadable */
  1127.     faddr_t faddr;        /* fonts easier to implement    */
  1128. } pgiofontarg_t;        /* Not for use by user programs!! */
  1129.  
  1130. #define MAPADAPTER     ('m' << 8)    /* Upper byte of mapping ioctl's */
  1131. #define MAPCONS     (MAPADAPTER)    /* Map display adapter memory */
  1132. #define MAPMONO     (MAPADAPTER | MONO)    /* Map MCA adapter memory */
  1133. #define MAPCGA      (MAPADAPTER | CGA)     /* Map CGA adapter memory */
  1134. #define MAPPGA      (MAPADAPTER | PGA)    /* Map PGA adapter memory */
  1135. #define MAPEGA      (MAPADAPTER | EGA)    /* Map EGA adapter memory */
  1136. #define MAPVGA        (MAPADAPTER | VGA)
  1137. #define MAPSPECIAL    (MAPADAPTER | S_ADAP)
  1138.  
  1139. #define SWAPCONS     ('s' << 8)    /* Upper byte of switching ioctl's */
  1140. #define SWAPMONO     (SWAPCONS | MONO)    /* Swap MCA adapter */
  1141. #define SWAPCGA      (SWAPCONS | CGA)    /* Swap CGA adapter */
  1142. #define SWAPPGA      (SWAPCONS | PGA)    /* Swap PGA adapter */
  1143. #define SWAPEGA      (SWAPCONS | EGA)    /* Swap EGA adapter */
  1144. #define SWAPVGA      (SWAPCONS | VGA)    /* Swap VGA adapter */
  1145.  
  1146. #ifndef _KB_386    /* These are also defined in termios.h    */
  1147. #define _KB_386
  1148. #define TIOCKBON      (TIOC | 8)    /* Turn on extended keys */
  1149. #define TIOCKBOF      (TIOC | 9)    /* Turn off extended keys */
  1150. #define KBENABLED     (TIOC | 10)    /* Are extended keys enabled? */
  1151. #endif    /* _KB_386    */
  1152.  
  1153.  
  1154. /* VP/ix keyboard types */
  1155. #define KB_84        1
  1156. #define KB_101        2
  1157. #define KB_OTHER    3
  1158.  
  1159. struct kbentry {
  1160.     unchar    kb_table;    /* which table to use */
  1161.     unchar    kb_index;    /* which entry in table */
  1162.     ushort    kb_value;    /* value to get/set in table */
  1163. };
  1164.  
  1165. #define    MKDCONFADDR    20    /* max no. of configurable addrs 
  1166.                  * that can be supported */
  1167. #define    MKDIOADDR    64    /* max no. of I/O addresses supported */
  1168.  
  1169. struct kd_disparam {
  1170.     long    type;        /* display type */
  1171.     char    *addr;        /* display memory address */
  1172.     ushort    ioaddr[MKDIOADDR];    /* valid I/O addresses */
  1173. };
  1174.  
  1175. struct kd_vdctype {
  1176.     long    cntlr,    /* controller type */
  1177.         dsply,    /* display type */
  1178.         rsrvd;    /* reserved for future enhancement */
  1179. };
  1180.  
  1181. struct kd_memloc {
  1182.     char    *vaddr;        /* virtual address to map to */
  1183.     char    *physaddr;    /* physical address to map from */
  1184.     long    length;        /* size in bytes to map */
  1185.     long    ioflg;        /* enable I/O addresses if non-zero */
  1186. };
  1187.  
  1188. struct    kd_range {
  1189.     ulong    start;        /* start address of video memory */
  1190.     ulong    end;        /* last address of video memory */
  1191. };
  1192.  
  1193. struct kd_quemode {
  1194.     int    qsize;    /* desired # elements in queue (set by user) */
  1195.     int    signo;    /* signal number to send when queue goes non-empty
  1196.                             (set by user) */
  1197.     char    *qaddr;    /* user virtual address of queue (set by driver) */
  1198. };
  1199.  
  1200. /* Defines for port I/O ioctls for graphics adapter ports */
  1201. #define IN_ON_PORT    1
  1202. #define OUT_ON_PORT    0
  1203.  
  1204. /* Structures for port I/O ioctls for graphics adapter ports */
  1205. #pragma pack(2)
  1206. struct port_io_struct {
  1207.     char    dir;        /* Direction flag (in or out) */
  1208.     ushort    port;        /* Port address */
  1209.     char    data;        /* Port data */
  1210. };
  1211. struct port_io_arg {
  1212.     struct port_io_struct args[4];    /* Port I/O's for single call */
  1213. };
  1214. #pragma pack()
  1215.  
  1216. #define MKDBASEIO    35    /* base system I/O address array size */
  1217.  
  1218. struct b_param { /* format of video parameters in bios */
  1219.     unchar        fill[5];
  1220.     unchar        seqtab[NSEQ - 1],
  1221.             miscreg;
  1222.     struct egainit    egatab;
  1223.     unchar        attrtab[NATTR],
  1224.             graphtab[NGRAPH];
  1225. };
  1226.  
  1227. #define    KD_BIOS    0    /* video parameters reside in the BIOS tables */
  1228. #define    KD_TBLE    1    /* video parameters reside in hard-coded tables */
  1229. #define    KD_CAS2    2    /* video parameters reside in supplemental table */
  1230.  
  1231. /*
  1232.  * Register values for CGA modes
  1233.  */
  1234.  
  1235. struct cgareginfo {
  1236.     unchar    cga_mode;        /* Mode select register value */
  1237.     unchar    cga_color;        /* Color select register value */
  1238.     ushort    cga_index;        /* Index into cga_videop array */
  1239. } ;
  1240.  
  1241. /*
  1242.  * EGA mode information.
  1243.  */
  1244.  
  1245. /* NOTE: This structure defined for compatibility only. Use the modeinfo struct
  1246.  * in vid.h
  1247.  */
  1248. struct mode_info {
  1249.     ushort    width,    /* alphanumeric mode widths (0 indicates graphics) */
  1250.         height; /* alphanumeric mode heights (0 indicates graphics) */
  1251.     unchar    color;    /* non-zero value indicates a color mode */
  1252.     paddr_t    base;    /* base screen memory physical address */
  1253.     ulong    size;    /* screen memory size */
  1254.     unchar    font,    /* font type (0 indicates graphics) */
  1255.         params,    /* parameter location: in bios or static table */
  1256.         offset,    /* offset given m_loc above */
  1257.         ramdac;    /* RAMDAC table offset to use */
  1258. } ;
  1259.  
  1260. struct kb_shiftmkbrk {
  1261.     ushort    mb_mask;
  1262.     unchar    mb_make,
  1263.         mb_break;
  1264.     unchar    mb_prfx;
  1265. } ;
  1266.  
  1267. struct font_info {
  1268.     unchar    *f_fontp;
  1269.     ushort    f_bpc;
  1270.     ulong    f_count;
  1271. };
  1272.  
  1273. struct vertim {
  1274.     unchar    v_ind,
  1275.         v_val;
  1276. } ;
  1277.  
  1278. #define KD_HERCINDX    0
  1279. #define KD_MONOINDX    1
  1280. #define KD_COLRINDX    2
  1281. #define KD_EGAINDX    3
  1282.  
  1283. #define VDCGRNUM    6
  1284.  
  1285. struct vdc_graphadds {
  1286.     unchar    v_graphtab[VDCGRNUM];
  1287. };
  1288.  
  1289. struct kdvtinfo {        /* device specific info for kd vt driver */
  1290.     scrnmapp_t        kv_scrnmap;    /* Output character map */
  1291.     unsigned        kv_sending;    /* Sending screen? */
  1292.     ushort            kv_rows;    /* Rows sent from screen */
  1293.     ushort            kv_cols;    /* Columns sent from screen */
  1294.     unchar            kv_kbmode;    /* keyboard mode */
  1295.     unchar            kv_dmode;    /* display mode */
  1296.     unchar            kv_flags;    /* flags */
  1297.     unchar            kv_egamode;    /* Saved EGA mode */
  1298. };
  1299.  
  1300. struct ext_graph {
  1301.     long    pid;
  1302.     struct proc *procp;
  1303. };
  1304.  
  1305.  
  1306. #endif /* _SYS_KD_H */
  1307.