lib: acpi: update shell and test app with the modifed resource struct

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>
This commit is contained in:
Najumon B.A 2024-02-02 19:15:31 +05:30 committed by Henrik Brix Andersen
parent 2139479722
commit 89745fe472
2 changed files with 12 additions and 0 deletions

View file

@ -279,6 +279,8 @@ static int get_acpi_dev_resource(const struct shell *sh, size_t argc, char **arg
struct acpi_dev *dev;
struct acpi_irq_resource irq_res;
struct acpi_mmio_resource mmio_res;
uint16_t irqs[CONFIG_ACPI_IRQ_VECTOR_MAX];
struct acpi_reg_base reg_base[CONFIG_ACPI_MMIO_ENTRIES_MAX];
if (argc < 3) {
return -EINVAL;
@ -293,6 +295,8 @@ static int get_acpi_dev_resource(const struct shell *sh, size_t argc, char **arg
if (dev->path) {
shell_print(sh, "Device Path: %s", dev->path);
mmio_res.mmio_max = ARRAY_SIZE(reg_base);
mmio_res.reg_base = reg_base;
if (!acpi_device_mmio_get(dev, &mmio_res)) {
shell_print(sh, "Device MMIO resources");
@ -304,6 +308,8 @@ static int get_acpi_dev_resource(const struct shell *sh, size_t argc, char **arg
}
}
irq_res.irq_vector_max = ARRAY_SIZE(irqs);
irq_res.irqs = irqs;
if (!acpi_device_irq_get(dev, &irq_res)) {
shell_print(sh, "Device IRQ resources");

View file

@ -49,6 +49,8 @@ ZTEST(acpi, test_resource_enum)
struct acpi_dev *dev;
struct acpi_irq_resource irq_res;
struct acpi_mmio_resource mmio_res;
uint16_t irqs[CONFIG_ACPI_IRQ_VECTOR_MAX];
struct acpi_reg_base reg_base[CONFIG_ACPI_MMIO_ENTRIES_MAX];
int ret;
Z_TEST_SKIP_IFNDEF(APCI_TEST_DEV);
@ -57,10 +59,14 @@ ZTEST(acpi, test_resource_enum)
zassert_not_null(dev, "Failed to get acpi device with given HID");
mmio_res.mmio_max = ARRAY_SIZE(reg_base);
mmio_res.reg_base = reg_base;
ret = acpi_device_mmio_get(dev, &mmio_res);
zassert_ok(ret, "Failed to get MMIO resources");
irq_res.irq_vector_max = ARRAY_SIZE(irqs);
irq_res.irqs = irqs;
ret = acpi_device_irq_get(dev, &irq_res);
zassert_ok(ret, "Failed to get IRQ resources");