Skip to content

Commit

Permalink
uacpi: introduce a uacpi_get_aml_bitness helper
Browse files Browse the repository at this point in the history
Signed-off-by: Daniil Tatianin <99danilt@gmail.com>
  • Loading branch information
d-tatianin committed Oct 29, 2024
1 parent df1a8af commit f2c799f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/uacpi/uacpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ uacpi_status uacpi_eval_integer(
const uacpi_args *args, uacpi_u64 *out_value
);

/*
* Get the bitness of the currently loaded AML code according to the DSDT.
*
* Returns either 32 or 64.
*/
uacpi_status uacpi_get_aml_bitness(uacpi_u8 *out_bitness);

/*
* Helpers for entering & leaving ACPI mode. Note that ACPI mode is entered
* automatically during the call to uacpi_initialize().
Expand Down
8 changes: 8 additions & 0 deletions source/uacpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,3 +705,11 @@ uacpi_status uacpi_eval_integer(

return UACPI_STATUS_OK;
}

uacpi_status uacpi_get_aml_bitness(uacpi_u8 *out_bitness)
{
UACPI_ENSURE_INIT_LEVEL_AT_LEAST(UACPI_INIT_LEVEL_SUBSYSTEM_INITIALIZED);

*out_bitness = g_uacpi_rt_ctx.is_rev1 ? 32 : 64;
return UACPI_STATUS_OK;
}

0 comments on commit f2c799f

Please sign in to comment.