Collect information in a "bootinfo" structure.

This commit is contained in:
drochner 1997-09-17 18:21:40 +00:00
parent c2095ccd48
commit a8c2622575
7 changed files with 77 additions and 38 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: 3c509.c,v 1.2 1997/03/15 22:18:21 perry Exp $ */
/* $NetBSD: 3c509.c,v 1.3 1997/09/17 18:21:40 drochner Exp $ */
/* stripped down from freebsd:sys/i386/netboot/3c509.c */
@ -30,14 +30,14 @@ Author: Martin Renters.
#include <machine/pio.h>
#include <lib/libsa/stand.h>
#include <lib/libkern/libkern.h>
#include <libi386.h>
#include <bootinfo.h>
#include "etherdrv.h"
#include "3c509.h"
char etherdev[20];
int ether_medium;
unsigned short eth_base;
@ -59,6 +59,8 @@ static struct mtabentry {
{1, IS_AUI, "AUI"},
};
static struct btinfo_netif bi_netif;
/**************************************************************************
ETH_PROBE - Look for an adapter
***************************************************************************/
@ -155,10 +157,17 @@ ok:
GO_WINDOW(2);
outw(BASE + EP_W2_ADDR_0 + (i * 2), help);
}
for(i = 0; i < 6; i++) myadr[i] = eth_myaddr[i];
for(i = 0; i < 6; i++)
bi_netif.hw_addr[i] = myadr[i] = eth_myaddr[i];
epreset();
sprintf(etherdev, "ep@isa,0x%x", eth_base);
strncpy(bi_netif.ifname, "ep", sizeof(bi_netif.ifname));
bi_netif.bus = BI_BUS_ISA;
bi_netif.addr = eth_base;
BI_ADD(&bi_netif, BTINFO_NETIF, sizeof(bi_netif));
return(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: 3c590.c,v 1.5 1997/07/15 11:23:07 drochner Exp $ */
/* $NetBSD: 3c590.c,v 1.6 1997/09/17 18:21:41 drochner Exp $ */
/* stripped down from freebsd:sys/i386/netboot/3c509.c */
@ -31,9 +31,11 @@ Author: Martin Renters.
#include <machine/pio.h>
#include <lib/libsa/stand.h>
#include <lib/libkern/libkern.h>
#include <libi386.h>
#include <pcivar.h>
#include <bootinfo.h>
#include "etherdrv.h"
#include "3c509.h"
@ -41,8 +43,6 @@ Author: Martin Renters.
#define EP_W3_INTERNAL_CONFIG 0x00 /* 32 bits */
#define EP_W3_RESET_OPTIONS 0x08 /* 16 bits */
char etherdev[20];
int ether_medium;
unsigned short eth_base;
@ -62,6 +62,8 @@ static struct mtabentry {
{6, 0x40, "MII"},
};
static struct btinfo_netif bi_netif;
/**************************************************************************
ETH_PROBE - Look for an adapter
***************************************************************************/
@ -99,8 +101,6 @@ char *myadr;
}
eth_base = iobase & 0xfffffffc;
ether_medium = ETHERMEDIUM_BNC; /* XXX */
/* test for presence of connectors */
GO_WINDOW(3);
i = inb(IS_BASE + EP_W3_RESET_OPTIONS);
@ -136,9 +136,17 @@ ok:
GO_WINDOW(2);
outw(BASE + EP_W2_ADDR_0 + (i * 2), help);
}
for(i = 0; i < 6; i++) myadr[i] = eth_myaddr[i];
for(i = 0; i < 6; i++)
bi_netif.hw_addr[i] = myadr[i] = eth_myaddr[i];
epreset();
sprintf(etherdev, "ep@pci,0x%x", eth_base);
strncpy(bi_netif.ifname, "ep", sizeof(bi_netif.ifname));
bi_netif.bus = BI_BUS_PCI;
bi_netif.addr = eth_base;
BI_ADD(&bi_netif, BTINFO_NETIF, sizeof(bi_netif));
return(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif_small.c,v 1.4 1997/07/22 17:44:31 drochner Exp $ */
/* $NetBSD: netif_small.c,v 1.5 1997/09/17 18:21:41 drochner Exp $ */
/* minimal netif - for boot ROMs we don't have to select between
several interfaces, and we have to save space
@ -74,8 +74,7 @@ socktodesc(sock)
}
int
netif_open(machdep_hint)
void *machdep_hint;
netif_open()
{
struct iodesc *io;

View File

@ -1,4 +1,4 @@
/* $NetBSD: netif_small.h,v 1.1.1.1 1997/03/14 02:40:33 perry Exp $ */
/* $NetBSD: netif_small.h,v 1.2 1997/09/17 18:21:42 drochner Exp $ */
/*
* Copyright (c) 1995 Gordon W. Ross
@ -41,7 +41,7 @@ struct netif; /* dummy */
int netif_get __P((struct iodesc*, void*, size_t, time_t));
int netif_put __P((struct iodesc*, void*, size_t));
int netif_open __P((void*));
int netif_open __P((void));
int netif_close __P((int));
struct iodesc *socktodesc __P((int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcnet_isapnp.c,v 1.2 1997/03/15 22:20:56 perry Exp $ */
/* $NetBSD: pcnet_isapnp.c,v 1.3 1997/09/17 18:21:43 drochner Exp $ */
/*
* Copyright (c) 1996
@ -35,10 +35,14 @@
#include <sys/types.h>
#include <machine/pio.h>
#include <lib/libsa/stand.h>
#include <lib/libsa/stand.h>
#include <lib/libkern/libkern.h>
#include <libi386.h>
#include <isapnpvar.h>
#include <isadmavar.h>
#include <bootinfo.h>
#include "etherdrv.h"
#include "lance.h"
@ -47,8 +51,6 @@
#define ISAPNPID 0x516e0010 /* TKN0010 */
#endif
char etherdev[20];
int lance_rap, lance_rdp;
u_char eth_myaddr[6];
@ -56,6 +58,8 @@ u_char eth_myaddr[6];
extern void am7990_init __P((void));
extern void am7990_stop __P((void));
static struct btinfo_netif bi_netif;
int EtherInit(myadr)
char *myadr;
{
@ -75,12 +79,17 @@ char *myadr;
am7990_stop();
for(i=0; i<6; i++)
myadr[i] = eth_myaddr[i] = inb(iobase + i);
bi_netif.hw_addr[i] = myadr[i] = eth_myaddr[i] = inb(iobase + i);
isa_dmacascade(dmachan);
am7990_init();
sprintf(etherdev. "le@isapnp,0x%x", iobase);
strncpy(bi_netif.ifname, "le", sizeof(bi_netif.ifname));
bi_netif.bus = BI_BUS_ISA;
bi_netif.addr = iobase;
BI_ADD(&bi_netif, BTINFO_NETIF, sizeof(bi_netif));
return(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcnet_pci.c,v 1.2 1997/03/15 22:20:55 perry Exp $ */
/* $NetBSD: pcnet_pci.c,v 1.3 1997/09/17 18:21:44 drochner Exp $ */
/*
* Copyright (c) 1996
@ -35,15 +35,16 @@
#include <sys/types.h>
#include <machine/pio.h>
#include <lib/libkern/libkern.h>
#include <lib/libsa/stand.h>
#include <libi386.h>
#include <pcivar.h>
#include <bootinfo.h>
#include "etherdrv.h"
#include "lance.h"
char etherdev[20];
int lance_rap, lance_rdp;
static pcihdl_t hdl;
@ -53,6 +54,8 @@ u_char eth_myaddr[6];
extern void am7990_init __P((void));
extern void am7990_stop __P((void));
static struct btinfo_netif bi_netif;
int EtherInit(myadr)
char *myadr;
{
@ -88,10 +91,15 @@ char *myadr;
}
for(i=0; i<6; i++)
myadr[i] = eth_myaddr[i] = inb(iobase + i);
bi_netif.hw_addr[i] = myadr[i] = eth_myaddr[i] = inb(iobase + i);
am7990_init();
sprintf(etherdev, "le@pci,0x%x", iobase);
strncpy(bi_netif.ifname, "le", sizeof(bi_netif.ifname));
bi_netif.bus = BI_BUS_PCI;
bi_netif.addr = iobase;
BI_ADD(&bi_netif, BTINFO_NETIF, sizeof(bi_netif));
return(1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: wd80x3.c,v 1.2 1997/06/21 14:43:11 drochner Exp $ */
/* $NetBSD: wd80x3.c,v 1.3 1997/09/17 18:21:44 drochner Exp $ */
/* stripped down from netbsd:sys/arch/i386/netboot/wd8x13.c */
@ -13,9 +13,12 @@
#include <sys/types.h>
#include <machine/pio.h>
#include <lib/libsa/stand.h>
#include <lib/libkern/libkern.h>
#include <libi386.h>
#include <bootinfo.h>
#include "etherdrv.h"
#include "dp8390.h"
@ -25,8 +28,6 @@
#define BASEMEM 0xd0000
#endif
char etherdev[20];
static int ourbasereg, ourbasemem;
/* configurable parameters */
@ -79,6 +80,8 @@ static u_char eth_myaddr[6];
static int boardid;
static dpconf_t dpc;
static struct btinfo_netif bi_netif;
/*
* Determine whether wd8003 hardware performs register aliasing
* (i.e. whether it is an old WD8003E board).
@ -195,6 +198,7 @@ char *myadr;
{
unsigned sum;
int memsize;
int i;
ourbasereg = BASEREG;
ourbasemem = BASEMEM;
@ -230,12 +234,8 @@ char *myadr;
outb(WD_BASEREG + WD_REG5, WD_LAAR_A19|WD_LAAR_LAN16E);
/* get ethernet address */
eth_myaddr[0] = myadr[0]= inb(WD_BASEREG + WD_EA0);
eth_myaddr[1] = myadr[1]= inb(WD_BASEREG + WD_EA1);
eth_myaddr[2] = myadr[2]= inb(WD_BASEREG + WD_EA2);
eth_myaddr[3] = myadr[3]= inb(WD_BASEREG + WD_EA3);
eth_myaddr[4] = myadr[4]= inb(WD_BASEREG + WD_EA4);
eth_myaddr[5] = myadr[5]= inb(WD_BASEREG + WD_EA5);
for(i = 0; i < 6; i++)
bi_netif.hw_addr[i] = eth_myaddr[i] = myadr[i]= inb(WD_BASEREG + WD_EA0 + i);
/* save settings for future use */
dpc.dc_reg = WD_BASEREG + WD_DP8390;
@ -253,7 +253,13 @@ char *myadr;
outb(WD_BASEREG + 5, 0x80);
outb(WD_BASEREG + 6, 0x1);
#endif
sprintf(etherdev, "ed@isa,0x%x", ourbasereg);
strncpy(bi_netif.ifname, "ed", sizeof(bi_netif.ifname));
bi_netif.bus = BI_BUS_ISA;
bi_netif.addr = WD_BASEREG;
BI_ADD(&bi_netif, BTINFO_NETIF, sizeof(bi_netif));
return 1;
}