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 28/* 29 * 6.8 : Debugging support 30 */ 31 32#include <sys/cdefs.h>
| 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 28/* 29 * 6.8 : Debugging support 30 */ 31 32#include <sys/cdefs.h>
|
33__FBSDID("$FreeBSD: head/sys/dev/acpica/Osd/OsdDebug.c 193530 2009-06-05 18:44:36Z jkim $");
| 33__FBSDID("$FreeBSD: head/sys/dev/acpica/Osd/OsdDebug.c 222544 2011-05-31 19:45:58Z jkim $");
|
34 35#include "opt_ddb.h" 36#include <sys/param.h> 37#include <sys/kdb.h> 38#include <sys/kernel.h> 39#include <sys/bus.h> 40#include <machine/bus.h> 41#include <ddb/ddb.h> 42#include <ddb/db_output.h> 43 44#include <contrib/dev/acpica/include/acpi.h> 45#include <contrib/dev/acpica/include/accommon.h> 46#include <contrib/dev/acpica/include/acdebug.h> 47 48#include <dev/acpica/acpivar.h> 49
| 34 35#include "opt_ddb.h" 36#include <sys/param.h> 37#include <sys/kdb.h> 38#include <sys/kernel.h> 39#include <sys/bus.h> 40#include <machine/bus.h> 41#include <ddb/ddb.h> 42#include <ddb/db_output.h> 43 44#include <contrib/dev/acpica/include/acpi.h> 45#include <contrib/dev/acpica/include/accommon.h> 46#include <contrib/dev/acpica/include/acdebug.h> 47 48#include <dev/acpica/acpivar.h> 49
|
50UINT32 51AcpiOsGetLine(char *Buffer)
| 50ACPI_STATUS 51AcpiOsGetLine(char *Buffer, UINT32 BufferLength, UINT32 *BytesRead)
|
52{ 53#ifdef DDB
| 52{ 53#ifdef DDB
|
54 char *cp;
| 54 char *cp;
|
55
| 55
|
56 db_readline(Buffer, 80); 57 for (cp = Buffer; *cp != 0; cp++) 58 if (*cp == '\n') 59 *cp = 0; 60 return (AE_OK);
| 56 cp = Buffer; 57 if (db_readline(Buffer, BufferLength) > 0) 58 while (*cp != '\0' && *cp != '\n' && *cp != '\r') 59 cp++; 60 *cp = '\0'; 61 if (BytesRead != NULL) 62 *BytesRead = cp - Buffer; 63 return (AE_OK);
|
61#else
| 64#else
|
62 printf("AcpiOsGetLine called but no input support"); 63 return (AE_NOT_EXIST);
| 65 printf("AcpiOsGetLine called but no input support"); 66 return (AE_NOT_EXIST);
|
64#endif /* DDB */ 65} 66 67ACPI_STATUS 68AcpiOsSignal(UINT32 Function, void *Info) 69{ 70 ACPI_SIGNAL_FATAL_INFO *fatal; 71 72 switch (Function) { 73 case ACPI_SIGNAL_FATAL: 74 fatal = (ACPI_SIGNAL_FATAL_INFO *)Info; 75 printf("ACPI fatal signal, type 0x%x code 0x%x argument 0x%x", 76 fatal->Type, fatal->Code, fatal->Argument); 77#ifdef ACPI_DEBUG 78 kdb_enter(KDB_WHY_ACPI, "AcpiOsSignal"); 79#endif 80 break; 81 82 case ACPI_SIGNAL_BREAKPOINT: 83#ifdef ACPI_DEBUG 84 kdb_enter(KDB_WHY_ACPI, (char *)Info); 85#endif 86 break; 87 88 default: 89 return (AE_BAD_PARAMETER); 90 } 91 92 return (AE_OK); 93} 94 95#ifdef ACPI_DEBUGGER 96void 97acpi_EnterDebugger(void) 98{ 99 ACPI_PARSE_OBJECT obj; 100 static int initted = 0; 101 102 if (!initted) { 103 printf("Initialising ACPICA debugger...\n"); 104 AcpiDbInitialize(); 105 initted = 1; 106 } 107 108 printf("Entering ACPICA debugger...\n"); 109 AcpiDbUserCommands('A', &obj); 110} 111#endif /* ACPI_DEBUGGER */
| 67#endif /* DDB */ 68} 69 70ACPI_STATUS 71AcpiOsSignal(UINT32 Function, void *Info) 72{ 73 ACPI_SIGNAL_FATAL_INFO *fatal; 74 75 switch (Function) { 76 case ACPI_SIGNAL_FATAL: 77 fatal = (ACPI_SIGNAL_FATAL_INFO *)Info; 78 printf("ACPI fatal signal, type 0x%x code 0x%x argument 0x%x", 79 fatal->Type, fatal->Code, fatal->Argument); 80#ifdef ACPI_DEBUG 81 kdb_enter(KDB_WHY_ACPI, "AcpiOsSignal"); 82#endif 83 break; 84 85 case ACPI_SIGNAL_BREAKPOINT: 86#ifdef ACPI_DEBUG 87 kdb_enter(KDB_WHY_ACPI, (char *)Info); 88#endif 89 break; 90 91 default: 92 return (AE_BAD_PARAMETER); 93 } 94 95 return (AE_OK); 96} 97 98#ifdef ACPI_DEBUGGER 99void 100acpi_EnterDebugger(void) 101{ 102 ACPI_PARSE_OBJECT obj; 103 static int initted = 0; 104 105 if (!initted) { 106 printf("Initialising ACPICA debugger...\n"); 107 AcpiDbInitialize(); 108 initted = 1; 109 } 110 111 printf("Entering ACPICA debugger...\n"); 112 AcpiDbUserCommands('A', &obj); 113} 114#endif /* ACPI_DEBUGGER */
|