1178173Simp/*-
2178173Simp * Copyright 2002 Wasabi Systems, Inc.
3178173Simp * All rights reserved.
4178173Simp *
5178173Simp * Written by Simon Burge for Wasabi Systems, Inc.
6178173Simp *
7178173Simp * Redistribution and use in source and binary forms, with or without
8178173Simp * modification, are permitted provided that the following conditions
9178173Simp * are met:
10178173Simp * 1. Redistributions of source code must retain the above copyright
11178173Simp *    notice, this list of conditions and the following disclaimer.
12178173Simp * 2. Redistributions in binary form must reproduce the above copyright
13178173Simp *    notice, this list of conditions and the following disclaimer in the
14178173Simp *    documentation and/or other materials provided with the distribution.
15178173Simp * 3. All advertising materials mentioning features or use of this software
16178173Simp *    must display the following acknowledgement:
17178173Simp *      This product includes software developed for the NetBSD Project by
18178173Simp *      Wasabi Systems, Inc.
19178173Simp * 4. The name of Wasabi Systems, Inc. may not be used to endorse
20178173Simp *    or promote products derived from this software without specific prior
21178173Simp *    written permission.
22178173Simp *
23178173Simp * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
24178173Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25178173Simp * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26178173Simp * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
27178173Simp * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28178173Simp * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29178173Simp * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30178173Simp * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31178173Simp * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32178173Simp * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33178173Simp * POSSIBILITY OF SUCH DAMAGE.
34178173Simp *
35178173Simp * $FreeBSD: releng/10.3/sys/mips/malta/yamon.h 202175 2010-01-12 21:36:08Z imp $
36178173Simp */
37178173Simp
38178173Simp#ifndef _MALTA_YAMON_H_
39178173Simp#define _MALTA_YAMON_H_
40178173Simp
41202035Simp#define YAMON_FUNCTION_BASE	0x1fc00500ul
42178173Simp
43178173Simp#define YAMON_PRINT_COUNT_OFS	(YAMON_FUNCTION_BASE + 0x04)
44178173Simp#define YAMON_EXIT_OFS		(YAMON_FUNCTION_BASE + 0x20)
45178173Simp#define YAMON_FLUSH_CACHE_OFS	(YAMON_FUNCTION_BASE + 0x2c)
46178173Simp#define YAMON_PRINT_OFS		(YAMON_FUNCTION_BASE + 0x34)
47178173Simp#define YAMON_REG_CPU_ISR_OFS	(YAMON_FUNCTION_BASE + 0x38)
48178173Simp#define YAMON_DEREG_CPU_ISR_OFS	(YAMON_FUNCTION_BASE + 0x3c)
49178173Simp#define YAMON_REG_IC_ISR_OFS	(YAMON_FUNCTION_BASE + 0x40)
50178173Simp#define YAMON_DEREG_IC_ISR_OFS	(YAMON_FUNCTION_BASE + 0x44)
51178173Simp#define YAMON_REG_ESR_OFS	(YAMON_FUNCTION_BASE + 0x48)
52178173Simp#define YAMON_DEREG_ESR_OFS	(YAMON_FUNCTION_BASE + 0x4c)
53178173Simp#define YAMON_GETCHAR_OFS	(YAMON_FUNCTION_BASE + 0x50)
54178173Simp#define YAMON_SYSCON_READ_OFS	(YAMON_FUNCTION_BASE + 0x54)
55178173Simp
56202035Simp#define YAMON_FUNC(ofs)		((long)(*(int32_t *)(MIPS_PHYS_TO_KSEG0(ofs))))
57178173Simp
58178173Simptypedef void (*t_yamon_print_count)(uint32_t port, char *s, uint32_t count);
59178173Simp#define YAMON_PRINT_COUNT(s, count) \
60178173Simp	((t_yamon_print_count)(YAMON_FUNC(YAMON_PRINT_COUNT_OFS)))(0, s, count)
61178173Simp
62178173Simptypedef void (*t_yamon_exit)(uint32_t rc);
63178173Simp#define YAMON_EXIT(rc) ((t_yamon_exit)(YAMON_FUNC(YAMON_EXIT_OFS)))(rc)
64178173Simp
65178173Simptypedef void (*t_yamon_print)(uint32_t port, const char *s);
66178173Simp#define YAMON_PRINT(s) ((t_yamon_print)(YAMON_FUNC(YAMON_PRINT_OFS)))(0, s)
67178173Simp
68178173Simptypedef int (*t_yamon_getchar)(uint32_t port, char *ch);
69178173Simp#define YAMON_GETCHAR(ch) \
70178173Simp	((t_yamon_getchar)(YAMON_FUNC(YAMON_GETCHAR_OFS)))(0, ch)
71178173Simp
72178173Simptypedef int t_yamon_syscon_id;
73178173Simptypedef int (*t_yamon_syscon_read)(t_yamon_syscon_id id, void *param,
74178173Simp				   uint32_t size);
75178173Simp#define YAMON_SYSCON_READ(id, param, size)				\
76178173Simp	((t_yamon_syscon_read)(YAMON_FUNC(YAMON_SYSCON_READ_OFS)))	\
77178173Simp	(id, param, size)
78178173Simp
79178173Simptypedef struct {
80178173Simp	char *name;
81178173Simp	char *value;
82178173Simp} yamon_env_t;
83178173Simp
84178173Simp#define SYSCON_BOARD_CPU_CLOCK_FREQ_ID	34	/* UINT32 */
85178173Simp#define SYSCON_BOARD_BUS_CLOCK_FREQ_ID	35	/* UINT32 */
86178173Simp#define SYSCON_BOARD_PCI_FREQ_KHZ_ID	36	/* UINT32 */
87178173Simp
88178173Simpchar*		yamon_getenv(char *name);
89178173Simpuint32_t	yamon_getcpufreq(void);
90178173Simp
91178173Simpextern yamon_env_t *fenvp[];
92178173Simp
93178173Simp#endif /* _MALTA_YAMON_H_ */
94