From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0067.outbound.protection.outlook.com [104.47.32.67]) by dpdk.org (Postfix) with ESMTP id E9E853238 for ; Tue, 21 Feb 2017 10:28:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=79io2rAcUYchpL6b0KXXRS7sLc9u0Msxisa8VLTmhiM=; b=PKvn/Bz9HWQKqEvm6m4QPbvRE63vb24KfRkQDmuAmWFGJVnpj8EqaMZZoK1xtPXnwNLMYJkwUQ3GvsnEHHx3t8IvNawT3rJLIJcC17g/0vJ0hXb3jfEQ6Rf6qDTTaySHbMAEMLslvLygkO4AqZauD0Gxit+UGtO692MDRTwYn9Y= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shijith.Thotton@cavium.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.919.13; Tue, 21 Feb 2017 09:28:26 +0000 From: Shijith Thotton To: dev@dpdk.org Cc: Jerin Jacob , Derek Chickles , Venkat Koppula , Mallesham Jatharakonda Date: Tue, 21 Feb 2017 14:56:23 +0530 Message-Id: <1487669225-30091-9-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: MA1PR01CA0089.INDPRD01.PROD.OUTLOOK.COM (10.174.56.29) To SN1PR07MB2285.namprd07.prod.outlook.com (10.164.47.155) X-MS-Office365-Filtering-Correlation-Id: ae2f0724-b53c-45f5-c4ec-08d45a3bfec6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 3:HHl+lag/ptiQHdAugJytrsjXSLgtG9uG5wq0ySaTYRiMnQpY+DheFxA3Qtx9YGQsrw9ZuhfeFbyGw4cuQ81OU1LJwG/BpyJ/1GhPmrjgrMfGYTAEEelcfUOlEcaUr8xBSr+d/RCO2CetRZT29bfSvPaHQiVElX4FK+ZFxnCa/aEetCmz4k04SPlOSOEcGGGHHb7S+yAsVpN9dtb6p4atDUQwjRD8kDZkcsBtIIgYj4YF71hzOXL+XZh9+BiYOhFk/Qr+Qd9bMO+vpOO2Km54Ag==; 25:jIkiRxFwOOhjF2IFsY45EmZJTFM4f14rmwGaPR6s4IAs2w75oluOHW73WigaJfO5laeA+ueKIZYrGfs3DEr1zUEtHDjL2c3WuN7NzqAqjqo9F1L+FuYxV9+Wm0Mfu6stHIZjzbvEGl+F+kR5r49x3BCfBLq7Kj1mSJQG68ucENFiM6Pu+ka4ziT66FAVbzgscGNQgltHByadJnJRNWg0h/89rIo7tb2TWXYneA23+YVSFwAw7d44lUc85h3BQzn/tKkkfghmyZr/6P3PMSzRVJ1Tqkd1YcjkCtadpnGD97wWsihg3X+s1lsA8wMw5FtMb3JYyx1CFmqwFJPbgHw+2DSESsGZbNQt4jOBDAY0Ty4uOP03O0VDV2FZAVXwaCUTbIVaKAkuiVRkWSTbd21M0Bxle1Gs3pzCXEoCYd45OiI6tf2zgqnmy1Kgy4VXezXP9GgtGdsK2Cc8tLlAUIvTPQ== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 31:xKZBJyzgJ74KkataXuLEGBpdl1s1WSbJ4ZxVxRC76oNok4wzmeFGFEHcGvK3LuEiQzwfGBnIa79U77Pm+3mXAGHGDVb8B3goYqS4chOA1YPpKgvDY45TX4m76qy1SeQxb79StHRfypGKWQ+TRUeRuGdGk1dACfuIF9/++UMlXIXHmMNPV8oqo/e3kBHf1LG8acdD8IwGmWYHf8oJhAzNY1mJyZ8XGO7B3ZoX4KU2Ohm3Q0A7nVS39l97mTBNiC/u; 20:WuwdLpcId65+cwDeye0GZrMV3GD9c2lUmhyFurFeYzfdioCGlrFrcrpey3KHtKhEyasF9ghd7Qpblb9WGzZsxlcxCE0rJisGt5h2fCDaXOsXsViJHevZ6xu5ah8iMf/FpL+O3zGsndamb5Y5fb4viI6hnqYBEDjmT0+lt+WdIjzqSGgMU0+4cXpDRul9OmmBGW34TRMHFvpkEQJdB5NKuLE+m1FZehERI4GGWCJY+Sq3JGuq/uQdr8dhxQPtgLqjAurP97HWnpaZOSuE+fP6BRDR7TVOtdDgn7nAotlokvBVb8cSIyMRFuoZBWY6WBKybuXi0iC9orT+6fZaZct/eGVF8vTsgN8FbgyBi6/gxpuDSlhIzi7e8HQTPEBeCqnpdo+mxwFrRs8ygffls4c+ovaV7Onb1zZluR7zItbQXLS6IqHG+kw0lUqCUuUhEgIT7LptwdXjcZwZNAeEsxPXYpaytsIYpsJnr5fRhuzUvn8cpBCJmf/QcXNGDRs6pxXeBPcoijowjBhLYYZqVZxhQ1ggSN+yTBcjN5Mofj/1DrhFRtZV9McmwAs1yiBZaJXYLT8200GVNeNMRgTeyqqjAKjgn+4fyAKvZr6J2w7fRKc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(20161123558025)(6072148); SRVR:SN1PR07MB2285; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2285; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 4:sqZlg2PH4w8KdtOjwWgfzyPS5irRE8ZlYrdJyncjACF/C+X3JNQs28bdvGh6vUndzaYNjYkePT9zFbxC49R1tHMUOSfco2Mh4szXJ7HzfjNFUumrlJDFz1jb4kBBclp9C5Jotlr4dCZsuPf/CNXE/Qft12ED4CXUqwjflUDf5hoTBvO8kgoA9+2ZZxrxpJz1PnyO/vbXEBwStEaBqYsejsgfmCxBN9kdqmX6FYb46QpkDuIS+HmMYi0+Spvaim7LLoRJBINwvK2f8q723qL0Euyw4oJq+R9wMuSwmNxpn/33ejGF0hvqmCNsFOzD2w1Yv59z3kcXPJG9eXv9SE+ardHVILXVNcv8EWBs0XXd1G2BKmK+E+f05reXDiXZys8dPENcFiVd+wJYW1BOZyFd5iSFbFNapyH9vQCJavVZZnnqwrpMygItcIIo2sIqOzexLzSca29C92mB2+5GEMOPtsyxgdxGIFD+C1nd+ZrDGB9fcMRFmM8upmEcws/kjfAOWdKc0myTPv12sRyDMIsihszlsqiaeqCAOM+wdzTKvLS1BCmzpnrpeBJ2iSCDkL/Ar17MwQGBJphVGtp8HaKpP6y7hlTx9mbH4OroAgf+fUU= X-Forefront-PRVS: 0225B0D5BC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(39410400002)(39830400002)(189002)(199003)(50226002)(81166006)(42186005)(2361001)(101416001)(81156014)(305945005)(3846002)(6116002)(5009440100003)(8676002)(105586002)(7736002)(53936002)(36756003)(110136004)(106356001)(6506006)(25786008)(38730400002)(2351001)(92566002)(48376002)(6486002)(97736004)(50466002)(5003940100001)(189998001)(68736007)(2906002)(4326007)(33646002)(76176999)(54906002)(5660300001)(6666003)(6916009)(50986999)(2950100002)(6512007)(4720700003)(42882006)(66066001)(47776003)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2285; H:lio357.in.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =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ThEupsXrnAa7I/IGnTwbrwlm3e3HBoQIokis8YMmlgmp7UdTfAayt5OohyVmKofp4eo31+vnIg0XnellNy4765a5qQ+d797rghv0lnS3GGqSIYVDO/SJwYmWbRQ==; 24:Vs9E5lOPY00JzxTSZA3Dv6NuQ64QKxZKAR44UpXFWReSBapg3akacJQAE3lQ3o4FCVQ86mjA2Nyogeu7SpJPPq3Cca42Qaz2RxEv1LlHWAc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2285; 7:rVgHlYWwxaMq8LOPwaRv6Ku5JKTPPY6nXyvqbx95GBIO5hTDGyepB/5fgZKf0SsNKJd5junZ/XnNQoZW58C9N3R6BAKKKBRjMwa3HEsS8Ku4TOnFpPhvCm432YgtwlKtOaYsVyCPqJKkpi+U5Ga9P/Xn2lCy0DzBlk5Vsj3+GfKHjz/sz5BuVpWmX2fU9wfXjDPzZpsK/F4oPYhH/WTsh5tuDDRNHA+OxEkt706MVVbQfYpvVG66m8muU0epYLzuQiGJEgLzRekJsjVgacl2oe40m5p9J7uJ/ARbHXnMLUmluvyolOs9VY7TOLPo6uUumACBNJbAMSxjK/afbCLp0Q== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2017 09:28:26.9935 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2285 Subject: [dpdk-dev] [PATCH 08/50] net/liquidio/base: macros to read and write register 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: , X-List-Received-Date: Tue, 21 Feb 2017 09:28:32 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Mallesham Jatharakonda --- drivers/net/liquidio/base/lio_hw_defs.h | 67 +++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/drivers/net/liquidio/base/lio_hw_defs.h b/drivers/net/liquidio/base/lio_hw_defs.h index db42f3e..673c2d6 100644 --- a/drivers/net/liquidio/base/lio_hw_defs.h +++ b/drivers/net/liquidio/base/lio_hw_defs.h @@ -34,6 +34,8 @@ #ifndef _LIO_HW_DEFS_H_ #define _LIO_HW_DEFS_H_ +#include + #ifndef PCI_VENDOR_ID_CAVIUM #define PCI_VENDOR_ID_CAVIUM 0x177D #endif @@ -41,4 +43,69 @@ #define LIO_CN23XX_VF_VID 0x9712 #define LIO_DEVICE_NAME_LEN 32 + +/* Routines for reading and writing CSRs */ +#ifdef RTE_LIBRTE_LIO_DEBUG_REGS +#define lio_write_csr(lio_dev, reg_off, value) \ + do { \ + typeof(lio_dev) _dev = lio_dev; \ + typeof(reg_off) _reg_off = reg_off; \ + typeof(value) _value = value; \ + PMD_REGS_LOG(_dev, \ + "Write32: Reg: 0x%08lx Val: 0x%08lx\n", \ + (unsigned long)_reg_off, \ + (unsigned long)_value); \ + rte_write32(_value, _dev->hw_addr + _reg_off); \ + } while (0) + +#define lio_write_csr64(lio_dev, reg_off, val64) \ + do { \ + typeof(lio_dev) _dev = lio_dev; \ + typeof(reg_off) _reg_off = reg_off; \ + typeof(val64) _val64 = val64; \ + PMD_REGS_LOG( \ + _dev, \ + "Write64: Reg: 0x%08lx Val: 0x%016llx\n", \ + (unsigned long)_reg_off, \ + (unsigned long long)_val64); \ + rte_write64(_val64, _dev->hw_addr + _reg_off); \ + } while (0) + +#define lio_read_csr(lio_dev, reg_off) \ + ({ \ + typeof(lio_dev) _dev = lio_dev; \ + typeof(reg_off) _reg_off = reg_off; \ + uint32_t val = rte_read32(_dev->hw_addr + _reg_off); \ + PMD_REGS_LOG(_dev, \ + "Read32: Reg: 0x%08lx Val: 0x%08lx\n", \ + (unsigned long)_reg_off, \ + (unsigned long)val); \ + val; \ + }) + +#define lio_read_csr64(lio_dev, reg_off) \ + ({ \ + typeof(lio_dev) _dev = lio_dev; \ + typeof(reg_off) _reg_off = reg_off; \ + uint64_t val64 = rte_read64(_dev->hw_addr + _reg_off); \ + PMD_REGS_LOG( \ + _dev, \ + "Read64: Reg: 0x%08lx Val: 0x%016llx\n", \ + (unsigned long)_reg_off, \ + (unsigned long long)val64); \ + val64; \ + }) +#else +#define lio_write_csr(lio_dev, reg_off, value) \ + rte_write32(value, (lio_dev)->hw_addr + (reg_off)) + +#define lio_write_csr64(lio_dev, reg_off, val64) \ + rte_write64(val64, (lio_dev)->hw_addr + (reg_off)) + +#define lio_read_csr(lio_dev, reg_off) \ + rte_read32((lio_dev)->hw_addr + (reg_off)) + +#define lio_read_csr64(lio_dev, reg_off) \ + rte_read64((lio_dev)->hw_addr + (reg_off)) +#endif #endif /* _LIO_HW_DEFS_H_ */ -- 1.8.3.1