Ignore:
Timestamp:
Aug 11, 2000, 7:26:31 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
57b1f53
Parents:
b96ca51
Message:

2000-08-11 Charles-Antoine Gauthier <charles.gauthier@…>

  • README: Updated
  • console/console.c: Fix polled input. Add support for shared printk. Add support for more flexible polled I/O with and without termios. I/O mode and console is selectable either from NVRAM or from mvme167.cfg. Clean up comments.

2000-08-11 Charles-Antoine Gauthier <charles.gauthier@…>

  • startup/page_table.c (page_table_init): Reorganize NVRAM parameters.
  • include/bsp.h: Reorganize NVRAM parameters. Add support for shared printk.
  • times: These are the times for the MVME167, not the MBX860-002.

2000-08-11 John Cotton <john.cotton@…>

  • network/network.c: Fix NVRAM configuration parameter handling from previous revision. Check J1-4, restructure NVRAM parameter handling.

2000-08-11 Charles-Antoine Gauthier <charles.gauthier@…>

  • network/network.c: Cleanup of network driver to reduce warnings. Addition of second parameter to uti596_attach.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/m68k/mvme167/network/network.c

    rb96ca51 red09fd77  
    16581658  uti596_softc_ *sc = &uti596_softc;                            /* device dependent data structure */
    16591659  struct ifnet * ifp = (struct ifnet *)&sc->arpcom.ac_if;       /* ifnet structure */
     1660  unsigned char j1;    /* State of J1 jumpers */
    16601661  int unitNumber;
    16611662  char *unitName;
     
    16881689
    16891690  /*
    1690    * If an IP address and netmask are provided in NVRAM, cheat,
    1691    * and stuff them into the ifconfig structure, overriding any
    1692    * existing or NULL values.
     1691   * Check whether parameters should be obtained from NVRAM. If
     1692   * yes, and if an IP address, netmask, or ethernet address are
     1693   * provided in NVRAM, cheat, and stuff them into the ifconfig
     1694   * structure, OVERRIDING and existing or NULL values.
    16931695   *
    16941696   * Warning: If values are provided in NVRAM, the ifconfig entries
    1695    * should be NULL because buffer memory allocated to hold the
     1697   * must be NULL because buffer memory allocated to hold the
    16961698   * structure values is unrecoverable and would be lost here.
    16971699   */
    1698   if ( (addr = nvram->ipaddr) ) {
    1699     if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
    1700       pConfig->ip_address = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
    1701     else
    1702       rtems_panic("Can't allocate ip_address buffer!\n");
    1703   }
    1704   if ( (addr = nvram->netmask) ) {
    1705     if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
    1706       pConfig->ip_netmask = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
    1707     else
    1708       rtems_panic("Can't allocate ip_netmask buffer!\n");
    1709   }
    1710 
    1711   /* Ethernet address can be specified in NVRAM, or in the ifconfig
    1712    * structure. It will be read by default from BBRAM at $FFFC1F2C
    1713    * (6 bytes) mvme167 manual p. 1-47
    1714    */
    1715   if ( nvram->enaddr ) {
    1716         memcpy ((void *)sc->arpcom.ac_enaddr, &nvram->enaddr, ETHER_ADDR_LEN);
     1700
     1701  /* Read the J1 header */
     1702  j1 = (unsigned char)(lcsr->vector_base & 0xFF);
     1703
     1704  if ( !(j1 & 0x10) ) {
     1705        /* Jumper J1-4 is on, configure from NVRAM */
     1706 
     1707    if ( (addr = nvram->ipaddr) ) {
     1708      /* We have a non-zero entry, copy the value */
     1709      if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
     1710        pConfig->ip_address = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
     1711      else
     1712        rtems_panic("Can't allocate ip_address buffer!\n");
     1713    }
     1714   
     1715    if ( (addr = nvram->netmask) ) {
     1716      /* We have a non-zero entry, copy the value */
     1717      if ( (pAddr = malloc ( INET_ADDR_MAX_BUF_SIZE, 0, M_NOWAIT )) )
     1718        pConfig->ip_netmask = (char *)inet_ntop(AF_INET, &addr, pAddr, INET_ADDR_MAX_BUF_SIZE -1 );
     1719      else
     1720        rtems_panic("Can't allocate ip_netmask buffer!\n");
     1721    }
     1722
     1723    /* Ethernet address requires special handling -- it must be copied into
     1724     * the arpcom struct. The following if construct serves only to give the
     1725     * NVRAM parameter the highest priority if J1-4 indicates we are configuring
     1726     * from NVRAM.
     1727     *
     1728     * If the ethernet address is specified in NVRAM, go ahead and copy it.
     1729     * (ETHER_ADDR_LEN = 6 bytes).
     1730     */
     1731    if ( nvram->enaddr[0] || nvram->enaddr[1] || nvram->enaddr[2] ) {
     1732      /* Anything in the first three bytes indicates a non-zero entry, copy value */
     1733          memcpy ((void *)sc->arpcom.ac_enaddr, &nvram->enaddr, ETHER_ADDR_LEN);
     1734    }
     1735    else if ( pConfig->hardware_address) {
     1736      /* There is no entry in NVRAM, but there is in the ifconfig struct, so use it. */
     1737      memcpy ((void *)sc->arpcom.ac_enaddr, pConfig->hardware_address, ETHER_ADDR_LEN);
     1738    }
     1739    else {
     1740      /* There is no ethernet address provided, so it will be read
     1741       * from BBRAM at $FFFC1F2C by default. [mvme167 manual p. 1-47]
     1742       */
     1743      memcpy ((void *)sc->arpcom.ac_enaddr, (char *)0xFFFC1F2C, ETHER_ADDR_LEN);
     1744    }
    17171745  }
    17181746  else if ( pConfig->hardware_address) {
     1747    /* We are not configuring from NVRAM (J1-4 is off), and the ethernet address
     1748     * is given in the ifconfig structure. Copy it.
     1749     */
    17191750    memcpy ((void *)sc->arpcom.ac_enaddr, pConfig->hardware_address, ETHER_ADDR_LEN);
    17201751  }
    17211752  else {
     1753    /* We are not configuring from NVRAM (J1-4 is off), and there is no ethernet
     1754     * address provided in the ifconfig struct, so it will be read from BBRAM at
     1755     * $FFFC1F2C by default. [mvme167 manual p. 1-47]
     1756     */
    17221757    memcpy ((void *)sc->arpcom.ac_enaddr, (char *)0xFFFC1F2C, ETHER_ADDR_LEN);
    17231758  }
Note: See TracChangeset for help on using the changeset viewer.