Changeset 518edef in rtems


Ignore:
Timestamp:
Jan 31, 2005, 7:03:41 PM (15 years ago)
Author:
Eric Norum <WENorum@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
fa5dfe8
Parents:
9be8c2d
Message:

Processor doesn't snoop FEC DMA so we must invalidate the cache appropriately.

Location:
c/src/lib/libbsp/m68k/uC5282
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/m68k/uC5282/ChangeLog

    r9be8c2d r518edef  
     12005-01-31  Eric Norum <norume@aps.anl.gov>
     2
     3        * network/network.c, startup/bspstart.c: Processor doesn't snoop FEC DMA
     4          so we must invalidate the cache appropriately.
     5
     6
    172005-01-31      Joel Sherrill <joel@OARcorp.com>
    28
  • c/src/lib/libbsp/m68k/uC5282/network/network.c

    r9be8c2d r518edef  
    1111#include <stdarg.h>
    1212#include <string.h>
     13#include <rtems.h>
    1314#include <rtems/error.h>
    1415#include <rtems/rtems_bsdnet.h>
     
    123124
    124125/*
    125  * Allocate buffer descriptors from SRAM
    126  * Ensure 128-bit (16-byte)alignment
    127  */
    128 static void *
     126 * Allocate buffer descriptors
     127 * Ensure 128-bit (16-byte) alignment
     128 */
     129static mcf5282BufferDescriptor_t *
    129130mcf5282_bd_allocate(unsigned int count)
    130131{
    131     char *p;
    132    
     132    mcf5282BufferDescriptor_t *p;
     133
    133134    p = malloc((count * sizeof(mcf5282BufferDescriptor_t)) + 15, 0, M_NOWAIT);
    134135    if (!p)
    135136        rtems_panic("FEC BD");
    136137    if ((int)p & 0xF)
    137         p += 16 - ((int)p & 0xF);
    138 printf("Allocate %d at %p\n", count, p);
     138        p = (mcf5282BufferDescriptor_t *)((char *)p + (16 - ((int)p & 0xF)));
    139139    return p;
    140140}
     
    172172     */
    173173    MCF5282_FEC_ECR = MCF5282_FEC_ECR_RESET;
    174     rtems_task_wake_after( 1 );
     174    rtems_task_wake_after(1);
    175175    /*
    176176     * Configuration of I/O ports is done outside of this function
     
    303303{
    304304    struct mbuf *m, *n;
    305 
    306     while ((sc->txBdActiveCount != 0)
    307         && ((sc->txBdBase[sc->txBdTail].status & MCF5282_FEC_TxBD_R) == 0)) {
     305    volatile mcf5282BufferDescriptor_t *txBd;
     306
     307    for (;;) {
     308        if (sc->txBdActiveCount == 0)
     309            return;
     310        txBd = sc->txBdBase + sc->txBdTail;
     311        rtems_cache_invalidate_multiple_data_lines(txBd, sizeof *txBd);
     312        if ((txBd->status & MCF5282_FEC_TxBD_R) != 0)
     313            return;
    308314        m = sc->txMbuf[sc->txBdTail];
    309315        MFREE(m, n);
     
    354360         * Wait for packet if there's not one ready
    355361         */
     362        rtems_cache_invalidate_multiple_data_lines(rxBd, sizeof *rxBd);
    356363        if ((status = rxBd->status) & MCF5282_FEC_RxBD_E) {
     364int chkCount=0 ;
    357365            /*
    358366             * Clear old events.
     
    366374             * `if' above, and the clearing of the RXF bit in the EIR.
    367375             */
    368             while ((status = rxBd->status) & MCF5282_FEC_RxBD_E) {
     376            for (;;) {
    369377                rtems_event_set events;
    370378                int level;
    371379
     380                rtems_cache_invalidate_multiple_data_lines(rxBd, sizeof *rxBd);
     381                if (((status = rxBd->status) & MCF5282_FEC_RxBD_E) == 0)
     382                    break;
     383
     384if(chkCount++)printf("ACK -- CACHE WOES\n");
    372385                rtems_interrupt_disable(level);
    373386                MCF5282_FEC_EIMR |= MCF5282_FEC_EIMR_RXF;
     
    389402             */
    390403            struct ether_header *eh;
    391 
    392             /*
    393              * Invalidate the buffer for this descriptor
     404            int len = rxBd->length - sizeof(rtems_unsigned32);;
     405
     406            /*
     407             * Invalidate the cache and push the packet up
     408             * The cache is so small that it's more efficient to just
     409             * invalidate the whole thing unless the packet is very small.
    394410             */
    395411            m = sc->rxMbuf[rxBdIndex];
    396             m->m_len = m->m_pkthdr.len = rxBd->length -
    397                        sizeof(rtems_unsigned32) -
    398                        sizeof(struct ether_header);
     412            if (len < 128)
     413                rtems_cache_invalidate_multiple_data_lines(m->m_data, len);
     414            else
     415                rtems_cache_invalidate_entire_data();
     416            m->m_len = m->m_pkthdr.len = len - sizeof(struct ether_header);
    399417            eh = mtod(m, struct ether_header *);
    400418            m->m_data += sizeof(struct ether_header);
     
    764782    unsigned char *hwaddr;
    765783
    766 printf("attaching\n"); rtems_task_wake_after(10);
    767784    /*
    768785     * Parse driver name
  • c/src/lib/libbsp/m68k/uC5282/startup/bspstart.c

    r9be8c2d r518edef  
    110110void _CPU_cache_invalidate_1_instruction_line(const void *addr)
    111111{
    112   asm volatile ("cpushl %%ic,(%0)" :: "a" (addr));
     112    /*
     113     * Top half of cache is I-space
     114     */
     115    addr = (void *)((int)addr | 0x400);
     116    asm volatile ("cpushl %%bc,(%0)" :: "a" (addr));
    113117}
    114118
     
    128132
    129133    rtems_interrupt_disable(level);
     134    rtems_interrupt_disable(level);
    130135    cacr_mode |= MCF5XXX_CACR_DISD;
    131136    m68k_set_cacr(cacr_mode);
     
    140145void _CPU_cache_invalidate_1_data_line(const void *addr)
    141146{
    142   asm volatile ("cpushl %%dc,(%0)" :: "a" (addr));
     147    /*
     148     * Bottom half of cache is D-space
     149     */
     150    addr = (void *)((int)addr & ~0x400);
     151    asm volatile ("cpushl %%bc,(%0)" :: "a" (addr));
    143152}
    144153
Note: See TracChangeset for help on using the changeset viewer.