1250757Sjkim/******************************************************************************* 2250757Sjkim * 3250757Sjkim * Module Name: uterror - Various internal error/warning output functions 4250757Sjkim * 5250757Sjkim ******************************************************************************/ 6250757Sjkim 7250757Sjkim/* 8306536Sjkim * Copyright (C) 2000 - 2016, Intel Corp. 9250757Sjkim * All rights reserved. 10250757Sjkim * 11250757Sjkim * Redistribution and use in source and binary forms, with or without 12250757Sjkim * modification, are permitted provided that the following conditions 13250757Sjkim * are met: 14250757Sjkim * 1. Redistributions of source code must retain the above copyright 15250757Sjkim * notice, this list of conditions, and the following disclaimer, 16250757Sjkim * without modification. 17250757Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18250757Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19250757Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20250757Sjkim * including a substantially similar Disclaimer requirement for further 21250757Sjkim * binary redistribution. 22250757Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23250757Sjkim * of any contributors may be used to endorse or promote products derived 24250757Sjkim * from this software without specific prior written permission. 25250757Sjkim * 26250757Sjkim * Alternatively, this software may be distributed under the terms of the 27250757Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28250757Sjkim * Software Foundation. 29250757Sjkim * 30250757Sjkim * NO WARRANTY 31250757Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32250757Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33250757Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34250757Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35250757Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36250757Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37250757Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38250757Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39250757Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40250757Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41250757Sjkim * POSSIBILITY OF SUCH DAMAGES. 42250757Sjkim */ 43250757Sjkim 44250838Sjkim#include <contrib/dev/acpica/include/acpi.h> 45250838Sjkim#include <contrib/dev/acpica/include/accommon.h> 46250838Sjkim#include <contrib/dev/acpica/include/acnamesp.h> 47250757Sjkim 48250757Sjkim 49250757Sjkim#define _COMPONENT ACPI_UTILITIES 50250757Sjkim ACPI_MODULE_NAME ("uterror") 51250757Sjkim 52250757Sjkim 53250757Sjkim/* 54250757Sjkim * This module contains internal error functions that may 55250757Sjkim * be configured out. 56250757Sjkim */ 57250757Sjkim#if !defined (ACPI_NO_ERROR_MESSAGES) 58250757Sjkim 59250757Sjkim/******************************************************************************* 60250757Sjkim * 61250757Sjkim * FUNCTION: AcpiUtPredefinedWarning 62250757Sjkim * 63250757Sjkim * PARAMETERS: ModuleName - Caller's module name (for error output) 64250757Sjkim * LineNumber - Caller's line number (for error output) 65250757Sjkim * Pathname - Full pathname to the node 66250757Sjkim * NodeFlags - From Namespace node for the method/object 67250757Sjkim * Format - Printf format string + additional args 68250757Sjkim * 69250757Sjkim * RETURN: None 70250757Sjkim * 71250757Sjkim * DESCRIPTION: Warnings for the predefined validation module. Messages are 72250757Sjkim * only emitted the first time a problem with a particular 73250757Sjkim * method/object is detected. This prevents a flood of error 74250757Sjkim * messages for methods that are repeatedly evaluated. 75250757Sjkim * 76250757Sjkim ******************************************************************************/ 77250757Sjkim 78250757Sjkimvoid ACPI_INTERNAL_VAR_XFACE 79250757SjkimAcpiUtPredefinedWarning ( 80250757Sjkim const char *ModuleName, 81250757Sjkim UINT32 LineNumber, 82250757Sjkim char *Pathname, 83250757Sjkim UINT8 NodeFlags, 84250757Sjkim const char *Format, 85250757Sjkim ...) 86250757Sjkim{ 87250757Sjkim va_list ArgList; 88250757Sjkim 89250757Sjkim 90250757Sjkim /* 91250757Sjkim * Warning messages for this method/object will be disabled after the 92250757Sjkim * first time a validation fails or an object is successfully repaired. 93250757Sjkim */ 94250757Sjkim if (NodeFlags & ANOBJ_EVALUATED) 95250757Sjkim { 96250757Sjkim return; 97250757Sjkim } 98250757Sjkim 99250757Sjkim AcpiOsPrintf (ACPI_MSG_WARNING "%s: ", Pathname); 100250757Sjkim 101250757Sjkim va_start (ArgList, Format); 102250757Sjkim AcpiOsVprintf (Format, ArgList); 103250757Sjkim ACPI_MSG_SUFFIX; 104250757Sjkim va_end (ArgList); 105250757Sjkim} 106250757Sjkim 107250757Sjkim 108250757Sjkim/******************************************************************************* 109250757Sjkim * 110250757Sjkim * FUNCTION: AcpiUtPredefinedInfo 111250757Sjkim * 112250757Sjkim * PARAMETERS: ModuleName - Caller's module name (for error output) 113250757Sjkim * LineNumber - Caller's line number (for error output) 114250757Sjkim * Pathname - Full pathname to the node 115250757Sjkim * NodeFlags - From Namespace node for the method/object 116250757Sjkim * Format - Printf format string + additional args 117250757Sjkim * 118250757Sjkim * RETURN: None 119250757Sjkim * 120250757Sjkim * DESCRIPTION: Info messages for the predefined validation module. Messages 121250757Sjkim * are only emitted the first time a problem with a particular 122250757Sjkim * method/object is detected. This prevents a flood of 123250757Sjkim * messages for methods that are repeatedly evaluated. 124250757Sjkim * 125250757Sjkim ******************************************************************************/ 126250757Sjkim 127250757Sjkimvoid ACPI_INTERNAL_VAR_XFACE 128250757SjkimAcpiUtPredefinedInfo ( 129250757Sjkim const char *ModuleName, 130250757Sjkim UINT32 LineNumber, 131250757Sjkim char *Pathname, 132250757Sjkim UINT8 NodeFlags, 133250757Sjkim const char *Format, 134250757Sjkim ...) 135250757Sjkim{ 136250757Sjkim va_list ArgList; 137250757Sjkim 138250757Sjkim 139250757Sjkim /* 140250757Sjkim * Warning messages for this method/object will be disabled after the 141250757Sjkim * first time a validation fails or an object is successfully repaired. 142250757Sjkim */ 143250757Sjkim if (NodeFlags & ANOBJ_EVALUATED) 144250757Sjkim { 145250757Sjkim return; 146250757Sjkim } 147250757Sjkim 148250757Sjkim AcpiOsPrintf (ACPI_MSG_INFO "%s: ", Pathname); 149250757Sjkim 150250757Sjkim va_start (ArgList, Format); 151250757Sjkim AcpiOsVprintf (Format, ArgList); 152250757Sjkim ACPI_MSG_SUFFIX; 153250757Sjkim va_end (ArgList); 154250757Sjkim} 155250757Sjkim 156250757Sjkim 157250757Sjkim/******************************************************************************* 158250757Sjkim * 159250757Sjkim * FUNCTION: AcpiUtPredefinedBiosError 160250757Sjkim * 161250757Sjkim * PARAMETERS: ModuleName - Caller's module name (for error output) 162250757Sjkim * LineNumber - Caller's line number (for error output) 163250757Sjkim * Pathname - Full pathname to the node 164250757Sjkim * NodeFlags - From Namespace node for the method/object 165250757Sjkim * Format - Printf format string + additional args 166250757Sjkim * 167250757Sjkim * RETURN: None 168250757Sjkim * 169250757Sjkim * DESCRIPTION: BIOS error message for predefined names. Messages 170250757Sjkim * are only emitted the first time a problem with a particular 171250757Sjkim * method/object is detected. This prevents a flood of 172250757Sjkim * messages for methods that are repeatedly evaluated. 173250757Sjkim * 174250757Sjkim ******************************************************************************/ 175250757Sjkim 176250757Sjkimvoid ACPI_INTERNAL_VAR_XFACE 177250757SjkimAcpiUtPredefinedBiosError ( 178250757Sjkim const char *ModuleName, 179250757Sjkim UINT32 LineNumber, 180250757Sjkim char *Pathname, 181250757Sjkim UINT8 NodeFlags, 182250757Sjkim const char *Format, 183250757Sjkim ...) 184250757Sjkim{ 185250757Sjkim va_list ArgList; 186250757Sjkim 187250757Sjkim 188250757Sjkim /* 189250757Sjkim * Warning messages for this method/object will be disabled after the 190250757Sjkim * first time a validation fails or an object is successfully repaired. 191250757Sjkim */ 192250757Sjkim if (NodeFlags & ANOBJ_EVALUATED) 193250757Sjkim { 194250757Sjkim return; 195250757Sjkim } 196250757Sjkim 197250757Sjkim AcpiOsPrintf (ACPI_MSG_BIOS_ERROR "%s: ", Pathname); 198250757Sjkim 199250757Sjkim va_start (ArgList, Format); 200250757Sjkim AcpiOsVprintf (Format, ArgList); 201250757Sjkim ACPI_MSG_SUFFIX; 202250757Sjkim va_end (ArgList); 203250757Sjkim} 204250757Sjkim 205250757Sjkim 206250757Sjkim/******************************************************************************* 207250757Sjkim * 208250757Sjkim * FUNCTION: AcpiUtNamespaceError 209250757Sjkim * 210250757Sjkim * PARAMETERS: ModuleName - Caller's module name (for error output) 211250757Sjkim * LineNumber - Caller's line number (for error output) 212250757Sjkim * InternalName - Name or path of the namespace node 213250757Sjkim * LookupStatus - Exception code from NS lookup 214250757Sjkim * 215250757Sjkim * RETURN: None 216250757Sjkim * 217250757Sjkim * DESCRIPTION: Print error message with the full pathname for the NS node. 218250757Sjkim * 219250757Sjkim ******************************************************************************/ 220250757Sjkim 221250757Sjkimvoid 222250757SjkimAcpiUtNamespaceError ( 223250757Sjkim const char *ModuleName, 224250757Sjkim UINT32 LineNumber, 225250757Sjkim const char *InternalName, 226250757Sjkim ACPI_STATUS LookupStatus) 227250757Sjkim{ 228250757Sjkim ACPI_STATUS Status; 229250757Sjkim UINT32 BadName; 230250757Sjkim char *Name = NULL; 231250757Sjkim 232250757Sjkim 233250757Sjkim ACPI_MSG_REDIRECT_BEGIN; 234250757Sjkim AcpiOsPrintf (ACPI_MSG_ERROR); 235250757Sjkim 236250757Sjkim if (LookupStatus == AE_BAD_CHARACTER) 237250757Sjkim { 238250757Sjkim /* There is a non-ascii character in the name */ 239250757Sjkim 240250757Sjkim ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName)); 241250757Sjkim AcpiOsPrintf ("[0x%.8X] (NON-ASCII)", BadName); 242250757Sjkim } 243250757Sjkim else 244250757Sjkim { 245250757Sjkim /* Convert path to external format */ 246250757Sjkim 247306536Sjkim Status = AcpiNsExternalizeName ( 248306536Sjkim ACPI_UINT32_MAX, InternalName, NULL, &Name); 249250757Sjkim 250250757Sjkim /* Print target name */ 251250757Sjkim 252250757Sjkim if (ACPI_SUCCESS (Status)) 253250757Sjkim { 254250757Sjkim AcpiOsPrintf ("[%s]", Name); 255250757Sjkim } 256250757Sjkim else 257250757Sjkim { 258250757Sjkim AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]"); 259250757Sjkim } 260250757Sjkim 261250757Sjkim if (Name) 262250757Sjkim { 263250757Sjkim ACPI_FREE (Name); 264250757Sjkim } 265250757Sjkim } 266250757Sjkim 267250757Sjkim AcpiOsPrintf (" Namespace lookup failure, %s", 268250757Sjkim AcpiFormatException (LookupStatus)); 269250757Sjkim 270250757Sjkim ACPI_MSG_SUFFIX; 271250757Sjkim ACPI_MSG_REDIRECT_END; 272250757Sjkim} 273250757Sjkim 274250757Sjkim 275250757Sjkim/******************************************************************************* 276250757Sjkim * 277250757Sjkim * FUNCTION: AcpiUtMethodError 278250757Sjkim * 279250757Sjkim * PARAMETERS: ModuleName - Caller's module name (for error output) 280250757Sjkim * LineNumber - Caller's line number (for error output) 281250757Sjkim * Message - Error message to use on failure 282250757Sjkim * PrefixNode - Prefix relative to the path 283250757Sjkim * Path - Path to the node (optional) 284250757Sjkim * MethodStatus - Execution status 285250757Sjkim * 286250757Sjkim * RETURN: None 287250757Sjkim * 288250757Sjkim * DESCRIPTION: Print error message with the full pathname for the method. 289250757Sjkim * 290250757Sjkim ******************************************************************************/ 291250757Sjkim 292250757Sjkimvoid 293250757SjkimAcpiUtMethodError ( 294250757Sjkim const char *ModuleName, 295250757Sjkim UINT32 LineNumber, 296250757Sjkim const char *Message, 297250757Sjkim ACPI_NAMESPACE_NODE *PrefixNode, 298250757Sjkim const char *Path, 299250757Sjkim ACPI_STATUS MethodStatus) 300250757Sjkim{ 301250757Sjkim ACPI_STATUS Status; 302250757Sjkim ACPI_NAMESPACE_NODE *Node = PrefixNode; 303250757Sjkim 304250757Sjkim 305250757Sjkim ACPI_MSG_REDIRECT_BEGIN; 306250757Sjkim AcpiOsPrintf (ACPI_MSG_ERROR); 307250757Sjkim 308250757Sjkim if (Path) 309250757Sjkim { 310306536Sjkim Status = AcpiNsGetNode (PrefixNode, Path, 311306536Sjkim ACPI_NS_NO_UPSEARCH, &Node); 312250757Sjkim if (ACPI_FAILURE (Status)) 313250757Sjkim { 314250757Sjkim AcpiOsPrintf ("[Could not get node by pathname]"); 315250757Sjkim } 316250757Sjkim } 317250757Sjkim 318250757Sjkim AcpiNsPrintNodePathname (Node, Message); 319250757Sjkim AcpiOsPrintf (", %s", AcpiFormatException (MethodStatus)); 320250757Sjkim 321250757Sjkim ACPI_MSG_SUFFIX; 322250757Sjkim ACPI_MSG_REDIRECT_END; 323250757Sjkim} 324250757Sjkim 325250757Sjkim#endif /* ACPI_NO_ERROR_MESSAGES */ 326