diff options
-rw-r--r-- | sys/dev/pci/if_san_common.h | 26 | ||||
-rw-r--r-- | sys/dev/pci/if_san_front_end.h | 10 | ||||
-rw-r--r-- | sys/dev/pci/if_san_obsd.c | 43 | ||||
-rw-r--r-- | sys/dev/pci/if_san_obsd.h | 15 | ||||
-rw-r--r-- | sys/dev/pci/if_san_te1.c | 138 | ||||
-rw-r--r-- | sys/dev/pci/if_san_te1.h | 98 | ||||
-rw-r--r-- | sys/dev/pci/if_san_xilinx.c | 6 | ||||
-rw-r--r-- | sys/dev/pci/if_sandrv.c | 8 |
8 files changed, 188 insertions, 156 deletions
diff --git a/sys/dev/pci/if_san_common.h b/sys/dev/pci/if_san_common.h index 26f9606ea37..6ec6f6c9c1d 100644 --- a/sys/dev/pci/if_san_common.h +++ b/sys/dev/pci/if_san_common.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_san_common.h,v 1.4 2004/07/16 15:11:45 alex Exp $ */ +/* $OpenBSD: if_san_common.h,v 1.5 2004/12/07 06:10:24 mcbride Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -50,37 +50,37 @@ #define WANROUTER_MINOR_VER 1 /* IOCTL codes for /proc/router/<device> entries (up to 255) */ -# define WANPIPE_DUMP _IOW(ROUTER_IOCTL, 16, wan_conf_t) -# define WANPIPE_EXEC _IOWR(ROUTER_IOCTL, 17, wan_conf_t) +#define WANPIPE_DUMP _IOW(ROUTER_IOCTL, 16, wan_conf_t) +#define WANPIPE_EXEC _IOWR(ROUTER_IOCTL, 17, wan_conf_t) /* get monitor statistics */ -# define SIOC_WANPIPE_PIPEMON _IOWR('i', 150, struct ifreq) +#define SIOC_WANPIPE_PIPEMON _IOWR('i', 150, struct ifreq) /* set generic device */ -# define SIOC_WANPIPE_DEVICE _IOWR('i', 151, struct ifreq) +#define SIOC_WANPIPE_DEVICE _IOWR('i', 151, struct ifreq) /* get hwprobe string */ -# define SIOC_WANPIPE_HWPROBE _IOWR('i', 152, struct ifreq) +#define SIOC_WANPIPE_HWPROBE _IOWR('i', 152, struct ifreq) /* get memdump string (GENERIC) */ -# define SIOC_WANPIPE_DUMP _IOWR('i', 153, struct ifreq) +#define SIOC_WANPIPE_DUMP _IOWR('i', 153, struct ifreq) /* clocking options */ -#define WANOPT_EXTERNAL 0 -#define WANOPT_INTERNAL 1 +#define WAN_EXTERNAL 0 +#define WAN_INTERNAL 1 /* intercace options */ -#define WANOPT_RS232 0 -#define WANOPT_V35 1 +#define WAN_RS232 0 +#define WAN_V35 1 #define WAN_UDP_FAILED_CMD 0xCF #define WAN_UDP_INVALID_CMD 0xCE #define WAN_UDP_TIMEOUT_CMD 0xAA #define WAN_UDP_INVALID_NET_CMD 0xCD -#define WANOPT_NO 0 -#define WANOPT_YES 1 +#define WAN_NO 0 +#define WAN_YES 1 /* UDP Packet Management */ #define UDP_PKT_FRM_STACK 0x00 diff --git a/sys/dev/pci/if_san_front_end.h b/sys/dev/pci/if_san_front_end.h index b3d024c1152..e4b1c9f9015 100644 --- a/sys/dev/pci/if_san_front_end.h +++ b/sys/dev/pci/if_san_front_end.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_san_front_end.h,v 1.3 2004/06/27 03:10:17 mcbride Exp $ */ +/* $OpenBSD: if_san_front_end.h,v 1.4 2004/12/07 06:10:24 mcbride Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -38,10 +38,10 @@ #define __IF_SAN_FRONT_END_H_ /* The hardware media */ -#define WANOPT_MEDIA_NONE 0x00 /* Regular card */ -#define WANOPT_MEDIA_T1 0x01 /* T1 connection */ -#define WANOPT_MEDIA_E1 0x02 /* E1 connection */ -#define WANOPT_MEDIA_56K 0x03 /* 56K connection */ +#define WAN_MEDIA_NONE 0x00 /* Regular card */ +#define WAN_MEDIA_T1 0x01 /* T1 connection */ +#define WAN_MEDIA_E1 0x02 /* E1 connection */ +#define WAN_MEDIA_56K 0x03 /* 56K connection */ /* settings for the 'adapter_type' */ #define S508_ADPTR 0x0001 /* S508 */ diff --git a/sys/dev/pci/if_san_obsd.c b/sys/dev/pci/if_san_obsd.c index f7163eed26a..2355b69f62a 100644 --- a/sys/dev/pci/if_san_obsd.c +++ b/sys/dev/pci/if_san_obsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_san_obsd.c,v 1.5 2004/11/28 23:39:45 canacar Exp $ */ +/* $OpenBSD: if_san_obsd.c,v 1.6 2004/12/07 06:10:24 mcbride Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -116,6 +116,8 @@ wanpipe_generic_name(sdla_t *card, char *ifname) int wanpipe_generic_register(sdla_t *card, struct ifnet *ifp, char *ifname) { + wanpipe_common_t* common = WAN_IFP_TO_COMMON(ifp); + if (ifname == NULL || strlen(ifname) > IFNAMSIZ) { return (-EINVAL); } else { @@ -124,6 +126,7 @@ wanpipe_generic_register(sdla_t *card, struct ifnet *ifp, char *ifname) IFQ_SET_MAXLEN(&ifp->if_snd, IFQ_MAXLEN); ifp->if_mtu = PP_MTU; ifp->if_flags = IFF_POINTOPOINT | IFF_MULTICAST; + common->protocol = IF_PROTO_CISCO; ((struct sppp *)ifp)->pp_flags |= PP_CISCO; ((struct sppp *)ifp)->pp_flags |= PP_KEEPALIVE; ((struct sppp *)ifp)->pp_framebytes = 3; @@ -299,6 +302,10 @@ wanpipe_generic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) err = wp_lite_set_proto(ifp, (struct ifreq*)data); break; + case IF_IFACE_T1: + case IF_IFACE_E1: + err = wp_lite_set_te1_cfg(ifp, (struct ifreq*)data); + break; default: if (card->iface_ioctl) { err = card->iface_ioctl(ifp, cmd, @@ -369,8 +376,7 @@ wanpipe_generic_input(struct ifnet *ifp, struct mbuf *m) return (0); } -int -wp_lite_set_proto(struct ifnet *ifp, struct ifreq *ifr) +int wp_lite_set_proto(struct ifnet *ifp, struct ifreq *ifr) { wanpipe_common_t *common; struct if_settings *ifsettings; @@ -386,12 +392,43 @@ wp_lite_set_proto(struct ifnet *ifp, struct ifreq *ifr) case IF_PROTO_CISCO: ((struct sppp *)ifp)->pp_flags |= PP_CISCO; ((struct sppp *)ifp)->pp_flags |= PP_KEEPALIVE; + common->protocol = IF_PROTO_CISCO; break; case IF_PROTO_PPP: ((struct sppp *)ifp)->pp_flags &= ~PP_CISCO; ((struct sppp *)ifp)->pp_flags &= ~PP_KEEPALIVE; + common->protocol = IF_PROTO_PPP; break; } err = sppp_ioctl(ifp, SIOCSIFFLAGS, ifr); return (err); } + +int wp_lite_set_te1_cfg(struct ifnet *ifp, struct ifreq *ifr) +{ + sdla_t *card; + struct if_settings *ifsettings; + sdla_te_cfg_t te_cfg; + int err = 0; + + if ((card = wanpipe_generic_getcard(ifp)) == NULL) { + return (-EINVAL); + } + ifsettings = (struct if_settings*)ifr->ifr_data; + err = copyin(ifsettings->ifs_te1, + &te_cfg, + sizeof(sdla_te_cfg_t)); + + if (ifsettings->flags & SANCFG_CLOCK_FLAG){ + card->fe_te.te_cfg.te_clock = te_cfg.te_clock; + } + switch (ifsettings->type) { + case IF_IFACE_T1: + if (ifsettings->flags & SANCFG_LBO_FLAG){ + card->fe_te.te_cfg.lbo = te_cfg.lbo; + } + break; + } + return (err); +} + diff --git a/sys/dev/pci/if_san_obsd.h b/sys/dev/pci/if_san_obsd.h index 0a0bf62209c..b0050fdc21d 100644 --- a/sys/dev/pci/if_san_obsd.h +++ b/sys/dev/pci/if_san_obsd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_san_obsd.h,v 1.3 2004/06/26 22:48:14 mcbride Exp $ */ +/* $OpenBSD: if_san_obsd.h,v 1.4 2004/12/07 06:10:24 mcbride Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -65,19 +65,14 @@ #define ifs_fr_pvc_info data -#define WANHDLC_CONF_INTERFACE 0x0001 -#define WANHDLC_CONF_CLOCKING 0x0002 - -typedef struct { - unsigned long mask; - char interface; - unsigned bps; -} wan_dev_conf_t; +#define SANCFG_LBO_FLAG 0x0001 +#define SANCFG_CLOCK_FLAG 0x0002 typedef struct { int dummy; } cisco_proto, fr_proto, fr_proto_pvc; struct if_settings { unsigned int type; unsigned int data_length; + unsigned long flags; void* data; }; @@ -86,7 +81,6 @@ typedef struct { int iface; char hwprobe[100]; sdla_te_cfg_t te_cfg; - wan_dev_conf_t devconf; union { cisco_proto cisco; fr_proto fr; @@ -106,5 +100,6 @@ int wanpipe_generic_close(struct ifnet *); int wanpipe_generic_input(struct ifnet *, struct mbuf *); int wanpipe_generic_tx_timeout(struct ifnet *); int wp_lite_set_proto(struct ifnet *, struct ifreq *); +int wp_lite_set_te1_cfg(struct ifnet *, struct ifreq *); # endif #endif /* __IF_SAN_OBSD_H */ diff --git a/sys/dev/pci/if_san_te1.c b/sys/dev/pci/if_san_te1.c index c6b8c82425d..f5e1cad92ff 100644 --- a/sys/dev/pci/if_san_te1.c +++ b/sys/dev/pci/if_san_te1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_san_te1.c,v 1.4 2004/07/16 15:11:45 alex Exp $ */ +/* $OpenBSD: if_san_te1.c,v 1.5 2004/12/07 06:10:24 mcbride Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -1386,43 +1386,43 @@ InitTemplate(sdla_t *card) if (IS_T1(&card->fe_te.te_cfg)) { switch (te_cfg->lbo) { - case WANOPT_T1_LBO_0_DB: + case WAN_T1_LBO_0_DB: tx_waveform = &t1_tx_waveform_lh_0db; xlpg_scale = 0x0C; break; - case WANOPT_T1_LBO_75_DB: + case WAN_T1_LBO_75_DB: tx_waveform = &t1_tx_waveform_lh_75db; xlpg_scale = 0x07; break; - case WANOPT_T1_LBO_15_DB: + case WAN_T1_LBO_15_DB: tx_waveform = &t1_tx_waveform_lh_15db; xlpg_scale = 0x03; break; - case WANOPT_T1_LBO_225_DB: + case WAN_T1_LBO_225_DB: tx_waveform = &t1_tx_waveform_lh_225db; xlpg_scale = 0x02; break; - case WANOPT_T1_0_110: + case WAN_T1_0_110: tx_waveform = &t1_tx_waveform_sh_110ft; xlpg_scale = 0x0C; break; - case WANOPT_T1_110_220: + case WAN_T1_110_220: tx_waveform = &t1_tx_waveform_sh_220ft; xlpg_scale = 0x10; break; - case WANOPT_T1_220_330: + case WAN_T1_220_330: tx_waveform = &t1_tx_waveform_sh_330ft; xlpg_scale = 0x11; break; - case WANOPT_T1_330_440: + case WAN_T1_330_440: tx_waveform = &t1_tx_waveform_sh_440ft; xlpg_scale = 0x12; break; - case WANOPT_T1_440_550: + case WAN_T1_440_550: tx_waveform = &t1_tx_waveform_sh_550ft; xlpg_scale = 0x14; break; - case WANOPT_T1_550_660: + case WAN_T1_550_660: tx_waveform = &t1_tx_waveform_sh_660ft; xlpg_scale = 0x15; break; @@ -1459,7 +1459,7 @@ InitLineReceiver(sdla_t *card) if (IS_E1(&card->fe_te.te_cfg)) { rlps_ram_table = e1_rlps_ram_table; } else { - if (card->fe_te.te_cfg.high_impedance_mode == WANOPT_YES) { + if (card->fe_te.te_cfg.high_impedance_mode == WAN_YES) { log(LOG_INFO, "%s: Setting to High-Impedance Mode!\n", card->devname); rlps_ram_table = t1_rlps_perf_mode_ram_table; @@ -1779,7 +1779,7 @@ static void EnableAllChannels(sdla_t* card) if (IS_E1(&card->fe_te.te_cfg)) { int first_ts = - (card->fe_te.te_cfg.frame == WANOPT_FR_UNFRAMED) ? + (card->fe_te.te_cfg.frame == WAN_FR_UNFRAMED) ? 0 : 1; DisableTxChannel(card, E1_FRAMING_TIMESLOT); @@ -1806,7 +1806,7 @@ static int EnableTxChannel(sdla_t* card, int channel) { sdla_te_cfg_t* te_cfg = &card->fe_te.te_cfg; - if (te_cfg->lcode == WANOPT_LC_AMI) { + if (te_cfg->lcode == WAN_LC_AMI) { /* ZCs=1 AMI*/ WRITE_TPSC_REG(REG_TPSC_DATA_CTRL_BYTE, channel, (((READ_TPSC_REG(REG_TPSC_DATA_CTRL_BYTE, channel) & @@ -1905,13 +1905,13 @@ int sdla_te_defcfg(void *pte_cfg) { sdla_te_cfg_t *te_cfg = (sdla_te_cfg_t*)pte_cfg; - te_cfg->media = WANOPT_MEDIA_T1; - te_cfg->lcode = WANOPT_LC_B8ZS; - te_cfg->frame = WANOPT_FR_ESF; - te_cfg->lbo = WANOPT_T1_LBO_0_DB; - te_cfg->te_clock = WANOPT_NORMAL_CLK; + te_cfg->media = WAN_MEDIA_T1; + te_cfg->lcode = WAN_LC_B8ZS; + te_cfg->frame = WAN_FR_ESF; + te_cfg->lbo = WAN_T1_LBO_0_DB; + te_cfg->te_clock = WAN_NORMAL_CLK; te_cfg->active_ch = ENABLE_ALL_CHANNELS; - te_cfg->high_impedance_mode = WANOPT_NO; + te_cfg->high_impedance_mode = WAN_NO; return 0; } @@ -1927,36 +1927,36 @@ int sdla_te_setcfg(void *pcard, struct ifmedia *ifm) log(LOG_INFO, "%s: Setting T1 media type!\n", card->devname); #endif /* DEBUG_INIT */ - te_cfg->media = WANOPT_MEDIA_T1; - te_cfg->lcode = WANOPT_LC_B8ZS; - te_cfg->frame = WANOPT_FR_ESF; + te_cfg->media = WAN_MEDIA_T1; + te_cfg->lcode = WAN_LC_B8ZS; + te_cfg->frame = WAN_FR_ESF; break; case(IFM_TDM|IFM_TDM_T1_AMI): #ifdef DEBUG_INIT log(LOG_INFO, "%s: Setting T1 AMI media type!\n", card->devname); #endif /* DEBUG_INIT */ - te_cfg->media = WANOPT_MEDIA_T1; - te_cfg->lcode = WANOPT_LC_AMI; - te_cfg->frame = WANOPT_FR_ESF; + te_cfg->media = WAN_MEDIA_T1; + te_cfg->lcode = WAN_LC_AMI; + te_cfg->frame = WAN_FR_ESF; break; case(IFM_TDM|IFM_TDM_E1): #ifdef DEBUG_INIT log(LOG_INFO, "%s: Setting E1 media type!\n", card->devname); #endif /* DEBUG_INIT */ - te_cfg->media = WANOPT_MEDIA_E1; - te_cfg->lcode = WANOPT_LC_HDB3; - te_cfg->frame = WANOPT_FR_NCRC4; + te_cfg->media = WAN_MEDIA_E1; + te_cfg->lcode = WAN_LC_HDB3; + te_cfg->frame = WAN_FR_NCRC4; break; case(IFM_TDM|IFM_TDM_E1_AMI): #ifdef DEBUG_INIT log(LOG_INFO, "%s: Setting E1 AMI media type!\n", card->devname); #endif /* DEBUG_INIT */ - te_cfg->media = WANOPT_MEDIA_E1; - te_cfg->lcode = WANOPT_LC_AMI; - te_cfg->frame = WANOPT_FR_NCRC4; + te_cfg->media = WAN_MEDIA_E1; + te_cfg->lcode = WAN_LC_AMI; + te_cfg->frame = WAN_FR_NCRC4; break; default: log(LOG_INFO, "%s: Unsupported ifmedia type (%04X)\n", @@ -2017,54 +2017,54 @@ sdla_te_config(void* card_id) if (IS_T1(&card->fe_te.te_cfg)) { log(LOG_DEBUG, "%s: Line decoding %s\n", card->devname, - (te_cfg->lcode == WANOPT_LC_AMI) ? "AMI" : "B8ZS"); + (te_cfg->lcode == WAN_LC_AMI) ? "AMI" : "B8ZS"); log(LOG_DEBUG, "%s: Frame type %s\n", card->devname, - (te_cfg->frame == WANOPT_FR_ESF) ? "ESF" : - (te_cfg->frame == WANOPT_FR_D4) ? "D4" : "Unframed"); + (te_cfg->frame == WAN_FR_ESF) ? "ESF" : + (te_cfg->frame == WAN_FR_D4) ? "D4" : "Unframed"); switch (te_cfg->lbo) { - case WANOPT_T1_LBO_0_DB: + case WAN_T1_LBO_0_DB: log(LOG_DEBUG, "%s: LBO 0 dB\n", card->devname); break; - case WANOPT_T1_LBO_75_DB: + case WAN_T1_LBO_75_DB: log(LOG_DEBUG, "%s: LBO 7.5 dB\n", card->devname); break; - case WANOPT_T1_LBO_15_DB: + case WAN_T1_LBO_15_DB: log(LOG_DEBUG, "%s: LBO 15 dB\n", card->devname); break; - case WANOPT_T1_LBO_225_DB: + case WAN_T1_LBO_225_DB: log(LOG_DEBUG, "%s: LBO 22.5 dB\n", card->devname); break; - case WANOPT_T1_0_110: + case WAN_T1_0_110: log(LOG_DEBUG, "%s: LBO 0-110 ft.\n", card->devname); break; - case WANOPT_T1_110_220: + case WAN_T1_110_220: log(LOG_DEBUG, "%s: LBO 110-220 ft.\n", card->devname); break; - case WANOPT_T1_220_330: + case WAN_T1_220_330: log(LOG_DEBUG, "%s: LBO 220-330 ft.\n", card->devname); break; - case WANOPT_T1_330_440: + case WAN_T1_330_440: log(LOG_DEBUG, "%s: LBO 330-440 ft.\n", card->devname); break; - case WANOPT_T1_440_550: + case WAN_T1_440_550: log(LOG_DEBUG, "%s: LBO 440-550 ft.\n", card->devname); break; - case WANOPT_T1_550_660: + case WAN_T1_550_660: log(LOG_DEBUG, "%s: LBO 550-660 ft.\n", card->devname); break; } } else { log(LOG_DEBUG, "%s: Line decoding %s\n", card->devname, - (te_cfg->lcode == WANOPT_LC_AMI) ? "AMI" : "HDB3"); + (te_cfg->lcode == WAN_LC_AMI) ? "AMI" : "HDB3"); log(LOG_DEBUG, "%s: Frame type %s\n", card->devname, - (te_cfg->frame == WANOPT_FR_CRC4) ? "CRC4" : - (te_cfg->frame == WANOPT_FR_NCRC4) ? "non-CRC3" : + (te_cfg->frame == WAN_FR_CRC4) ? "CRC4" : + (te_cfg->frame == WAN_FR_NCRC4) ? "non-CRC3" : "Unframed"); } log(LOG_DEBUG, "%s: Clock mode %s\n", card->devname, - (te_cfg->te_clock == WANOPT_NORMAL_CLK) ? "Normal" : "Master"); + (te_cfg->te_clock == WAN_NORMAL_CLK) ? "Normal" : "Master"); #endif /* DEBUG_INIT */ /* 1. Initiate software reset of the COMET */ @@ -2109,7 +2109,7 @@ sdla_te_config(void* card_id) } /* Set Line decoding (Reg. 0x10) */ - if (te_cfg->lcode == WANOPT_LC_AMI) { + if (te_cfg->lcode == WAN_LC_AMI) { WRITE_REG(REG_CDRC_CFG, BIT_CDRC_CFG_AMI); } else { WRITE_REG(REG_CDRC_CFG, 0x00); @@ -2129,43 +2129,43 @@ sdla_te_config(void* card_id) if (IS_E1(&card->fe_te.te_cfg)) { /* Program the trasmitter framing and line decoding ** (Reg. 0x80) */ - if (te_cfg->lcode == WANOPT_LC_AMI) { + if (te_cfg->lcode == WAN_LC_AMI) { value |= BIT_E1_TRAN_AMI; } - if (te_cfg->frame == WANOPT_FR_CRC4) { + if (te_cfg->frame == WAN_FR_CRC4) { value |= BIT_E1_TRAN_GENCRC; - } else if (te_cfg->frame == WANOPT_FR_UNFRAMED) { + } else if (te_cfg->frame == WAN_FR_UNFRAMED) { value |= BIT_E1_TRAN_FDIS; } /* E1 TRAN Configuration (Reg 0x80) */ WRITE_REG(REG_E1_TRAN_CFG, value); /* Configure the receive framer (Reg 0x90) */ value = 0x00; - if (te_cfg->frame == WANOPT_FR_CRC4) { + if (te_cfg->frame == WAN_FR_CRC4) { value |= (BIT_E1_FRMR_CRCEN | BIT_E1_FRMR_CASDIS | BIT_E1_FRMR_REFCRCEN); - } else if (te_cfg->frame == WANOPT_FR_NCRC4) { + } else if (te_cfg->frame == WAN_FR_NCRC4) { value |= BIT_E1_FRMR_CASDIS; } WRITE_REG(REG_E1_FRMR_CFG, value); } else { /* Set framing format & line decoding for transmitter ** (Reg 0x54) */ - if (te_cfg->lcode == WANOPT_LC_B8ZS) { + if (te_cfg->lcode == WAN_LC_B8ZS) { value |= BIT_T1_XBAS_B8ZS; } else { value |= BIT_T1_XBAS_ZCS0; } - if (te_cfg->frame == WANOPT_FR_ESF) { + if (te_cfg->frame == WAN_FR_ESF) { value |= BIT_T1_XBAS_ESF; } WRITE_REG(REG_T1_XBAS_CFG, value); /* Program framing format for receiving (Reg. 0x48) */ value = 0x00; - if (te_cfg->frame == WANOPT_FR_ESF) { + if (te_cfg->frame == WAN_FR_ESF) { value = BIT_T1_FRMR_ESF | BIT_T1_FRMR_ESFFA; } WRITE_REG(REG_T1_FRMR_CFG, value); @@ -2173,7 +2173,7 @@ sdla_te_config(void* card_id) /* Program the transmitter framing format and line deconding ** (Reg. 0x60) */ value = 0x00; - if (te_cfg->frame == WANOPT_FR_ESF) { + if (te_cfg->frame == WAN_FR_ESF) { value = BIT_T1_ALMI_CFG_ESF; } WRITE_REG(REG_T1_ALMI_CFG, value); @@ -2184,7 +2184,7 @@ sdla_te_config(void* card_id) WRITE_REG(REG_SIGX_CFG, 0x00); } else { value = READ_REG(REG_SIGX_CFG); - if (te_cfg->frame == WANOPT_FR_ESF) { + if (te_cfg->frame == WAN_FR_ESF) { value |= BIT_SIGX_ESF; } WRITE_REG(REG_SIGX_CFG, value); @@ -2194,9 +2194,9 @@ sdla_te_config(void* card_id) if (IS_E1(&card->fe_te.te_cfg)) { value |= BIT_BTIF_RATE0; } - if (te_cfg->lcode == WANOPT_LC_AMI) { + if (te_cfg->lcode == WAN_LC_AMI) { value |= BIT_BTIF_NXDS0_0; - } else if (te_cfg->frame != WANOPT_FR_UNFRAMED) { + } else if (te_cfg->frame != WAN_FR_UNFRAMED) { value |= BIT_BTIF_NXDS0_1; } @@ -2217,9 +2217,9 @@ sdla_te_config(void* card_id) if (IS_E1(&card->fe_te.te_cfg)) { value |= BIT_BRIF_RATE0; } - if (te_cfg->lcode == WANOPT_LC_AMI) { + if (te_cfg->lcode == WAN_LC_AMI) { value |= BIT_BRIF_NXDS0_0; - } else if (te_cfg->frame != WANOPT_FR_UNFRAMED) { + } else if (te_cfg->frame != WAN_FR_UNFRAMED) { value |= BIT_BRIF_NXDS0_1; } if (adapter_type & A101_ADPTR_T1E1_MASK) { @@ -2237,7 +2237,7 @@ sdla_te_config(void* card_id) WRITE_REG(REG_BRIF_DATA_CFG, BIT_BRIF_DATA_TRI_0); /* Set TJAT FIFO output clock signal (Reg 0x06) */ - if (te_cfg->te_clock == WANOPT_NORMAL_CLK) { + if (te_cfg->te_clock == WAN_NORMAL_CLK) { WRITE_REG(REG_TX_TIMING_OPT, BIT_TX_PLLREF1 | BIT_TX_TXELSTBYP); } else { WRITE_REG(REG_TX_TIMING_OPT, @@ -2289,7 +2289,7 @@ sdla_te_config(void* card_id) /* Configure the RJAT FIFO (Reg 0x17) */ WRITE_REG(REG_RJAT_CFG, BIT_RJAT_CENT); /* Program Receive Options (Reg 0x02) */ - if (te_cfg->frame == WANOPT_FR_UNFRAMED) { + if (te_cfg->frame == WAN_FR_UNFRAMED) { WRITE_REG(REG_RECEIVE_OPT, BIT_RECEIVE_OPT_UNF); } else { WRITE_REG(REG_RECEIVE_OPT, 0x00); @@ -3744,9 +3744,9 @@ sdla_te_udp(void *card_id, void *cmd, unsigned char *data) switch (udp_cmd->wan_cmd_command) { case WAN_GET_MEDIA_TYPE: data[0] = - IS_T1(&card->fe_te.te_cfg) ? WANOPT_MEDIA_T1 : - IS_E1(&card->fe_te.te_cfg) ? WANOPT_MEDIA_E1 : - WANOPT_MEDIA_NONE; + IS_T1(&card->fe_te.te_cfg) ? WAN_MEDIA_T1 : + IS_E1(&card->fe_te.te_cfg) ? WAN_MEDIA_E1 : + WAN_MEDIA_NONE; udp_cmd->wan_cmd_return_code = WAN_CMD_OK; udp_cmd->wan_cmd_data_len = sizeof(unsigned char); break; diff --git a/sys/dev/pci/if_san_te1.h b/sys/dev/pci/if_san_te1.h index 985c155130c..457f5b62d63 100644 --- a/sys/dev/pci/if_san_te1.h +++ b/sys/dev/pci/if_san_te1.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_san_te1.h,v 1.3 2004/06/27 01:54:21 mcbride Exp $ */ +/* $OpenBSD: if_san_te1.h,v 1.4 2004/12/07 06:10:24 mcbride Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -660,37 +660,37 @@ /*The line code */ -#define WANOPT_LC_AMI 0x01 -#define WANOPT_LC_B8ZS 0x02 -#define WANOPT_LC_HDB3 0x03 +#define WAN_LC_AMI 0x01 +#define WAN_LC_B8ZS 0x02 +#define WAN_LC_HDB3 0x03 /* Framing mode (T1/E1)/Unframed */ -#define WANOPT_FR_ESF 0x01 -#define WANOPT_FR_D4 0x02 -#define WANOPT_FR_ESF_JAPAN 0x03 -#define WANOPT_FR_CRC4 0x04 -#define WANOPT_FR_NCRC4 0x05 -#define WANOPT_FR_UNFRAMED 0x06 +#define WAN_FR_ESF 0x01 +#define WAN_FR_D4 0x02 +#define WAN_FR_ESF_JAPAN 0x03 +#define WAN_FR_CRC4 0x04 +#define WAN_FR_NCRC4 0x05 +#define WAN_FR_UNFRAMED 0x06 /* For T1 only */ -#define WANOPT_T1_LBO_0_DB 0x01 -#define WANOPT_T1_LBO_75_DB 0x02 -#define WANOPT_T1_LBO_15_DB 0x03 -#define WANOPT_T1_LBO_225_DB 0x04 -#define WANOPT_T1_0_110 0x05 -#define WANOPT_T1_110_220 0x06 -#define WANOPT_T1_220_330 0x07 -#define WANOPT_T1_330_440 0x08 -#define WANOPT_T1_440_550 0x09 -#define WANOPT_T1_550_660 0x0A +#define WAN_T1_LBO_0_DB 0x01 +#define WAN_T1_LBO_75_DB 0x02 +#define WAN_T1_LBO_15_DB 0x03 +#define WAN_T1_LBO_225_DB 0x04 +#define WAN_T1_0_110 0x05 +#define WAN_T1_110_220 0x06 +#define WAN_T1_220_330 0x07 +#define WAN_T1_330_440 0x08 +#define WAN_T1_440_550 0x09 +#define WAN_T1_550_660 0x0A /* For E1 only */ -#define WANOPT_E1_120 0x0B -#define WANOPT_E1_75 0x0C +#define WAN_E1_120 0x0B +#define WAN_E1_75 0x0C /* Clocking Master/Normal */ -#define WANOPT_NORMAL_CLK 0x01 -#define WANOPT_MASTER_CLK 0x02 +#define WAN_NORMAL_CLK 0x01 +#define WAN_MASTER_CLK 0x02 #define NUM_OF_T1_CHANNELS 24 #define NUM_OF_E1_TIMESLOTS 31 @@ -801,12 +801,12 @@ /* TE1 T1/E1 interrupt setting delay */ #define INTR_TE1_TIMER 150 /* 50 ms */ -#define IS_T1(te_cfg) ((te_cfg)->media == WANOPT_MEDIA_T1) -#define IS_E1(te_cfg) ((te_cfg)->media == WANOPT_MEDIA_E1) +#define IS_T1(te_cfg) ((te_cfg)->media == WAN_MEDIA_T1) +#define IS_E1(te_cfg) ((te_cfg)->media == WAN_MEDIA_E1) #define IS_TE1(te_cfg) (IS_T1(te_cfg) || IS_E1(te_cfg)) -#define IS_TE1_UNFRAMED(card) ((card)->te_cfg.frame == WANOPT_FR_UNFRAMED) +#define IS_TE1_UNFRAMED(card) ((card)->te_cfg.frame == WAN_FR_UNFRAMED) #define GET_TE_CHANNEL_RANGE(card) \ (IS_T1(&card->te_cfg) ? NUM_OF_T1_CHANNELS : \ @@ -824,35 +824,35 @@ #define RAI_ALARM(val) (val & BIT_RAI_ALARM) ? "ON" : "OFF" #define YEL_ALARM(val) (val & BIT_YEL_ALARM) ? "ON" : "OFF" -#define MEDIA_DECODE(val) (val == WANOPT_MEDIA_T1) ? "T1" : \ - (val == WANOPT_MEDIA_E1) ? "E1" : "Unknown" +#define MEDIA_DECODE(val) (val == WAN_MEDIA_T1) ? "T1" : \ + (val == WAN_MEDIA_E1) ? "E1" : "Unknown" -#define LCODE_DECODE(val) (val == WANOPT_LC_AMI) ? "AMI" : \ - (val == WANOPT_LC_B8ZS) ? "B8ZS" : \ - (val == WANOPT_LC_HDB3) ? "HDB3" : "Unknown" +#define LCODE_DECODE(val) (val == WAN_LC_AMI) ? "AMI" : \ + (val == WAN_LC_B8ZS) ? "B8ZS" : \ + (val == WAN_LC_HDB3) ? "HDB3" : "Unknown" -#define FRAME_DECODE(val) (val == WANOPT_FR_ESF) ? "ESF" : \ - (val == WANOPT_FR_D4) ? "D4" : \ - (val == WANOPT_FR_CRC4) ? "CRC4" : \ - (val == WANOPT_FR_NCRC4) ? "non-CRC4" : \ - (val == WANOPT_FR_UNFRAMED) ? \ +#define FRAME_DECODE(val) (val == WAN_FR_ESF) ? "ESF" : \ + (val == WAN_FR_D4) ? "D4" : \ + (val == WAN_FR_CRC4) ? "CRC4" : \ + (val == WAN_FR_NCRC4) ? "non-CRC4" : \ + (val == WAN_FR_UNFRAMED) ? \ "Unframed" : "Unknown" -#define TECLK_DECODE(val) (val == WANOPT_NORMAL_CLK) ? "Normal" : \ - (val == WANOPT_MASTER_CLK) ? "Master" : \ +#define TECLK_DECODE(val) (val == WAN_NORMAL_CLK) ? "Normal" : \ + (val == WAN_MASTER_CLK) ? "Master" : \ "Unknown" #define LBO_DECODE(val) \ - (val == WANOPT_T1_LBO_0_DB) ? "0db" : \ - (val == WANOPT_T1_LBO_75_DB) ? "7.5db" : \ - (val == WANOPT_T1_LBO_15_DB) ? "15dB" : \ - (val == WANOPT_T1_LBO_225_DB) ? "22.5dB" : \ - (val == WANOPT_T1_0_110) ? "0-110ft" : \ - (val == WANOPT_T1_110_220) ? "110-220ft" : \ - (val == WANOPT_T1_220_330) ? "220-330ft" : \ - (val == WANOPT_T1_330_440) ? "330-440ft" : \ - (val == WANOPT_T1_440_550) ? "440-550ft" : \ - (val == WANOPT_T1_550_660) ? "550-660ft" : "Unknown" + (val == WAN_T1_LBO_0_DB) ? "0db" : \ + (val == WAN_T1_LBO_75_DB) ? "7.5db" : \ + (val == WAN_T1_LBO_15_DB) ? "15dB" : \ + (val == WAN_T1_LBO_225_DB) ? "22.5dB" : \ + (val == WAN_T1_0_110) ? "0-110ft" : \ + (val == WAN_T1_110_220) ? "110-220ft" : \ + (val == WAN_T1_220_330) ? "220-330ft" : \ + (val == WAN_T1_330_440) ? "330-440ft" : \ + (val == WAN_T1_440_550) ? "440-550ft" : \ + (val == WAN_T1_550_660) ? "550-660ft" : "Unknown" /* diff --git a/sys/dev/pci/if_san_xilinx.c b/sys/dev/pci/if_san_xilinx.c index 2153c5f8d97..b85b6326850 100644 --- a/sys/dev/pci/if_san_xilinx.c +++ b/sys/dev/pci/if_san_xilinx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_san_xilinx.c,v 1.5 2004/11/10 10:14:47 grange Exp $ */ +/* $OpenBSD: if_san_xilinx.c,v 1.6 2004/12/07 06:10:24 mcbride Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -339,6 +339,8 @@ wan_xilinx_init(sdla_t *card) } memset(sc, 0, sizeof(xilinx_softc_t)); ifp = (struct ifnet *)&sc->common.ifp; + ifp->if_softc = sc; + sc->common.card = card; if (wanpipe_generic_register(card, ifp, card->devname)) { free(sc, M_DEVBUF); return (NULL); @@ -346,8 +348,6 @@ wan_xilinx_init(sdla_t *card) strlcpy(sc->if_name, ifp->if_xname, IFNAMSIZ); - ifp->if_softc = sc; - sc->common.card = card; sc->first_time_slot=-1; sc->time_slot_map = 0; diff --git a/sys/dev/pci/if_sandrv.c b/sys/dev/pci/if_sandrv.c index 71aaa100cb8..9d4b6f67cbe 100644 --- a/sys/dev/pci/if_sandrv.c +++ b/sys/dev/pci/if_sandrv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sandrv.c,v 1.5 2004/08/25 13:09:11 markus Exp $ */ +/* $OpenBSD: if_sandrv.c,v 1.6 2004/12/07 06:10:24 mcbride Exp $ */ /*- * Copyright (c) 2001-2004 Sangoma Technologies (SAN) @@ -1225,8 +1225,8 @@ sdla_check_mismatch(void *phw, unsigned char media) SDLA_MAGIC(hw); WAN_ASSERT(hw->hwcard == NULL); hwcard = hw->hwcard; - if (media == WANOPT_MEDIA_T1 || - media == WANOPT_MEDIA_E1) { + if (media == WAN_MEDIA_T1 || + media == WAN_MEDIA_E1) { if (hwcard->atype != S5144_ADPTR_1_CPU_T1E1 && hwcard->atype != S5147_ADPTR_2_CPU_T1E1 && hwcard->atype != S5148_ADPTR_1_CPU_T1E1) { @@ -1237,7 +1237,7 @@ sdla_check_mismatch(void *phw, unsigned char media) } hwcard->atype = S5144_ADPTR_1_CPU_T1E1; - }else if (media == WANOPT_MEDIA_56K) { + }else if (media == WAN_MEDIA_56K) { if (hwcard->atype != S5145_ADPTR_1_CPU_56K) { log(LOG_INFO, "%s: Error: Card type mismatch: " "User=56K Actual=%s\n", hw->devname, |