1294740Szbb/*-
2294740Szbb * Copyright (c) 2014 The FreeBSD Foundation
3294740Szbb * All rights reserved.
4294740Szbb *
5294740Szbb * This software was developed by Semihalf under
6294740Szbb * the sponsorship of the FreeBSD Foundation.
7294740Szbb *
8294740Szbb * Redistribution and use in source and binary forms, with or without
9294740Szbb * modification, are permitted provided that the following conditions
10294740Szbb * are met:
11294740Szbb * 1. Redistributions of source code must retain the above copyright
12294740Szbb *    notice, this list of conditions and the following disclaimer.
13294740Szbb * 2. Redistributions in binary form must reproduce the above copyright
14294740Szbb *    notice, this list of conditions and the following disclaimer in the
15294740Szbb *    documentation and/or other materials provided with the distribution.
16294740Szbb *
17294740Szbb * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18294740Szbb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19294740Szbb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20294740Szbb * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21294740Szbb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22294740Szbb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23294740Szbb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24294740Szbb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25294740Szbb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26294740Szbb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27294740Szbb * SUCH DAMAGE.
28294740Szbb *
29294740Szbb * $FreeBSD$
30294740Szbb */
31294740Szbb
32294740Szbb#ifndef _MACHINE_DEBUG_MONITOR_H_
33294740Szbb#define	_MACHINE_DEBUG_MONITOR_H_
34294740Szbb
35294740Szbb#ifdef DDB
36294740Szbb
37294740Szbb#include <machine/db_machdep.h>
38294740Szbb
39294740Szbbenum dbg_access_t {
40294740Szbb	HW_BREAKPOINT_X		= 0,
41294740Szbb	HW_WATCHPOINT_R		= 1,
42294740Szbb	HW_WATCHPOINT_W		= 2,
43294740Szbb	HW_WATCHPOINT_RW	= HW_WATCHPOINT_R | HW_WATCHPOINT_W,
44294740Szbb};
45294740Szbb
46294740Szbb#if __ARM_ARCH >= 6
47294740Szbbvoid dbg_monitor_init(void);
48300969Szbbvoid dbg_monitor_init_secondary(void);
49294740Szbbvoid dbg_show_watchpoint(void);
50294740Szbbint dbg_setup_watchpoint(db_expr_t, db_expr_t, enum dbg_access_t);
51294740Szbbint dbg_remove_watchpoint(db_expr_t, db_expr_t);
52294987Szbbvoid dbg_resume_dbreg(void);
53294740Szbb#else /* __ARM_ARCH >= 6 */
54294740Szbbstatic __inline void
55294740Szbbdbg_show_watchpoint(void)
56294740Szbb{
57294740Szbb}
58294740Szbbstatic __inline int
59294740Szbbdbg_setup_watchpoint(db_expr_t addr __unused, db_expr_t size __unused,
60294740Szbb    enum dbg_access_t access __unused)
61294740Szbb{
62294740Szbb	return (ENXIO);
63294740Szbb}
64294740Szbbstatic __inline int
65294740Szbbdbg_remove_watchpoint(db_expr_t addr __unused, db_expr_t size __unused)
66294740Szbb{
67294740Szbb	return (ENXIO);
68294740Szbb}
69294740Szbbstatic __inline void
70294740Szbbdbg_monitor_init(void)
71294740Szbb{
72294740Szbb}
73294987Szbbstatic __inline void
74300969Szbbdbg_monitor_init_secondary(void)
75300969Szbb{
76300969Szbb}
77300969Szbbstatic __inline void
78294987Szbbdbg_resume_dbreg(void)
79294987Szbb{
80294987Szbb}
81294740Szbb#endif /* __ARM_ARCH < 6 */
82294740Szbb
83294740Szbb#else /* DDB */
84294740Szbbstatic __inline void
85294740Szbbdbg_monitor_init(void)
86294740Szbb{
87294740Szbb}
88294740Szbb#endif
89294740Szbb
90294740Szbb#endif /* _MACHINE_DEBUG_MONITOR_H_ */
91