Newbus question
Alexander Kabaev
kabaev at gmail.com
Sat Nov 15 18:35:33 UTC 2014
On Sat, 15 Nov 2014 20:03:02 +0200
Konstantin Belousov <kostikbel at gmail.com> wrote:
> On Sat, Nov 15, 2014 at 12:17:30PM -0500, Alexander Kabaev wrote:
> > On Sat, 15 Nov 2014 17:32:39 +1030
> > "O'Connor, Daniel" <darius at dons.net.au> wrote:
> >
> > > Hi,
> > > I am trying to write a driver for the EHCI debug port [1]. I found
> > > some userland code which I got working (written by the person who
> > > did the Linux version) and now I am trying to get it running in
> > > the kernel. One problem I have is that it needs to run in
> > > parallel with the normal EHCI controller. It uses the same BAR as
> > > the EHCI controller but offset (the offset is found in a PCI
> > > capability). I think I can bus_alloc_resource() if I change EHCI
> > > to allocate with RF_SHAREABLE but my first problem is to add
> > > another device so my driver doesn't contest with the EHCI driver.
> > >
> > > Currently I have a module which loops over bus/slot/func using
> > > find_bsf (is there a way to enumerate all connected PCI devices?)
> > > and then check each for the debug capability (I plan on being a
> > > bit pickier later but it works so far) then creating a child
> > > device. The problem is that the probe routine <missing text>
> > >
> >
> > Hi,
> >
> > I do not think this can be done without cooperation of the ECHI
> > device. You'd have to go the way of the full parent/child
> > relationship between ehci parent and debug port child devices.
> > Fortunately, this is not that hard to do and you can even define
> > your own devmethod interfaces to make communication between debug
> > port decoupled, so that debug port can be loaded and unloaded
> > independently. The echi device already manages one child usbus
> > device, adding another should not be too hard.
>
> I think that debugging should be available much earlier than the
> device tree is explored and devices are attached. It probably makes
> sense to operate the debugging port outside the newbus at all, in
> particular, before the pci and acpi machinery is initialized.
>
> You might want a callback from ehci driver when it appropriated the
> resources, to handle the case of bar realocation.
If one wants early debugger, then whole thing will need to be split
into pre-newbus and after-newbus part, similar to dcons.
--
Alexander Kabaev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 173 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20141115/04413c95/attachment.sig>
More information about the freebsd-hackers
mailing list