OsdDebug.c revision 67760
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2000 BSDi
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 AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 *	$FreeBSD: head/sys/dev/acpica/Osd/OsdDebug.c 67760 2000-10-28 06:56:15Z msmith $
28 */
29
30/*
31 * 6.8 : Debugging support
32 */
33
34#include "opt_ddb.h"
35#include <sys/param.h>
36#include <sys/systm.h>
37#include <sys/cons.h>
38#include <sys/kernel.h>
39
40#include <sys/bus.h>
41#include <machine/resource.h>
42#include <machine/bus.h>
43#include <sys/rman.h>
44
45#include <ddb/ddb.h>
46#include <ddb/db_output.h>
47
48#include "acpi.h"
49#include "acdebug.h"
50#include <dev/acpica/acpivar.h>
51
52ACPI_STATUS
53AcpiOsBreakpoint(NATIVE_CHAR *Message)
54{
55    Debugger(Message);
56    return(AE_OK);
57}
58
59UINT32
60AcpiOsGetLine(NATIVE_CHAR *Buffer)
61{
62#ifdef DDB
63    char	*cp;
64
65    db_readline(Buffer, 80);
66    for (cp = Buffer; *cp != 0; cp++)
67	if (*cp == '\n')
68	    *cp = 0;
69    return(AE_OK);
70#else
71    printf("AcpiOsGetLine called but no input support");
72    return(AE_NOT_EXIST);
73#endif
74}
75
76void
77AcpiOsDbgAssert(void *FailedAssertion, void *FileName, UINT32 LineNumber, NATIVE_CHAR *Message)
78{
79    printf("ACPI: %s:%d - %s\n", (char *)FileName, LineNumber, Message);
80    printf("ACPI: assertion  %s\n", (char *)FailedAssertion);
81}
82
83#ifdef ENABLE_DEBUGGER
84void
85acpi_EnterDebugger(void)
86{
87    ACPI_PARSE_OBJECT	obj;
88    static int		initted = 0;
89
90    if (!initted) {
91	printf("Initialising ACPICA debugger...\n");
92	AcpiDbInitialize();
93	initted = 1;
94    }
95
96    printf("Entering ACPICA debugger...\n");
97    AcpiDbUserCommands('A', &obj);
98}
99#endif
100