From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0049.outbound.protection.outlook.com [104.47.41.49]) by dpdk.org (Postfix) with ESMTP id 3256E370 for ; Mon, 12 Dec 2016 11:32:38 +0100 (CET) Received: from DM5PR03CA0008.namprd03.prod.outlook.com (10.175.104.18) by BN1PR0301MB0740.namprd03.prod.outlook.com (10.160.78.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8; Mon, 12 Dec 2016 10:32:36 +0000 Received: from BN1AFFO11FD019.protection.gbl (2a01:111:f400:7c10::198) by DM5PR03CA0008.outlook.office365.com (2603:10b6:3:118::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.771.8 via Frontend Transport; Mon, 12 Dec 2016 10:32:35 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD019.mail.protection.outlook.com (10.58.52.79) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.761.6 via Frontend Transport; Mon, 12 Dec 2016 10:32:35 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:1030; Count:13 Received: from [127.0.0.1] ([10.232.133.65]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uBCAWRI1031917; Mon, 12 Dec 2016 03:32:31 -0700 To: Ferruh Yigit , References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> <1480875447-23680-3-git-send-email-hemant.agrawal@nxp.com> CC: , , , Cristian Sovaiala From: Hemant Agrawal Message-ID: <2946520f-1fe7-99d7-6f6b-6e2077f23178@nxp.com> Date: Mon, 12 Dec 2016 16:02:27 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-IncomingHeaderCount: 13 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131260123558463420; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39450400003)(39410400002)(39380400002)(39850400002)(39840400002)(39400400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(3190300001)(377454003)(189002)(199003)(76104003)(57704003)(24454002)(81156014)(47776003)(7246003)(7126002)(76176999)(54356999)(31686004)(65806001)(50986999)(77096006)(5660300001)(106466001)(105606002)(5001770100001)(305945005)(97736004)(189998001)(36756003)(65826007)(65956001)(38730400001)(4001350100001)(229853002)(626004)(2950100002)(6666003)(50466002)(23746002)(8936002)(120886001)(104016004)(85426001)(68736007)(92566002)(33646002)(83506001)(4326007)(8676002)(31696002)(230700001)(86362001)(356003)(64126003)(81166006)(2906002)(8666005)(7059030)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0301MB0740; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD019; 1:klSW3ePkLQLMj3QgEafZrTdoieNc2nMN7krEXpYefAN1sVu0Yh/oPf1sJSHN/ZLxTgspeOMYLVQxeBCiVBQXXnhSg8epFQAeOZWmKdB1S7/EY2mvgW7BocbBFWWS7TvYrRpDtfgQINgGphZ3Jpi43q62ryg8mFeI3kiP8two1AWfTBBcV8CT/2EuSPQsPQMfoUU3Ubz52skOcv4uGiVV4dQGPxogCYUKna2roC48MFur2nNjMcp/b9icjnk3XJuS8Bibfs9Ra++wNg4tI/SOUcNAGj8sp752bb/QzgXGyk3BM+xeRv7zD/thgqqapoz1gMBPSqOCBE6rAW1iLoh4p5RHUNTuYhaVU6AkRwCAl55pJrtNf7bmYxeD6XigEPDT8F1s5q/2FfZDmxNoRl3xKyWqR/u1KABIlyqi0K0YZloDFNR0mBe1TPUQVLGFe0dfpZbZP+ldQYghKANOzqDWaNN3splOqgi+eXe/qWQKElQUDvzf6Tkr6vvw6eFFRz5iCynSVrk/i//vfK71jJaVPhACjL4OQH3qsu0zaX6Hw0TS9InDAAJ/bw2oGBQ6V2qjpcvoOHXKXqetZBetqS3F7TRFd8HO924eYwbUgUYMntnmN2Z4HGkSnXXQziitbRYEEU7w2nvwxeZqS1dJCASAhFter8Xn1ppjQd0Ofz/lWzo= X-MS-Office365-Filtering-Correlation-Id: 24486d92-cc6f-434a-e65b-08d4227a3054 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN1PR0301MB0740; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 3:SzxB4OUSFzElPQmKdJKwyEFSovrczItNCb3fdDlaBltnHTqIeXmvS2E64F7mFivE8pWeSt4mf66YGn3wPIKiOnqmpcLt5YEARtkge+LbkpIT6m7Qq0M5C595nnWh+3F6qgGIIflsVsj2Ye9OS2TShGKMJonGeggxzbnJeBhUCOSme9mKTeY+Bhw0QZYRXujmjb77U0TXDjgv04Zz78BYfz3HGQ+6IzWq4t7PkA45Ga/P/hyaXmmyb5C0MuD9YV6cruV51s7R9s/u9l/XknV3gg9TXFGfU84mv50eQNTdnfvUQc9i8BN0EEB6F3kUanxMur/C7sYEg2Xbr4IdcYgoEudMK4ZBUMMj0Fm14y/XIdKJeHp9ok0DhGd53S/mokAB X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 25:Y8SobkiNgUGAGeTeRRcDKVtoHojBjt8nVIgojcWUFtdUmuOOCKB50yXYDJpelGSXBBu9J5lfevkfgHJcd7L/zVDFtG/aNKwRKHKJggbyGt8MPR2X18rJ5LacECmbCRl5Py7SSSHLl24FHhaJAEmW1ZPZ3SM5bwdfZTZLdrOCAMyKq75Qtg2jBB3idNSxDV2FxpPwCdjKIeNqy7giCG+L8K/KlcpDGc5I66r83SoR7A1H4E1/AFmTSnSkfNV7BltTMqQhZPU7NLo98m2fC0PS6TZ1QKW40/GON4+4fcSTH7XXTnaZSrbog/COz1kEkWV5HS8n7P2ewIsWVfyC4nEgGziGw39zp3p1c5YTmIOf4VieiHBrJnvhMRAY2atlcmyC7gPvlQ7VNQGwbUp+ehUDL070CjBpjtnZNbIlDQuraSOkof9K+MOghn7PjENIAa3+B6EyqlCFKm7bzdfbLfoljmkk6li/Bw7b7yE6JDczAPA9zHpfnmqxuhaD4BpA7D7qRM5MM/mnX1VgyXWP9oSsmsdMigJbHO+eB3xoYw3F32LWgSYbHIxkKI+TH7L5iR8cyoywepx5k3ED+M2LOHQRcoHe2z5AmniCnMCZB0kA27sri7Ucmg3XPR7tqq54qTzymSiTDWwtAv8pJMXaoRU8JEEbQWz4IfIaM8ybNe93v8d4XcUdq5AjQ+gZWXiRTNtURBGPdbz8YhGHJyft9VcG8ooQKcODiorLSnXAFYAH5S/FW2oAChnHSCSDp07IR5tenKgM52yTP04FE3QpnOXLpLXgV6x/uiFZiEM8bb86tsk= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 31:LWF0BMABSoDm3ETjKHGgK3JzxRwjjlJZ7CYw8rQDDDF8TptsmNV6q3mWCN2B1+tKFosyZFbWKwP+fxB0ediaMqbUhq3V5jNqB0QtL3Z6s1CtBdIOmj+Mjt+dA5MjVdS4s9KAsqYRPIppWAPSibQnAgC2uOYwTgMhyHJvVOLAxTwoDf7dAgE6jKnz6CZB0YGwzyZfAJS+YPyyiH2XD5Bww+MsQ1Ix/sKPTokv8t5dBwe12zXccIjdSMjK5wtAC844uXQ5JxETggbUd3szb7GQqdxDyRMM3cUMPRuNbFlJtWQ= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13017025)(13015025)(13023025)(13024025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6096035)(20161123559025)(20161123565025)(20161123563025)(20161123556025)(20161123561025); SRVR:BN1PR0301MB0740; BCL:0; PCL:0; RULEID:(400006); SRVR:BN1PR0301MB0740; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 4:hyH7XsI7bA8OlQvBxJ0+WrwWaHLB2V44a/tsqYTswx7ZQtr4AYgtk+cKC2c+UikyoMCoZpgbfkR3GwKWw7XscOzoWFjkT4z7oOFbkbJahQ7TknIwBs03PD5WYkvd0e1ac+ZAnauZ9WWeXbh33zvZVd9/lsC3Seqo9L1eQhsH/NFT6KcydEo4l0GfcrvYayiJyvT+J1syQn8WZAaP0MUX4MhNm6xEsKpy9+57VYka2/rlYN36lOaCbNZDj4LBc7NNEUjhEBNYjwPEGA4enoJukF55c38GsUhhgZqRgv9HnxQfGTXd8gRZu96oo5nX+T9j2lKFA08Lds0rOhsNa8JmJNwLmkK9u/VjtmWCYSbCDALsBD/TlHr6wUBecBH0dIMegBRWYFwN642jToiUXZTgWlgjJpULmX0QWg4XHWW4+iEb7tS22krm7VREWyI99Pzmwz7twENNk65t8MwKL8+61W1BQKTizXfF/l+UGY///1lv21e6RMcmiDiFwQaXHEmKNUnW5BPAzGKxWE4jMxiDwhOLaTqYWCIRZF544HaQ96OxJz5EkEUsUZgFDv48CP4BhYDGuhWFVzRSJc+IaNcxuMGbUzxBemMLS9PNfqJP2ohPjORTku1ylkSD+erJ+bPlPiuNv4tEXZXbp/bVABW0lZc3IqC+GM9YD48+EaLhfd7iGFYGC8QuI33XZpk0qsaNo96+cBUkrXNitg0cISeIMWVEOQIAt+NJysAMSGZ7JTOouo0m48Pc+Su4SjjppU/iszg1x5UapQGlPtHG+rA91A== X-Forefront-PRVS: 0154C61618 X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; BN1PR0301MB0740; 23:3zqN/5lSg0GvlISHeiYK1bnbU65ZTe7+wHV?= =?Windows-1252?Q?aXdhMZdzYn3mJOx89HcWG7of3OOqdtHGKYG/Z0GmCROBQvxAV5nyT2Gp?= =?Windows-1252?Q?QLobVA9v/NrrnU+zdjZna76EnwpRFJmHU+HDz5UD0cSDGST6ky79trZK?= =?Windows-1252?Q?BYtG4eEVMUysBKDcdKcbiKoKndkIaeXQk5/NT73AYM3oBBEVehr94KzW?= =?Windows-1252?Q?j+ge0u2fwYgEZ2/EIMGqG0o5vaznJosGLACebUshHe2PgP1ktYljIp9t?= =?Windows-1252?Q?o4zuNbxINiIxSYrz1N5FcEDchuox5bcURz8HYKxdFXC9sV6EWFy416VS?= =?Windows-1252?Q?kFa+9JVhS87JdOkNnC4GJKiBzYkjg2sHD5W71/Xv9RgwJWgic2HhYhi9?= =?Windows-1252?Q?/23cJeflSDQvjSiSKxTSDJcUTnK+0SRiY5OGj5IJIZeE9wXWCa7yNKxE?= =?Windows-1252?Q?rfBYvOLh+i+M10gxgA3jLeiT91lyV07QQZzWBzTVklA1JJpW3dCuZx6S?= =?Windows-1252?Q?b3UZp2Wm+WyI8UgWoKGLe9JBRlMMmAPeBC4aI6R1kRmW8lSbGWyG3yKE?= =?Windows-1252?Q?00jykqdUSWBmg2E/yxBLsPnZ7AtykIaRMgQekWApp7sIMUn7pbdQzXQs?= =?Windows-1252?Q?e4WdIk7wmwevY9tWGMBsDo/av94BPUuSWYIYD2wJgFKFLh8GSxLsNLgL?= =?Windows-1252?Q?KuAwbT3GTeyDDqjbkgWX7kgQwjOMhjVEg78JrbqKFOc5biXkjSMzZSf9?= =?Windows-1252?Q?5ezWXEFkLPTXydmqBAXc9R2xQFQgU10Rhb3UYTi9OvCcwd6+5wPHMQjt?= =?Windows-1252?Q?adItDgBWjRmou5kyiFJKWOkiOJUvy7PAoQizDY/Zf6mtLDwee7pbjHgP?= =?Windows-1252?Q?SpQrUS/lZcd/q9ugX07p7T1UngUu/wqTSRxU+kLIh78IoOp1pnIp7IV5?= =?Windows-1252?Q?bL5Fr0jmJxMjkWLDmZwi3fttp29MuzPokNP50OfRB8Wk+M1QJn8Cm07Y?= =?Windows-1252?Q?X5Lp3FHUvLoTVOEaOao4lZh2f/REhujzIBSnDsxB5szqJDny9Gop3Xf0?= =?Windows-1252?Q?VR7dd+kooVjpwpLOsuNP++9JxDIeszjdj9Qbo1MOpfum2kl8dtyIsqpR?= =?Windows-1252?Q?R2QWGVwoIS4C7SHyL+5DabB7vxa88ShLca4upB+8fN9y9e0BO2SM6ZPx?= =?Windows-1252?Q?h83xZV4snawIlAYotizD04xUuUS9PBANSUjkbxGpxL4gg7ltEvX6Txl3?= =?Windows-1252?Q?Kf9Yk0gMi3NQd8jgPgm1hI6KS7Ti+pGQDD4k9nCOvqXUvJzZmWqfTFkY?= =?Windows-1252?Q?AakdORLaRGwp1S5RrYvOydeJl7mWKG/vHnkkRO0AhadvvE3bheCDHweX?= =?Windows-1252?Q?Sry1S4mRSvfHNkrj7tNXn9tvCMjBe990W4XrYf8kDU+5D1VxjArkur4J?= =?Windows-1252?Q?xSaC7idoBsaQdtuxMbg9nrXMF6kat98Ng5kZLdGFCklvrQIf+lvHS5TR?= =?Windows-1252?Q?3J1FIF/A+WYGYHX+IIaDBNHoc3HwpqsCRRuOvMYgMFXrh5R3Ljv6kby0?= =?Windows-1252?Q?Umfuyzvgjd5JenUGps5ThBWSDupn7u8pD27VAZ5xktVp4pG+jm6gSQBu?= =?Windows-1252?Q?frId2afDGd+AD/sE9wv6otKx1glf/QZNsqpxTQFeXx+iRNi8vwpEw+4x?= =?Windows-1252?Q?w5sBk3mEZZyQSHwA3757yWBhvqOqCEL95S8P/JS5ZgdQT08vSfGt+jZf?= =?Windows-1252?Q?2ZAe96HScF1bDhddWcuCDhzzK5VN1a0KQ4FISP9o=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 6:tRp++f/a1IwRD6EJew3MEhZ1C4grBpl5npOqy2Xs2h6RgfkQT4h2QU/nQzpCIjxsB1z1G6+TznOrYE000g46Yd102lOv5pU/aYvjHQTIYjkcEVxrBJOZOn9OQxdvkkegggCz+/rX6y4boQpcqu1TFR/ZncSdjj0OK/bnvYX8B+dkdZr+DW+PoPiZk47CjBhBuQRp/1bapoCtTOTrrEGw/DRR+OSqqUNVf2Ks0TxDz8HxYbtcbdbpP1W20Ny6IVMzoWFXQyzHhQbvchB2SPBDJ846TeBwYm74PXRGMTzYTTAfj53xQbPdEzieGUW3Agd7Boz5POy0rmhDEP9BEehjBVWfR/ymywWDLCYX7mWeknLMpf/FSGsfLBUapkbp7w39jtbh7DO8AUres4BrkoKc5JBq4pWQaDf7fK2jDW8m0xCX0c5JM1kQcF3HXpCMb6fY; 5:f8s4fUC0fKMynENgJet1gju978nsfyFRQtg6cB+yT/dgwZNKJNalaAwwizRRyqNoOas8cKCsjR7txRJQGFq79tCJjfK5hN0PP3iKflaQa4+MzOkD1WFU/vRfYMqeghDniBclgyQvK3JFis6bhs7+87dSv4r6lxVH6QnS5Jj//NkOulPFwr+NYOwCp+EhjUwY; 24:+EuvYrW/YMwG6ZaeZf2ZNTRStr3+NpNfJwo12ZZ6PLKfawaWIQc6MUZ7zWUDePJA4Ju1JBj4yTxZVi/52I7JKePTCw5CgQ+QfzpixLrJ55w= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0301MB0740; 7:/z3OszqTAdK7jbklzCSl8DHRoGA3FgwXa2EVuEUrihpqcCoGmSTvz4hE6wbmW/6VT+J6OtZ0lA2/hj+OnRIR7Ulndcg4dhccapwy5oiAPcld4OG1w36vYh0DdiTNEUtA/Pd9mmUXE2RA+xvxKPBWog596Dt6/pDF3lbxG2SpMEYgwZyYzS+lRHKFl35dXPnEP7gEiKShvZHGqWF4t2WUkLZvzoOz0XKLrwD79DZ/EWkE7rl8Tqyx43it48swMfk5vgaIJeMaFufIZkzuPM+Giz+3/SYrWPAFe8CPYy4aInaNI4/asiUcKuFyJcQHH0kmguElVajiovmgT8cY7Fglq8/HNUc8sMDVyfFYI4nQ/IKf3guJsj/if00pnEie4obNfAzVca8F22a5Z0cursGAROUIuc/C7xZBVD0UQI38RKl1lbNsNI64c2iDZbS1bvhbX8OU/zJXkVsybLemPW7LSQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2016 10:32:35.5031 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0301MB0740 Subject: Re: [dpdk-dev] [PATCH 02/32] drivers/common: introducing dpaa2 mc driver 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: Mon, 12 Dec 2016 10:32:39 -0000 On 12/7/2016 1:18 AM, Ferruh Yigit wrote: > On 12/4/2016 6:16 PM, Hemant Agrawal wrote: >> This patch intoduces the DPAA2 MC(Management complex Driver) >> >> This driver is common to be used by various DPAA2 net, crypto >> and other drivers >> >> Signed-off-by: Cristian Sovaiala >> [Hemant:rebase and conversion to library for DPDK] > > Is this note about how work share done? Do we need this in the history? Yes! We can avoid it. >> Signed-off-by: Hemant Agrawal >> --- >> config/defconfig_arm64-dpaa2-linuxapp-gcc | 7 +- >> drivers/Makefile | 1 + >> drivers/common/Makefile | 36 +++++ >> drivers/common/dpaa2/Makefile | 36 +++++ >> drivers/common/dpaa2/mc/Makefile | 53 ++++++ >> drivers/common/dpaa2/mc/dpaa2_mc_version.map | 4 + >> drivers/common/dpaa2/mc/fsl_mc_cmd.h | 231 +++++++++++++++++++++++++++ >> drivers/common/dpaa2/mc/fsl_mc_sys.h | 98 ++++++++++++ >> drivers/common/dpaa2/mc/mc_sys.c | 126 +++++++++++++++ > > Are drivers/common/dpaa2/* files are shared code or implemented for > DPDK, I can see Linux version is different. > > If these are re-implemented for DPDK, let's follow DPDK coding rules for > a clean start, what do you think? > It is not a re-implementation. We do minor changes to make the common library work in user space with DPDK. The deviation from kernel is because it is still a work in progress there. Once it stable there, we will pull in the changes. >> 9 files changed, 591 insertions(+), 1 deletion(-) >> create mode 100644 drivers/common/Makefile >> create mode 100644 drivers/common/dpaa2/Makefile >> create mode 100644 drivers/common/dpaa2/mc/Makefile >> create mode 100644 drivers/common/dpaa2/mc/dpaa2_mc_version.map >> create mode 100644 drivers/common/dpaa2/mc/fsl_mc_cmd.h >> create mode 100644 drivers/common/dpaa2/mc/fsl_mc_sys.h >> create mode 100644 drivers/common/dpaa2/mc/mc_sys.c >> >> diff --git a/config/defconfig_arm64-dpaa2-linuxapp-gcc b/config/defconfig_arm64-dpaa2-linuxapp-gcc >> index 66df54c..00f207e 100644 >> --- a/config/defconfig_arm64-dpaa2-linuxapp-gcc >> +++ b/config/defconfig_arm64-dpaa2-linuxapp-gcc >> @@ -1,6 +1,7 @@ >> # BSD LICENSE >> # >> -# Copyright(c) 2016 Freescale Semiconductor, Inc. All rights reserved. >> +# Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. >> +# Copyright (c) 2016 NXP. All rights reserved. >> # >> # Redistribution and use in source and binary forms, with or without >> # modification, are permitted provided that the following conditions >> @@ -40,3 +41,7 @@ CONFIG_RTE_ARCH_ARM_TUNE="cortex-a57+fp+simd" >> # >> CONFIG_RTE_MAX_LCORE=8 >> CONFIG_RTE_MAX_NUMA_NODES=1 >> + >> +# Compile software PMD backed by NXP DPAA2 files >> +# >> +CONFIG_RTE_LIBRTE_DPAA2_PMD=y > > Currently how it works is, default value of the config in "common_base" > and it is overwritten in specific config files. > So this config option also should go to "common_base" as disabled by > default. > > And the other config option too, mentioned in the documentation. > OK >> diff --git a/drivers/Makefile b/drivers/Makefile >> index 81c03a8..d5580f6 100644 >> --- a/drivers/Makefile >> +++ b/drivers/Makefile >> @@ -31,6 +31,7 @@ >> >> include $(RTE_SDK)/mk/rte.vars.mk >> >> +DIRS-y += common >> DIRS-y += net >> DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += crypto >> >> diff --git a/drivers/common/Makefile b/drivers/common/Makefile >> new file mode 100644 >> index 0000000..0c3f35f >> --- /dev/null >> +++ b/drivers/common/Makefile >> @@ -0,0 +1,36 @@ >> +# BSD LICENSE >> +# >> +# Copyright(c) 2016 NXP. All rights reserved. >> +# All rights reserved. >> +# >> +# Redistribution and use in source and binary forms, with or without >> +# modification, are permitted provided that the following conditions >> +# are met: >> +# >> +# * Redistributions of source code must retain the above copyright >> +# notice, this list of conditions and the following disclaimer. >> +# * Redistributions in binary form must reproduce the above copyright >> +# notice, this list of conditions and the following disclaimer in >> +# the documentation and/or other materials provided with the >> +# distribution. >> +# * Neither the name of NXP nor the names of its >> +# contributors may be used to endorse or promote products derived >> +# from this software without specific prior written permission. >> +# >> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >> +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >> +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >> +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >> +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >> +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >> +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >> +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >> +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >> +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >> +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> + >> +include $(RTE_SDK)/mk/rte.vars.mk >> + >> +DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += dpaa2 >> + >> +include $(RTE_SDK)/mk/rte.subdir.mk >> diff --git a/drivers/common/dpaa2/Makefile b/drivers/common/dpaa2/Makefile >> new file mode 100644 >> index 0000000..a4f80c1 >> --- /dev/null >> +++ b/drivers/common/dpaa2/Makefile >> @@ -0,0 +1,36 @@ >> +# BSD LICENSE >> +# >> +# Copyright(c) 2016 NXP. All rights reserved. >> +# All rights reserved. >> +# >> +# Redistribution and use in source and binary forms, with or without >> +# modification, are permitted provided that the following conditions >> +# are met: >> +# >> +# * Redistributions of source code must retain the above copyright >> +# notice, this list of conditions and the following disclaimer. >> +# * Redistributions in binary form must reproduce the above copyright >> +# notice, this list of conditions and the following disclaimer in >> +# the documentation and/or other materials provided with the >> +# distribution. >> +# * Neither the name of NXP nor the names of its >> +# contributors may be used to endorse or promote products derived >> +# from this software without specific prior written permission. >> +# >> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >> +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >> +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >> +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >> +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >> +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >> +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >> +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >> +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >> +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >> +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> + >> +include $(RTE_SDK)/mk/rte.vars.mk >> + >> +DIRS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc >> + >> +include $(RTE_SDK)/mk/rte.subdir.mk >> diff --git a/drivers/common/dpaa2/mc/Makefile b/drivers/common/dpaa2/mc/Makefile >> new file mode 100644 >> index 0000000..9632168 >> --- /dev/null >> +++ b/drivers/common/dpaa2/mc/Makefile >> @@ -0,0 +1,53 @@ >> +# BSD LICENSE >> +# >> +# Copyright(c) 2016 NXP. All rights reserved. >> +# All rights reserved. >> +# >> +# Redistribution and use in source and binary forms, with or without >> +# modification, are permitted provided that the following conditions >> +# are met: >> +# >> +# * Redistributions of source code must retain the above copyright >> +# notice, this list of conditions and the following disclaimer. >> +# * Redistributions in binary form must reproduce the above copyright >> +# notice, this list of conditions and the following disclaimer in >> +# the documentation and/or other materials provided with the >> +# distribution. >> +# * Neither the name of NXP nor the names of its >> +# contributors may be used to endorse or promote products derived >> +# from this software without specific prior written permission. >> +# >> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >> +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >> +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >> +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >> +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >> +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >> +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >> +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >> +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >> +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >> +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> + >> +include $(RTE_SDK)/mk/rte.vars.mk >> +RTE_SDK_MC=$(RTE_SDK)/drivers/common/dpaa2 >> + >> +# >> +# library name >> +# >> +LIB = libdpaa2_mc.a > > Not sure about this name, what do you think sticking the name used for > pmd, like: librte_pmd_dpaa2_mc.a ? We can do it. however dpaa2_mc is not a pmd in itself. It is library for dpaa2 PMDs (net and crypto). We did this to distinguish from a regular PMD. Do you suggest something else? >> + >> +CFLAGS += -O3 >> +CFLAGS += $(WERROR_FLAGS) >> +CFLAGS +=-Wno-strict-aliasing >> + >> +CFLAGS += -I$(RTE_SDK_MC)/mc >> +EXPORT_MAP := dpaa2_mc_version.map > > Same comment for version file naming, rte_pmd_dpaa2_mc_version.map ? > >> + >> +LIBABIVER := 1 >> + >> +SRCS-y += \ >> + mc_sys.c > > Also this is fine, since this folder included only if > CONFIG_RTE_LIBRTE_DPAA2_PMD=y, to be consistent for rest of the Makefiles: > SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_PMD) += mc_sys.c > OK >> + >> + >> +include $(RTE_SDK)/mk/rte.lib.mk >> diff --git a/drivers/common/dpaa2/mc/dpaa2_mc_version.map b/drivers/common/dpaa2/mc/dpaa2_mc_version.map >> new file mode 100644 >> index 0000000..31eca32 >> --- /dev/null >> +++ b/drivers/common/dpaa2/mc/dpaa2_mc_version.map >> @@ -0,0 +1,4 @@ >> +DPDK_17.02 { >> + >> + local: *; >> +}; >> diff --git a/drivers/common/dpaa2/mc/fsl_mc_cmd.h b/drivers/common/dpaa2/mc/fsl_mc_cmd.h >> new file mode 100644 >> index 0000000..cbd3995 >> --- /dev/null >> +++ b/drivers/common/dpaa2/mc/fsl_mc_cmd.h >> @@ -0,0 +1,231 @@ >> +/* Copyright 2013-2016 Freescale Semiconductor Inc. >> + * Copyright (c) 2016 NXP. >> + * >> + * Redistribution and use in source and binary forms, with or without >> + * modification, are permitted provided that the following conditions are met: >> + * * Redistributions of source code must retain the above copyright >> + * notice, this list of conditions and the following disclaimer. >> + * * Redistributions in binary form must reproduce the above copyright >> + * notice, this list of conditions and the following disclaimer in the >> + * documentation and/or other materials provided with the distribution. >> + * * Neither the name of the above-listed copyright holders nor the >> + * names of any contributors may be used to endorse or promote products >> + * derived from this software without specific prior written permission. >> + * >> + * >> + * ALTERNATIVELY, this software may be distributed under the terms of the >> + * GNU General Public License ("GPL") as published by the Free Software >> + * Foundation, either version 2 of that License or (at your option) any >> + * later version. >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" >> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE >> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE >> + * POSSIBILITY OF SUCH DAMAGE. >> + */ >> +#ifndef __FSL_MC_CMD_H >> +#define __FSL_MC_CMD_H >> + >> +#define MC_CMD_NUM_OF_PARAMS 7 >> + >> +#define MAKE_UMASK64(_width) \ >> + ((uint64_t)((_width) < 64 ? ((uint64_t)1 << (_width)) - 1 : \ >> + (uint64_t)-1)) >> + >> +static inline uint64_t mc_enc(int lsoffset, int width, uint64_t val) >> +{ >> + return (uint64_t)(((uint64_t)val & MAKE_UMASK64(width)) << lsoffset); >> +} >> + >> +static inline uint64_t mc_dec(uint64_t val, int lsoffset, int width) >> +{ >> + return (uint64_t)((val >> lsoffset) & MAKE_UMASK64(width)); >> +} >> + >> +struct mc_command { >> + uint64_t header; >> + uint64_t params[MC_CMD_NUM_OF_PARAMS]; >> +}; >> + >> +/** >> + * enum mc_cmd_status - indicates MC status at command response >> + * @MC_CMD_STATUS_OK: Completed successfully >> + * @MC_CMD_STATUS_READY: Ready to be processed >> + * @MC_CMD_STATUS_AUTH_ERR: Authentication error >> + * @MC_CMD_STATUS_NO_PRIVILEGE: No privilege >> + * @MC_CMD_STATUS_DMA_ERR: DMA or I/O error >> + * @MC_CMD_STATUS_CONFIG_ERR: Configuration error >> + * @MC_CMD_STATUS_TIMEOUT: Operation timed out >> + * @MC_CMD_STATUS_NO_RESOURCE: No resources >> + * @MC_CMD_STATUS_NO_MEMORY: No memory available >> + * @MC_CMD_STATUS_BUSY: Device is busy >> + * @MC_CMD_STATUS_UNSUPPORTED_OP: Unsupported operation >> + * @MC_CMD_STATUS_INVALID_STATE: Invalid state >> + */ >> +enum mc_cmd_status { >> + MC_CMD_STATUS_OK = 0x0, >> + MC_CMD_STATUS_READY = 0x1, >> + MC_CMD_STATUS_AUTH_ERR = 0x3, >> + MC_CMD_STATUS_NO_PRIVILEGE = 0x4, >> + MC_CMD_STATUS_DMA_ERR = 0x5, >> + MC_CMD_STATUS_CONFIG_ERR = 0x6, >> + MC_CMD_STATUS_TIMEOUT = 0x7, >> + MC_CMD_STATUS_NO_RESOURCE = 0x8, >> + MC_CMD_STATUS_NO_MEMORY = 0x9, >> + MC_CMD_STATUS_BUSY = 0xA, >> + MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, >> + MC_CMD_STATUS_INVALID_STATE = 0xC >> +}; >> + >> +/* MC command flags */ >> + >> +/** >> + * High priority flag >> + */ >> +#define MC_CMD_FLAG_PRI 0x00008000 >> +/** >> + * Command completion flag >> + */ >> +#define MC_CMD_FLAG_INTR_DIS 0x01000000 >> + >> +/** >> + * Command ID field offset >> + */ >> +#define MC_CMD_HDR_CMDID_O 48 >> +/** >> + * Command ID field size >> + */ >> +#define MC_CMD_HDR_CMDID_S 16 >> +/** >> + * Token field offset >> + */ >> +#define MC_CMD_HDR_TOKEN_O 32 >> +/** >> + * Token field size >> + */ >> +#define MC_CMD_HDR_TOKEN_S 16 >> +/** >> + * Status field offset >> + */ >> +#define MC_CMD_HDR_STATUS_O 16 >> +/** >> + * Status field size >> + */ >> +#define MC_CMD_HDR_STATUS_S 8 >> +/** >> + * Flags field offset >> + */ >> +#define MC_CMD_HDR_FLAGS_O 0 >> +/** >> + * Flags field size >> + */ >> +#define MC_CMD_HDR_FLAGS_S 32 >> +/** >> + * Command flags mask >> + */ >> +#define MC_CMD_HDR_FLAGS_MASK 0xFF00FF00 >> + >> +#define MC_CMD_HDR_READ_STATUS(_hdr) \ >> + ((enum mc_cmd_status)mc_dec((_hdr), \ >> + MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S)) >> + >> +#define MC_CMD_HDR_READ_TOKEN(_hdr) \ >> + ((uint16_t)mc_dec((_hdr), MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S)) >> + >> +#define MC_PREP_OP(_ext, _param, _offset, _width, _type, _arg) \ >> + ((_ext)[_param] |= cpu_to_le64(mc_enc((_offset), (_width), _arg))) >> + >> +#define MC_EXT_OP(_ext, _param, _offset, _width, _type, _arg) \ >> + (_arg = (_type)mc_dec(cpu_to_le64(_ext[_param]), (_offset), (_width))) >> + >> +#define MC_CMD_OP(_cmd, _param, _offset, _width, _type, _arg) \ >> + ((_cmd).params[_param] |= mc_enc((_offset), (_width), _arg)) >> + >> +#define MC_RSP_OP(_cmd, _param, _offset, _width, _type, _arg) \ >> + (_arg = (_type)mc_dec(_cmd.params[_param], (_offset), (_width))) >> + >> +/* cmd, param, offset, width, type, arg_name */ >> +#define CMD_CREATE_RSP_GET_OBJ_ID_PARAM0(cmd, object_id) \ >> + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, object_id) >> + >> +/* cmd, param, offset, width, type, arg_name */ >> +#define CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id) \ >> + MC_CMD_OP(cmd, 0, 0, 32, uint32_t, object_id) >> + >> +static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id, >> + uint32_t cmd_flags, >> + uint16_t token) >> +{ >> + uint64_t hdr; >> + >> + hdr = mc_enc(MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S, cmd_id); >> + hdr |= mc_enc(MC_CMD_HDR_FLAGS_O, MC_CMD_HDR_FLAGS_S, >> + (cmd_flags & MC_CMD_HDR_FLAGS_MASK)); >> + hdr |= mc_enc(MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S, token); >> + hdr |= mc_enc(MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S, >> + MC_CMD_STATUS_READY); >> + >> + return hdr; >> +} >> + >> +/** >> + * mc_write_command - writes a command to a Management Complex (MC) portal >> + * >> + * @portal: pointer to an MC portal >> + * @cmd: pointer to a filled command >> + */ >> +static inline void mc_write_command(struct mc_command __iomem *portal, >> + struct mc_command *cmd) >> +{ >> + int i; >> + uint32_t word; >> + >> + /* copy command parameters into the portal */ >> + for (i = 0; i < MC_CMD_NUM_OF_PARAMS; i++) >> + iowrite64(cmd->params[i], &portal->params[i]); >> + >> + /* submit the command by writing the header */ >> + word = (uint32_t)mc_dec(cmd->header, 32, 32); >> + iowrite32(word, (((uint32_t *)&portal->header) + 1)); >> + >> + word = (uint32_t)mc_dec(cmd->header, 0, 32); >> + iowrite32(word, (uint32_t *)&portal->header); >> +} >> + >> +/** >> + * mc_read_response - reads the response for the last MC command from a >> + * Management Complex (MC) portal >> + * >> + * @portal: pointer to an MC portal >> + * @resp: pointer to command response buffer >> + * >> + * Returns MC_CMD_STATUS_OK on Success; Error code otherwise. >> + */ >> +static inline enum mc_cmd_status mc_read_response( >> + struct mc_command __iomem *portal, >> + struct mc_command *resp) >> +{ >> + int i; >> + enum mc_cmd_status status; >> + >> + /* Copy command response header from MC portal: */ >> + resp->header = ioread64(&portal->header); >> + status = MC_CMD_HDR_READ_STATUS(resp->header); >> + if (status != MC_CMD_STATUS_OK) >> + return status; >> + >> + /* Copy command response data from MC portal: */ >> + for (i = 0; i < MC_CMD_NUM_OF_PARAMS; i++) >> + resp->params[i] = ioread64(&portal->params[i]); >> + >> + return status; >> +} >> + >> +#endif /* __FSL_MC_CMD_H */ >> diff --git a/drivers/common/dpaa2/mc/fsl_mc_sys.h b/drivers/common/dpaa2/mc/fsl_mc_sys.h >> new file mode 100644 >> index 0000000..d9d43e5 >> --- /dev/null >> +++ b/drivers/common/dpaa2/mc/fsl_mc_sys.h >> @@ -0,0 +1,98 @@ >> +/* Copyright 2013-2015 Freescale Semiconductor Inc. >> + * >> + * Redistribution and use in source and binary forms, with or without >> + * modification, are permitted provided that the following conditions are met: >> + * * Redistributions of source code must retain the above copyright >> + * notice, this list of conditions and the following disclaimer. >> + * * Redistributions in binary form must reproduce the above copyright >> + * notice, this list of conditions and the following disclaimer in the >> + * documentation and/or other materials provided with the distribution. >> + * * Neither the name of the above-listed copyright holders nor the >> + * names of any contributors may be used to endorse or promote products >> + * derived from this software without specific prior written permission. >> + * >> + * >> + * ALTERNATIVELY, this software may be distributed under the terms of the >> + * GNU General Public License ("GPL") as published by the Free Software >> + * Foundation, either version 2 of that License or (at your option) any >> + * later version. >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" >> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE >> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE >> + * POSSIBILITY OF SUCH DAMAGE. >> + */ >> +#ifndef _FSL_MC_SYS_H >> +#define _FSL_MC_SYS_H >> + >> +#ifdef __linux_driver__ >> + >> +#include >> +#include >> +#include >> + >> +struct fsl_mc_io { >> + void *regs; >> +}; >> + >> +#ifndef ENOTSUP >> +#define ENOTSUP 95 >> +#endif >> + >> +#define ioread64(_p) readq(_p) >> +#define iowrite64(_v, _p) writeq(_v, _p) >> + >> +#else /* __linux_driver__ */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#define cpu_to_le64(x) __cpu_to_le64(x) >> +#ifndef dmb >> +#define dmb() {__asm__ __volatile__("" : : : "memory"); } >> +#endif >> +#define __iormb() dmb() >> +#define __iowmb() dmb() >> +#define __arch_getq(a) (*(volatile unsigned long *)(a)) >> +#define __arch_putq(v, a) (*(volatile unsigned long *)(a) = (v)) >> +#define __arch_putq32(v, a) (*(volatile unsigned int *)(a) = (v)) >> +#define readq(c) \ >> + ({ uint64_t __v = __arch_getq(c); __iormb(); __v; }) >> +#define writeq(v, c) \ >> + ({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; }) >> +#define writeq32(v, c) \ >> + ({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; }) >> +#define ioread64(_p) readq(_p) >> +#define iowrite64(_v, _p) writeq(_v, _p) >> +#define iowrite32(_v, _p) writeq32(_v, _p) >> +#define __iomem >> + >> +struct fsl_mc_io { >> + void *regs; >> +}; >> + >> +#ifndef ENOTSUP >> +#define ENOTSUP 95 >> +#endif >> + >> +/*GPP is supposed to use MC commands with low priority*/ >> +#define CMD_PRI_LOW 0 /*!< Low Priority command indication */ >> + >> +struct mc_command; >> + >> +int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd); >> + >> +#endif /* __linux_driver__ */ >> + >> +#endif /* _FSL_MC_SYS_H */ >> diff --git a/drivers/common/dpaa2/mc/mc_sys.c b/drivers/common/dpaa2/mc/mc_sys.c >> new file mode 100644 >> index 0000000..e12a18b >> --- /dev/null >> +++ b/drivers/common/dpaa2/mc/mc_sys.c >> @@ -0,0 +1,126 @@ >> +/* Copyright 2013-2015 Freescale Semiconductor Inc. >> + * >> + * Redistribution and use in source and binary forms, with or without >> + * modification, are permitted provided that the following conditions are met: >> + * * Redistributions of source code must retain the above copyright >> + * notice, this list of conditions and the following disclaimer. >> + * * Redistributions in binary form must reproduce the above copyright >> + * notice, this list of conditions and the following disclaimer in the >> + * documentation and/or other materials provided with the distribution. >> + * * Neither the name of the above-listed copyright holders nor the >> + * names of any contributors may be used to endorse or promote products >> + * derived from this software without specific prior written permission. >> + * >> + * >> + * ALTERNATIVELY, this software may be distributed under the terms of the >> + * GNU General Public License ("GPL") as published by the Free Software >> + * Foundation, either version 2 of that License or (at your option) any >> + * later version. >> + * >> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" >> + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE >> + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE >> + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >> + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >> + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >> + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >> + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >> + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE >> + * POSSIBILITY OF SUCH DAMAGE. >> + */ >> +#include >> +#include >> + >> +/** User space framework uses MC Portal in shared mode. Following change >> +* introduces lock in MC FLIB >> +*/ >> + >> +/** >> +* The mc_spinlock_t type. >> +*/ >> +typedef struct { >> + volatile int locked; /**< lock status 0 = unlocked, 1 = locked */ >> +} mc_spinlock_t; >> + >> +/** >> +* A static spinlock initializer. >> +*/ >> +static mc_spinlock_t mc_portal_lock = { 0 }; >> + >> +static inline void mc_pause(void) {} >> + >> +static inline void mc_spinlock_lock(mc_spinlock_t *sl) >> +{ >> + while (__sync_lock_test_and_set(&sl->locked, 1)) >> + while (sl->locked) >> + mc_pause(); >> +} >> + >> +static inline void mc_spinlock_unlock(mc_spinlock_t *sl) >> +{ >> + __sync_lock_release(&sl->locked); >> +} >> + >> +static int mc_status_to_error(enum mc_cmd_status status) >> +{ >> + switch (status) { >> + case MC_CMD_STATUS_OK: >> + return 0; >> + case MC_CMD_STATUS_AUTH_ERR: >> + return -EACCES; /* Token error */ >> + case MC_CMD_STATUS_NO_PRIVILEGE: >> + return -EPERM; /* Permission denied */ >> + case MC_CMD_STATUS_DMA_ERR: >> + return -EIO; /* Input/Output error */ >> + case MC_CMD_STATUS_CONFIG_ERR: >> + return -EINVAL; /* Device not configured */ >> + case MC_CMD_STATUS_TIMEOUT: >> + return -ETIMEDOUT; /* Operation timed out */ >> + case MC_CMD_STATUS_NO_RESOURCE: >> + return -ENAVAIL; /* Resource temporarily unavailable */ >> + case MC_CMD_STATUS_NO_MEMORY: >> + return -ENOMEM; /* Cannot allocate memory */ >> + case MC_CMD_STATUS_BUSY: >> + return -EBUSY; /* Device busy */ >> + case MC_CMD_STATUS_UNSUPPORTED_OP: >> + return -ENOTSUP; /* Operation not supported by device */ >> + case MC_CMD_STATUS_INVALID_STATE: >> + return -ENODEV; /* Invalid device state */ >> + default: >> + break; >> + } >> + >> + /* Not expected to reach here */ >> + return -EINVAL; >> +} >> + >> +int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd) >> +{ >> + enum mc_cmd_status status; >> + >> + if (!mc_io || !mc_io->regs) >> + return -EACCES; >> + >> + /* --- Call lock function here in case portal is shared --- */ >> + mc_spinlock_lock(&mc_portal_lock); >> + >> + mc_write_command(mc_io->regs, cmd); >> + >> + /* Spin until status changes */ >> + do { >> + status = MC_CMD_HDR_READ_STATUS(ioread64(mc_io->regs)); >> + >> + /* --- Call wait function here to prevent blocking --- >> + * Change the loop condition accordingly to exit on timeout. >> + */ >> + } while (status == MC_CMD_STATUS_READY); >> + >> + /* Read the response back into the command buffer */ >> + mc_read_response(mc_io->regs, cmd); >> + >> + /* --- Call unlock function here in case portal is shared --- */ >> + mc_spinlock_unlock(&mc_portal_lock); >> + >> + return mc_status_to_error(status); >> +} >> > >