[PATCH] pc386 BSP PCI initialization fix [was: Re: PCI lookup issue: 3c905C-TX not found by RTEMS.]

Karel Gardas kgardas at objectsecurity.com
Tue Jan 25 19:02:34 UTC 2005


On Tue, 25 Jan 2005, Till Straumann wrote:

> gregory.menke at gsfc.nasa.gov wrote:
> > Karel Gardas writes:
> >  >
> >  > Hello,
> >  >
> >  > thanks to help provided by Gregory Menke, I was finally able to get my
> >  > K6-2/3c905C-TX NIC machine working with RTEMS. As a result of my debug
> >  > trip thorough pcibios/elnk.c sources, I've created attached patch. It adds
> >  > some more verbose debugging when PCI_DEBUG is defined and fixes pci
> >  > initialization by directly calling pcib_init from BSP_pciFindDevice in
> >  > case PCI is not yet initialized. I've also tested applying it to the trunk
> >  > and it has gone well.
> >
> > I think calling pcib_init in this way is probably not the best idea
> > for a long-term fix.  Thought he fact that it works suggests theres a
> > bug in the pc386 bsp startup.
>
> True. I just realized that I call pcib_init()
> from my application (GeSys) which is a work-around...
>
> A call should probably go into
>
> c/src/lib/libbsp/i386/pc386/startup/bspstart.c:bsp_start()
>
> Nicely, the BSP defines an weak alias of bsp_start for an
> application to redefine bsp_start(). Hence it's easy to
> test a modified version (doing a pcib_init() call). Make
> sure to verify it still works on a PC *without* PCI, then
> submit a PR.

I have been still wondering why RTEMS works w/ Intel's EtherExpress NIC
(PCI) on my notebook well and not with 3C905C-TX also attached to PCI bus
in my backup machine, and now, I've found the reason:

Both dec21140 and if_fxp (that's what I used for my notebook's intel's
NIC) calls pcib_init function!
Even there is a note in file: decdriver.t:

``On RTEMS, a PCI API exists. We have used it to configure the board.
After initializing this PCI module via the @code{pcib_init()} function, we
try to detect the DEC21140 based ethernet board. This board is
characterized by its Vendor ID (0x1011) and its Device ID (0x0009).''

So from this point of view, it seems, drivers for PCI-based devices are
responsible themselves for initializing PCI. On the other hand, this seems
to be practice only for i386 architecture, since PPC uses completely
different logic just relaying on calling BSP_pciFinDevice function.

In case someone is going to move pcib_init call to
c/src/lib/libbsp/i386/pc386/startup/bspstart.c:bsp_start()
as Timm suggested, then probably he/she should also fix appropriate bits
of drivers listed above including documentation provided for dec21140.

But the main question still remains: what's the prefered practice: i.e.
PPC way or dec21140/if_fxp way of PCI initialization?

Thanks,
Karel
--
Karel Gardas                  kgardas at objectsecurity.com
ObjectSecurity Ltd.           http://www.objectsecurity.com




More information about the users mailing list