Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Mar 2011 00:15:44 +0100
From:      Philip Schulz <philip.s.schulz@googlemail.com>
To:        Henrik Brix Andersen <brix@freebsd.org>
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: Allocating resources to isab children
Message-ID:  <AANLkTi=-NBmwh2nfWreJJtCNVHSXrcKSvh_Mb7jVWf2H@mail.gmail.com>
In-Reply-To: <D1A07777-B5CF-4E24-B0A8-57B57B66D9EF@freebsd.org>
References:  <3550EA55-ADDE-40AC-9C22-1FAC441A0BC8@freebsd.org> <0A707516-C7D1-4441-B17B-1273B6C256B0@FreeBSD.org> <A5AEBC94-8E50-49E0-A72E-9B9E8A73E7F6@FreeBSD.org> <AANLkTin627pE_%2B6o3LvRhCzPYpw%2BTdWEEsw%2BkjA5PT-J@mail.gmail.com> <D1A07777-B5CF-4E24-B0A8-57B57B66D9EF@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Brix,

2011/3/13 Henrik Brix Andersen <brix@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 o=
f enabling direct children of the PCI-ISA bridge driver to allocate BARs fr=
om 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)? Se=
e 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 fun=
ction 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTi=-NBmwh2nfWreJJtCNVHSXrcKSvh_Mb7jVWf2H>