📄 if_devar.h
字号:
"Full Duplex 10baseT", /* TULIP_MEDIA_10BASET_FD */ "BNC", /* TULIP_MEDIA_BNC */ "AUI", /* TULIP_MEDIA_AUI */ "External SIA", /* TULIP_MEDIA_EXTSIA */ "AUI/BNC", /* TULIP_MEDIA_AUIBNC */ "100baseTX", /* TULIP_MEDIA_100BASET */ "Full Duplex 100baseTX", /* TULIP_MEDIA_100BASET_FD */ "100baseT4", /* TULIP_MEDIA_100BASET4 */ "100baseFX", /* TULIP_MEDIA_100BASEFX */ "Full Duplex 100baseFX", /* TULIP_MEDIA_100BASEFX_FD */};#if defined(IFM_ETHER)static const int tulip_media_to_ifmedia[] = { IFM_ETHER | IFM_NONE, /* TULIP_MEDIA_UNKNOWN */ IFM_ETHER | IFM_10_T, /* TULIP_MEDIA_10BASET */ IFM_ETHER | IFM_10_T | IFM_FDX, /* TULIP_MEDIA_10BASET_FD */ IFM_ETHER | IFM_10_2, /* TULIP_MEDIA_BNC */ IFM_ETHER | IFM_10_5, /* TULIP_MEDIA_AUI */ IFM_ETHER | IFM_MANUAL, /* TULIP_MEDIA_EXTSIA */ IFM_ETHER | IFM_10_5, /* TULIP_MEDIA_AUIBNC */ IFM_ETHER | IFM_100_TX, /* TULIP_MEDIA_100BASET */ IFM_ETHER | IFM_100_TX | IFM_FDX, /* TULIP_MEDIA_100BASET_FD */ IFM_ETHER | IFM_100_T4, /* TULIP_MEDIA_100BASET4 */ IFM_ETHER | IFM_100_FX, /* TULIP_MEDIA_100BASEFX */ IFM_ETHER | IFM_100_FX | IFM_FDX, /* TULIP_MEDIA_100BASEFX_FD */};#endif /* defined(IFM_ETHER) */static const char * const tulip_system_errors[] = { "parity error", "master abort", "target abort", "reserved #3", "reserved #4", "reserved #5", "reserved #6", "reserved #7",};static const char * const tulip_status_bits[] = { NULL, "transmit process stopped", NULL, "transmit jabber timeout", NULL, "transmit underflow", NULL, "receive underflow", "receive process stopped", "receive watchdog timeout", NULL, NULL, "link failure", NULL, NULL,};static const struct { tulip_srom_connection_t sc_type; tulip_media_t sc_media; u_int32_t sc_attrs;} tulip_srom_conninfo[] = { { TULIP_SROM_CONNTYPE_10BASET, TULIP_MEDIA_10BASET }, { TULIP_SROM_CONNTYPE_BNC, TULIP_MEDIA_BNC }, { TULIP_SROM_CONNTYPE_AUI, TULIP_MEDIA_AUI }, { TULIP_SROM_CONNTYPE_100BASETX, TULIP_MEDIA_100BASETX }, { TULIP_SROM_CONNTYPE_100BASET4, TULIP_MEDIA_100BASET4 }, { TULIP_SROM_CONNTYPE_100BASEFX, TULIP_MEDIA_100BASEFX }, { TULIP_SROM_CONNTYPE_MII_10BASET, TULIP_MEDIA_10BASET, TULIP_SROM_ATTR_MII }, { TULIP_SROM_CONNTYPE_MII_100BASETX, TULIP_MEDIA_100BASETX, TULIP_SROM_ATTR_MII }, { TULIP_SROM_CONNTYPE_MII_100BASET4, TULIP_MEDIA_100BASET4, TULIP_SROM_ATTR_MII }, { TULIP_SROM_CONNTYPE_MII_100BASEFX, TULIP_MEDIA_100BASEFX, TULIP_SROM_ATTR_MII }, { TULIP_SROM_CONNTYPE_10BASET_NWAY, TULIP_MEDIA_10BASET, TULIP_SROM_ATTR_NWAY }, { TULIP_SROM_CONNTYPE_10BASET_FD, TULIP_MEDIA_10BASET_FD }, { TULIP_SROM_CONNTYPE_MII_10BASET_FD, TULIP_MEDIA_10BASET_FD, TULIP_SROM_ATTR_MII }, { TULIP_SROM_CONNTYPE_100BASETX_FD, TULIP_MEDIA_100BASETX_FD }, { TULIP_SROM_CONNTYPE_MII_100BASETX_FD, TULIP_MEDIA_100BASETX_FD, TULIP_SROM_ATTR_MII }, { TULIP_SROM_CONNTYPE_10BASET_NOLINKPASS, TULIP_MEDIA_10BASET, TULIP_SROM_ATTR_NOLINKPASS }, { TULIP_SROM_CONNTYPE_AUTOSENSE, TULIP_MEDIA_UNKNOWN, TULIP_SROM_ATTR_AUTOSENSE }, { TULIP_SROM_CONNTYPE_AUTOSENSE_POWERUP, TULIP_MEDIA_UNKNOWN, TULIP_SROM_ATTR_AUTOSENSE|TULIP_SROM_ATTR_POWERUP }, { TULIP_SROM_CONNTYPE_AUTOSENSE_NWAY, TULIP_MEDIA_UNKNOWN, TULIP_SROM_ATTR_AUTOSENSE|TULIP_SROM_ATTR_NWAY }, { TULIP_SROM_CONNTYPE_NOT_USED, TULIP_MEDIA_UNKNOWN }};#define TULIP_SROM_LASTCONNIDX \ (sizeof(tulip_srom_conninfo)/sizeof(tulip_srom_conninfo[0]) - 1)static const struct { tulip_media_t sm_type; tulip_srom_media_t sm_srom_type;} tulip_srom_mediums[] = { { TULIP_MEDIA_100BASEFX_FD, TULIP_SROM_MEDIA_100BASEFX_FD }, { TULIP_MEDIA_100BASEFX, TULIP_SROM_MEDIA_100BASEFX }, { TULIP_MEDIA_100BASET4, TULIP_SROM_MEDIA_100BASET4 }, { TULIP_MEDIA_100BASETX_FD, TULIP_SROM_MEDIA_100BASETX_FD }, { TULIP_MEDIA_100BASETX, TULIP_SROM_MEDIA_100BASETX }, { TULIP_MEDIA_10BASET_FD, TULIP_SROM_MEDIA_10BASET_FD }, { TULIP_MEDIA_AUI, TULIP_SROM_MEDIA_AUI }, { TULIP_MEDIA_BNC, TULIP_SROM_MEDIA_BNC }, { TULIP_MEDIA_10BASET, TULIP_SROM_MEDIA_10BASET }, { TULIP_MEDIA_UNKNOWN }};#endif /* TULIP_HDR_DATA *//* * This driver supports a maximum of 32 tulip boards. * This should be enough for the forseeable future. */#define TULIP_MAX_DEVICES 32#if defined(TULIP_USE_SOFTINTR) && defined(TULIP_HDR_DATA)static u_int32_t tulip_softintr_mask;static int tulip_softintr_last_unit;static int tulip_softintr_max_unit;static void tulip_softintr(void);#endif#ifdef notyet#define SIOCGADDRROM _IOW('i', 240, struct ifreq) /* get 128 bytes of ROM */#define SIOCGCHIPID _IOWR('i', 241, struct ifreq) /* get chipid */#endif#if defined(__FreeBSD__)typedef void ifnet_ret_t;typedef int ioctl_cmd_t;#if defined(TULIP_HDR_DATA)static tulip_softc_t *tulips[TULIP_MAX_DEVICES];#endif#if BSD >= 199506#define TULIP_IFP_TO_SOFTC(ifp) ((tulip_softc_t *)((ifp)->if_softc))#if NBPFILTER > 0#define TULIP_BPF_MTAP(sc, m) bpf_mtap(&(sc)->tulip_if, m)#define TULIP_BPF_TAP(sc, p, l) bpf_tap(&(sc)->tulip_if, p, l)#define TULIP_BPF_ATTACH(sc) bpfattach(&(sc)->tulip_if, DLT_EN10MB, sizeof(struct ether_header))#endif#define tulip_intrfunc_t void#define TULIP_VOID_INTRFUNC#define IFF_NOTRAILERS 0#define CLBYTES PAGE_SIZE#if 0#define TULIP_KVATOPHYS(sc, va) kvtop(va)#endif#define TULIP_EADDR_FMT "%6D"#define TULIP_EADDR_ARGS(addr) addr, ":"#elseextern int bootverbose;#define TULIP_IFP_TO_SOFTC(ifp) (TULIP_UNIT_TO_SOFTC((ifp)->if_unit))#include <sys/devconf.h>#define TULIP_DEVCONF#endif#if defined(TULIP_USE_SOFTINTR)NETISR_SET(NETISR_DE, tulip_softintr);#endif#define TULIP_UNIT_TO_SOFTC(unit) (tulips[unit])#define TULIP_BURSTSIZE(unit) pci_max_burst_len#define loudprintf if (bootverbose) printf#endif#if defined(__bsdi__)typedef int ifnet_ret_t;typedef u_long ioctl_cmd_t;extern struct cfdriver decd;#define TULIP_UNIT_TO_SOFTC(unit) ((tulip_softc_t *) decd.cd_devs[unit])#define TULIP_IFP_TO_SOFTC(ifp) (TULIP_UNIT_TO_SOFTC((ifp)->if_unit))#define TULIP_ETHER_IFATTACH(sc) ether_attach(&(sc)->tulip_if)#if _BSDI_VERSION >= 199510#if 0#define TULIP_BURSTSIZE(unit) log2_burst_size#endif#define loudprintf aprint_verbose#define printf (*sc->tulip_pf)#define MCNT(x) (sizeof(x) / sizeof(struct ifmedia_entry))#elif _BSDI_VERSION <= 199401#define DRQNONE 0#define loudprintf printfstatic voidarp_ifinit( struct arpcom *ac, struct ifaddr *ifa){ ac->ac_ipaddr = IA_SIN(ifa)->sin_addr; arpwhohas(ac, &ac->ac_ipaddr);}#endif#endif /* __bsdi__ */#if defined(__NetBSD__) || defined(__OpenBSD__)typedef void ifnet_ret_t;typedef u_long ioctl_cmd_t;extern struct cfattach de_ca;extern struct cfdriver de_cd;#define TULIP_UNIT_TO_SOFTC(unit) ((tulip_softc_t *) de_cd.cd_devs[unit])#define TULIP_IFP_TO_SOFTC(ifp) ((tulip_softc_t *)((ifp)->if_softc))#define tulip_unit tulip_dev.dv_unit#if defined(__OpenBSD__)#define tulip_xname tulip_dev.dv_cfdata->cf_driver->cd_name#else#define tulip_xname tulip_if.if_xname#endif#define TULIP_RAISESPL() splnet()#define TULIP_RAISESOFTSPL() splsoftnet()#define TULIP_RESTORESPL(s) splx(s)#define loudprintf printf#if !defined(__OpenBSD__)#define tulip_if tulip_ec.ec_if#define tulip_enaddr tulip_enaddr#define tulip_multicnt tulip_ec.ec_multicnt#define TULIP_ETHERCOM(sc) (&(sc)->tulip_ec)#define TULIP_ARP_IFINIT(sc, ifa) arp_ifinit(&(sc)->tulip_if, (ifa))#define TULIP_ETHER_IFATTACH(sc) ether_ifattach(&(sc)->tulip_if, (sc)->tulip_enaddr)#define TULIP_PRINTF_FMT "%s"#define TULIP_PRINTF_ARGS sc->tulip_xname#else#define TULIP_PRINTF_FMT "%s%d"#define TULIP_PRINTF_ARGS sc->tulip_xname, sc->tulip_unit#endif#endif /* __NetBSD__ */#if defined(__alpha__)/* XXX XXX NEED REAL DMA MAPPING SUPPORT XXX XXX */#define TULIP_KVATOPHYS(sc, va) alpha_XXX_dmamap((vm_offset_t)(va))#endif#if defined(PROM)/* P5064 mapping of local memory onto PCI bus is not 1 to 1 */#define TULIP_KVATOPHYS(sc, va) _pci_dmamap((vm_offset_t)(va), 1)#define TULIP_BURSTSIZE(unit) MIN(_pci_maxburst_log2(), 5)#endif#ifndef TULIP_PRINTF_FMT#define TULIP_PRINTF_FMT "%s%d"#endif#ifndef TULIP_PRINTF_ARGS#define TULIP_PRINTF_ARGS sc->tulip_name, sc->tulip_unit#endif#ifndef TULIP_BURSTSIZE#define TULIP_BURSTSIZE(unit) 3#endif#ifndef tulip_if#define tulip_if tulip_ac.ac_if#endif#ifndef tulip_unit#define tulip_unit tulip_if.if_unit#endif#define tulip_name tulip_if.if_name#ifndef tulip_enaddr#define tulip_enaddr tulip_ac.ac_enaddr#endif#ifndef tulip_multicnt#define tulip_multicnt tulip_ac.ac_multicnt#endif#if !defined(TULIP_ETHERCOM)#define TULIP_ETHERCOM(sc) (&(sc)->tulip_ac)#endif#if !defined(TULIP_ARP_IFINIT)#define TULIP_ARP_IFINIT(sc, ifa) arp_ifinit(TULIP_ETHERCOM(sc), (ifa))#endif#if !defined(TULIP_ETHER_IFATTACH)#define TULIP_ETHER_IFATTACH(sc) ether_ifattach(&(sc)->tulip_if)#endif#if !defined(tulip_bpf) && (!defined(__bsdi__) || _BSDI_VERSION >= 199401)#define tulip_bpf tulip_if.if_bpf#endif#if !defined(tulip_intrfunc_t)#define tulip_intrfunc_t int#endif#if !defined(TULIP_KVATOPHYS)#define TULIP_KVATOPHYS(sc, va) vtophys(va)#endif#ifndef TULIP_RAISESPL#define TULIP_RAISESPL() splimp()#endif#ifndef TULIP_RAISESOFTSPL#define TULIP_RAISESOFTSPL() splnet()#endif#ifndef TULUP_RESTORESPL#define TULIP_RESTORESPL(s) splx(s)#endif/* * While I think FreeBSD's 2.2 change to the bpf is a nice simplification, * it does add yet more conditional code to this driver. Sigh. */#if !defined(TULIP_BPF_MTAP) && NBPFILTER > 0#define TULIP_BPF_MTAP(sc, m) bpf_mtap((sc)->tulip_bpf, m)#define TULIP_BPF_TAP(sc, p, l) bpf_tap((sc)->tulip_bpf, p, l)#define TULIP_BPF_ATTACH(sc) bpfattach(&(sc)->tulip_bpf, &(sc)->tulip_if, DLT_EN10MB, sizeof(struct ether_header))#endif#if defined(TULIP_PERFSTATS)#define TULIP_PERFMERGE(sc, member) \ do { (sc)->tulip_perfstats[TULIP_PERF_TOTAL].member \ += (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member; \ (sc)->tulip_perfstats[TULIP_PERF_PREVIOUS].member \ = (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member; \ (sc)->tulip_perfstats[TULIP_PERF_CURRENT].member = 0; } while (0)#define TULIP_PERFSTART(name) const tulip_cycle_t perfstart_ ## name = TULIP_PERFREAD();#define TULIP_PERFEND(name) do { \ (sc)->tulip_curperfstats.perf_ ## name ## _cycles += TULIP_PERFDIFF(perfstart_ ## name, TULIP_PERFREAD()); \ (sc)->tulip_curperfstats.perf_ ## name ++; \ } while (0)#if defined(__i386__)typedef u_quad_t tulip_cycle_t;static __inline__ tulip_cycle_tTULIP_PERFREAD( void){ tulip_cycle_t x; __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); return x;}#define TULIP_PERFDIFF(s, f) ((f) - (s))#elif defined(__alpha__)typedef unsigned long tulip_cycle_t;static __inline__ tulip_cycle_tTULIP_PERFREAD( void){ tulip_cycle_t x; __asm__ volatile ("rpcc %0" : "=r" (x)); return x;}#define TULIP_PERFDIFF(s, f) ((unsigned int) ((f) - (s)))#endif#else#define TULIP_PERFSTART(name) #define TULIP_PERFEND(name) do { } while (0)#define TULIP_PERFMERGE(s,n) do { } while (0)#endif /* TULIP_PERFSTATS *//* * However, this change to FreeBSD I am much less enamored with. */#if !defined(TULIP_EADDR_FMT)#define TULIP_EADDR_FMT "%s"#define TULIP_EADDR_ARGS(addr) ether_sprintf(addr)#endif#define TULIP_CRC32_POLY 0xEDB88320UL /* CRC-32 Poly -- Little Endian */#define TULIP_MAX_TXSEG 30#define TULIP_ADDREQUAL(a1, a2) \ (((u_int16_t *)a1)[0] == ((u_int16_t *)a2)[0] \ && ((u_int16_t *)a1)[1] == ((u_int16_t *)a2)[1] \ && ((u_int16_t *)a1)[2] == ((u_int16_t *)a2)[2])#define TULIP_ADDRBRDCST(a1) \ (((u_int16_t *)a1)[0] == 0xFFFFU \ && ((u_int16_t *)a1)[1] == 0xFFFFU \ && ((u_int16_t *)a1)[2] == 0xFFFFU)typedef int tulip_spl_t;#endif /* !defined(_DEVAR_H) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -