u-boot/0023-dm-test-Add-test-case-for-dev_phys_.patch
Guillaume GARDET 111c122751 Accepting request 872955 from hardware👢staging
- Add qemu-riscv64spl
Patch queue updated from git://github.com/openSUSE/u-boot.git tumbleweed-2021.01
* Patches added:
  0031-efi_loader-Avoid-emitting-efi_var_b.patch
- Drop pcm051rev3 for Phytec Wega board 
- Fix binary extension for sunxi based boards
- Add Pinephone
- Fix documentation location 
Update to v2021.01.
Patch queue updated from git://github.com/openSUSE/u-boot.git tumbleweed-2021.01
* Patches dropped:
  0028-usb-xhci-xhci_bulk_tx-Don-t-BUG-whe.patch
  0029-Revert-Fix-data-abort-caused-by-mis.patch
  0030-usb-xhci-pci-Add-DM_FLAG_OS_PREPARE.patch
  0031-pci-brcmstb-Cleanup-controller-stat.patch
* Patches added:
  0028-usb-xhci-pci-Add-DM_FLAG_OS_PREPARE.patch
  0029-pci-brcmstb-Cleanup-controller-stat.patch
  0030-fs-btrfs-Select-SHA256-in-Kconfig.patch

OBS-URL: https://build.opensuse.org/request/show/872955
OBS-URL: https://build.opensuse.org/package/show/hardware:boot/u-boot?expand=0&rev=127
2021-02-17 07:37:34 +00:00

74 lines
2.4 KiB
Diff

From f169928dad5b95413fefc3749e54a39bf481c401 Mon Sep 17 00:00:00 2001
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Date: Tue, 12 Jan 2021 13:55:27 +0100
Subject: [PATCH] dm: test: Add test case for
dev_phys_to_bus()/dev_bus_to_phys()
By reusing DT nodes already available in sandbox's test DT introduce a
test to validate dev_phys_to_bus()/dev_bus_to_phys().
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
---
test/dm/Makefile | 1 +
test/dm/phys2bus.c | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 test/dm/phys2bus.c
diff --git a/test/dm/Makefile b/test/dm/Makefile
index 5c52d8b6ea..ac86abaa88 100644
--- a/test/dm/Makefile
+++ b/test/dm/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_UT_DM) += test-uclass.o
obj-$(CONFIG_UT_DM) += core.o
obj-$(CONFIG_UT_DM) += read.o
+obj-$(CONFIG_UT_DM) += phys2bus.o
ifneq ($(CONFIG_SANDBOX),)
obj-$(CONFIG_ACPIGEN) += acpi.o
obj-$(CONFIG_ACPIGEN) += acpigen.o
diff --git a/test/dm/phys2bus.c b/test/dm/phys2bus.c
new file mode 100644
index 0000000000..342f2fa8eb
--- /dev/null
+++ b/test/dm/phys2bus.c
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <mapmem.h>
+#include <phys2bus.h>
+#include <dm/device.h>
+#include <dm/ofnode.h>
+#include <dm/root.h>
+#include <dm/test.h>
+#include <dm/uclass-internal.h>
+#include <test/ut.h>
+
+static int dm_test_phys_to_bus(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ ofnode node;
+
+ node = ofnode_path("/mmio-bus@0");
+ ut_assert(ofnode_valid(node));
+ ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_BUS, node, &dev));
+ /* In this case it should be transparent, no dma-ranges in parent bus */
+ ut_asserteq_addr((void*)0xfffffULL, (void*)dev_phys_to_bus(dev, 0xfffff));
+ ut_asserteq_addr((void*)0xfffffULL, (void*)(ulong)dev_bus_to_phys(dev, 0xfffff));
+
+ node = ofnode_path("/mmio-bus@0/subnode@0");
+ ut_assert(ofnode_valid(node));
+ ut_assertok(uclass_get_device_by_ofnode(UCLASS_TEST_FDT, node, &dev));
+ ut_asserteq_addr((void*)0x100fffffULL, (void*)dev_phys_to_bus(dev, 0xfffff));
+ ut_asserteq_addr((void*)0xfffffULL, (void*)(ulong)dev_bus_to_phys(dev, 0x100fffff));
+
+ return 0;
+}
+DM_TEST(dm_test_phys_to_bus, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);