From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3EB78A0540; Mon, 13 Jul 2020 17:15:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 21C6C1D61E; Mon, 13 Jul 2020 17:15:15 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 086891D615 for ; Mon, 13 Jul 2020 17:15:13 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06DFARIJ004295; Mon, 13 Jul 2020 08:15:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=hkDA7pHGOGSWyIq+M6csNxdodXGyXA+5tbDRtuBv2+0=; b=sg1l5kbVFze0VWcpnyFL+FTVmWUtWsiqxNdqLLI+tGNqr2uxgI6DtRP0BNOfDnOrmaMb 3TL3gOlNJaYbUrFEcF/aIyPYDiPcf+OEW+INquYF0pem6kgPJMKscHvg4o5uVcQWlmvM iZgdZTtPUy3jK53WuX+4dRHJD1Ft5dAy/1tpRfdFXeaFTSD4bLe6VgE+huOyfv1sDwFc k6W00TJ4gSyYrURixRGWknL+MUGd6psmW14ismvg37ztzyWOQhwQ7pjIeaJ9Wz1s2Ugy IfTS1QwHqZu/34aixioW4hx2erAEQ5t6RxL1lNCeoCRkhxWpGQejagXOofSSmO3hYhtG KA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 327asn7ypc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2020 08:15:08 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 13 Jul 2020 08:15:07 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 13 Jul 2020 08:15:07 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 548F13F7044; Mon, 13 Jul 2020 08:15:07 -0700 (PDT) Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id 06DFF7ue017613; Mon, 13 Jul 2020 08:15:07 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id 06DFF7Cw017612; Mon, 13 Jul 2020 08:15:07 -0700 From: Manish Chopra To: , , , CC: , , , , , , , , , , , Date: Mon, 13 Jul 2020 08:13:15 -0700 Message-ID: <20200713151319.17547-4-manishc@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20200713151319.17547-1-manishc@marvell.com> References: <20200713151319.17547-1-manishc@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-13_14:2020-07-13, 2020-07-13 signatures=0 Subject: [dpdk-dev] [PATCH v2 3/7] net/qede: define PCI config space specific osals X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch defines various PCI config space access APIs in order to read and find IOV specific PCI capabilities. With these definitions implemented, it enables the base driver to do SR-IOV specific initialization and HW specific configuration required from PF-PMD driver instance. Signed-off-by: Manish Chopra Signed-off-by: Igor Russkikh Signed-off-by: Rasesh Mody --- drivers/net/qede/base/bcm_osal.h | 18 +++++++++++++----- drivers/net/qede/base/ecore.h | 3 +++ drivers/net/qede/qede_main.c | 1 + 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/net/qede/base/bcm_osal.h b/drivers/net/qede/base/bcm_osal.h index 5d4df5907..317e088e1 100644 --- a/drivers/net/qede/base/bcm_osal.h +++ b/drivers/net/qede/base/bcm_osal.h @@ -21,6 +21,11 @@ #include #include #include +#include +#include + +#define PCICFG_VENDOR_ID_OFFSET PCI_VENDOR_ID +#define PCICFG_DEVICE_ID_OFFSET PCI_DEVICE_ID /* Forward declaration */ struct ecore_dev; @@ -286,11 +291,14 @@ typedef struct osal_list_t { OSAL_LIST_PUSH_HEAD(new_entry, list) /* PCI config space */ - -#define OSAL_PCI_READ_CONFIG_BYTE(dev, address, dst) nothing -#define OSAL_PCI_READ_CONFIG_WORD(dev, address, dst) nothing -#define OSAL_PCI_READ_CONFIG_DWORD(dev, address, dst) nothing -#define OSAL_PCI_FIND_EXT_CAPABILITY(dev, pcie_id) 0 +#define OSAL_PCI_READ_CONFIG_BYTE(dev, address, dst) \ + rte_pci_read_config((dev)->pci_dev, dst, 1, address) +#define OSAL_PCI_READ_CONFIG_WORD(dev, address, dst) \ + rte_pci_read_config((dev)->pci_dev, dst, 2, address) +#define OSAL_PCI_READ_CONFIG_DWORD(dev, address, dst) \ + rte_pci_read_config((dev)->pci_dev, dst, 4, address) +#define OSAL_PCI_FIND_EXT_CAPABILITY(dev, cap) \ + rte_pci_find_next_ext_capability((dev)->pci_dev, cap) #define OSAL_PCI_FIND_CAPABILITY(dev, pcie_id) 0 #define OSAL_PCI_WRITE_CONFIG_WORD(dev, address, val) nothing #define OSAL_BAR_SIZE(dev, bar_id) 0 diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index 63bd7466a..750e99a8f 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -937,6 +937,9 @@ struct ecore_dev { struct ecore_dbg_feature dbg_features[DBG_FEATURE_NUM]; struct ecore_dbg_params dbg_params; osal_mutex_t dbg_lock; + + /* DPDK specific ecore field */ + struct rte_pci_device *pci_dev; }; enum ecore_hsi_def_type { diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index 987a6f1e1..d919f9f11 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -37,6 +37,7 @@ static void qed_init_pci(struct ecore_dev *edev, struct rte_pci_device *pci_dev) edev->regview = pci_dev->mem_resource[0].addr; edev->doorbells = pci_dev->mem_resource[2].addr; edev->db_size = pci_dev->mem_resource[2].len; + edev->pci_dev = pci_dev; } static int -- 2.17.1