Changeset 3eb75db3 in rtems


Ignore:
Timestamp:
Oct 25, 1999, 2:52:19 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
c58674c
Parents:
bf61f225
Message:

tch from Eric Valette <valette@…> and Emmanuel Raguet
<raguet@…> to fix bugs and make the mcp750 boot
RTEMS running the GoAhead? web server.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/mcp750/dec21140/dec21140.c

    rbf61f225 r3eb75db3  
    107107    volatile unsigned long status;
    108108    volatile unsigned long counts;
    109     unsigned long buf1, buf2;   
     109    volatile unsigned char *buf1, *buf2;       
    110110};
    111111
     
    144144  struct arpcom                 arpcom;
    145145  rtems_irq_connect_data        irqInfo;
    146   struct MD                     *MDbase;
    147   char                          *bufferBase;
     146  volatile struct MD            *MDbase;
     147  volatile unsigned char        *bufferBase;
    148148  int                           acceptBroadcast;
    149149  int                           rxBdCount;
     
    153153
    154154  unsigned int                  port;
    155   unsigned int                  *base;
     155  volatile unsigned int         *base;
    156156  unsigned long                 bpar;
    157157   
     
    187187dec21140Enet_interrupt_handler (rtems_vector_number v)
    188188{
    189   unsigned int *tbase;
     189  volatile unsigned int *tbase;
    190190  unsigned long status;
    191191
     
    234234#define MDIO_DATA_READ          0x80000
    235235
    236 static int mdio_read(unsigned int *ioaddr, int phy_id, int location)
     236static int mdio_read(volatile unsigned int *ioaddr, int phy_id, int location)
    237237{
    238238        int i, i3;
     
    278278}
    279279
    280 static int mdio_write(unsigned int *ioaddr, int phy_id, int location, int value)
     280static int mdio_write(volatile unsigned int *ioaddr, int phy_id, int location, int value)
    281281{
    282282        int i, i3;
     
    328328#define EE_ERASE_CMD    (7 << 6)
    329329
    330 static int eeget16(unsigned int *ioaddr, int location)
     330static int eeget16(volatile unsigned int *ioaddr, int location)
    331331{
    332332        int i, i3;
     
    369369{
    370370  rtems_status_code st;
    371   unsigned int *tbase;
     371  volatile unsigned int *tbase;
    372372  union {char c[64]; unsigned short s[32];} rombuf;
    373373  int i, i2, i3;
    374   char *cp, direction, *setup_frm, *eaddrs;
     374  volatile unsigned char *cp, direction, *setup_frm, *eaddrs;
    375375  unsigned long csr12_val, mii_reg0;
    376   unsigned char *buffer;
    377   struct MD *rmd;
     376  volatile unsigned char *buffer;
     377  volatile struct MD *rmd;
    378378
    379379 
     
    418418   */
    419419  sc->rxBdCount = 0;
    420   cp = (char *)malloc((NRXBUFS+NTXBUFS)*(sizeof(struct MD)+ RBUF_SIZE) + PPC_CACHE_ALIGNMENT);
     420  cp = (volatile unsigned char *)malloc((NRXBUFS+NTXBUFS)*(sizeof(struct MD)+ RBUF_SIZE) + PPC_CACHE_ALIGNMENT);
    421421  sc->bufferBase = cp;
    422422  if ((unsigned int)cp & (PPC_CACHE_ALIGNMENT-1))
    423     cp = ((unsigned int)cp + PPC_CACHE_ALIGNMENT) & ~(PPC_CACHE_ALIGNMENT-1);
     423    cp = (volatile unsigned char *) (((unsigned int)cp + PPC_CACHE_ALIGNMENT) & ~(PPC_CACHE_ALIGNMENT-1));
    424424#ifdef PCI_BRIDGE_DOES_NOT_ENSURE_CACHE_COHERENCY_FOR_DMA
    425425  if (_CPU_is_paging_enabled())
     
    429429                    PTE_CACHE_DISABLE | PTE_WRITABLE);
    430430#endif
    431   rmd = (struct MD*)cp;
     431  rmd = (volatile struct MD*)cp;
    432432  sc->MDbase = rmd;
    433433  buffer = cp + ((NRXBUFS+NTXBUFS)*sizeof(struct MD));
    434434  st_le32( (tbase+memCSR3), (long)((long)(sc->MDbase) + PREP_PCI_DRAM_OFFSET));
    435435  for (i=0 ; i<NRXBUFS; i++){
    436     rmd->buf2 = 0;
    437     rmd->buf1 = (unsigned long)(buffer + (i*RBUF_SIZE) + PREP_PCI_DRAM_OFFSET); 
    438     if (i == NRXBUFS-1)
    439       rmd->counts = 0xfec00000 | (RBUF_SIZE);
    440     else
    441       rmd->counts = 0xfcc00000 | (RBUF_SIZE);
     436    rmd->buf2 = (volatile unsigned char *) 0;
     437    rmd->buf1 = (buffer + (i*RBUF_SIZE) + PREP_PCI_DRAM_OFFSET); 
     438    rmd->counts = 0xfcc00000 | (RBUF_SIZE);
    442439    rmd->status = 0x80000000;
    443440    rmd++;
    444441  }
    445 
     442  /*
     443   * mark last RX buffer.
     444   */
     445  sc->MDbase [NRXBUFS-1].counts = 0xfec00000 | (RBUF_SIZE);
    446446  /*
    447447   * Init TX ring
    448448   */
    449449  sc->txBdCount = 0;
    450   st_le32( (tbase+memCSR4), (long)((long)(rmd) + PREP_PCI_DRAM_OFFSET));
    451   rmd->buf2 = 0;
    452   rmd->buf1 = (unsigned long)(buffer + (NRXBUFS*RBUF_SIZE) + PREP_PCI_DRAM_OFFSET);
     450  st_le32( (tbase+memCSR4), (long)(((long)(rmd)) + PREP_PCI_DRAM_OFFSET));
     451  rmd->buf2 = (volatile unsigned char *) 0;
     452  rmd->buf1 = buffer + (NRXBUFS*RBUF_SIZE) + PREP_PCI_DRAM_OFFSET;
    453453  rmd->counts = 0x62000000;
    454454  rmd->status = 0x0;
     
    477477   * Build setup frame
    478478   */
    479   setup_frm = (char *)((long)(rmd->buf1) - PREP_PCI_DRAM_OFFSET);
     479  setup_frm = rmd->buf1 - PREP_PCI_DRAM_OFFSET;
    480480  eaddrs = (char *)(sc->arpcom.ac_enaddr);
    481481  /* Fill the buffer with our physical address. */
     
    495495  }
    496496  /* Add the broadcast address when doing perfect filtering */
    497   memset(setup_frm, 0xff, 12);
     497  memset((void*) setup_frm, 0xff, 12);
    498498  rmd->counts = 0x0a000000 | 192 ;
    499499  rmd->status = 0x80000000;
     
    526526dec21140_rxDaemon (void *arg)
    527527{
    528   unsigned int *tbase;
     528  volatile unsigned int *tbase;
    529529  struct ether_header *eh;
    530530  struct dec21140_softc *dp = (struct dec21140_softc *)&dec21140_softc[0];
    531531  struct ifnet *ifp = &dp->arpcom.ac_if;
    532532  struct mbuf *m;
    533   struct MD *rmd;
     533  volatile struct MD *rmd;
    534534  unsigned int len;
    535535  char *temp;
     
    556556        temp = m->m_data;
    557557        m->m_len = m->m_pkthdr.len = len - sizeof(struct ether_header);
    558         memcpy(temp, (char *)((long)(rmd->buf1)-PREP_PCI_DRAM_OFFSET), len);
     558        memcpy(temp, (void*) (rmd->buf1-PREP_PCI_DRAM_OFFSET), len);
    559559        rmd->status = 0x80000000;
    560560        eh = mtod (m, struct ether_header *);
     
    574574  struct dec21140_softc *dp = ifp->if_softc;
    575575  volatile struct MD *tmd;
    576   unsigned char *temp;
     576  volatile unsigned char *temp;
    577577  struct mbuf *n;
    578578  unsigned int len;
    579   unsigned int *tbase;
     579  volatile unsigned int *tbase;
    580580
    581581  tbase = dp->base;
     
    588588  len = 0;
    589589  n = m;
    590   temp = (char *)((long)(tmd->buf1)-PREP_PCI_DRAM_OFFSET);
     590  temp = tmd->buf1-PREP_PCI_DRAM_OFFSET;
    591591 
    592592  for (;;){
    593593    len += m->m_len;
    594     memcpy(temp, (char *)m->m_data, m->m_len);
     594    memcpy((void*) temp, (char *)m->m_data, m->m_len);
    595595    temp += m->m_len ;
    596596    if ((m = m->m_next) == NULL)
     
    689689dec21140_stop (struct dec21140_softc *sc)
    690690{
    691   unsigned int *tbase;
     691  volatile unsigned int *tbase;
    692692  struct ifnet *ifp = &sc->arpcom.ac_if;
    693693
     
    700700  st_le32( (tbase+memCSR7), NO_IT);
    701701  st_le32( (tbase+memCSR6), CSR6_INIT);
    702   free(sc->bufferBase);
     702  free((void*)sc->bufferBase);
    703703}
    704704
  • c/src/lib/libbsp/powerpc/motorola_powerpc/dec21140/dec21140.c

    rbf61f225 r3eb75db3  
    107107    volatile unsigned long status;
    108108    volatile unsigned long counts;
    109     unsigned long buf1, buf2;   
     109    volatile unsigned char *buf1, *buf2;       
    110110};
    111111
     
    144144  struct arpcom                 arpcom;
    145145  rtems_irq_connect_data        irqInfo;
    146   struct MD                     *MDbase;
    147   char                          *bufferBase;
     146  volatile struct MD            *MDbase;
     147  volatile unsigned char        *bufferBase;
    148148  int                           acceptBroadcast;
    149149  int                           rxBdCount;
     
    153153
    154154  unsigned int                  port;
    155   unsigned int                  *base;
     155  volatile unsigned int         *base;
    156156  unsigned long                 bpar;
    157157   
     
    187187dec21140Enet_interrupt_handler (rtems_vector_number v)
    188188{
    189   unsigned int *tbase;
     189  volatile unsigned int *tbase;
    190190  unsigned long status;
    191191
     
    234234#define MDIO_DATA_READ          0x80000
    235235
    236 static int mdio_read(unsigned int *ioaddr, int phy_id, int location)
     236static int mdio_read(volatile unsigned int *ioaddr, int phy_id, int location)
    237237{
    238238        int i, i3;
     
    278278}
    279279
    280 static int mdio_write(unsigned int *ioaddr, int phy_id, int location, int value)
     280static int mdio_write(volatile unsigned int *ioaddr, int phy_id, int location, int value)
    281281{
    282282        int i, i3;
     
    328328#define EE_ERASE_CMD    (7 << 6)
    329329
    330 static int eeget16(unsigned int *ioaddr, int location)
     330static int eeget16(volatile unsigned int *ioaddr, int location)
    331331{
    332332        int i, i3;
     
    369369{
    370370  rtems_status_code st;
    371   unsigned int *tbase;
     371  volatile unsigned int *tbase;
    372372  union {char c[64]; unsigned short s[32];} rombuf;
    373373  int i, i2, i3;
    374   char *cp, direction, *setup_frm, *eaddrs;
     374  volatile unsigned char *cp, direction, *setup_frm, *eaddrs;
    375375  unsigned long csr12_val, mii_reg0;
    376   unsigned char *buffer;
    377   struct MD *rmd;
     376  volatile unsigned char *buffer;
     377  volatile struct MD *rmd;
    378378
    379379 
     
    418418   */
    419419  sc->rxBdCount = 0;
    420   cp = (char *)malloc((NRXBUFS+NTXBUFS)*(sizeof(struct MD)+ RBUF_SIZE) + PPC_CACHE_ALIGNMENT);
     420  cp = (volatile unsigned char *)malloc((NRXBUFS+NTXBUFS)*(sizeof(struct MD)+ RBUF_SIZE) + PPC_CACHE_ALIGNMENT);
    421421  sc->bufferBase = cp;
    422422  if ((unsigned int)cp & (PPC_CACHE_ALIGNMENT-1))
    423     cp = ((unsigned int)cp + PPC_CACHE_ALIGNMENT) & ~(PPC_CACHE_ALIGNMENT-1);
     423    cp = (volatile unsigned char *) (((unsigned int)cp + PPC_CACHE_ALIGNMENT) & ~(PPC_CACHE_ALIGNMENT-1));
    424424#ifdef PCI_BRIDGE_DOES_NOT_ENSURE_CACHE_COHERENCY_FOR_DMA
    425425  if (_CPU_is_paging_enabled())
     
    429429                    PTE_CACHE_DISABLE | PTE_WRITABLE);
    430430#endif
    431   rmd = (struct MD*)cp;
     431  rmd = (volatile struct MD*)cp;
    432432  sc->MDbase = rmd;
    433433  buffer = cp + ((NRXBUFS+NTXBUFS)*sizeof(struct MD));
    434434  st_le32( (tbase+memCSR3), (long)((long)(sc->MDbase) + PREP_PCI_DRAM_OFFSET));
    435435  for (i=0 ; i<NRXBUFS; i++){
    436     rmd->buf2 = 0;
    437     rmd->buf1 = (unsigned long)(buffer + (i*RBUF_SIZE) + PREP_PCI_DRAM_OFFSET); 
    438     if (i == NRXBUFS-1)
    439       rmd->counts = 0xfec00000 | (RBUF_SIZE);
    440     else
    441       rmd->counts = 0xfcc00000 | (RBUF_SIZE);
     436    rmd->buf2 = (volatile unsigned char *) 0;
     437    rmd->buf1 = (buffer + (i*RBUF_SIZE) + PREP_PCI_DRAM_OFFSET); 
     438    rmd->counts = 0xfcc00000 | (RBUF_SIZE);
    442439    rmd->status = 0x80000000;
    443440    rmd++;
    444441  }
    445 
     442  /*
     443   * mark last RX buffer.
     444   */
     445  sc->MDbase [NRXBUFS-1].counts = 0xfec00000 | (RBUF_SIZE);
    446446  /*
    447447   * Init TX ring
    448448   */
    449449  sc->txBdCount = 0;
    450   st_le32( (tbase+memCSR4), (long)((long)(rmd) + PREP_PCI_DRAM_OFFSET));
    451   rmd->buf2 = 0;
    452   rmd->buf1 = (unsigned long)(buffer + (NRXBUFS*RBUF_SIZE) + PREP_PCI_DRAM_OFFSET);
     450  st_le32( (tbase+memCSR4), (long)(((long)(rmd)) + PREP_PCI_DRAM_OFFSET));
     451  rmd->buf2 = (volatile unsigned char *) 0;
     452  rmd->buf1 = buffer + (NRXBUFS*RBUF_SIZE) + PREP_PCI_DRAM_OFFSET;
    453453  rmd->counts = 0x62000000;
    454454  rmd->status = 0x0;
     
    477477   * Build setup frame
    478478   */
    479   setup_frm = (char *)((long)(rmd->buf1) - PREP_PCI_DRAM_OFFSET);
     479  setup_frm = rmd->buf1 - PREP_PCI_DRAM_OFFSET;
    480480  eaddrs = (char *)(sc->arpcom.ac_enaddr);
    481481  /* Fill the buffer with our physical address. */
     
    495495  }
    496496  /* Add the broadcast address when doing perfect filtering */
    497   memset(setup_frm, 0xff, 12);
     497  memset((void*) setup_frm, 0xff, 12);
    498498  rmd->counts = 0x0a000000 | 192 ;
    499499  rmd->status = 0x80000000;
     
    526526dec21140_rxDaemon (void *arg)
    527527{
    528   unsigned int *tbase;
     528  volatile unsigned int *tbase;
    529529  struct ether_header *eh;
    530530  struct dec21140_softc *dp = (struct dec21140_softc *)&dec21140_softc[0];
    531531  struct ifnet *ifp = &dp->arpcom.ac_if;
    532532  struct mbuf *m;
    533   struct MD *rmd;
     533  volatile struct MD *rmd;
    534534  unsigned int len;
    535535  char *temp;
     
    556556        temp = m->m_data;
    557557        m->m_len = m->m_pkthdr.len = len - sizeof(struct ether_header);
    558         memcpy(temp, (char *)((long)(rmd->buf1)-PREP_PCI_DRAM_OFFSET), len);
     558        memcpy(temp, (void*) (rmd->buf1-PREP_PCI_DRAM_OFFSET), len);
    559559        rmd->status = 0x80000000;
    560560        eh = mtod (m, struct ether_header *);
     
    574574  struct dec21140_softc *dp = ifp->if_softc;
    575575  volatile struct MD *tmd;
    576   unsigned char *temp;
     576  volatile unsigned char *temp;
    577577  struct mbuf *n;
    578578  unsigned int len;
    579   unsigned int *tbase;
     579  volatile unsigned int *tbase;
    580580
    581581  tbase = dp->base;
     
    588588  len = 0;
    589589  n = m;
    590   temp = (char *)((long)(tmd->buf1)-PREP_PCI_DRAM_OFFSET);
     590  temp = tmd->buf1-PREP_PCI_DRAM_OFFSET;
    591591 
    592592  for (;;){
    593593    len += m->m_len;
    594     memcpy(temp, (char *)m->m_data, m->m_len);
     594    memcpy((void*) temp, (char *)m->m_data, m->m_len);
    595595    temp += m->m_len ;
    596596    if ((m = m->m_next) == NULL)
     
    689689dec21140_stop (struct dec21140_softc *sc)
    690690{
    691   unsigned int *tbase;
     691  volatile unsigned int *tbase;
    692692  struct ifnet *ifp = &sc->arpcom.ac_if;
    693693
     
    700700  st_le32( (tbase+memCSR7), NO_IT);
    701701  st_le32( (tbase+memCSR6), CSR6_INIT);
    702   free(sc->bufferBase);
     702  free((void*)sc->bufferBase);
    703703}
    704704
  • make/custom/mcp750.cfg

    rbf61f225 r3eb75db3  
    8686# model => not used.
    8787# Currently the sdata2 and sbss2 sections are empty => r2 is not used...
    88 CFLAGS_OPTIMIZE_V=-O2 -fno-keep-inline-functions -fvolatile-global -fvolatile -mstrict-align  -mcpu=750
     88CFLAGS_OPTIMIZE_V=-O4 -mmultiple -mstring -mstrict-align  -mcpu=750
    8989#CFLAGS_OPTIMIZE_V=-O4 -fno-keep-inline-functions -fvolatile-global -fvolatile -mstrict-align -mcpu=750
    9090
Note: See TracChangeset for help on using the changeset viewer.