Moved to ../stand/netboot

This commit is contained in:
gwr 1995-06-09 21:55:47 +00:00
parent b80b4c93a5
commit 5a7b959d02
8 changed files with 0 additions and 1117 deletions

View File

@ -1,36 +0,0 @@
# $NetBSD: Makefile,v 1.2 1994/10/26 09:11:38 cgd Exp $
.include <../../common/netboot/Makefile>
CFLAGS += -I../../common -I. -DDEBUG -Dsun3
CC = gcc
AS = gas
NOMAN =
OBJS+= start.o
SRCS+= le_poll.c machdep.c sunos_exec.c
CLEANFILES += genassym netboot.nm assym.s a.out netboot.o
LINKADDR= 240000
genassym: genassym.c
${CC} ${CFLAGS} -Dmc68020 -Dsun3 -o genassym genassym.c
netboot: $(START_OBJ) $(OBJS)
$(LD) -n -o netboot.o -e start -N -T $(LINKADDR) $(START_OBJ) $(OBJS) $(LIBC)
cp netboot.o a.out
strip a.out
dd if=a.out of=$@ ibs=32 skip=1
rm -f a.out
netboot.nm:
nm -n netboot > netboot.nm
assym.s: genassym
./genassym >assym.s
start.o: start.s assym.s
${CPP} -E ${COPTS} $< | ${AS} -o $@
install: netboot
cp netboot /tftpboot/boot.sun3
.include <bsd.prog.mk>

View File

@ -1,53 +0,0 @@
/* $NetBSD: conf.c,v 1.3 1994/10/26 09:11:42 cgd Exp $ */
/*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY 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.
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netinet/in_systm.h>
#include "netboot/netboot.h"
#include "netboot/netif.h"
#include "config.h"
extern struct netif le_netif;
struct netif *netiftab[] = {
&le_netif
};
int n_netif = sizeof(netiftab)/ sizeof(netiftab[0]);

View File

@ -1,21 +0,0 @@
/* $NetBSD: config.h,v 1.2 1994/10/26 09:11:44 cgd Exp $ */
/* configuration information for base-line code */
#include "../include/mon.h"
#ifndef GENASSYM /* XXX */
#define printf mon_printf
#endif
#define machdep_exec_override(x,y) 1
#define machdep_exec(x,y) sunos_exec(x,y)
#define machdep_netbsd_exec(x,y) 1
#define COMMON_ETHERADDR
#define FIXED_LOAD_ADDR 0x4000
#define BOOT_LOAD_ADDR 0x240000
caddr_t dvma_malloc __P((unsigned int));

View File

@ -1,86 +0,0 @@
/* $NetBSD: genassym.c,v 1.4 1995/05/16 22:25:17 jtc Exp $ */
/*
* Copyright (c) 1993 Adam Glass
* Copyright (c) 1982, 1990 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY 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.
*
* @(#)genassym.c 7.8 (Berkeley) 5/7/91
*/
#define _KERNEL
#include "sys/cdefs.h"
#include "sys/errno.h"
#include "machine/memmap.h"
#include "machine/cpu.h"
#include "machine/trap.h"
#include "machine/psl.h"
#include "machine/pte.h"
#include "machine/control.h"
#include "machine/mon.h"
#include "machine/param.h"
#define GENASSYM
#include "config.h"
int main(argc, argv)
int argc;
char *argv[];
{
/* 68k isms */
printf("#define\tPSL_LOWIPL %d\n", PSL_LOWIPL);
printf("#define\tPSL_HIGHIPL %d\n", PSL_HIGHIPL);
printf("#define\tPSL_IPL7 %d\n", PSL_IPL7);
printf("#define\tPSL_USER %d\n", PSL_USER);
printf("#define\tSPL1 %d\n", PSL_S | PSL_IPL1);
printf("#define\tFC_CONTROL %d\n", FC_CONTROL);
/* sun3 control space isms */
printf("#define\tCONTEXT_0 %d\n", CONTEXT_0);
printf("#define\tCONTEXT_REG %d\n", CONTEXT_REG);
printf("#define\tCONTEXT_NUM %d\n", CONTEXT_NUM);
printf("#define\tSEGMAP_BASE %d\n", SEGMAP_BASE);
printf("#define\tNBPG %d\n", NBPG);
printf("#define\tNBSG %d\n", NBSG);
/* sun3 memory map */
printf("#define\tMAINMEM_MONMAP %d\n", MAINMEM_MONMAP);
printf("#define\tMONSHORTSEG %d\n", MONSHORTSEG);
printf("#define\tEFAULT %d\n", EFAULT);
printf("#define\tENAMETOOLONG %d\n", ENAMETOOLONG);
printf("#define\tFIXED_LOAD_ADDR %d\n", FIXED_LOAD_ADDR);
exit(0);
}

View File

@ -1,508 +0,0 @@
/* $NetBSD: le_poll.c,v 1.3 1994/10/26 09:11:48 cgd Exp $ */
/*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY 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.
*/
#include <sys/param.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include "netboot/netboot.h"
#include "netboot/netif.h"
#include "config.h"
#include "machine/obio.h"
#include "../dev/if_lereg.h"
#include "../dev/if_le_subr.h"
int le_debug = 1;
int le_probe();
int le_match();
void le_init();
int le_get();
int le_put();
void le_end();
struct netif_stats le_stats;
struct netif le_netif = {
"le", /* netif_bname */
0, /* netif_unit */
0, /* netif_exhausted */
le_match, /* netif_match */
le_probe, /* netif_probe */
le_init, /* netif_init */
le_get, /* netif_get */
le_put, /* netif_put */
le_end, /* netif_end */
&le_stats
};
struct le_configuration {
unsigned int obio_addr;
int used;
} le_config[] = {
{OBIO_AMD_ETHER, 0}
};
int nle_config = sizeof(le_config)/(sizeof(le_config[0]));
#define LE_UNIT le_netif.netif_unit
struct {
struct lereg1 *sc_r1; /* LANCE registers */
struct lereg2 *sc_r2; /* RAM */
int next_rmd;
int next_tmd;
} le_softc;
int le_match(machdep_hint, unitp)
void *machdep_hint;
int *unitp;
{
char *name;
int i, val = 0;
name = machdep_hint;
if (name && !strncmp(le_netif.netif_bname, name,2))
val += 10;
for (i = 0; i < nle_config; i++) {
if (le_config[i].used) continue;
*unitp = i;
if (le_debug)
printf("le%d: le_match --> %d\n", i, val+1);
le_config[i].used++;
return val+1;
}
if (le_debug)
printf("le%d: le_match --> 0\n", i);
return 0;
}
int le_probe(machdep_hint)
void *machdep_hint;
{
/* the set unit is the current unit */
if (le_debug)
printf("le%d: le_probe called\n", LE_UNIT);
return 0;
}
void le_sanity_check(str)
char *str;
{
struct lereg1 *ler1 = le_softc.sc_r1;
struct lereg2 *ler2 = le_softc.sc_r2;
unsigned int a;
int i;
for (i = 0; i < LERBUF; i++) {
a = LANCE_ADDR(&ler2->ler2_rbuf[i]);
if ((ler2->ler2_rmd[i].rmd0 != (a & LE_ADDR_LOW_MASK)) ||
(ler2->ler2_rmd[i].rmd1_hadr != (a >> 16))) {
printf("le%d: ler2_rmd[%d] addrs bad\n", LE_UNIT, i);
printf("le%d: string: %s\n", LE_UNIT, str);
panic("addrs trashed\n");
}
}
for (i = 0; i < LETBUF; i++) {
a = LANCE_ADDR(&ler2->ler2_tbuf[i]);
if ((ler2->ler2_tmd[i].tmd0 != (a & LE_ADDR_LOW_MASK)) ||
(ler2->ler2_tmd[i].tmd1_hadr != (a >> 16))) {
printf("le%d: ler2_tmd[%d] addrs bad\n", LE_UNIT, i);
printf("le%d: string: %s\n", LE_UNIT, str);
panic("addrs trashed\n");
}
}
}
void le_mem_summary()
{
struct lereg1 *ler1 = le_softc.sc_r1;
struct lereg2 *ler2 = le_softc.sc_r2;
int i;
printf("le%d: obio addr = %x\n", LE_UNIT, ler1);
printf("le%d: dvma addr = %x\n", LE_UNIT, ler2);
#if 0
ler1->ler1_rap = LE_CSR0;
ler1->ler1_rdp = LE_STOP;
printf("le%d: csr0 = %x\n", LE_UNIT, ler1->ler1_rdp);
ler1->ler1_rap = LE_CSR1;
printf("le%d: csr1 = %x\n", LE_UNIT, ler1->ler1_rdp);
ler1->ler1_rap = LE_CSR2;
printf("le%d: csr2 = %x\n", LE_UNIT, ler1->ler1_rdp);
ler1->ler1_rap = LE_CSR3;
printf("le%d: csr3 = %x\n", LE_UNIT, ler1->ler1_rdp);
#endif
printf("le%d: ladrf0 = %x\n", LE_UNIT, ler2->ler2_ladrf0);
printf("le%d: ladrf1 = %x\n", LE_UNIT, ler2->ler2_ladrf1);
printf("le%d: ler2_rdra = %x\n", LE_UNIT, ler2->ler2_rdra);
printf("le%d: ler2_rlen = %x\n", LE_UNIT, ler2->ler2_rlen);
printf("le%d: ler2_tdra = %x\n", LE_UNIT, ler2->ler2_tdra);
printf("le%d: ler2_tlen = %x\n", LE_UNIT, ler2->ler2_tlen);
for (i = 0; i < LERBUF; i++) {
printf("le%d: ler2_rmd[%d].rmd0 (ladr) = %x\n", LE_UNIT, i,
ler2->ler2_rmd[i].rmd0);
printf("le%d: ler2_rmd[%d].rmd1_bits = %x\n", LE_UNIT, i,
ler2->ler2_rmd[i].rmd1_bits);
printf("le%d: ler2_rmd[%d].rmd1_hadr = %x\n", LE_UNIT, i,
ler2->ler2_rmd[i].rmd1_hadr);
printf("le%d: ler2_rmd[%d].rmd2 (-bcnt) = %x\n", LE_UNIT, i,
ler2->ler2_rmd[i].rmd2);
printf("le%d: ler2_rmd[%d].rmd3 (mcnt) = %x\n", LE_UNIT, i,
ler2->ler2_rmd[i].rmd3);
printf("le%d: ler2_rbuf[%d] addr = %x\n", LE_UNIT, i,
&ler2->ler2_rbuf[i]);
}
for (i = 0; i < LETBUF; i++) {
printf("le%d: ler2_tmd[%d].tmd0 = %x\n", LE_UNIT, i,
ler2->ler2_tmd[i].tmd0);
printf("le%d: ler2_tmd[%d].tmd1_bits = %x\n", LE_UNIT, i,
ler2->ler2_tmd[i].tmd1_bits);
printf("le%d: ler2_tmd[%d].tmd1_hadr = %x\n", LE_UNIT, i,
ler2->ler2_tmd[i].tmd1_hadr);
printf("le%d: ler2_tmd[%d].tmd2 (bcnt) = %x\n", LE_UNIT, i,
ler2->ler2_tmd[i].tmd2);
printf("le%d: ler2_tmd[%d].tmd3 = %x\n", LE_UNIT, i,
ler2->ler2_tmd[i].tmd3);
printf("le%d: ler2_tbuf[%d] addr = %x\n", LE_UNIT, i,
&ler2->ler2_tbuf[i]);
}
}
void le_error(str, ler1)
char *str;
struct lereg1 *ler1;
{
/* ler1->ler1_rap = LE_CSRO done in caller */
if (ler1->ler1_rdp & LE_BABL)
panic("le%d: been babbling, found by '%s'\n", LE_UNIT, str);
if (ler1->ler1_rdp & LE_CERR) {
le_stats.collision_error++;
ler1->ler1_rdp = LE_CERR;
}
if (ler1->ler1_rdp & LE_MISS) {
le_stats.missed++;
ler1->ler1_rdp = LE_MISS;
}
if (ler1->ler1_rdp & LE_MERR) {
printf("le%d: memory error in '%s'\n", LE_UNIT, str);
le_mem_summary();
panic("bye");
}
}
void le_reset(myea)
u_char *myea;
{
struct lereg1 *ler1 = le_softc.sc_r1;
struct lereg2 *ler2 = le_softc.sc_r2;
unsigned int a;
int timo = 100000, stat, i;
if (le_debug)
printf("le%d: le_reset called\n", LE_UNIT);
ler1->ler1_rap = LE_CSR0;
ler1->ler1_rdp = LE_STOP; /* do nothing until we are finished */
bzero(ler2, sizeof(*ler2));
ler2->ler2_mode = LE_MODE;
ler2->ler2_padr[0] = myea[1];
ler2->ler2_padr[1] = myea[0];
ler2->ler2_padr[2] = myea[3];
ler2->ler2_padr[3] = myea[2];
ler2->ler2_padr[4] = myea[5];
ler2->ler2_padr[5] = myea[4];
ler2->ler2_ladrf0 = 0;
ler2->ler2_ladrf1 = 0;
a = LANCE_ADDR(ler2->ler2_rmd);
#ifdef RECV_DEBUG
ler2->ler2_rlen = 0 | (a >> 16);
#undef LERBUF
#define LERBUF 1
#else
ler2->ler2_rlen = LE_RLEN | (a >> 16);
#endif
ler2->ler2_rdra = a & LE_ADDR_LOW_MASK;
a = LANCE_ADDR(ler2->ler2_tmd);
ler2->ler2_tlen = LE_TLEN | (a >> 16);
ler2->ler2_tdra = a & LE_ADDR_LOW_MASK;
ler1->ler1_rap = LE_CSR1;
a = LANCE_ADDR(ler2);
ler1->ler1_rdp = a & LE_ADDR_LOW_MASK;
ler1->ler1_rap = LE_CSR2;
ler1->ler1_rdp = a >> 16;
for (i = 0; i < LERBUF; i++) {
a = LANCE_ADDR(&ler2->ler2_rbuf[i]);
ler2->ler2_rmd[i].rmd0 = a & LE_ADDR_LOW_MASK;
ler2->ler2_rmd[i].rmd1_bits = LE_OWN;
ler2->ler2_rmd[i].rmd1_hadr = a >> 16;
if (le_debug)
printf("le rbuf[%d] = %x%x\n", i, a >>16, a & LE_ADDR_LOW_MASK);
ler2->ler2_rmd[i].rmd2 = -LEMTU;
ler2->ler2_rmd[i].rmd3 = 0;
}
for (i = 0; i < LETBUF; i++) {
a = LANCE_ADDR(&ler2->ler2_tbuf[i]);
ler2->ler2_tmd[i].tmd0 = a & LE_ADDR_LOW_MASK;
ler2->ler2_tmd[i].tmd1_bits = 0;
ler2->ler2_tmd[i].tmd1_hadr = a >> 16;
if (le_debug)
printf("le tbuf[%d] = %x%x\n", i, a >>16, a & LE_ADDR_LOW_MASK );
ler2->ler2_tmd[i].tmd2 = 0;
ler2->ler2_tmd[i].tmd3 = 0;
}
ler1->ler1_rap = LE_CSR3;
ler1->ler1_rdp = LE_BSWP;
ler1->ler1_rap = LE_CSR0;
ler1->ler1_rdp = LE_INIT;
do {
if (--timo == 0) {
printf("le%d: init timeout, stat = 0x%x\n",
le_netif.netif_unit, stat);
break;
}
stat = ler1->ler1_rdp;
} while ((stat & LE_IDON) == 0);
ler1->ler1_rdp = LE_IDON;
le_softc.next_rmd = 0;
le_softc.next_tmd = 0;
ler1->ler1_rap = LE_CSR0;
ler1->ler1_rdp = LE_STRT;
le_mem_summary();
}
int le_poll(desc, pkt, len)
struct iodesc *desc;
void *pkt;
int len;
{
struct lereg1 *ler1 = le_softc.sc_r1;
struct lereg2 *ler2 = le_softc.sc_r2;
unsigned int a;
int length;
struct lermd *rmd;
printf("next_rmd on poll attempt %d\n", le_softc.next_rmd);
ler1->ler1_rap = LE_CSR0;
if ((ler1->ler1_rdp & LE_RINT) == 0)
return 0;
ler1->ler1_rdp = LE_RINT;
rmd = &ler2->ler2_rmd[le_softc.next_rmd];
if (le_debug) {
printf("next_rmd %d\n", le_softc.next_rmd);
printf("rmd->rmd1_bits %x\n", rmd->rmd1_bits);
printf("rmd->rmd2 %x, rmd->rmd3 %x\n", rmd->rmd2, rmd->rmd3);
printf("rmd->rbuf msg %d buf %d\n", rmd->rmd3, -rmd->rmd2 );
}
if (rmd->rmd1_bits & LE_OWN)
panic("le_poll: rmd still owned by lance");
if (ler1->ler1_rdp & LE_SERR)
le_error("le_poll", ler1);
if (rmd->rmd1_bits & LE_ERR) {
printf("le%d_poll: rmd status 0x%x\n", rmd->rmd1_bits);
length = 0;
goto cleanup;
}
if ((rmd->rmd1_bits & (LE_STP|LE_ENP)) != (LE_STP|LE_ENP))
panic("le_poll: chained packet\n");
length = rmd->rmd3;
printf("le_poll: length %d\n", length);
if (length >= LEMTU) {
length = 0;
panic("csr0 when bad things happen: %x\n", ler1->ler1_rdp);
goto cleanup;
}
if (!length) goto cleanup;
length -= 4;
if (length > 0)
bcopy(&ler2->ler2_rbuf[le_softc.next_rmd], pkt, length);
cleanup:
le_sanity_check("before forced rmd sanity");
a = LANCE_ADDR(&ler2->ler2_rbuf[le_softc.next_rmd]);
rmd->rmd0 = a & LE_ADDR_LOW_MASK;
rmd->rmd1_hadr = a >> 16;
rmd->rmd2 = -LEMTU;
le_softc.next_rmd =
(le_softc.next_rmd == (LERBUF - 1)) ? 0 : (le_softc.next_rmd + 1);
printf("new next_rmd %d\n", le_softc.next_rmd);
le_sanity_check("after forced rmd sanity");
rmd->rmd1_bits = LE_OWN;
return length;
}
int le_put(desc, pkt, len)
struct iodesc *desc;
void *pkt;
int len;
{
volatile struct lereg1 *ler1 = le_softc.sc_r1;
volatile struct lereg2 *ler2 = le_softc.sc_r2;
volatile struct letmd *tmd;
int timo = 100000, stat, i;
unsigned int a;
if (le_debug)
printf("le%d: le_put called\n", LE_UNIT);
printf("wierd place le_next_rmd %d\n", le_softc.next_rmd);
le_sanity_check("before transmit");
ler1->ler1_rap = LE_CSR0;
if (ler1->ler1_rdp & LE_SERR)
le_error("le_put(way before xmit)", ler1);
tmd = &ler2->ler2_tmd[le_softc.next_tmd];
while(tmd->tmd1_bits & LE_OWN) {
printf("le%d: output buffer busy\n");
}
bcopy(pkt, ler2->ler2_tbuf[le_softc.next_tmd], len);
if (len < 64)
tmd->tmd2 = -64;
else
tmd->tmd2 = -len;
tmd->tmd3 = 0;
if (ler1->ler1_rdp & LE_SERR)
le_error("le_put(before xmit)", ler1);
tmd->tmd1_bits = LE_STP | LE_ENP | LE_OWN;
a = LANCE_ADDR(&ler2->ler2_tbuf[le_softc.next_tmd]);
tmd->tmd0 = a & LE_ADDR_LOW_MASK;
tmd->tmd1_hadr = a >> 16;
ler1->ler1_rdp = LE_TDMD;
if (ler1->ler1_rdp & LE_SERR)
le_error("le_put(after xmit)", ler1);
do {
if (--timo == 0) {
printf("le%d: transmit timeout, stat = 0x%x\n",
le_netif.netif_unit, stat);
if (ler1->ler1_rdp & LE_SERR)
le_error("le_put(timeout)", ler1);
break;
}
stat = ler1->ler1_rdp;
} while ((stat & LE_TINT) == 0);
ler1->ler1_rdp = LE_TINT;
if (ler1->ler1_rdp & LE_SERR) {
printf("le_put: xmit error, buf %d\n", le_softc.next_tmd);
le_error("le_put(xmit error)", ler1);
}
le_sanity_check("after transmit");
le_softc.next_tmd = 0;
le_sanity_check("after next tmd");
/* (le_softc.next_tmd == (LETBUF - 1)) ? 0 : le_softc.next_tmd + 1;*/
if (tmd->tmd1_bits & LE_DEF) le_stats.deferred++;
if (tmd->tmd1_bits & LE_ONE) le_stats.collisions++;
if (tmd->tmd1_bits & LE_MORE) le_stats.collisions+=2;
le_sanity_check("bits check");
if (tmd->tmd1_bits & LE_ERR) {
printf("le%d: transmit error, error = 0x%x\n", LE_UNIT,
tmd->tmd3);
return -1;
}
le_sanity_check("le_debug check");
if (le_debug) {
printf("le%d: le_put() successful: sent %d\n", LE_UNIT, len);
printf("le%d: le_put(): tmd1_bits: %x tmd3: %x\n", LE_UNIT,
(unsigned int) tmd->tmd1_bits,
(unsigned int) tmd->tmd3);
}
le_sanity_check("after le_put return len");
return len;
}
int le_get(desc, pkt, len, timeout)
struct iodesc *desc;
void *pkt;
int len;
time_t timeout;
{
time_t t;
int cc;
t = getsecs();
cc = 0;
while (((getsecs() - t) < timeout) && !cc) {
cc = le_poll(desc, pkt, len);
}
return cc;
}
void le_init(desc, machdep_hint)
struct iodesc *desc;
void *machdep_hint;
{
caddr_t addr;
if (le_debug)
printf("le%d: le_init called\n", LE_UNIT);
bzero(&le_softc, sizeof(le_softc));
addr = obio_alloc((caddr_t) OBIO_AMD_ETHER, OBIO_AMD_ETHER_SIZE,
OBIO_WRITE);
if (addr == NULL)
panic("le%d: out of obio memory???", le_netif.netif_unit);
le_softc.sc_r1 = (struct lereg1 *) addr;
addr = dvma_malloc(sizeof(struct lereg2));
if (addr == NULL)
panic("le%d: no dvma space???", le_netif.netif_unit);
le_softc.sc_r2 = (struct lereg2 *) addr;
le_reset(desc->myea);
}
void le_end()
{
struct lereg1 *ler1 = le_softc.sc_r1;
if (le_debug)
printf("le%d: le_end called\n", LE_UNIT);
ler1->ler1_rap = LE_CSR0;
ler1->ler1_rdp = LE_STOP;
obio_free(le_softc.sc_r1);
dvma_free(le_softc.sc_r2);
}

View File

@ -1,231 +0,0 @@
/* $NetBSD: machdep.c,v 1.2 1994/10/26 09:11:51 cgd Exp $ */
#include <sys/param.h>
#include <sys/types.h>
#include <sys/types.h>
#include "machine/obio.h"
#include "machine/pte.h"
#include "machine/control.h"
#include "machine/idprom.h"
#include "../sun3/intersil7170.h"
#include "netboot/exec_var.h"
#include "config.h"
extern int debug;
vm_offset_t high_segment_free_start = 0;
vm_offset_t high_segment_free_end = 0;
vm_offset_t avail_start;
volatile struct intersil7170 *clock_addr = 0;
void high_segment_init()
{
vm_offset_t va;
high_segment_free_start = MONSHORTSEG;
high_segment_free_end = MONSHORTPAGE;
for (va = high_segment_free_start; va < high_segment_free_end;
va+= NBPG)
set_pte(va, PG_INVAL);
}
vm_offset_t high_segment_alloc(npages)
int npages;
{
int i;
vm_offset_t va, tmp;
if (npages == 0)
panic("panic: request for high segment allocation of 0 pages");
if (high_segment_free_start == high_segment_free_end) return NULL;
va = high_segment_free_start + (npages*NBPG);
if (va > high_segment_free_end) return NULL;
tmp = high_segment_free_start;
high_segment_free_start = va;
return tmp;
}
#define intersil_command(run, interrupt) \
(run | interrupt | INTERSIL_CMD_FREQ_32K | INTERSIL_CMD_24HR_MODE | \
INTERSIL_CMD_NORMAL_MODE)
void clock_start()
{
clock_addr = (struct intersil7170 *)
obio_alloc((caddr_t) OBIO_CLOCK, OBIO_CLOCK_SIZE, OBIO_WRITE);
if (!clock_addr)
panic("clock_init: no obio space for clock");
printf("about to turn on clock\n");
clock_addr->command_reg = intersil_command(INTERSIL_CMD_RUN,
INTERSIL_CMD_IDISABLE);
printf("clock on\n");
}
u_long gettenths()
{
char csecs;
u_long val;
val = 0;
csecs = clock_addr->counters.csecs;
val = csecs/10;
val += clock_addr->counters.seconds*10;
val += clock_addr->counters.minutes*60*10;
val += clock_addr->counters.hours*60*60*10;
csecs = clock_addr->counters.csecs;
return val;
}
time_t getsecs()
{
return gettenths()/10;
}
void machdep_nfsboot()
{
extern char edata[], end[];
printf("before bzero\n");
printf("edata %x, end-edata %x\n", edata, end - edata);
bzero(edata, end - edata);
printf("hi\n");
high_segment_init();
printf("high_segment_initialized\n");
/* get va afer netboot */
avail_start = sun3_round_page(end);
avail_start+= NBPG; /* paranoia */
printf("pre_clock_start\n");
clock_start();
printf("hi there\n");
nfs_boot(NULL, "le");
}
void machdep_stop()
{
mon_exit_to_mon();
}
void machdep_common_ether(ether)
unsigned char *ether;
{
static int ether_init = 0;
static struct idprom idprom_copy;
unsigned char *p;
if (!ether_init) {
int i;
for (i= 0, p = (char *) &idprom_copy; i<sizeof(idprom_copy); i++,p++)
*p= get_control_byte((char *) (IDPROM_BASE+i));
}
bcopy(idprom_copy.idp_etheraddr, ether, 6);
}
caddr_t obio_alloc(obio_addr, obio_size, obio_flags)
caddr_t obio_addr;
int obio_size;
int obio_flags;
{
int npages;
vm_offset_t va, high_segment_alloc(), obio_pa, obio_va, pte_proto;
npages = PA_PGNUM(sun3_round_page(obio_size));
if (!npages)
panic("obio_alloc: attempt to allocate 0 pages for obio");
va = high_segment_alloc(npages);
if (!va)
panic("obio_alloc: unable to allocate va for obio mapping");
pte_proto = PG_VALID|PG_SYSTEM|MAKE_PGTYPE(PG_OBIO);
if ((obio_flags & OBIO_CACHE) == 0)
pte_proto |= PG_NC;
if (obio_flags & OBIO_WRITE)
pte_proto |= PG_WRITE;
obio_va = va;
obio_pa = (vm_offset_t) obio_addr;
printf("pre_set_pte\n");
for (; npages ; npages--, obio_va += NBPG, obio_pa += NBPG)
set_pte(obio_va, pte_proto | PA_PGNUM(obio_pa));
printf("post_set_pte\n");
return (caddr_t) va;
}
/*
* pretty nasty:
*
* Can't allocate pages from top of phys memory because of msgbuf, etc.
*
* best bet is to steal pages just above us and re-map them in the dvma area.
*/
caddr_t dvma_malloc(size)
unsigned int size;
{
int npages;
vm_offset_t dvma_va, avail_pa, va, pte_proto;
npages = PA_PGNUM(sun3_round_page(size));
if (!npages)
panic("dvma_malloc: attempt to allocate 0 pages for dvma");
va = high_segment_alloc(npages);
if (!va)
panic("dvma_malloc: unable to allocate va for obio mapping");
pte_proto = PG_VALID|PG_SYSTEM|MAKE_PGTYPE(PG_MMEM)|PG_WRITE;
dvma_va = va;
avail_pa = PG_PA(get_pte(avail_start));
avail_start += npages*NBPG;
for (; npages; npages--, dvma_va+= NBPG, avail_pa+NBPG)
set_pte(dvma_va, pte_proto|PA_PGNUM(avail_pa));
return (caddr_t) va;
}
void obio_free(addr)
void *addr;
{
}
void dvma_free(addr)
void *addr;
{
}
#define CONTROL_ALIGN(x) (x & CONTROL_ADDR_MASK)
#define CONTROL_ADDR_BUILD(space, va) (CONTROL_ALIGN(va)|space)
vm_offset_t get_pte(va)
vm_offset_t va;
{
return (vm_offset_t)
get_control_word((char *) CONTROL_ADDR_BUILD(PGMAP_BASE, va));
}
void set_pte(va, pte)
vm_offset_t va,pte;
{
set_control_word((char *) CONTROL_ADDR_BUILD(PGMAP_BASE, va),
(unsigned int) pte);
}
void machdep_exec_setup(ev)
struct exec_var *ev;
{
unsigned int correction;
correction = ev->text_info.segment_addr - FIXED_LOAD_ADDR;
ev->text_info.segment_va = FIXED_LOAD_ADDR;
ev->data_info.segment_va = ev->data_info.segment_addr - correction;
ev->bss_info.segment_va = ev->bss_info.segment_addr - correction;
if (ev->nfs_disklessp)
ev->nfs_disklessp =
(caddr_t) (((unsigned char) ev->nfs_disklessp) - correction);
ev->real_entry_point = ev->entry_point - correction;
if ((ev->bss_info.segment_va + ev->bss_info.segment_size) >
BOOT_LOAD_ADDR)
panic("netboot: kernel image would overwrite bootstrap code");
}

View File

@ -1,106 +0,0 @@
/* $NetBSD: start.s,v 1.3 1994/10/26 09:11:54 cgd Exp $ */
/*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY 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.
*/
#include "assym.s"
#include "../include/asm.h"
.text
.globl start
start:
movl #FIXED_LOAD_ADDR,a0 | where we are (a0)
lea start:l, a1 | where we want to be (a1)
cmpl a0, a1
jeq begin
movl #_edata, d0
copy:
movl a0@+,a1@+
cmpl d0, a1
jne copy
jmp begin:l
/* find out where we are, and copy ourselves to where we are supposed to be */
.align 4
begin:
moveq #FC_CONTROL, d0 | make movs get us to the control
movc d0, dfc | space where the sun3 designers
movc d0, sfc | put all the "useful" stuff
moveq #CONTEXT_0, d0
movsb d0, CONTEXT_REG | now in context 0
savesp: movl sp, start-4:l
lea start-4:l, sp
movl #(FIXED_LOAD_ADDR-4), sp
jsr _machdep_nfsboot
jsr FIXED_LOAD_ADDR
/*
* unsigned int get_control_word (char *)
*/
ENTRY(get_control_word)
movl sp@(4), a0
movsl a0@, d0
rts
/*
* void set_control_word (char *, unsigned int)
*/
ENTRY(set_control_word)
movl sp@(4), a0
movl sp@(8), d0
movsl d0, a0@
rts
/*
* unsigned char get_control_byte (char *)
*/
ENTRY(get_control_byte)
movl sp@(4), a0
moveq #0, d0
movsb a0@, d0
rts
/*
* Get callers current SP value.
* Note that simply taking the address of a local variable in a C function
* doesn't work because callee saved registers may be outside the stack frame
* defined by A6 (e.g. GCC generated code).
*
* [I don't think the ENTRY() macro will do the right thing with this -- glass]
*/
.globl _getsp; .align 2
_getsp:
movl sp,d0 | get current SP
addql #4,d0 | compensate for return address
rts

View File

@ -1,76 +0,0 @@
/* $NetBSD: sunos_exec.c,v 1.3 1994/10/26 09:11:57 cgd Exp $ */
/*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY 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.
*/
#include <sys/param.h>
#include <sys/types.h>
#include <sys/cdefs.h>
#include <sys/mount.h>
#include <sys/exec.h>
#include <sys/errno.h>
#include <sys/time.h>
#include <a.out.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include "netboot/netboot.h"
#include "netboot/netif.h"
#include "netboot/exec_var.h"
#include "config.h"
int sunos_exec(desc, ev)
struct iodesc *desc;
struct exec_var *ev;
{
int cc, error;
struct exec exec;
unsigned short magic;
cc = readdata(desc, 0, &exec, sizeof(exec));
if (cc < 0)
panic("netbsd_exec: bad exec read\n");
if (N_BADMAG(exec)) {
error = 1;
goto failed;
}
if (N_GETMID(exec) != 2) {
error = 1;
goto failed;
}
failed:
if (error)
printf("netbsd_exec: bad exec? code %d\n", error);
error = netbsd_exec_compute(exec, ev);
return error;
}