Home | History | Annotate | Line # | Download | only in include
      1  1.1  riastrad /*	$NetBSD: amd_pcie.h,v 1.2 2021/12/18 23:45:08 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /*
      4  1.1  riastrad  * Copyright 2015 Advanced Micro Devices, Inc.
      5  1.1  riastrad  *
      6  1.1  riastrad  * Permission is hereby granted, free of charge, to any person obtaining a
      7  1.1  riastrad  * copy of this software and associated documentation files (the "Software"),
      8  1.1  riastrad  * to deal in the Software without restriction, including without limitation
      9  1.1  riastrad  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     10  1.1  riastrad  * and/or sell copies of the Software, and to permit persons to whom the
     11  1.1  riastrad  * Software is furnished to do so, subject to the following conditions:
     12  1.1  riastrad  *
     13  1.1  riastrad  * The above copyright notice and this permission notice shall be included in
     14  1.1  riastrad  * all copies or substantial portions of the Software.
     15  1.1  riastrad  *
     16  1.1  riastrad  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     17  1.1  riastrad  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     18  1.1  riastrad  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     19  1.1  riastrad  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
     20  1.1  riastrad  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     21  1.1  riastrad  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     22  1.1  riastrad  * OTHER DEALINGS IN THE SOFTWARE.
     23  1.1  riastrad  */
     24  1.1  riastrad 
     25  1.1  riastrad #ifndef __AMD_PCIE_H__
     26  1.1  riastrad #define __AMD_PCIE_H__
     27  1.1  riastrad 
     28  1.1  riastrad /* Following flags shows PCIe link speed supported in driver which are decided by chipset and ASIC */
     29  1.1  riastrad #define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1        0x00010000
     30  1.1  riastrad #define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2        0x00020000
     31  1.1  riastrad #define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3        0x00040000
     32  1.1  riastrad #define CAIL_PCIE_LINK_SPEED_SUPPORT_GEN4        0x00080000
     33  1.1  riastrad #define CAIL_PCIE_LINK_SPEED_SUPPORT_MASK        0xFFFF0000
     34  1.1  riastrad #define CAIL_PCIE_LINK_SPEED_SUPPORT_SHIFT       16
     35  1.1  riastrad 
     36  1.1  riastrad /* Following flags shows PCIe link speed supported by ASIC H/W.*/
     37  1.1  riastrad #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1   0x00000001
     38  1.1  riastrad #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2   0x00000002
     39  1.1  riastrad #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3   0x00000004
     40  1.1  riastrad #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN4   0x00000008
     41  1.1  riastrad #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_MASK   0x0000FFFF
     42  1.1  riastrad #define CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_SHIFT  0
     43  1.1  riastrad 
     44  1.1  riastrad /* gen: chipset 1/2, asic 1/2/3 */
     45  1.1  riastrad #define AMDGPU_DEFAULT_PCIE_GEN_MASK (CAIL_PCIE_LINK_SPEED_SUPPORT_GEN1 \
     46  1.1  riastrad 				      | CAIL_PCIE_LINK_SPEED_SUPPORT_GEN2 \
     47  1.1  riastrad 				      | CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN1 \
     48  1.1  riastrad 				      | CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN2 \
     49  1.1  riastrad 				      | CAIL_ASIC_PCIE_LINK_SPEED_SUPPORT_GEN3)
     50  1.1  riastrad 
     51  1.1  riastrad /* Following flags shows PCIe lane width switch supported in driver which are decided by chipset and ASIC */
     52  1.1  riastrad #define CAIL_PCIE_LINK_WIDTH_SUPPORT_X1          0x00010000
     53  1.1  riastrad #define CAIL_PCIE_LINK_WIDTH_SUPPORT_X2          0x00020000
     54  1.1  riastrad #define CAIL_PCIE_LINK_WIDTH_SUPPORT_X4          0x00040000
     55  1.1  riastrad #define CAIL_PCIE_LINK_WIDTH_SUPPORT_X8          0x00080000
     56  1.1  riastrad #define CAIL_PCIE_LINK_WIDTH_SUPPORT_X12         0x00100000
     57  1.1  riastrad #define CAIL_PCIE_LINK_WIDTH_SUPPORT_X16         0x00200000
     58  1.1  riastrad #define CAIL_PCIE_LINK_WIDTH_SUPPORT_X32         0x00400000
     59  1.1  riastrad #define CAIL_PCIE_LINK_WIDTH_SUPPORT_SHIFT       16
     60  1.1  riastrad 
     61  1.1  riastrad /* 1/2/4/8/16 lanes */
     62  1.1  riastrad #define AMDGPU_DEFAULT_PCIE_MLW_MASK (CAIL_PCIE_LINK_WIDTH_SUPPORT_X1 \
     63  1.1  riastrad 				      | CAIL_PCIE_LINK_WIDTH_SUPPORT_X2 \
     64  1.1  riastrad 				      | CAIL_PCIE_LINK_WIDTH_SUPPORT_X4 \
     65  1.1  riastrad 				      | CAIL_PCIE_LINK_WIDTH_SUPPORT_X8 \
     66  1.1  riastrad 				      | CAIL_PCIE_LINK_WIDTH_SUPPORT_X16)
     67  1.1  riastrad 
     68  1.1  riastrad #endif
     69