* What is the difference between number and secondary in pci_bus?
@ 2012-04-01 8:38 Richard Yang
2012-04-02 23:30 ` Bjorn Helgaas
0 siblings, 1 reply; 3+ messages in thread
From: Richard Yang @ 2012-04-01 8:38 UTC (permalink / raw)
To: linux-pci
All
In the structure of pci_bus.
There is number, primary, secondary and subordinate.
primary and subordinate are easy to understand, while the number and
secondary confused me.
I think secondary means the current bus number.
Then what number stands for?
In pci_alloc_child_bus(),
child->number = child->secondary = busnr;
So they are the same?
Then we need two different field?
I search the git log while find these code is imported as the first
commit. So I don't see the history.
--
Richard Yang
Help you, Help me
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: What is the difference between number and secondary in pci_bus?
2012-04-01 8:38 What is the difference between number and secondary in pci_bus? Richard Yang
@ 2012-04-02 23:30 ` Bjorn Helgaas
2012-04-03 15:17 ` Richard Yang
0 siblings, 1 reply; 3+ messages in thread
From: Bjorn Helgaas @ 2012-04-02 23:30 UTC (permalink / raw)
To: Richard Yang; +Cc: linux-pci
On Sun, Apr 1, 2012 at 2:38 AM, Richard Yang <weiyang@linux.vnet.ibm.com> wrote:
> All
>
> In the structure of pci_bus.
> There is number, primary, secondary and subordinate.
>
> primary and subordinate are easy to understand, while the number and
> secondary confused me.
>
> I think secondary means the current bus number.
> Then what number stands for?
>
> In pci_alloc_child_bus(),
> child->number = child->secondary = busnr;
> So they are the same?
> Then we need two different field?
Good questions.
Primary, secondary, and subordinate are really properties of the
upstream bridge, not the bus itself. If we had a struct pci_bridge,
they would logically live there. Primary is the bus number of the
upstream side of the bridge. Secondary is the bus number of the
bridge's downstream side. The bridge forwards config transactions
with bus numbers between secondary and subordinate to its downstream
side.
The "number of primary/secondary bridge" comments in struct pci_bus
are wrong -- they are bus numbers, not bridge numbers. And the "max
number of subordinate buses" comment is not really right either.
Subordinate is just the largest bus number forwarded by the bridge.
As a consequence, that limits the number of buses in the downstream
hierarchy.
I have no idea why we have both number and secondary in struct
pci_bus. It seems like they should always be the same. It would be
an interesting exercise to figure out if they're ever different.
Bjorn
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: What is the difference between number and secondary in pci_bus?
2012-04-02 23:30 ` Bjorn Helgaas
@ 2012-04-03 15:17 ` Richard Yang
0 siblings, 0 replies; 3+ messages in thread
From: Richard Yang @ 2012-04-03 15:17 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Richard Yang, linux-pci
On Mon, Apr 02, 2012 at 05:30:52PM -0600, Bjorn Helgaas wrote:
>On Sun, Apr 1, 2012 at 2:38 AM, Richard Yang <weiyang@linux.vnet.ibm.com> wrote:
>> All
>>
>> In the structure of pci_bus.
>> There is number, primary, secondary and subordinate.
>>
>> primary and subordinate are easy to understand, while the number and
>> secondary confused me.
>>
>> I think secondary means the current bus number.
>> Then what number stands for?
>>
>> In pci_alloc_child_bus(),
>> child->number = child->secondary = busnr;
>> So they are the same?
>> Then we need two different field?
>
>Good questions.
Thanks for your response.
>
>Primary, secondary, and subordinate are really properties of the
>upstream bridge, not the bus itself. If we had a struct pci_bridge,
>they would logically live there. Primary is the bus number of the
>upstream side of the bridge. Secondary is the bus number of the
>bridge's downstream side. The bridge forwards config transactions
>with bus numbers between secondary and subordinate to its downstream
>side.
>
>The "number of primary/secondary bridge" comments in struct pci_bus
>are wrong -- they are bus numbers, not bridge numbers. And the "max
So do you think it is better to change "bridge" to "number"?
>number of subordinate buses" comment is not really right either.
>Subordinate is just the largest bus number forwarded by the bridge.
>As a consequence, that limits the number of buses in the downstream
>hierarchy.
Yes, sounds it is not very exact. Or just "subordinate bus" is ok?
>
>I have no idea why we have both number and secondary in struct
>pci_bus. It seems like they should always be the same. It would be
>an interesting exercise to figure out if they're ever different.
>
Do you think add some printk() at the end of pci_scan_bridge() is a good
place to test this?
If they are the same, could we remove one?
BTW, I tried git blame to search who add these two fields. Seems those
code is imported by 1da177e, which is the start of the git system.
>Bjorn
--
Richard Yang
Help you, Help me
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-03 15:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-01 8:38 What is the difference between number and secondary in pci_bus? Richard Yang
2012-04-02 23:30 ` Bjorn Helgaas
2012-04-03 15:17 ` Richard Yang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).