Subject: Fwd: Located problem in pcn driver...
To: None <tech-kern@netbsd.org>
From: John Gordon <john_94501@yahoo.com>
List: tech-kern
Date: 04/18/2003 00:39:53
Sorry, mistyped the address...
John...


--- John Gordon <john_94501@yahoo.com> wrote:
> Date: Fri, 18 Apr 2003 00:38:22 -0700 (PDT)
> From: John Gordon <john_94501@yahoo.com>
> Subject: Located problem in pcn driver...
> To: port-powerpc@netbsd.org, tech-kernel@netbsd.org
> 
> Hello,
> 
> Well, after much hunting and a lot of debug code I have tracked down why my
> NS
> 1000 was unable to send anything over the network, despite being able to
> receive packets correctly. Problem is I am not certain of how to solve it
> correctly...
> 
> The problem is simple: the address of the data that is being inserted into
> the
> transmit descriptor is not a PCI address, but a CPU address. On the NS 1000,
> as
> with many PPC systems, the main memory is in the 0 -> 2GB portion of the
> CPU's
> address space, but from the PCI side of the host bridge it is in in the 2GB
> ->
> 4GB range.
> 
> Now, the code in the pcn_start() routine is as follows:
> 
> if (sc->sc_swstyle == LE_B20_SSTYLE_PCNETPCI3) {
>     for (nexttx = sc->sc_txnext, seg = 0;
>         seg < dmamap->dm_nsegs;
>         seg++, nexttx = PCN_NEXTTX(nexttx)) {
>         /*
>          * If this is the first descriptor we're
>          * enqueueing, don't set the OWN bit just
>          * yet.  That could cause a race condition.
>          * We'll do it below.
>          */
>         sc->sc_txdescs[nexttx].tmd0 = 0;
>         sc->sc_txdescs[nexttx].tmd2 =
>             htole32(dmamap->dm_segs[seg].ds_addr);
>         sc->sc_txdescs[nexttx].tmd1 =
>             htole32(LE_T1_ONES |
>                 (nexttx == sc->sc_txnext ? 0 : LE_T1_OWN) |
>                 (LE_BCNT(dmamap->dm_segs[seg].ds_len) &
>                  LE_T1_BCNT_MASK));
>         lasttx = nexttx;
>     }
> }
> 
> The line in the middle of that loop that sets tmd2 is correctly handling the
> translation to PCI's little endian, but it is not dealing with the difference
> between the CPU's view of the address space, and the PCI bus' view of the
> address space.
> 
> So, how do I fix this? Is the problem in this piece of code, or should the
> ds_addr value already have been translated to a PCI-view address? Obviously,
> for my testing it is simple to just set the top bit on the address, but how
> do
> I do this correctly, and where (in the driver here, or in the DMA code that
> sets up the ds_addr value in the first place)?
> 
> Suggestions welcomed...
> 
> Thanks,
> John...
> 
> =====
> Rate Corporate America at http://exec-ratings.bluedonkey.org
> 
> __________________________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo
> http://search.yahoo.com


=====
Rate Corporate America at http://exec-ratings.bluedonkey.org

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com