This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: Fwd: RealTek 8139 ethernet driver


"Andy Dyer" <adyer@righthandtech.com> writes:

> > > I think what's missing in your driver is a call to
> > > cyg_pci_configure_device()
> > > to get BARs allocated in pci space.  I haven't tried it yet :-)
> > 
> > I disagree - that call is not the responsibility of the driver.
> > It's up to the HAL initialization to call the PCI layer and cause
> > it to configure devices, busses, etc.
> > 
> > What platform are you using?
> > 
> 
> I was looking at the 82559 driver as an example.
> 
> The platform is custom (based on a mips tx49 derivative).  There
> seems to be some inconsistiency in how this gets done.  A quick
> grep-find in devs/eth shows:
> 
> find /ecos-z/ecos/packages/devs/eth -type f -print0 | xargs -0 -e grep
> -n cyg_pci_configure_device 
> /ecos-z/ecos/packages/devs/eth/amd/pcnet/current/src/if_pcnet.c:349:
> if (cyg_pci_configure_device(&dev_info)) {
> /ecos-z/ecos/packages/devs/eth/intel/i21143/current/src/if_i21143.c:2056
> :            if (cyg_pci_configure_device(&dev_info)) {
> /ecos-z/ecos/packages/devs/eth/intel/i82544/current/src/if_i82544.c:2641
> :            if (cyg_pci_configure_device(&dev_info)) {
> /ecos-z/ecos/packages/devs/eth/intel/i82559/current/src/if_i82559.c:2918
> :            if (cyg_pci_configure_device(&dev_info)) {
> /ecos-z/ecos/packages/devs/eth/mips/atlas/current/src/if_atlas.c:475:
> if (!cyg_pci_configure_device(&dev_info)) {
> /ecos-z/ecos/packages/devs/eth/via/rhine/current/src/if_rhine.c:369:
> if (cyg_pci_configure_device(&dev_info)) {
> 
> Grepping in packages/hal/mips shows no matches, and doing a
> wider grep shows some arm derivatives seem to have calls to
> it in the hal functions.
> 
> So it's done sometimes in the chip drivers, sometimes in the 
> platform "glue" function, and sometimes in the hal.

Calling cyg_pci_configure_device() in the driver should be benign. If
the device is already configured then it should just return
successfully.

Most HALs should not need to pre-initialize the PCI bus, its better to
leave it until the device drivers start up. Otherwise we could end up
using up all our PCI address space configuring devices we won't ever
use.

Some platforms do need to initialize things early since they have a
more complex structure of multiple busses and bridges. Without that
you wouldn't even be able to find the network card if it were on a
secondary bus.


-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com      The eCos and RedBoot experts


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]