tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] pcictl: simplify its usage



Manuel Bouyer wrote:
> On Thu, Jun 04, 2009 at 08:01:39PM +0200, Manuel Bouyer wrote:
>> On Thu, Jun 04, 2009 at 07:18:50PM +0200, Matthias Drochner wrote:
>>> mouse%Rodents-Montreal.ORG@localhost said:
>>>> But you need /dev/pci in order to have something to open when you
>>>> don't have a bus number available.
>>> I didn't follow all the thread, just want to make sure that
>>> everyone is aware of the fact that the N and the M in
>>> pcictl /dev/pciN <command> -b M
>>> are not the same: N is a logical index chosen by autoconf
>>> and M is the physical bus number.
>>> This might be not a big issue with a simple PC, but on
>>> a big box with multiple PCI hierarchies the same physical bus
>>> number can occur multiple times.
>> Yes, you're right. The API proposed by Christoph doens't work in
>> that case. I think it needs to use the autoconf index in this case,
>> not the physical bus number.
> 
> This is the case on a DS20 system:
> cpu0 at mainbus0: ID 0 (primary), 21264-4
> cpu0: Architecture extensions: 303<PAT,MVI,FIX,BWX>
> tsc0 at mainbus0: 21272 Core Logic Chipset, Cchip rev 0
> tsc0: 8 Dchips, 2 memory buses of 32 bytes
> tsc0: arrays present: 256MB, 256MB, 0MB, 0MB, Dchip 0 rev 1
> tsp0 at tsc0
> pci0 at tsp0 bus 0
> [...]
> tsp1 at tsc0
> pci1 at tsp1 bus 0
> 
> both have the same physical bus number (which is stored in sc_bus).
> What's unique is the autoconf index.

PCI domains should be unique, too.
In my patch, I have this snippet:

+       for (i = 0; i < pci_cd.cd_ndevs; i++) {
+               pci = pci_cd.cd_devs[i];
+               if (pci == NULL)
+                       continue;
+
+               sc = device_private(pci);
+               if (sc != NULL && /* sc->sc_domain == minor(dev) && */
+                   sc->sc_bus == bdfr->bus)
+                       break;
+       }
+       if (i >= pci_cd.cd_ndevs)
+               return NULL;

Note the commented out PCI domain check.
As Joerg pointed out we don't support PCI domains, therefore I can't
enable the check which Manuel needs on his machine.

Christoph


Home | Main Index | Thread Index | Old Index