Style(9) cleanup. There was no consistent style in this driver, and
The next round of commits will be to fix up locking in it. This lot is to at least give a consistent base to work off. OK'ed by: imp, mdodd
This commit is contained in:
parent
9e66b98a4a
commit
5146af6d82
1073
sys/dev/ep/if_ep.c
1073
sys/dev/ep/if_ep.c
File diff suppressed because it is too large
Load Diff
@ -18,26 +18,25 @@
|
||||
* Justin T. Gibbs.
|
||||
* 4. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <dev/eisa/eisaconf.h>
|
||||
|
||||
@ -72,32 +71,25 @@
|
||||
|
||||
static const char *ep_match(eisa_id_t type);
|
||||
|
||||
static const char*
|
||||
static const char *
|
||||
ep_match(eisa_id_t type)
|
||||
{
|
||||
switch(type) {
|
||||
case EISA_DEVICE_ID_3COM_3C509_TP:
|
||||
return "3Com 3C509-TP Network Adapter";
|
||||
break;
|
||||
case EISA_DEVICE_ID_3COM_3C509_BNC:
|
||||
return "3Com 3C509-BNC Network Adapter";
|
||||
break;
|
||||
case EISA_DEVICE_ID_3COM_3C579_TP:
|
||||
return "3Com 3C579-TP EISA Network Adapter";
|
||||
break;
|
||||
case EISA_DEVICE_ID_3COM_3C579_BNC:
|
||||
return "3Com 3C579-BNC EISA Network Adapter";
|
||||
break;
|
||||
case EISA_DEVICE_ID_3COM_3C509_COMBO:
|
||||
return "3Com 3C509-Combo Network Adapter";
|
||||
break;
|
||||
case EISA_DEVICE_ID_3COM_3C509_TPO:
|
||||
return "3Com 3C509-TPO Network Adapter";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (type) {
|
||||
case EISA_DEVICE_ID_3COM_3C509_TP:
|
||||
return ("3Com 3C509-TP Network Adapter");
|
||||
case EISA_DEVICE_ID_3COM_3C509_BNC:
|
||||
return ("3Com 3C509-BNC Network Adapter");
|
||||
case EISA_DEVICE_ID_3COM_3C579_TP:
|
||||
return ("3Com 3C579-TP EISA Network Adapter");
|
||||
case EISA_DEVICE_ID_3COM_3C579_BNC:
|
||||
return ("3Com 3C579-BNC EISA Network Adapter");
|
||||
case EISA_DEVICE_ID_3COM_3C509_COMBO:
|
||||
return ("3Com 3C509-Combo Network Adapter");
|
||||
case EISA_DEVICE_ID_3COM_3C509_TPO:
|
||||
return ("3Com 3C509-TPO Network Adapter");
|
||||
default:
|
||||
return (NULL);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -120,7 +112,7 @@ ep_eisa_probe(device_t dev)
|
||||
|
||||
/* We must be in EISA configuration mode */
|
||||
if ((inw(iobase + EP_W0_ADDRESS_CFG) & 0x1f) != 0x1f)
|
||||
return ENXIO;
|
||||
return ENXIO;
|
||||
|
||||
eisa_add_iospace(dev, iobase, EP_EISA_IOSIZE, RESVADDR_NONE);
|
||||
eisa_add_iospace(dev, port, EP_IOSIZE, RESVADDR_NONE);
|
||||
@ -129,66 +121,66 @@ ep_eisa_probe(device_t dev)
|
||||
/* Determine our IRQ */
|
||||
switch (conf & IRQ_CHANNEL) {
|
||||
case INT_3:
|
||||
irq = 3;
|
||||
break;
|
||||
irq = 3;
|
||||
break;
|
||||
case INT_5:
|
||||
irq = 5;
|
||||
break;
|
||||
irq = 5;
|
||||
break;
|
||||
case INT_7:
|
||||
irq = 7;
|
||||
break;
|
||||
irq = 7;
|
||||
break;
|
||||
case INT_9:
|
||||
irq = 9;
|
||||
break;
|
||||
irq = 9;
|
||||
break;
|
||||
case INT_10:
|
||||
irq = 10;
|
||||
break;
|
||||
irq = 10;
|
||||
break;
|
||||
case INT_11:
|
||||
irq = 11;
|
||||
break;
|
||||
irq = 11;
|
||||
break;
|
||||
case INT_12:
|
||||
irq = 12;
|
||||
break;
|
||||
irq = 12;
|
||||
break;
|
||||
case INT_15:
|
||||
irq = 15;
|
||||
break;
|
||||
irq = 15;
|
||||
break;
|
||||
default:
|
||||
/* Disabled */
|
||||
printf("ep: 3COM Network Adapter at "
|
||||
"slot %d has its IRQ disabled. "
|
||||
"Probe failed.\n",
|
||||
eisa_get_slot(dev));
|
||||
return ENXIO;
|
||||
/* Disabled */
|
||||
printf("ep: 3COM Network Adapter at "
|
||||
"slot %d has its IRQ disabled. "
|
||||
"Probe failed.\n",
|
||||
eisa_get_slot(dev));
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
switch(eisa_get_id(dev)) {
|
||||
case EISA_DEVICE_ID_3COM_3C579_BNC:
|
||||
case EISA_DEVICE_ID_3COM_3C579_TP:
|
||||
int_trig = EISA_TRIGGER_LEVEL;
|
||||
break;
|
||||
default:
|
||||
int_trig = EISA_TRIGGER_EDGE;
|
||||
break;
|
||||
switch (eisa_get_id(dev)) {
|
||||
case EISA_DEVICE_ID_3COM_3C579_BNC:
|
||||
case EISA_DEVICE_ID_3COM_3C579_TP:
|
||||
int_trig = EISA_TRIGGER_LEVEL;
|
||||
break;
|
||||
default:
|
||||
int_trig = EISA_TRIGGER_EDGE;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
eisa_add_intr(dev, irq, int_trig);
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
ep_eisa_attach(device_t dev)
|
||||
{
|
||||
struct ep_softc * sc = device_get_softc(dev);
|
||||
struct resource * eisa_io = NULL;
|
||||
u_int32_t eisa_iobase;
|
||||
int irq;
|
||||
int error = 0;
|
||||
int rid;
|
||||
struct ep_softc *sc = device_get_softc(dev);
|
||||
struct resource *eisa_io = NULL;
|
||||
u_int32_t eisa_iobase;
|
||||
int irq;
|
||||
int error = 0;
|
||||
int rid;
|
||||
|
||||
rid = 1;
|
||||
eisa_io = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
|
||||
0, ~0, 1, RF_ACTIVE);
|
||||
0, ~0, 1, RF_ACTIVE);
|
||||
if (!eisa_io) {
|
||||
device_printf(dev, "No I/O space?!\n");
|
||||
error = ENXIO;
|
||||
@ -198,7 +190,7 @@ ep_eisa_attach(device_t dev)
|
||||
|
||||
/* Reset and Enable the card */
|
||||
outb(eisa_iobase + EP_W0_CONFIG_CTRL, W0_P4_CMD_RESET_ADAPTER);
|
||||
DELAY(1000); /* we must wait at least 1 ms */
|
||||
DELAY(1000); /* we must wait at least 1 ms */
|
||||
outb(eisa_iobase + EP_W0_CONFIG_CTRL, W0_P4_CMD_ENABLE_ADAPTER);
|
||||
/* Now the registers are availible through the lower ioport */
|
||||
|
||||
@ -206,14 +198,11 @@ ep_eisa_attach(device_t dev)
|
||||
device_printf(dev, "ep_alloc() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
switch(eisa_get_id(dev)) {
|
||||
case EISA_DEVICE_ID_3COM_3C579_BNC:
|
||||
case EISA_DEVICE_ID_3COM_3C579_TP:
|
||||
sc->stat = F_ACCESS_32_BITS;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (eisa_get_id(dev)) {
|
||||
case EISA_DEVICE_ID_3COM_3C579_BNC:
|
||||
case EISA_DEVICE_ID_3COM_3C579_TP:
|
||||
sc->stat = F_ACCESS_32_BITS;
|
||||
break;
|
||||
}
|
||||
|
||||
ep_get_media(sc);
|
||||
@ -229,16 +218,14 @@ ep_eisa_attach(device_t dev)
|
||||
device_printf(dev, "ep_attach() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, ep_intr,
|
||||
sc, &sc->ep_intrhand))) {
|
||||
sc, &sc->ep_intrhand))) {
|
||||
device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
bad:
|
||||
bad:
|
||||
if (eisa_io)
|
||||
bus_release_resource(dev, SYS_RES_IOPORT, 0, eisa_io);
|
||||
|
||||
@ -248,11 +235,11 @@ ep_eisa_attach(device_t dev)
|
||||
|
||||
static device_method_t ep_eisa_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, ep_eisa_probe),
|
||||
DEVMETHOD(device_attach, ep_eisa_attach),
|
||||
DEVMETHOD(device_detach, ep_detach),
|
||||
DEVMETHOD(device_probe, ep_eisa_probe),
|
||||
DEVMETHOD(device_attach, ep_eisa_attach),
|
||||
DEVMETHOD(device_detach, ep_detach),
|
||||
|
||||
{ 0, 0 }
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static driver_t ep_eisa_driver = {
|
||||
|
@ -26,25 +26,25 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/if_media.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
#include <isa/isavar.h>
|
||||
|
||||
@ -56,18 +56,19 @@
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
static u_int16_t get_eeprom_data (int, int);
|
||||
static void ep_isa_identify (driver_t *, device_t);
|
||||
static u_int16_t get_eeprom_data(int, int);
|
||||
static void ep_isa_identify(driver_t *, device_t);
|
||||
#endif
|
||||
static int ep_isa_probe (device_t);
|
||||
static int ep_isa_attach (device_t);
|
||||
static int ep_eeprom_cksum (struct ep_softc *);
|
||||
|
||||
static int ep_isa_probe(device_t);
|
||||
static int ep_isa_attach(device_t);
|
||||
static int ep_eeprom_cksum(struct ep_softc *);
|
||||
|
||||
struct isa_ident {
|
||||
u_int32_t id;
|
||||
char * name;
|
||||
u_int32_t id;
|
||||
char *name;
|
||||
};
|
||||
const char * ep_isa_match_id (u_int32_t, struct isa_ident *);
|
||||
const char *ep_isa_match_id(u_int32_t, struct isa_ident *);
|
||||
|
||||
#define ISA_ID_3C509_XXX 0x0506d509
|
||||
#define ISA_ID_3C509_TP 0x506d5090
|
||||
@ -82,27 +83,27 @@ const char * ep_isa_match_id (u_int32_t, struct isa_ident *);
|
||||
|
||||
#ifdef __i386__
|
||||
static struct isa_ident ep_isa_devs[] = {
|
||||
{ ISA_ID_3C509_TP, "3Com 3C509-TP EtherLink III" },
|
||||
{ ISA_ID_3C509_BNC, "3Com 3C509-BNC EtherLink III" },
|
||||
{ ISA_ID_3C509_COMBO, "3Com 3C509-Combo EtherLink III" },
|
||||
{ ISA_ID_3C509_TPO, "3Com 3C509-TPO EtherLink III" },
|
||||
{ ISA_ID_3C509_TPC, "3Com 3C509-TPC EtherLink III" },
|
||||
{ISA_ID_3C509_TP, "3Com 3C509-TP EtherLink III"},
|
||||
{ISA_ID_3C509_BNC, "3Com 3C509-BNC EtherLink III"},
|
||||
{ISA_ID_3C509_COMBO, "3Com 3C509-Combo EtherLink III"},
|
||||
{ISA_ID_3C509_TPO, "3Com 3C509-TPO EtherLink III"},
|
||||
{ISA_ID_3C509_TPC, "3Com 3C509-TPC EtherLink III"},
|
||||
#ifdef PC98
|
||||
{ ISA_ID_3C569B_COMBO, "3Com 3C569B-J-Combo EtherLink III" },
|
||||
{ ISA_ID_3C569B_TPO, "3Com 3C569B-J-TPO EtherLink III" },
|
||||
{ISA_ID_3C569B_COMBO, "3Com 3C569B-J-Combo EtherLink III"},
|
||||
{ISA_ID_3C569B_TPO, "3Com 3C569B-J-TPO EtherLink III"},
|
||||
#endif
|
||||
{ 0, NULL },
|
||||
{0, NULL},
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct isa_pnp_id ep_ids[] = {
|
||||
{ 0x90506d50, "3Com 3C509B-TP EtherLink III (PnP)" }, /* TCM5090 */
|
||||
{ 0x91506d50, "3Com 3C509B-BNC EtherLink III (PnP)" },/* TCM5091 */
|
||||
{ 0x94506d50, "3Com 3C509B-Combo EtherLink III (PnP)" },/* TCM5094 */
|
||||
{ 0x95506d50, "3Com 3C509B-TPO EtherLink III (PnP)" },/* TCM5095 */
|
||||
{ 0x98506d50, "3Com 3C509B-TPC EtherLink III (PnP)" },/* TCM5098 */
|
||||
{ 0xf780d041, NULL }, /* PNP80f7 */
|
||||
{ 0, NULL },
|
||||
{0x90506d50, "3Com 3C509B-TP EtherLink III (PnP)"}, /* TCM5090 */
|
||||
{0x91506d50, "3Com 3C509B-BNC EtherLink III (PnP)"}, /* TCM5091 */
|
||||
{0x94506d50, "3Com 3C509B-Combo EtherLink III (PnP)"}, /* TCM5094 */
|
||||
{0x95506d50, "3Com 3C509B-TPO EtherLink III (PnP)"}, /* TCM5095 */
|
||||
{0x98506d50, "3Com 3C509B-TPC EtherLink III (PnP)"}, /* TCM5098 */
|
||||
{0xf780d041, NULL}, /* PNP80f7 */
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
/*
|
||||
@ -119,14 +120,12 @@ static struct isa_pnp_id ep_ids[] = {
|
||||
*/
|
||||
#ifdef __i386__
|
||||
static u_int16_t
|
||||
get_eeprom_data(id_port, offset)
|
||||
int id_port;
|
||||
int offset;
|
||||
get_eeprom_data(int id_port, int offset)
|
||||
{
|
||||
int i;
|
||||
u_int16_t data = 0;
|
||||
int i;
|
||||
u_int16_t data = 0;
|
||||
|
||||
outb(id_port, EEPROM_CMD_RD|offset);
|
||||
outb(id_port, EEPROM_CMD_RD | offset);
|
||||
DELAY(BIT_DELAY_MULTIPLE * 1000);
|
||||
for (i = 0; i < 16; i++) {
|
||||
DELAY(50);
|
||||
@ -137,41 +136,39 @@ get_eeprom_data(id_port, offset)
|
||||
#endif
|
||||
|
||||
const char *
|
||||
ep_isa_match_id (id, isa_devs)
|
||||
u_int32_t id;
|
||||
struct isa_ident * isa_devs;
|
||||
ep_isa_match_id(u_int32_t id, struct isa_ident *isa_devs)
|
||||
{
|
||||
struct isa_ident * i = isa_devs;
|
||||
while(i->name != NULL) {
|
||||
if (id == i->id)
|
||||
return (i->name);
|
||||
i++;
|
||||
struct isa_ident *i = isa_devs;
|
||||
|
||||
while (i->name != NULL) {
|
||||
if (id == i->id)
|
||||
return (i->name);
|
||||
i++;
|
||||
}
|
||||
/*
|
||||
* If we see a card that is likely to be a 3c509
|
||||
* return something so that it will work; be annoying
|
||||
* so that the user will tell us about it though.
|
||||
*/
|
||||
if ((id >> 4) == ISA_ID_3C509_XXX) {
|
||||
if ((id >> 4) == ISA_ID_3C509_XXX)
|
||||
return ("Unknown 3c509; notify maintainer!");
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
static void
|
||||
ep_isa_identify (driver_t *driver, device_t parent)
|
||||
ep_isa_identify(driver_t * driver, device_t parent)
|
||||
{
|
||||
int tag = EP_LAST_TAG;
|
||||
int found = 0;
|
||||
int i;
|
||||
int j;
|
||||
const char * desc;
|
||||
u_int16_t data;
|
||||
u_int32_t irq;
|
||||
u_int32_t ioport;
|
||||
u_int32_t isa_id;
|
||||
device_t child;
|
||||
int tag = EP_LAST_TAG;
|
||||
int found = 0;
|
||||
int i;
|
||||
int j;
|
||||
const char *desc;
|
||||
u_int16_t data;
|
||||
u_int32_t irq;
|
||||
u_int32_t ioport;
|
||||
u_int32_t isa_id;
|
||||
device_t child;
|
||||
|
||||
outb(ELINK_ID_PORT, 0);
|
||||
outb(ELINK_ID_PORT, 0);
|
||||
@ -187,27 +184,22 @@ ep_isa_identify (driver_t *driver, device_t parent)
|
||||
elink_idseq(ELINK_509_POLY);
|
||||
DELAY(400);
|
||||
|
||||
/* For the first probe, clear all
|
||||
* board's tag registers.
|
||||
* Otherwise kill off already-found
|
||||
* boards. -- linux 3c509.c
|
||||
/*
|
||||
* For the first probe, clear all board's tag registers.
|
||||
* Otherwise kill off already-found boards. -- linux 3c509.c
|
||||
*/
|
||||
if (i == 0) {
|
||||
if (i == 0)
|
||||
outb(ELINK_ID_PORT, 0xd0);
|
||||
} else {
|
||||
else
|
||||
outb(ELINK_ID_PORT, 0xd8);
|
||||
}
|
||||
|
||||
/* Get out of loop if we're out of cards. */
|
||||
data = get_eeprom_data(ELINK_ID_PORT, EEPROM_MFG_ID);
|
||||
if (data != MFG_ID) {
|
||||
if (data != MFG_ID)
|
||||
break;
|
||||
}
|
||||
|
||||
/* resolve contention using the Ethernet address */
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (j = 0; j < 3; j++)
|
||||
(void)get_eeprom_data(ELINK_ID_PORT, j);
|
||||
}
|
||||
|
||||
/*
|
||||
* Construct an 'isa_id' in 'EISA'
|
||||
@ -221,13 +213,11 @@ ep_isa_identify (driver_t *driver, device_t parent)
|
||||
/* Find known ISA boards */
|
||||
desc = ep_isa_match_id(isa_id, ep_isa_devs);
|
||||
if (!desc) {
|
||||
if (bootverbose) {
|
||||
if (bootverbose)
|
||||
device_printf(parent, "if_ep: unknown ID 0x%08x\n",
|
||||
isa_id);
|
||||
}
|
||||
isa_id);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Retreive IRQ */
|
||||
data = get_eeprom_data(ELINK_ID_PORT, EEPROM_RESOURCE_CFG);
|
||||
irq = (data >> 12);
|
||||
@ -242,27 +232,30 @@ ep_isa_identify (driver_t *driver, device_t parent)
|
||||
|
||||
if ((data & ADDR_CFG_MASK) == ADDR_CFG_EISA) {
|
||||
device_printf(parent, "if_ep: <%s> at port 0x%03x in EISA mode!\n",
|
||||
desc, ioport);
|
||||
/* Set the adaptor tag so that the next card can be found. */
|
||||
desc, ioport);
|
||||
/*
|
||||
* Set the adaptor tag so that the next card can be
|
||||
* found.
|
||||
*/
|
||||
outb(ELINK_ID_PORT, tag--);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Test for an adapter with PnP support. */
|
||||
data = get_eeprom_data(ELINK_ID_PORT, EEPROM_CAP);
|
||||
if (data == CAP_ISA) {
|
||||
data = get_eeprom_data(ELINK_ID_PORT, EEPROM_INT_CONFIG_1);
|
||||
if (data & ICW1_IAS_PNP) {
|
||||
if (bootverbose) {
|
||||
if (bootverbose)
|
||||
device_printf(parent, "if_ep: <%s> at 0x%03x in PnP mode!\n",
|
||||
desc, ioport);
|
||||
}
|
||||
/* Set the adaptor tag so that the next card can be found. */
|
||||
desc, ioport);
|
||||
/*
|
||||
* Set the adaptor tag so that the next card
|
||||
* can be found.
|
||||
*/
|
||||
outb(ELINK_ID_PORT, tag--);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the adaptor tag so that the next card can be found. */
|
||||
outb(ELINK_ID_PORT, tag--);
|
||||
|
||||
@ -274,66 +267,57 @@ ep_isa_identify (driver_t *driver, device_t parent)
|
||||
data = inw(ioport + EP_W0_EEPROM_COMMAND);
|
||||
if (data & EEPROM_TST_MODE) {
|
||||
device_printf(parent, "if_ep: <%s> at port 0x%03x in TEST mode! Erase pencil mark.\n",
|
||||
desc, ioport);
|
||||
desc, ioport);
|
||||
continue;
|
||||
}
|
||||
|
||||
child = BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "ep", -1);
|
||||
device_set_desc_copy(child, desc);
|
||||
device_set_driver(child, driver);
|
||||
bus_set_resource(child, SYS_RES_IRQ, 0, irq, 1);
|
||||
bus_set_resource(child, SYS_RES_IOPORT, 0, ioport, EP_IOSIZE);
|
||||
|
||||
if (bootverbose) {
|
||||
if (bootverbose)
|
||||
device_printf(parent, "if_ep: <%s> at port 0x%03x-0x%03x irq %d\n",
|
||||
desc, ioport, ioport + EP_IOSIZE, irq);
|
||||
}
|
||||
|
||||
desc, ioport, ioport + EP_IOSIZE, irq);
|
||||
found++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
ep_isa_probe (device_t dev)
|
||||
ep_isa_probe(device_t dev)
|
||||
{
|
||||
int error = 0;
|
||||
int error = 0;
|
||||
|
||||
/* Check isapnp ids */
|
||||
error = ISA_PNP_PROBE(device_get_parent(dev), dev, ep_ids);
|
||||
|
||||
/* If the card had a PnP ID that didn't match any we know about */
|
||||
if (error == ENXIO) {
|
||||
return (error);
|
||||
}
|
||||
if (error == ENXIO)
|
||||
return (error);
|
||||
|
||||
/* If we had some other problem. */
|
||||
if (!(error == 0 || error == ENOENT)) {
|
||||
if (!(error == 0 || error == ENOENT))
|
||||
return (error);
|
||||
}
|
||||
|
||||
/* If we have the resources we need then we're good to go. */
|
||||
if ((bus_get_resource_start(dev, SYS_RES_IOPORT, 0) != 0) &&
|
||||
(bus_get_resource_start(dev, SYS_RES_IRQ, 0) != 0)) {
|
||||
(bus_get_resource_start(dev, SYS_RES_IRQ, 0) != 0))
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
static int
|
||||
ep_isa_attach (device_t dev)
|
||||
ep_isa_attach(device_t dev)
|
||||
{
|
||||
struct ep_softc * sc = device_get_softc(dev);
|
||||
int error = 0;
|
||||
struct ep_softc *sc = device_get_softc(dev);
|
||||
int error = 0;
|
||||
|
||||
if ((error = ep_alloc(dev))) {
|
||||
device_printf(dev, "ep_alloc() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
ep_get_media(sc);
|
||||
|
||||
GO_WINDOW(0);
|
||||
@ -343,19 +327,16 @@ ep_isa_attach (device_t dev)
|
||||
device_printf(dev, "ep_attach() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
error = ep_eeprom_cksum(sc);
|
||||
if (error) {
|
||||
device_printf(sc->dev, "Invalid EEPROM checksum!\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, ep_intr,
|
||||
sc, &sc->ep_intrhand))) {
|
||||
sc, &sc->ep_intrhand))) {
|
||||
device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
return (0);
|
||||
bad:
|
||||
ep_free(dev);
|
||||
@ -363,19 +344,18 @@ ep_isa_attach (device_t dev)
|
||||
}
|
||||
|
||||
static int
|
||||
ep_eeprom_cksum (sc)
|
||||
struct ep_softc * sc;
|
||||
ep_eeprom_cksum(struct ep_softc *sc)
|
||||
{
|
||||
int i;
|
||||
int error;
|
||||
u_int16_t val;
|
||||
u_int16_t cksum;
|
||||
u_int8_t cksum_high = 0;
|
||||
u_int8_t cksum_low = 0;
|
||||
int i;
|
||||
int error;
|
||||
u_int16_t val;
|
||||
u_int16_t cksum;
|
||||
u_int8_t cksum_high = 0;
|
||||
u_int8_t cksum_low = 0;
|
||||
|
||||
error = get_e(sc, 0x0f, &val);
|
||||
if (error)
|
||||
return (ENXIO);
|
||||
return (ENXIO);
|
||||
cksum = val;
|
||||
|
||||
for (i = 0; i < 0x0f; i++) {
|
||||
@ -383,31 +363,31 @@ ep_eeprom_cksum (sc)
|
||||
if (error)
|
||||
return (ENXIO);
|
||||
switch (i) {
|
||||
case 0x08:
|
||||
case 0x09:
|
||||
case 0x0d:
|
||||
cksum_low ^= (u_int8_t)(val & 0x00ff) ^
|
||||
(u_int8_t)((val & 0xff00) >> 8);
|
||||
break;
|
||||
default:
|
||||
cksum_high ^= (u_int8_t)(val & 0x00ff) ^
|
||||
(u_int8_t)((val & 0xff00) >> 8);
|
||||
break;
|
||||
case 0x08:
|
||||
case 0x09:
|
||||
case 0x0d:
|
||||
cksum_low ^= (u_int8_t) (val & 0x00ff) ^
|
||||
(u_int8_t) ((val & 0xff00) >> 8);
|
||||
break;
|
||||
default:
|
||||
cksum_high ^= (u_int8_t) (val & 0x00ff) ^
|
||||
(u_int8_t) ((val & 0xff00) >> 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return (cksum != ((u_int16_t)cksum_low | (u_int16_t)(cksum_high << 8)));
|
||||
return (cksum != ((u_int16_t) cksum_low | (u_int16_t) (cksum_high << 8)));
|
||||
}
|
||||
|
||||
static device_method_t ep_isa_methods[] = {
|
||||
/* Device interface */
|
||||
#ifdef __i386__
|
||||
DEVMETHOD(device_identify, ep_isa_identify),
|
||||
DEVMETHOD(device_identify, ep_isa_identify),
|
||||
#endif
|
||||
DEVMETHOD(device_probe, ep_isa_probe),
|
||||
DEVMETHOD(device_attach, ep_isa_attach),
|
||||
DEVMETHOD(device_detach, ep_detach),
|
||||
DEVMETHOD(device_probe, ep_isa_probe),
|
||||
DEVMETHOD(device_attach, ep_isa_attach),
|
||||
DEVMETHOD(device_detach, ep_detach),
|
||||
|
||||
{ 0, 0 }
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static driver_t ep_isa_driver = {
|
||||
|
@ -22,22 +22,22 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <net/if.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
@ -54,22 +54,22 @@
|
||||
#define EP_MCA_62F7 0x62f7
|
||||
|
||||
static struct mca_ident ep_mca_devs[] = {
|
||||
{ EP_MCA_627C, "3Com 3C529 Network Adapter" },
|
||||
{ EP_MCA_627D, "3Com 3C529-TP Network Adapter" },
|
||||
{EP_MCA_627C, "3Com 3C529 Network Adapter"},
|
||||
{EP_MCA_627D, "3Com 3C529-TP Network Adapter"},
|
||||
|
||||
/*
|
||||
* These are from the linux 3c509 driver.
|
||||
* I have not seen the ADFs for them and have
|
||||
* I have not seen the ADFs for them and have
|
||||
* not tested or even seen the hardware.
|
||||
* Someone with the ADFs should replace the names with
|
||||
* whatever is in the AdapterName field of the ADF.
|
||||
* (and fix the media setup for the cards as well.)
|
||||
*/
|
||||
{ EP_MCA_62DB, "3Com 3c529 EtherLink III (test mode)" },
|
||||
{ EP_MCA_62F6, "3Com 3c529 EtherLink III (TP or coax)" },
|
||||
{ EP_MCA_62F7, "3Com 3c529 EtherLink III (TP)" },
|
||||
{EP_MCA_62DB, "3Com 3c529 EtherLink III (test mode)"},
|
||||
{EP_MCA_62F6, "3Com 3c529 EtherLink III (TP or coax)"},
|
||||
{EP_MCA_62F7, "3Com 3c529 EtherLink III (TP)"},
|
||||
|
||||
{ 0, NULL },
|
||||
{0, NULL},
|
||||
};
|
||||
|
||||
#define EP_MCA_IOPORT_POS MCA_ADP_POS(MCA_POS2)
|
||||
@ -87,12 +87,12 @@ static struct mca_ident ep_mca_devs[] = {
|
||||
#define EP_MCA_MEDIA(pos) (pos & EP_MCA_MEDIA_MASK)
|
||||
|
||||
static int
|
||||
ep_mca_probe (device_t dev)
|
||||
ep_mca_probe(device_t dev)
|
||||
{
|
||||
const char * desc;
|
||||
u_int32_t iobase = 0;
|
||||
u_int8_t irq = 0;
|
||||
u_int8_t pos;
|
||||
const char *desc;
|
||||
u_int32_t iobase = 0;
|
||||
u_int8_t irq = 0;
|
||||
u_int8_t pos;
|
||||
|
||||
desc = mca_match_id(mca_get_id(dev), ep_mca_devs);
|
||||
if (!desc)
|
||||
@ -112,10 +112,10 @@ ep_mca_probe (device_t dev)
|
||||
}
|
||||
|
||||
static int
|
||||
ep_mca_attach (device_t dev)
|
||||
ep_mca_attach(device_t dev)
|
||||
{
|
||||
struct ep_softc * sc = device_get_softc(dev);
|
||||
int error = 0;
|
||||
struct ep_softc *sc = device_get_softc(dev);
|
||||
int error = 0;
|
||||
|
||||
if ((error = ep_alloc(dev))) {
|
||||
device_printf(dev, "ep_alloc() failed! (%d)\n", error);
|
||||
@ -132,13 +132,11 @@ ep_mca_attach (device_t dev)
|
||||
device_printf(dev, "ep_attach() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, ep_intr,
|
||||
sc, &sc->ep_intrhand))) {
|
||||
sc, &sc->ep_intrhand))) {
|
||||
device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
return (0);
|
||||
bad:
|
||||
ep_free(dev);
|
||||
@ -147,11 +145,11 @@ ep_mca_attach (device_t dev)
|
||||
|
||||
static device_method_t ep_mca_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, ep_mca_probe),
|
||||
DEVMETHOD(device_attach, ep_mca_attach),
|
||||
DEVMETHOD(device_detach, ep_detach),
|
||||
DEVMETHOD(device_probe, ep_mca_probe),
|
||||
DEVMETHOD(device_attach, ep_mca_attach),
|
||||
DEVMETHOD(device_detach, ep_detach),
|
||||
|
||||
{ 0, 0 }
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static driver_t ep_mca_driver = {
|
||||
|
@ -26,8 +26,6 @@
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -36,28 +34,30 @@
|
||||
* nao@tom-yam.or.jp
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <net/if_media.h>
|
||||
|
||||
|
||||
#include <dev/ep/if_epreg.h>
|
||||
#include <dev/ep/if_epvar.h>
|
||||
|
||||
#include <dev/pccard/pccardvar.h>
|
||||
#include <dev/pccard/pccarddevs.h>
|
||||
|
||||
#include "card_if.h"
|
||||
|
||||
static const char *ep_pccard_identify(u_short id);
|
||||
@ -68,22 +68,22 @@ static const char *ep_pccard_identify(u_short id);
|
||||
static int
|
||||
ep_pccard_probe(device_t dev)
|
||||
{
|
||||
struct ep_softc * sc = device_get_softc(dev);
|
||||
struct ep_board * epb = &sc->epb;
|
||||
const char * desc;
|
||||
u_int16_t result;
|
||||
int error;
|
||||
struct ep_softc *sc = device_get_softc(dev);
|
||||
struct ep_board *epb = &sc->epb;
|
||||
const char *desc;
|
||||
u_int16_t result;
|
||||
int error;
|
||||
|
||||
error = ep_alloc(dev);
|
||||
if (error)
|
||||
return error;
|
||||
return (error);
|
||||
|
||||
/*
|
||||
* XXX - Certain (newer?) 3Com cards need epb->cmd_off ==
|
||||
* 2. Sadly, you need to have a correct cmd_off in order to
|
||||
* identify the card. So we have to hit it with both and
|
||||
* cross our virtual fingers. There's got to be a better way
|
||||
* to do this. jyoung@accessus.net 09/11/1999
|
||||
* to do this. jyoung@accessus.net 09/11/1999
|
||||
*/
|
||||
|
||||
epb->cmd_off = 0;
|
||||
@ -92,7 +92,7 @@ ep_pccard_probe(device_t dev)
|
||||
epb->prod_id = result;
|
||||
|
||||
if ((desc = ep_pccard_identify(epb->prod_id)) == NULL) {
|
||||
if (bootverbose)
|
||||
if (bootverbose)
|
||||
device_printf(dev, "Pass 1 of 2 detection "
|
||||
"failed (nonfatal) id 0x%x\n", epb->prod_id);
|
||||
epb->cmd_off = 2;
|
||||
@ -121,57 +121,58 @@ ep_pccard_identify(u_short id)
|
||||
{
|
||||
/* Determine device type and associated MII capabilities */
|
||||
switch (id) {
|
||||
case 0x6055: /* 3C556 */
|
||||
case 0x6055: /* 3C556 */
|
||||
return ("3Com 3C556");
|
||||
case 0x4057: /* 3C574 */
|
||||
case 0x4057: /* 3C574 */
|
||||
return ("3Com 3C574");
|
||||
case 0x4b57: /* 3C574B */
|
||||
case 0x4b57: /* 3C574B */
|
||||
return ("3Com 3C574B, Megahertz 3CCFE574BT or "
|
||||
"Fast Etherlink 3C574-TX");
|
||||
case 0x2b57: /* 3CXSH572BT */
|
||||
case 0x2b57: /* 3CXSH572BT */
|
||||
return ("3Com OfficeConnect 572BT");
|
||||
case 0x9058: /* 3C589 */
|
||||
case 0x9058: /* 3C589 */
|
||||
return ("3Com Etherlink III 3C589");
|
||||
case 0x2056: /* 3C562/3C563 */
|
||||
case 0x2056: /* 3C562/3C563 */
|
||||
return ("3Com 3C562D/3C563D");
|
||||
case 0x0010: /* 3C1 */
|
||||
case 0x0010: /* 3C1 */
|
||||
return ("3Com Megahertz C1");
|
||||
default:
|
||||
return (NULL);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
ep_pccard_card_attach(struct ep_board *epb)
|
||||
ep_pccard_card_attach(struct ep_board * epb)
|
||||
{
|
||||
/* Determine device type and associated MII capabilities */
|
||||
switch (epb->prod_id) {
|
||||
case 0x6055: /* 3C556 */
|
||||
case 0x2b57: /* 3C572BT */
|
||||
case 0x4057: /* 3C574 */
|
||||
case 0x4b57: /* 3C574B */
|
||||
case 0x0010: /* 3C1 */
|
||||
case 0x6055: /* 3C556 */
|
||||
case 0x2b57: /* 3C572BT */
|
||||
case 0x4057: /* 3C574 */
|
||||
case 0x4b57: /* 3C574B */
|
||||
case 0x0010: /* 3C1 */
|
||||
epb->mii_trans = 1;
|
||||
return (1);
|
||||
case 0x2056: /* 3C562D/3C563D */
|
||||
case 0x9058: /* 3C589 */
|
||||
case 0x2056: /* 3C562D/3C563D */
|
||||
case 0x9058: /* 3C589 */
|
||||
epb->mii_trans = 0;
|
||||
return (1);
|
||||
default:
|
||||
return (0);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
ep_pccard_attach(device_t dev)
|
||||
{
|
||||
struct ep_softc * sc = device_get_softc(dev);
|
||||
u_int16_t result;
|
||||
int error = 0;
|
||||
struct ep_softc *sc = device_get_softc(dev);
|
||||
u_int16_t result;
|
||||
int error = 0;
|
||||
|
||||
if ((error = ep_alloc(dev))) {
|
||||
device_printf(dev, "ep_alloc() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
sc->epb.cmd_off = 0;
|
||||
|
||||
error = get_e(sc, EEPROM_PROD_ID, &result); /* XXX check return */
|
||||
@ -190,7 +191,6 @@ ep_pccard_attach(device_t dev)
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
|
||||
error = get_e(sc, EEPROM_ADDR_CFG, &result);
|
||||
|
||||
/* ROM size = 0, ROM base = 0 */
|
||||
@ -215,21 +215,18 @@ ep_pccard_attach(device_t dev)
|
||||
while (inw(BASE + EP_STATUS) & S_COMMAND_IN_PROGRESS);
|
||||
DELAY(1000);
|
||||
outw(BASE + EP_W3_OPTIONS, 0x8040);
|
||||
} else {
|
||||
} else
|
||||
ep_get_media(sc);
|
||||
}
|
||||
|
||||
if ((error = ep_attach(sc))) {
|
||||
device_printf(dev, "ep_attach() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
if ((error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET, ep_intr,
|
||||
sc, &sc->ep_intrhand))) {
|
||||
sc, &sc->ep_intrhand))) {
|
||||
device_printf(dev, "bus_setup_intr() failed! (%d)\n", error);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
return (0);
|
||||
bad:
|
||||
ep_free(dev);
|
||||
@ -239,12 +236,12 @@ ep_pccard_attach(device_t dev)
|
||||
static const struct pccard_product ep_pccard_products[] = {
|
||||
PCMCIA_CARD(3COM, 3C1, 0),
|
||||
PCMCIA_CARD(3COM, 3C562, 0),
|
||||
PCMCIA_CARD(3COM, 3C574, 0), /* ROADRUNNER */
|
||||
PCMCIA_CARD(3COM, 3C574, 0), /* ROADRUNNER */
|
||||
PCMCIA_CARD(3COM, 3C589, 0),
|
||||
PCMCIA_CARD(3COM, 3CCFEM556BI, 0), /* ROADRUNNER */
|
||||
PCMCIA_CARD(3COM, 3CXEM556, 0),
|
||||
PCMCIA_CARD(3COM, 3CXEM556INT, 0),
|
||||
{ NULL }
|
||||
{NULL}
|
||||
};
|
||||
|
||||
static int
|
||||
@ -253,7 +250,7 @@ ep_pccard_match(device_t dev)
|
||||
const struct pccard_product *pp;
|
||||
|
||||
if ((pp = pccard_product_lookup(dev, ep_pccard_products,
|
||||
sizeof(ep_pccard_products[0]), NULL)) != NULL) {
|
||||
sizeof(ep_pccard_products[0]), NULL)) != NULL) {
|
||||
if (pp->pp_name != NULL)
|
||||
device_set_desc(dev, pp->pp_name);
|
||||
return 0;
|
||||
@ -263,16 +260,16 @@ ep_pccard_match(device_t dev)
|
||||
|
||||
static device_method_t ep_pccard_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, pccard_compat_probe),
|
||||
DEVMETHOD(device_attach, pccard_compat_attach),
|
||||
DEVMETHOD(device_detach, ep_detach),
|
||||
DEVMETHOD(device_probe, pccard_compat_probe),
|
||||
DEVMETHOD(device_attach, pccard_compat_attach),
|
||||
DEVMETHOD(device_detach, ep_detach),
|
||||
|
||||
/* Card interface */
|
||||
DEVMETHOD(card_compat_match, ep_pccard_match),
|
||||
DEVMETHOD(card_compat_probe, ep_pccard_probe),
|
||||
DEVMETHOD(card_compat_attach, ep_pccard_attach),
|
||||
DEVMETHOD(card_compat_match, ep_pccard_match),
|
||||
DEVMETHOD(card_compat_probe, ep_pccard_probe),
|
||||
DEVMETHOD(card_compat_attach, ep_pccard_attach),
|
||||
|
||||
{ 0, 0 }
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
static driver_t ep_pccard_driver = {
|
||||
|
@ -35,7 +35,7 @@
|
||||
#define TX_INIT_RATE 16
|
||||
#define TX_INIT_MAX_RATE 64
|
||||
#define RX_INIT_LATENCY 64
|
||||
#define RX_INIT_EARLY_THRESH 208 /* not less than MINCLSIZE */
|
||||
#define RX_INIT_EARLY_THRESH 208/* not less than MINCLSIZE */
|
||||
#define RX_NEXT_EARLY_THRESH 500
|
||||
|
||||
#define EEPROMSIZE 0x40
|
||||
@ -94,13 +94,13 @@
|
||||
#define EEPROM_NODE_ADDR_1 0x1 /* Word */
|
||||
#define EEPROM_NODE_ADDR_2 0x2 /* Word */
|
||||
#define EEPROM_PROD_ID 0x3 /* 0x9[0-f]50 */
|
||||
#define EEPROM_MFG_DATE 0x4 /* Manufacturing date */
|
||||
#define EEPROM_MFG_DIVSION 0x5 /* Manufacturing division */
|
||||
#define EEPROM_MFG_PRODUCT 0x6 /* Product code */
|
||||
#define EEPROM_MFG_DATE 0x4 /* Manufacturing date */
|
||||
#define EEPROM_MFG_DIVSION 0x5 /* Manufacturing division */
|
||||
#define EEPROM_MFG_PRODUCT 0x6 /* Product code */
|
||||
#define EEPROM_MFG_ID 0x7 /* 0x6d50 */
|
||||
#define EEPROM_ADDR_CFG 0x8 /* Base addr */
|
||||
# define ADDR_CFG_EISA 0x1f
|
||||
# define ADDR_CFG_MASK 0x1f
|
||||
#define ADDR_CFG_EISA 0x1f
|
||||
#define ADDR_CFG_MASK 0x1f
|
||||
#define EEPROM_RESOURCE_CFG 0x9 /* IRQ. Bits 12-15 */
|
||||
#define EEPROM_OEM_ADDR0 0xa
|
||||
#define EEPROM_OEM_ADDR1 0xb
|
||||
@ -109,22 +109,24 @@
|
||||
#define EEPROM_COMPAT 0xe
|
||||
#define EEPROM_SOFTINFO2 0xf
|
||||
#define EEPROM_CAP 0x10
|
||||
# define CAP_ISA 0x2083
|
||||
# define CAP_PCMCIA 0x2082
|
||||
#define CAP_ISA 0x2083
|
||||
#define CAP_PCMCIA 0x2082
|
||||
#define EEPROM_INT_CONFIG_0 0x12
|
||||
#define EEPROM_INT_CONFIG_1 0x13
|
||||
/* RAM Partition TX FIFO/RX FIFO */
|
||||
# define ICW1_RAM_PART_MASK 0x03
|
||||
# define ICW1_RAM_PART_35 0x00 /* 2:5 (only legal if RAM size == 000b default power-up/reset */
|
||||
# define ICW1_RAM_PART_13 0x01 /* 1:3 (only legal if RAM size == 000b) */
|
||||
# define ICW1_RAM_PART_11 0x10 /* 1:1 */
|
||||
# define ICW1_RAM_PART_RESV 0x11 /* Reserved */
|
||||
#define ICW1_RAM_PART_MASK 0x03
|
||||
#define ICW1_RAM_PART_35 0x00 /* 2:5 (only legal if RAM size == 000b
|
||||
* default power-up/reset */
|
||||
#define ICW1_RAM_PART_13 0x01 /* 1:3 (only legal if RAM size ==
|
||||
* 000b) */
|
||||
#define ICW1_RAM_PART_11 0x10 /* 1:1 */
|
||||
#define ICW1_RAM_PART_RESV 0x11 /* Reserved */
|
||||
/* ISA Adapter Selection */
|
||||
# define ICW1_IAS_MASK 0x0c
|
||||
# define ICW1_IAS_DIS 0x00 /* Both mechanisms disabled (default) */
|
||||
# define ICW1_IAS_ISA 0x04 /* ISA contention only */
|
||||
# define ICW1_IAS_PNP 0x08 /* ISA Plug and Play only */
|
||||
# define ICW1_IAS_BOTH 0x0c /* Both mechanisms enabled */
|
||||
#define ICW1_IAS_MASK 0x0c
|
||||
#define ICW1_IAS_DIS 0x00 /* Both mechanisms disabled (default) */
|
||||
#define ICW1_IAS_ISA 0x04 /* ISA contention only */
|
||||
#define ICW1_IAS_PNP 0x08 /* ISA Plug and Play only */
|
||||
#define ICW1_IAS_BOTH 0x0c /* Both mechanisms enabled */
|
||||
|
||||
#define EEPROM_CHECKSUM_EL3 0x17
|
||||
|
||||
@ -233,13 +235,13 @@
|
||||
*
|
||||
****************************************/
|
||||
|
||||
/*
|
||||
/*
|
||||
* Command parameter that disables threshold interrupts
|
||||
* PIO (3c509) cards use 2044. The fifo word-oriented and 2044--2047 work.
|
||||
* "busmastering" cards need 8188.
|
||||
* The implicit two-bit upshift done by busmastering cards means
|
||||
* a value of 2047 disables threshold interrupts on both.
|
||||
*/
|
||||
*/
|
||||
#define EP_THRESH_DISABLE 2047
|
||||
|
||||
/*
|
||||
@ -294,7 +296,7 @@
|
||||
#define C_RX_EARLY (u_short) (ACK_INTR|0x20)
|
||||
#define C_INT_RQD (u_short) (ACK_INTR|0x40)
|
||||
#define C_UPD_STATS (u_short) (ACK_INTR|0x80)
|
||||
#define C_MASK (u_short) 0xFF /* mask of C_* */
|
||||
#define C_MASK (u_short) 0xFF /* mask of C_* */
|
||||
|
||||
/*
|
||||
* Status register. All windows.
|
||||
@ -322,7 +324,7 @@
|
||||
#define S_RX_EARLY (u_short) (0x20)
|
||||
#define S_INT_RQD (u_short) (0x40)
|
||||
#define S_UPD_STATS (u_short) (0x80)
|
||||
#define S_MASK (u_short) 0xFF /* mask of S_* */
|
||||
#define S_MASK (u_short) 0xFF /* mask of S_* */
|
||||
#define S_5_INTS (S_CARD_FAILURE|S_TX_COMPLETE|\
|
||||
S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY)
|
||||
#define S_COMMAND_IN_PROGRESS (u_short) (0x1000)
|
||||
@ -343,7 +345,7 @@
|
||||
|
||||
#define SET_IRQ(base,irq) outw((base) + EP_W0_RESOURCE_CFG, \
|
||||
((inw((base) + EP_W0_RESOURCE_CFG) & 0x0fff) | \
|
||||
((u_short)(irq)<<12)) ) /* set IRQ i */
|
||||
((u_short)(irq)<<12)) ) /* set IRQ i */
|
||||
|
||||
/*
|
||||
* FIFO Registers.
|
||||
@ -418,8 +420,9 @@
|
||||
/*
|
||||
* Misc defines for various things.
|
||||
*/
|
||||
#define ACTIVATE_ADAPTER_TO_CONFIG 0xff /* to the id_port */
|
||||
#define MFG_ID 0x6d50 /* in EEPROM and W0 ADDR_CONFIG */
|
||||
#define ACTIVATE_ADAPTER_TO_CONFIG 0xff /* to the id_port */
|
||||
#define MFG_ID 0x6d50 /* in EEPROM and W0
|
||||
* ADDR_CONFIG */
|
||||
#define PROD_ID 0x9150
|
||||
|
||||
#define AUI 0x1
|
||||
|
@ -23,62 +23,62 @@
|
||||
*/
|
||||
|
||||
struct ep_board {
|
||||
u_short prod_id; /* product ID */
|
||||
int cmd_off; /* command offset (bit shift) */
|
||||
int mii_trans; /* activate MII transiever */
|
||||
u_short res_cfg; /* resource configuration */
|
||||
u_short prod_id; /* product ID */
|
||||
int cmd_off; /* command offset (bit shift) */
|
||||
int mii_trans; /* activate MII transiever */
|
||||
u_short res_cfg; /* resource configuration */
|
||||
};
|
||||
|
||||
/*
|
||||
* Ethernet software status per interface.
|
||||
*/
|
||||
struct ep_softc {
|
||||
struct arpcom arpcom; /* Ethernet common part */
|
||||
struct ifmedia ifmedia; /* media info */
|
||||
struct arpcom arpcom; /* Ethernet common part */
|
||||
struct ifmedia ifmedia; /* media info */
|
||||
|
||||
device_t dev;
|
||||
device_t dev;
|
||||
|
||||
struct resource * iobase;
|
||||
struct resource * irq;
|
||||
struct resource *iobase;
|
||||
struct resource *irq;
|
||||
|
||||
bus_space_handle_t ep_bhandle;
|
||||
bus_space_tag_t ep_btag;
|
||||
void * ep_intrhand;
|
||||
bus_space_handle_t ep_bhandle;
|
||||
bus_space_tag_t ep_btag;
|
||||
void *ep_intrhand;
|
||||
|
||||
int ep_io_addr; /* i/o bus address */
|
||||
int ep_io_addr; /* i/o bus address */
|
||||
|
||||
u_short ep_connectors; /* Connectors on this card. */
|
||||
u_char ep_connector; /* Configured connector.*/
|
||||
u_short ep_connectors; /* Connectors on this card. */
|
||||
u_char ep_connector; /* Configured connector. */
|
||||
|
||||
struct mbuf * top;
|
||||
struct mbuf * mcur;
|
||||
short cur_len;
|
||||
struct mbuf *top;
|
||||
struct mbuf *mcur;
|
||||
short cur_len;
|
||||
|
||||
int stat; /* some flags */
|
||||
int stat; /* some flags */
|
||||
#define F_RX_FIRST 0x001
|
||||
#define F_PROMISC 0x008
|
||||
#define F_ACCESS_32_BITS 0x100
|
||||
|
||||
int gone; /* adapter is not present (for PCCARD) */
|
||||
int gone; /* adapter is not present (for PCCARD) */
|
||||
|
||||
struct ep_board epb;
|
||||
struct ep_board epb;
|
||||
|
||||
int unit;
|
||||
int unit;
|
||||
|
||||
#ifdef EP_LOCAL_STATS
|
||||
short tx_underrun;
|
||||
short rx_no_first;
|
||||
short rx_no_mbuf;
|
||||
short rx_overrunf;
|
||||
short rx_overrunl;
|
||||
short tx_underrun;
|
||||
short rx_no_first;
|
||||
short rx_no_mbuf;
|
||||
short rx_overrunf;
|
||||
short rx_overrunl;
|
||||
#endif
|
||||
};
|
||||
|
||||
int ep_alloc (device_t);
|
||||
void ep_free (device_t);
|
||||
int ep_detach (device_t);
|
||||
void ep_get_media (struct ep_softc *);
|
||||
int ep_attach (struct ep_softc *);
|
||||
void ep_intr (void *);
|
||||
int get_e (struct ep_softc *, u_int16_t, u_int16_t *);
|
||||
int ep_get_macaddr (struct ep_softc *, u_char *);
|
||||
int ep_alloc(device_t);
|
||||
void ep_free(device_t);
|
||||
int ep_detach(device_t);
|
||||
void ep_get_media(struct ep_softc *);
|
||||
int ep_attach(struct ep_softc *);
|
||||
void ep_intr(void *);
|
||||
int get_e(struct ep_softc *, u_int16_t, u_int16_t *);
|
||||
int ep_get_macaddr(struct ep_softc *, u_char *);
|
||||
|
Loading…
Reference in New Issue
Block a user