[8027] | 1 | /* |
---|
| 2 | * Machtype: determine machine type & display type |
---|
| 3 | * |
---|
| 4 | * RCS Info |
---|
[11423] | 5 | * $Id: machtype_sgi.c,v 1.9 1998-04-22 22:05:55 ghudson Exp $ |
---|
[8027] | 6 | * $Locker: $ |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include <stdio.h> |
---|
| 10 | #include <string.h> |
---|
| 11 | #include <strings.h> |
---|
| 12 | #if defined(_AIX) && defined(_BSD) |
---|
| 13 | #undef _BSD |
---|
| 14 | #endif |
---|
| 15 | #include <nlist.h> |
---|
| 16 | #include <sys/param.h> |
---|
| 17 | #include <sys/types.h> |
---|
| 18 | #include <sys/file.h> |
---|
| 19 | |
---|
| 20 | #include <sys/sysinfo.h> |
---|
| 21 | #include <sys/ioctl.h> |
---|
| 22 | |
---|
| 23 | #include <ctype.h> |
---|
| 24 | #ifdef sgi |
---|
| 25 | #include <sys/cpu.h> |
---|
| 26 | #include <invent.h> |
---|
| 27 | void do_INV_SCSI(inventory_t *); |
---|
[11326] | 28 | void do_INV_SCSICONTROL(inventory_t *); |
---|
[8027] | 29 | void do_INV_DISK(inventory_t *); |
---|
| 30 | void do_INV_PROCESSOR(inventory_t *,int); |
---|
| 31 | void do_INV_GRAPHICS(inventory_t *); |
---|
| 32 | void do_INV_CAM(inventory_t *); |
---|
| 33 | #endif |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | |
---|
| 37 | #define NL_NF(nl) ((nl).n_type == 0) |
---|
| 38 | |
---|
| 39 | #define KERNEL "/unix" |
---|
| 40 | #define MEMORY "/dev/kmem" |
---|
| 41 | |
---|
| 42 | int verbose = 0; |
---|
| 43 | |
---|
| 44 | struct nlist nl[] = { |
---|
| 45 | #define X_cpu 0 |
---|
| 46 | { "cputype" }, |
---|
| 47 | #define X_maxmem 1 |
---|
| 48 | { "maxmem" }, |
---|
| 49 | #define X_physmem 2 |
---|
| 50 | { "physmem" }, |
---|
| 51 | #define X_nscsi 3 |
---|
| 52 | { "_nscsi_devices" }, |
---|
| 53 | { "" }, |
---|
| 54 | }; |
---|
| 55 | |
---|
| 56 | main(argc, argv) |
---|
| 57 | int argc; |
---|
| 58 | char **argv; |
---|
| 59 | { |
---|
| 60 | int i; |
---|
| 61 | int cpuflg = 0, dpyflg = 0, raflg = 0, memflg = 0; |
---|
| 62 | int doathenaV = 0; |
---|
| 63 | int dosyspV = 0; |
---|
| 64 | int dolocalV = 0; |
---|
| 65 | int dobosN = 0; |
---|
| 66 | int dobosV = 0; |
---|
| 67 | int dosysnam = 0; |
---|
[11418] | 68 | int dosyscompatnam = 0; |
---|
[8027] | 69 | char *kernel = KERNEL, *memory = MEMORY; |
---|
| 70 | FILE *f; |
---|
| 71 | int memfd=0; |
---|
| 72 | |
---|
| 73 | for (i = 1; i < argc; i++) { |
---|
| 74 | if (argv[i][0] != '-') |
---|
| 75 | usage(argv[0]); |
---|
| 76 | |
---|
| 77 | switch (argv[i][1]) { |
---|
| 78 | case 'c': |
---|
| 79 | cpuflg++; |
---|
| 80 | break; |
---|
| 81 | case 'd': |
---|
| 82 | dpyflg++; |
---|
| 83 | break; |
---|
| 84 | case 'r': |
---|
| 85 | raflg++; |
---|
| 86 | break; |
---|
| 87 | case 'M': |
---|
| 88 | memflg++; |
---|
| 89 | break; |
---|
| 90 | case 'k': |
---|
| 91 | kernel = argv[i+1]; |
---|
| 92 | i++; |
---|
| 93 | break; |
---|
| 94 | case 'm': |
---|
| 95 | memory = argv[i+1]; |
---|
| 96 | i++; |
---|
| 97 | break; |
---|
| 98 | case 'A': |
---|
| 99 | doathenaV = 1; |
---|
| 100 | break; |
---|
| 101 | case 'L': |
---|
| 102 | dolocalV = 1; |
---|
| 103 | break; |
---|
| 104 | case 'P': |
---|
| 105 | dosyspV = 1; |
---|
| 106 | break; |
---|
| 107 | case 'N': |
---|
| 108 | dobosN = 1; |
---|
| 109 | break; |
---|
| 110 | case 'E': |
---|
| 111 | dobosV = 1; |
---|
| 112 | break; |
---|
| 113 | case 'S': |
---|
| 114 | dosysnam = 1; |
---|
| 115 | break; |
---|
[11418] | 116 | case 'C': |
---|
| 117 | dosyscompatnam = 1; |
---|
| 118 | break; |
---|
[8027] | 119 | case 'v': |
---|
| 120 | verbose++; |
---|
| 121 | break; |
---|
| 122 | default: |
---|
| 123 | usage(argv[0]); |
---|
| 124 | } |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | |
---|
| 128 | if ((argc == 1) || ((argc == 2) && verbose)) { |
---|
| 129 | #if defined(vax) |
---|
| 130 | puts("vax"); |
---|
| 131 | #else |
---|
| 132 | #if defined(ibm032) |
---|
| 133 | puts("rt"); |
---|
| 134 | #else |
---|
| 135 | #if defined(ultrix) && defined(mips) |
---|
| 136 | puts("decmips"); |
---|
| 137 | #else |
---|
| 138 | #if defined(i386) && defined(_AIX) |
---|
| 139 | puts("ps2"); |
---|
| 140 | #else /* ! ps2 */ |
---|
| 141 | #if defined(sgi) |
---|
| 142 | puts("sgi"); |
---|
| 143 | #else |
---|
| 144 | #if defined(sun) && defined(sparc) |
---|
| 145 | puts("sun4"); |
---|
| 146 | #else /* ! sun sparc */ |
---|
| 147 | #if defined(sun) |
---|
| 148 | puts("sun3"); |
---|
| 149 | #else |
---|
| 150 | puts("???"); |
---|
| 151 | #endif |
---|
| 152 | #endif |
---|
| 153 | #endif |
---|
| 154 | #endif |
---|
| 155 | #endif |
---|
| 156 | #endif |
---|
| 157 | #endif |
---|
| 158 | exit(0); |
---|
| 159 | } |
---|
| 160 | |
---|
| 161 | /* Print out version of Athena machtype compiled against */ |
---|
| 162 | if (doathenaV) { |
---|
| 163 | if (verbose) |
---|
| 164 | printf("Machtype version: %s.%s\n",ATHMAJV,ATHMINV); |
---|
| 165 | else |
---|
| 166 | printf("%s.%s\n",ATHMAJV,ATHMINV); |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | /* Print out version of attached packs */ |
---|
| 170 | if (dosyspV) { |
---|
| 171 | char buf[256],rvd_version[256], *p; |
---|
| 172 | if ((f = fopen("/srvd/.rvdinfo","r")) == NULL) { |
---|
| 173 | printf("Syspack information unavailable\n"); |
---|
| 174 | } else { |
---|
| 175 | fgets(buf,256,f); |
---|
| 176 | fclose(f); |
---|
| 177 | |
---|
| 178 | /* If it is verbose, give the whole line, else just the vers # */ |
---|
| 179 | if (verbose) { |
---|
| 180 | printf(buf); |
---|
| 181 | } else { |
---|
| 182 | p = index(buf,' '); /* skip "Athena" */ |
---|
| 183 | p = index(p+1,' '); /* skip "RVD" */ |
---|
| 184 | p = index(p+1,' '); /* Skip "RSAIX" */ |
---|
| 185 | p = index(p+1,' '); /* skip "version" */ |
---|
| 186 | strncpy(rvd_version,p+1,256); |
---|
| 187 | p = index(rvd_version,' '); |
---|
| 188 | *p = '\0'; |
---|
| 189 | printf("%s\n",rvd_version); |
---|
| 190 | } |
---|
| 191 | } |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | /* Print out local version from /etc/athena/version */ |
---|
| 195 | if (dolocalV) { |
---|
| 196 | char buf[256],loc_version[256], *p; |
---|
[8750] | 197 | if ((f = fopen("/etc/athena/version","r")) == NULL) { |
---|
[8027] | 198 | printf("Local version information unavailable\n"); |
---|
| 199 | } else { |
---|
| 200 | fseek(f,-100,2); |
---|
| 201 | while (fgets(buf,256,f) != NULL) |
---|
| 202 | ; |
---|
| 203 | fclose(f); |
---|
| 204 | |
---|
| 205 | if (verbose) { |
---|
| 206 | printf(buf); |
---|
| 207 | } else { |
---|
| 208 | p = index(buf,' '); /* skip "Athena" */ |
---|
| 209 | p = index(p+1,' '); /* skip "Workstation/Server" */ |
---|
| 210 | p = index(p+1,' '); /* Skip "RSAIX" */ |
---|
| 211 | p = index(p+1,' '); /* skip "version" */ |
---|
| 212 | strncpy(loc_version,p+1,256); |
---|
| 213 | p = index(loc_version,' '); |
---|
| 214 | *p = '\0'; |
---|
| 215 | printf("%s\n",loc_version); |
---|
| 216 | } |
---|
| 217 | } |
---|
| 218 | } |
---|
| 219 | |
---|
| 220 | /* Print out vendor OS name */ |
---|
| 221 | if (dobosN) { |
---|
| 222 | if (verbose) { |
---|
[8766] | 223 | printf(OSNAME " " OSVERS "\n"); |
---|
[8027] | 224 | } else { |
---|
[8766] | 225 | printf(OSNAME "\n"); |
---|
[8027] | 226 | } |
---|
| 227 | } |
---|
| 228 | |
---|
| 229 | /* Print out vendor OS version */ |
---|
| 230 | if (dobosV) { |
---|
[8766] | 231 | printf(OSVERS "\n"); |
---|
[8027] | 232 | } |
---|
| 233 | if (dosysnam) |
---|
| 234 | printf("%s\n", ATHSYS); |
---|
[11423] | 235 | if (dosyscompatnam) |
---|
[11418] | 236 | printf("%s\n", ATHSYSCOMPAT); |
---|
[8027] | 237 | if (cpuflg) |
---|
| 238 | do_cpu(kernel, memfd); |
---|
| 239 | if (dpyflg) |
---|
| 240 | do_dpy(kernel, memfd); |
---|
| 241 | if (raflg) |
---|
| 242 | do_disk(kernel, memfd); |
---|
| 243 | |
---|
| 244 | if (memflg) |
---|
| 245 | { |
---|
| 246 | |
---|
| 247 | if (nlist(kernel, nl) < 0) { |
---|
| 248 | fprintf(stderr,"%s: can't get namelist\n", argv[0]); |
---|
| 249 | exit(2); |
---|
| 250 | } |
---|
| 251 | if ((memfd = open (memory, O_RDONLY)) == -1) { |
---|
| 252 | perror ("machtype: can't open memory"); |
---|
| 253 | exit(2); |
---|
| 254 | } |
---|
| 255 | if (memflg) |
---|
| 256 | do_memory(kernel, memfd); |
---|
| 257 | } |
---|
| 258 | exit(0); |
---|
| 259 | } |
---|
| 260 | |
---|
| 261 | |
---|
| 262 | |
---|
| 263 | usage(name) |
---|
| 264 | char *name; |
---|
| 265 | { |
---|
| 266 | fprintf(stderr, "usage: %s [-v] [-c] [-d] [-r] [-E] [-N] [-M]\n",name); |
---|
[8407] | 267 | fprintf(stderr, " [-k kernel] [-m memory] [-A] [-L] [-P] [-S]\n"); |
---|
[8027] | 268 | exit(1); |
---|
| 269 | } |
---|
| 270 | |
---|
| 271 | |
---|
| 272 | do_cpu(kernel, mf) |
---|
| 273 | char *kernel; |
---|
| 274 | int mf; |
---|
| 275 | { |
---|
| 276 | inventory_t *inv; |
---|
| 277 | int done=0; |
---|
| 278 | (void)setinvent(); |
---|
| 279 | inv = getinvent(); |
---|
| 280 | while ((inv != NULL) && !done) { |
---|
| 281 | if ( inv->inv_class == 1) { |
---|
| 282 | do_INV_PROCESSOR(inv,verbose); |
---|
| 283 | } |
---|
| 284 | inv = getinvent(); |
---|
| 285 | } |
---|
| 286 | } |
---|
| 287 | |
---|
| 288 | void do_INV_PROCESSOR(inventory_t *i,int verbose) |
---|
| 289 | { |
---|
| 290 | if (i->inv_type == INV_CPUBOARD ) { |
---|
| 291 | switch (i->inv_state) { |
---|
| 292 | case INV_R2300BOARD: |
---|
| 293 | puts(verbose ? "SGI R2300": "R2300"); |
---|
| 294 | break; |
---|
| 295 | case INV_IP4BOARD: |
---|
| 296 | puts(verbose ? "SGI IP4": "IP4"); |
---|
| 297 | break; |
---|
| 298 | case INV_IP5BOARD: |
---|
| 299 | puts(verbose ? "SGI IP5": "IP5"); |
---|
| 300 | break; |
---|
| 301 | case INV_IP6BOARD: |
---|
| 302 | puts(verbose ? "SGI IP6": "IP6"); |
---|
| 303 | break; |
---|
| 304 | case INV_IP7BOARD: |
---|
| 305 | puts(verbose ? "SGI IP7": "IP7"); |
---|
| 306 | break; |
---|
| 307 | case INV_IP9BOARD: |
---|
| 308 | puts(verbose ? "SGI IP9": "IP9"); |
---|
| 309 | break; |
---|
| 310 | case INV_IP12BOARD: |
---|
| 311 | puts(verbose ? "SGI IP12": "IP12"); |
---|
| 312 | break; |
---|
| 313 | case INV_IP15BOARD: |
---|
| 314 | puts(verbose ? "SGI IP15": "IP15"); |
---|
| 315 | break; |
---|
| 316 | case INV_IP17BOARD: |
---|
| 317 | puts(verbose ? "SGI IP17": "IP17"); |
---|
| 318 | break; |
---|
| 319 | case INV_IP19BOARD: |
---|
| 320 | puts(verbose ? "SGI IP19": "IP19"); |
---|
| 321 | break; |
---|
| 322 | case INV_IP20BOARD: |
---|
| 323 | puts(verbose ? "SGI IP20": "IP20"); |
---|
| 324 | break; |
---|
| 325 | case INV_IP21BOARD: |
---|
| 326 | puts(verbose ? "SGI IP21": "IP21"); |
---|
| 327 | break; |
---|
| 328 | case INV_IP22BOARD: |
---|
| 329 | puts(verbose ? "SGI IP22": "IP22"); |
---|
| 330 | break; |
---|
| 331 | case INV_IP26BOARD: |
---|
| 332 | puts(verbose ? "SGI IP26": "IP26"); |
---|
| 333 | break; |
---|
[10540] | 334 | #ifdef INV_IP32BOARD |
---|
| 335 | case INV_IP32BOARD: |
---|
| 336 | puts(verbose ? "SGI IP32": "IP32"); |
---|
| 337 | break; |
---|
| 338 | #endif |
---|
[8027] | 339 | default: |
---|
| 340 | if(verbose) |
---|
| 341 | printf("Unknown SGI type %d\n", i->inv_state); |
---|
| 342 | else |
---|
| 343 | puts("SGI???"); |
---|
| 344 | } |
---|
| 345 | } else if (verbose) { |
---|
| 346 | if (i->inv_type == INV_CPUCHIP) { |
---|
| 347 | fprintf(stdout,"CPU: MIPS R4600\n"); |
---|
| 348 | } else { |
---|
| 349 | fprintf(stdout,"FPU:MIPS R4610\n"); |
---|
| 350 | } |
---|
| 351 | } |
---|
| 352 | } |
---|
| 353 | |
---|
| 354 | |
---|
| 355 | #ifdef vax |
---|
| 356 | int ka420model() |
---|
| 357 | { |
---|
| 358 | unsigned long cacr; |
---|
| 359 | int kUmf; |
---|
| 360 | if (nl[X_nexus].n_type == 0) |
---|
| 361 | return -1; |
---|
| 362 | kUmf = open("/dev/kUmem", O_RDONLY); |
---|
| 363 | if (kUmf == -1) |
---|
| 364 | return -1; |
---|
| 365 | lseek(kUmf, nl[X_nexus].n_value + (int)&((struct nb_regs *)0)->nb_cacr, L_SET); |
---|
| 366 | if(read(kUmf, &cacr, sizeof(cacr)) != sizeof(cacr)) |
---|
| 367 | return -1; |
---|
| 368 | close (kUmf); |
---|
| 369 | return (cacr >> 6) & 3; |
---|
| 370 | } |
---|
| 371 | #endif /* vax */ |
---|
| 372 | |
---|
| 373 | do_dpy(kernel, mf) |
---|
| 374 | char *kernel; |
---|
| 375 | int mf; |
---|
| 376 | { |
---|
| 377 | int status; |
---|
| 378 | inventory_t *inv; |
---|
| 379 | int done=0; |
---|
| 380 | #ifdef sgi |
---|
| 381 | if (verbose) { |
---|
| 382 | switch(fork()) { |
---|
| 383 | case -1: |
---|
| 384 | fprintf (stderr, |
---|
| 385 | "Don't know how to determine display type for this machine.\n"); |
---|
| 386 | return; |
---|
| 387 | case 0: |
---|
| 388 | if ((execlp("/usr/gfx/gfxinfo","gfxinfo",NULL) ) == -1 ) { |
---|
| 389 | fprintf (stderr, |
---|
| 390 | "Don't know how to determine display type for this machine.\n"); |
---|
| 391 | return; |
---|
| 392 | } |
---|
| 393 | default: |
---|
| 394 | wait(&status); |
---|
| 395 | break; |
---|
| 396 | } /* switch */ |
---|
| 397 | (void) setinvent(); |
---|
| 398 | inv = getinvent(); |
---|
| 399 | while ((inv != NULL) && !done) { |
---|
| 400 | if ( inv->inv_class == INV_VIDEO) { |
---|
| 401 | do_INV_CAM(inv); |
---|
| 402 | } |
---|
| 403 | inv = getinvent(); |
---|
| 404 | } |
---|
| 405 | } else { /* not verbose */ |
---|
| 406 | (void) setinvent(); |
---|
| 407 | inv = getinvent(); |
---|
| 408 | while ((inv != NULL) && !done) { |
---|
| 409 | if ( inv->inv_class == INV_GRAPHICS) { |
---|
| 410 | do_INV_GRAPHICS(inv); |
---|
| 411 | } |
---|
| 412 | inv = getinvent(); |
---|
| 413 | } |
---|
| 414 | } /* verbose */ |
---|
| 415 | |
---|
| 416 | #else |
---|
| 417 | fprintf (stderr, |
---|
| 418 | "Don't know how to determine display type for this machine.\n"); |
---|
| 419 | return; |
---|
| 420 | #endif |
---|
| 421 | } |
---|
| 422 | |
---|
| 423 | void do_INV_GRAPHICS(inventory_t *i) |
---|
| 424 | { |
---|
[10540] | 425 | switch(i->inv_type) |
---|
| 426 | { |
---|
| 427 | case INV_NEWPORT: |
---|
| 428 | switch(i->inv_state) |
---|
| 429 | { |
---|
| 430 | case INV_NEWPORT_24: |
---|
| 431 | fprintf(stdout,"XL-24\n"); |
---|
| 432 | break; |
---|
| 433 | case INV_NEWPORT_XL: |
---|
| 434 | fprintf(stdout,"XL\n"); |
---|
| 435 | break; |
---|
| 436 | default: |
---|
| 437 | fprintf(stdout,"NG1\n"); |
---|
| 438 | break; |
---|
| 439 | } |
---|
| 440 | break; |
---|
| 441 | case INV_GR2: |
---|
| 442 | /* an EXPRESS is an EXPRESS of course of course |
---|
| 443 | except when you are a GR3-XZ */ |
---|
| 444 | if ((i->inv_state & ~INV_GR2_INDY) == INV_GR2_ELAN ) |
---|
| 445 | fprintf(stdout,"GR3-XZ\n"); |
---|
| 446 | else |
---|
| 447 | fprintf(stdout,"UNKNOWN video\n"); |
---|
| 448 | break; |
---|
| 449 | #ifdef INV_CRIME |
---|
| 450 | case INV_CRIME: |
---|
| 451 | fprintf(stdout, "CRM\n"); |
---|
| 452 | break; |
---|
| 453 | #endif |
---|
| 454 | default: |
---|
| 455 | fprintf(stdout,"UNKNOWN video\n"); |
---|
| 456 | } |
---|
[8027] | 457 | } |
---|
| 458 | |
---|
| 459 | void do_INV_CAM(inventory_t *i) |
---|
| 460 | { |
---|
| 461 | if (i->inv_type == INV_VIDEO_VINO ) { |
---|
| 462 | if (i->inv_state == INV_VINO_INDY_CAM ) { |
---|
| 463 | fprintf(stdout,"\tIndy cam connected\n"); |
---|
| 464 | } |
---|
| 465 | } |
---|
| 466 | } |
---|
| 467 | |
---|
| 468 | |
---|
| 469 | |
---|
| 470 | do_disk(kernel, mf) |
---|
| 471 | char *kernel; |
---|
| 472 | int mf; |
---|
| 473 | { |
---|
| 474 | inventory_t *inv; |
---|
| 475 | int t; |
---|
| 476 | int done=0; |
---|
| 477 | (void) setinvent(); |
---|
| 478 | inv = getinvent(); |
---|
| 479 | t = 0; |
---|
| 480 | while ((inv != NULL) && !done) { |
---|
[11326] | 481 | if (inv->inv_class == INV_DISK) |
---|
| 482 | do_INV_DISK(inv); |
---|
| 483 | else if (inv->inv_class == INV_SCSI) |
---|
| 484 | do_INV_SCSI(inv); |
---|
| 485 | inv = getinvent(); |
---|
[8027] | 486 | } |
---|
| 487 | } |
---|
| 488 | void do_INV_SCSI(inventory_t *i) |
---|
| 489 | { |
---|
| 490 | if (i->inv_type == INV_CDROM) { |
---|
[11326] | 491 | fprintf(stdout,"CDROM: unit %i, on SCSI controller %i\n",i->inv_unit,i->inv_controller); |
---|
[8027] | 492 | } else { |
---|
| 493 | fprintf(stdout,"Unknown type %i:unit %i, on SCSI controller %i\n",i->inv_type,i->inv_unit,i->inv_controller); |
---|
| 494 | } |
---|
| 495 | } |
---|
| 496 | |
---|
| 497 | void do_INV_DISK(inventory_t *i) |
---|
| 498 | { |
---|
[11326] | 499 | switch (i->inv_type) |
---|
| 500 | { |
---|
| 501 | case INV_SCSIDRIVE: |
---|
| 502 | printf("Disk drive: unit %u, on SCSI controller %u\n", |
---|
| 503 | i->inv_unit, i->inv_controller); |
---|
| 504 | break; |
---|
| 505 | |
---|
| 506 | case INV_SCSIFLOPPY: |
---|
| 507 | printf("Floppy drive: unit %u, on SCSI controller %u\n", |
---|
| 508 | i->inv_unit, i->inv_controller); |
---|
| 509 | break; |
---|
| 510 | |
---|
| 511 | case INV_SCSICONTROL: |
---|
| 512 | case INV_GIO_SCSICONTROL: |
---|
| 513 | #ifdef INV_PCI_SCSICONTROL |
---|
| 514 | case INV_PCI_SCSICONTROL: |
---|
| 515 | #endif |
---|
| 516 | do_INV_SCSICONTROL(i); |
---|
| 517 | break; |
---|
| 518 | |
---|
| 519 | default: |
---|
| 520 | printf("Unknown type %u: unit %u, on SCSI controller %u\n", |
---|
| 521 | i->inv_type, i->inv_unit, i->inv_controller); |
---|
| 522 | break; |
---|
| 523 | } |
---|
[8027] | 524 | } |
---|
| 525 | |
---|
[11326] | 526 | void do_INV_SCSICONTROL(inventory_t *i) |
---|
| 527 | { |
---|
| 528 | switch (i->inv_type) |
---|
| 529 | { |
---|
| 530 | case INV_SCSICONTROL: |
---|
| 531 | printf("Integral"); |
---|
| 532 | break; |
---|
| 533 | case INV_GIO_SCSICONTROL: |
---|
| 534 | printf("GIO"); |
---|
| 535 | break; |
---|
| 536 | #ifdef INV_PCI_SCSICONTROL |
---|
| 537 | case INV_PCI_SCSICONTROL: |
---|
| 538 | printf("PCI"); |
---|
| 539 | break; |
---|
| 540 | #endif |
---|
| 541 | default: |
---|
| 542 | printf("Unknown"); |
---|
| 543 | break; |
---|
| 544 | } |
---|
| 545 | |
---|
| 546 | printf(" SCSI controller %u: Version ", i->inv_controller); |
---|
| 547 | |
---|
| 548 | switch (i->inv_state) |
---|
| 549 | { |
---|
| 550 | case INV_WD93: |
---|
| 551 | printf("WD 33C93"); |
---|
| 552 | break; |
---|
| 553 | |
---|
| 554 | case INV_WD93A: |
---|
| 555 | printf("WD 33C93A"); |
---|
| 556 | break; |
---|
| 557 | |
---|
| 558 | case INV_WD93B: |
---|
| 559 | printf("WD 33C93B"); |
---|
| 560 | break; |
---|
| 561 | |
---|
| 562 | case INV_WD95A: |
---|
| 563 | printf("WD 33C95A"); |
---|
| 564 | break; |
---|
| 565 | |
---|
| 566 | case INV_SCIP95: |
---|
| 567 | printf("SCIP w/WD 33C95A"); |
---|
| 568 | break; |
---|
| 569 | |
---|
| 570 | #ifdef INV_ADP7880 |
---|
| 571 | case INV_ADP7880: |
---|
| 572 | printf("ADAPTEC 7880"); |
---|
| 573 | break; |
---|
| 574 | #endif |
---|
| 575 | |
---|
| 576 | default: |
---|
| 577 | printf("Unknown"); |
---|
| 578 | break; |
---|
| 579 | } |
---|
| 580 | |
---|
| 581 | if (i->inv_unit) |
---|
| 582 | printf(", rev. %X", i->inv_unit); |
---|
| 583 | |
---|
| 584 | putchar('\n'); |
---|
[8027] | 585 | } |
---|
| 586 | |
---|
| 587 | |
---|
| 588 | #define MEG (1024*1024) |
---|
| 589 | |
---|
| 590 | do_memory (kernel, mf) |
---|
| 591 | char *kernel; |
---|
| 592 | int mf; |
---|
| 593 | { |
---|
| 594 | int pos, mem; |
---|
| 595 | pos = nl[X_maxmem].n_value; |
---|
| 596 | if(pos == 0) { |
---|
| 597 | fprintf(stderr, "can't find maxmem\n"); |
---|
| 598 | exit(3); |
---|
| 599 | } |
---|
| 600 | lseek(mf,pos,L_SET); /* Error checking ? */ |
---|
| 601 | if(read(mf,&mem,4) == -1) { |
---|
| 602 | perror("read (kmem)"); |
---|
| 603 | exit(4); |
---|
| 604 | } else { |
---|
| 605 | if(verbose) |
---|
| 606 | printf("%#06x user, ",mem * getpagesize()); |
---|
| 607 | } |
---|
| 608 | pos = nl[X_physmem].n_value; |
---|
| 609 | if(pos == 0) { |
---|
| 610 | fprintf(stderr, "can't find physmem\n"); |
---|
| 611 | exit(3); |
---|
| 612 | } |
---|
| 613 | lseek(mf,pos,L_SET); |
---|
| 614 | if(read(mf,&mem,4) == -1) { |
---|
| 615 | perror("read (kmem)"); |
---|
| 616 | exit(4); |
---|
| 617 | } else { |
---|
| 618 | if(verbose) |
---|
| 619 | printf("%#06x (%d M) total\n",mem * getpagesize(),(mem * getpagesize() + MEG/2)/MEG); |
---|
| 620 | else |
---|
| 621 | printf("%d\n", mem * getpagesize()); |
---|
| 622 | } |
---|
| 623 | return; |
---|
| 624 | } |
---|
| 625 | |
---|