1 /* $NetBSD: ka610.c,v 1.9 2017/05/22 16:46:15 ragge Exp $ */
2 /*
3 * Copyright (c) 2001 Ludd, University of Lule}, Sweden.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 #include <sys/cdefs.h>
28 __KERNEL_RCSID(0, "$NetBSD: ka610.c,v 1.9 2017/05/22 16:46:15 ragge Exp $");
29
30 #include <sys/param.h>
31 #include <sys/systm.h>
32 #include <sys/cpu.h>
33 #include <sys/device.h>
34 #include <sys/kernel.h>
35
36 #include <machine/nexus.h>
37 #include <machine/clock.h>
38 #include <machine/sid.h>
39
40 static void ka610_attach_cpu(device_t);
41 static void ka610_memerr(void);
42 static int ka610_mchk(void *);
43 static void ka610_halt(void);
44 static void ka610_reboot(int);
45
46 static const char * const ka610_devs[] = { "cpu", "uba", NULL };
47
48 /*
49 * Declaration of KA610-specific calls.
50 */
51 const struct cpu_dep ka610_calls = {
52 .cpu_mchk = ka610_mchk,
53 .cpu_memerr = ka610_memerr,
54 .cpu_gettime = generic_gettime,
55 .cpu_settime = generic_settime,
56 .cpu_vups = 1, /* ~VUPS */
57 .cpu_scbsz = 2, /* SCB pages */
58 .cpu_halt = ka610_halt,
59 .cpu_reboot = ka610_reboot,
60 .cpu_devs = ka610_devs,
61 .cpu_attach_cpu = ka610_attach_cpu,
62 .cpu_flags = CPU_RAISEIPL,
63 };
64
65
66 void
ka610_attach_cpu(device_t self)67 ka610_attach_cpu(device_t self)
68 {
69 aprint_normal(": KA610, HW rev %d, ucode rev %d\n",
70 vax_cpudata & 0xff, (vax_cpudata >> 8) & 0xff);
71 }
72
73 void
ka610_memerr(void)74 ka610_memerr(void)
75 {
76 printf("Memory err!\n");
77 }
78
79 int
ka610_mchk(void * addr)80 ka610_mchk(void *addr)
81 {
82 panic("Machine check");
83 return 0;
84 }
85
86 void
ka610_halt(void)87 ka610_halt(void)
88 {
89 __asm("halt");
90 }
91
92 void
ka610_reboot(int arg)93 ka610_reboot(int arg)
94 {
95 __asm("halt");
96 }
97
98