Changeset 7f7298c4 in rtems for c/src/libchip
- Timestamp:
- Feb 23, 2006, 9:05:16 PM (14 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, master
- Children:
- 61b0cc6
- Parents:
- 0d0560a1
- Location:
- c/src/libchip/network
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/libchip/network/if_dc.c
r0d0560a1 r7f7298c4 101 101 */ 102 102 103 #if defined(DRIVER_SUPPORTED) 104 #undef DRIVER_SUPPORTED 105 #endif 106 103 107 #if defined(__i386__) 104 #define DRIVER_SUPPORTED108 #define DRIVER_SUPPORTED 105 109 #endif 106 110 107 111 #if defined(__PPC__) && (defined(mpc604) || defined(mpc750) || defined(mpc603e)) 108 #define DRIVER_SUPPORTED 109 #endif 110 111 #undef DRIVER_SUPPORTED 112 113 #if defined(DRIVER_SUPPORTED) 112 #define DRIVER_SUPPORTED 113 #warning The if_dc driver is untested on the PPC platform !!! 114 #endif 115 116 117 #if defined(DRIVER_SUPPORTED) /* this covers the file "globally"... */ 118 #include <bsp.h> 114 119 #include <rtems.h> 120 #include <rtems/pci.h> 121 115 122 #include <rtems/error.h> 123 #include <errno.h> 116 124 #include <rtems/rtems_bsdnet.h> 117 118 119 125 120 126 #include <net/if_types.h> … … 131 137 #include <bsp.h> 132 138 139 /* moved to cpukit/include/rtems in CVS current ! */ 140 //#include "if_media.h" 141 //#include "pci.h" 133 142 #include <net/if_media.h> 134 143 #include <rtems/pci.h> … … 189 198 #define IRQ_EVENT RTEMS_EVENT_13 /* Ha ... */ 190 199 static struct dc_softc dc_softc_devs[NDRIVER]; 200 201 #define UNUSED 191 202 192 203 #if 0 … … 284 295 static void dc_daemon(void *); 285 296 static void dc_start(struct ifnet *); 286 static int dc_ioctl(struct ifnet *, int, caddr_t);297 static int dc_ioctl(struct ifnet *, u_long, caddr_t); 287 298 static void dc_init(void *); 288 299 static void dc_stop(struct dc_softc *); … … 316 327 static void dc_setcfg(struct dc_softc *, int); 317 328 static u_int32_t dc_crc_le(struct dc_softc *, caddr_t); 329 #ifndef UNUSED 318 330 static u_int32_t dc_crc_be(caddr_t); 331 #endif 319 332 static void dc_setfilt_21143(struct dc_softc *); 320 333 static void dc_setfilt_asix(struct dc_softc *); … … 1130 1143 } 1131 1144 1145 #ifndef UNUSED 1132 1146 /* 1133 1147 * Calculate CRC of a multicast group address, return the lower 6 bits. … … 1157 1171 return((crc >> 26) & 0x0000003F); 1158 1172 } 1159 1173 #endif 1160 1174 1161 1175 /* … … 1598 1612 1599 1613 while(t->dc_name != NULL) { 1600 rc = pci b_find_by_devid(t->dc_vid, t->dc_did, \1601 (unitnum - 1), &t->dc_ devsig);1614 rc = pci_find_device(t->dc_vid, t->dc_did, \ 1615 (unitnum - 1), &t->dc_bus, &t->dc_dev, &t->dc_fun); 1602 1616 if (rc == PCIB_ERR_SUCCESS) { 1603 1617 /* Check the PCI revision */ 1604 pcib_conf_read32(t->dc_devsig, DC_PCI_CFRV, &rev); 1605 rev &= 0xFF; 1618 //pcib_conf_read32(t->dc_devsig, DC_PCI_CFRV, &rev); 1619 pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 1620 DC_PCI_CFRV, &rev); 1621 rev &= 0xFF; 1622 1606 1623 if (t->dc_did == DC_DEVICEID_98713 && 1607 1624 rev >= DC_REVISION_98713A) … … 1886 1903 rtems_dc_driver_attach(struct rtems_bsdnet_ifconfig *config, int attaching) 1887 1904 { 1888 /*int s, tmp = 0;*/1905 int rc; 1889 1906 u_char eaddr[ETHER_ADDR_LEN]; 1890 1907 … … 1895 1912 struct dc_softc *sc; 1896 1913 struct ifnet *ifp; 1914 struct dc_type *t; 1897 1915 u_int32_t revision; 1898 1916 int error = 0, mac_offset; 1899 #if defined(__i386__) 1900 int sig; 1901 int value; 1902 #endif 1917 unsigned int value; 1903 1918 1904 1919 /* … … 1916 1931 } 1917 1932 1918 1919 /*1920 * First, find a DEC board1921 */1922 1933 sc = &dc_softc_devs[unitNumber - 1]; 1923 1934 ifp = &sc->arpcom.ac_if; … … 1945 1956 return 0; 1946 1957 } 1958 t = sc->dc_info; 1947 1959 1948 1960 … … 1950 1962 * Map control/status registers. 1951 1963 */ 1952 sig = sc->dc_info->dc_devsig; 1953 pcib_conf_read32(sig, PCI_COMMAND, &command); 1964 //sig = sc->dc_info->dc_devsig; 1965 pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 1966 PCI_COMMAND, &command); 1967 //pcib_conf_read32(sig, PCI_COMMAND, &command); 1954 1968 command |= (PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); 1955 pcib_conf_write32(sig, PCI_COMMAND, command); 1956 pcib_conf_read32(sig, PCI_COMMAND, &command); 1969 pci_write_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 1970 PCI_COMMAND, command); 1971 //pcib_conf_write32(sig, PCI_COMMAND, command); 1972 pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 1973 PCI_COMMAND, &command); 1974 //pcib_conf_read32(sig, PCI_COMMAND, &command); 1957 1975 1958 1976 #ifdef DC_USEIOSPACE … … 1985 2003 1986 2004 /* sc->membase is the address of the card's CSRs !!! */ 1987 pcib_conf_read32(sig, DC_PCI_CFBMA, &value); 2005 //pcib_conf_read32(sig, DC_PCI_CFBMA, &value); 2006 pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 2007 DC_PCI_CFBMA, &value); 1988 2008 sc->membase = value; 1989 2009 1990 2010 /* Allocate interrupt */ 1991 2011 memset(&sc->irqInfo, 0, sizeof(rtems_irq_connect_data)); 1992 pcib_conf_read32(sig, DC_PCI_CFIT, &value); 2012 //pcib_conf_read32(sig, DC_PCI_CFIT, &value); 2013 pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 2014 DC_PCI_CFIT, &value); 2015 1993 2016 sc->irqInfo.name = value & 0xFF; 1994 1995 2017 sc->irqInfo.hdl = (rtems_irq_hdl)dc_intr; 2018 sc->irqInfo.handle = (void *)sc; /* new parameter */ 1996 2019 sc->irqInfo.on = nop; 1997 2020 sc->irqInfo.off = nop; 1998 2021 sc->irqInfo.isOn = decISON; 1999 2022 2000 if(!(BSP_install_rtems_irq_handler( &sc->irqInfo ))) { 2023 #ifdef BSP_SHARED_HANDLER_SUPPORT 2024 rc = BSP_install_rtems_shared_irq_handler( &sc->irqInfo ); 2025 #else 2026 rc = BSP_install_rtems_irq_handler( &sc->irqInfo ); 2027 #endif 2028 if(!rc) { 2001 2029 rtems_panic("Can't install dec2114x irq handler.\n"); 2002 2030 } … … 2030 2058 sc->dc_info = dc_devtype(dev); 2031 2059 */ 2032 pcib_conf_read32(sig, DC_PCI_CFRV, &revision); 2060 //pcib_conf_read32(sig, DC_PCI_CFRV, &revision); 2061 pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 2062 DC_PCI_CFRV, &revision); 2033 2063 revision &= 0x000000FF; 2034 2064 … … 2053 2083 sc->dc_pmode = DC_PMODE_MII; 2054 2084 /* Increase the latency timer value. */ 2055 pcib_conf_read32(sig, DC_PCI_CFLT, &command); 2085 //pcib_conf_read32(sig, DC_PCI_CFLT, &command); 2086 pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 2087 DC_PCI_CFLT, &command); 2056 2088 command &= 0xFFFF00FF; 2057 2089 command |= 0x00008000; 2058 pcib_conf_write32(sig, DC_PCI_CFLT, command); 2090 //pcib_conf_write32(sig, DC_PCI_CFLT, command); 2091 pci_write_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 2092 DC_PCI_CFLT, command); 2059 2093 break; 2060 2094 case DC_DEVICEID_AL981: … … 2143 2177 } 2144 2178 else { 2145 pcib_conf_read32(sig, DC_PCI_CFLT, &value); 2179 //pcib_conf_read32(sig, DC_PCI_CFLT, &value); 2180 pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 2181 DC_PCI_CFLT, &value); 2146 2182 sc->dc_cachesize = (u_int8_t)(value & 0xFF); 2147 2183 } … … 2152 2188 /* Take 21143 out of snooze mode */ 2153 2189 if (DC_IS_INTEL(sc)) { 2154 pcib_conf_read32(sig, DC_PCI_CFDD, &command); 2190 //pcib_conf_read32(sig, DC_PCI_CFDD, &command); 2191 pci_read_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 2192 DC_PCI_CFDD, &command); 2155 2193 command &= ~(DC_CFDD_SNOOZE_MODE|DC_CFDD_SLEEP_MODE); 2156 pcib_conf_write32(sig, DC_PCI_CFDD, command); 2194 //pcib_conf_write32(sig, DC_PCI_CFDD, command); 2195 pci_write_config_dword(t->dc_bus,t->dc_dev,t->dc_fun,\ 2196 DC_PCI_CFDD, command); 2157 2197 } 2158 2198 … … 2242 2282 ifp->if_name = unitName; /*sc->dc_name;*/ 2243 2283 ifp->if_mtu = ETHERMTU; 2244 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; /* | IFF_MULTICAST;*/2284 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; /* | IFF_MULTICAST;*/ 2245 2285 ifp->if_ioctl = dc_ioctl; 2246 2286 ifp->if_output = ether_output; … … 2327 2367 */ 2328 2368 2329 #ifdef SRM_MEDIA 2369 #ifdef SRM_MEDIA /* only defined if __alpha__ is defined... */ 2330 2370 sc->dc_srm_media = 0; 2331 2371 … … 3286 3326 { 3287 3327 struct dc_softc *sc; 3288 struct mbuf *m_head = NULL;3289 intidx;3328 struct mbuf *m_head = NULL; 3329 unsigned int idx; 3290 3330 3291 3331 sc = ifp->if_softc; … … 3582 3622 static int dc_ioctl(ifp, command, data) 3583 3623 struct ifnet *ifp; 3584 intcommand;3624 u_long command; 3585 3625 caddr_t data; 3586 3626 { … … 3807 3847 #endif 3808 3848 3809 3810 #endif /* end if supported */ 3849 #endif /* end if supported */ -
c/src/libchip/network/if_dcreg.h
r0d0560a1 r7f7298c4 475 475 u_int16_t dc_did; 476 476 char *dc_name; 477 int dc_devsig; 477 int dc_devsig; 478 int dc_bus; 479 int dc_dev; 480 int dc_fun; 478 481 }; 479 482 … … 679 682 struct arpcom arpcom; /* interface info */ 680 683 rtems_irq_connect_data irqInfo; 681 volatile u nsigned32membase;684 volatile u_int32_t membase; 682 685 rtems_id daemontid; 683 686 #if 0
Note: See TracChangeset
for help on using the changeset viewer.