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 2FDD242597; Thu, 14 Sep 2023 14:37:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E84340A8A; Thu, 14 Sep 2023 14:36:58 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 22F6640395 for ; Thu, 14 Sep 2023 14:36:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694695015; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wUoyAH45cHEdp6t84Dj6nJNTCDqaKZ/wg+FI17wWxYE=; b=WD3VF7OXYNjtToYzLmIkq2EkWVrVnj9C3Ab0Oi4+4Yfu9ipRrGLxJLvRIM9taMxzLczgtx f79MM12zPwPkkmNJa3kmos/wo/9ZF0L0WAq7zfBBPvI/zI1zF7kjTeoG5CQs4HuYnnRy7Z S++QKSJcqZwBFXt7wxyYrfEYRU4h/6o= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-593-rRjXFmS8MQiZJXK0Xotk_w-1; Thu, 14 Sep 2023 08:36:54 -0400 X-MC-Unique: rRjXFmS8MQiZJXK0Xotk_w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF99981DBE6; Thu, 14 Sep 2023 12:36:53 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.225.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8303721B20B1; Thu, 14 Sep 2023 12:36:52 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@amd.com, chenbo.xia@intel.com, nipun.gupta@amd.com, bruce.richardson@intel.com, Anatoly Burakov , Gaetan Rivet Subject: [PATCH v3 08/15] pci: define some BAR constants Date: Thu, 14 Sep 2023 14:36:07 +0200 Message-ID: <20230914123615.1705654-9-david.marchand@redhat.com> In-Reply-To: <20230914123615.1705654-1-david.marchand@redhat.com> References: <20230803075038.307012-1-david.marchand@redhat.com> <20230914123615.1705654-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 Define some PCI BAR constants and use them in existing drivers. Signed-off-by: David Marchand Acked-by: Bruce Richardson Reviewed-by: Chenbo Xia --- drivers/bus/pci/linux/pci_vfio.c | 7 +++---- lib/pci/rte_pci.h | 4 ++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index bf91492dd9..3f3201daf2 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include @@ -427,14 +426,14 @@ pci_vfio_is_ioport_bar(const struct rte_pci_device *dev, int vfio_dev_fd, } ret = pread64(vfio_dev_fd, &ioport_bar, sizeof(ioport_bar), - offset + PCI_BASE_ADDRESS_0 + bar_index * 4); + offset + RTE_PCI_BASE_ADDRESS_0 + bar_index * 4); if (ret != sizeof(ioport_bar)) { RTE_LOG(ERR, EAL, "Cannot read command (%x) from config space!\n", - PCI_BASE_ADDRESS_0 + bar_index*4); + RTE_PCI_BASE_ADDRESS_0 + bar_index*4); return -1; } - return (ioport_bar & PCI_BASE_ADDRESS_SPACE_IO) != 0; + return (ioport_bar & RTE_PCI_BASE_ADDRESS_SPACE_IO) != 0; } static int diff --git a/lib/pci/rte_pci.h b/lib/pci/rte_pci.h index 8bf60b9fb7..12866be5d5 100644 --- a/lib/pci/rte_pci.h +++ b/lib/pci/rte_pci.h @@ -35,6 +35,7 @@ extern "C" { #define RTE_PCI_DEVICE_ID 0x02 /* 16 bits */ #define RTE_PCI_COMMAND 0x04 /* 16 bits */ #define RTE_PCI_STATUS 0x06 /* 16 bits */ +#define RTE_PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ #define RTE_PCI_CAPABILITY_LIST 0x34 /* 32 bits */ /* PCI Command Register (RTE_PCI_COMMAND) */ @@ -45,6 +46,9 @@ extern "C" { /* PCI Status Register (RTE_PCI_STATUS) */ #define RTE_PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */ +/* Base addresses (RTE_PCI_BASE_ADDRESS_*) */ +#define RTE_PCI_BASE_ADDRESS_SPACE_IO 0x01 + /* Capability registers (RTE_PCI_CAPABILITY_LIST) */ #define RTE_PCI_CAP_ID_PM 0x01 /* Power Management */ #define RTE_PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */ -- 2.41.0