forked from Imagelibrary/rtems
2005-05-04 Jennifer Averett <jennifer.averett@oarcorp.com>
* libchip/network/dec21140.c, libchip/network/elnk.c: Consolidation of code as a result of the implementation of a common PCI interface.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2005-05-04 Jennifer Averett <jennifer.averett@oarcorp.com>
|
||||||
|
|
||||||
|
* libchip/network/dec21140.c, libchip/network/elnk.c: Consolidation
|
||||||
|
of code as a result of the implementation of a common PCI interface.
|
||||||
|
|
||||||
2005-05-04 Joel Sherrill <joel@OARcorp.com>
|
2005-05-04 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
* libchip/network/open_eth.c: Remove prototype of set_vector.
|
* libchip/network/open_eth.c: Remove prototype of set_vector.
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
#define DEC21140_SUPPORTED
|
#define DEC21140_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__PPC__) && (defined(mpc604) || defined(mpc750) || defined(mpc603e))
|
#if defined(__PPC__) && (defined(mpc604) || defined(mpc750) || defined(mpc603e))
|
||||||
#define DEC21140_SUPPORTED
|
#define DEC21140_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
@@ -56,9 +55,7 @@
|
|||||||
#if defined(DEC21140_SUPPORTED)
|
#if defined(DEC21140_SUPPORTED)
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <rtems/pci.h>
|
#include <rtems/pci.h>
|
||||||
#if defined(__i386__)
|
|
||||||
#include <pcibios.h>
|
|
||||||
#endif
|
|
||||||
#if defined(__PPC__)
|
#if defined(__PPC__)
|
||||||
#include <libcpu/byteorder.h>
|
#include <libcpu/byteorder.h>
|
||||||
#include <libcpu/io.h>
|
#include <libcpu/io.h>
|
||||||
@@ -1011,7 +1008,6 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
int mtu;
|
int mtu;
|
||||||
unsigned char cvalue;
|
unsigned char cvalue;
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
int signature;
|
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
unsigned char interrupt;
|
unsigned char interrupt;
|
||||||
#endif
|
#endif
|
||||||
@@ -1049,8 +1045,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
|
|
||||||
/* the 21143 chip must be enabled before it can be accessed */
|
/* the 21143 chip must be enabled before it can be accessed */
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
signature = PCIB_DEVSIG_MAKE( pbus, pdev, pfun );
|
pci_write_config_dword(pbus, pdev, pfun, 0x40, 0 );
|
||||||
pcib_conf_write32( signature, 0x40, 0 );
|
|
||||||
#else
|
#else
|
||||||
pci_write_config_dword(pbus, pdev, pfun, 0x40, PCI_DEVICE_ID_DEC_21143);
|
pci_write_config_dword(pbus, pdev, pfun, 0x40, PCI_DEVICE_ID_DEC_21143);
|
||||||
#endif
|
#endif
|
||||||
@@ -1068,12 +1063,6 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__i386__)
|
|
||||||
signature = PCIB_DEVSIG_MAKE( pbus, pdev, pfun );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((unitNumber < 1) || (unitNumber > NDECDRIVER))
|
if ((unitNumber < 1) || (unitNumber > NDECDRIVER))
|
||||||
{
|
{
|
||||||
printk("dec2114x : unit %i is invalid, must be (1 <= n <= %d)\n", unitNumber);
|
printk("dec2114x : unit %i is invalid, must be (1 <= n <= %d)\n", unitNumber);
|
||||||
@@ -1106,10 +1095,10 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
*/
|
*/
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
|
|
||||||
pcib_conf_read32(signature, 16, &value);
|
pci_read_config_dword(pbus, pdev, pfun, 16, &value);
|
||||||
sc->port = value & ~IO_MASK;
|
sc->port = value & ~IO_MASK;
|
||||||
|
|
||||||
pcib_conf_read32(signature, 20, &value);
|
pci_read_config_dword(pbus, pdev, pfun, 20, &value);
|
||||||
if (_CPU_is_paging_enabled())
|
if (_CPU_is_paging_enabled())
|
||||||
_CPU_map_phys_address((void **) &(sc->base),
|
_CPU_map_phys_address((void **) &(sc->base),
|
||||||
(void *)(value & ~MEM_MASK),
|
(void *)(value & ~MEM_MASK),
|
||||||
@@ -1118,7 +1107,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
else
|
else
|
||||||
sc->base = (unsigned int *)(value & ~MEM_MASK);
|
sc->base = (unsigned int *)(value & ~MEM_MASK);
|
||||||
|
|
||||||
pcib_conf_read8(signature, 60, &interrupt);
|
pci_read_config_byte(pbus, pdev, pfun, 60, &interrupt);
|
||||||
cvalue = interrupt;
|
cvalue = interrupt;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__PPC__)
|
#if defined(__PPC__)
|
||||||
@@ -1153,12 +1142,7 @@ rtems_dec21140_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
** Prep the board
|
** Prep the board
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__PPC__)
|
|
||||||
pci_write_config_word(pbus, pdev, pfun,
|
pci_write_config_word(pbus, pdev, pfun,
|
||||||
#endif
|
|
||||||
#if defined(__i386__)
|
|
||||||
pcib_conf_write16(signature,
|
|
||||||
#endif
|
|
||||||
PCI_COMMAND,
|
PCI_COMMAND,
|
||||||
(uint16_t) ( PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER ) );
|
(uint16_t) ( PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER ) );
|
||||||
|
|
||||||
|
|||||||
@@ -83,11 +83,9 @@
|
|||||||
|
|
||||||
#if defined(ELNK_SUPPORTED)
|
#if defined(ELNK_SUPPORTED)
|
||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#if defined(__i386__)
|
#include <rtems/pci.h>
|
||||||
#include <pcibios.h>
|
|
||||||
#endif
|
|
||||||
#if defined(__PPC__)
|
#if defined(__PPC__)
|
||||||
#include <bsp/pci.h>
|
|
||||||
#include <libcpu/byteorder.h>
|
#include <libcpu/byteorder.h>
|
||||||
#include <libcpu/io.h>
|
#include <libcpu/io.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -3138,7 +3136,6 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
int numFound = 0;
|
int numFound = 0;
|
||||||
int pbus, pdev, pfun;
|
int pbus, pdev, pfun;
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
int signature;
|
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
unsigned char interrupt;
|
unsigned char interrupt;
|
||||||
#endif
|
#endif
|
||||||
@@ -3248,9 +3245,6 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
pbus = sysboards[unitNumber-1].pbus;
|
pbus = sysboards[unitNumber-1].pbus;
|
||||||
pdev = sysboards[unitNumber-1].pdev;
|
pdev = sysboards[unitNumber-1].pdev;
|
||||||
pfun = sysboards[unitNumber-1].pfun;
|
pfun = sysboards[unitNumber-1].pfun;
|
||||||
#if defined(__i386__)
|
|
||||||
signature = PCIB_DEVSIG_MAKE(pbus,pdev,pfun);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sc = &elnk_softc[unitNumber - 1];
|
sc = &elnk_softc[unitNumber - 1];
|
||||||
@@ -3318,10 +3312,10 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
|
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
pcib_conf_read32(signature, 16, &value);
|
pci_read_config_dword(pbus, pdev, pfun, 16, &value);
|
||||||
sc->ioaddr = value & ~IO_MASK;
|
sc->ioaddr = value & ~IO_MASK;
|
||||||
|
|
||||||
pcib_conf_read8(signature, 60, &interrupt);
|
pci_read_config_byte(pbus, pdev, pfun, 60, &interrupt);
|
||||||
cvalue = interrupt;
|
cvalue = interrupt;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__PPC__)
|
#if defined(__PPC__)
|
||||||
@@ -3369,7 +3363,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
when the timer expires during a transfer. This bug exists the Vortex
|
when the timer expires during a transfer. This bug exists the Vortex
|
||||||
chip only. */
|
chip only. */
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
pcib_conf_read8(signature, 0x0d, &pci_latency);
|
pci_read_config_byte(pbus, pdev, pfun, 0x0d, &pci_latency);
|
||||||
#endif
|
#endif
|
||||||
#if defined(__PPC__)
|
#if defined(__PPC__)
|
||||||
pci_read_config_byte(pbus,pdev,pfun, PCI_LATENCY_TIMER, &pci_latency);
|
pci_read_config_byte(pbus,pdev,pfun, PCI_LATENCY_TIMER, &pci_latency);
|
||||||
@@ -3378,7 +3372,7 @@ rtems_elnk_driver_attach (struct rtems_bsdnet_ifconfig *config, int attach)
|
|||||||
{
|
{
|
||||||
printk("etherlink : unit elnk%d Overriding PCI latency, timer (CFLT) setting of %d, new value is %d.\n", sc->xl_unit, pci_latency, new_latency );
|
printk("etherlink : unit elnk%d Overriding PCI latency, timer (CFLT) setting of %d, new value is %d.\n", sc->xl_unit, pci_latency, new_latency );
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
pcib_conf_write8(signature, 0x0d, new_latency);
|
pci_write_config_byte(pbus, pdev, pfun, 0x0d, new_latency);
|
||||||
#endif
|
#endif
|
||||||
#if defined(__PPC__)
|
#if defined(__PPC__)
|
||||||
pci_write_config_byte(pbus,pdev,pfun, PCI_LATENCY_TIMER, new_latency);
|
pci_write_config_byte(pbus,pdev,pfun, PCI_LATENCY_TIMER, new_latency);
|
||||||
|
|||||||
Reference in New Issue
Block a user