Message ID | 1389081848-26506-1-git-send-email-dongsheng.wang@freescale.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
On 2014/1/7 16:04, Dongsheng Wang wrote: > From: Wang Dongsheng <dongsheng.wang@freescale.com> > > the root port bus->self always NULL, so put root port pci device > into root port bus->self. > > Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com> > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index 38e403d..7f2d1ab 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -1472,6 +1472,9 @@ int pci_scan_slot(struct pci_bus *bus, int devfn) > if (!dev->is_added) > nr++; > > + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) > + bus->self = dev; In this case, bus is the pci root bus I think, so why set bus->self = root port ? "bus->self" should pointer to the pci device that bridge out this bus. > + > for (fn = next_fn(bus, dev, 0); fn > 0; fn = next_fn(bus, dev, fn)) { > dev = pci_scan_single_device(bus, devfn + fn); > if (dev) { >
On 2014/1/7 16:27, Yijing Wang wrote: > On 2014/1/7 16:04, Dongsheng Wang wrote: >> From: Wang Dongsheng <dongsheng.wang@freescale.com> >> >> the root port bus->self always NULL, so put root port pci device >> into root port bus->self. >> >> Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com> >> >> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c >> index 38e403d..7f2d1ab 100644 >> --- a/drivers/pci/probe.c >> +++ b/drivers/pci/probe.c >> @@ -1472,6 +1472,9 @@ int pci_scan_slot(struct pci_bus *bus, int devfn) >> if (!dev->is_added) >> nr++; >> >> + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) >> + bus->self = dev; > > In this case, bus is the pci root bus I think, so why set bus->self = root port ? > "bus->self" should pointer to the pci device that bridge out this bus. Yes, this patch seems wrong. If dev is root port, bus should be root bus, so we shouldn't set root_bus->self = pci_dev_of_root_port. Actually PCI core has correctly setup pci_bus->self for secondary bus of PCIe root port. Thanks! Gerry > >> + >> for (fn = next_fn(bus, dev, 0); fn > 0; fn = next_fn(bus, dev, fn)) { >> dev = pci_scan_single_device(bus, devfn + fn); >> if (dev) { >> > > -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
PiA+PiBkaWZmIC0tZ2l0IGEvZHJpdmVycy9wY2kvcHJvYmUuYyBiL2RyaXZlcnMvcGNpL3Byb2Jl LmMgaW5kZXgNCj4gPj4gMzhlNDAzZC4uN2YyZDFhYiAxMDA2NDQNCj4gPj4gLS0tIGEvZHJpdmVy cy9wY2kvcHJvYmUuYw0KPiA+PiArKysgYi9kcml2ZXJzL3BjaS9wcm9iZS5jDQo+ID4+IEBAIC0x NDcyLDYgKzE0NzIsOSBAQCBpbnQgcGNpX3NjYW5fc2xvdChzdHJ1Y3QgcGNpX2J1cyAqYnVzLCBp bnQgZGV2Zm4pDQo+ID4+ICAJaWYgKCFkZXYtPmlzX2FkZGVkKQ0KPiA+PiAgCQlucisrOw0KPiA+ Pg0KPiA+PiArCWlmIChwY2lfcGNpZV90eXBlKGRldikgPT0gUENJX0VYUF9UWVBFX1JPT1RfUE9S VCkNCj4gPj4gKwkJYnVzLT5zZWxmID0gZGV2Ow0KPiA+DQo+ID4gSW4gdGhpcyBjYXNlLCBidXMg aXMgdGhlIHBjaSByb290IGJ1cyBJIHRoaW5rLCBzbyB3aHkgc2V0IGJ1cy0+c2VsZiA9IHJvb3QN Cj4gcG9ydCA/DQo+ID4gImJ1cy0+c2VsZiIgc2hvdWxkIHBvaW50ZXIgdG8gdGhlIHBjaSBkZXZp Y2UgdGhhdCBicmlkZ2Ugb3V0IHRoaXMgYnVzLg0KPiBZZXMsIHRoaXMgcGF0Y2ggc2VlbXMgd3Jv bmcuIElmIGRldiBpcyByb290IHBvcnQsIGJ1cyBzaG91bGQgYmUgcm9vdCBidXMsIHNvIHdlDQo+ IHNob3VsZG4ndCBzZXQgcm9vdF9idXMtPnNlbGYgPSBwY2lfZGV2X29mX3Jvb3RfcG9ydC4NCj4g DQpXaHkgdGhlIHJvb3QgYnVzLT5zZWxmIHBvaW50ZXIgdG8gdGhlIGJyaWRnZT8NCklmIGNoaWxk IGJ1cyBjcmVhdGUgZnJvbSByb290IGJ1cywgdGhlIGNoaWxkLT5zZWxmIHdpbGwgZ2V0IHRoZSBi cmlkZ2Uocm9vdCBwb3J0KSBwY2kgZGV2aWNlLg0KDQo+IEFjdHVhbGx5IFBDSSBjb3JlIGhhcyBj b3JyZWN0bHkgc2V0dXAgcGNpX2J1cy0+c2VsZiBmb3Igc2Vjb25kYXJ5IGJ1cyBvZiBQQ0llDQo+ IHJvb3QgcG9ydC4NClllcywgcmlnaHQuIEJ1dCB0aGUgcm9vdC1idXMtPnNlbGYgaXMgTlVMTC4g SSB0aGluayB0aGUgcm9vdCBidXMgc2hvdWxkIGdldCByb290IHBvcnQNCnBjaSBkZXZpY2UgZm9y IGl0c2VsZi4gSWYgdGhlcmUgaXMgbm8gYnJpZGdlIGF0IGJvYXJkIGhvdyB0byBnZXQgdGhlIHJv b3QgcG9ydCBkZXZpY2U/DQoNCi1Eb25nc2hlbmcNCg0KPiANCj4gVGhhbmtzIQ0KPiBHZXJyeQ0K PiANCg0K -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2014/1/7 17:51, Dongsheng.Wang@freescale.com wrote: >>>> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index >>>> 38e403d..7f2d1ab 100644 >>>> --- a/drivers/pci/probe.c >>>> +++ b/drivers/pci/probe.c >>>> @@ -1472,6 +1472,9 @@ int pci_scan_slot(struct pci_bus *bus, int devfn) >>>> if (!dev->is_added) >>>> nr++; >>>> >>>> + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) >>>> + bus->self = dev; >>> >>> In this case, bus is the pci root bus I think, so why set bus->self = root >> port ? >>> "bus->self" should pointer to the pci device that bridge out this bus. >> Yes, this patch seems wrong. If dev is root port, bus should be root bus, so we >> shouldn't set root_bus->self = pci_dev_of_root_port. >> > Why the root bus->self pointer to the bridge? > If child bus create from root bus, the child->self will get the bridge(root port) pci device. > >> Actually PCI core has correctly setup pci_bus->self for secondary bus of PCIe >> root port. > Yes, right. But the root-bus->self is NULL. I think the root bus should get root port > pci device for itself. If there is no bridge at board how to get the root port device? Hi Dongsheng, PCI root bus represents PCI host bridge, which has no corresponding PCI device. > > -Dongsheng > >> >> Thanks! >> Gerry >> > -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogSmlhbmcgTGl1IFttYWls dG86amlhbmcubGl1QGxpbnV4LmludGVsLmNvbV0NCj4gU2VudDogV2VkbmVzZGF5LCBKYW51YXJ5 IDA4LCAyMDE0IDEwOjMzIEFNDQo+IFRvOiBXYW5nIERvbmdzaGVuZy1CNDA1MzQ7IFlpamluZyBX YW5nOyBiaGVsZ2Fhc0Bnb29nbGUuY29tOyByandAcmp3eXNvY2tpLm5ldA0KPiBDYzogV29vZCBT Y290dC1CMDc0MjE7IGdhbGFrQGNvZGVhdXJvcmEub3JnOyBaYW5nIFJveS1SNjE5MTE7IGxpbnV4 LQ0KPiBwY2lAdmdlci5rZXJuZWwub3JnOyBsaW51eHBwYy1kZXZAbGlzdHMub3psYWJzLm9yZw0K PiBTdWJqZWN0OiBSZTogW1BBVENIIDEvMl0gcGNpOiBGaXggcm9vdCBwb3J0IGJ1cy0+c2VsZiBp cyBOVUxMDQo+IA0KPiANCj4gDQo+IE9uIDIwMTQvMS83IDE3OjUxLCBEb25nc2hlbmcuV2FuZ0Bm cmVlc2NhbGUuY29tIHdyb3RlOg0KPiA+Pj4+IGRpZmYgLS1naXQgYS9kcml2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BidXMgY3JlYXRlIGZyb20gcm9vdCBidXMsIHRoZSBjaGlsZC0+c2Vs ZiB3aWxsIGdldCB0aGUgYnJpZGdlKHJvb3QNCj4gcG9ydCkgcGNpIGRldmljZS4NCj4gPg0KPiA+ PiBBY3R1YWxseSBQQ0kgY29yZSBoYXMgY29ycmVjdGx5IHNldHVwIHBjaV9idXMtPnNlbGYgZm9y IHNlY29uZGFyeSBidXMNCj4gPj4gb2YgUENJZSByb290IHBvcnQuDQo+ID4gWWVzLCByaWdodC4g QnV0IHRoZSByb290LWJ1cy0+c2VsZiBpcyBOVUxMLiBJIHRoaW5rIHRoZSByb290IGJ1cw0KPiA+ IHNob3VsZCBnZXQgcm9vdCBwb3J0IHBjaSBkZXZpY2UgZm9yIGl0c2VsZi4gSWYgdGhlcmUgaXMg bm8gYnJpZGdlIGF0IGJvYXJkIGhvdw0KPiB0byBnZXQgdGhlIHJvb3QgcG9ydCBkZXZpY2U/DQo+ IEhpIERvbmdzaGVuZywNCj4gCVBDSSByb290IGJ1cyByZXByZXNlbnRzIFBDSSBob3N0IGJyaWRn ZSwgd2hpY2ggaGFzIG5vIGNvcnJlc3BvbmRpbmcgUENJDQo+IGRldmljZS4NCj4gDQpZZXMsIGFn cmVlLiBJZiBtb3JlIHRoYW4gb25lIGJyaWRnZSBvbiB0aGUgcm9vdCBidXMsIHRoaXMgcGF0Y2gg aXMgd3JvbmcuDQoNClRoYW5rcyBmb3IgeW91ciByZXZpZXcuIDopDQoNCi1Eb25nc2hlbmcNCg0K PiA+DQo+ID4gLURvbmdzaGVuZw0KPiA+DQo+ID4+DQo+ID4+IFRoYW5rcyENCj4gPj4gR2VycnkN Cj4gPj4NCj4gPg0KPiANCg0K -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 38e403d..7f2d1ab 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1472,6 +1472,9 @@ int pci_scan_slot(struct pci_bus *bus, int devfn) if (!dev->is_added) nr++; + if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT) + bus->self = dev; + for (fn = next_fn(bus, dev, 0); fn > 0; fn = next_fn(bus, dev, fn)) { dev = pci_scan_single_device(bus, devfn + fn); if (dev) {