~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/drivers/char/nvram.c

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * CMOS/NV-RAM driver for Linux
  3  *
  4  * Copyright (C) 1997 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
  5  * idea by and with help from Richard Jelinek <rj@suse.de>
  6  *
  7  * This driver allows you to access the contents of the non-volatile memory in
  8  * the mc146818rtc.h real-time clock. This chip is built into all PCs and into
  9  * many Atari machines. In the former it's called "CMOS-RAM", in the latter
 10  * "NVRAM" (NV stands for non-volatile).
 11  *
 12  * The data are supplied as a (seekable) character device, /dev/nvram. The
 13  * size of this file is 50, the number of freely available bytes in the memory
 14  * (i.e., not used by the RTC itself).
 15  * 
 16  * Checksums over the NVRAM contents are managed by this driver. In case of a
 17  * bad checksum, reads and writes return -EIO. The checksum can be initialized
 18  * to a sane state either by ioctl(NVRAM_INIT) (clear whole NVRAM) or
 19  * ioctl(NVRAM_SETCKS) (doesn't change contents, just makes checksum valid
 20  * again; use with care!)
 21  *
 22  * This file also provides some functions for other parts of the kernel that
 23  * want to access the NVRAM: nvram_{read,write,check_checksum,set_checksum}.
 24  * Obviously this can be used only if this driver is always configured into
 25  * the kernel and is not a module. Since the functions are used by some Atari
 26  * drivers, this is the case on the Atari.
 27  *
 28  *
 29  *      1.1     Cesar Barros: SMP locking fixes
 30  *              added changelog
 31  */
 32 
 33 #define NVRAM_VERSION           "1.1"
 34 
 35 #include <linux/module.h>
 36 #include <linux/config.h>
 37 #include <linux/sched.h>
 38 #include <linux/smp_lock.h>
 39 
 40 #define PC              1
 41 #define ATARI   2
 42 
 43 /* select machine configuration */
 44 #if defined(CONFIG_ATARI)
 45 #define MACH ATARI
 46 #elif defined(__i386__) || defined(__arm__) /* and others?? */
 47 #define MACH PC
 48 #else
 49 #error Cannot build nvram driver for this machine configuration.
 50 #endif
 51 
 52 #if MACH == PC
 53 
 54 /* RTC in a PC */
 55 #define CHECK_DRIVER_INIT() 1
 56 
 57 /* On PCs, the checksum is built only over bytes 2..31 */
 58 #define PC_CKS_RANGE_START      2
 59 #define PC_CKS_RANGE_END        31
 60 #define PC_CKS_LOC                      32
 61 
 62 #define mach_check_checksum     pc_check_checksum
 63 #define mach_set_checksum       pc_set_checksum
 64 #define mach_proc_infos         pc_proc_infos
 65 
 66 #endif
 67 
 68 #if MACH == ATARI
 69 
 70 /* Special parameters for RTC in Atari machines */
 71 #include <asm/atarihw.h>
 72 #include <asm/atariints.h>
 73 #define RTC_PORT(x)                     (TT_RTC_BAS + 2*(x))
 74 #define CHECK_DRIVER_INIT() (MACH_IS_ATARI && ATARIHW_PRESENT(TT_CLK))
 75 
 76 /* On Ataris, the checksum is over all bytes except the checksum bytes
 77  * themselves; these are at the very end */
 78 #define ATARI_CKS_RANGE_START   0
 79 #define ATARI_CKS_RANGE_END             47
 80 #define ATARI_CKS_LOC                   48
 81 
 82 #define mach_check_checksum     atari_check_checksum
 83 #define mach_set_checksum       atari_set_checksum
 84 #define mach_proc_infos         atari_proc_infos
 85 
 86 #endif
 87 
 88 /* Note that *all* calls to CMOS_READ and CMOS_WRITE must be done with
 89  * rtc_lock held. Due to the index-port/data-port design of the RTC, we
 90  * don't want two different things trying to get to it at once. (e.g. the
 91  * periodic 11 min sync from time.c vs. this driver.)
 92  */
 93 
 94 #include <linux/types.h>
 95 #include <linux/errno.h>
 96 #include <linux/miscdevice.h>
 97 #include <linux/malloc.h>
 98 #include <linux/ioport.h>
 99 #include <linux/fcntl.h>
100 #include <linux/mc146818rtc.h>
101 #include <linux/nvram.h>
102 #include <linux/init.h>
103 #include <linux/proc_fs.h>
104 #include <linux/spinlock.h>
105 
106 #include <asm/io.h>
107 #include <asm/uaccess.h>
108 #include <asm/system.h>
109 
110 static int nvram_open_cnt;      /* #times opened */
111 static int nvram_open_mode;             /* special open modes */
112 #define NVRAM_WRITE             1               /* opened for writing (exclusive) */
113 #define NVRAM_EXCL              2               /* opened with O_EXCL */
114 
115 #define RTC_FIRST_BYTE          14      /* RTC register number of first NVRAM byte */
116 #define NVRAM_BYTES                     50      /* number of NVRAM bytes */
117 
118 
119 static int mach_check_checksum( void );
120 static void mach_set_checksum( void );
121 #ifdef CONFIG_PROC_FS
122 static int mach_proc_infos( unsigned char *contents, char *buffer, int *len,
123                                                         off_t *begin, off_t offset, int size );
124 #endif
125 
126 
127 /*
128  * These are the internal NVRAM access functions, which do NOT disable
129  * interrupts and do not check the checksum. Both tasks are left to higher
130  * level function, so they need to be done only once per syscall.
131  */
132 
133 static __inline__ unsigned char nvram_read_int( int i )
134 {
135         return( CMOS_READ( RTC_FIRST_BYTE+i ) );
136 }
137 
138 static __inline__ void nvram_write_int( unsigned char c, int i )
139 {
140         CMOS_WRITE( c, RTC_FIRST_BYTE+i );
141 }
142 
143 static __inline__ int nvram_check_checksum_int( void )
144 {
145         return( mach_check_checksum() );
146 }
147 
148 static __inline__ void nvram_set_checksum_int( void )
149 {
150         mach_set_checksum();
151 }
152 
153 #if MACH == ATARI
154 
155 /*
156  * These non-internal functions are provided to be called by other parts of
157  * the kernel. It's up to the caller to ensure correct checksum before reading
158  * or after writing (needs to be done only once).
159  *
160  * They're only built if CONFIG_ATARI is defined, because Atari drivers use
161  * them. For other configurations (PC), the rest of the kernel can't rely on
162  * them being present (this driver may not be configured at all, or as a
163  * module), so they access config information themselves.
164  */
165 
166 unsigned char nvram_read_byte( int i )
167 {
168         unsigned long flags;
169         unsigned char c;
170 
171         spin_lock_irqsave (&rtc_lock, flags);
172         c = nvram_read_int( i );
173         spin_unlock_irqrestore (&rtc_lock, flags);
174         return( c );
175 }
176 
177 /* This races nicely with trying to read with checksum checking (nvram_read) */
178 void nvram_write_byte( unsigned char c, int i )
179 {
180         unsigned long flags;
181 
182         spin_lock_irqsave (&rtc_lock, flags);
183         nvram_write_int( c, i );
184         spin_unlock_irqrestore (&rtc_lock, flags);
185 }
186 
187 int nvram_check_checksum( void )
188 {
189         unsigned long flags;
190         int rv;
191 
192         spin_lock_irqsave (&rtc_lock, flags);
193         rv = nvram_check_checksum_int();
194         spin_unlock_irqrestore (&rtc_lock, flags);
195         return( rv );
196 }
197 
198 void nvram_set_checksum( void )
199 {
200         unsigned long flags;
201 
202         spin_lock_irqsave (&rtc_lock, flags);
203         nvram_set_checksum_int();
204         spin_unlock_irqrestore (&rtc_lock, flags);
205 }
206 
207 #endif /* MACH == ATARI */
208 
209 
210 /*
211  * The are the file operation function for user access to /dev/nvram
212  */
213 
214 static long long nvram_llseek(struct file *file,loff_t offset, int origin )
215 {
216         switch( origin ) {
217           case 0:
218                 /* nothing to do */
219                 break;
220           case 1:
221                 offset += file->f_pos;
222                 break;
223           case 2:
224                 offset += NVRAM_BYTES;
225                 break;
226         }
227         return( (offset >= 0) ? (file->f_pos = offset) : -EINVAL );
228 }
229 
230 static ssize_t nvram_read(struct file * file,
231         char * buf, size_t count, loff_t *ppos )
232 {
233         char contents [NVRAM_BYTES];
234         unsigned i = *ppos;
235         char *tmp;
236 
237         spin_lock_irq (&rtc_lock);
238         
239         if (!nvram_check_checksum_int())
240                 goto checksum_err;
241 
242         for (tmp = contents; count-- > 0 && i < NVRAM_BYTES; ++i, ++tmp)
243                 *tmp = nvram_read_int(i);
244 
245         spin_unlock_irq (&rtc_lock);
246 
247         if (copy_to_user (buf, contents, tmp - contents))
248                 return -EFAULT;
249 
250         *ppos = i;
251 
252         return (tmp - contents);
253 
254 checksum_err:
255         spin_unlock_irq (&rtc_lock);
256         return -EIO;
257 }
258 
259 static ssize_t nvram_write(struct file * file,
260                 const char * buf, size_t count, loff_t *ppos )
261 {
262         char contents [NVRAM_BYTES];
263         unsigned i = *ppos;
264         char * tmp;
265 
266         if (copy_from_user (contents, buf, (NVRAM_BYTES - i) < count ?
267                                                 (NVRAM_BYTES - i) : count))
268                 return -EFAULT;
269 
270         spin_lock_irq (&rtc_lock);
271 
272         if (!nvram_check_checksum_int())
273                 goto checksum_err;
274 
275         for (tmp = contents; count-- > 0 && i < NVRAM_BYTES; ++i, ++tmp)
276                 nvram_write_int (*tmp, i);
277 
278         nvram_set_checksum_int();
279 
280         spin_unlock_irq (&rtc_lock);
281 
282         *ppos = i;
283 
284         return (tmp - contents);
285 
286 checksum_err:
287         spin_unlock_irq (&rtc_lock);
288         return -EIO;
289 }
290 
291 static int nvram_ioctl( struct inode *inode, struct file *file,
292                                                 unsigned int cmd, unsigned long arg )
293 {
294         int i;
295         
296         switch( cmd ) {
297 
298           case NVRAM_INIT:                      /* initialize NVRAM contents and checksum */
299                 if (!capable(CAP_SYS_ADMIN))
300                         return( -EACCES );
301 
302                 spin_lock_irq (&rtc_lock);
303 
304                 for( i = 0; i < NVRAM_BYTES; ++i )
305                         nvram_write_int( 0, i );
306                 nvram_set_checksum_int();
307                 
308                 spin_unlock_irq (&rtc_lock);
309                 return( 0 );
310           
311           case NVRAM_SETCKS:            /* just set checksum, contents unchanged
312                                                                  * (maybe useful after checksum garbaged
313                                                                  * somehow...) */
314                 if (!capable(CAP_SYS_ADMIN))
315                         return( -EACCES );
316 
317                 spin_lock_irq (&rtc_lock);
318                 nvram_set_checksum_int();
319                 spin_unlock_irq (&rtc_lock);
320                 return( 0 );
321 
322           default:
323                 return( -EINVAL );
324         }
325 }
326 
327 static int nvram_open( struct inode *inode, struct file *file )
328 {
329         if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
330                 (nvram_open_mode & NVRAM_EXCL) ||
331                 ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE)))
332                 return( -EBUSY );
333 
334         if (file->f_flags & O_EXCL)
335                 nvram_open_mode |= NVRAM_EXCL;
336         if (file->f_mode & 2)
337                 nvram_open_mode |= NVRAM_WRITE;
338         nvram_open_cnt++;
339         return( 0 );
340 }
341 
342 static int nvram_release( struct inode *inode, struct file *file )
343 {
344         lock_kernel();
345         nvram_open_cnt--;
346         if (file->f_flags & O_EXCL)
347                 nvram_open_mode &= ~NVRAM_EXCL;
348         if (file->f_mode & 2)
349                 nvram_open_mode &= ~NVRAM_WRITE;
350         unlock_kernel();
351 
352         return( 0 );
353 }
354 
355 
356 #ifndef CONFIG_PROC_FS
357 static int nvram_read_proc( char *buffer, char **start, off_t offset,
358                             int size, int *eof, void *data) { return 0; }
359 #else
360 
361 static int nvram_read_proc( char *buffer, char **start, off_t offset,
362                                                         int size, int *eof, void *data )
363 {
364         unsigned char contents[NVRAM_BYTES];
365     int i, len = 0;
366     off_t begin = 0;
367 
368         spin_lock_irq (&rtc_lock);
369         for( i = 0; i < NVRAM_BYTES; ++i )
370                 contents[i] = nvram_read_int( i );
371         spin_unlock_irq (&rtc_lock);
372         
373         *eof = mach_proc_infos( contents, buffer, &len, &begin, offset, size );
374 
375     if (offset >= begin + len)
376                 return( 0 );
377     *start = buffer + (offset - begin);
378     return( size < begin + len - offset ? size : begin + len - offset );
379         
380 }
381 
382 /* This macro frees the machine specific function from bounds checking and
383  * this like that... */
384 #define PRINT_PROC(fmt,args...)                                                 \
385         do {                                                                                            \
386                 *len += sprintf( buffer+*len, fmt, ##args );    \
387                 if (*begin + *len > offset + size)                              \
388                         return( 0 );                                                            \
389                 if (*begin + *len < offset) {                                   \
390                         *begin += *len;                                                         \
391                         *len = 0;                                                                       \
392                 }                                                                                               \
393         } while(0)
394 
395 #endif /* CONFIG_PROC_FS */
396 
397 static struct file_operations nvram_fops = {
398         owner:          THIS_MODULE,
399         llseek:         nvram_llseek,
400         read:           nvram_read,
401         write:          nvram_write,
402         ioctl:          nvram_ioctl,
403         open:           nvram_open,
404         release:        nvram_release,
405 };
406 
407 static struct miscdevice nvram_dev = {
408         NVRAM_MINOR,
409         "nvram",
410         &nvram_fops
411 };
412 
413 
414 static int __init nvram_init(void)
415 {
416         int ret;
417 
418         /* First test whether the driver should init at all */
419         if (!CHECK_DRIVER_INIT())
420             return( -ENXIO );
421 
422         ret = misc_register( &nvram_dev );
423         if (ret) {
424                 printk(KERN_ERR "nvram: can't misc_register on minor=%d\n", NVRAM_MINOR);
425                 goto out;
426         }
427         if (!create_proc_read_entry("driver/nvram",0,0,nvram_read_proc,NULL)) {
428                 printk(KERN_ERR "nvram: can't create /proc/driver/nvram\n");
429                 ret = -ENOMEM;
430                 goto outmisc;
431         }
432         ret = 0;
433         printk(KERN_INFO "Non-volatile memory driver v" NVRAM_VERSION "\n");
434 out:
435         return( ret );
436 outmisc:
437         misc_deregister( &nvram_dev );
438         goto out;
439 }
440 
441 static void __exit nvram_cleanup_module (void)
442 {
443         remove_proc_entry( "driver/nvram", 0 );
444         misc_deregister( &nvram_dev );
445 }
446 
447 module_init(nvram_init);
448 module_exit(nvram_cleanup_module);
449 
450 
451 /*
452  * Machine specific functions
453  */
454 
455 
456 #if MACH == PC
457 
458 static int pc_check_checksum( void )
459 {
460         int i;
461         unsigned short sum = 0;
462         
463         for( i = PC_CKS_RANGE_START; i <= PC_CKS_RANGE_END; ++i )
464                 sum += nvram_read_int( i );
465         return( (sum & 0xffff) ==
466                         ((nvram_read_int(PC_CKS_LOC) << 8) |
467                          nvram_read_int(PC_CKS_LOC+1)) );
468 }
469 
470 static void pc_set_checksum( void )
471 {
472         int i;
473         unsigned short sum = 0;
474         
475         for( i = PC_CKS_RANGE_START; i <= PC_CKS_RANGE_END; ++i )
476                 sum += nvram_read_int( i );
477         nvram_write_int( sum >> 8, PC_CKS_LOC );
478         nvram_write_int( sum & 0xff, PC_CKS_LOC+1 );
479 }
480 
481 #ifdef CONFIG_PROC_FS
482 
483 static char *floppy_types[] = {
484         "none", "5.25'' 360k", "5.25'' 1.2M", "3.5'' 720k", "3.5'' 1.44M", "3.5'' 2.88M"
485 };
486 
487 static char *gfx_types[] = {
488         "EGA, VGA, ... (with BIOS)",
489         "CGA (40 cols)",
490         "CGA (80 cols)",
491         "monochrome",
492 };
493 
494 static int pc_proc_infos( unsigned char *nvram, char *buffer, int *len,
495                                                   off_t *begin, off_t offset, int size )
496 {
497         int checksum;
498         int type;
499 
500         spin_lock_irq (&rtc_lock);
501         checksum = nvram_check_checksum_int();
502         spin_unlock_irq (&rtc_lock);
503 
504         PRINT_PROC( "Checksum status: %svalid\n", checksum ? "" : "not " );
505 
506         PRINT_PROC( "# floppies     : %d\n",
507                                 (nvram[6] & 1) ? (nvram[6] >> 6) + 1 : 0 );
508         PRINT_PROC( "Floppy 0 type  : " );
509         type = nvram[2] >> 4;
510         if (type < sizeof(floppy_types)/sizeof(*floppy_types))
511                 PRINT_PROC( "%s\n", floppy_types[type] );
512         else
513                 PRINT_PROC( "%d (unknown)\n", type );
514         PRINT_PROC( "Floppy 1 type  : " );
515         type = nvram[2] & 0x0f;
516         if (type < sizeof(floppy_types)/sizeof(*floppy_types))
517                 PRINT_PROC( "%s\n", floppy_types[type] );
518         else
519                 PRINT_PROC( "%d (unknown)\n", type );
520 
521         PRINT_PROC( "HD 0 type      : " );
522         type = nvram[4] >> 4;
523         if (type)
524                 PRINT_PROC( "%02x\n", type == 0x0f ? nvram[11] : type );
525         else
526                 PRINT_PROC( "none\n" );
527 
528         PRINT_PROC( "HD 1 type      : " );
529         type = nvram[4] & 0x0f;
530         if (type)
531                 PRINT_PROC( "%02x\n", type == 0x0f ? nvram[12] : type );
532         else
533                 PRINT_PROC( "none\n" );
534 
535         PRINT_PROC( "HD type 48 data: %d/%d/%d C/H/S, precomp %d, lz %d\n",
536                                 nvram[18] | (nvram[19] << 8),
537                                 nvram[20], nvram[25],
538                                 nvram[21] | (nvram[22] << 8),
539                                 nvram[23] | (nvram[24] << 8) );
540         PRINT_PROC( "HD type 49 data: %d/%d/%d C/H/S, precomp %d, lz %d\n",
541                                 nvram[39] | (nvram[40] << 8),
542                                 nvram[41], nvram[46],
543                                 nvram[42] | (nvram[43] << 8),
544                                 nvram[44] | (nvram[45] << 8) );
545 
546         PRINT_PROC( "DOS base memory: %d kB\n", nvram[7] | (nvram[8] << 8) );
547         PRINT_PROC( "Extended memory: %d kB (configured), %d kB (tested)\n",
548                                 nvram[9] | (nvram[10] << 8),
549                                 nvram[34] | (nvram[35] << 8) );
550 
551         PRINT_PROC( "Gfx adapter    : %s\n", gfx_types[ (nvram[6] >> 4)&3 ] );
552 
553         PRINT_PROC( "FPU            : %sinstalled\n",
554                                 (nvram[6] & 2) ? "" : "not " );
555         
556         return( 1 );
557 }
558 #endif
559 
560 #endif /* MACH == PC */
561 
562 #if MACH == ATARI
563 
564 static int atari_check_checksum( void )
565 {
566         int i;
567         unsigned char sum = 0;
568         
569         for( i = ATARI_CKS_RANGE_START; i <= ATARI_CKS_RANGE_END; ++i )
570                 sum += nvram_read_int( i );
571         return( nvram_read_int( ATARI_CKS_LOC ) == (~sum & 0xff) &&
572                         nvram_read_int( ATARI_CKS_LOC+1 ) == (sum & 0xff) );
573 }
574 
575 static void atari_set_checksum( void )
576 {
577         int i;
578         unsigned char sum = 0;
579         
580         for( i = ATARI_CKS_RANGE_START; i <= ATARI_CKS_RANGE_END; ++i )
581                 sum += nvram_read_int( i );
582         nvram_write_int( ~sum, ATARI_CKS_LOC );
583         nvram_write_int( sum, ATARI_CKS_LOC+1 );
584 }
585 
586 #ifdef CONFIG_PROC_FS
587 
588 static struct {
589         unsigned char val;
590         char *name;
591 } boot_prefs[] = {
592         { 0x80, "TOS" },
593         { 0x40, "ASV" },
594         { 0x20, "NetBSD (?)" },
595         { 0x10, "Linux" },
596         { 0x00, "unspecified" }
597 };
598 
599 static char *languages[] = {
600         "English (US)",
601         "German",
602         "French",
603         "English (UK)",
604         "Spanish",
605         "Italian",
606         "6 (undefined)",
607         "Swiss (French)",
608         "Swiss (German)"
609 };
610 
611 static char *dateformat[] = {
612         "MM%cDD%cYY",
613         "DD%cMM%cYY",
614         "YY%cMM%cDD",
615         "YY%cDD%cMM",
616         "4 (undefined)",
617         "5 (undefined)",
618         "6 (undefined)",
619         "7 (undefined)"
620 };
621 
622 static char *colors[] = {
623         "2", "4", "16", "256", "65536", "??", "??", "??"
624 };
625 
626 #define fieldsize(a)    (sizeof(a)/sizeof(*a))
627 
628 static int atari_proc_infos( unsigned char *nvram, char *buffer, int *len,
629                             off_t *begin, off_t offset, int size )
630 {
631         int checksum = nvram_check_checksum();
632         int i;
633         unsigned vmode;
634         
635         PRINT_PROC( "Checksum status  : %svalid\n", checksum ? "" : "not " );
636 
637         PRINT_PROC( "Boot preference  : " );
638         for( i = fieldsize(boot_prefs)-1; i >= 0; --i ) {
639                 if (nvram[1] == boot_prefs[i].val) {
640                         PRINT_PROC( "%s\n", boot_prefs[i].name );
641                         break;
642                 }
643         }
644         if (i < 0)
645                 PRINT_PROC( "0x%02x (undefined)\n", nvram[1] );
646 
647         PRINT_PROC( "SCSI arbitration : %s\n", (nvram[16] & 0x80) ? "on" : "off" );
648         PRINT_PROC( "SCSI host ID     : " );
649         if (nvram[16] & 0x80)
650                 PRINT_PROC( "%d\n", nvram[16] & 7 );
651         else
652                 PRINT_PROC( "n/a\n" );
653 
654         /* the following entries are defined only for the Falcon */
655         if ((atari_mch_cookie >> 16) != ATARI_MCH_FALCON)
656                 return 1;
657 
658         PRINT_PROC( "OS language      : " );
659         if (nvram[6] < fieldsize(languages))
660                 PRINT_PROC( "%s\n", languages[nvram[6]] );
661         else
662                 PRINT_PROC( "%u (undefined)\n", nvram[6] );
663         PRINT_PROC( "Keyboard language: " );
664         if (nvram[7] < fieldsize(languages))
665                 PRINT_PROC( "%s\n", languages[nvram[7]] );
666         else
667                 PRINT_PROC( "%u (undefined)\n", nvram[7] );
668         PRINT_PROC( "Date format      : " );
669         PRINT_PROC( dateformat[nvram[8]&7],
670                                 nvram[9] ? nvram[9] : '/', nvram[9] ? nvram[9] : '/' );
671         PRINT_PROC( ", %dh clock\n", nvram[8] & 16 ? 24 : 12 );
672         PRINT_PROC( "Boot delay       : " );
673         if (nvram[10] == 0)
674                 PRINT_PROC( "default" );
675         else
676                 PRINT_PROC( "%ds%s\n", nvram[10],
677                                         nvram[10] < 8 ? ", no memory test" : "" );
678 
679         vmode = (nvram[14] << 8) || nvram[15];
680         PRINT_PROC( "Video mode       : %s colors, %d columns, %s %s monitor\n",
681                                 colors[vmode & 7],
682                                 vmode & 8 ? 80 : 40,
683                                 vmode & 16 ? "VGA" : "TV",
684                                 vmode & 32 ? "PAL" : "NTSC" );
685         PRINT_PROC( "                   %soverscan, compat. mode %s%s\n",
686                                 vmode & 64 ? "" : "no ",
687                                 vmode & 128 ? "on" : "off",
688                                 vmode & 256 ?
689                                   (vmode & 16 ? ", line doubling" : ", half screen") : "" );
690                 
691         return( 1 );
692 }
693 #endif
694 
695 #endif /* MACH == ATARI */
696 
697 /*
698  * Local variables:
699  *  c-indent-level: 4
700  *  tab-width: 4
701  * End:
702  */
703 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.