xref: /netbsd-src/sys/arch/mipsco/stand/common/callvec.c (revision df7f595ecd6efe54ea7c11083e2dbf711cad4b31)
1*df7f595eScegger /*	$NetBSD: callvec.c,v 1.6 2009/03/18 10:22:32 cegger Exp $	*/
2a3ec1726Swdk 
3a3ec1726Swdk /*
4a3ec1726Swdk  * Copyright (c) 2000 The NetBSD Foundation, Inc.
5a3ec1726Swdk  * All rights reserved.
6a3ec1726Swdk  *
7a3ec1726Swdk  * This code is derived from software contributed to The NetBSD Foundation
8a3ec1726Swdk  * by Wayne Knowles
9a3ec1726Swdk  *
10a3ec1726Swdk  * Redistribution and use in source and binary forms, with or without
11a3ec1726Swdk  * modification, are permitted provided that the following conditions
12a3ec1726Swdk  * are met:
13a3ec1726Swdk  * 1. Redistributions of source code must retain the above copyright
14a3ec1726Swdk  *    notice, this list of conditions and the following disclaimer.
15a3ec1726Swdk  * 2. Redistributions in binary form must reproduce the above copyright
16a3ec1726Swdk  *    notice, this list of conditions and the following disclaimer in the
17a3ec1726Swdk  *    documentation and/or other materials provided with the distribution.
18a3ec1726Swdk  *
19a3ec1726Swdk  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20a3ec1726Swdk  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21a3ec1726Swdk  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22a3ec1726Swdk  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23a3ec1726Swdk  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24a3ec1726Swdk  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25a3ec1726Swdk  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26a3ec1726Swdk  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27a3ec1726Swdk  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28a3ec1726Swdk  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29a3ec1726Swdk  * POSSIBILITY OF SUCH DAMAGE.
30a3ec1726Swdk  */
31a3ec1726Swdk 
32a3ec1726Swdk #include <sys/param.h>
33a3ec1726Swdk 
34a3ec1726Swdk #include <machine/cpu.h>
35a3ec1726Swdk #include <machine/prom.h>
36a3ec1726Swdk 
37a3ec1726Swdk static struct mips_prom callvec;
38a3ec1726Swdk 
39a3ec1726Swdk struct mips_prom *callv;
40a3ec1726Swdk 
4102cdf4d2Sdsl typedef void (*funcp_t)(void);
42a3ec1726Swdk 
43a3ec1726Swdk void
prom_init(void)44*df7f595eScegger prom_init(void)
45a3ec1726Swdk {
46a3ec1726Swdk 	int i;
47a3ec1726Swdk 	funcp_t *fp;
48a3ec1726Swdk 
49a3ec1726Swdk 	fp = (void *)&callvec;
50a3ec1726Swdk 	for (i=0; i < sizeof(struct mips_prom)/sizeof(funcp_t); i++ ) {
51a3ec1726Swdk 		fp[i] = (funcp_t)MIPS_PROM_ENTRY(i);
52a3ec1726Swdk 	}
53a3ec1726Swdk 	callv = &callvec;
54a3ec1726Swdk }
55