Hello,

On Thu, 25 May 2000, Ivan Kokshaysky wrote:

> Heh. GAS from binutils-2.9.1 doesn't understand 'palXX' mnemonics.

[ snip ]

> I forgot that hwrpb is checksum protected.

[ snip ]

The fixes you sent worked great for me. Now I have PCA56 MVI set enabled
and real frequency calculated, all in 2.2.15 kernel. Thanks a lot! I'm
attaching the patch for 2.2.15 if somebody cares.

BTW, I have some SX164 systems that are built around EV56 processor. Is
the patch harmless to those? (I don't want to test it since all systems in
question are production machines).

Regards,
  Metod

Metod Kozelj

mailto:[EMAIL PROTECTED]            /\  Ne posiljajte mi smeti ker grizem!
http://www.rzs-hm.si/                   /  \  Don't spam me for I bite!
_______________________________________/    \__________________________________

---- perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'

diff -urN linux-2.2.15-vanilla/arch/alpha/kernel/core_pyxis.c 
linux-2.2.15/arch/alpha/kernel/core_pyxis.c
--- linux-2.2.15-vanilla/arch/alpha/kernel/core_pyxis.c Thu May  4 02:16:30 2000
+++ linux-2.2.15/arch/alpha/kernel/core_pyxis.c Fri May 26 09:31:16 2000
@@ -15,6 +15,7 @@
 
 #include <asm/ptrace.h>
 #include <asm/system.h>
+#include <asm/hwrpb.h>
 #include <asm/pci.h>
 
 #define __EXTERN_INLINE inline
@@ -522,6 +523,24 @@
 void __init
 pyxis_init_arch(unsigned long *mem_start, unsigned long *mem_end)
 {
+       unsigned int cc0, cc1;
+       unsigned long pyxis_cc;
+
+       /* On pyxis machines we can precisely calculate the
+          CPU clock frequency using pyxis real time counter.
+          Especially it's useful for SX164 with broken RTC.
+          Both CPU and chipset are driven by the single 16.666M
+          or 16.667M crystal oscillator. PYXIS_RT_COUNT clock is
+          66.66 MHz. -ink */
+
+       __asm__ __volatile__ ("rpcc %0" : "=r"(cc0));
+       pyxis_cc = *(vulp)PYXIS_RT_COUNT;
+       do { } while(*(vulp)PYXIS_RT_COUNT - pyxis_cc < 4096);
+       __asm__ __volatile__ ("rpcc %0" : "=r"(cc1));
+       cc1 -= cc0;
+       hwrpb->cycle_freq = ((cc1 >> 11) * 100000000UL) / 3;
+       hwrpb_update_checksum(hwrpb);
+
        pyxis_enable_errors();
        if (!pyxis_srm_window_setup())
                pyxis_native_window_setup();
diff -urN linux-2.2.15-vanilla/arch/alpha/kernel/sys_sx164.c 
linux-2.2.15/arch/alpha/kernel/sys_sx164.c
--- linux-2.2.15-vanilla/arch/alpha/kernel/sys_sx164.c  Mon Feb 22 04:06:36 1999
+++ linux-2.2.15/arch/alpha/kernel/sys_sx164.c  Fri May 26 09:33:16 2000
@@ -24,6 +24,7 @@
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/core_pyxis.h>
+#include <asm/hwrpb.h>
 
 #include "proto.h"
 #include "irq.h"
@@ -186,6 +187,35 @@
        SMC669_Init(0);
 }
 
+static void __init
+sx164_init_arch(unsigned long *mem_start, unsigned long *mem_end)
+{
+       /*
+        * OSF palcode v1.23 forgets to enable PCA56 Motion Video
+        * Instructions. Let's enable it.
+        * We have to check palcode revision because CSERVE interface
+        * is subject to change without notice. For example, it
+        * has been changed completely since v1.16 (found in MILO
+        * distribution). -ink
+        */
+       struct percpu_struct *cpu = (struct percpu_struct*)
+                               ((char*)hwrpb + hwrpb->processor_offset);
+
+       if (alpha_using_srm && (cpu->pal_revision & 0xffff) == 0x117) {
+               __asm__ __volatile__(
+               "lda    $16,8($31)\n"
+               "call_pal 9\n"          /* Allow PALRES insns in kernel mode */
+               ".long  0x64000118\n"   /* hw_mfpr $0,icsr */
+               "ldah   $16,(1<<(19-16))($31)\n"
+               "or     $0,$16,$0\n"    /* set MVE bit */
+               ".long  0x74000118\n"   /* hw_mtpr $0,icsr */
+               "lda    $16,9($31)\n"
+               "call_pal 9"            /* Disable PALRES insns */
+               : : : "$0", "$16");
+               printk("PCA56 MVI set enabled\n");
+       }
+       pyxis_init_arch(mem_start, mem_end);
+}
 
 /*
  * The System Vector
@@ -206,7 +236,7 @@
        ack_irq:                generic_ack_irq,
        device_interrupt:       sx164_device_interrupt,
 
-       init_arch:              pyxis_init_arch,
+       init_arch:              sx164_init_arch,
        init_irq:               sx164_init_irq,
        init_pit:               generic_init_pit,
        pci_fixup:              sx164_pci_fixup,

Reply via email to