1f08c3bdfSopenharmony_ciHOWTO --> PCI-Express test scripts for LTP 2f08c3bdfSopenharmony_ci Amit Khanna amit.khanna@intel.com 3f08c3bdfSopenharmony_ci 08/20/2004 4f08c3bdfSopenharmony_ci 5f08c3bdfSopenharmony_ci1. About this HOWTO 6f08c3bdfSopenharmony_ci 7f08c3bdfSopenharmony_ciThis document describes the addition of PCI-Express test cases to the existing LTP project. 8f08c3bdfSopenharmony_ciThese test cases/scripts will enhance the LTP's capability to test PCI-Express devices/drivers. 9f08c3bdfSopenharmony_ci 10f08c3bdfSopenharmony_ci2. Copyright (c) Intel Corporation, 2004 11f08c3bdfSopenharmony_ci 12f08c3bdfSopenharmony_ci3. What is this patch doing? 13f08c3bdfSopenharmony_ci 14f08c3bdfSopenharmony_cia. A function "test_find_pci_exp_cap" has been added to the tpci.c file of LTP project. 15f08c3bdfSopenharmony_ci (\ltp\testcases\kernel\device-drivers\pci\tpci\tpci.c) 16f08c3bdfSopenharmony_ci This function makes a call to pci_find_capability, which will determine if a device 17f08c3bdfSopenharmony_ci has PCI-Express capability. A PCI Express device function indicates PCI-Express support 18f08c3bdfSopenharmony_ci by implementing the PCI-Express capability structure in its capability list. 19f08c3bdfSopenharmony_ci 20f08c3bdfSopenharmony_cib. A function "test_read_pci_exp_config" has been added to the tpci.c file of LTP project. 21f08c3bdfSopenharmony_ci This function calls "pci_config_read" and determines if the PCI-Express enhanced config 22f08c3bdfSopenharmony_ci space of the device can be read successfully or not. 23f08c3bdfSopenharmony_ci 24f08c3bdfSopenharmony_ci "pci_config_read" function here reads the Advanced Error Reporting CAP-ID register located 25f08c3bdfSopenharmony_ci at the PCI-Express enhanced config space address 0x100. The value of this register is a READ-ONLY 26f08c3bdfSopenharmony_ci value which is constant on all the PCI-Express devices. If the value read from this register matches with the 27f08c3bdfSopenharmony_ci defined macro AER_CAP_ID_VALUE(in tpci.h) that means that PCI-Express driver is accessing 28f08c3bdfSopenharmony_ci the enhanced config space SUCCESSFULLY. 29f08c3bdfSopenharmony_ci 30f08c3bdfSopenharmony_cic. A user space function 'ki_generic()" is already available in user_tpci.c file of LTP project, 31f08c3bdfSopenharmony_ci (\ltp\testcases\kernel\device-drivers\pci\user_tpci\user_tpci.c) which will drive the kernel 32f08c3bdfSopenharmony_ci module tpci to test various pci and pci-express functions (defined & prototyped in tpci.c). 33f08c3bdfSopenharmony_ci 34f08c3bdfSopenharmony_ci 35f08c3bdfSopenharmony_ci4. Including PCI-Express support into the kernel 36f08c3bdfSopenharmony_ci 37f08c3bdfSopenharmony_ciBy default, the kernel may not enable PCI-Express feature. A kernel 38f08c3bdfSopenharmony_ciconfiguration option must be selected to enable PCI-Express support. 39f08c3bdfSopenharmony_ci 40f08c3bdfSopenharmony_ciTo include PCI-Express support into the kernel requires users to enable PCI-Access mode with 41f08c3bdfSopenharmony_ci"Any" or "MMCFG" in the "General Setup" menu in the kernel configuration menu. 42f08c3bdfSopenharmony_ci 43f08c3bdfSopenharmony_ci5. FAQ 44f08c3bdfSopenharmony_ci 45f08c3bdfSopenharmony_ciQ1. Are there any limitations on using this patch? 46f08c3bdfSopenharmony_ci 47f08c3bdfSopenharmony_ciA1. If the device supports PCI-Express feature and the PCI-Express feature is enabled in the kernel, 48f08c3bdfSopenharmony_cithen only a user will be able to access the PCI-Express space. 49f08c3bdfSopenharmony_ciEven if the device doesn't support PCI-Express feature, the traditional PCI-space would still be accessible. 50f08c3bdfSopenharmony_ci 51f08c3bdfSopenharmony_ciQ2. What is this AER_CAP_ID_VALUE macro defined in tpci.h? 52f08c3bdfSopenharmony_ci 53f08c3bdfSopenharmony_ciA2. AER_CAP_ID_VALUE represents the value of Advanced Error Reporting Capability ID in the PCI Express config space. 54f08c3bdfSopenharmony_ciThe default value of this is always same for all PCI-Express devices. i.e. 0x14011. 55f08c3bdfSopenharmony_ciIn the function "test_read_pci_exp_config" in tpci.c file, it is compared with the value retrieved from a PCI-Express 56f08c3bdfSopenharmony_cicapable device. If both the values match that means that the PCI-Express driver is accessing the PCI-Express config space 57f08c3bdfSopenharmony_ciSUCCESSFULLY. 58f08c3bdfSopenharmony_ci***FINISH*** 59