@@ -425,38 +425,6 @@ int init_acpi(void) {
425425
426426/* ACPI initialization and termination functions */
427427
428- static ACPI_STATUS InitializeFullAcpi (void ) {
429- ACPI_STATUS status ;
430-
431- /* Initialize the ACPICA subsystem */
432- status = AcpiInitializeSubsystem ();
433- if (ACPI_FAILURE (status ))
434- return status ;
435-
436- /* Initialize the ACPICA Table Manager and get all ACPI tables */
437- status = AcpiInitializeTables (NULL , 16 , true);
438- if (ACPI_FAILURE (status ))
439- return status ;
440-
441- /* Create the ACPI namespace from ACPI tables */
442- status = AcpiLoadTables ();
443- if (ACPI_FAILURE (status ))
444- return status ;
445-
446- /* Note: Local handlers should be installed here */
447- /* Initialize the ACPI hardware */
448- status = AcpiEnableSubsystem (ACPI_FULL_INITIALIZATION );
449- if (ACPI_FAILURE (status ))
450- return status ;
451-
452- /* Complete the ACPI namespace object initialization */
453- status = AcpiInitializeObjects (ACPI_FULL_INITIALIZATION );
454- if (ACPI_FAILURE (status ))
455- return status ;
456-
457- return AE_OK ;
458- }
459-
460428static void madt_parser (ACPI_SUBTABLE_HEADER * entry , void * arg ) {
461429 bus_t * isa_bus =
462430 add_system_bus (ACPI_MADT_INT_BUS_ISA , madt_int_bus_names [ACPI_MADT_INT_BUS_ISA ],
@@ -713,18 +681,52 @@ ACPI_STATUS init_acpi(void) {
713681
714682 printk ("Initializing ACPI support\n" );
715683
716- status = InitializeFullAcpi ();
717- if (status != AE_OK )
684+ /* Initialize the ACPICA subsystem */
685+ status = AcpiInitializeSubsystem ();
686+ if (ACPI_FAILURE (status ))
687+ return status ;
688+
689+ /* Initialize the ACPICA Table Manager and get all ACPI tables */
690+ status = AcpiInitializeTables (NULL , 16 , true);
691+ if (ACPI_FAILURE (status ))
692+ return status ;
693+
694+ /* Create the ACPI namespace from ACPI tables */
695+ status = AcpiLoadTables ();
696+ if (ACPI_FAILURE (status ))
718697 return status ;
719698
720699 status = init_fadt ();
721- if (status != AE_OK )
700+ if (ACPI_FAILURE ( status ) )
722701 return status ;
723702
724703 status = init_madt ();
725704 return status ;
726705}
727706
707+ ACPI_STATUS init_acpi_finalize (void ) {
708+ ACPI_STATUS status ;
709+
710+ printk ("Initializing ACPI finalize\n" );
711+
712+ /* Note: Local handlers should be installed here */
713+ /* Initialize the ACPI hardware */
714+ status = AcpiEnableSubsystem (ACPI_FULL_INITIALIZATION );
715+ if (ACPI_FAILURE (status ))
716+ return status ;
717+
718+ /* Complete the ACPI namespace object initialization */
719+ status = AcpiInitializeObjects (ACPI_FULL_INITIALIZATION );
720+ if (ACPI_FAILURE (status ))
721+ return status ;
722+
723+ status = AcpiUpdateAllGpes ();
724+ if (ACPI_FAILURE (status ))
725+ return status ;
726+
727+ return AE_OK ;
728+ }
729+
728730void acpi_power_off (void ) {
729731 AcpiEnterSleepStatePrep (ACPI_STATE_S5 );
730732 interrupts_disable ();
0 commit comments