Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Mar 2011 20:45:26 +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:  <AANLkTin627pE_%2B6o3LvRhCzPYpw%2BTdWEEsw%2BkjA5PT-J@mail.gmail.com>
In-Reply-To: <A5AEBC94-8E50-49E0-A72E-9B9E8A73E7F6@FreeBSD.org>
References:  <3550EA55-ADDE-40AC-9C22-1FAC441A0BC8@freebsd.org> <0A707516-C7D1-4441-B17B-1273B6C256B0@FreeBSD.org> <A5AEBC94-8E50-49E0-A72E-9B9E8A73E7F6@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>:
[...]
> Comments are more than welcome. I am still trying to figure out how to al=
low children to allocate and setup interrupts through isab; any pointers to=
 what needs to be done in that regard are also very welcome since I'm not h=
aving much luck with it so far...
>

I'm currently working on a driver for the exact same device, except
I'm going for the I2C engine. Naturally, I'm facing some similar
issues ;-)

 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.

 In the attach routine of my isab driver, I used
BUS_GET_RESOURCE_LIST() to obtain the list of resources that the
parent PCI bus allocated for the device. On my system (Alix 1.C), that
list contains the I/O ranges the device announces in the BARs.

 The bus_alloc_resource (and the bus_release_resource) method then
checks whether said list contains the requested resource. If so, my
isab driver requests the resource from the PCI bus and returns the
requested resource to the requestor. If not, the request is passed
through so it eventually ends up at the nexus device driver on x86.

 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.

 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. If the glxiic driver request an
interrupt resource, the request passes the isab driver at one point.
Because the interrupt resource is not in the list mentioned above, the
request is passed onto the parent, which is the PCI bus. The PCI bus
will only handle those requests that come from direct children, so the
request is again passed up. Eventually, the nexus device handles the
request and the interrupt is allocated.

 As with other ISA device drivers, the interrupt number used by glxiic
is set up via device.hints. However, the driver still needs to route
the interrupt in the "Extended PIC" that is part of the CS5536 chip.
I'm not sure if this is the right concept, but I found it to work out
for my needs.

Hope that helps,

Phil.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTin627pE_%2B6o3LvRhCzPYpw%2BTdWEEsw%2BkjA5PT-J>