genericbd.c revision 1.1.22.2 1 1.1.22.2 rpaulo /* $NetBSD: genericbd.c,v 1.1.22.2 2006/09/09 02:38:55 rpaulo Exp $ */
2 1.1.22.2 rpaulo
3 1.1.22.2 rpaulo /*-
4 1.1.22.2 rpaulo * Copyright (c) 2006 Itronix Inc.
5 1.1.22.2 rpaulo * All rights reserved.
6 1.1.22.2 rpaulo *
7 1.1.22.2 rpaulo * Written by Garrett D'Amore for Itronix Inc.
8 1.1.22.2 rpaulo *
9 1.1.22.2 rpaulo * Redistribution and use in source and binary forms, with or without
10 1.1.22.2 rpaulo * modification, are permitted provided that the following conditions
11 1.1.22.2 rpaulo * are met:
12 1.1.22.2 rpaulo * 1. Redistributions of source code must retain the above copyright
13 1.1.22.2 rpaulo * notice, this list of conditions and the following disclaimer.
14 1.1.22.2 rpaulo * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.22.2 rpaulo * notice, this list of conditions and the following disclaimer in the
16 1.1.22.2 rpaulo * documentation and/or other materials provided with the distribution.
17 1.1.22.2 rpaulo * 3. The name of Itronix Inc. may not be used to endorse
18 1.1.22.2 rpaulo * or promote products derived from this software without specific
19 1.1.22.2 rpaulo * prior written permission.
20 1.1.22.2 rpaulo *
21 1.1.22.2 rpaulo * THIS SOFTWARE IS PROVIDED BY ITRONIX INC. ``AS IS'' AND
22 1.1.22.2 rpaulo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 1.1.22.2 rpaulo * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 1.1.22.2 rpaulo * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ITRONIX INC. BE LIABLE FOR ANY
25 1.1.22.2 rpaulo * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 1.1.22.2 rpaulo * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 1.1.22.2 rpaulo * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 1.1.22.2 rpaulo * ON ANY THEORY OF LIABILITY, WHETHER IN
29 1.1.22.2 rpaulo * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 1.1.22.2 rpaulo * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 1.1.22.2 rpaulo * POSSIBILITY OF SUCH DAMAGE.
32 1.1.22.2 rpaulo */
33 1.1.22.2 rpaulo
34 1.1.22.2 rpaulo #include <sys/cdefs.h>
35 1.1.22.2 rpaulo __KERNEL_RCSID(0, "$NetBSD: genericbd.c,v 1.1.22.2 2006/09/09 02:38:55 rpaulo Exp $");
36 1.1.22.2 rpaulo
37 1.1.22.2 rpaulo #include <sys/param.h>
38 1.1.22.2 rpaulo #include <machine/bus.h>
39 1.1.22.2 rpaulo #include <machine/locore.h>
40 1.1.22.2 rpaulo #include <evbmips/alchemy/obiovar.h>
41 1.1.22.2 rpaulo #include <evbmips/alchemy/board.h>
42 1.1.22.2 rpaulo
43 1.1.22.2 rpaulo static void genericbd_init(void);
44 1.1.22.2 rpaulo
45 1.1.22.2 rpaulo /*
46 1.1.22.2 rpaulo * Generically, we have no OBIO devices.
47 1.1.22.2 rpaulo */
48 1.1.22.2 rpaulo static const struct obiodev genericbd_devices[] = {
49 1.1.22.2 rpaulo { NULL },
50 1.1.22.2 rpaulo };
51 1.1.22.2 rpaulo
52 1.1.22.2 rpaulo static struct alchemy_board genericbd_info = {
53 1.1.22.2 rpaulo NULL,
54 1.1.22.2 rpaulo genericbd_devices,
55 1.1.22.2 rpaulo genericbd_init,
56 1.1.22.2 rpaulo NULL, /* no PCI */
57 1.1.22.2 rpaulo };
58 1.1.22.2 rpaulo
59 1.1.22.2 rpaulo /*
60 1.1.22.2 rpaulo * XXX: A cleaner way would be to get this from the cpu table in the MIPS
61 1.1.22.2 rpaulo * CPU handler code (or even better, have *that* code fill in cpu_model.)
62 1.1.22.2 rpaulo */
63 1.1.22.2 rpaulo static struct {
64 1.1.22.2 rpaulo int id;
65 1.1.22.2 rpaulo const char *name;
66 1.1.22.2 rpaulo } cpus[] = {
67 1.1.22.2 rpaulo { MIPS_AU1000, "Generic Alchemy Au1000" },
68 1.1.22.2 rpaulo { MIPS_AU1100, "Generic Alchemy Au1100" },
69 1.1.22.2 rpaulo { MIPS_AU1500, "Generic Alchemy Au1500" },
70 1.1.22.2 rpaulo { MIPS_AU1550, "Generic Alchemy Au1550" },
71 1.1.22.2 rpaulo { 0, NULL },
72 1.1.22.2 rpaulo };
73 1.1.22.2 rpaulo
74 1.1.22.2 rpaulo const struct alchemy_board *
75 1.1.22.2 rpaulo board_info(void)
76 1.1.22.2 rpaulo {
77 1.1.22.2 rpaulo /* at least try to report the correct processor name */
78 1.1.22.2 rpaulo if (genericbd_info.ab_name == NULL) {
79 1.1.22.2 rpaulo int i;
80 1.1.22.2 rpaulo for (i = 0; cpus[i].name; i++) {
81 1.1.22.2 rpaulo if (cpus[i].id == MIPS_PRID_COPTS(cpu_id)) {
82 1.1.22.2 rpaulo genericbd_info.ab_name = cpus[i].name;
83 1.1.22.2 rpaulo break;
84 1.1.22.2 rpaulo }
85 1.1.22.2 rpaulo }
86 1.1.22.2 rpaulo if (genericbd_info.ab_name == NULL)
87 1.1.22.2 rpaulo genericbd_info.ab_name = "Unknown Alchemy";
88 1.1.22.2 rpaulo }
89 1.1.22.2 rpaulo
90 1.1.22.2 rpaulo return &genericbd_info;
91 1.1.22.2 rpaulo }
92 1.1.22.2 rpaulo
93 1.1.22.2 rpaulo void
94 1.1.22.2 rpaulo genericbd_init(void)
95 1.1.22.2 rpaulo {
96 1.1.22.2 rpaulo
97 1.1.22.2 rpaulo /* leave console and clocks alone -- YAMON should have got it right! */
98 1.1.22.2 rpaulo }
99