19b0d045cSFredrik Holmqvist /******************************************************************************
29b0d045cSFredrik Holmqvist *
39b0d045cSFredrik Holmqvist * Module Name: utxfinit - External interfaces for ACPICA initialization
49b0d045cSFredrik Holmqvist *
59b0d045cSFredrik Holmqvist *****************************************************************************/
69b0d045cSFredrik Holmqvist
79b0d045cSFredrik Holmqvist /******************************************************************************
89b0d045cSFredrik Holmqvist *
99b0d045cSFredrik Holmqvist * 1. Copyright Notice
109b0d045cSFredrik Holmqvist *
11*6dde014fSPulkoMandy * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
129b0d045cSFredrik Holmqvist * All rights reserved.
139b0d045cSFredrik Holmqvist *
149b0d045cSFredrik Holmqvist * 2. License
159b0d045cSFredrik Holmqvist *
169b0d045cSFredrik Holmqvist * 2.1. This is your license from Intel Corp. under its intellectual property
179b0d045cSFredrik Holmqvist * rights. You may have additional license terms from the party that provided
189b0d045cSFredrik Holmqvist * you this software, covering your right to use that party's intellectual
199b0d045cSFredrik Holmqvist * property rights.
209b0d045cSFredrik Holmqvist *
219b0d045cSFredrik Holmqvist * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
229b0d045cSFredrik Holmqvist * copy of the source code appearing in this file ("Covered Code") an
239b0d045cSFredrik Holmqvist * irrevocable, perpetual, worldwide license under Intel's copyrights in the
249b0d045cSFredrik Holmqvist * base code distributed originally by Intel ("Original Intel Code") to copy,
259b0d045cSFredrik Holmqvist * make derivatives, distribute, use and display any portion of the Covered
269b0d045cSFredrik Holmqvist * Code in any form, with the right to sublicense such rights; and
279b0d045cSFredrik Holmqvist *
289b0d045cSFredrik Holmqvist * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
299b0d045cSFredrik Holmqvist * license (with the right to sublicense), under only those claims of Intel
309b0d045cSFredrik Holmqvist * patents that are infringed by the Original Intel Code, to make, use, sell,
319b0d045cSFredrik Holmqvist * offer to sell, and import the Covered Code and derivative works thereof
329b0d045cSFredrik Holmqvist * solely to the minimum extent necessary to exercise the above copyright
339b0d045cSFredrik Holmqvist * license, and in no event shall the patent license extend to any additions
349b0d045cSFredrik Holmqvist * to or modifications of the Original Intel Code. No other license or right
359b0d045cSFredrik Holmqvist * is granted directly or by implication, estoppel or otherwise;
369b0d045cSFredrik Holmqvist *
379b0d045cSFredrik Holmqvist * The above copyright and patent license is granted only if the following
389b0d045cSFredrik Holmqvist * conditions are met:
399b0d045cSFredrik Holmqvist *
409b0d045cSFredrik Holmqvist * 3. Conditions
419b0d045cSFredrik Holmqvist *
429b0d045cSFredrik Holmqvist * 3.1. Redistribution of Source with Rights to Further Distribute Source.
439b0d045cSFredrik Holmqvist * Redistribution of source code of any substantial portion of the Covered
449b0d045cSFredrik Holmqvist * Code or modification with rights to further distribute source must include
459b0d045cSFredrik Holmqvist * the above Copyright Notice, the above License, this list of Conditions,
469b0d045cSFredrik Holmqvist * and the following Disclaimer and Export Compliance provision. In addition,
479b0d045cSFredrik Holmqvist * Licensee must cause all Covered Code to which Licensee contributes to
489b0d045cSFredrik Holmqvist * contain a file documenting the changes Licensee made to create that Covered
499b0d045cSFredrik Holmqvist * Code and the date of any change. Licensee must include in that file the
509b0d045cSFredrik Holmqvist * documentation of any changes made by any predecessor Licensee. Licensee
519b0d045cSFredrik Holmqvist * must include a prominent statement that the modification is derived,
529b0d045cSFredrik Holmqvist * directly or indirectly, from Original Intel Code.
539b0d045cSFredrik Holmqvist *
549b0d045cSFredrik Holmqvist * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
559b0d045cSFredrik Holmqvist * Redistribution of source code of any substantial portion of the Covered
569b0d045cSFredrik Holmqvist * Code or modification without rights to further distribute source must
579b0d045cSFredrik Holmqvist * include the following Disclaimer and Export Compliance provision in the
589b0d045cSFredrik Holmqvist * documentation and/or other materials provided with distribution. In
599b0d045cSFredrik Holmqvist * addition, Licensee may not authorize further sublicense of source of any
609b0d045cSFredrik Holmqvist * portion of the Covered Code, and must include terms to the effect that the
619b0d045cSFredrik Holmqvist * license from Licensee to its licensee is limited to the intellectual
629b0d045cSFredrik Holmqvist * property embodied in the software Licensee provides to its licensee, and
639b0d045cSFredrik Holmqvist * not to intellectual property embodied in modifications its licensee may
649b0d045cSFredrik Holmqvist * make.
659b0d045cSFredrik Holmqvist *
669b0d045cSFredrik Holmqvist * 3.3. Redistribution of Executable. Redistribution in executable form of any
679b0d045cSFredrik Holmqvist * substantial portion of the Covered Code or modification must reproduce the
689b0d045cSFredrik Holmqvist * above Copyright Notice, and the following Disclaimer and Export Compliance
699b0d045cSFredrik Holmqvist * provision in the documentation and/or other materials provided with the
709b0d045cSFredrik Holmqvist * distribution.
719b0d045cSFredrik Holmqvist *
729b0d045cSFredrik Holmqvist * 3.4. Intel retains all right, title, and interest in and to the Original
739b0d045cSFredrik Holmqvist * Intel Code.
749b0d045cSFredrik Holmqvist *
759b0d045cSFredrik Holmqvist * 3.5. Neither the name Intel nor any other trademark owned or controlled by
769b0d045cSFredrik Holmqvist * Intel shall be used in advertising or otherwise to promote the sale, use or
779b0d045cSFredrik Holmqvist * other dealings in products derived from or relating to the Covered Code
789b0d045cSFredrik Holmqvist * without prior written authorization from Intel.
799b0d045cSFredrik Holmqvist *
809b0d045cSFredrik Holmqvist * 4. Disclaimer and Export Compliance
819b0d045cSFredrik Holmqvist *
829b0d045cSFredrik Holmqvist * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
839b0d045cSFredrik Holmqvist * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
849b0d045cSFredrik Holmqvist * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
859b0d045cSFredrik Holmqvist * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
869b0d045cSFredrik Holmqvist * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
879b0d045cSFredrik Holmqvist * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
889b0d045cSFredrik Holmqvist * PARTICULAR PURPOSE.
899b0d045cSFredrik Holmqvist *
909b0d045cSFredrik Holmqvist * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
919b0d045cSFredrik Holmqvist * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
929b0d045cSFredrik Holmqvist * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
939b0d045cSFredrik Holmqvist * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
949b0d045cSFredrik Holmqvist * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
959b0d045cSFredrik Holmqvist * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
969b0d045cSFredrik Holmqvist * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
979b0d045cSFredrik Holmqvist * LIMITED REMEDY.
989b0d045cSFredrik Holmqvist *
999b0d045cSFredrik Holmqvist * 4.3. Licensee shall not export, either directly or indirectly, any of this
1009b0d045cSFredrik Holmqvist * software or system incorporating such software without first obtaining any
1019b0d045cSFredrik Holmqvist * required license or other approval from the U. S. Department of Commerce or
1029b0d045cSFredrik Holmqvist * any other agency or department of the United States Government. In the
1039b0d045cSFredrik Holmqvist * event Licensee exports any such software from the United States or
1049b0d045cSFredrik Holmqvist * re-exports any such software from a foreign destination, Licensee shall
1059b0d045cSFredrik Holmqvist * ensure that the distribution and export/re-export of the software is in
1069b0d045cSFredrik Holmqvist * compliance with all laws, regulations, orders, or other restrictions of the
1079b0d045cSFredrik Holmqvist * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1089b0d045cSFredrik Holmqvist * any of its subsidiaries will export/re-export any technical data, process,
1099b0d045cSFredrik Holmqvist * software, or service, directly or indirectly, to any country for which the
1109b0d045cSFredrik Holmqvist * United States government or any agency thereof requires an export license,
1119b0d045cSFredrik Holmqvist * other governmental approval, or letter of assurance, without first obtaining
1129b0d045cSFredrik Holmqvist * such license, approval or letter.
1139b0d045cSFredrik Holmqvist *
114ff2e2f81SFredrik Holmqvist *****************************************************************************
115ff2e2f81SFredrik Holmqvist *
116ff2e2f81SFredrik Holmqvist * Alternatively, you may choose to be licensed under the terms of the
117ff2e2f81SFredrik Holmqvist * following license:
118ff2e2f81SFredrik Holmqvist *
119ff2e2f81SFredrik Holmqvist * Redistribution and use in source and binary forms, with or without
120ff2e2f81SFredrik Holmqvist * modification, are permitted provided that the following conditions
121ff2e2f81SFredrik Holmqvist * are met:
122ff2e2f81SFredrik Holmqvist * 1. Redistributions of source code must retain the above copyright
123ff2e2f81SFredrik Holmqvist * notice, this list of conditions, and the following disclaimer,
124ff2e2f81SFredrik Holmqvist * without modification.
125ff2e2f81SFredrik Holmqvist * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126ff2e2f81SFredrik Holmqvist * substantially similar to the "NO WARRANTY" disclaimer below
127ff2e2f81SFredrik Holmqvist * ("Disclaimer") and any redistribution must be conditioned upon
128ff2e2f81SFredrik Holmqvist * including a substantially similar Disclaimer requirement for further
129ff2e2f81SFredrik Holmqvist * binary redistribution.
130ff2e2f81SFredrik Holmqvist * 3. Neither the names of the above-listed copyright holders nor the names
131ff2e2f81SFredrik Holmqvist * of any contributors may be used to endorse or promote products derived
132ff2e2f81SFredrik Holmqvist * from this software without specific prior written permission.
133ff2e2f81SFredrik Holmqvist *
134ff2e2f81SFredrik Holmqvist * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135ff2e2f81SFredrik Holmqvist * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136ff2e2f81SFredrik Holmqvist * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137ff2e2f81SFredrik Holmqvist * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138ff2e2f81SFredrik Holmqvist * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139ff2e2f81SFredrik Holmqvist * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140ff2e2f81SFredrik Holmqvist * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141ff2e2f81SFredrik Holmqvist * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142ff2e2f81SFredrik Holmqvist * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143ff2e2f81SFredrik Holmqvist * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144ff2e2f81SFredrik Holmqvist * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145ff2e2f81SFredrik Holmqvist *
146ff2e2f81SFredrik Holmqvist * Alternatively, you may choose to be licensed under the terms of the
147ff2e2f81SFredrik Holmqvist * GNU General Public License ("GPL") version 2 as published by the Free
148ff2e2f81SFredrik Holmqvist * Software Foundation.
149ff2e2f81SFredrik Holmqvist *
1509b0d045cSFredrik Holmqvist *****************************************************************************/
1519b0d045cSFredrik Holmqvist
152ad5bbfb8SFredrik Holmqvist #define EXPORT_ACPI_INTERFACES
1539b0d045cSFredrik Holmqvist
1549b0d045cSFredrik Holmqvist #include "acpi.h"
1559b0d045cSFredrik Holmqvist #include "accommon.h"
1569b0d045cSFredrik Holmqvist #include "acevents.h"
1579b0d045cSFredrik Holmqvist #include "acnamesp.h"
1589b0d045cSFredrik Holmqvist #include "acdebug.h"
1599b0d045cSFredrik Holmqvist #include "actables.h"
1609b0d045cSFredrik Holmqvist
1619b0d045cSFredrik Holmqvist #define _COMPONENT ACPI_UTILITIES
1629b0d045cSFredrik Holmqvist ACPI_MODULE_NAME ("utxfinit")
1639b0d045cSFredrik Holmqvist
164e226d1d0SFredrik Holmqvist /* For AcpiExec only */
165e226d1d0SFredrik Holmqvist void
166e226d1d0SFredrik Holmqvist AeDoObjectOverrides (
167e226d1d0SFredrik Holmqvist void);
168e226d1d0SFredrik Holmqvist
1699b0d045cSFredrik Holmqvist
1709b0d045cSFredrik Holmqvist /*******************************************************************************
1719b0d045cSFredrik Holmqvist *
1729b0d045cSFredrik Holmqvist * FUNCTION: AcpiInitializeSubsystem
1739b0d045cSFredrik Holmqvist *
1749b0d045cSFredrik Holmqvist * PARAMETERS: None
1759b0d045cSFredrik Holmqvist *
1769b0d045cSFredrik Holmqvist * RETURN: Status
1779b0d045cSFredrik Holmqvist *
1789b0d045cSFredrik Holmqvist * DESCRIPTION: Initializes all global variables. This is the first function
1799b0d045cSFredrik Holmqvist * called, so any early initialization belongs here.
1809b0d045cSFredrik Holmqvist *
1819b0d045cSFredrik Holmqvist ******************************************************************************/
1829b0d045cSFredrik Holmqvist
18374ffd18dSFredrik Holmqvist ACPI_STATUS ACPI_INIT_FUNCTION
AcpiInitializeSubsystem(void)1849b0d045cSFredrik Holmqvist AcpiInitializeSubsystem (
1859b0d045cSFredrik Holmqvist void)
1869b0d045cSFredrik Holmqvist {
1879b0d045cSFredrik Holmqvist ACPI_STATUS Status;
1889b0d045cSFredrik Holmqvist
1899b0d045cSFredrik Holmqvist
1909b0d045cSFredrik Holmqvist ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem);
1919b0d045cSFredrik Holmqvist
1929b0d045cSFredrik Holmqvist
1939b0d045cSFredrik Holmqvist AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE;
1949b0d045cSFredrik Holmqvist ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
1959b0d045cSFredrik Holmqvist
1969b0d045cSFredrik Holmqvist /* Initialize the OS-Dependent layer */
1979b0d045cSFredrik Holmqvist
1989b0d045cSFredrik Holmqvist Status = AcpiOsInitialize ();
1999b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
2009b0d045cSFredrik Holmqvist {
2019b0d045cSFredrik Holmqvist ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization"));
2029b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
2039b0d045cSFredrik Holmqvist }
2049b0d045cSFredrik Holmqvist
2059b0d045cSFredrik Holmqvist /* Initialize all globals used by the subsystem */
2069b0d045cSFredrik Holmqvist
2079b0d045cSFredrik Holmqvist Status = AcpiUtInitGlobals ();
2089b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
2099b0d045cSFredrik Holmqvist {
2109b0d045cSFredrik Holmqvist ACPI_EXCEPTION ((AE_INFO, Status, "During initialization of globals"));
2119b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
2129b0d045cSFredrik Holmqvist }
2139b0d045cSFredrik Holmqvist
2149b0d045cSFredrik Holmqvist /* Create the default mutex objects */
2159b0d045cSFredrik Holmqvist
2169b0d045cSFredrik Holmqvist Status = AcpiUtMutexInitialize ();
2179b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
2189b0d045cSFredrik Holmqvist {
2199b0d045cSFredrik Holmqvist ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation"));
2209b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
2219b0d045cSFredrik Holmqvist }
2229b0d045cSFredrik Holmqvist
2239b0d045cSFredrik Holmqvist /*
2249b0d045cSFredrik Holmqvist * Initialize the namespace manager and
2259b0d045cSFredrik Holmqvist * the root of the namespace tree
2269b0d045cSFredrik Holmqvist */
2279b0d045cSFredrik Holmqvist Status = AcpiNsRootInitialize ();
2289b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
2299b0d045cSFredrik Holmqvist {
2309b0d045cSFredrik Holmqvist ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization"));
2319b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
2329b0d045cSFredrik Holmqvist }
2339b0d045cSFredrik Holmqvist
2349b0d045cSFredrik Holmqvist /* Initialize the global OSI interfaces list with the static names */
2359b0d045cSFredrik Holmqvist
2369b0d045cSFredrik Holmqvist Status = AcpiUtInitializeInterfaces ();
2379b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
2389b0d045cSFredrik Holmqvist {
2399b0d045cSFredrik Holmqvist ACPI_EXCEPTION ((AE_INFO, Status, "During OSI interfaces initialization"));
2409b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
2419b0d045cSFredrik Holmqvist }
2429b0d045cSFredrik Holmqvist
243ad5bbfb8SFredrik Holmqvist return_ACPI_STATUS (AE_OK);
244ad5bbfb8SFredrik Holmqvist }
245ad5bbfb8SFredrik Holmqvist
ACPI_EXPORT_SYMBOL_INIT(AcpiInitializeSubsystem)246ad5bbfb8SFredrik Holmqvist ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeSubsystem)
2479b0d045cSFredrik Holmqvist
2489b0d045cSFredrik Holmqvist
2499b0d045cSFredrik Holmqvist /*******************************************************************************
2509b0d045cSFredrik Holmqvist *
2519b0d045cSFredrik Holmqvist * FUNCTION: AcpiEnableSubsystem
2529b0d045cSFredrik Holmqvist *
2539b0d045cSFredrik Holmqvist * PARAMETERS: Flags - Init/enable Options
2549b0d045cSFredrik Holmqvist *
2559b0d045cSFredrik Holmqvist * RETURN: Status
2569b0d045cSFredrik Holmqvist *
2579b0d045cSFredrik Holmqvist * DESCRIPTION: Completes the subsystem initialization including hardware.
2589b0d045cSFredrik Holmqvist * Puts system into ACPI mode if it isn't already.
2599b0d045cSFredrik Holmqvist *
2609b0d045cSFredrik Holmqvist ******************************************************************************/
2619b0d045cSFredrik Holmqvist
26274ffd18dSFredrik Holmqvist ACPI_STATUS ACPI_INIT_FUNCTION
2639b0d045cSFredrik Holmqvist AcpiEnableSubsystem (
2649b0d045cSFredrik Holmqvist UINT32 Flags)
2659b0d045cSFredrik Holmqvist {
2669b0d045cSFredrik Holmqvist ACPI_STATUS Status = AE_OK;
2679b0d045cSFredrik Holmqvist
2689b0d045cSFredrik Holmqvist
2699b0d045cSFredrik Holmqvist ACPI_FUNCTION_TRACE (AcpiEnableSubsystem);
2709b0d045cSFredrik Holmqvist
2719b0d045cSFredrik Holmqvist
272b64e8511SFredrik Holmqvist /*
273b64e8511SFredrik Holmqvist * The early initialization phase is complete. The namespace is loaded,
274b64e8511SFredrik Holmqvist * and we can now support address spaces other than Memory, I/O, and
275b64e8511SFredrik Holmqvist * PCI_Config.
276b64e8511SFredrik Holmqvist */
277b64e8511SFredrik Holmqvist AcpiGbl_EarlyInitialization = FALSE;
278b64e8511SFredrik Holmqvist
2799b0d045cSFredrik Holmqvist #if (!ACPI_REDUCED_HARDWARE)
2809b0d045cSFredrik Holmqvist
2819b0d045cSFredrik Holmqvist /* Enable ACPI mode */
2829b0d045cSFredrik Holmqvist
2839b0d045cSFredrik Holmqvist if (!(Flags & ACPI_NO_ACPI_ENABLE))
2849b0d045cSFredrik Holmqvist {
2859b0d045cSFredrik Holmqvist ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Going into ACPI mode\n"));
2869b0d045cSFredrik Holmqvist
2879b0d045cSFredrik Holmqvist AcpiGbl_OriginalMode = AcpiHwGetMode();
2889b0d045cSFredrik Holmqvist
2899b0d045cSFredrik Holmqvist Status = AcpiEnable ();
2909b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
2919b0d045cSFredrik Holmqvist {
2929b0d045cSFredrik Holmqvist ACPI_WARNING ((AE_INFO, "AcpiEnable failed"));
2939b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
2949b0d045cSFredrik Holmqvist }
2959b0d045cSFredrik Holmqvist }
2969b0d045cSFredrik Holmqvist
2979b0d045cSFredrik Holmqvist /*
2989b0d045cSFredrik Holmqvist * Obtain a permanent mapping for the FACS. This is required for the
2999b0d045cSFredrik Holmqvist * Global Lock and the Firmware Waking Vector
3009b0d045cSFredrik Holmqvist */
301e226d1d0SFredrik Holmqvist if (!(Flags & ACPI_NO_FACS_INIT))
302e226d1d0SFredrik Holmqvist {
3039b0d045cSFredrik Holmqvist Status = AcpiTbInitializeFacs ();
3049b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
3059b0d045cSFredrik Holmqvist {
3069b0d045cSFredrik Holmqvist ACPI_WARNING ((AE_INFO, "Could not map the FACS table"));
3079b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
3089b0d045cSFredrik Holmqvist }
309e226d1d0SFredrik Holmqvist }
3109b0d045cSFredrik Holmqvist
3119b0d045cSFredrik Holmqvist /*
3129b0d045cSFredrik Holmqvist * Initialize ACPI Event handling (Fixed and General Purpose)
3139b0d045cSFredrik Holmqvist *
3149b0d045cSFredrik Holmqvist * Note1: We must have the hardware and events initialized before we can
3159b0d045cSFredrik Holmqvist * execute any control methods safely. Any control method can require
3169b0d045cSFredrik Holmqvist * ACPI hardware support, so the hardware must be fully initialized before
3179b0d045cSFredrik Holmqvist * any method execution!
3189b0d045cSFredrik Holmqvist *
3199b0d045cSFredrik Holmqvist * Note2: Fixed events are initialized and enabled here. GPEs are
3209b0d045cSFredrik Holmqvist * initialized, but cannot be enabled until after the hardware is
3219b0d045cSFredrik Holmqvist * completely initialized (SCI and GlobalLock activated) and the various
3229b0d045cSFredrik Holmqvist * initialization control methods are run (_REG, _STA, _INI) on the
3239b0d045cSFredrik Holmqvist * entire namespace.
3249b0d045cSFredrik Holmqvist */
3259b0d045cSFredrik Holmqvist if (!(Flags & ACPI_NO_EVENT_INIT))
3269b0d045cSFredrik Holmqvist {
3279b0d045cSFredrik Holmqvist ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
3289b0d045cSFredrik Holmqvist "[Init] Initializing ACPI events\n"));
3299b0d045cSFredrik Holmqvist
3309b0d045cSFredrik Holmqvist Status = AcpiEvInitializeEvents ();
3319b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
3329b0d045cSFredrik Holmqvist {
3339b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
3349b0d045cSFredrik Holmqvist }
3359b0d045cSFredrik Holmqvist }
3369b0d045cSFredrik Holmqvist
3379b0d045cSFredrik Holmqvist /*
3389b0d045cSFredrik Holmqvist * Install the SCI handler and Global Lock handler. This completes the
3399b0d045cSFredrik Holmqvist * hardware initialization.
3409b0d045cSFredrik Holmqvist */
3419b0d045cSFredrik Holmqvist if (!(Flags & ACPI_NO_HANDLER_INIT))
3429b0d045cSFredrik Holmqvist {
3439b0d045cSFredrik Holmqvist ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
3449b0d045cSFredrik Holmqvist "[Init] Installing SCI/GL handlers\n"));
3459b0d045cSFredrik Holmqvist
3469b0d045cSFredrik Holmqvist Status = AcpiEvInstallXruptHandlers ();
3479b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
3489b0d045cSFredrik Holmqvist {
3499b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
3509b0d045cSFredrik Holmqvist }
3519b0d045cSFredrik Holmqvist }
3529b0d045cSFredrik Holmqvist
3539b0d045cSFredrik Holmqvist #endif /* !ACPI_REDUCED_HARDWARE */
3549b0d045cSFredrik Holmqvist
3559b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
3569b0d045cSFredrik Holmqvist }
3579b0d045cSFredrik Holmqvist
ACPI_EXPORT_SYMBOL_INIT(AcpiEnableSubsystem)358ad5bbfb8SFredrik Holmqvist ACPI_EXPORT_SYMBOL_INIT (AcpiEnableSubsystem)
3599b0d045cSFredrik Holmqvist
3609b0d045cSFredrik Holmqvist
3619b0d045cSFredrik Holmqvist /*******************************************************************************
3629b0d045cSFredrik Holmqvist *
3639b0d045cSFredrik Holmqvist * FUNCTION: AcpiInitializeObjects
3649b0d045cSFredrik Holmqvist *
3659b0d045cSFredrik Holmqvist * PARAMETERS: Flags - Init/enable Options
3669b0d045cSFredrik Holmqvist *
3679b0d045cSFredrik Holmqvist * RETURN: Status
3689b0d045cSFredrik Holmqvist *
3699b0d045cSFredrik Holmqvist * DESCRIPTION: Completes namespace initialization by initializing device
3709b0d045cSFredrik Holmqvist * objects and executing AML code for Regions, buffers, etc.
3719b0d045cSFredrik Holmqvist *
3729b0d045cSFredrik Holmqvist ******************************************************************************/
3739b0d045cSFredrik Holmqvist
37474ffd18dSFredrik Holmqvist ACPI_STATUS ACPI_INIT_FUNCTION
3759b0d045cSFredrik Holmqvist AcpiInitializeObjects (
3769b0d045cSFredrik Holmqvist UINT32 Flags)
3779b0d045cSFredrik Holmqvist {
3789b0d045cSFredrik Holmqvist ACPI_STATUS Status = AE_OK;
3799b0d045cSFredrik Holmqvist
3809b0d045cSFredrik Holmqvist
3819b0d045cSFredrik Holmqvist ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
3829b0d045cSFredrik Holmqvist
3839b0d045cSFredrik Holmqvist
3840ffed378SFredrik Holmqvist #ifdef ACPI_OBSOLETE_BEHAVIOR
385e226d1d0SFredrik Holmqvist /*
3860ffed378SFredrik Holmqvist * 05/2019: Removed, initialization now happens at both object
3870ffed378SFredrik Holmqvist * creation and table load time
3889b0d045cSFredrik Holmqvist */
3899b0d045cSFredrik Holmqvist
3909b0d045cSFredrik Holmqvist /*
39174ffd18dSFredrik Holmqvist * Initialize the objects that remain uninitialized. This
39274ffd18dSFredrik Holmqvist * runs the executable AML that may be part of the
3930ffed378SFredrik Holmqvist * declaration of these objects: OperationRegions, BufferFields,
3940ffed378SFredrik Holmqvist * BankFields, Buffers, and Packages.
3959b0d045cSFredrik Holmqvist */
3969b0d045cSFredrik Holmqvist if (!(Flags & ACPI_NO_OBJECT_INIT))
3979b0d045cSFredrik Holmqvist {
3989b0d045cSFredrik Holmqvist Status = AcpiNsInitializeObjects ();
3999b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
4009b0d045cSFredrik Holmqvist {
4019b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
4029b0d045cSFredrik Holmqvist }
4039b0d045cSFredrik Holmqvist }
4040ffed378SFredrik Holmqvist #endif
4059b0d045cSFredrik Holmqvist
4069b0d045cSFredrik Holmqvist /*
40774ffd18dSFredrik Holmqvist * Initialize all device/region objects in the namespace. This runs
40874ffd18dSFredrik Holmqvist * the device _STA and _INI methods and region _REG methods.
4099b0d045cSFredrik Holmqvist */
41074ffd18dSFredrik Holmqvist if (!(Flags & (ACPI_NO_DEVICE_INIT | ACPI_NO_ADDRESS_SPACE_INIT)))
4119b0d045cSFredrik Holmqvist {
41274ffd18dSFredrik Holmqvist Status = AcpiNsInitializeDevices (Flags);
4139b0d045cSFredrik Holmqvist if (ACPI_FAILURE (Status))
4149b0d045cSFredrik Holmqvist {
4159b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
4169b0d045cSFredrik Holmqvist }
4179b0d045cSFredrik Holmqvist }
4189b0d045cSFredrik Holmqvist
4199b0d045cSFredrik Holmqvist /*
4209b0d045cSFredrik Holmqvist * Empty the caches (delete the cached objects) on the assumption that
4219b0d045cSFredrik Holmqvist * the table load filled them up more than they will be at runtime --
4229b0d045cSFredrik Holmqvist * thus wasting non-paged memory.
4239b0d045cSFredrik Holmqvist */
4249b0d045cSFredrik Holmqvist Status = AcpiPurgeCachedObjects ();
4259b0d045cSFredrik Holmqvist
4269b0d045cSFredrik Holmqvist AcpiGbl_StartupFlags |= ACPI_INITIALIZED_OK;
4279b0d045cSFredrik Holmqvist return_ACPI_STATUS (Status);
4289b0d045cSFredrik Holmqvist }
4299b0d045cSFredrik Holmqvist
430ad5bbfb8SFredrik Holmqvist ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeObjects)
431