1 /*******************************************************************************
   2  *
   3  * Module Name: utxferror - Various error/warning output functions
   4  *
   5  ******************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.
  29  *
  30  * NO WARRANTY
  31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  41  * POSSIBILITY OF SUCH DAMAGES.
  42  */
  43 
  44 #define __UTXFERROR_C__
  45 #define EXPORT_ACPI_INTERFACES
  46 
  47 #include "acpi.h"
  48 #include "accommon.h"
  49 
  50 
  51 #define _COMPONENT          ACPI_UTILITIES
  52         ACPI_MODULE_NAME    ("utxferror")
  53 
  54 /*
  55  * This module is used for the in-kernel ACPICA as well as the ACPICA
  56  * tools/applications.
  57  */
  58 
  59 /*******************************************************************************
  60  *
  61  * FUNCTION:    AcpiError
  62  *
  63  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
  64  *              LineNumber          - Caller's line number (for error output)
  65  *              Format              - Printf format string + additional args
  66  *
  67  * RETURN:      None
  68  *
  69  * DESCRIPTION: Print "ACPI Error" message with module/line/version info
  70  *
  71  ******************************************************************************/
  72 
  73 void ACPI_INTERNAL_VAR_XFACE
  74 AcpiError (
  75     const char              *ModuleName,
  76     UINT32                  LineNumber,
  77     const char              *Format,
  78     ...)
  79 {
  80     va_list                 ArgList;
  81 
  82 
  83     ACPI_MSG_REDIRECT_BEGIN;
  84     AcpiOsPrintf (ACPI_MSG_ERROR);
  85 
  86     va_start (ArgList, Format);
  87     AcpiOsVprintf (Format, ArgList);
  88     ACPI_MSG_SUFFIX;
  89     va_end (ArgList);
  90 
  91     ACPI_MSG_REDIRECT_END;
  92 }
  93 
  94 ACPI_EXPORT_SYMBOL (AcpiError)
  95 
  96 
  97 /*******************************************************************************
  98  *
  99  * FUNCTION:    AcpiException
 100  *
 101  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
 102  *              LineNumber          - Caller's line number (for error output)
 103  *              Status              - Status to be formatted
 104  *              Format              - Printf format string + additional args
 105  *
 106  * RETURN:      None
 107  *
 108  * DESCRIPTION: Print "ACPI Exception" message with module/line/version info
 109  *              and decoded ACPI_STATUS.
 110  *
 111  ******************************************************************************/
 112 
 113 void ACPI_INTERNAL_VAR_XFACE
 114 AcpiException (
 115     const char              *ModuleName,
 116     UINT32                  LineNumber,
 117     ACPI_STATUS             Status,
 118     const char              *Format,
 119     ...)
 120 {
 121     va_list                 ArgList;
 122 
 123 
 124     ACPI_MSG_REDIRECT_BEGIN;
 125     AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status));
 126 
 127     va_start (ArgList, Format);
 128     AcpiOsVprintf (Format, ArgList);
 129     ACPI_MSG_SUFFIX;
 130     va_end (ArgList);
 131 
 132     ACPI_MSG_REDIRECT_END;
 133 }
 134 
 135 ACPI_EXPORT_SYMBOL (AcpiException)
 136 
 137 
 138 /*******************************************************************************
 139  *
 140  * FUNCTION:    AcpiWarning
 141  *
 142  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
 143  *              LineNumber          - Caller's line number (for error output)
 144  *              Format              - Printf format string + additional args
 145  *
 146  * RETURN:      None
 147  *
 148  * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
 149  *
 150  ******************************************************************************/
 151 
 152 void ACPI_INTERNAL_VAR_XFACE
 153 AcpiWarning (
 154     const char              *ModuleName,
 155     UINT32                  LineNumber,
 156     const char              *Format,
 157     ...)
 158 {
 159     va_list                 ArgList;
 160 
 161 
 162     ACPI_MSG_REDIRECT_BEGIN;
 163     AcpiOsPrintf (ACPI_MSG_WARNING);
 164 
 165     va_start (ArgList, Format);
 166     AcpiOsVprintf (Format, ArgList);
 167     ACPI_MSG_SUFFIX;
 168     va_end (ArgList);
 169 
 170     ACPI_MSG_REDIRECT_END;
 171 }
 172 
 173 ACPI_EXPORT_SYMBOL (AcpiWarning)
 174 
 175 
 176 /*******************************************************************************
 177  *
 178  * FUNCTION:    AcpiInfo
 179  *
 180  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
 181  *              LineNumber          - Caller's line number (for error output)
 182  *              Format              - Printf format string + additional args
 183  *
 184  * RETURN:      None
 185  *
 186  * DESCRIPTION: Print generic "ACPI:" information message. There is no
 187  *              module/line/version info in order to keep the message simple.
 188  *
 189  * TBD: ModuleName and LineNumber args are not needed, should be removed.
 190  *
 191  ******************************************************************************/
 192 
 193 void ACPI_INTERNAL_VAR_XFACE
 194 AcpiInfo (
 195     const char              *ModuleName,
 196     UINT32                  LineNumber,
 197     const char              *Format,
 198     ...)
 199 {
 200     va_list                 ArgList;
 201 
 202 
 203     ACPI_MSG_REDIRECT_BEGIN;
 204     AcpiOsPrintf (ACPI_MSG_INFO);
 205 
 206     va_start (ArgList, Format);
 207     AcpiOsVprintf (Format, ArgList);
 208     AcpiOsPrintf ("\n");
 209     va_end (ArgList);
 210 
 211     ACPI_MSG_REDIRECT_END;
 212 }
 213 
 214 ACPI_EXPORT_SYMBOL (AcpiInfo)
 215 
 216 
 217 /*******************************************************************************
 218  *
 219  * FUNCTION:    AcpiBiosError
 220  *
 221  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
 222  *              LineNumber          - Caller's line number (for error output)
 223  *              Format              - Printf format string + additional args
 224  *
 225  * RETURN:      None
 226  *
 227  * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
 228  *              info
 229  *
 230  ******************************************************************************/
 231 
 232 void ACPI_INTERNAL_VAR_XFACE
 233 AcpiBiosError (
 234     const char              *ModuleName,
 235     UINT32                  LineNumber,
 236     const char              *Format,
 237     ...)
 238 {
 239     va_list                 ArgList;
 240 
 241 
 242     ACPI_MSG_REDIRECT_BEGIN;
 243     AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);
 244 
 245     va_start (ArgList, Format);
 246     AcpiOsVprintf (Format, ArgList);
 247     ACPI_MSG_SUFFIX;
 248     va_end (ArgList);
 249 
 250     ACPI_MSG_REDIRECT_END;
 251 }
 252 
 253 ACPI_EXPORT_SYMBOL (AcpiBiosError)
 254 
 255 
 256 /*******************************************************************************
 257  *
 258  * FUNCTION:    AcpiBiosWarning
 259  *
 260  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
 261  *              LineNumber          - Caller's line number (for error output)
 262  *              Format              - Printf format string + additional args
 263  *
 264  * RETURN:      None
 265  *
 266  * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
 267  *              info
 268  *
 269  ******************************************************************************/
 270 
 271 void ACPI_INTERNAL_VAR_XFACE
 272 AcpiBiosWarning (
 273     const char              *ModuleName,
 274     UINT32                  LineNumber,
 275     const char              *Format,
 276     ...)
 277 {
 278     va_list                 ArgList;
 279 
 280 
 281     ACPI_MSG_REDIRECT_BEGIN;
 282     AcpiOsPrintf (ACPI_MSG_BIOS_WARNING);
 283 
 284     va_start (ArgList, Format);
 285     AcpiOsVprintf (Format, ArgList);
 286     ACPI_MSG_SUFFIX;
 287     va_end (ArgList);
 288 
 289     ACPI_MSG_REDIRECT_END;
 290 }
 291 
 292 ACPI_EXPORT_SYMBOL (AcpiBiosWarning)