From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0053.outbound.protection.outlook.com [104.47.40.53]) by dpdk.org (Postfix) with ESMTP id 7E936D586 for ; Thu, 2 Mar 2017 12:38:10 +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=KfzSypgPxh96nh3qssd4OLHcb+fJf1BjzZywFLuY9YA=; b=KWovcY0wbsFzP2fcBvV3T8iUZsTJvrG4pY7S86bDdpKaTSxkUPERRDFS8o7DGcB6uDgTPXqOnE/gv4dI3GeC61/aCXsFDqirv/lcZiXI21nzoRUTwXkJ1yJWDQf0kyNdy2i68hOU0m6HyS1FxLxtv97D3kRAox60rT7m6YeU0mM= Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from lio357.in.caveonetworks.com (14.140.2.178) by CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 11:38:05 +0000 From: Shijith Thotton To: ferruh.yigit@intel.com Cc: dev@dpdk.org, Jerin Jacob , Derek Chickles , Venkat Koppula , Srisivasubramanian S , Mallesham Jatharakonda Date: Thu, 2 Mar 2017 17:02:10 +0530 Message-Id: <1488454371-3342-6-git-send-email-shijith.thotton@caviumnetworks.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488454371-3342-1-git-send-email-shijith.thotton@caviumnetworks.com> References: <1487669225-30091-1-git-send-email-shijith.thotton@caviumnetworks.com> <1488454371-3342-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: BM1PR01CA0021.INDPRD01.PROD.OUTLOOK.COM (10.163.198.156) To CY1PR07MB2277.namprd07.prod.outlook.com (10.164.112.155) X-MS-Office365-Filtering-Correlation-Id: 9d5a212c-8dc8-4d4f-a65e-08d46160998f X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 3:kCjDDu3pZi78BhTOgMa5qN693sX4hNuYJw+oNMpCkjMwlHilXCUBqPbDP5WCOOpNETwOBkmS1BwhhWCGh8fkmaPb0xt9BpJwYMSNtpgT/JsY3l5PCnLiEB0VfzQSLS6YEpL5DSvCR8sxYEDHQ13NWph+BTxwjWKF4gXs+3UHNhwQveFfuJTwRYvxNwjmMv19ogxVoIeakVZbU3x7qh5Huwar6VvmJYzlPcaXDHSdK3hK4fl9ElK/pm2SFiYNJlyli/WyWJiLB6WYysa/OTIiMQ==; 25:106MZRpcASnWr5AXgkTfmRnv93tNOVikOCr4QN3jgjDskawMy+olQFLlGMVWoGZIO9eJaRT2PdEnKj1YMLmkgyaEJGN9s7wEatNsa9QIHPfRX73MTe23YuCZ92Q6sXybx7JnJ4p7HQd+E+FSZmmPUOORFy+jDkCl3Aw/uKOY0uo/ikHZMQ7UJBEjwwT6rtcvaDsYWuvJjXpQ7kPj04m6uDnBxq0rfsOh5pWba6fQgpvoO7yTwjvOFSNMO62y7jobIReU3sN64Zjzo+xjKVYVzxepbjB9GY9YylOpT4mXCw+M3oyEV8/CAmTQ20sgQXmufko19NB+YCvxtWjRfuiWi/sSqjMv2bfMZwXbnn4aJc0BretGG05gpnKE3i6OcqaBk9g0JULP4nfULxe5OturBaOvdw1mAlSxJI18RbNnfXq/mWBJD5oyz04MTij5A0hSBQWSlQrpxO5EgLZ3cbsegA== X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 31:Y4OVEvdu7APqtSLjH7JnYnJx5paXjW50BUhQyF/zPYo1I+qVzkuiecByXYkfC1AMQGYn8voADACUfbhcInZnQ8ynYhhUQeODNQ/zxfNAMeOe3XvjwgD1wXdaR8H67cza0fI5oeYDsXEYgDhW+E0D77Kkke+9O4KeRFPWNPs9+3cmS4QO1l09DiA18ckAn90AcTgypf+/YNSrFvxJI6iIUoFugU0spn4zv60MyomxfnNt+wyMIm0aCGAHvo+sukQ2; 20:oz03DfMQCIfg+t7rNS07e6UOqudnDsFGa40TgWwCq6rIzY9DNbb2zO10FTUOvStdRa6dRwCy+LwkD0/FUveayle7yeZJoCuNUAit8mfuSXesb8aZLcjW03Bj0wm37HxZkORufWQXesd38o/a8U3iJSQtYlovJCYRHWeoIDxdSlY7CYeyqlxHrb3jTywlrccRpVKDWgv9gdtBQiTDk9US+jRnpC1gDiVG3hvREXxE9OMGuq1u/KNU734iEsSnJgqYSp2QoUALt59SQa1FH53tLgf+wzz82dGSoW5ZOFzYWpNSnj+hxeVd/7D3F8ORkynAgF4Agl0UWnFEcANrFkv8jVA6vmVS+prZhKSELeZZbXqAEFQSf4wZl7vddi9YTdSd3TVbuHcLldkZgBAMlBbJ8ObGUkk7/II0mrPnf3jYuVuXxftgDIlnJfMtt27cvzNiRVjZoXdraXeg/BVMgwKOq4pI5Kdw25Lr7BlqRdZA9Htn9ZUUY0u+U84kXy+dz0O/UwzC7kDkcRsCSkm72rFO+78fx0L5Qz0Ku2CCKeZSAzo412/zAs/llhvqNt3ikS8iLpxYaMJ3SL0zk1B1Cox6N/lL953SNX4e433SXn0yjiM= 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)(10201501046)(3002001)(6041248)(20161123558025)(20161123555025)(20161123560025)(20161123564025)(20161123562025)(6072148); SRVR:CY1PR07MB2277; BCL:0; PCL:0; RULEID:; SRVR:CY1PR07MB2277; X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 4:bgqR48zgZVUC0qfgU5mGquWb2dSqZEkspaUd42nsENA6lSkYNVwEcv/+TY/gmZ2qnGCgbQf9m/WPOKjPE+sWIeVaOmR77t2mSZCoSpnwy1m/UT0MnAuBxZaOFay123yho6AxbtufIjOUaarQ/pks2GTqHaBu0EK7ogfcgLAaG/6OVckYo8BuU2sMUsddfc0qZ29kPSxQ8Bqoy2J+im4pu+b2C/4zDE+3H8+tQScguKYTAytzhGxUdFg41b31vOgXefBSJtFTcHE3RlkrDDcOCqU7ieo0bCdx/xiN7sGInvFSjBflOkN6x4QTtOEFnjTNRtQwtOOhY3TJA8qrhhIZne4XRA4DLElyuiehh5f5PMYteB4t3vzq9HF4ztelpOfMd30fKTr+KrqbrDe5N8ECl19yHv0K+DnIvlQUiGoRRAEmaUFX4H1jS9aU50PhJ+yN5VngVdLVj/poBmBbE9VMPYjjX/KfMaAuk/I7TCt2PitDIKlhcFVTykYI/1fF2hawKr1zcYC11NrFxW5ERKCGbrPH/15rOdjUfPZSgMRRq7+tCvf2trxEXQTSFE4vWRrtUDzrE3bouUH32nYAjxNIc6NH2HIQKZL7qFXUuFdm3oY= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39450400003)(2950100002)(6916009)(42882006)(5660300001)(92566002)(4720700003)(33646002)(48376002)(50226002)(6666003)(2906002)(5003940100001)(36756003)(8676002)(50466002)(81166006)(110136004)(38730400002)(4326008)(305945005)(2361001)(53936002)(2351001)(25786008)(6512007)(189998001)(54906002)(47776003)(6506006)(6486002)(66066001)(6116002)(3846002)(50986999)(76176999)(5009440100003)(42186005)(7736002)(7099028)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR07MB2277; H:lio357.in.caveonetworks.com; FPR:; SPF:None; MLV:nov; PTR:InfoNoRecords; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR07MB2277; 23:vXyB2eJvXCKsVq98yAstSK8PQw5d3BuIdA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JGgPeA+C2RLT4/J9a62l1rg1oSNjvFm+PGvfs?= =?us-ascii?Q?qB3oaNv7yOZ0naVBcWLa+frJJtZtZKwjuRWVk0buAZoPxV/iwaTvHCkTFxk3?= =?us-ascii?Q?0IJeKsJnXDAPKV8eG9pkpSu0eTpqlhI/i0YJMuKNHd0dsdGm2c4y28v7TGQw?= =?us-ascii?Q?uZgj+NWko2NKxcRpgF+owTwAL13tN/S400IU6Zvh50tfx+9Iw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 6:QVdtoefI5ujvlcZ1u9ThAnmbRUBNsyVX+UaGORBJ6H9FD5OFMZV1JFczA2xv78PiZJvBEE8HOf6rIsZRBRkQBKq/sAo8WxtsnoclV5IT77wLecfCkE0dvq7kVMbK0PqEMRFkZ1U8nwRhdo18Z+KpTTg02DGsP6PUI7jtZWlyvZsL1NZyw7IBsdJIiHNL9PusLtdnh1ZSkQKOxBt/lTC8bBlp1YEYZGW6LoCvUpfBe4bI9+TPFyHb2trlUNuJ4KsAQ2L45ctELggCiUwu/eCCxPPg04NO7nYHt+dnrwMeZN7EBlEhdI4tmzy8SZBu1owXn8xouYNZDrrGzdXybpNgURmOQnIrBNydqhHPaP7gJzLXiteHl5uM4FMJUJJ/0iE+GecQHwxVlZbNejrY6b4reg==; 5:SN6DdklPz+5EI3ZkayyH/k5HRi5QN8ChaeD/V7IK3WSnZg+XfKLuHyqp6rVcdPfNXHN7HwOKwG3vaDuvz3AlFchMXKC1/pfWujPuP1XpUjozT8dimaBFwy7OqipFf4j/AB9Z3KrHEEA/twgbfML/5g==; 24:341cUfyKH1MDqnkLu0aUqJN1axci7u8DQ3fdlCJU24njWf6M22bALH1lRvrW8aeTEXf/SjOwqreFBwTzu9FmGIkUYNC8ECpaKHmTSk0nFa0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR07MB2277; 7:mMSW3hwpQ/VA98l57xzV4ODrIbtTNLZF1NExk1w/vkG2KXPK9+IUQxk0LBtfe4Fe3eW/veYjafydFAiKJ2QrQrZTwLZBcNQs0sVwhfR0lRju4qQ3LdSX3bSITofOyKpVQoeMUtZpHdQ2CWifn6Im9QxUcwwS8NocHdhEtxwIVPzyPTG57zZRQweiy2uGwKKIJb3UWM9ynVJNdHWa+IEy1IWVKMJGQDkKjAjpNufWRX3z3G2laahhfHVD9wwEt0clACBvc57rO7hw8/Kcr6H48xyi8CyYVPDNIb8GGllcBoWVtL+K9bgiVBpPoP+kRC8weyjEd/Cf+RCuTvw6YVRoNg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 11:38:05.4508 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2277 Subject: [dpdk-dev] [PATCH v2 05/46] 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: Thu, 02 Mar 2017 11:38:11 -0000 Signed-off-by: Shijith Thotton Signed-off-by: Jerin Jacob Signed-off-by: Derek Chickles Signed-off-by: Venkat Koppula Signed-off-by: Srisivasubramanian S 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..9a7a894 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