Path: blob/main/sys/contrib/dev/acpica/components/utilities/utxferror.c
48406 views
/*******************************************************************************1*2* Module Name: utxferror - Various error/warning output functions3*4******************************************************************************/56/******************************************************************************7*8* 1. Copyright Notice9*10* Some or all of this work - Copyright (c) 1999 - 2025, Intel Corp.11* All rights reserved.12*13* 2. License14*15* 2.1. This is your license from Intel Corp. under its intellectual property16* rights. You may have additional license terms from the party that provided17* you this software, covering your right to use that party's intellectual18* property rights.19*20* 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a21* copy of the source code appearing in this file ("Covered Code") an22* irrevocable, perpetual, worldwide license under Intel's copyrights in the23* base code distributed originally by Intel ("Original Intel Code") to copy,24* make derivatives, distribute, use and display any portion of the Covered25* Code in any form, with the right to sublicense such rights; and26*27* 2.3. Intel grants Licensee a non-exclusive and non-transferable patent28* license (with the right to sublicense), under only those claims of Intel29* patents that are infringed by the Original Intel Code, to make, use, sell,30* offer to sell, and import the Covered Code and derivative works thereof31* solely to the minimum extent necessary to exercise the above copyright32* license, and in no event shall the patent license extend to any additions33* to or modifications of the Original Intel Code. No other license or right34* is granted directly or by implication, estoppel or otherwise;35*36* The above copyright and patent license is granted only if the following37* conditions are met:38*39* 3. Conditions40*41* 3.1. Redistribution of Source with Rights to Further Distribute Source.42* Redistribution of source code of any substantial portion of the Covered43* Code or modification with rights to further distribute source must include44* the above Copyright Notice, the above License, this list of Conditions,45* and the following Disclaimer and Export Compliance provision. In addition,46* Licensee must cause all Covered Code to which Licensee contributes to47* contain a file documenting the changes Licensee made to create that Covered48* Code and the date of any change. Licensee must include in that file the49* documentation of any changes made by any predecessor Licensee. Licensee50* must include a prominent statement that the modification is derived,51* directly or indirectly, from Original Intel Code.52*53* 3.2. Redistribution of Source with no Rights to Further Distribute Source.54* Redistribution of source code of any substantial portion of the Covered55* Code or modification without rights to further distribute source must56* include the following Disclaimer and Export Compliance provision in the57* documentation and/or other materials provided with distribution. In58* addition, Licensee may not authorize further sublicense of source of any59* portion of the Covered Code, and must include terms to the effect that the60* license from Licensee to its licensee is limited to the intellectual61* property embodied in the software Licensee provides to its licensee, and62* not to intellectual property embodied in modifications its licensee may63* make.64*65* 3.3. Redistribution of Executable. Redistribution in executable form of any66* substantial portion of the Covered Code or modification must reproduce the67* above Copyright Notice, and the following Disclaimer and Export Compliance68* provision in the documentation and/or other materials provided with the69* distribution.70*71* 3.4. Intel retains all right, title, and interest in and to the Original72* Intel Code.73*74* 3.5. Neither the name Intel nor any other trademark owned or controlled by75* Intel shall be used in advertising or otherwise to promote the sale, use or76* other dealings in products derived from or relating to the Covered Code77* without prior written authorization from Intel.78*79* 4. Disclaimer and Export Compliance80*81* 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED82* HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE83* IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,84* INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY85* UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY86* IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A87* PARTICULAR PURPOSE.88*89* 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES90* OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR91* COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,92* SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY93* CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL94* HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS95* SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY96* LIMITED REMEDY.97*98* 4.3. Licensee shall not export, either directly or indirectly, any of this99* software or system incorporating such software without first obtaining any100* required license or other approval from the U. S. Department of Commerce or101* any other agency or department of the United States Government. In the102* event Licensee exports any such software from the United States or103* re-exports any such software from a foreign destination, Licensee shall104* ensure that the distribution and export/re-export of the software is in105* compliance with all laws, regulations, orders, or other restrictions of the106* U.S. Export Administration Regulations. Licensee agrees that neither it nor107* any of its subsidiaries will export/re-export any technical data, process,108* software, or service, directly or indirectly, to any country for which the109* United States government or any agency thereof requires an export license,110* other governmental approval, or letter of assurance, without first obtaining111* such license, approval or letter.112*113*****************************************************************************114*115* Alternatively, you may choose to be licensed under the terms of the116* following license:117*118* Redistribution and use in source and binary forms, with or without119* modification, are permitted provided that the following conditions120* are met:121* 1. Redistributions of source code must retain the above copyright122* notice, this list of conditions, and the following disclaimer,123* without modification.124* 2. Redistributions in binary form must reproduce at minimum a disclaimer125* substantially similar to the "NO WARRANTY" disclaimer below126* ("Disclaimer") and any redistribution must be conditioned upon127* including a substantially similar Disclaimer requirement for further128* binary redistribution.129* 3. Neither the names of the above-listed copyright holders nor the names130* of any contributors may be used to endorse or promote products derived131* from this software without specific prior written permission.132*133* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS134* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT135* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR136* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT137* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,138* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT139* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,140* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY141* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT142* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE143* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.144*145* Alternatively, you may choose to be licensed under the terms of the146* GNU General Public License ("GPL") version 2 as published by the Free147* Software Foundation.148*149*****************************************************************************/150151#define EXPORT_ACPI_INTERFACES152153#include <contrib/dev/acpica/include/acpi.h>154#include <contrib/dev/acpica/include/accommon.h>155156157#define _COMPONENT ACPI_UTILITIES158ACPI_MODULE_NAME ("utxferror")159160/*161* This module is used for the in-kernel ACPICA as well as the ACPICA162* tools/applications.163*/164165#ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */166167/*******************************************************************************168*169* FUNCTION: AcpiError170*171* PARAMETERS: ModuleName - Caller's module name (for error output)172* LineNumber - Caller's line number (for error output)173* Format - Printf format string + additional args174*175* RETURN: None176*177* DESCRIPTION: Print "ACPI Error" message with module/line/version info178*179******************************************************************************/180181void ACPI_INTERNAL_VAR_XFACE182AcpiError (183const char *ModuleName,184UINT32 LineNumber,185const char *Format,186...)187{188va_list ArgList;189190191ACPI_MSG_REDIRECT_BEGIN;192AcpiOsPrintf (ACPI_MSG_ERROR);193194va_start (ArgList, Format);195AcpiOsVprintf (Format, ArgList);196ACPI_MSG_SUFFIX;197va_end (ArgList);198199ACPI_MSG_REDIRECT_END;200}201202ACPI_EXPORT_SYMBOL (AcpiError)203204205/*******************************************************************************206*207* FUNCTION: AcpiException208*209* PARAMETERS: ModuleName - Caller's module name (for error output)210* LineNumber - Caller's line number (for error output)211* Status - Status value to be decoded/formatted212* Format - Printf format string + additional args213*214* RETURN: None215*216* DESCRIPTION: Print an "ACPI Error" message with module/line/version217* info as well as decoded ACPI_STATUS.218*219******************************************************************************/220221void ACPI_INTERNAL_VAR_XFACE222AcpiException (223const char *ModuleName,224UINT32 LineNumber,225ACPI_STATUS Status,226const char *Format,227...)228{229va_list ArgList;230231232ACPI_MSG_REDIRECT_BEGIN;233234/* For AE_OK, just print the message */235236if (ACPI_SUCCESS (Status))237{238AcpiOsPrintf (ACPI_MSG_ERROR);239240}241else242{243AcpiOsPrintf (ACPI_MSG_ERROR "%s, ",244AcpiFormatException (Status));245}246247va_start (ArgList, Format);248AcpiOsVprintf (Format, ArgList);249ACPI_MSG_SUFFIX;250va_end (ArgList);251252ACPI_MSG_REDIRECT_END;253}254255ACPI_EXPORT_SYMBOL (AcpiException)256257258/*******************************************************************************259*260* FUNCTION: AcpiWarning261*262* PARAMETERS: ModuleName - Caller's module name (for warning output)263* LineNumber - Caller's line number (for warning output)264* Format - Printf format string + additional args265*266* RETURN: None267*268* DESCRIPTION: Print "ACPI Warning" message with module/line/version info269*270******************************************************************************/271272void ACPI_INTERNAL_VAR_XFACE273AcpiWarning (274const char *ModuleName,275UINT32 LineNumber,276const char *Format,277...)278{279va_list ArgList;280281282ACPI_MSG_REDIRECT_BEGIN;283AcpiOsPrintf (ACPI_MSG_WARNING);284285va_start (ArgList, Format);286AcpiOsVprintf (Format, ArgList);287ACPI_MSG_SUFFIX;288va_end (ArgList);289290ACPI_MSG_REDIRECT_END;291}292293ACPI_EXPORT_SYMBOL (AcpiWarning)294295296/*******************************************************************************297*298* FUNCTION: AcpiInfo299*300* PARAMETERS: Format - Printf format string + additional args301*302* RETURN: None303*304* DESCRIPTION: Print generic "ACPI:" information message. There is no305* module/line/version info in order to keep the message simple.306*307******************************************************************************/308309void ACPI_INTERNAL_VAR_XFACE310AcpiInfo (311const char *Format,312...)313{314va_list ArgList;315316#ifdef _KERNEL317/* Temporarily hide too verbose printfs. */318if (!bootverbose)319return;320#endif321322ACPI_MSG_REDIRECT_BEGIN;323AcpiOsPrintf (ACPI_MSG_INFO);324325va_start (ArgList, Format);326AcpiOsVprintf (Format, ArgList);327AcpiOsPrintf ("\n");328va_end (ArgList);329330ACPI_MSG_REDIRECT_END;331}332333ACPI_EXPORT_SYMBOL (AcpiInfo)334335336/*******************************************************************************337*338* FUNCTION: AcpiBiosError339*340* PARAMETERS: ModuleName - Caller's module name (for error output)341* LineNumber - Caller's line number (for error output)342* Format - Printf format string + additional args343*344* RETURN: None345*346* DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version347* info348*349******************************************************************************/350351void ACPI_INTERNAL_VAR_XFACE352AcpiBiosError (353const char *ModuleName,354UINT32 LineNumber,355const char *Format,356...)357{358va_list ArgList;359360361ACPI_MSG_REDIRECT_BEGIN;362AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);363364va_start (ArgList, Format);365AcpiOsVprintf (Format, ArgList);366ACPI_MSG_SUFFIX;367va_end (ArgList);368369ACPI_MSG_REDIRECT_END;370}371372ACPI_EXPORT_SYMBOL (AcpiBiosError)373374375/*******************************************************************************376*377* FUNCTION: AcpiBiosException378*379* PARAMETERS: ModuleName - Caller's module name (for error output)380* LineNumber - Caller's line number (for error output)381* Status - Status value to be decoded/formatted382* Format - Printf format string + additional args383*384* RETURN: None385*386* DESCRIPTION: Print an "ACPI Firmware Error" message with module/line/version387* info as well as decoded ACPI_STATUS.388*389******************************************************************************/390391void ACPI_INTERNAL_VAR_XFACE392AcpiBiosException (393const char *ModuleName,394UINT32 LineNumber,395ACPI_STATUS Status,396const char *Format,397...)398{399va_list ArgList;400401402ACPI_MSG_REDIRECT_BEGIN;403404/* For AE_OK, just print the message */405406if (ACPI_SUCCESS (Status))407{408AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);409410}411else412{413AcpiOsPrintf (ACPI_MSG_BIOS_ERROR "%s, ",414AcpiFormatException (Status));415}416417va_start (ArgList, Format);418AcpiOsVprintf (Format, ArgList);419ACPI_MSG_SUFFIX;420va_end (ArgList);421422ACPI_MSG_REDIRECT_END;423}424425ACPI_EXPORT_SYMBOL (AcpiBiosException)426427428/*******************************************************************************429*430* FUNCTION: AcpiBiosWarning431*432* PARAMETERS: ModuleName - Caller's module name (for warning output)433* LineNumber - Caller's line number (for warning output)434* Format - Printf format string + additional args435*436* RETURN: None437*438* DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version439* info440*441******************************************************************************/442443void ACPI_INTERNAL_VAR_XFACE444AcpiBiosWarning (445const char *ModuleName,446UINT32 LineNumber,447const char *Format,448...)449{450va_list ArgList;451452453ACPI_MSG_REDIRECT_BEGIN;454AcpiOsPrintf (ACPI_MSG_BIOS_WARNING);455456va_start (ArgList, Format);457AcpiOsVprintf (Format, ArgList);458ACPI_MSG_SUFFIX;459va_end (ArgList);460461ACPI_MSG_REDIRECT_END;462}463464ACPI_EXPORT_SYMBOL (AcpiBiosWarning)465466#endif /* ACPI_NO_ERROR_MESSAGES */467468469