update shell and test app with the modifed resource struct such as
acpi_irq_resource and acpi_mmio_resource
Signed-off-by: Najumon B.A <najumon.ba@intel.com>
add resource enumeration and acpi method shell commands such as
retrieve mmio and interrupt resources.
Signed-off-by: Najumon B.A <najumon.ba@intel.com>
All x86 boards have so far set a custom heap memory pool size because of
their dependency on ACPI. It makes more sense to introduce a new
ACPI-specific option, utilizing the recently added
HEAP_MEM_POOL_ADD_SIZE_ Kconfig option prefix, and adjust the default
value as necessary for each board.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Add function walking though all DMAR subtables, at the moment only
first subtable is taking into account, which causes bugs for some
boards.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Do not enable subsystem/driver shell modules by default and stop abusing
CONFIG_SHELL_MINIMAL, which is internal to the shell subsystem, to decide
when to enable a driver shell.
The list of shell modules has grown considerably through the
years. Enabling CONFIG_SHELL for doing e.g. an interactive debug session
leads to a large number of shell modules also being enabled unless
explicitly disabled, which again leads to non-negligible increases in
RAM/ROM usage.
This commit attempts to establish a policy of subsystem/driver shell
modules being disabled by default, requiring the user/application to
explicitly enable only those needed.
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
The ACPI table signature is not null terminated, so a precision needs to
be provided in format strings. There was an attempt to do this, but it
was done in an incorrect way, which resulted in garbage characters
getting printed.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
For most types, ACPICA provides both a struct name as well as a typedef.
The struct names follow the exact same naming style as Zephyr's ACPI
API, which makes it impossible to distinguish which type is defined by
Zephyr and which comes from ACPICA. It's therefore better to use the
typedefs, since they follow a distinct style compared to the Zephyr API.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The log functions themselves automatically add newline characters, so no
need to do it when calling the log macros.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The ACPI shell command create way too much vertical empty space. Remove
the unnecesary newlines and use indentation to indicate grouping of
lines. At the same time, place case statments with variable declarations
behind {} since otherwise both the Zephyr compliance checker and some
other static analyzers get confused by the code in the branch.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This was never used for anything, since the ACPI API overwrites the
pointer when fetching a resource list.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
ACPI_STATUS variables should not store values of any other error domain
(like negative POSIX error codes used for Zephyr's ACPI API).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The acpi_get_irq_table() function takes a pointer to a table that can
come from anywhere, i.e. it doesn't have to be the acpi.pci_prt.table
that acpi.c uses. Because of this, the correct place to iterate and
process the acpi.pci_prt_table is in the function that actually passes
acpi.pci_prt_table to the acpi_get_irq_table() function.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The acpi_get_irq_routing_table() takes a pointer to an array of
ACPI_PCI_ROUTING_TABLE elements rather than a generic buffer pointer
(e.g. void *).
Because of the above, it makes sense to specify the array size as an
actual ARRAY_SIZE() value, since it makes no sense to accept buffers
which are not a multiple of sizeof(ACPI_PCI_ROUTING_TABLE) long.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Use the appropriate ACPI_STATUS type for any status variable that stores
return values from ACPICA APIS.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
If the CONFIG_PCIE_PRT option is disabled it makes no sense to bloat the
ACPI build with PRT-related code or static tables. The diff looks a bit
larger since functions in acpi.c had to be shuffled around to be able to
be included in a single "#ifdef CONFIG_PCIE_PRT" block.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
ACPI currently uses implicit (auto) initialization, i.e. it doesn't need
any init level or priority.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The acpi_tables array is only needed for systems where dynamic memory
allocation is not available during the early ACPI init phase. In the
Zephyr case we can immediately start using k_malloc, so this is
unnecessary.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The PRT bus name for most (especially older) platforms is _SB.PCI0. Only
newer platforms use something else (like _SB.PC00).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
The upstream ACPICA example initialization order does AcpiLoadTables()
before calling AcpiEnableSubsystem(), so use this order in Zephyr too.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
ACPICA itself already registers its own handler (which works perfectly
fine for our purposes). Furthermore, ACPICA will always fail trying to
register another handler, unless the previous one is explicitly cleared
(which is something the Zephyr code didn't do).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
z_acpi_get_cpu() used to retrieve the local apic on enabled CPU, where
n was about the n'th enabled CPU, not just the n'th local apic.
The system indeed keeps local apic info also about non-enabled CPU,
and we don't care about these as there is nothing to do about it.
This issue exists on up_squared board for instance, but it's a common
one anyway.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
add support for retrieve MAD and DMAR table information. Provided
two new interface namely acpi_dmar_entry_get() and acpi_drhd_get()
for retrieve DMA Remapping Reporting and DMA-remapping hardware
unit definition (DRDH).
Signed-off-by: Najumon B.A <najumon.ba@intel.com>
Add ACPI support for Zephyr using acpica open source
project. ACPI subsystem use to discover and configure
hardware components, perform power management (e.g. putting
unused hardware components to sleep), auto configuration (e.g.
Plug and Play and hot swapping) etc.
Signed-off-by: Najumon Ba <najumon.ba@intel.com>