Allocating resources to isab children

Philip Schulz philip.s.schulz at googlemail.com
Sun Mar 13 23:15:46 UTC 2011


Hi Brix,

2011/3/13 Henrik Brix Andersen <brix at freebsd.org>:
> Hi,
>
> On Mar 13, 2011, at 20:45, Philip Schulz wrote:
[...]
>> I created a new isab driver that attaches specifically to the
>> relevant function in the CS5536 chip, mainly because I didn't want to
>> modify the existing generic PCI-ISA bridge driver.
>
> Interesting! However, I am not sure that is the best approach. The idea of enabling direct children of the PCI-ISA bridge driver to allocate BARs from the parent PCI bus would also benefit other drivers currently present in FreeBSD, e.g. the sys/i386/i386/geode.c driver and ichwd(4) - and it would imho make a for a cleaner, more generic solution.
>

I agree, however I didn't add the resource allocation stuff to the
existing PCI-ISA bridge driver only because I didn't feel comfortable
touching it. In fact, I think the code is probably generic enough to
go into the existing driver -- but I don't know if its right. What I
did does also enable direct children of isab to obtain BAR resources.
Anyways, I think we're doing the same thing in principle, see for
yourself ;-)

https://phs.phisch.org/~phs/glx_isab.c
https://phs.phisch.org/~phs/glx_isab.h

>> On my system, the resource list obtained from the PCI bus does not
>> contain any interrupts. If I read the PCI bus code correctly, that's
>> because the "Interrupt Pin" and "Interrupt Line" fields in the
>> device's PCI config space are not set up. I didn't find any code that
>> sets up those fields which leads me to believe that the fields should
>> have been set up by the BIOS. As a result, my isab driver cannot
>> request any interrupts from the PCI bus driver.
>
> As far as I can tell, this can be set up by using pci_write_config(9)? See intpm(4) for an example.
>

I don't know, maybe the SMBus IRQ can be routed and handled through
the PCI layer. But I think you'd still have to set it up in the
CS5536's XPIC, wouldn't you? For me it was just easier to route the
SMBus IRQ to an unused legacy IRQ.

>> However, that's not a problem because my I2C device driver ("glxiic")
>> is a child of isa, not isab. So the tree is something like glxiix -
>> isa - isab - pci - ... - nexus - root. [...]
>
> Hmm, but wouldn't that go against the design of the CS5536? The DIVIL function block found in the CS5536 is not hooked up to the ISA bus.
>

 I made my glxiic driver a child of isa(4) because I didn't know where
else to put it. After all, the DIVIL contains a bunch of devices on
legacy I/O addresses such as e.g. UARTs which are already managed by
ISA device drivers. Also, I couldn't get glxiic to be a direct child
of isab unless I added a device_add_child() to isab_attach() -
something I didn't want to do because it would be non-generic.
Finally, glxiic can't be a PCI device driver because on my system, the
entire DIVIL announces itself as one single PCI function (15.0, seems
to be the same on your system). If glxiic attached to that function,
isab wouldn't be able to attach anymore and I'd lose all of the other
ISA devices. Of course, I could have added the ISA bridge logic to
glxiic as well, but then I'd have glxiic+isab merged in one driver.

 Any thoughts?

Regards,

Phil.

P.S.: For those interested, the data sheet can be found at
http://www.linuxmedialabs.com/LMLCD/LMLGEOMG/AMDG_CS5536.pdf


More information about the freebsd-drivers mailing list