From patchwork Sun Nov 29 20:18:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 549814 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 4EF0D1401E7 for ; Mon, 30 Nov 2015 07:28:42 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=k7FviMsA; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D91394B7B6; Sun, 29 Nov 2015 21:28:39 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MPDVtJ8MXVvx; Sun, 29 Nov 2015 21:28:39 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B8E2D4B7BD; Sun, 29 Nov 2015 21:28:34 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7D0A34B785 for ; Sun, 29 Nov 2015 21:28:30 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iWuxejc9e6an for ; Sun, 29 Nov 2015 21:28:30 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-oi0-f48.google.com (mail-oi0-f48.google.com [209.85.218.48]) by theia.denx.de (Postfix) with ESMTPS id 163A04B766 for ; Sun, 29 Nov 2015 21:28:27 +0100 (CET) Received: by oixx65 with SMTP id x65so84536117oix.0 for ; Sun, 29 Nov 2015 12:28:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=4IjMHAPfxOCvswZK1Zd9cnClr0fg6vxDBdU/mVNIDac=; b=k7FviMsA1Wwb84gT5m1E4og76725IiGNIQchn/oqxGBVU13fwN3xxXqoEpiWYzxms6 1dw3YWgcL6pVtBI5rjNzs222Ig+TvCn3xYo6yELF5+xrHly422E0ihR86igBBPTNENVe vt50VfIxrdB/wkJxU4fa+O8dgQnqaBfB/wJX3u5JfDyk5lDr3E1AgxvO7JepP1lVnFBw QEH3vuxot7/WYJw8en4l1HxQKoQVNiNqd8JS8oY6PABLRkK/EeXsqPy3UWxwPvA0bL0y wKDyXbUuogotzWhxoU1jFY4i8bzSZc3Y332jXtyz0/jugfcb7FECkxnasBHdNxU/6adq sqEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4IjMHAPfxOCvswZK1Zd9cnClr0fg6vxDBdU/mVNIDac=; b=L5XtVhweQGHhNMSnx0pjJxdPm02uQfkb0gL3CfkDdcO6iM5INKQZCOdfOP6uKGMyl0 I2Xg5nebDJfvcNSuQH62jeO1r0AW9eUiV2Au/Qk0kPnsnordBOAx9KxnfcoIjvgmu3ml s2m33X7jHp17+SBjDSXmJTCueSPOwqrR3iIDuyEyKiLec9iPaOH/MZnp6bEjewrRG4Ft ckr9XKgSI0FFD1u+WT8GiLDE8Usmyo420ygLLHBgW2jOIx+dJmeJksx03cUIqQpa3wi4 5TcvIAvMdteGyiu2WpxEW5dSED2qc8aztUhkfo5vAsgO4aqlV+duVT/tK27dk66a28PC j9hA== X-Gm-Message-State: ALoCoQmlEB9phXO1HvzxlLMMdswxYE7S7JAN2/NV9cSxNy4Yk+FRJEc76JpErNT78j4Ga/pTU70e X-Received: by 10.202.218.193 with SMTP id r184mr40758011oig.111.1448828905923; Sun, 29 Nov 2015 12:28:25 -0800 (PST) Received: from kaki.bld.corp.google.com ([2620:0:1005:1100:db0:6c41:dcb6:f2ad]) by smtp.gmail.com with ESMTPSA id r82sm20034873oib.10.2015.11.29.12.28.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Nov 2015 12:28:25 -0800 (PST) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 450B5221941; Sun, 29 Nov 2015 13:18:22 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Sun, 29 Nov 2015 13:18:02 -0700 Message-Id: <1448828291-12660-18-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1448828291-12660-1-git-send-email-sjg@chromium.org> References: <1448828291-12660-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH v2 17/26] dm: test: Convert PCI tests to use the DM PCI API X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Update these tests to use driver model API functions. Signed-off-by: Simon Glass --- Changes in v2: - Use pci_bus_find_bdf() test/dm/pci.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/test/dm/pci.c b/test/dm/pci.c index 3ab4ba8..a5b1290 100644 --- a/test/dm/pci.c +++ b/test/dm/pci.c @@ -35,20 +35,17 @@ DM_TEST(dm_test_pci_busnum, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); /* Test that we can use the swapcase device correctly */ static int dm_test_pci_swapcase(struct unit_test_state *uts) { - pci_dev_t pci_dev = PCI_BDF(0, 0x1f, 0); - struct pci_controller *hose; - struct udevice *bus, *swap; + struct udevice *emul, *swap; ulong io_addr, mem_addr; char *ptr; /* Check that asking for the device automatically fires up PCI */ - ut_assertok(uclass_get_device(UCLASS_PCI_EMUL, 0, &swap)); - - ut_assertok(uclass_get_device(UCLASS_PCI, 0, &bus)); - hose = dev_get_uclass_priv(bus); + ut_assertok(uclass_get_device(UCLASS_PCI_EMUL, 0, &emul)); + ut_assertok(dm_pci_bus_find_bdf(PCI_BDF(0, 0x1f, 0), &swap)); + ut_assert(device_active(swap)); /* First test I/O */ - io_addr = pci_read_bar32(hose, pci_dev, 0); + io_addr = dm_pci_read_bar32(swap, 0); outb(2, io_addr); ut_asserteq(2, inb(io_addr)); @@ -56,7 +53,7 @@ static int dm_test_pci_swapcase(struct unit_test_state *uts) * Now test memory mapping - note we must unmap and remap to cause * the swapcase emulation to see our data and response. */ - mem_addr = pci_read_bar32(hose, pci_dev, 1); + mem_addr = dm_pci_read_bar32(swap, 1); ptr = map_sysmem(mem_addr, 20); strcpy(ptr, "This is a TesT"); unmap_sysmem(ptr);