uterror.c revision 250757
138514Sdfr/******************************************************************************* 259603Sdfr * 338514Sdfr * Module Name: uterror - Various internal error/warning output functions 438514Sdfr * 538514Sdfr ******************************************************************************/ 638514Sdfr 738514Sdfr/* 838514Sdfr * Copyright (C) 2000 - 2013, Intel Corp. 938514Sdfr * All rights reserved. 1038514Sdfr * 1138514Sdfr * Redistribution and use in source and binary forms, with or without 1238514Sdfr * modification, are permitted provided that the following conditions 1338514Sdfr * are met: 1438514Sdfr * 1. Redistributions of source code must retain the above copyright 1538514Sdfr * notice, this list of conditions, and the following disclaimer, 1638514Sdfr * without modification. 1738514Sdfr * 2. Redistributions in binary form must reproduce at minimum a disclaimer 1838514Sdfr * substantially similar to the "NO WARRANTY" disclaimer below 1938514Sdfr * ("Disclaimer") and any redistribution must be conditioned upon 2038514Sdfr * including a substantially similar Disclaimer requirement for further 2138514Sdfr * binary redistribution. 2238514Sdfr * 3. Neither the names of the above-listed copyright holders nor the names 2338514Sdfr * of any contributors may be used to endorse or promote products derived 2438514Sdfr * from this software without specific prior written permission. 2538514Sdfr * 2638514Sdfr * Alternatively, this software may be distributed under the terms of the 27116182Sobrien * GNU General Public License ("GPL") version 2 as published by the Free 28116182Sobrien * Software Foundation. 29116182Sobrien * 30179223Sjb * NO WARRANTY 31131928Smarcel * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3259603Sdfr * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3338514Sdfr * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 3476166Smarkm * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35129443Sbde * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36129443Sbde * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37129443Sbde * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3838514Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 3976166Smarkm * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 4038514Sdfr * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 4177642Sdd * POSSIBILITY OF SUCH DAMAGES. 42159808Sjhb */ 43194784Sjeff 4438514Sdfr#define __UTERROR_C__ 4538514Sdfr 4638514Sdfr#include "acpi.h" 4738514Sdfr#include "accommon.h" 4838514Sdfr#include "acnamesp.h" 4976166Smarkm 5038514Sdfr 5138514Sdfr#define _COMPONENT ACPI_UTILITIES 52195699Srwatson ACPI_MODULE_NAME ("uterror") 53195699Srwatson 54163606Srwatson 55163606Srwatson/* 5639071Sdfr * This module contains internal error functions that may 5739071Sdfr * be configured out. 5852128Speter */ 5939071Sdfr#if !defined (ACPI_NO_ERROR_MESSAGES) 6039071Sdfr 6139071Sdfr/******************************************************************************* 6252128Speter * 6339071Sdfr * FUNCTION: AcpiUtPredefinedWarning 6439071Sdfr * 6576166Smarkm * PARAMETERS: ModuleName - Caller's module name (for error output) 66102288Speter * LineNumber - Caller's line number (for error output) 6739071Sdfr * Pathname - Full pathname to the node 68179223Sjb * NodeFlags - From Namespace node for the method/object 69179223Sjb * Format - Printf format string + additional args 70179223Sjb * 71179223Sjb * RETURN: None 7259603Sdfr * 7338514Sdfr * DESCRIPTION: Warnings for the predefined validation module. Messages are 74151430Speter * only emitted the first time a problem with a particular 75151430Speter * method/object is detected. This prevents a flood of error 76180438Sobrien * messages for methods that are repeatedly evaluated. 77215013Smdf * 78215013Smdf ******************************************************************************/ 79215013Smdf 80180438Sobrienvoid ACPI_INTERNAL_VAR_XFACE 81215013SmdfAcpiUtPredefinedWarning ( 82180438Sobrien const char *ModuleName, 83215013Smdf UINT32 LineNumber, 84215013Smdf char *Pathname, 85215013Smdf UINT8 NodeFlags, 86215013Smdf const char *Format, 87215013Smdf ...) 88215013Smdf{ 89215013Smdf va_list ArgList; 90215013Smdf 91215013Smdf 92215013Smdf /* 93215013Smdf * Warning messages for this method/object will be disabled after the 94215013Smdf * first time a validation fails or an object is successfully repaired. 95215013Smdf */ 96215013Smdf if (NodeFlags & ANOBJ_EVALUATED) 97215013Smdf { 98215013Smdf return; 99215013Smdf } 100215013Smdf 101215013Smdf AcpiOsPrintf (ACPI_MSG_WARNING "%s: ", Pathname); 102215013Smdf 103215013Smdf va_start (ArgList, Format); 104215013Smdf AcpiOsVprintf (Format, ArgList); 105215013Smdf ACPI_MSG_SUFFIX; 106215013Smdf va_end (ArgList); 107215013Smdf} 108215013Smdf 109215013Smdf 110215013Smdf/******************************************************************************* 111215013Smdf * 112215013Smdf * FUNCTION: AcpiUtPredefinedInfo 113215013Smdf * 114215013Smdf * PARAMETERS: ModuleName - Caller's module name (for error output) 115215013Smdf * LineNumber - Caller's line number (for error output) 116195699Srwatson * Pathname - Full pathname to the node 117215013Smdf * NodeFlags - From Namespace node for the method/object 118215013Smdf * Format - Printf format string + additional args 119215013Smdf * 120195699Srwatson * RETURN: None 121180438Sobrien * 122215013Smdf * DESCRIPTION: Info messages for the predefined validation module. Messages 123180438Sobrien * are only emitted the first time a problem with a particular 124180438Sobrien * method/object is detected. This prevents a flood of 125180438Sobrien * messages for methods that are repeatedly evaluated. 126240997Strociny * 127240997Strociny ******************************************************************************/ 128240997Strociny 129240997Strocinyvoid ACPI_INTERNAL_VAR_XFACE 130240997StrocinyAcpiUtPredefinedInfo ( 131240997Strociny const char *ModuleName, 132240997Strociny UINT32 LineNumber, 133240997Strociny char *Pathname, 134240997Strociny UINT8 NodeFlags, 135179223Sjb const char *Format, 136179223Sjb ...) 137105468Smarcel{ 13859751Speter va_list ArgList; 139215013Smdf 14059751Speter 141215013Smdf /* 142215013Smdf * Warning messages for this method/object will be disabled after the 143215013Smdf * first time a validation fails or an object is successfully repaired. 144215013Smdf */ 145215013Smdf if (NodeFlags & ANOBJ_EVALUATED) 146215013Smdf { 147215013Smdf return; 148215013Smdf } 14938514Sdfr 15059603Sdfr AcpiOsPrintf (ACPI_MSG_INFO "%s: ", Pathname); 15159751Speter 15278161Speter va_start (ArgList, Format); 153215013Smdf AcpiOsVprintf (Format, ArgList); 15485736Sgreen ACPI_MSG_SUFFIX; 155215013Smdf va_end (ArgList); 156179223Sjb} 157215013Smdf 158109605Sjake 159192859Ssson/******************************************************************************* 160192859Ssson * 161215013Smdf * FUNCTION: AcpiUtPredefinedBiosError 16259603Sdfr * 16359603Sdfr * PARAMETERS: ModuleName - Caller's module name (for error output) 164215013Smdf * LineNumber - Caller's line number (for error output) 165215013Smdf * Pathname - Full pathname to the node 166215013Smdf * NodeFlags - From Namespace node for the method/object 167215013Smdf * Format - Printf format string + additional args 168215013Smdf * 169215013Smdf * RETURN: None 170215013Smdf * 171215013Smdf * DESCRIPTION: BIOS error message for predefined names. Messages 172215013Smdf * are only emitted the first time a problem with a particular 173215013Smdf * method/object is detected. This prevents a flood of 174215013Smdf * messages for methods that are repeatedly evaluated. 175215013Smdf * 176215013Smdf ******************************************************************************/ 177215013Smdf 17859603Sdfrvoid ACPI_INTERNAL_VAR_XFACE 17959603SdfrAcpiUtPredefinedBiosError ( 18059603Sdfr const char *ModuleName, 18159603Sdfr UINT32 LineNumber, 182215013Smdf char *Pathname, 18359603Sdfr UINT8 NodeFlags, 184215013Smdf const char *Format, 18559603Sdfr ...) 186215013Smdf{ 18759603Sdfr va_list ArgList; 18859603Sdfr 189215013Smdf 190215013Smdf /* 191215013Smdf * Warning messages for this method/object will be disabled after the 19259603Sdfr * first time a validation fails or an object is successfully repaired. 193240997Strociny */ 194240997Strociny if (NodeFlags & ANOBJ_EVALUATED) 195240997Strociny { 196240997Strociny return; 197240997Strociny } 198240997Strociny 199240997Strociny AcpiOsPrintf (ACPI_MSG_BIOS_ERROR "%s: ", Pathname); 200240997Strociny 201240997Strociny va_start (ArgList, Format); 202240997Strociny AcpiOsVprintf (Format, ArgList); 203240997Strociny ACPI_MSG_SUFFIX; 204240997Strociny va_end (ArgList); 205240997Strociny} 206240997Strociny 207240997Strociny 208240997Strociny/******************************************************************************* 209240997Strociny * 210240997Strociny * FUNCTION: AcpiUtNamespaceError 211240997Strociny * 212240997Strociny * PARAMETERS: ModuleName - Caller's module name (for error output) 213240997Strociny * LineNumber - Caller's line number (for error output) 214240997Strociny * InternalName - Name or path of the namespace node 215240997Strociny * LookupStatus - Exception code from NS lookup 216240997Strociny * 217240997Strociny * RETURN: None 218240997Strociny * 219240997Strociny * DESCRIPTION: Print error message with the full pathname for the NS node. 220240997Strociny * 221240997Strociny ******************************************************************************/ 222240997Strociny 223240997Strocinyvoid 224240997StrocinyAcpiUtNamespaceError ( 225240997Strociny const char *ModuleName, 226240997Strociny UINT32 LineNumber, 227240997Strociny const char *InternalName, 228240997Strociny ACPI_STATUS LookupStatus) 229240997Strociny{ 230240997Strociny ACPI_STATUS Status; 231240997Strociny UINT32 BadName; 232240997Strociny char *Name = NULL; 233240997Strociny 234240997Strociny 235240997Strociny ACPI_MSG_REDIRECT_BEGIN; 236240997Strociny AcpiOsPrintf (ACPI_MSG_ERROR); 237240997Strociny 238240997Strociny if (LookupStatus == AE_BAD_CHARACTER) 239240997Strociny { 240240997Strociny /* There is a non-ascii character in the name */ 241240997Strociny 242240997Strociny ACPI_MOVE_32_TO_32 (&BadName, ACPI_CAST_PTR (UINT32, InternalName)); 243240997Strociny AcpiOsPrintf ("[0x%.8X] (NON-ASCII)", BadName); 244240997Strociny } 245240997Strociny else 246240997Strociny { 247240997Strociny /* Convert path to external format */ 248240997Strociny 249240997Strociny Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, 250240997Strociny InternalName, NULL, &Name); 251240997Strociny 252240997Strociny /* Print target name */ 253240997Strociny 254240997Strociny if (ACPI_SUCCESS (Status)) 255240997Strociny { 256240997Strociny AcpiOsPrintf ("[%s]", Name); 257240997Strociny } 258240997Strociny else 259240997Strociny { 260240997Strociny AcpiOsPrintf ("[COULD NOT EXTERNALIZE NAME]"); 261240997Strociny } 262131928Smarcel 263215013Smdf if (Name) 26459603Sdfr { 26538514Sdfr ACPI_FREE (Name); 26659603Sdfr } 26759603Sdfr } 26859603Sdfr 26959603Sdfr AcpiOsPrintf (" Namespace lookup failure, %s", 270215013Smdf AcpiFormatException (LookupStatus)); 271215013Smdf 272215013Smdf ACPI_MSG_SUFFIX; 27359603Sdfr ACPI_MSG_REDIRECT_END; 27459603Sdfr} 27559603Sdfr 27659603Sdfr 277104094Sphk/******************************************************************************* 27866719Sjhb * 27966719Sjhb * FUNCTION: AcpiUtMethodError 28059603Sdfr * 28159603Sdfr * PARAMETERS: ModuleName - Caller's module name (for error output) 28259603Sdfr * LineNumber - Caller's line number (for error output) 283105467Smarcel * Message - Error message to use on failure 284105467Smarcel * PrefixNode - Prefix relative to the path 285105467Smarcel * Path - Path to the node (optional) 286215013Smdf * MethodStatus - Execution status 28759603Sdfr * 288215013Smdf * RETURN: None 289105467Smarcel * 290215013Smdf * DESCRIPTION: Print error message with the full pathname for the method. 291215013Smdf * 292215013Smdf ******************************************************************************/ 293215013Smdf 294215013Smdfvoid 295215013SmdfAcpiUtMethodError ( 296215013Smdf const char *ModuleName, 297215013Smdf UINT32 LineNumber, 298215013Smdf const char *Message, 299215013Smdf ACPI_NAMESPACE_NODE *PrefixNode, 300215013Smdf const char *Path, 301215013Smdf ACPI_STATUS MethodStatus) 302215013Smdf{ 303105467Smarcel ACPI_STATUS Status; 304105467Smarcel ACPI_NAMESPACE_NODE *Node = PrefixNode; 305105467Smarcel 306105467Smarcel 307105467Smarcel ACPI_MSG_REDIRECT_BEGIN; 308215013Smdf AcpiOsPrintf (ACPI_MSG_ERROR); 309215013Smdf 310215013Smdf if (Path) 311215013Smdf { 312215013Smdf Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH, 313215013Smdf &Node); 314215013Smdf if (ACPI_FAILURE (Status)) 315215013Smdf { 316215013Smdf AcpiOsPrintf ("[Could not get node by pathname]"); 317105467Smarcel } 318131928Smarcel } 319105467Smarcel 32095228Smarcel AcpiNsPrintNodePathname (Node, Message); 32195228Smarcel AcpiOsPrintf (", %s", AcpiFormatException (MethodStatus)); 32295228Smarcel 32395228Smarcel ACPI_MSG_SUFFIX; 324180438Sobrien ACPI_MSG_REDIRECT_END; 325180438Sobrien} 326180438Sobrien 327180438Sobrien#endif /* ACPI_NO_ERROR_MESSAGES */ 328180438Sobrien