1 /* $OpenBSD: eeprom.h,v 1.10 2003/06/02 18:17:36 deraadt Exp $ */ 2 3 /* 4 * Copyright (c) 1995 Theo de Raadt 5 * All rights reserved. 6 * Portions Copyright (c) 1997, Jason Downs. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /* 30 * This structure defines the contents of the EEPROM for all Sun 31 * Workstations with the SunMon monitor. 32 * 33 * The EEPROM is divided into a diagnostic section, a reserved section, 34 * a ROM section, and a software section (defined in detail elsewhere). 35 */ 36 37 /* 38 * Note that most places where the PROM stores a "true/false" flag, 39 * the true value is 0x12 and false is the usual zero. Such flags 40 * all take the values EE_TRUE or EE_FALSE so this file does not 41 * need to define so many value macros. 42 */ 43 #define EE_TRUE 0x12 44 #define EE_FALSE 0x00 45 46 struct ee_keymap { 47 u_char keymap[128]; /* PROM/EEPROM are 7 bit */ 48 }; 49 50 #define PW_SIZE 8 /* max size of a password entry */ 51 52 struct password_inf { 53 u_short bad_counter; /* illegal password count */ 54 char pw_mode; /* mode */ 55 char pw_bytes[PW_SIZE]; /* password */ 56 }; 57 #define NON_SECURE_MODE 0x00 /* non-secure */ 58 #define COMMAND_SECURE_MODE 0x01 /* command secure */ 59 #define FULLY_SECURE_MODE 0x5e /* fully secure */ 60 /* 0, 2-0x5d, 0x5f-0xff: non secure*/ 61 62 63 #define MAX_SLOTS 12 64 #define CONFIG_SIZE 16 /* bytes of config data for each slot */ 65 66 struct eeprom { 67 struct ee_diag { 68 u_int eed_test; /* 0x000: diagnostic test write area */ 69 u_short eed_wrcnt[3]; /* 0x004: diag area write count (3 copies) */ 70 short eed_nu1; 71 72 u_char eed_chksum[3]; /* 0x00c: diag area checksum (3 copies) */ 73 char eed_nu2; 74 time_t eed_hwupdate; /* 0x010: date of last hardware update */ 75 76 char eed_memsize; /* 0x014: MB's of memory in system */ 77 char eed_memtest; /* 0x015: MB's of memory to test */ 78 79 char eed_scrsize; /* 0x016: screen size */ 80 #define EED_SCR_1152X900 0x00 81 #define EED_SCR_1024X1024 0x12 82 #define EED_SCR_1600X1280 0x13 83 #define EED_SCR_1440X1440 0x14 84 #define EED_SCR_640X480 0x15 85 #define EED_SCR_1280X1024 0x16 86 87 char eed_dogaction; /* 0x017: watchdog reset action */ 88 #define EED_DOG_MONITOR 0x00 /* return to monitor command level */ 89 #define EED_DOG_REBOOT 0x12 /* perform power on reset and reboot */ 90 91 char eed_defboot; /* 0x018: default boot? */ 92 #define EED_DEFBOOT 0x00 /* do default boot */ 93 #define EED_NODEFBOOT 0x12 /* don't do default boot */ 94 95 char eed_bootdev[2]; /* 0x019: boot device name (e.g. xy, ie) */ 96 97 u_char eed_bootctrl; /* 0x01b: controller number */ 98 u_char eed_bootunit; /* 0x01c: unit number */ 99 u_char eed_bootpart; /* 0x01d: partition number */ 100 101 char eed_kbdtype; /* 0x01f: non-Sun keyboard type - for OEM's */ 102 #define EED_KBD_SUN 0 /* one of the Sun keyboards */ 103 104 char eed_console; /* 0x01f: console device */ 105 #define EED_CONS_BW 0x00 /* use b&w monitor */ 106 #define EED_CONS_TTYA 0x10 /* use tty A port */ 107 #define EED_CONS_TTYB 0x11 /* use tty B port */ 108 #define EED_CONS_COLOR 0x12 /* use color monitor */ 109 #define EED_CONS_P4 0x20 /* use the P4 monitor */ 110 111 char eed_showlogo; /* 0x020: display Sun logo? */ 112 #define EED_LOGO 0x00 113 #define EED_NOLOGO 0x12 114 115 char eed_keyclick; /* 0x021: keyboard click? */ 116 #define EED_NOKEYCLICK 0x00 117 #define EED_KEYCLICK 0x12 118 119 char eed_diagdev[2]; /* 0x022: boot device name (e.g. xy, ie) */ 120 u_char eed_diagctrl; /* 0x024: controller number */ 121 u_char eed_diagunit; /* 0x025: unit number */ 122 u_char eed_diagpart; /* 0x026: partition number */ 123 #define EED_WOB 0x12 /* bring system up white on black */ 124 125 u_char eed_videobg; 126 char eed_diagpath[40]; /* 0x028: boot path of diagnostic */ 127 #define EED_TERM_34x80 00 128 #define EED_TERM_48x120 0x12 /* for large scrn size 1600x1280 */ 129 u_char eed_colsize; /* 0x050: number of columns */ 130 u_char eed_rowsize; /* 0x051: number of rows */ 131 132 char eed_nu5[6]; 133 134 struct eed_tty_def { /* 0x058: tty port defaults */ 135 char eet_sel_baud; /* user specifies baud rate */ 136 #define EET_DEFBAUD 0x00 137 #define EET_SELBAUD 0x12 138 u_char eet_hi_baud; /* upper byte of baud rate */ 139 u_char eet_lo_baud; /* lower byte of baud rate */ 140 u_char eet_rtsdtr; /* flag for dtr and rts */ 141 #define NO_RTSDTR 0x12 142 char eet_unused[4]; 143 } eed_ttya_def, eed_ttyb_def; 144 145 char eed_banner[80]; /* 0x068: replacement banner */ 146 /* last two chars must be \r\n (XXX - why not \0?) */ 147 148 u_short eed_pattern; /* 0x0b8: test pattern - must contain 0xAA55 */ 149 short eed_nu6; 150 struct eed_conf { /* 0x0bc: system configuration, by slot */ 151 union { 152 struct eec_gen { 153 u_char eec_type; /* board type code */ 154 char eec_size[CONFIG_SIZE - 1]; 155 } eec_gen; 156 157 char conf_byte[CONFIG_SIZE]; 158 u_char eec_type; /* type of this board */ 159 #define EEC_TYPE_NONE 0 /* no board this slot */ 160 #define EEC_TYPE_CPU 0x01 /* cpu */ 161 struct eec_cpu { 162 u_char eec_type; /* board type */ 163 u_char eec_cpu_memsize; /* MB's on cpu */ 164 int eec_cpu_unused:6; 165 int eec_cpu_dcp:1; /* dcp? */ 166 int eec_cpu_68881:1; /* 68881? */ 167 u_char eec_cpu_cachesize; /* KB's cache */ 168 } eec_cpu; 169 struct eec_cpu_alt { 170 u_char eec_type; /* board type */ 171 u_char memsize; /* MB's on cpu */ 172 u_char option; /* option flags */ 173 #define CPU_HAS_DCP 0x02 174 #define CPU_HAS_68881 0x01 175 u_char cachesize; /* KB's in cache */ 176 } eec_cpu_alt; 177 178 #define EEC_TYPE_MEM 0x02 /* memory board */ 179 struct eec_mem { 180 u_char eec_type; /* board type */ 181 u_char eec_mem_size; /* MB's on card */ 182 } eec_mem; 183 184 #define EEC_TYPE_COLOR 0x03 /* color frame buffer */ 185 struct eec_color { 186 u_char eec_type; /* board type */ 187 char eec_color_type; 188 #define EEC_COLOR_TYPE_CG2 2 /* cg2 color board */ 189 #define EEC_COLOR_TYPE_CG3 3 /* cg3 color board */ 190 #define EEC_COLOR_TYPE_CG5 5 /* cg5 color board */ 191 } eec_color; 192 193 #define EEC_TYPE_BW 0x04 /* b&w frame buffer */ 194 195 #define EEC_TYPE_FPA 0x05 /* floating point accelerator */ 196 197 #define EEC_TYPE_DISK 0x06 /* SMD disk controller */ 198 struct eec_disk { 199 u_char eec_type; /* board type */ 200 char eec_disk_type; /* controller type */ 201 #define EEC_DISK_TYPE_X450 1 202 #define EEC_DISK_TYPE_X451 2 203 char eec_disk_ctlr; /* controller number */ 204 char eec_disk_disks; /* number of disks */ 205 char eec_disk_cap[4]; /* capacity */ 206 #define EEC_DISK_NONE 0 207 #define EEC_DISK_130 1 208 #define EEC_DISK_280 2 209 #define EEC_DISK_380 3 210 #define EEC_DISK_575 4 211 #define EEC_DISK_900 5 212 } eec_disk; 213 214 #define EEC_TYPE_TAPE 0x07 /* 1/2" tape controller */ 215 struct eec_tape { 216 u_char eec_type; /* board type */ 217 char eec_tape_type; /* controller type */ 218 #define EEC_TAPE_TYPE_XT 1 /* Xylogics 472 */ 219 #define EEC_TAPE_TYPE_MT 2 /* TapeMaster */ 220 char eec_tape_ctlr; /* controller number */ 221 char eec_tape_drives; /* number of drives */ 222 } eec_tape; 223 224 #define EEC_TYPE_ETHER 0x08 /* Ethernet controller */ 225 226 #define EEC_TYPE_TTY 0x09 /* terminal multiplexer */ 227 struct eec_tty { 228 u_char eec_type; /* board type */ 229 char eec_tty_lines; /* number of lines */ 230 #define MAX_TTY_LINES 16 231 char manufacturer; /* code for maker */ 232 #define EEC_TTY_UNKNOWN 0 233 #define EEC_TTY_SYSTECH 1 234 #define EEC_TTY_SUN 2 235 } eec_tty; 236 237 #define EEC_TYPE_GP 0x0a /* graphics processor/buffer */ 238 struct eec_gp { 239 u_char eec_type; /* board type */ 240 char eec_gp_type; 241 #define EEC_GP_TYPE_GPPLUS 1 /* GP+ graphic processor board */ 242 #define EEC_GP_TYPE_GP2 2 /* GP2 graphic processor board */ 243 } eec_gp; 244 245 #define EEC_TYPE_DCP 0x0b /* DCP ??? XXX */ 246 247 #define EEC_TYPE_SCSI 0x0c /* SCSI controller */ 248 struct eec_scsi { 249 u_char eec_type; /* board type */ 250 char eec_scsi_type; /* host adaptor type */ 251 #define EEC_SCSI_SUN2 2 252 #define EEC_SCSI_SUN3 3 253 char eec_scsi_tapes; /* number of tapes */ 254 char eec_scsi_disks; /* number of disks */ 255 char eec_scsi_tape_type; 256 #define EEC_SCSI_SYSG 1 257 #define EEC_SCSI_MT02 2 258 char eec_scsi_disk_type; 259 #define EEC_SCSI_MD21 1 260 #define EEC_SCSI_ADAPT 2 261 char eec_scsi_driv_code[2]; 262 #define EEC_SCSI_D71 1 263 #define EEC_SCSI_D141 2 264 #define EEC_SCSI_D327 3 265 } eec_scsi; 266 #define EEC_TYPE_IPC 0x0d 267 268 #define EEC_TYPE_GB 0x0e 269 270 #define EEC_TYPE_SCSI375 0x0f 271 272 #define EEC_TYPE_MAPKIT 0x10 273 struct eec_mapkit { 274 u_char eec_type; /* board type */ 275 char eec_mapkit_hw; /* whether INI */ 276 #define EEC_TYPE_MAPKIT_INI 1 277 } eec_mapkit; 278 279 #define EEC_TYPE_CHANNEL 0x11 280 #define EEC_TYPE_ALM2 0x12 281 282 283 struct eec_generic_net { 284 #define EEC_TYPE_GENERIC_NET 0x13 285 u_char eec_devtype; /* board type */ 286 u_char eec_mem_type; /* Memory type */ 287 u_char gn_nu1; 288 u_char gn_nu2; 289 #define ID_VME 0x0 /* Data buffers are in VME space(Shared) */ 290 #define ID_DVMA 0x1 /* or DVMA buffer memory type */ 291 char *dev_reg_ptr; 292 } eec_generic_net; 293 294 295 #define EEC_TYPE_END 0xff /* end of card cage */ 296 } eec_un; 297 } eed_conf[MAX_SLOTS + 1]; 298 #define EEPROM_TABLE 0x58 /* 1 indicates alternate key table. */ 299 u_char which_kbt; /* 0x18C: which keytable? */ 300 301 /* 302 * Note. The following contains the full keyboard id 303 * returned by the type4 transmit layout command. It is not 304 * necessarily anything to do with locale of operation. 305 */ 306 u_char ee_kb_type; 307 u_char ee_kb_id; /* 0x18E: keyboard id in case of EEPROM table */ 308 #define EEPROM_LOGO 0x12 309 u_char otherlogo; /* 0x18F: True if eeprom logo needed */ 310 struct ee_keymap ee_keytab_lc[1]; /* 0x190: */ 311 struct ee_keymap ee_keytab_uc[1]; /* 0x210: */ 312 u_char ee_logo[64][8]; /* 0x290: A 64X64 bit space for custom/OEM designed logo icon */ 313 struct password_inf ee_password_inf; /* 0x490: reserved */ 314 char eed_resv[0x500 - 0x49c]; /* 0x49c: reserved */ 315 } ee_diag; 316 317 struct ee_resv { /* reserved area of EEPROM */ 318 u_short eev_wrcnt[3]; /* 0x500: write count (3 copies) */ 319 short eev_nu1; 320 u_char eev_chksum[3]; /* 0x508: reserved area checksum (3 copies) */ 321 char eev_nu2; 322 char eev_resv[0x600 - 0x50c]; /* 0x50c: */ 323 } ee_resv; 324 325 struct ee_rom { /* ROM area of EEPROM */ 326 u_short eer_wrcnt[3]; /* 0x600: write count (3 copies) */ 327 short eer_nu1; 328 u_char eer_chksum[3]; /* 0x608: ROM area checksum (3 copies) */ 329 char eer_nu2; 330 char eer_resv[0x700 - 0x60c]; /* 0x60c: */ 331 } ee_rom; 332 333 /* 334 * The following area is reserved for software (i.e. UNIX). 335 * The actual contents of this area are defined elsewhere. 336 */ 337 struct ee_softresv { /* software area of EEPROM */ 338 u_short ees_wrcnt[3]; /* 0x700: write count (3 copies) */ 339 short ees_nu1; 340 u_char ees_chksum[3]; /* 0x708: software area checksum (3 copies) */ 341 char ees_nu2; 342 char ees_resv[0x800 - 0x70c]; /* 0x70c: */ 343 } ee_soft; 344 }; 345 346 #define EEPROM_BASE 0xffd04000 347 348 /* 349 * The size of the eeprom on machines with the old clock is 2k. However, 350 * on machines with the new clock (and the `eeprom' in the nvram area) 351 * there are only 2040 bytes available. (???). Since we really only 352 * care about the `diagnostic' area, we'll use it's size when dealing 353 * with the eeprom in general. 354 */ 355 #define EEPROM_SIZE 0x500 356 357 #ifdef _KERNEL 358 extern char *eeprom_va; 359 int eeprom_uio(struct uio *); 360 361 /* 362 * Compatibility defines with NetBSD's eeprom.h. 363 * 364 * The goal here is to provide enough compatibility for kernel drivers to 365 * compile without changes; not to make userland utilities compile. Userland 366 * should use the native interface. 367 */ 368 #define EE_CONS_BW EED_CONS_BW 369 #define EE_CONS_TTYA EED_CONS_TTYA 370 #define EE_CONS_TTYB EED_CONS_TTYB 371 #define EE_CONS_COLOR EED_CONS_COLOR 372 #define EE_CONS_P4OPT EED_CONS_P4 373 374 #define EE_SCR_1152X900 EED_SCR_1152X900 375 #define EE_SCR_1024X1024 EED_SCR_1024X1024 376 #define EE_SCR_1600X1280 EED_SCR_1600X1280 377 #define EE_SCR_1440X1440 EED_SCR_1440X1440 378 #define EE_SCR_640X480 EED_SCR_640X480 379 #define EE_SCR_1280X1024 EED_SCR_1280X1024 380 381 #define eeConsole ee_diag.eed_console 382 #define eeTtyRows ee_diag.eed_rowsize 383 #define eeTtyCols ee_diag.eed_colsize 384 #define eeScreenSize ee_diag.eed_scrsize 385 386 #endif /* _KERNEL */ 387