From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AA728A00C5; Tue, 2 Aug 2022 21:13:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 515B640A84; Tue, 2 Aug 2022 21:13:29 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 463DF40141 for ; Tue, 2 Aug 2022 21:13:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659467608; x=1691003608; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=QqV1wmw9NrxjSF02icRYRrYF9cwr4P31RL7IS+q/Wks=; b=WeO43wqinP9IipFeTcb3mW775t4zJFv+t/Q039ZwkQ2lfAS5YgUP8cRK 1cXU1mkZJMd/jmJ8UWWqG/pp50QSyNGJRCwM41hKJ2vuFUq7JabhO7Eln IXRG8dlIjN4kFaHNMjTeqTX6hGiv++QMNf6HRc2W5FRENcOAOTc2oLJCB 5XNkWvQq+jclUi17tzkzW5X5DH0yJmkH5qdZD4WxivQv4TvalQMKJJ6qf LF6vPHeemuosxZuqG3FYWbtmuqX9qeNtlvM7W00QxzVtG8gj6oc9pX0u2 3PiOFlknRSFv81n5KQ1erjZEe5rAlzdhn6/nfUeSL2fEXdT6qdpv7bPEj Q==; IronPort-HdrOrdr: A9a23:dTAPoqu2q696XSxBqJj8z+ba7skDYdV00zEX/kB9WHVpmwKj+f xG+85rsSMc5wxwZJhNo7y90cq7MBbhHOBOkOos1N6ZNWGKhILCFuBfBOXZrAEIXBeUygda78 1dmtBFeb/NMWQ= X-IronPort-AV: E=McAfee;i="6400,9594,10427"; a="276410190" X-IronPort-AV: E=Sophos;i="5.93,211,1654585200"; d="scan'208";a="276410190" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2022 12:13:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,211,1654585200"; d="scan'208";a="705497115" Received: from win-dpdk-pallavi.jf.intel.com (HELO localhost.localdomain) ([10.166.188.111]) by fmsmga002.fm.intel.com with ESMTP; 02 Aug 2022 12:13:26 -0700 From: Pallavi Kadam To: dev@dpdk.org Cc: thomas@monjalon.net, ranjit.menon@intel.com, dmitry.kozliuk@gmail.com, Narcisa.Vasile@microsoft.com, roretzla@linux.microsoft.com, qiao.liu@intel.com, pallavi.kadam@intel.com Subject: [dpdk-kmods] windows/netuio: fix bar parsing Date: Tue, 2 Aug 2022 12:10:58 -0700 Message-Id: <20220802191058.1779-1-pallavi.kadam@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org For certain PCIe devices, BAR values are not continuous. This patch maps all the BARs and avoids skipping the next BAR addresses. Fixes: e28aabd88279 ("windows/netuio: introduce NetUIO kernel driver") Cc: navasile@microsoft.com Signed-off-by: Qiao Liu Signed-off-by: Pallavi Kadam --- windows/netuio/netuio_dev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/windows/netuio/netuio_dev.c b/windows/netuio/netuio_dev.c index b2deb10..e2cac3e 100644 --- a/windows/netuio/netuio_dev.c +++ b/windows/netuio/netuio_dev.c @@ -172,6 +172,7 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST Resources, WDFCMRESLIST R ULONG next_descriptor = 0; ULONG curr_bar = 0; ULONG prev_bar = 0; + BOOLEAN bar_done = FALSE; /* * ResourcesTranslated report MMIO BARs in the correct order, but their @@ -197,7 +198,8 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST Resources, WDFCMRESLIST R for (INT bar_index = 0; bar_index < PCI_MAX_BAR; bar_index++) { prev_bar = curr_bar; curr_bar = pci_config.u.type0.BaseAddresses[bar_index]; - if (curr_bar == 0 || (prev_bar & PCI_TYPE_64BIT)) { + if (curr_bar == 0 || ((prev_bar & PCI_TYPE_64BIT) && (bar_done))) { + bar_done = FALSE; continue; } @@ -219,6 +221,7 @@ netuio_map_hw_resources(WDFDEVICE Device, WDFCMRESLIST Resources, WDFCMRESLIST R ctx->bar[bar_index].virt_addr = MmMapIoSpace(descriptor->u.Memory.Start, descriptor->u.Memory.Length, MmNonCached); + bar_done = TRUE; if (ctx->bar[bar_index].virt_addr == NULL) { status = STATUS_INSUFFICIENT_RESOURCES; goto end; -- 2.31.1.windows.1