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 82ACAA04F3; Thu, 9 Jan 2020 08:07:51 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B0E7A1DB9E; Thu, 9 Jan 2020 08:07:50 +0100 (CET) Received: from NAM04-SN1-obe.outbound.protection.outlook.com (mail-eopbgr700063.outbound.protection.outlook.com [40.107.70.63]) by dpdk.org (Postfix) with ESMTP id 5EBBE1DB2F for ; Thu, 9 Jan 2020 08:07:49 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G/Xpb1e55V/IwcKqK7W37t1aodDzYjYjnDn+2FOwTSj/7jsR1qHMtpeD9E1ONkZUDurXJYl2RbMRnMY7jchrRpPGUtif/UgR5yNeQ+muvThGouuHNwtoa0Hub3X3FrE/t76f0YejbrZmbO9hl9kbt4laBkh7EZ+MmDbhUPklPhvUTvNYYR7SmuqxuKhDxlhhB8F8/poZItQKRl5zhrR2IqEfUeo0YOJ64xDMvnhE6Y9o+NNgKx/Z2Vfd6hj0HDNyXys+CTn+0PPFjcI4rQmxPBUsey9uIfT2/5pF0v/Y+0tcFoWX90L/aod+owPhOdgq4usJAOfuP9N4tPDdxP0xMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0PN+7cVeYTSK5hkeKXyyQYI4W96ZTcs0uIh5T9sNVq8=; b=FsPYs7E9BjEfneYppbHWE7FzdeKlteZ60EliQIEQwA9VneMxf/8rqKDwmpcIF/tSKnYLhUixTcRBhwu0Ls/oWxRM5UG92zd8n9t3/aY5Ctub3YJUllqtpVBjOqi6RnL0p3Lj3f7UYoNzjTiqRmHNrZqfhUuJrfMj+WrPTofrjXo3DvWcrssi9AoEPWsG+BUW/YXs4fbobCTdTrJXEz9II7rDUaEa0e1NqOR7e2aHLoQ8CgyqASdizQSE5BKLF6m5UiRhZ/N4cTAnRbsuKiX0vZDWlO4TtEz5moksSRtMy7vAvFfCPvOtCgKlmpq28lODaCZLDwB/39COZ5cBPOhDqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0PN+7cVeYTSK5hkeKXyyQYI4W96ZTcs0uIh5T9sNVq8=; b=XZXucKqpki3wU3ChEvSg4ztc63C2EcWKr650HYQyhPY52c/Yq8d2RlXrwUrPmNVfuyjM8f/Z93xzqlhwjUU2WljbR9UE5wowwttYwaUNoiNS6SI+IfbDeqPEa8Ldm0CIPCjKh9jFmNlZ2bKcO16obT7oTLMW6a1MjOfLsFckm9w= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Selwin.Sebastian@amd.com; Received: from SN6PR12MB2704.namprd12.prod.outlook.com (52.135.104.148) by SN6PR12MB2622.namprd12.prod.outlook.com (52.135.104.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9; Thu, 9 Jan 2020 07:07:47 +0000 Received: from SN6PR12MB2704.namprd12.prod.outlook.com ([fe80::41ba:11c1:62c9:3188]) by SN6PR12MB2704.namprd12.prod.outlook.com ([fe80::41ba:11c1:62c9:3188%7]) with mapi id 15.20.2602.016; Thu, 9 Jan 2020 07:07:47 +0000 From: Selwin Sebastian To: dev@dpdk.org Cc: Selwin Sebastian , Selwin Sebastian Date: Thu, 9 Jan 2020 18:09:37 +0530 Message-Id: <20200109123937.10658-1-Selwin.Sebastian@amd.com> X-Mailer: git-send-email 2.17.1 Content-Type: text/plain X-ClientProxiedBy: MA1PR01CA0111.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::27) To SN6PR12MB2704.namprd12.prod.outlook.com (2603:10b6:805:72::20) MIME-Version: 1.0 Received: from cae-dibler.amd.com (165.204.157.251) by MA1PR01CA0111.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:1::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10 via Frontend Transport; Thu, 9 Jan 2020 07:07:45 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.157.251] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: f6717f13-b912-4b1f-04e6-08d794d2a18f X-MS-TrafficTypeDiagnostic: SN6PR12MB2622:|SN6PR12MB2622: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-Forefront-PRVS: 02778BF158 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(366004)(346002)(136003)(396003)(39860400002)(189003)(199004)(2906002)(6666004)(66556008)(478600001)(66946007)(66476007)(54906003)(6916009)(36756003)(4326008)(956004)(86362001)(6486002)(1076003)(2616005)(26005)(186003)(16526019)(7696005)(52116002)(81156014)(8676002)(316002)(8936002)(5660300002)(81166006); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR12MB2622; H:SN6PR12MB2704.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n7WYfpEcExZeld2jLnoCiudenwoabUCCc22pmL4CMGAdSWgLwR0w+klnRf64Ul5NsCtsQqtXMKTXdaOX+ruuacF5iRT//hJBITgEg5rUGmHwyyfaPpJ5KWogqQEen9hHHh+CXxlb18Aoeib3ErqTxn30bQbdPeKAREilpEhatrxlF92Huqq5rGQAqTQMGbHJWrQWvSnaU8VbWsfhfgo/RwUaWPu93sNCvZF2zapVQL+IDedieK69W087RKDryQDz03L7Z4ZPulTohqKpv2lRE2F98j5oh8UUL1tky44lO2vuzg1wHF4j8vvGi3zsJBZSyAr+5j5MR3IM+FyBsMSCzQxZ7h5QecbUoABzaTPXFUetphT2GQS0ZnaXHKox2BLW/Isz3pIJQUSZvxTjLJ57XDC9BTyCWTfk2GarEE8MDagtzcb+SHdnLd18MFRzK4Fi X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6717f13-b912-4b1f-04e6-08d794d2a18f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2020 07:07:47.4809 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nQS/b50hASq40lv6DwfNaNXDJYnoDpi72Jm2ZW0s96NYBoUCMDBdjjPUdpUnGfip7YqmQ7u/7xI1a8QLx+2mnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2622 Subject: [dpdk-dev] [PATCH v2] net/axgbe: add a HW quirk for register definitions 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" V1000/R1000 processors are using the same PCI ids for the network device as SNOWYOWL processor but has altered register definitions for determining the window settings for the indirect PCS access. Add support to check for this hardware and if found use the new register values Signed-off-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_common.h | 2 ++ drivers/net/axgbe/axgbe_ethdev.c | 22 +++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h index 34f60f156..4a3fbac16 100644 --- a/drivers/net/axgbe/axgbe_common.h +++ b/drivers/net/axgbe/axgbe_common.h @@ -841,6 +841,8 @@ #define PCS_V1_WINDOW_SELECT 0x03fc #define PCS_V2_WINDOW_DEF 0x9060 #define PCS_V2_WINDOW_SELECT 0x9064 +#define PCS_V2_RV_WINDOW_DEF 0x1060 +#define PCS_V2_RV_WINDOW_SELECT 0x1064 /* PCS register entry bit positions and sizes */ #define PCS_V2_WINDOW_DEF_OFFSET_INDEX 6 diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index d1f160e79..c551375a4 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -29,8 +29,10 @@ static int axgbe_dev_info_get(struct rte_eth_dev *dev, /* The set of PCI devices this driver supports */ #define AMD_PCI_VENDOR_ID 0x1022 +#define AMD_PCI_RV_ROOT_COMPLEX_ID 0x15d0 #define AMD_PCI_AXGBE_DEVICE_V2A 0x1458 #define AMD_PCI_AXGBE_DEVICE_V2B 0x1459 +extern struct rte_pci_bus rte_pci_bus; int axgbe_logtype_init; int axgbe_logtype_driver; @@ -585,6 +587,7 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) struct rte_pci_device *pci_dev; uint32_t reg, mac_lo, mac_hi; int ret; + struct rte_pci_device *root_complex_dev; eth_dev->dev_ops = &axgbe_eth_dev_ops; eth_dev->rx_pkt_burst = &axgbe_recv_pkts; @@ -605,6 +608,20 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) pci_dev = RTE_DEV_TO_PCI(eth_dev->device); pdata->pci_dev = pci_dev; + /* + * Get root complex device to differentiate RV AXGBE vs SNOWY AXGBE + */ + root_complex_dev = TAILQ_FIRST(&rte_pci_bus.device_list); + + if (root_complex_dev->id.vendor_id == AMD_PCI_VENDOR_ID && + root_complex_dev->id.device_id == AMD_PCI_RV_ROOT_COMPLEX_ID) { + pdata->xpcs_window_def_reg = PCS_V2_RV_WINDOW_DEF; + pdata->xpcs_window_sel_reg = PCS_V2_RV_WINDOW_SELECT; + } else { + pdata->xpcs_window_def_reg = PCS_V2_WINDOW_DEF; + pdata->xpcs_window_sel_reg = PCS_V2_WINDOW_SELECT; + } + pdata->xgmac_regs = (void *)pci_dev->mem_resource[AXGBE_AXGMAC_BAR].addr; pdata->xprop_regs = (void *)((uint8_t *)pdata->xgmac_regs @@ -620,14 +637,13 @@ eth_axgbe_dev_init(struct rte_eth_dev *eth_dev) pdata->vdata = &axgbe_v2b; /* Configure the PCS indirect addressing support */ - reg = XPCS32_IOREAD(pdata, PCS_V2_WINDOW_DEF); + reg = XPCS32_IOREAD(pdata, pdata->xpcs_window_def_reg); pdata->xpcs_window = XPCS_GET_BITS(reg, PCS_V2_WINDOW_DEF, OFFSET); pdata->xpcs_window <<= 6; pdata->xpcs_window_size = XPCS_GET_BITS(reg, PCS_V2_WINDOW_DEF, SIZE); pdata->xpcs_window_size = 1 << (pdata->xpcs_window_size + 7); pdata->xpcs_window_mask = pdata->xpcs_window_size - 1; - pdata->xpcs_window_def_reg = PCS_V2_WINDOW_DEF; - pdata->xpcs_window_sel_reg = PCS_V2_WINDOW_SELECT; + PMD_INIT_LOG(DEBUG, "xpcs window :%x, size :%x, mask :%x ", pdata->xpcs_window, pdata->xpcs_window_size, pdata->xpcs_window_mask); -- 2.17.1