support T1 card (LMC1200) properly. PR 12331 (patch from openbsd).
change DLT type to cisco HDLC, as lmc driver is hardwired to cisco HDLC on driver attach. XXX we may need to revisit this, as if_spppsubr may want to alter this later.
This commit is contained in:
parent
35a07da1df
commit
477b193d09
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_lmc.c,v 1.7 2001/04/09 19:34:40 martin Exp $ */
|
||||
/* $NetBSD: if_lmc.c,v 1.8 2001/04/12 07:50:54 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-1999 LAN Media Corporation (LMC)
|
||||
@ -405,6 +405,36 @@ lmc_watchdog(int unit)
|
||||
|
||||
state = 0;
|
||||
|
||||
/*
|
||||
* Make sure the tx jabber and rx watchdog are off,
|
||||
* and the transmit and recieve processes are running.
|
||||
*/
|
||||
LMC_CSR_WRITE (sc, csr_15, 0x00000011);
|
||||
sc->lmc_cmdmode |= TULIP_CMD_TXRUN | TULIP_CMD_RXRUN;
|
||||
LMC_CSR_WRITE (sc, csr_command, sc->lmc_cmdmode);
|
||||
|
||||
/* Is the transmit clock still available? */
|
||||
ticks = LMC_CSR_READ (sc, csr_gp_timer);
|
||||
ticks = 0x0000ffff - (ticks & 0x0000ffff);
|
||||
|
||||
if (ticks == 0)
|
||||
{
|
||||
/* no clock found ? */
|
||||
if (sc->tx_clockState != 0)
|
||||
{
|
||||
sc->tx_clockState = 0;
|
||||
if (sc->lmc_cardtype == LMC_CARDTYPE_SSI)
|
||||
lmc_led_on (sc, LMC_MII16_LED3); /* ON red */
|
||||
}
|
||||
else
|
||||
if (sc->tx_clockState == 0)
|
||||
{
|
||||
sc->tx_clockState = 1;
|
||||
if (sc->lmc_cardtype == LMC_CARDTYPE_SSI)
|
||||
lmc_led_off (sc, LMC_MII16_LED3); /* OFF red */
|
||||
}
|
||||
}
|
||||
|
||||
link_status = sc->lmc_media->get_link_status(sc);
|
||||
ostatus = ((sc->lmc_flags & LMC_MODEMOK) == LMC_MODEMOK);
|
||||
|
||||
@ -412,27 +442,53 @@ lmc_watchdog(int unit)
|
||||
* hardware level link lost, but the interface is marked as up.
|
||||
* Mark it as down.
|
||||
*/
|
||||
if (link_status == 0 && ostatus) {
|
||||
if (link_status == LMC_LINK_DOWN && ostatus) {
|
||||
printf(LMC_PRINTF_FMT ": physical link down\n",
|
||||
LMC_PRINTF_ARGS);
|
||||
sc->lmc_flags &= ~LMC_MODEMOK;
|
||||
lmc_led_off(sc, LMC_MII16_LED1);
|
||||
if (sc->lmc_cardtype == LMC_CARDTYPE_DS3 ||
|
||||
sc->lmc_cardtype == LMC_CARDTYPE_T1)
|
||||
lmc_led_on (sc, LMC_DS3_LED3 | LMC_DS3_LED2);
|
||||
/* turn on red LED */
|
||||
else {
|
||||
lmc_led_off (sc, LMC_MII16_LED1);
|
||||
lmc_led_on (sc, LMC_MII16_LED0);
|
||||
if (sc->lmc_timing == LMC_CTL_CLOCK_SOURCE_EXT)
|
||||
lmc_led_on (sc, LMC_MII16_LED3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* hardware link is up, but the interface is marked as down.
|
||||
* Bring it back up again.
|
||||
*/
|
||||
if (link_status != 0 && !ostatus) {
|
||||
if (link_status != LMC_LINK_DOWN && !ostatus) {
|
||||
printf(LMC_PRINTF_FMT ": physical link up\n",
|
||||
LMC_PRINTF_ARGS);
|
||||
if (sc->lmc_flags & LMC_IFUP)
|
||||
lmc_ifup(sc);
|
||||
sc->lmc_flags |= LMC_MODEMOK;
|
||||
lmc_led_on(sc, LMC_MII16_LED1);
|
||||
if (sc->lmc_cardtype == LMC_CARDTYPE_DS3 ||
|
||||
sc->lmc_cardtype == LMC_CARDTYPE_T1)
|
||||
{
|
||||
sc->lmc_miireg16 |= LMC_DS3_LED3;
|
||||
lmc_led_off (sc, LMC_DS3_LED3);
|
||||
/* turn off red LED */
|
||||
lmc_led_on (sc, LMC_DS3_LED2);
|
||||
} else {
|
||||
lmc_led_on (sc, LMC_MII16_LED0 | LMC_MII16_LED1
|
||||
| LMC_MII16_LED2);
|
||||
if (sc->lmc_timing != LMC_CTL_CLOCK_SOURCE_EXT)
|
||||
lmc_led_off (sc, LMC_MII16_LED3);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Call media specific watchdog functions */
|
||||
sc->lmc_media->watchdog(sc);
|
||||
|
||||
/*
|
||||
* remember the timer value
|
||||
*/
|
||||
@ -455,12 +511,19 @@ lmc_ifup(lmc_softc_t * const sc)
|
||||
lmc_dec_reset(sc);
|
||||
lmc_reset(sc);
|
||||
|
||||
sc->lmc_media->set_link_status(sc, 1);
|
||||
sc->lmc_media->set_link_status(sc, LMC_LINK_UP);
|
||||
sc->lmc_media->set_status(sc, NULL);
|
||||
|
||||
sc->lmc_flags |= LMC_IFUP;
|
||||
|
||||
lmc_led_on(sc, LMC_MII16_LED1);
|
||||
/*
|
||||
* for DS3 & DS1 adapters light the green light, led2
|
||||
*/
|
||||
if (sc->lmc_cardtype == LMC_CARDTYPE_DS3 ||
|
||||
sc->lmc_cardtype == LMC_CARDTYPE_T1)
|
||||
lmc_led_on (sc, LMC_MII16_LED2);
|
||||
else
|
||||
lmc_led_on (sc, LMC_MII16_LED0 | LMC_MII16_LED2);
|
||||
|
||||
/*
|
||||
* select what interrupts we want to get
|
||||
@ -493,8 +556,8 @@ lmc_ifdown(lmc_softc_t * const sc)
|
||||
sc->lmc_if.if_timer = 0;
|
||||
sc->lmc_flags &= ~LMC_IFUP;
|
||||
|
||||
sc->lmc_media->set_link_status(sc, 0);
|
||||
lmc_led_off(sc, LMC_MII16_LED1);
|
||||
sc->lmc_media->set_link_status(sc, LMC_LINK_DOWN);
|
||||
lmc_led_off(sc, LMC_MII16_LED_ALL);
|
||||
|
||||
lmc_dec_reset(sc);
|
||||
lmc_reset(sc);
|
||||
@ -1139,7 +1202,10 @@ lmc_ifioctl(struct ifnet * ifp, ioctl_cmd_t cmd, caddr_t data)
|
||||
if (ifr->ifr_mtu > LMC_MTU) {
|
||||
error = EINVAL;
|
||||
goto out;
|
||||
} else {
|
||||
ifp->if_mtu = ifr->ifr_mtu;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_lmc_common.c,v 1.4 2000/06/28 16:08:44 mrg Exp $ */
|
||||
/* $NetBSD: if_lmc_common.c,v 1.5 2001/04/12 07:50:54 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-1999 LAN Media Corporation (LMC)
|
||||
@ -230,8 +230,7 @@ lmc_reset(lmc_softc_t * const sc)
|
||||
/*
|
||||
* busy wait for the chip to reset
|
||||
*/
|
||||
while ((LMC_CSR_READ(sc, csr_gp) & LMC_GEP_DP) == 0)
|
||||
;
|
||||
while ((LMC_CSR_READ(sc, csr_gp) & LMC_GEP_DP) == 0);
|
||||
|
||||
/*
|
||||
* Call media specific init routine
|
||||
|
@ -1,10 +1,12 @@
|
||||
/* $NetBSD: if_lmc_media.c,v 1.4 2000/06/28 16:08:45 mrg Exp $ */
|
||||
/* $NetBSD: if_lmc_media.c,v 1.5 2001/04/12 07:50:54 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-1999 LAN Media Corporation (LMC)
|
||||
* All rights reserved. www.lanmedia.com
|
||||
*
|
||||
* This code is written by Michael Graff <graff@vix.com> for LMC.
|
||||
* The code is derived from permitted modifications to software created
|
||||
* by Matt Thomas (matt@3am-software.com).
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -161,6 +163,7 @@ static void lmc_ds3_set_100ft(lmc_softc_t * const, int);
|
||||
static int lmc_ds3_get_link_status(lmc_softc_t * const);
|
||||
static void lmc_ds3_set_crc_length(lmc_softc_t * const, int);
|
||||
static void lmc_ds3_set_scram(lmc_softc_t * const, int);
|
||||
static void lmc_ds3_watchdog(lmc_softc_t * const);
|
||||
|
||||
static void lmc_hssi_init(lmc_softc_t * const);
|
||||
static void lmc_hssi_default(lmc_softc_t * const);
|
||||
@ -169,15 +172,26 @@ static void lmc_hssi_set_clock(lmc_softc_t * const, int);
|
||||
static int lmc_hssi_get_link_status(lmc_softc_t * const);
|
||||
static void lmc_hssi_set_link_status(lmc_softc_t * const, int);
|
||||
static void lmc_hssi_set_crc_length(lmc_softc_t * const, int);
|
||||
static void lmc_hssi_watchdog(lmc_softc_t * const);
|
||||
|
||||
static void lmc_ssi_init(lmc_softc_t * const);
|
||||
static void lmc_ssi_default(lmc_softc_t * const);
|
||||
static void lmc_ssi_set_status(lmc_softc_t * const, lmc_ctl_t *);
|
||||
static void lmc_ssi_set_clock(lmc_softc_t * const, int);
|
||||
static void lmc_ssi_set_speed(lmc_softc_t * const, lmc_ctl_t *);
|
||||
static int lmc_ssi_get_link_status(lmc_softc_t * const);
|
||||
static void lmc_ssi_set_link_status(lmc_softc_t * const, int);
|
||||
static void lmc_ssi_set_crc_length(lmc_softc_t * const, int);
|
||||
static void lmc_ssi_watchdog(lmc_softc_t * const);
|
||||
|
||||
static void lmc_t1_init(lmc_softc_t * const);
|
||||
static void lmc_t1_default(lmc_softc_t * const);
|
||||
static void lmc_t1_set_status(lmc_softc_t * const, lmc_ctl_t *);
|
||||
static void lmc_t1_set_clock(lmc_softc_t * const, int);
|
||||
static void lmc_t1_set_speed(lmc_softc_t * const, lmc_ctl_t *);
|
||||
static int lmc_t1_get_link_status(lmc_softc_t * const);
|
||||
static void lmc_t1_set_link_status(lmc_softc_t * const, int);
|
||||
static void lmc_t1_set_circuit_type(lmc_softc_t * const, int);
|
||||
static void lmc_t1_set_crc_length(lmc_softc_t * const, int);
|
||||
static void lmc_t1_set_clock(lmc_softc_t * const, int);
|
||||
static void lmc_t1_watchdog(lmc_softc_t * const);
|
||||
|
||||
static void lmc_dummy_set_1(lmc_softc_t * const, int);
|
||||
static void lmc_dummy_set2_1(lmc_softc_t * const, lmc_ctl_t *);
|
||||
@ -197,6 +211,8 @@ lmc_media_t lmc_ds3_media = {
|
||||
lmc_ds3_get_link_status, /* get link status */
|
||||
lmc_dummy_set_1, /* set link status */
|
||||
lmc_ds3_set_crc_length, /* set CRC length */
|
||||
lmc_dummy_set_1, /* set T1 or E1 circuit type */
|
||||
lmc_ds3_watchdog
|
||||
};
|
||||
|
||||
lmc_media_t lmc_hssi_media = {
|
||||
@ -210,6 +226,23 @@ lmc_media_t lmc_hssi_media = {
|
||||
lmc_hssi_get_link_status, /* get link status */
|
||||
lmc_hssi_set_link_status, /* set link status */
|
||||
lmc_hssi_set_crc_length, /* set CRC length */
|
||||
lmc_dummy_set_1, /* set T1 or E1 circuit type */
|
||||
lmc_hssi_watchdog
|
||||
};
|
||||
|
||||
lmc_media_t lmc_ssi_media = {
|
||||
lmc_ssi_init, /* special media init stuff */
|
||||
lmc_ssi_default, /* reset to default state */
|
||||
lmc_ssi_set_status, /* reset status to state provided */
|
||||
lmc_ssi_set_clock, /* set clock source */
|
||||
lmc_ssi_set_speed, /* set line speed */
|
||||
lmc_dummy_set_1, /* set cable length */
|
||||
lmc_dummy_set_1, /* set scrambler */
|
||||
lmc_ssi_get_link_status, /* get link status */
|
||||
lmc_ssi_set_link_status, /* set link status */
|
||||
lmc_ssi_set_crc_length, /* set CRC length */
|
||||
lmc_dummy_set_1, /* set T1 or E1 circuit type */
|
||||
lmc_ssi_watchdog
|
||||
};
|
||||
|
||||
lmc_media_t lmc_t1_media = {
|
||||
@ -217,12 +250,14 @@ lmc_media_t lmc_t1_media = {
|
||||
lmc_t1_default, /* reset to default state */
|
||||
lmc_t1_set_status, /* reset status to state provided */
|
||||
lmc_t1_set_clock, /* set clock source */
|
||||
lmc_t1_set_speed, /* set line speed */
|
||||
lmc_dummy_set2_1, /* set line speed */
|
||||
lmc_dummy_set_1, /* set cable length */
|
||||
lmc_dummy_set_1, /* set scrambler */
|
||||
lmc_t1_get_link_status, /* get link status */
|
||||
lmc_t1_set_link_status, /* set link status */
|
||||
lmc_dummy_set_1, /* set link status */
|
||||
lmc_t1_set_crc_length, /* set CRC length */
|
||||
lmc_t1_set_circuit_type, /* set T1 or E1 circuit type */
|
||||
lmc_t1_watchdog
|
||||
};
|
||||
|
||||
static void
|
||||
@ -274,10 +309,13 @@ lmc_hssi_set_status(lmc_softc_t * const sc, lmc_ctl_t *ctl)
|
||||
/*
|
||||
* check for change in clock source
|
||||
*/
|
||||
if (ctl->clock_source && !sc->ictl.clock_source)
|
||||
if (ctl->clock_source && !sc->ictl.clock_source) {
|
||||
sc->lmc_media->set_clock_source(sc, LMC_CTL_CLOCK_SOURCE_INT);
|
||||
else if (!ctl->clock_source && sc->ictl.clock_source)
|
||||
sc->lmc_timing = LMC_CTL_CLOCK_SOURCE_INT;
|
||||
} else if (!ctl->clock_source && sc->ictl.clock_source) {
|
||||
sc->lmc_timing = LMC_CTL_CLOCK_SOURCE_EXT;
|
||||
sc->lmc_media->set_clock_source(sc, LMC_CTL_CLOCK_SOURCE_EXT);
|
||||
}
|
||||
|
||||
lmc_set_protocol(sc, ctl);
|
||||
}
|
||||
@ -350,6 +388,23 @@ lmc_hssi_set_crc_length(lmc_softc_t * const sc, int state)
|
||||
lmc_mii_writereg(sc, 0, 16, sc->lmc_miireg16);
|
||||
}
|
||||
|
||||
static void
|
||||
lmc_hssi_watchdog (lmc_softc_t * const sc)
|
||||
{
|
||||
/* HSSI is blank */
|
||||
}
|
||||
|
||||
static void
|
||||
lmc_ds3_watchdog (lmc_softc_t * const sc)
|
||||
{
|
||||
sc->lmc_miireg16 = lmc_mii_readreg (sc, 0, 16);
|
||||
if (sc->lmc_miireg16 & 0x0018)
|
||||
{
|
||||
printf("%s: AIS Recieved\n", sc->lmc_xname);
|
||||
lmc_led_on (sc, LMC_DS3_LED1 | LMC_DS3_LED2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* DS3 methods
|
||||
@ -501,11 +556,11 @@ lmc_ds3_set_crc_length(lmc_softc_t * const sc, int state)
|
||||
|
||||
|
||||
/*
|
||||
* T1 methods
|
||||
* SSI methods
|
||||
*/
|
||||
|
||||
static void
|
||||
lmc_t1_init(lmc_softc_t * const sc)
|
||||
lmc_ssi_init(lmc_softc_t * const sc)
|
||||
{
|
||||
u_int16_t mii17;
|
||||
int cable;
|
||||
@ -514,21 +569,21 @@ lmc_t1_init(lmc_softc_t * const sc)
|
||||
|
||||
mii17 = lmc_mii_readreg(sc, 0, 17);
|
||||
|
||||
cable = (mii17 & LMC_MII17_T1_CABLE_MASK) >> LMC_MII17_T1_CABLE_SHIFT;
|
||||
cable = (mii17 & LMC_MII17_SSI_CABLE_MASK) >> LMC_MII17_SSI_CABLE_SHIFT;
|
||||
sc->ictl.cable_type = cable;
|
||||
|
||||
lmc_gpio_mkoutput(sc, LMC_GEP_T1_TXCLOCK);
|
||||
lmc_gpio_mkoutput(sc, LMC_GEP_SSI_TXCLOCK);
|
||||
}
|
||||
|
||||
static void
|
||||
lmc_t1_default(lmc_softc_t * const sc)
|
||||
lmc_ssi_default(lmc_softc_t * const sc)
|
||||
{
|
||||
sc->lmc_miireg16 = LMC_MII16_LED_ALL;
|
||||
|
||||
/*
|
||||
* make TXCLOCK always be an output
|
||||
*/
|
||||
lmc_gpio_mkoutput(sc, LMC_GEP_T1_TXCLOCK);
|
||||
lmc_gpio_mkoutput(sc, LMC_GEP_SSI_TXCLOCK);
|
||||
|
||||
sc->lmc_media->set_link_status(sc, 0);
|
||||
sc->lmc_media->set_clock_source(sc, LMC_CTL_CLOCK_SOURCE_EXT);
|
||||
@ -541,7 +596,7 @@ lmc_t1_default(lmc_softc_t * const sc)
|
||||
* always reset the card if needed.
|
||||
*/
|
||||
static void
|
||||
lmc_t1_set_status(lmc_softc_t * const sc, lmc_ctl_t *ctl)
|
||||
lmc_ssi_set_status(lmc_softc_t * const sc, lmc_ctl_t *ctl)
|
||||
{
|
||||
if (ctl == NULL) {
|
||||
sc->lmc_media->set_clock_source(sc, sc->ictl.clock_source);
|
||||
@ -554,12 +609,15 @@ lmc_t1_set_status(lmc_softc_t * const sc, lmc_ctl_t *ctl)
|
||||
/*
|
||||
* check for change in clock source
|
||||
*/
|
||||
if (ctl->clock_source == LMC_CTL_CLOCK_SOURCE_INT
|
||||
&& sc->ictl.clock_source == LMC_CTL_CLOCK_SOURCE_EXT)
|
||||
if (ctl->clock_source == LMC_CTL_CLOCK_SOURCE_INT &&
|
||||
sc->ictl.clock_source == LMC_CTL_CLOCK_SOURCE_EXT) {
|
||||
sc->lmc_media->set_clock_source(sc, LMC_CTL_CLOCK_SOURCE_INT);
|
||||
else if (ctl->clock_source == LMC_CTL_CLOCK_SOURCE_EXT
|
||||
&& sc->ictl.clock_source == LMC_CTL_CLOCK_SOURCE_INT)
|
||||
sc->lmc_timing = LMC_CTL_CLOCK_SOURCE_INT;
|
||||
} else if (ctl->clock_source == LMC_CTL_CLOCK_SOURCE_EXT &&
|
||||
sc->ictl.clock_source == LMC_CTL_CLOCK_SOURCE_INT) {
|
||||
sc->lmc_media->set_clock_source(sc, LMC_CTL_CLOCK_SOURCE_EXT);
|
||||
sc->lmc_timing = LMC_CTL_CLOCK_SOURCE_EXT;
|
||||
}
|
||||
|
||||
if (ctl->clock_rate != sc->ictl.clock_rate)
|
||||
sc->lmc_media->set_speed(sc, ctl);
|
||||
@ -571,16 +629,16 @@ lmc_t1_set_status(lmc_softc_t * const sc, lmc_ctl_t *ctl)
|
||||
* 1 == internal, 0 == external
|
||||
*/
|
||||
static void
|
||||
lmc_t1_set_clock(lmc_softc_t * const sc, int ie)
|
||||
lmc_ssi_set_clock(lmc_softc_t * const sc, int ie)
|
||||
{
|
||||
if (ie == LMC_CTL_CLOCK_SOURCE_EXT) {
|
||||
sc->lmc_gpio &= ~(LMC_GEP_T1_TXCLOCK);
|
||||
sc->lmc_gpio &= ~(LMC_GEP_SSI_TXCLOCK);
|
||||
LMC_CSR_WRITE(sc, csr_gp, sc->lmc_gpio);
|
||||
sc->ictl.clock_source = LMC_CTL_CLOCK_SOURCE_EXT;
|
||||
printf(LMC_PRINTF_FMT ": clock external\n",
|
||||
LMC_PRINTF_ARGS);
|
||||
} else {
|
||||
sc->lmc_gpio |= LMC_GEP_T1_TXCLOCK;
|
||||
sc->lmc_gpio |= LMC_GEP_SSI_TXCLOCK;
|
||||
LMC_CSR_WRITE(sc, csr_gp, sc->lmc_gpio);
|
||||
sc->ictl.clock_source = LMC_CTL_CLOCK_SOURCE_INT;
|
||||
printf(LMC_PRINTF_FMT ": clock internal\n",
|
||||
@ -589,32 +647,39 @@ lmc_t1_set_clock(lmc_softc_t * const sc, int ie)
|
||||
}
|
||||
|
||||
static void
|
||||
lmc_t1_set_speed(lmc_softc_t * const sc, lmc_ctl_t *ctl)
|
||||
lmc_ssi_set_speed(lmc_softc_t * const sc, lmc_ctl_t *ctl)
|
||||
{
|
||||
lmc_ctl_t *ictl = &sc->ictl;
|
||||
lmc_av9110_t *av;
|
||||
|
||||
/*
|
||||
* original settings for clock rate of:
|
||||
* 100 Khz (8,25,0,0,2) were incorrect
|
||||
* they should have been 80,125,1,3,3
|
||||
* There are 17 param combinations to produce this freq.
|
||||
* For 1.5 Mhz use 120,100,1,1,2 (226 param. combinations)
|
||||
*/
|
||||
if (ctl == NULL) {
|
||||
av = &ictl->cardspec.t1;
|
||||
ictl->clock_rate = 100000;
|
||||
av = &ictl->cardspec.ssi;
|
||||
ictl->clock_rate = 1500000;
|
||||
av->f = ictl->clock_rate;
|
||||
av->n = 8;
|
||||
av->m = 25;
|
||||
av->v = 0;
|
||||
av->x = 0;
|
||||
av->n = 120;
|
||||
av->m = 100;
|
||||
av->v = 1;
|
||||
av->x = 1;
|
||||
av->r = 2;
|
||||
|
||||
write_av9110(sc, av->n, av->m, av->v, av->x, av->r);
|
||||
return;
|
||||
}
|
||||
|
||||
av = &ctl->cardspec.t1;
|
||||
av = &ctl->cardspec.ssi;
|
||||
|
||||
if (av->f == 0)
|
||||
return;
|
||||
|
||||
ictl->clock_rate = av->f; /* really, this is the rate we are */
|
||||
ictl->cardspec.t1 = *av;
|
||||
ictl->cardspec.ssi = *av;
|
||||
|
||||
write_av9110(sc, av->n, av->m, av->v, av->x, av->r);
|
||||
}
|
||||
@ -624,7 +689,7 @@ lmc_t1_set_speed(lmc_softc_t * const sc, lmc_ctl_t *ctl)
|
||||
* 0 == link is down, 1 == link is up.
|
||||
*/
|
||||
static int
|
||||
lmc_t1_get_link_status(lmc_softc_t * const sc)
|
||||
lmc_ssi_get_link_status(lmc_softc_t * const sc)
|
||||
{
|
||||
u_int16_t link_status;
|
||||
|
||||
@ -637,54 +702,66 @@ lmc_t1_get_link_status(lmc_softc_t * const sc)
|
||||
* DSR _must_ be asserted.
|
||||
* One of DCD or CTS must be asserted.
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_LMC_IGNORE_HARDWARE_HANDSHAKE
|
||||
link_status = LMC_CSR_READ(sc, csr_gp_timer);
|
||||
link_status = 0x0000ffff - (link_status & 0x0000ffff);
|
||||
|
||||
return(link_status);
|
||||
#else
|
||||
|
||||
link_status = lmc_mii_readreg(sc, 0, 16);
|
||||
|
||||
if ((link_status & LMC_MII16_T1_DSR) == 0)
|
||||
if ((link_status & LMC_MII16_SSI_DSR) == 0)
|
||||
return (0);
|
||||
|
||||
if ((link_status & (LMC_MII16_T1_CTS | LMC_MII16_T1_DCD)) == 0)
|
||||
if ((link_status & (LMC_MII16_SSI_CTS | LMC_MII16_SSI_DCD)) == 0)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
lmc_t1_set_link_status(lmc_softc_t * const sc, int state)
|
||||
lmc_ssi_set_link_status(lmc_softc_t * const sc, int state)
|
||||
{
|
||||
if (state) {
|
||||
sc->lmc_miireg16 |= (LMC_MII16_T1_DTR | LMC_MII16_T1_RTS);
|
||||
sc->lmc_miireg16 |= (LMC_MII16_SSI_DTR | LMC_MII16_SSI_RTS);
|
||||
printf(LMC_PRINTF_FMT ": asserting DTR and RTS\n",
|
||||
LMC_PRINTF_ARGS);
|
||||
} else {
|
||||
sc->lmc_miireg16 &= ~(LMC_MII16_T1_DTR | LMC_MII16_T1_RTS);
|
||||
sc->lmc_miireg16 &= ~(LMC_MII16_SSI_DTR | LMC_MII16_SSI_RTS);
|
||||
printf(LMC_PRINTF_FMT ": deasserting DTR and RTS\n",
|
||||
LMC_PRINTF_ARGS);
|
||||
}
|
||||
|
||||
lmc_mii_writereg(sc, 0, 16, sc->lmc_miireg16);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 0 == 16bit, 1 == 32bit
|
||||
*/
|
||||
static void
|
||||
lmc_t1_set_crc_length(lmc_softc_t * const sc, int state)
|
||||
lmc_ssi_set_crc_length(lmc_softc_t * const sc, int state)
|
||||
{
|
||||
if (state == LMC_CTL_CRC_LENGTH_32) {
|
||||
/* 32 bit */
|
||||
sc->lmc_miireg16 |= LMC_MII16_T1_CRC;
|
||||
sc->lmc_miireg16 |= LMC_MII16_SSI_CRC;
|
||||
sc->ictl.crc_length = LMC_CTL_CRC_LENGTH_32;
|
||||
sc->lmc_crcSize = LMC_CTL_CRC_BYTESIZE_4;
|
||||
} else {
|
||||
/* 16 bit */
|
||||
sc->lmc_miireg16 &= ~LMC_MII16_T1_CRC;
|
||||
sc->lmc_miireg16 &= ~LMC_MII16_SSI_CRC;
|
||||
sc->ictl.crc_length = LMC_CTL_CRC_LENGTH_16;
|
||||
sc->lmc_crcSize = LMC_CTL_CRC_BYTESIZE_2;
|
||||
}
|
||||
|
||||
lmc_mii_writereg(sc, 0, 16, sc->lmc_miireg16);
|
||||
}
|
||||
|
||||
/*
|
||||
* These are bits to program the T1 frequency generator
|
||||
* These are bits to program the ssi frequency generator
|
||||
*/
|
||||
static inline void
|
||||
write_av9110_bit(lmc_softc_t *sc, int c)
|
||||
@ -724,7 +801,7 @@ write_av9110(lmc_softc_t *sc, u_int32_t n, u_int32_t m, u_int32_t v,
|
||||
n, m, v, x, r);
|
||||
#endif
|
||||
|
||||
sc->lmc_gpio |= LMC_GEP_T1_GENERATOR;
|
||||
sc->lmc_gpio |= LMC_GEP_SSI_GENERATOR;
|
||||
sc->lmc_gpio &= ~(LMC_GEP_SERIAL | LMC_GEP_SERIALCLK);
|
||||
LMC_CSR_WRITE(sc, csr_gp, sc->lmc_gpio);
|
||||
|
||||
@ -733,9 +810,9 @@ write_av9110(lmc_softc_t *sc, u_int32_t n, u_int32_t m, u_int32_t v,
|
||||
* as outputs.
|
||||
*/
|
||||
lmc_gpio_mkoutput(sc, (LMC_GEP_SERIAL | LMC_GEP_SERIALCLK
|
||||
| LMC_GEP_T1_GENERATOR));
|
||||
| LMC_GEP_SSI_GENERATOR));
|
||||
|
||||
sc->lmc_gpio &= ~(LMC_GEP_T1_GENERATOR);
|
||||
sc->lmc_gpio &= ~(LMC_GEP_SSI_GENERATOR);
|
||||
LMC_CSR_WRITE(sc, csr_gp, sc->lmc_gpio);
|
||||
|
||||
/*
|
||||
@ -759,9 +836,345 @@ write_av9110(lmc_softc_t *sc, u_int32_t n, u_int32_t m, u_int32_t v,
|
||||
*/
|
||||
lmc_gpio_mkinput(sc,
|
||||
(LMC_GEP_SERIAL | LMC_GEP_SERIALCLK
|
||||
| LMC_GEP_T1_GENERATOR));
|
||||
| LMC_GEP_SSI_GENERATOR));
|
||||
}
|
||||
|
||||
static void
|
||||
lmc_ssi_watchdog(lmc_softc_t * const sc)
|
||||
{
|
||||
u_int16_t mii17;
|
||||
struct ssicsr2 {
|
||||
unsigned short dtr:1, dsr:1, rts:1, cable:3, crc:1, led0:1,
|
||||
led1:1, led2:1, led3:1, fifo:1, ll:1, rl:1, tm:1, loop:1;
|
||||
};
|
||||
struct ssicsr2 *ssicsr;
|
||||
mii17 = lmc_mii_readreg (sc, 0, 17);
|
||||
ssicsr = (struct ssicsr2 *) &mii17;
|
||||
if (ssicsr->cable == 7) {
|
||||
lmc_led_off (sc, LMC_MII16_LED2);
|
||||
}
|
||||
else {
|
||||
lmc_led_on (sc, LMC_MII16_LED2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* T1 methods
|
||||
*/
|
||||
|
||||
/*
|
||||
* The framer regs are multiplexed through MII regs 17 & 18
|
||||
* write the register address to MII reg 17 and the
|
||||
* data to MII reg 18.
|
||||
*/
|
||||
static void
|
||||
lmc_t1_write(lmc_softc_t * const sc, int a, int d)
|
||||
{
|
||||
lmc_mii_writereg(sc, 0, 17, a);
|
||||
lmc_mii_writereg(sc, 0, 18, d);
|
||||
}
|
||||
|
||||
static int
|
||||
lmc_t1_read(lmc_softc_t * const sc, int a)
|
||||
{
|
||||
lmc_mii_writereg(sc, 0, 17, a);
|
||||
return lmc_mii_readreg(sc, 0, 18);
|
||||
}
|
||||
|
||||
static void
|
||||
lmc_t1_init(lmc_softc_t * const sc)
|
||||
{
|
||||
u_int16_t mii16;
|
||||
int i;
|
||||
|
||||
sc->ictl.cardtype = LMC_CTL_CARDTYPE_LMC1200;
|
||||
mii16 = lmc_mii_readreg(sc, 0, 16);
|
||||
|
||||
mii16 &= ~LMC_MII16_T1_XOE;
|
||||
lmc_mii_writereg (sc, 0, 16, mii16);
|
||||
sc->lmc_miireg16 = mii16;
|
||||
|
||||
/* reset 8370 */
|
||||
mii16 &= ~LMC_MII16_T1_RST;
|
||||
lmc_mii_writereg(sc, 0, 16, mii16 | LMC_MII16_T1_RST);
|
||||
lmc_mii_writereg(sc, 0, 16, mii16);
|
||||
|
||||
/* set T1 or E1 line impedance */
|
||||
/* mii16 &= ~LMC_MII16_T1_Z; */
|
||||
mii16 |= LMC_MII16_T1_Z;
|
||||
lmc_mii_writereg(sc, 0, 16, mii16);
|
||||
|
||||
/* Standard LMC1200 init code */
|
||||
lmc_t1_write(sc, 0x01, 0x1B); /* CR0 - primary control */
|
||||
lmc_t1_write(sc, 0x02, 0x42); /* JAT_CR - jitter atten config */
|
||||
lmc_t1_write(sc, 0x14, 0x00); /* LOOP - loopback config */
|
||||
lmc_t1_write(sc, 0x15, 0x00); /* DL3_TS - xtrnl datalink timeslot */
|
||||
lmc_t1_write(sc, 0x18, 0xFF); /* PIO - programmable I/O */
|
||||
lmc_t1_write(sc, 0x19, 0x30); /* POE - programmable OE */
|
||||
lmc_t1_write(sc, 0x1A, 0x0F); /* CMUX - clock input mux */
|
||||
lmc_t1_write(sc, 0x20, 0x41); /* LIU_CR - RX LIU config */
|
||||
lmc_t1_write(sc, 0x22, 0x76); /* RLIU_CR - RX LIU config */
|
||||
lmc_t1_write(sc, 0x40, 0x03); /* RCR0 - RX config */
|
||||
lmc_t1_write(sc, 0x45, 0x00); /* RALM - RX alarm config */
|
||||
lmc_t1_write(sc, 0x46, 0x05); /* LATCH - RX alarm/err/cntr latch */
|
||||
lmc_t1_write(sc, 0x68, 0x40); /* TLIU_CR - TX LIU config */
|
||||
lmc_t1_write(sc, 0x70, 0x0D); /* TCR0 - TX framer config */
|
||||
lmc_t1_write(sc, 0x71, 0x05); /* TCR1 - TX config */
|
||||
lmc_t1_write(sc, 0x72, 0x0B); /* TFRM - TX frame format */
|
||||
lmc_t1_write(sc, 0x73, 0x00); /* TERROR - TX error insert */
|
||||
lmc_t1_write(sc, 0x74, 0x00); /* TMAN - TX manual Sa/FEBE config */
|
||||
lmc_t1_write(sc, 0x75, 0x00); /* TALM - TX alarm signal config */
|
||||
lmc_t1_write(sc, 0x76, 0x00); /* TPATT - TX test pattern config */
|
||||
lmc_t1_write(sc, 0x77, 0x00); /* TLB - TX inband loopback confg */
|
||||
lmc_t1_write(sc, 0x90, 0x05); /* CLAD_CR - clock rate adapter confg */
|
||||
lmc_t1_write(sc, 0x91, 0x05); /* CSEL - clad freq sel */
|
||||
lmc_t1_write(sc, 0xA6, 0x00); /* DL1_CTL - DL1 control */
|
||||
lmc_t1_write(sc, 0xB1, 0x00); /* DL2_CTL - DL2 control */
|
||||
lmc_t1_write(sc, 0xD0, 0x47); /* SBI_CR - sys bus iface config */
|
||||
lmc_t1_write(sc, 0xD1, 0x70); /* RSB_CR - RX sys bus config */
|
||||
lmc_t1_write(sc, 0xD4, 0x30); /* TSB_CR - TX sys bus config */
|
||||
for (i = 0; i < 32; i++) {
|
||||
lmc_t1_write(sc, 0x0E0+i, 0x00); /*SBCn sysbus perchannel ctl */
|
||||
lmc_t1_write(sc, 0x100+i, 0x00); /* TPCn - TX per-channel ctl */
|
||||
lmc_t1_write(sc, 0x180+i, 0x00); /* RPCn - RX per-channel ctl */
|
||||
}
|
||||
for (i = 1; i < 25; i++) {
|
||||
lmc_t1_write(sc, 0x0E0+i, 0x0D);
|
||||
/* SBCn - sys bus per-channel ctl */
|
||||
}
|
||||
|
||||
mii16 |= LMC_MII16_T1_XOE;
|
||||
lmc_mii_writereg (sc, 0, 16, mii16);
|
||||
sc->lmc_miireg16 = mii16;
|
||||
}
|
||||
|
||||
static void
|
||||
lmc_t1_default(lmc_softc_t * const sc)
|
||||
{
|
||||
sc->lmc_miireg16 = LMC_MII16_LED_ALL;
|
||||
sc->lmc_media->set_link_status(sc, LMC_LINK_DOWN);
|
||||
sc->lmc_media->set_circuit_type(sc, LMC_CTL_CIRCUIT_TYPE_T1);
|
||||
sc->lmc_media->set_crc_length(sc, LMC_CTL_CRC_LENGTH_16);
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a user provided state, set ourselves up to match it. This will
|
||||
* always reset the card if needed.
|
||||
*/
|
||||
|
||||
static void
|
||||
lmc_t1_set_status(lmc_softc_t * const sc, lmc_ctl_t *ctl){
|
||||
if (ctl == NULL) {
|
||||
sc->lmc_media->set_circuit_type(sc, sc->ictl.circuit_type);
|
||||
lmc_set_protocol(sc, NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* check for change in circuit type
|
||||
*/
|
||||
|
||||
if (ctl->circuit_type == LMC_CTL_CIRCUIT_TYPE_T1
|
||||
&& sc->ictl.circuit_type == LMC_CTL_CIRCUIT_TYPE_E1)
|
||||
sc->lmc_media->set_circuit_type(sc, LMC_CTL_CIRCUIT_TYPE_E1);
|
||||
else if (ctl->circuit_type == LMC_CTL_CIRCUIT_TYPE_E1
|
||||
&& sc->ictl.circuit_type == LMC_CTL_CIRCUIT_TYPE_T1)
|
||||
sc->lmc_media->set_circuit_type(sc, LMC_CTL_CIRCUIT_TYPE_T1);
|
||||
lmc_set_protocol(sc, ctl);
|
||||
}
|
||||
|
||||
/*
|
||||
* return hardware link status.
|
||||
* 0 == link is down, 1 == link is up.
|
||||
*/
|
||||
|
||||
static int
|
||||
lmc_t1_get_link_status(lmc_softc_t * const sc)
|
||||
{
|
||||
u_int16_t link_status;
|
||||
lmc_mii_writereg(sc, 0, 17, T1FRAMER_ALARM1_STATUS);
|
||||
link_status = lmc_mii_readreg(sc, 0, 18);
|
||||
|
||||
/*
|
||||
* LMC 1200 LED definitions
|
||||
* led0 yellow = far-end adapter is in Red alarm condition
|
||||
* led1 blue = received an Alarm Indication signal (upstream failure)
|
||||
* led2 Green = power to adapter, Gate Array loaded & driver attached
|
||||
* led3 red = Loss of Signal (LOS) or out of frame (OOF) conditions
|
||||
* detected on T3 receive signal
|
||||
*/
|
||||
|
||||
/* detect a change in Blue alarm indication signal */
|
||||
|
||||
if ((sc->t1_alarm1_status & T1F_RAIS) != (link_status & T1F_RAIS)) {
|
||||
if (link_status & T1F_RAIS) {
|
||||
/* turn on blue LED */
|
||||
/* DEBUG */
|
||||
printf(" link status: RAIS turn ON Blue %x\n",
|
||||
link_status);
|
||||
lmc_led_on(sc, LMC_DS3_LED1);
|
||||
} else {
|
||||
/* turn off blue LED */
|
||||
/* DEBUG */
|
||||
printf(" link status: RAIS turn OFF Blue %x\n",
|
||||
link_status);
|
||||
lmc_led_off(sc, LMC_DS3_LED1);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* T1F_RYEL wiggles quite a bit,
|
||||
* taking it out until I understand why -baz 6/22/99
|
||||
*/
|
||||
/* Yellow alarm indication */
|
||||
if ((sc->t1_alarm1_status & T1F_RMYEL) !=
|
||||
(link_status & T1F_RMYEL)) {
|
||||
if ((link_status & (T1F_RYEL | T1F_RMYEL)) == 0) {
|
||||
/* turn off yellow LED */
|
||||
/* DEBUG */
|
||||
printf(" link status: RYEL turn OFF Yellow %x\n",
|
||||
link_status);
|
||||
lmc_led_off(sc, LMC_DS3_LED0);
|
||||
|
||||
} else {
|
||||
/* turn on yellow LED */
|
||||
/* DEBUG */
|
||||
printf(" link status: RYEL turn ON Yellow %x\n",
|
||||
link_status);
|
||||
lmc_led_on(sc, LMC_DS3_LED0);
|
||||
}
|
||||
}
|
||||
|
||||
sc->t1_alarm1_status = link_status;
|
||||
|
||||
lmc_mii_writereg(sc, 0, 17, T1FRAMER_ALARM2_STATUS);
|
||||
sc->t1_alarm2_status = lmc_mii_readreg(sc, 0, 18);
|
||||
|
||||
/*
|
||||
* link status based upon T1 receive loss of frame or
|
||||
* loss of signal - RED alarm indication
|
||||
*/
|
||||
if ((link_status & (T1F_RLOF | T1F_RLOS)) == 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 1 == T1 Circuit Type , 0 == E1 Circuit Type
|
||||
*/
|
||||
static void
|
||||
lmc_t1_set_circuit_type(lmc_softc_t * const sc, int ie)
|
||||
{
|
||||
if (ie == LMC_CTL_CIRCUIT_TYPE_T1) {
|
||||
sc->lmc_miireg16 |= LMC_MII16_T1_Z;
|
||||
sc->ictl.circuit_type = LMC_CTL_CIRCUIT_TYPE_T1;
|
||||
} else {
|
||||
sc->lmc_miireg16 &= ~LMC_MII16_T1_Z;
|
||||
sc->ictl.scrambler_onoff = LMC_CTL_CIRCUIT_TYPE_E1;
|
||||
}
|
||||
lmc_mii_writereg(sc, 0, 16, sc->lmc_miireg16);
|
||||
}
|
||||
|
||||
/*
|
||||
* 0 == 16bit, 1 == 32bit
|
||||
*/
|
||||
static void
|
||||
lmc_t1_set_crc_length(lmc_softc_t * const sc, int state)
|
||||
{
|
||||
if (state == LMC_CTL_CRC_LENGTH_32) {
|
||||
/* 32 bit */
|
||||
sc->lmc_miireg16 |= LMC_MII16_T1_CRC;
|
||||
sc->ictl.crc_length = LMC_CTL_CRC_LENGTH_32;
|
||||
sc->lmc_crcSize = LMC_CTL_CRC_BYTESIZE_4;
|
||||
|
||||
} else {
|
||||
/* 16 bit */
|
||||
sc->lmc_miireg16 &= ~LMC_MII16_T1_CRC;
|
||||
sc->ictl.crc_length = LMC_CTL_CRC_LENGTH_16;
|
||||
sc->lmc_crcSize = LMC_CTL_CRC_BYTESIZE_2;
|
||||
}
|
||||
|
||||
lmc_mii_writereg(sc, 0, 16, sc->lmc_miireg16);
|
||||
}
|
||||
|
||||
/*
|
||||
* 1 == internal, 0 == external
|
||||
*/
|
||||
static void
|
||||
lmc_t1_set_clock(lmc_softc_t * const sc, int ie)
|
||||
{
|
||||
if (ie == LMC_CTL_CLOCK_SOURCE_EXT) {
|
||||
sc->lmc_gpio &= ~(LMC_GEP_SSI_TXCLOCK);
|
||||
LMC_CSR_WRITE (sc, csr_gp, sc->lmc_gpio);
|
||||
sc->ictl.clock_source = LMC_CTL_CLOCK_SOURCE_EXT;
|
||||
printf (LMC_PRINTF_FMT ": clock external\n", LMC_PRINTF_ARGS);
|
||||
}
|
||||
else {
|
||||
sc->lmc_gpio |= LMC_GEP_SSI_TXCLOCK;
|
||||
LMC_CSR_WRITE (sc, csr_gp, sc->lmc_gpio);
|
||||
sc->ictl.clock_source = LMC_CTL_CLOCK_SOURCE_INT;
|
||||
printf (LMC_PRINTF_FMT ": clock internal\n", LMC_PRINTF_ARGS);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
lmc_t1_watchdog(lmc_softc_t * const sc)
|
||||
{
|
||||
int t1stat;
|
||||
|
||||
/* read alarm 1 status (recieve) */
|
||||
t1stat = lmc_t1_read (sc, 0x47);
|
||||
/* blue alarm -- RAIS */
|
||||
if (t1stat & 0x08) {
|
||||
if (sc->lmc_blue != 1)
|
||||
printf ("%s: AIS Recieved\n", sc->lmc_xname);
|
||||
lmc_led_on (sc, LMC_DS3_LED1 | LMC_DS3_LED2);
|
||||
sc->lmc_blue = 1;
|
||||
} else {
|
||||
if (sc->lmc_blue == 1)
|
||||
printf ("%s: AIS ok\n", sc->lmc_xname);
|
||||
lmc_led_off (sc, LMC_DS3_LED1);
|
||||
lmc_led_on (sc, LMC_DS3_LED2);
|
||||
sc->lmc_blue = 0;
|
||||
}
|
||||
|
||||
/* Red alarm -- LOS | LOF */
|
||||
if (t1stat & 0x04) {
|
||||
/* Only print the error once */
|
||||
if (sc->lmc_red != 1)
|
||||
printf ("%s: Red Alarm\n", sc->lmc_xname);
|
||||
lmc_led_on (sc, LMC_DS3_LED2 | LMC_DS3_LED3);
|
||||
sc->lmc_red = 1;
|
||||
} else {
|
||||
if (sc->lmc_red == 1)
|
||||
printf ("%s: Red Alarm ok\n", sc->lmc_xname);
|
||||
lmc_led_off (sc, LMC_DS3_LED3);
|
||||
lmc_led_on (sc, LMC_DS3_LED2);
|
||||
sc->lmc_red = 0;
|
||||
}
|
||||
|
||||
/* check for Recieve Multiframe Yellow Alarm
|
||||
* Ignore Recieve Yellow Alarm
|
||||
*/
|
||||
if (t1stat & 0x80) {
|
||||
if (sc->lmc_yel != 1) {
|
||||
printf ("%s: Recieve Yellow Alarm\n", sc->lmc_xname);
|
||||
}
|
||||
lmc_led_on (sc, LMC_DS3_LED0 | LMC_DS3_LED2);
|
||||
sc->lmc_yel = 1;
|
||||
}
|
||||
else {
|
||||
if (sc->lmc_yel == 1)
|
||||
printf ("%s: Yellow Alarm ok\n", sc->lmc_xname);
|
||||
lmc_led_off (sc, LMC_DS3_LED0);
|
||||
lmc_led_on (sc, LMC_DS3_LED2);
|
||||
sc->lmc_yel = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
lmc_set_protocol(lmc_softc_t * const sc, lmc_ctl_t *ctl)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_lmc_nbsd.c,v 1.7 2001/01/12 05:19:18 itojun Exp $ */
|
||||
/* $NetBSD: if_lmc_nbsd.c,v 1.8 2001/04/12 07:50:54 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-1999 LAN Media Corporation (LMC)
|
||||
@ -197,7 +197,7 @@ lmc_pci_probe(struct device *parent, struct cfdata *match,
|
||||
if ((PCI_CHIPID(id) != PCI_PRODUCT_LMC_HSSI)
|
||||
&& (PCI_CHIPID(id) != PCI_PRODUCT_LMC_DS3)
|
||||
&& (PCI_CHIPID(id) != PCI_PRODUCT_LMC_SSI)
|
||||
&& (PCI_CHIPID(id) != PCI_PRODUCT_LMC_T1))
|
||||
&& (PCI_CHIPID(id) != PCI_PRODUCT_LMC_DS1))
|
||||
return 0;
|
||||
|
||||
return 10; /* must be > than any other tulip driver */
|
||||
@ -217,7 +217,7 @@ lmc_pci_attach(struct device * const parent,
|
||||
u_int32_t revinfo, cfdainfo, id, ssid;
|
||||
pci_intr_handle_t intrhandle;
|
||||
const char *intrstr;
|
||||
#if !defined(LMC_IOMAPPED)
|
||||
#if 0
|
||||
vm_offset_t pa_csrs;
|
||||
#endif
|
||||
unsigned csroffset = LMC_PCI_CSROFFSET;
|
||||
@ -230,6 +230,7 @@ lmc_pci_attach(struct device * const parent,
|
||||
extern lmc_media_t lmc_hssi_media;
|
||||
extern lmc_media_t lmc_ds3_media;
|
||||
extern lmc_media_t lmc_t1_media;
|
||||
extern lmc_media_t lmc_ssi_media;
|
||||
|
||||
revinfo = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_CFRV) & 0xFF;
|
||||
id = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_CFID);
|
||||
@ -247,12 +248,16 @@ lmc_pci_attach(struct device * const parent,
|
||||
break;
|
||||
case PCI_PRODUCT_LMC_SSI:
|
||||
printf(": Lan Media Corporation SSI\n");
|
||||
sc->lmc_media = &lmc_ssi_media;
|
||||
break;
|
||||
case PCI_PRODUCT_LMC_DS1:
|
||||
printf(": Lan Media Corporation T1\n");
|
||||
sc->lmc_media = &lmc_t1_media;
|
||||
break;
|
||||
}
|
||||
|
||||
sc->lmc_pci_busno = parent;
|
||||
sc->lmc_pci_devno = pa->pa_device;
|
||||
sc->lmc_pci_busno = parent;
|
||||
sc->lmc_pci_devno = pa->pa_device;
|
||||
|
||||
sc->lmc_chipid = LMC_21140A;
|
||||
sc->lmc_features |= LMC_HAVE_STOREFWD;
|
||||
@ -296,6 +301,11 @@ lmc_pci_attach(struct device * const parent,
|
||||
sc->lmc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
/* Make sure bus mastering is enabled. */
|
||||
pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
|
||||
pci_conf_read(pa->pa_pc, pa->pa_tag,
|
||||
PCI_COMMAND_STATUS_REG) |
|
||||
PCI_COMMAND_MASTER_ENABLE);
|
||||
}
|
||||
|
||||
lmc_initcsrs(sc, csr_base + csroffset, csrsize);
|
||||
@ -309,7 +319,7 @@ lmc_pci_attach(struct device * const parent,
|
||||
|
||||
sc->lmc_media->defaults(sc);
|
||||
|
||||
sc->lmc_media->set_link_status(sc, 0); /* down */
|
||||
sc->lmc_media->set_link_status(sc, LMC_LINK_DOWN); /* down */
|
||||
|
||||
/*
|
||||
* Make sure there won't be any interrupts or such...
|
||||
@ -324,10 +334,6 @@ lmc_pci_attach(struct device * const parent,
|
||||
DELAY(100);
|
||||
|
||||
lmc_read_macaddr(sc);
|
||||
printf("%s: pass %d.%d, serial " LMC_EADDR_FMT "\n",
|
||||
sc->lmc_dev.dv_xname,
|
||||
(sc->lmc_revinfo & 0xF0) >> 4, sc->lmc_revinfo & 0x0F,
|
||||
LMC_EADDR_ARGS(sc->lmc_enaddr));
|
||||
|
||||
if (pci_intr_map(pa, &intrhandle)) {
|
||||
printf("%s: couldn't map interrupt\n",
|
||||
@ -345,11 +351,14 @@ lmc_pci_attach(struct device * const parent,
|
||||
printf("\n");
|
||||
return;
|
||||
}
|
||||
printf("%s: interrupting at %s\n", sc->lmc_dev.dv_xname,
|
||||
intrstr);
|
||||
|
||||
sc->lmc_ats = shutdownhook_establish(lmc_shutdown, sc);
|
||||
if (sc->lmc_ats == NULL)
|
||||
printf("%s: pass %d.%d, serial " LMC_EADDR_FMT ", %s\n",
|
||||
sc->lmc_dev.dv_xname,
|
||||
(sc->lmc_revinfo & 0xF0) >> 4, sc->lmc_revinfo & 0x0F,
|
||||
LMC_EADDR_ARGS(sc->lmc_enaddr), intrstr);
|
||||
|
||||
sc->lmc_ats = shutdownhook_establish(lmc_shutdown, sc);
|
||||
if (sc->lmc_ats == NULL)
|
||||
printf("%s: warning: couldn't establish shutdown hook\n",
|
||||
sc->lmc_xname);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_lmc_types.h,v 1.2 1999/03/25 04:09:33 explorer Exp $ */
|
||||
/* $NetBSD: if_lmc_types.h,v 1.3 2001/04/12 07:50:54 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-1999 LAN Media Corporation (LMC)
|
||||
@ -58,12 +58,8 @@
|
||||
#if defined(__NetBSD__)
|
||||
typedef bus_addr_t lmc_csrptr_t;
|
||||
#else
|
||||
#ifdef LMC_IOMAPPED
|
||||
typedef u_int16_t lmc_csrptr_t;
|
||||
#else
|
||||
typedef volatile u_int32_t *lmc_csrptr_t;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#define lmc_intrfunc_t int
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_lmcioctl.h,v 1.2 1999/03/25 04:09:34 explorer Exp $ */
|
||||
/* $NetBSD: if_lmcioctl.h,v 1.3 2001/04/12 07:50:54 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-1999 LAN Media Corporation (LMC)
|
||||
@ -82,13 +82,21 @@ struct lmc___ctl {
|
||||
u_int32_t keepalive_onoff; /* protocol */
|
||||
u_int32_t ticks; /* ticks/sec */
|
||||
union {
|
||||
lmc_av9110_t t1;
|
||||
lmc_av9110_t ssi;
|
||||
} cardspec;
|
||||
u_int32_t circuit_type; /* T1 or E1 */
|
||||
};
|
||||
|
||||
#define LMC_CARDTYPE_UNKNOWN -1
|
||||
#define LMC_CARDTYPE_HSSI 1 /* probed card is a HSSI card */
|
||||
#define LMC_CARDTYPE_DS3 2 /* probed card is a DS3 card */
|
||||
#define LMC_CARDTYPE_SSI 3 /* probed card is a SSI card */
|
||||
#define LMC_CARDTYPE_T1 4 /* probed card is a T1 card */
|
||||
|
||||
#define LMC_CTL_CARDTYPE_LMC5200 0 /* HSSI */
|
||||
#define LMC_CTL_CARDTYPE_LMC5245 1 /* DS3 */
|
||||
#define LMC_CTL_CARDTYPE_LMC1000 2 /* T1, E1, etc */
|
||||
#define LMC_CTL_CARDTYPE_LMC1000 2 /* SSI, V.35 */
|
||||
#define LMC_CTL_CARDTYPE_LMC1200 3 /* DS1 */
|
||||
|
||||
#define LMC_CTL_OFF 0 /* generic OFF value */
|
||||
#define LMC_CTL_ON 1 /* generic ON value */
|
||||
@ -98,10 +106,15 @@ struct lmc___ctl {
|
||||
|
||||
#define LMC_CTL_CRC_LENGTH_16 16
|
||||
#define LMC_CTL_CRC_LENGTH_32 32
|
||||
#define LMC_CTL_CRC_BYTESIZE_2 2
|
||||
#define LMC_CTL_CRC_BYTESIZE_4 4
|
||||
|
||||
#define LMC_CTL_CABLE_LENGTH_LT_100FT 0 /* DS3 cable < 100 feet */
|
||||
#define LMC_CTL_CABLE_LENGTH_GT_100FT 1 /* DS3 cable >= 100 feet */
|
||||
|
||||
#define LMC_CTL_CIRCUIT_TYPE_E1 0
|
||||
#define LMC_CTL_CIRCUIT_TYPE_T1 1
|
||||
|
||||
/*
|
||||
* These are not in the least IOCTL related, but I want them common.
|
||||
*/
|
||||
@ -124,29 +137,29 @@ struct lmc___ctl {
|
||||
/*
|
||||
* T1 GPIO assignments
|
||||
*/
|
||||
#define LMC_GEP_T1_GENERATOR 0x04 /* 2: enable prog freq gen serial i/f */
|
||||
#define LMC_GEP_T1_TXCLOCK 0x08 /* 3: provide clock on TXCLOCK output */
|
||||
#define LMC_GEP_SSI_GENERATOR 0x04 /* 2: enable prog freq gen serial i/f */
|
||||
#define LMC_GEP_SSI_TXCLOCK 0x08 /* 3: provide clock on TXCLOCK output */
|
||||
|
||||
/*
|
||||
* Common MII16 bits
|
||||
*/
|
||||
#define LMC_MII16_LED0 0x0080
|
||||
#define LMC_MII16_LED1 0x0100
|
||||
#define LMC_MII16_LED2 0x0200
|
||||
#define LMC_MII16_LED3 0x0400 /* Error, and the red one */
|
||||
#define LMC_MII16_LED_ALL 0x0780 /* LED bit mask */
|
||||
#define LMC_MII16_FIFO_RESET 0x0800
|
||||
#define LMC_MII16_LED0 0x0080
|
||||
#define LMC_MII16_LED1 0x0100
|
||||
#define LMC_MII16_LED2 0x0200
|
||||
#define LMC_MII16_LED3 0x0400 /* Error, and the red one */
|
||||
#define LMC_MII16_LED_ALL 0x0780 /* LED bit mask */
|
||||
#define LMC_MII16_FIFO_RESET 0x0800
|
||||
|
||||
/*
|
||||
* definitions for HSSI
|
||||
*/
|
||||
#define LMC_MII16_HSSI_TA 0x0001
|
||||
#define LMC_MII16_HSSI_CA 0x0002
|
||||
#define LMC_MII16_HSSI_LA 0x0004
|
||||
#define LMC_MII16_HSSI_LB 0x0008
|
||||
#define LMC_MII16_HSSI_LC 0x0010
|
||||
#define LMC_MII16_HSSI_TM 0x0020
|
||||
#define LMC_MII16_HSSI_CRC 0x0040
|
||||
#define LMC_MII16_HSSI_TA 0x0001
|
||||
#define LMC_MII16_HSSI_CA 0x0002
|
||||
#define LMC_MII16_HSSI_LA 0x0004
|
||||
#define LMC_MII16_HSSI_LB 0x0008
|
||||
#define LMC_MII16_HSSI_LC 0x0010
|
||||
#define LMC_MII16_HSSI_TM 0x0020
|
||||
#define LMC_MII16_HSSI_CRC 0x0040
|
||||
|
||||
/*
|
||||
* assignments for the MII register 16 (DS3)
|
||||
@ -161,33 +174,12 @@ struct lmc___ctl {
|
||||
#define LMC_MII16_DS3_CRC 0x1000
|
||||
#define LMC_MII16_DS3_SCRAM 0x2000
|
||||
|
||||
/*
|
||||
* And T1
|
||||
*/
|
||||
#define LMC_MII16_T1_DTR 0x0001 /* DTR output RW */
|
||||
#define LMC_MII16_T1_DSR 0x0002 /* DSR input RO */
|
||||
#define LMC_MII16_T1_RTS 0x0004 /* RTS output RW */
|
||||
#define LMC_MII16_T1_CTS 0x0008 /* CTS input RO */
|
||||
#define LMC_MII16_T1_DCD 0x0010 /* DCD input RO */
|
||||
#define LMC_MII16_T1_RI 0x0020 /* RI input RO */
|
||||
#define LMC_MII16_T1_CRC 0x0040 /* CRC select */
|
||||
|
||||
/*
|
||||
* bits 0x0080 through 0x0800 are generic, and described
|
||||
* above with LMC_MII16_LED[0123] _LED_ALL, and _FIFO_RESET
|
||||
*/
|
||||
#define LMC_MII16_T1_LL 0x1000 /* LL output RW */
|
||||
#define LMC_MII16_T1_RL 0x2000 /* RL output RW */
|
||||
#define LMC_MII16_T1_TM 0x4000 /* TM input RO */
|
||||
#define LMC_MII16_T1_LOOP 0x8000 /* loopback enable RW */
|
||||
|
||||
/*
|
||||
* Some of the MII16 bits are mirrored in the MII17 register as well,
|
||||
* but let's keep thing seperate for now, and get only the cable from
|
||||
* the MII17.
|
||||
*/
|
||||
#define LMC_MII17_T1_CABLE_MASK 0x0038 /* mask to extract the cable type */
|
||||
#define LMC_MII17_T1_CABLE_SHIFT 3 /* shift to extract the cable type */
|
||||
/* Note: 2 pairs of LEDs where swapped by mistake
|
||||
* in Xilinx code for DS3 & DS1 adapters */
|
||||
#define LMC_DS3_LED0 0x0100 /* bit 08 yellow */
|
||||
#define LMC_DS3_LED1 0x0080 /* bit 07 blue */
|
||||
#define LMC_DS3_LED2 0x0400 /* bit 10 green */
|
||||
#define LMC_DS3_LED3 0x0200 /* bit 09 red */
|
||||
|
||||
/*
|
||||
* framer register 0 and 7 (7 is latched and reset on read)
|
||||
@ -198,10 +190,88 @@ struct lmc___ctl {
|
||||
#define LMC_FRAMER_REG0_CIS 0x10 /* channel idle */
|
||||
#define LMC_FRAMER_REG0_LOC 0x08 /* loss of clock */
|
||||
|
||||
#define LMC_CARDTYPE_UNKNOWN -1
|
||||
#define LMC_CARDTYPE_HSSI 1 /* probed card is a HSSI card */
|
||||
#define LMC_CARDTYPE_DS3 2 /* probed card is a DS3 card */
|
||||
#define LMC_CARDTYPE_T1 3 /* probed card is a T1 card */
|
||||
|
||||
/*
|
||||
* And SSI, LMC1000
|
||||
*/
|
||||
#define LMC_MII16_SSI_DTR 0x0001 /* DTR output RW */
|
||||
#define LMC_MII16_SSI_DSR 0x0002 /* DSR input RO */
|
||||
#define LMC_MII16_SSI_RTS 0x0004 /* RTS output RW */
|
||||
#define LMC_MII16_SSI_CTS 0x0008 /* CTS input RO */
|
||||
#define LMC_MII16_SSI_DCD 0x0010 /* DCD input RO */
|
||||
#define LMC_MII16_SSI_RI 0x0020 /* RI input RO */
|
||||
#define LMC_MII16_SSI_CRC 0x1000 /* CRC select - RW */
|
||||
|
||||
/*
|
||||
* bits 0x0080 through 0x0800 are generic, and described
|
||||
* above with LMC_MII16_LED[0123] _LED_ALL, and _FIFO_RESET
|
||||
*/
|
||||
#define LMC_MII16_SSI_LL 0x1000 /* LL output RW */
|
||||
#define LMC_MII16_SSI_RL 0x2000 /* RL output RW */
|
||||
#define LMC_MII16_SSI_TM 0x4000 /* TM input RO */
|
||||
#define LMC_MII16_SSI_LOOP 0x8000 /* loopback enable RW */
|
||||
|
||||
/*
|
||||
* Some of the MII16 bits are mirrored in the MII17 register as well,
|
||||
* but let's keep thing separate for now, and get only the cable from
|
||||
* the MII17.
|
||||
*/
|
||||
#define LMC_MII17_SSI_CABLE_MASK 0x0038 /* mask to extract the cable type */
|
||||
#define LMC_MII17_SSI_CABLE_SHIFT 3 /* shift to extract the cable type */
|
||||
|
||||
/*
|
||||
* And T1, LMC1200
|
||||
*/
|
||||
#define LMC_MII16_T1_UNUSED1 0x0003
|
||||
#define LMC_MII16_T1_XOE 0x0004
|
||||
#define LMC_MII16_T1_RST 0x0008 /* T1 chip reset - RW */
|
||||
#define LMC_MII16_T1_Z 0x0010 /* output impedance T1=1, E1=0 output - RW */
|
||||
#define LMC_MII16_T1_INTR 0x0020 /* interrupt from 8370 - RO */
|
||||
#define LMC_MII16_T1_ONESEC 0x0040 /* one second square wave - ro */
|
||||
|
||||
#define LMC_MII16_T1_LED0 0x0100
|
||||
#define LMC_MII16_T1_LED1 0x0080
|
||||
#define LMC_MII16_T1_LED2 0x0400
|
||||
#define LMC_MII16_T1_LED3 0x0200
|
||||
#define LMC_MII16_T1_FIFO_RESET 0x0800
|
||||
|
||||
#define LMC_MII16_T1_CRC 0x1000 /* CRC select - RW */
|
||||
#define LMC_MII16_T1_UNUSED2 0xe000
|
||||
|
||||
|
||||
/* 8370 framer registers */
|
||||
|
||||
#define T1FRAMER_ALARM1_STATUS 0x47
|
||||
#define T1FRAMER_ALARM2_STATUS 0x48
|
||||
#define T1FRAMER_FERR_LSB 0x50
|
||||
#define T1FRAMER_FERR_MSB 0x51 /* framing bit error counter */
|
||||
#define T1FRAMER_LCV_LSB 0x54
|
||||
#define T1FRAMER_LCV_MSB 0x55 /* line code violation counter */
|
||||
#define T1FRAMER_AERR 0x5A
|
||||
|
||||
/* mask for the above AERR register */
|
||||
#define T1FRAMER_LOF_MASK (0x0f0) /* receive loss of frame */
|
||||
#define T1FRAMER_COFA_MASK (0x0c0) /* change of frame alignment */
|
||||
#define T1FRAMER_SEF_MASK (0x03) /* severely errored frame */
|
||||
|
||||
/*
|
||||
* 8370 framer register ALM1 (0x47) values
|
||||
* used to determine link status
|
||||
*/
|
||||
|
||||
#define T1F_SIGFRZ 0x01 /* signaling freeze */
|
||||
#define T1F_RLOF 0x02 /* receive loss of frame alignment */
|
||||
#define T1F_RLOS 0x04 /* receive loss of signal */
|
||||
#define T1F_RALOS 0x08 /* receive analog loss of signal or RCKI loss of clock */
|
||||
#define T1F_RAIS 0x10 /* receive alarm indication signal */
|
||||
#define T1F_UNUSED 0x20
|
||||
#define T1F_RYEL 0x40 /* receive yellow alarm */
|
||||
#define T1F_RMYEL 0x80 /* receive multiframe yellow alarm */
|
||||
|
||||
/* ------------------ end T1 defs ------------------- */
|
||||
|
||||
#define LMC_MII_LedMask 0x0780
|
||||
#define LMC_MII_LedBitPos 7
|
||||
|
||||
#if defined(LMC_IS_KERNEL) /* defined in if_lmc_types.h */
|
||||
|
||||
@ -220,6 +290,8 @@ struct lmc___media {
|
||||
int (* get_link_status)(lmc_softc_t * const);
|
||||
void (* set_link_status)(lmc_softc_t * const, int);
|
||||
void (* set_crc_length)(lmc_softc_t * const, int);
|
||||
void (* set_circuit_type)(lmc_softc_t * const, int);
|
||||
void (* watchdog)(lmc_softc_t * const);
|
||||
};
|
||||
|
||||
u_int32_t lmc_mii_readreg(lmc_softc_t * const sc, u_int32_t devaddr,
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_lmcvar.h,v 1.5 2000/12/12 18:00:25 thorpej Exp $ */
|
||||
/* $NetBSD: if_lmcvar.h,v 1.6 2001/04/12 07:50:54 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-1999 LAN Media Corporation (LMC)
|
||||
@ -127,6 +127,9 @@
|
||||
#include <sys/rnd.h>
|
||||
#endif
|
||||
|
||||
#endif /* NetBSD */
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#define LMC_CSR_READ(sc, csr) \
|
||||
bus_space_read_4((sc)->lmc_bustag, (sc)->lmc_bushandle, (sc)->lmc_csrs.csr)
|
||||
#define LMC_CSR_WRITE(sc, csr, val) \
|
||||
@ -138,22 +141,6 @@
|
||||
bus_space_write_1((sc)->lmc_bustag, (sc)->lmc_bushandle, (sc)->lmc_csrs.csr, (val))
|
||||
#endif /* __NetBSD__ */
|
||||
|
||||
#ifdef LMC_IOMAPPED
|
||||
#define LMC_EISA_CSRSIZE 16
|
||||
#define LMC_EISA_CSROFFSET 0
|
||||
#define LMC_PCI_CSRSIZE 8
|
||||
#define LMC_PCI_CSROFFSET 0
|
||||
|
||||
#if !defined(__NetBSD__)
|
||||
#define LMC_CSR_READ(sc, csr) (inl((sc)->lmc_csrs.csr))
|
||||
#define LMC_CSR_WRITE(sc, csr, val) outl((sc)->lmc_csrs.csr, val)
|
||||
|
||||
#define LMC_CSR_READBYTE(sc, csr) (inb((sc)->lmc_csrs.csr))
|
||||
#define LMC_CSR_WRITEBYTE(sc, csr, val) outb((sc)->lmc_csrs.csr, val)
|
||||
#endif /* __NetBSD__ */
|
||||
|
||||
#else /* LMC_IOMAPPED */
|
||||
|
||||
#define LMC_PCI_CSRSIZE 8
|
||||
#define LMC_PCI_CSROFFSET 0
|
||||
|
||||
@ -167,8 +154,6 @@
|
||||
#define LMC_CSR_WRITE(sc, csr, val) ((void)(*(sc)->lmc_csrs.csr = (val)))
|
||||
#endif /* __NetBSD__ */
|
||||
|
||||
#endif /* LMC_IOMAPPED */
|
||||
|
||||
/*
|
||||
* This structure contains "pointers" for the registers on
|
||||
* the various 21x4x chips. CSR0 through CSR8 are common
|
||||
@ -255,11 +240,8 @@ struct lmc_ringinfo {
|
||||
|
||||
#define LMC_RX_BUFLEN ((MCLBYTES < 2048 ? MCLBYTES : 2048) - 16)
|
||||
|
||||
/*
|
||||
* The various controllers support. Technically the DE425 is just
|
||||
* a 21040 on EISA. But since it remarkably difference from normal
|
||||
* 21040s, we give it its own chip id.
|
||||
*/
|
||||
#define LMC_LINK_UP 1
|
||||
#define LMC_LINK_DOWN 0
|
||||
|
||||
typedef enum {
|
||||
LMC_21140, LMC_21140A,
|
||||
@ -368,6 +350,13 @@ struct lmc___softc {
|
||||
#if defined(__NetBSD__) && NRND > 0
|
||||
rndsource_element_t lmc_rndsource;
|
||||
#endif
|
||||
|
||||
u_int32_t lmc_crcSize;
|
||||
u_int32_t tx_clockState;
|
||||
char lmc_yel, lmc_blue, lmc_red; /* for T1 and DS3 */
|
||||
char lmc_timing; /* for HSSI and SSI */
|
||||
u_int16_t t1_alarm1_status;
|
||||
u_int16_t t1_alarm2_status;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -483,7 +472,7 @@ static lmc_softc_t *tulips[LMC_MAX_DEVICES];
|
||||
#define LMC_EADDR_ARGS(addr) addr, ":"
|
||||
#else
|
||||
extern int bootverbose;
|
||||
#define LMC_IFP_TO_SOFTC(ifp) (LMC_UNIT_TO_SOFTC((ifp)->if_unit))
|
||||
#define LMC_IFP_TO_SOFTC(ifp) (LMC_UNIT_TO_SOFTC((ifp)->if_unit))
|
||||
#include <sys/devconf.h>
|
||||
#define LMC_DEVCONF
|
||||
#endif
|
||||
@ -513,7 +502,7 @@ typedef u_long ioctl_cmd_t;
|
||||
extern struct cfattach de_ca;
|
||||
extern struct cfdriver de_cd;
|
||||
#define LMC_UNIT_TO_SOFTC(unit) ((lmc_softc_t *) de_cd.cd_devs[unit])
|
||||
#define LMC_IFP_TO_SOFTC(ifp) ((lmc_softc_t *)((ifp)->if_softc))
|
||||
#define LMC_IFP_TO_SOFTC(ifp) ((lmc_softc_t *)((ifp)->if_softc))
|
||||
#define lmc_unit lmc_dev.dv_unit
|
||||
#define lmc_xname lmc_if.if_xname
|
||||
#define LMC_RAISESPL() splnet()
|
||||
@ -578,7 +567,7 @@ extern struct cfdriver de_cd;
|
||||
#if !defined(LMC_BPF_MTAP) && NBPFILTER > 0
|
||||
#define LMC_BPF_MTAP(sc, m) bpf_mtap((sc)->lmc_bpf, m)
|
||||
#define LMC_BPF_TAP(sc, p, l) bpf_tap((sc)->lmc_bpf, p, l)
|
||||
#define LMC_BPF_ATTACH(sc) bpfattach(&(sc)->lmc_sppp.pp_if, DLT_PPP_SERIAL, PPP_HEADER_LEN)
|
||||
#define LMC_BPF_ATTACH(sc) bpfattach(&(sc)->lmc_sppp.pp_if, DLT_HDLC, PPP_HEADER_LEN)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user