/*-1* Copyright (c) 2000 Michael Smith2* Copyright (c) 2000 BSDi3* All rights reserved.4*5* Redistribution and use in source and binary forms, with or without6* modification, are permitted provided that the following conditions7* are met:8* 1. Redistributions of source code must retain the above copyright9* notice, this list of conditions and the following disclaimer.10* 2. Redistributions in binary form must reproduce the above copyright11* notice, this list of conditions and the following disclaimer in the12* documentation and/or other materials provided with the distribution.13*14* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND15* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE16* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE17* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE18* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL19* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS20* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)21* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT22* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY23* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF24* SUCH DAMAGE.25*/2627/*28* 6.8 : Debugging support29*/3031#include <sys/cdefs.h>32#include "opt_ddb.h"33#include <sys/param.h>34#include <sys/kdb.h>35#include <sys/kernel.h>36#include <sys/bus.h>37#include <machine/bus.h>38#include <ddb/ddb.h>39#include <ddb/db_output.h>4041#include <contrib/dev/acpica/include/acpi.h>42#include <contrib/dev/acpica/include/accommon.h>43#include <contrib/dev/acpica/include/acdebug.h>4445#include <dev/acpica/acpivar.h>4647ACPI_STATUS48AcpiOsGetLine(char *Buffer, UINT32 BufferLength, UINT32 *BytesRead)49{50#ifdef DDB51char *cp;5253cp = Buffer;54if (db_readline(Buffer, BufferLength) > 0)55while (*cp != '\0' && *cp != '\n' && *cp != '\r')56cp++;57*cp = '\0';58if (BytesRead != NULL)59*BytesRead = cp - Buffer;60return (AE_OK);61#else62printf("AcpiOsGetLine called but no input support");63return (AE_NOT_EXIST);64#endif /* DDB */65}6667ACPI_STATUS68AcpiOsSignal(UINT32 Function, void *Info)69{70ACPI_SIGNAL_FATAL_INFO *fatal;7172switch (Function) {73case ACPI_SIGNAL_FATAL:74fatal = (ACPI_SIGNAL_FATAL_INFO *)Info;75printf("ACPI fatal signal, type 0x%x code 0x%x argument 0x%x",76fatal->Type, fatal->Code, fatal->Argument);77#ifdef ACPI_DEBUG78kdb_enter(KDB_WHY_ACPI, "AcpiOsSignal");79#endif80break;8182case ACPI_SIGNAL_BREAKPOINT:83#ifdef ACPI_DEBUG84kdb_enter(KDB_WHY_ACPI, (char *)Info);85#endif86break;8788default:89return (AE_BAD_PARAMETER);90}9192return (AE_OK);93}9495#ifdef ACPI_DEBUGGER96void97acpi_EnterDebugger(void)98{99static int initted = 0;100101if (!initted) {102printf("Initialising ACPICA debugger...\n");103AcpiInitializeDebugger();104initted = 1;105}106107printf("Entering ACPICA debugger...\n");108AcpiDbUserCommands();109}110#endif /* ACPI_DEBUGGER */111112113