PatchworkOS
Loading...
Searching...
No Matches
Devices

Device and Power Management. More...

Macros

#define ACPI_STA_FLAGS_DEFAULT   (ACPI_STA_PRESENT | ACPI_STA_ENABLED | ACPI_STA_SHOW_IN_UI | ACPI_STA_FUNCTIONAL)
 Default _STA flags if the _STA method does not exist.
 

Enumerations

enum  acpi_sta_flags_t {
  ACPI_STA_PRESENT = 1 << 0 ,
  ACPI_STA_ENABLED = 1 << 1 ,
  ACPI_STA_SHOW_IN_UI = 1 << 2 ,
  ACPI_STA_FUNCTIONAL ,
  ACPI_STA_BATTERY_PRESENT = 1 << 4
}
 Flags for the _STA method. More...
 

Functions

void acpi_devices_init (void)
 Enumerate and configure ACPI devices.
 

Detailed Description

Device and Power Management.

Handles enumeration and configuration of ACPI devices, along with dynamic loading of device drivers based on ACPI IDs.

TODO: Implement hotplugging support.

Macro Definition Documentation

◆ ACPI_STA_FLAGS_DEFAULT

#define ACPI_STA_FLAGS_DEFAULT   (ACPI_STA_PRESENT | ACPI_STA_ENABLED | ACPI_STA_SHOW_IN_UI | ACPI_STA_FUNCTIONAL)

Default _STA flags if the _STA method does not exist.

If the _STA method does not exist, the device is assumed to be present, enabled, shown in the UI and functioning.

See also
Section 6.3.7 of the ACPI specification for more details.

Definition at line 42 of file devices.h.

Enumeration Type Documentation

◆ acpi_sta_flags_t

Flags for the _STA method.

See also
Section 6.3.7 of the ACPI specification for more details.
Enumerator
ACPI_STA_PRESENT 

Set if the device is present.

ACPI_STA_ENABLED 

Set if the device is enabled and decoding its resources.

ACPI_STA_SHOW_IN_UI 

Set if the device should be shown in the UI.

ACPI_STA_FUNCTIONAL 

Set if the device is functioning properly (cleared if device failed its diagnostics)

ACPI_STA_BATTERY_PRESENT 

Set if a battery is present.

Definition at line 25 of file devices.h.

Function Documentation

◆ acpi_devices_init()

void acpi_devices_init ( void  )

Enumerate and configure ACPI devices.

This function always evaluates the _SB._INI node if it exists, enumerates ACPI devices (found under _SB), evaulates their _STA object retrieving its present and functional status (if it exists) and then evaluates their _INI object acording to these rules:

  • If the _INI object does not exist it is ignored.
  • If the _STA object does not exist the device is assumed to be present and functional
  • If the _STA object does exist its status is read.
  • Depending on the status returned by _STA or assumed, the device is treated in one of four ways:
    • If the device is not present and not functional, the device is ignored.
    • If the device is not present and functional, the device's _INI is ignored but its children are enumerated.
    • If the device is present and not functional, the device's _INI is evaluated and its children are enumerated.
    • If the device is present and functional, the device's _INI is evaluated and its children are enumerated.
See also
Section 6.5.1 of the ACPI specification for more details.

Definition at line 98 of file devices.c.

References acpi_devices_init_children(), aml_big_mutex_get(), AML_METHOD, aml_method_evaluate_integer(), AML_NAME, aml_namespace_find(), aml_namespace_find_child(), aml_state_deinit(), aml_state_init(), aml_type_to_string(), DEREF_DEFER, ERR, LOG_ERR, LOG_INFO, MUTEX_SCOPE, NULL, and panic().

Referenced by init_finalize().