Import 2.3.17
[davej-history.git] / arch / m68k / mac / via.c
blob2205b226c63abce660ff944e4e8e1c336ff7590f
1 /*
2 * 6522 Versatile Interface Adapter (VIA)
4 * There are two of these on the Mac II. Some IRQ's are vectored
5 * via them as are assorted bits and bobs - eg RTC, ADB.
7 * CSA: Motorola seems to have removed documentation on the 6522 from
8 * their web site; try
9 * http://nerini.drf.com/vectrex/other/text/chips/6522/
10 * http://www.zymurgy.net/classic/vic20/vicdet1.htm
11 * and
12 * http://193.23.168.87/mikro_laborversuche/via_iobaustein/via6522_1.html
13 * for info. A full-text web search on 6522 AND VIA will probably also
14 * net some usefulness. <cananian@alumni.princeton.edu> 20apr1999
16 * PRAM/RTC access algorithms are from the NetBSD RTC toolkit version 1.08b
17 * by Erik Vogan and adapted to Linux by Joshua M. Thompson (funaho@jurai.org)
21 #include <linux/types.h>
22 #include <linux/kernel.h>
23 #include <linux/mm.h>
24 #include <linux/delay.h>
25 #include <linux/init.h>
27 #include <asm/traps.h>
28 #include <asm/bootinfo.h>
29 #include <asm/macintosh.h>
30 #include <asm/macints.h>
31 #include <asm/machw.h>
32 #include <asm/mac_via.h>
33 #include <asm/mac_psc.h>
35 volatile __u8 *via1, *via2;
36 #if 0
37 /* See note in mac_via.h about how this is possibly not useful */
38 volatile long *via_memory_bogon=(long *)&via_memory_bogon;
39 #endif
40 int rbv_present,via_alt_mapping;
41 __u8 rbv_clear;
44 * Globals for accessing the VIA chip registers without having to
45 * check if we're hitting a real VIA or an RBV. Normally you could
46 * just hit the combined register (ie, vIER|rIER) but that seems to
47 * break on AV Macs...probably because they actually decode more than
48 * eight address bits. Why can't Apple engineers at least be
49 * _consistantly_ lazy? - 1999-05-21 (jmt)
52 static int gIER,gIFR,gBufA,gBufB;
55 * Timer defs.
58 #define TICK_SIZE 10000
59 #define MAC_CLOCK_TICK (783300/HZ) /* ticks per HZ */
60 #define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF)
61 #define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8)
63 static int nubus_active;
65 void via_debug_dump(void);
66 void via1_irq(int, void *, struct pt_regs *);
67 void via2_irq(int, void *, struct pt_regs *);
68 void via_nubus_irq(int, void *, struct pt_regs *);
69 void via_irq_enable(int irq);
70 void via_irq_disable(int irq);
71 void via_irq_clear(int irq);
73 extern void mac_bang(int, void *, struct pt_regs *);
74 extern void mac_SCC_handler(int, void *, struct pt_regs *);
75 extern int console_loglevel;
76 extern int oss_present;
79 * Initialize the VIAs
81 * First we figure out where they actually _are_ as well as what type of
82 * VIA we have for VIA2 (it could be a real VIA or an RBV or even an OSS.)
83 * Then we pretty much clear them out and disable all IRQ sources.
85 * Note: the OSS is actually "detected" here and not in oss_init(). It just
86 * seems more logical to do it here since via_init() needs to know
87 * these things anyways.
90 void __init via_init(void)
92 switch(macintosh_config->via_type) {
94 /* IIci, IIsi, IIvx, IIvi (P6xx), LC series */
96 case MAC_VIA_IIci:
97 via1 = (void *) VIA1_BASE;
98 if (macintosh_config->ident == MAC_MODEL_IIFX) {
99 via2 = NULL;
100 rbv_present = 0;
101 oss_present = 1;
102 } else {
103 via2 = (void *) RBV_BASE;
104 rbv_present = 1;
105 oss_present = 0;
107 if (macintosh_config->ident == MAC_MODEL_LCIII) {
108 rbv_clear = 0x00;
109 } else {
110 /* on most RBVs (& unlike the VIAs), you */
111 /* need to set bit 7 when you write to IFR */
112 /* in order for your clear to occur. */
113 rbv_clear = 0x80;
115 gIER = rIER;
116 gIFR = rIFR;
117 gBufA = rSIFR;
118 gBufB = rBufB;
119 break;
121 /* Quadra and early MacIIs agree on the VIA locations */
123 case MAC_VIA_QUADRA:
124 case MAC_VIA_II:
125 via1 = (void *) VIA1_BASE;
126 via2 = (void *) VIA2_BASE;
127 rbv_present = 0;
128 oss_present = 0;
129 rbv_clear = 0x00;
130 gIER = vIER;
131 gIFR = vIFR;
132 gBufA = vBufA;
133 gBufB = vBufB;
134 break;
135 default:
136 panic("UNKNOWN VIA TYPE");
139 printk("VIA1 at %p is a 6522 or clone\n", via1);
141 printk("VIA2 at %p is ", via2);
142 if (rbv_present) {
143 printk("an RBV\n");
144 } else if (oss_present) {
145 printk("an OSS\n");
146 } else {
147 printk("a 6522 or clone\n");
150 #ifdef DEBUG_VIA
151 via_debug_dump();
152 #endif
155 * Shut down all IRQ sources, reset the timers, and
156 * kill the timer latch on VIA1.
159 via1[vIER] = 0x7F;
160 via1[vIFR] = 0x7F;
161 via1[vT1LL] = 0;
162 via1[vT1LH] = 0;
163 via1[vT1CL] = 0;
164 via1[vT1CH] = 0;
165 via1[vT2CL] = 0;
166 via1[vT2CH] = 0;
167 via1[vACR] &= 0x3F;
170 * SE/30: disable video IRQ
171 * XXX: testing for SE/30 VBL
174 if (macintosh_config->ident == MAC_MODEL_SE30) {
175 via1[vDirB] |= 0x40;
176 via1[vBufB] |= 0x40;
180 * Set the RTC bits to a known state: all lines to outputs and
181 * RTC disabled (yes that's 0 to enable and 1 to disable).
184 via1[vDirB] |= (VIA1B_vRTCEnb | VIA1B_vRTCClk | VIA1B_vRTCData);
185 via1[vBufB] |= (VIA1B_vRTCEnb | VIA1B_vRTCClk);
187 /* Everything below this point is VIA2/RBV only... */
189 if (oss_present) return;
191 #if 1
192 /* Some machines support an alternate IRQ mapping that spreads */
193 /* Ethernet and Sound out to their own autolevel IRQs and moves */
194 /* VIA1 to level 6. A/UX uses this mapping and we do too. Note */
195 /* that the IIfx emulates this alternate mapping using the OSS. */
197 switch(macintosh_config->ident) {
198 case MAC_MODEL_C610:
199 case MAC_MODEL_Q610:
200 case MAC_MODEL_C650:
201 case MAC_MODEL_Q650:
202 case MAC_MODEL_Q700:
203 case MAC_MODEL_Q800:
204 case MAC_MODEL_Q900:
205 case MAC_MODEL_Q950:
206 via_alt_mapping = 1;
207 via1[vDirB] |= 0x40;
208 via1[vBufB] &= ~0x40;
209 break;
210 default:
211 via_alt_mapping = 0;
212 break;
214 #else
215 /* The alernate IRQ mapping seems to just not work. Anyone with a */
216 /* supported machine is welcome to take a stab at fixing it. It */
217 /* _should_ work on the following Quadras: 610,650,700,800,900,950 */
218 /* - 1999-06-12 (jmt) */
220 via_alt_mapping = 0;
221 #endif
224 * Now initialize VIA2. For RBV we just kill all interrupts;
225 * for a regular VIA we also reset the timers and stuff.
228 via2[gIER] = 0x7F;
229 via2[gIFR] = 0x7F | rbv_clear;
230 if (!rbv_present) {
231 via2[vT1LL] = 0;
232 via2[vT1LH] = 0;
233 via2[vT1CL] = 0;
234 via2[vT1CH] = 0;
235 via2[vT2CL] = 0;
236 via2[vT2CH] = 0;
237 via2[vACR] &= 0x3F;
242 * Start the 100 Hz clock
245 void __init via_init_clock(void (*func)(int, void *, struct pt_regs *))
247 via1[vACR] |= 0x40;
248 via1[vT1LL] = MAC_CLOCK_LOW;
249 via1[vT1LH] = MAC_CLOCK_HIGH;
250 via1[vT1CL] = MAC_CLOCK_LOW;
251 via1[vT1CH] = MAC_CLOCK_HIGH;
253 request_irq(IRQ_MAC_TIMER_1, func, IRQ_FLG_LOCK, "timer", func);
257 * Register the interrupt dispatchers for VIA or RBV machines only.
260 void __init via_register_interrupts(void)
262 if (via_alt_mapping) {
263 request_irq(IRQ_AUTO_1, via1_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
264 "Software IRQ", (void *) via1);
265 request_irq(IRQ_AUTO_6, via1_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
266 "VIA1 Dispatch", (void *) via1);
267 } else {
268 request_irq(IRQ_AUTO_1, via1_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
269 "VIA1 Dispatch", (void *) via1);
270 #if 0 /* interferes with serial on some machines */
271 if (!psc_present) {
272 request_irq(IRQ_AUTO_6, mac_bang, IRQ_FLG_LOCK,
273 "Off Switch", mac_bang);
275 #endif
277 request_irq(IRQ_AUTO_2, via2_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
278 "VIA2 Dispatch", (void *) via2);
279 if (!psc_present) {
280 request_irq(IRQ_AUTO_4, mac_SCC_handler, IRQ_FLG_LOCK,
281 "SCC Dispatch", mac_SCC_handler);
283 request_irq(IRQ_MAC_NUBUS, via_nubus_irq, IRQ_FLG_LOCK|IRQ_FLG_FAST,
284 "Nubus Dispatch", (void *) via2);
288 * Debugging dump, used in various places to see what's going on.
291 void via_debug_dump(void)
293 printk("VIA1: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
294 (uint) via1[vDirA], (uint) via1[vDirB], (uint) via1[vACR]);
295 printk(" PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
296 (uint) via1[vPCR], (uint) via1[vIFR], (uint) via1[vIER]);
297 if (oss_present) {
298 printk("VIA2: <OSS>\n");
299 } else if (rbv_present) {
300 printk("VIA2: IFR = 0x%02X IER = 0x%02X\n",
301 (uint) via2[rIFR], (uint) via2[rIER]);
302 printk(" SIFR = 0x%02X SIER = 0x%02X\n",
303 (uint) via2[rSIFR], (uint) via2[rSIER]);
304 } else {
305 printk("VIA2: DDRA = 0x%02X DDRB = 0x%02X ACR = 0x%02X\n",
306 (uint) via2[vDirA], (uint) via2[vDirB],
307 (uint) via2[vACR]);
308 printk(" PCR = 0x%02X IFR = 0x%02X IER = 0x%02X\n",
309 (uint) via2[vPCR],
310 (uint) via2[vIFR], (uint) via2[vIER]);
315 * This is always executed with interrupts disabled.
317 * TBI: get time offset between scheduling timer ticks
320 unsigned long mac_gettimeoffset (void)
322 unsigned long ticks, offset = 0;
324 /* read VIA1 timer 2 current value */
325 ticks = via1[vT1CL] | (via1[vT1CH] << 8);
326 /* The probability of underflow is less than 2% */
327 if (ticks > MAC_CLOCK_TICK - MAC_CLOCK_TICK / 50)
328 /* Check for pending timer interrupt in VIA1 IFR */
329 if (via1[vIFR] & 0x40) offset = TICK_SIZE;
331 ticks = MAC_CLOCK_TICK - ticks;
332 ticks = ticks * 10000L / MAC_CLOCK_TICK;
334 return ticks + offset;
338 * Flush the L2 cache on Macs that have it by flipping
339 * the system into 24-bit mode for an instant.
342 void via_flush_cache(void)
344 via2[gBufB] &= ~VIA2B_vMode32;
345 via2[gBufB] |= VIA2B_vMode32;
349 * Return the status of the L2 cache on a IIci
352 int via_get_cache_disable(void)
354 /* Safeguard against being called accidentally */
355 if (!via2) {
356 printk(KERN_ERR "via_get_cache_disable called on a non-VIA machine!\n");
357 return 1;
360 return (int) via2[gBufB] & VIA2B_vCDis;
364 * VIA-based power switch, for machines that support it.
367 void via_poweroff(void)
369 if (rbv_present) {
370 via2[rBufB] &= ~0x04;
371 } else {
372 /* Direction of vDirB is output */
373 via2[vDirB] |= 0x04;
374 /* Send a value of 0 on that line */
375 via2[vBufB] &= ~0x04;
376 /* Otherwise it prints "It is now.." then shuts off */
377 mdelay(1000);
380 /* We should never make it this far... */
381 printk ("It is now safe to switch off your machine.\n");
382 while(1);
386 * Initialize VIA2 for Nubus access
389 void __init via_nubus_init(void)
391 nubus_active = 0;
393 /* unlock nubus transactions */
395 if (!rbv_present) {
396 /* set the line to be an output on non-RBV machines */
397 via2[vDirB] |= 0x02;
399 via2[gBufB] |= 0x02;
401 /* disable nubus slot interrupts. */
402 if (rbv_present) {
403 via2[rSIER] = 0x7F; /* like VIA; bit 7=clr,set */
404 } else {
405 via2[vBufA] = 0xFF; /* active low irqs, force high */
406 via2[vDirA] = 0xFF; /* ddr to output. */
411 * The generic VIA interrupt routines (shamelessly stolen from Alan Cox's
412 * via6522.c :-), disable/pending masks added.
414 * The new interrupt architecture in macints.c takes care of a lot of the
415 * gruntwork for us, including tallying the interrupts and calling the
416 * handlers on the linked list. All we need to do here is basically generate
417 * the machspec interrupt number after clearing the interrupt.
420 void via1_irq(int irq, void *dev_id, struct pt_regs *regs)
422 int irq_bit, i;
423 unsigned char events, mask;
425 irq -= VEC_SPUR;
427 mask = via1[vIER] & 0x7F;
428 if (!(events = via1[vIFR] & mask)) return;
430 for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1)
431 if (events & irq_bit) {
432 via1[vIER] = irq_bit;
433 mac_do_irq_list(VIA1_SOURCE_BASE + i, regs);
434 via1[vIFR] = irq_bit;
435 via1[vIER] = irq_bit | 0x80;
438 if (!oss_present) {
439 /* This (still) seems to be necessary to get IDE
440 working. However, if you enable VBL interrupts,
441 you're screwed... */
442 /* FIXME: should we check the SLOTIRQ bit before
443 pulling this stunt? */
444 /* No, it won't be set. that's why we're doing this. */
445 via_irq_disable(IRQ_MAC_NUBUS);
446 via_irq_clear(IRQ_MAC_NUBUS);
447 mac_do_irq_list(IRQ_MAC_NUBUS, regs);
448 via_irq_enable(IRQ_MAC_NUBUS);
452 void via2_irq(int irq, void *dev_id, struct pt_regs *regs)
454 int irq_bit, i;
455 unsigned char events, mask;
457 irq -= VEC_SPUR;
459 mask = via2[gIER] & 0x7F;
460 if (!(events = via2[gIFR] & mask)) return;
462 for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1)
463 if (events & irq_bit) {
464 via2[gIER] = irq_bit;
465 mac_do_irq_list(VIA2_SOURCE_BASE + i, regs);
466 via2[gIFR] = irq_bit | rbv_clear;
467 via2[gIER] = irq_bit | 0x80;
472 * Dispatch Nubus interrupts. We are called as a secondary dispatch by the
473 * VIA2 dispatcher as a fast interrupt handler.
476 void via_nubus_irq(int irq, void *dev_id, struct pt_regs *regs)
478 int irq_bit, i;
479 unsigned char events;
481 if (!(events = ~via2[gBufA] & nubus_active)) return;
483 for (i = 0, irq_bit = 1 ; i < 7 ; i++, irq_bit <<= 1) {
484 if (events & irq_bit) {
485 via_irq_disable(NUBUS_SOURCE_BASE + i);
486 mac_do_irq_list(NUBUS_SOURCE_BASE + i, regs);
487 via_irq_enable(NUBUS_SOURCE_BASE + i);
492 void via_irq_enable(int irq) {
493 int irq_src = IRQ_SRC(irq);
494 int irq_idx = IRQ_IDX(irq);
495 int irq_bit = 1 << irq_idx;
497 #ifdef DEBUG_IRQUSE
498 printk("via_irq_enable(%d)\n", irq);
499 #endif
501 if (irq_src == 1) {
502 via1[vIER] = irq_bit | 0x80;
503 } else if (irq_src == 2) {
505 * Set vPCR for SCSI interrupts (but not on RBV)
507 if ((irq_idx == 0) && !rbv_present) {
508 if (macintosh_config->scsi_type == MAC_SCSI_OLD) {
509 /* CB2 (IRQ) indep. input, positive edge */
510 /* CA2 (DRQ) indep. input, positive edge */
511 via2[vPCR] = 0x66;
512 } else {
513 /* CB2 (IRQ) indep. input, negative edge */
514 /* CA2 (DRQ) indep. input, negative edge */
515 via2[vPCR] = 0x22;
518 via2[gIER] = irq_bit | 0x80;
519 } else if (irq_src == 7) {
520 if (rbv_present) {
521 /* enable the slot interrupt. SIER works like IER. */
522 via2[rSIER] = IER_SET_BIT(irq_idx);
523 } else {
524 /* Make sure the bit is an input, to enable the irq */
525 via2[vDirA] &= ~irq_bit;
527 nubus_active |= irq_bit;
531 void via_irq_disable(int irq) {
532 int irq_src = IRQ_SRC(irq);
533 int irq_idx = IRQ_IDX(irq);
534 int irq_bit = 1 << irq_idx;
536 #ifdef DEBUG_IRQUSE
537 printk("via_irq_disable(%d)\n", irq);
538 #endif
540 if (irq_src == 1) {
541 via1[vIER] = irq_bit;
542 } else if (irq_src == 2) {
543 via2[gIER] = irq_bit;
544 } else if (irq_src == 7) {
545 if (rbv_present) {
546 /* disable the slot interrupt. SIER works like IER. */
547 via2[rSIER] = IER_CLR_BIT(irq_idx);
548 } else {
549 /* disable the nubus irq by changing dir to output */
550 via2[vDirA] |= irq_bit;
552 nubus_active &= ~irq_bit;
556 void via_irq_clear(int irq) {
557 int irq_src = IRQ_SRC(irq);
558 int irq_idx = IRQ_IDX(irq);
559 int irq_bit = 1 << irq_idx;
561 if (irq_src == 1) {
562 via1[vIFR] = irq_bit;
563 } else if (irq_src == 2) {
564 via2[gIFR] = irq_bit | rbv_clear;
565 } else if (irq_src == 7) {
566 /* FIXME: hmm.. */
571 * Returns nonzero if an interrupt is pending on the given
572 * VIA/IRQ combination.
575 int via_irq_pending(int irq)
577 int irq_src = IRQ_SRC(irq);
578 int irq_idx = IRQ_IDX(irq);
579 int irq_bit = 1 << irq_idx;
581 if (irq_src == 1) {
582 return via1[vIFR] & irq_bit;
583 } else if (irq_src == 2) {
584 return via2[gIFR] & irq_bit;
585 } else if (irq_src == 7) {
586 return ~via2[gBufA] & irq_bit;
588 return 0;
591 void via_scsi_clear(void)
593 volatile unsigned char deep_magic;
595 #ifdef DEBUG_IRQUSE
596 printk("via_scsi_clear()\n");
597 #endif
599 /* We handle this in oss.c , but this gets called in mac_scsinew.c */
600 if(oss_present) return;
602 if (rbv_present) {
603 via2[rIFR] = (1<<3) | (1<<0) | rbv_clear;
604 deep_magic = via2[rBufB];
605 } else {
606 deep_magic = via2[vBufB];
608 mac_enable_irq(IRQ_MAC_SCSI);
612 * PRAM/RTC access routines
614 * Must be called with interrupts disabled and
615 * the RTC should be enabled.
618 static __u8 via_pram_readbyte(void)
620 int i,reg;
621 __u8 data;
623 reg = via1[vBufB] & ~VIA1B_vRTCClk;
625 /* Set the RTC data line to be an input. */
627 via1[vDirB] &= ~VIA1B_vRTCData;
629 /* The bits of the byte come out in MSB order */
631 data = 0;
632 for (i = 0 ; i < 8 ; i++) {
633 via1[vBufB] = reg;
634 via1[vBufB] = reg | VIA1B_vRTCClk;
635 data = (data << 1) | (via1[vBufB] & VIA1B_vRTCData);
638 /* Return RTC data line to output state */
640 via1[vDirB] |= VIA1B_vRTCData;
642 return data;
645 static void via_pram_writebyte(__u8 data)
647 int i,reg,bit;
649 reg = via1[vBufB] & ~(VIA1B_vRTCClk | VIA1B_vRTCData);
651 /* The bits of the byte go in in MSB order */
653 for (i = 0 ; i < 8 ; i++) {
654 bit = data & 0x80? 1 : 0;
655 data <<= 1;
656 via1[vBufB] = reg | bit;
657 via1[vBufB] = reg | bit | VIA1B_vRTCClk;
662 * Execute a PRAM/RTC command. For read commands
663 * data should point to a one-byte buffer for the
664 * resulting data. For write commands it should point
665 * to the data byte to for the command.
667 * This function disables all interrupts while running.
670 void via_pram_command(int command, __u8 *data)
672 unsigned long cpu_flags;
673 int is_read;
675 save_flags(cpu_flags);
676 cli();
678 /* Enable the RTC and make sure the strobe line is high */
680 via1[vBufB] = (via1[vBufB] | VIA1B_vRTCClk) & ~VIA1B_vRTCEnb;
682 if (command & 0xFF00) { /* extended (two-byte) command */
683 via_pram_writebyte((command & 0xFF00) >> 8);
684 via_pram_writebyte(command & 0xFF);
685 is_read = command & 0x8000;
686 } else { /* one-byte command */
687 via_pram_writebyte(command);
688 is_read = command & 0x80;
690 if (is_read) {
691 *data = via_pram_readbyte();
692 } else {
693 via_pram_writebyte(*data);
696 /* All done, disable the RTC */
698 via1[vBufB] |= VIA1B_vRTCEnb;
700 restore_flags(cpu_flags);
704 * Return the current time in seconds since January 1, 1904.
706 * This only works on machines with the VIA-based PRAM/RTC, which
707 * is basically any machine with Mac II-style ADB.
710 __u32 via_read_time(void)
712 union {
713 __u8 cdata[4];
714 __u32 idata;
715 } result, last_result;
716 int ct;
719 * The NetBSD guys say to loop until you get the same reading
720 * twice in a row.
723 ct = 0;
724 do {
725 if (++ct > 10) {
726 printk("via_read_time: couldn't get valid time, "
727 "last read = 0x%08X and 0x%08X\n", last_result.idata,
728 result.idata);
729 break;
732 last_result.idata = result.idata;
733 result.idata = 0;
735 via_pram_command(0x81, &result.cdata[3]);
736 via_pram_command(0x85, &result.cdata[2]);
737 via_pram_command(0x89, &result.cdata[1]);
738 via_pram_command(0x8D, &result.cdata[0]);
739 } while (result.idata != last_result.idata);
741 return result.idata;
745 * Set the current time to a number of seconds since January 1, 1904.
747 * This only works on machines with the VIA-based PRAM/RTC, which
748 * is basically any machine with Mac II-style ADB.
751 void via_write_time(__u32 time)
753 union {
754 __u8 cdata[4];
755 __u32 idata;
756 } data;
757 __u8 temp;
759 /* Clear the write protect bit */
761 temp = 0x55;
762 via_pram_command(0x35, &temp);
764 data.idata = time;
765 via_pram_command(0x01, &data.cdata[3]);
766 via_pram_command(0x05, &data.cdata[2]);
767 via_pram_command(0x09, &data.cdata[1]);
768 via_pram_command(0x0D, &data.cdata[0]);
770 /* Set the write protect bit */
772 temp = 0xD5;
773 via_pram_command(0x35, &temp);