Skip to content

Commit

Permalink
lib: acpi: update shell and test app with the modifed resource struct
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
najumon1980 authored and henrikbrixandersen committed Feb 15, 2024
1 parent 2139479 commit 89745fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/acpi/acpi_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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");
Expand All @@ -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");
Expand Down
6 changes: 6 additions & 0 deletions tests/lib/acpi/integration/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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");
Expand Down

0 comments on commit 89745fe

Please sign in to comment.