PCIe:change the method to get the address of a requested capability in configuration space.
PATCH 1/1 PCIe:change the method to get the address of a requested capability in configuration space.
Previously, the address of a requested capability is define like that
"#define PCI_DCR 0x78"
But, the addresses of capabilities is different with regard to PCIe revs. So this method is not flexible.
Now a function to get the address of a requested capability is added and used. It can get the address dynamically by capability ID.
The step of this function:
1. Read Status register in PCIe configuration space to confirm that Capabilities List is valid.
2. Find the address of Capabilities Pointer Register.
3. Find the address of requested capability from the first capability.
--- arch/powerpc/include/asm/fsl_pci.h | 13 +------- drivers/pci/fsl_pci_init.c | 44 +++++++++++++++++++------- drivers/pci/pci.c | 65 ++++++++++++++++++++++++++++++++++++++ include/pci.h | 10 ++++++ 4 files changed, 108 insertions(+), 24 deletions(-)
arch/powerpc/include/asm/fsl_pci.h +1 -12
@@ -32,22 +32,11 @@/* Freescale-specific PCI config registers */ #define FSL_PCI_PBFR 0x44 -#ifdef CONFIG_SYS_FSL_PCI_VER_3_X +#ifndef CONFIG_SYS_FSL_PCI_VER_3_X /* Currently only the PCIe capability is used, so hardcode the offset. * if more capabilities need to be justified, the capability link method * should be applied here */ -#define FSL_PCIE_CAP_ID 0x70 -#define PCI_DCR 0x78/* PCIe Device Control Register */ -#define PCI_DSR 0x7a/* PCIe Device Status Register */ -#define PCI_LSR 0x82/* PCIe Link Status Register */ -#define PCI_LCR 0x80/* PCIe Link Control Register */ -#else -#define FSL_PCIE_CAP_ID 0x4c -#define PCI_DCR 0x54/* PCIe Device Control Register */ -#define PCI_DSR 0x56/* PCIe Device Status Register */ -#define PCI_LSR 0x5e/* PCIe Link Status Register */ -#define PCI_LCR 0x5c/* PCIe Link Control Register */ #define FSL_PCIE_CFG_RDY 0x4b0#endif #define FSL_PCI_CFG_READY 1/* Endpoint: allow inbound configuration */
drivers/pci/fsl_pci_init.c +32 -12
112 lines not on this page · raw message
drivers/pci/pci.c +65 -0
68 lines not on this page · raw message
include/pci.h +10 -0
@@ -426,6 +426,9 @@#define PCI_MAX_PCI_DEVICES 32#define PCI_MAX_PCI_FUNCTIONS 8 +#define PCI_FIND_CAP_TTL 0x48 +#define CAP_START_POS 0x40 +/* Include the ID list */ #include <pci_ids.h>
@@ -663,6 +666,13 @@ extern int pci_hose_config_device(struct pci_controller *hose,pci_addr_t mem, unsigned long command); +extern int pci_hose_find_capability (struct pci_controller *hose,pci_dev_t dev, +int cap); +extern int pci_hose_find_cap_start (struct pci_controller *hose,pci_dev_t dev, +u8 hdr_type); +extern int pci_find_cap (struct pci_controller *hose,pci_dev_t dev,int pos, +int cap); +const char *pci_class_str (u8 class);int pci_last_busno (void );
Signature · 1 line
1.8.0
PATCH 1/1 PCIe:change the method to get the address of a requested capability in configuration space.
Dear Zhao Qiang,
Quoted 13 lines · In message <[email protected]> you wrote:
Previously, the address of a requested capability is define like that
"#define PCI_DCR 0x78"But, the addresses of capabilities is different with regard to PCIe revs. So this method is not flexible.
Now a function to get the address of a requested capability is added and used. It can get the address dynamically by capability ID.
The step of this function:
1. Read Status register in PCIe configuration space to confirm that Capabilities List is valid.
2. Find the address of Capabilities Pointer Register.
3. Find the address of requested capability from the first capability.
Quoted 1 line
Signed-off-by Zhao Qiang <[email protected]>
As far as I can tell, this is the third time you are posting this patch, but with out any indication (there is no version string in the Subject), and without any description of any changes you might have made.
Could you please be so kind and read the instructions at [1] and then provide the missing information?
[1] http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions
Thanks.
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de There are certain things men must do to remain men. -- Kirk, "The Ultimate Computer", stardate 4929.4