[comp.os.minix] #39 part 4 of 4

ast@cs.vu.nl (Andy Tanenbaum) (07/23/88)

: This is a shar archive.  Extract with sh, not csh.
: This archive ends with exit, so do not worry about trailing junk.
: --------------------------- cut here --------------------------
PATH=/bin:/usr/bin:/usr/ucb
echo Extracting 'amstat.h'
sed 's/^X//' > 'amstat.h' << '+ END-OF-FILE ''amstat.h'
Xstruct amstat {
X	long ams_clfail;
X	long ams_svfail;
X	long ams_clcrash;
X	long ams_rxcl;
X	long ams_rxsv;
X	long ams_trans;
X	long ams_loctrans;
X	long ams_remtrans;
X	long ams_getreq;
X	long ams_putrep;
X	long ams_naks;
X};
+ END-OF-FILE amstat.h
chmod 'u=rw,g=r,o=r' 'amstat.h'
set `wc -c 'amstat.h'`
count=$1
case $count in
215)	:;;
*)	echo 'Bad character count in ''amstat.h' >&2
		echo 'Count should be 215' >&2
esac
echo Extracting 'assert.h'
sed 's/^X//' > 'assert.h' << '+ END-OF-FILE ''assert.h'
X/****************************************************************************
X *									    *
X * (c) Copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands *
X *									    *
X *    This product is part of the  Amoeba  distributed operating system.    *
X *    Permission is hereby granted to use it exclusively for educational    * 
X *    and research purposes.  It may also be freely duplicated and given    *
X *    to others for educational and research purposes only.  All other use  *
X *    requires written permission from the copyright owner.		    *
X *									    *
X *    Requests for such permissions may be sent to              	    *
X *									    *
X *									    *
X *		Dr. Andrew S. Tanenbaum					    *
X *		Dept. of Mathematics and Computer Science		    *
X *		Vrije Universiteit					    *
X *		De Boelelaan 1081					    *
X *		1081 HV Amsterdam					    *
X *		The Netherlands						    *
X *									    *
X/****************************************************************************/
X
X#define NDEBUG
X#ifdef NDEBUG
X#define assert(e)	/* NOTHING */
X#define compare(a,t,b)	/* NOTHING */
X#else
X#ifdef lint
X#define assert(e)	use(e)
X#define compare(a,t,b)	use(a, b)
X#else lint
X#define assert(x)	if (!(x)) printf("assertion failed in %s at %d\n", __FILE__, __LINE__)
X#define compare(a,t,b)	if (!((a) t (b))) \
X			printf("comparison failed in %s at %d (%D)\n", \
X						 __FILE__, __LINE__, a)
X/*
X#define assert(e)	do if (!(e)) badassertion(__FILE__,__LINE__); while (0)
X#define compare(a,t,b)	do if (!((a) t (b))) \
X				badcompare(__FILE__,__LINE__, (long) (a)); \
X			while (0)
X*/
X#endif lint
X#endif NDEBUG
+ END-OF-FILE assert.h
chmod 'u=rw,g=r,o=r' 'assert.h'
set `wc -c 'assert.h'`
count=$1
case $count in
1621)	:;;
*)	echo 'Bad character count in ''assert.h' >&2
		echo 'Count should be 1621' >&2
esac
echo Extracting 'byteorder.h'
sed 's/^X//' > 'byteorder.h' << '+ END-OF-FILE ''byteorder.h'
X/*
X * set of macros to do inplace byteorder changes
X * The dec_* routines decode a short (_s) or long (_l) from little endian(_le)
X * or bigendian(_be) to native format.
X * The enc_* are similar for native to net format
X */
X
X
X/* littleendian version for ibm pc */
X
X#define dec_s_le(s)	/* nothing */
X#define dec_s_be(s)	(*(s))=((((*(s))>>8)&0xFF)|(((*(s))&0xFF)<<8))
X
X#define dec_l_le(l)	/* nothing */
X#define dec_l_be(l)	(*(l))=((((*(l))>>24)&0xFF)|(((*(l))>>8)&0xFF00)|(((*(l))<<8)&0xFF0000)|(((*(l))<<24)&0xFF000000))
X
X#define enc_s_le(s)	/* nothing */
X#define enc_s_be(s)	dec_s_be(s)
X
X#define enc_l_le(l)	/* nothing */
X#define enc_l_be(l)	dec_l_be(l)
+ END-OF-FILE byteorder.h
chmod 'u=rw,g=r,o=r' 'byteorder.h'
set `wc -c 'byteorder.h'`
count=$1
case $count in
654)	:;;
*)	echo 'Bad character count in ''byteorder.h' >&2
		echo 'Count should be 654' >&2
esac
echo Extracting 'conf.c'
sed 's/^X//' > 'conf.c' << '+ END-OF-FILE ''conf.c'
X#include "../h/type.h"
X#include "../h/amoeba.h"
X#include "global.h"
X#include "conf.h"
X
X/*
X**	the following hack is imported from task.c under Amoeba to declare
X**	a few pointers to the task table
X*/ 
X#define extern
X
X#include "task.h"
X
X#undef extern
X
X/************************************************************************/
X/*	TRANS CONFIGURATION						*/
X/************************************************************************/
X
X/*
X**	various variables used for transactions
X*/
X
Xport	NULLPORT;	/* used in trans.c, declared here for compatability */
Xlong	ticker;		/* bogus global used by trans.c for statistics */
X
X#ifndef NONET
X
Xunshort minloccnt	= MINLOCCNT;
Xunshort maxloccnt	= MAXLOCCNT;
X
Xunshort retranstime	= RETRANSTIME;
Xunshort crashtime	= CRASHTIME;
Xunshort clientcrash	= CLIENTCRASH;
X
Xunshort maxretrans	= MAXRETRANS;
Xunshort mincrash	= MINCRASH;
Xunshort maxcrash	= MAXCRASH;
X
X#endif NONET
+ END-OF-FILE conf.c
chmod 'u=rw,g=r,o=r' 'conf.c'
set `wc -c 'conf.c'`
count=$1
case $count in
902)	:;;
*)	echo 'Bad character count in ''conf.c' >&2
		echo 'Count should be 902' >&2
esac
echo Extracting 'conf.h'
sed 's/^X//' > 'conf.h' << '+ END-OF-FILE ''conf.h'
X/*
X**	constants used for configuring amoeba transactions
X*/
X#define MINLOCCNT	   5	/* locate message sent every dsec */
X#define MAXLOCCNT	 100	/* locate message sent every MAXLOCCNT dsec */
X
X#define RETRANSTIME	   5	/* retransmission time in dsec */
X#define CRASHTIME	 100	/* crash timer in dsec */
X#define CLIENTCRASH	 500	/* client must probe within this time */
X
X#define MAXRETRANS	  10	/* max. number of transmissions */
X#define MINCRASH	   5	/* enquiry sent MINCRASH times during recv */
X#define MAXCRASH	  10	/* enquiry sent MAXCRASH times during serv */
X
X#define	NPORTS		  16	/* # ports in portcache */
+ END-OF-FILE conf.h
chmod 'u=rw,g=r,o=r' 'conf.h'
set `wc -c 'conf.h'`
count=$1
case $count in
610)	:;;
*)	echo 'Bad character count in ''conf.h' >&2
		echo 'Count should be 610' >&2
esac
echo Extracting 'dp8390.c'
sed 's/^X//' > 'dp8390.c' << '+ END-OF-FILE ''dp8390.c'
X
X#include "../h/const.h"
X
X#ifndef NONET
X
X#include "../h/error.h"
X#include "../h/type.h"
X#include "../h/com.h"
X#include "const.h"
X#include "internet.h"
X#include "etherformat.h"
X#include "dp8390.h"
X#include "dp8390info.h"
X#include "dp8390stat.h"
X#include "assert.h"
X
X/* macros for device I/O */
X#define PIC_enable()	port_out(INT_CTL,ENABLE)
X
X#define input(devaddr, dp_register) \
X	inbyte((vir_bytes)&((union dp8390reg *) devaddr)->dp_pg0rd.dp_register)
X#define input1(devaddr, dp_register) \
X	inbyte((vir_bytes)&((union dp8390reg *) devaddr)->dp_pg1rdwr.dp_register)
X#define output(devaddr, dp_register, value) \
X	outbyte((vir_bytes)&((union dp8390reg *) devaddr)->dp_pg0wr.dp_register, value)
X#define output1(devaddr, dp_register, value) \
X	outbyte((vir_bytes)&((union dp8390reg *) devaddr)->dp_pg1rdwr.dp_register, value)
X
X#define MAX_WAIT	10000
X
X#ifdef DPSTAT
Xstruct dpstat dpstat;
X#endif
X
Xstatic int (*bufread)();	/* call when packet came in */
Xstatic int (*bufwritten)();	/* call when packet has been written */
X
Xstatic disabled;
Xstatic phys_bytes curopacket;	/* packet being transmitted */
Xstatic phys_bytes Curbuff;	/* address of next read buffer to release */
X
X
Xstatic
Xchipinit(myaddr)
XEth_addr *myaddr;
X{
X	register vir_bytes device;
X
X	device = dp8390info.dpi_devaddr;
X	output(device, dp_cr, CR_PS_P0|CR_DM_ABORT);	/* back to main register set */
X	output(device, dp_pstart, dp8390info.dpi_pstart);
X	output(device, dp_pstop, dp8390info.dpi_pstop);
X	output(device, dp_bnry, dp8390info.dpi_pstart);
X	output(device, dp_rcr, RCR_MON);
X	output(device, dp_tcr, TCR_NORMAL);
X	output(device, dp_dcr, DCR_BYTEWIDE|DCR_8BYTES);
X        output(device, dp_rbcr0, 0);
X        output(device, dp_rbcr1, 0);
X        output(device, dp_isr, 0xFF);
X	output(device, dp_cr, CR_PS_P1|CR_DM_ABORT);	/* switch to register set 1 */
X	output1(device, dp_par0, myaddr->e[0]);
X	output1(device, dp_par1, myaddr->e[1]);
X	output1(device, dp_par2, myaddr->e[2]);
X	output1(device, dp_par3, myaddr->e[3]);
X	output1(device, dp_par4, myaddr->e[4]);
X	output1(device, dp_par5, myaddr->e[5]);
X	output1(device, dp_curr, dp8390info.dpi_pstart+1);
X        output1(device, dp_cr, CR_PS_P0|CR_DM_ABORT);
X        output(device, dp_rcr, RCR_AB);
X        input(device, dp_cntr0);
X        input(device, dp_cntr1);
X        input(device, dp_cntr2);
X
X#ifdef TRMTINT
X	output(device, dp_imr, IMR_TXEE|IMR_PTXE|IMR_PRXE|IMR_CNTE|IMR_OVWE);
X#endif    
X	output(device, dp_imr, IMR_PRXE|IMR_CNTE|IMR_OVWE);
X	output(device, dp_cr, CR_STA|CR_DM_ABORT);		/* fire it up */
X}
X
X/*
X * Interrupt handling
X */
X
Xstatic
Xdp_xmit_intr()
X#ifdef TRMTINT
X{
X	register tsr;
X
X	if (curopacket == 0) {
X		printf("Bogus transmit interrupt\n");
X		STINC(ds_btint);
X		return;
X	}
X	tsr = input(dp8390info.dpi_devaddr, dp_tsr);
X	if (tsr&TSR_PTX)
X		STINC(ds_written);	/* It went OK! */
X	if (tsr&TSR_DFR)
X		STINC(ds_deferred);
X	if (tsr&TSR_COL)
X		STINC(ds_collisions);
X	if (tsr&TSR_ABT)
X		STINC(ds_xcollisions);
X	if (tsr&TSR_CRS) {
X		printf("Ethernet carrier sense lost\n");
X		STINC(ds_carlost);
X	}
X	if (tsr&TSR_FU) {
X		printf("Ethernet Fifo Underrun\n");
X		STINC(ds_fifo);
X	}
X	if (tsr&TSR_CDH) {
X		printf("Ethernet Heartbeat failure\n");
X		STINC(ds_heartbeat);
X	}
X	if (tsr&TSR_OWC) {
X		printf("Ethernet late collision\n");
X		STINC(ds_lcol);
X	}
X	(*bufwritten)(curopacket);
X	curopacket = 0;
X}
X#else
X{}
X#endif
X
X
Xstatic
Xrecvintr()
X{
X	register vir_bytes device;
X	register phys_bytes paddr;
X	struct rcvdheader pkthead;
X	char pageno, curr, next;
X	int length;
X
X	device = dp8390info.dpi_devaddr;
X	pageno=input(device, dp_bnry)+1;
X        if (pageno == dp8390info.dpi_pstop)
X            pageno = dp8390info.dpi_pstart;
X	while (!(disabled)) {
X		output(device, dp_cr, CR_PS_P1);/* switch to register set 1 */
X		curr = input1(device, dp_curr);
X		output1(device, dp_cr, CR_PS_P0);/* back to main register set */
X		if (pageno==curr)
X			break;
X		STINC(ds_read);
X		paddr = dp8390info.dpi_membase+(pageno<<8);
X		getheader(paddr, &pkthead);
X		next = pkthead.rp_next;
X		if (pkthead.rp_status&RSR_PRX) {
X			if (next < pageno && next > dp8390info.dpi_pstart) {
X				/*
X				 * We copy end of packet to avoid break.
X				 */
X				phys_copy(dp8390info.dpi_membase+
X					   (dp8390info.dpi_pstart<<8),
X					  dp8390info.dpi_membase+
X					   (dp8390info.dpi_pstop<<8),
X					  (phys_bytes) (next-dp8390info.dpi_pstart)<<8);
X			}
X			length = (pkthead.rp_rbcl&0xFF)|(pkthead.rp_rbch<<8);
X			Curbuff = paddr + sizeof (pkthead);
X			disabled = 1;
X			(*bufread)(Curbuff, length-4);
X		}
X		pageno = pkthead.rp_next;
Xif (pageno >= dp8390info.dpi_pstop || pageno < dp8390info.dpi_pstart)
X	 printf("page no %x\n", pageno);
X		assert(pageno >= dp8390info.dpi_pstart);
X		assert(pageno < dp8390info.dpi_pstop);
X	}
X}			
X
Xstatic
Xcntintr()
X{
X	register vir_bytes device;
X        int n;
X
X        printf("dp8390: counter overflow\n");		/*DEBUG*/
X	device = dp8390info.dpi_devaddr;
X        n = input(device, dp_cntr0);
X	STADD(ds_fram, n);
X        n = input(device, dp_cntr1);
X	STADD(ds_crc, n); 
X        n =input(device, dp_cntr2);
X	STADD(ds_lost, n);
X}
X
Xdp8390_int()
X{
X	register isr;
X	register vir_bytes device;
X
X	PIC_enable();
X	device = dp8390info.dpi_devaddr;
X	for(isr=input(device, dp_isr); isr&(ISR_OVW|ISR_PRX|ISR_PTX|ISR_CNT);
X						isr=input(device, dp_isr)) {
X		if (isr&ISR_OVW) {
X			printf("OVW, do something\n");
X			output(device, dp_isr, ISR_OVW);	/* ack */
X		}
X		if (isr&ISR_PTX) {
X			dp_xmit_intr();
X			output(device, dp_isr, ISR_PTX);	/* ack */
X		}
X		if (isr&ISR_TXE) {
X			dp_xmit_intr();
X			output(device, dp_isr, ISR_TXE);	/* ack */
X		}
X		if (isr&ISR_PRX) {
X			recvintr();
X			output(device, dp_isr, ISR_PRX);	/* ack */
X		}
X		if (isr&ISR_CNT) {
X			cntintr();
X			output(device, dp_isr, ISR_CNT);	/* ack */
X		}
X	}
X}
X
Xeth_init(etheraddr, br, bw)
XEth_addr *etheraddr;
Xint (*br)(), (*bw)();
X{
X	bufread = br;
X	bufwritten = bw;
X	epl_init();		/* activate on board memory */
X	chipinit(etheraddr);	/* start ethernet controller chip */
X}
X
X
X
Xeth_write(bufaddr, bufcnt)
Xphys_bytes bufaddr;
X{
X	int bpageno;
X	register vir_bytes device;
X
X	device = dp8390info.dpi_devaddr;
X/*	assert(curopacket==0);  */
X	assert(((bufaddr-dp8390info.dpi_membase)&0xFF)==0);
X	assert(bufcnt >= 60);	/* magic Ethernet requirement */
X/*	assert(bufcnt <= 1514); /* another one */
X	bpageno = ((bufaddr-dp8390info.dpi_membase)>>8) & 0xFF;
X	curopacket = bufaddr;
X	output(device, dp_tpsr, bpageno);
X	output(device, dp_tbcr1, bufcnt>>8);
X	output(device, dp_tbcr0, bufcnt&0xFF);
X	output(device, dp_cr, CR_TXP);		/* there it goes */
X}
X
Xeth_release(bufaddr) 
Xphys_bytes bufaddr;
X{
X	register vir_bytes device;
X	register phys_bytes paddr;
X	struct rcvdheader pkthead;
X	char pageno;
X	int old_state;
X
X	device = dp8390info.dpi_devaddr;
X	paddr = bufaddr-sizeof(pkthead);
X	assert(((paddr-dp8390info.dpi_membase)&0xFF)==0);
X	getheader(paddr, &pkthead);
X        pageno = pkthead.rp_next;
X        if (pageno == dp8390info.dpi_pstart)
X            pageno = dp8390info.dpi_pstop;
X	if (bufaddr != Curbuff)
X	    panic("eth_release: bad order", NO_NUM);
X	output(device, dp_bnry, pageno-1);
X	disabled = 0;
X	old_state = lock();
X	recvintr();
X	restore(old_state);
X}
X
Xphys_bytes
Xeth_getbuf()
X{
X	int t_cnt;
X	register vir_bytes device;
X	register tsr;
X
X	device = dp8390info.dpi_devaddr;
X
X        t_cnt = 0;
X        while (input(device,dp_cr)&CR_TXP) {
X            if (t_cnt++ > MAX_WAIT)
X                printf("transmitter frozen\n"); 
X		return (phys_bytes)0;
X	}       
X
X#ifndef TRMTINT
X#ifdef DPSTAT
X	tsr = input(device, dp_tsr);
X	if (tsr&TSR_PTX)
X		STINC(ds_written);	/* It went OK! */
X	if (tsr&TSR_DFR)
X		STINC(ds_deferred);
X	if (tsr&TSR_COL)
X		STINC(ds_collisions);
X	if (tsr&TSR_ABT)
X		STINC(ds_xcollisions);
X	if (tsr&TSR_CRS) {
X		printf("Ethernet carrier sense lost\n");
X		STINC(ds_carlost);
X	}
X	if (tsr&TSR_FU) {
X		printf("Ethernet Fifo Underrun\n");
X		STINC(ds_fifo);
X	}
X	if (tsr&TSR_CDH) {
X		printf("Ethernet Heartbeat failure\n");
X		STINC(ds_heartbeat);
X	}
X	if (tsr&TSR_OWC) {
X		printf("Ethernet late collision\n");
X		STINC(ds_lcol);
X	}
X#endif
X#endif
X	return dp8390info.dpi_tbuf;	/* return pointer to xmit buffer */
X}
X
X#else NONET
X
XPUBLIC
Xdp8390_int()
X{
X}
X
X#endif NONET
X
X#ifdef i8088
X
XPUBLIC
Xeth_stp()
X{
X/* called from reboot() (klib88.s) to stop the ethernet */
X#ifndef NONET
X	output(dp8390info.dpi_devaddr, dp_cr, CR_STP|CR_DM_ABORT);
X
X#endif
X}
X
X#endif i8088
+ END-OF-FILE dp8390.c
chmod 'u=rw,g=r,o=r' 'dp8390.c'
set `wc -c 'dp8390.c'`
count=$1
case $count in
8277)	:;;
*)	echo 'Bad character count in ''dp8390.c' >&2
		echo 'Count should be 8277' >&2
esac
echo Extracting 'dp8390.h'
sed 's/^X//' > 'dp8390.h' << '+ END-OF-FILE ''dp8390.h'
X/*
X * National Semiconductor DP8390 Network Interface Controller
X */
X
Xtypedef
Xunion dp8390reg {
X	struct pg0rd {			/* Page 0, for reading ------------- */
X		char	dp_cr;		/* Read side of Command Register     */
X		char	dp_clda0;	/* Current Local Dma Address 0       */
X		char	dp_clda1;	/* Current Local Dma Address 1       */
X		char	dp_bnry;	/* Boundary Pointer                  */
X		char	dp_tsr;		/* Transmit Status Register          */
X		char	dp_ncr;		/* Number of Collisions Register     */
X		char	dp_fifo;	/* Fifo ??                           */
X		char	dp_isr;		/* Interrupt Status Register         */
X		char	dp_crda0;	/* Current Remote Dma Address 0      */
X		char	dp_crda1;	/* Current Remote Dma Address 1      */
X		char	dp_dum1;	/* unused                            */
X		char	dp_dum2;	/* unused                            */
X		char	dp_rsr;		/* Receive Status Register           */
X		char	dp_cntr0;	/* Tally Counter 0                   */
X		char	dp_cntr1;	/* Tally Counter 1                   */
X		char	dp_cntr2;	/* Tally Counter 2                   */
X	} dp_pg0rd;
X	struct pg0wr {			/* Page 0, for writing ------------- */
X		char	dp_cr;		/* Write side of Command Register    */
X		char	dp_pstart;	/* Page Start Register               */
X		char	dp_pstop;	/* Page Stop Register                */
X		char	dp_bnry;	/* Boundary Pointer                  */
X		char	dp_tpsr;	/* Transmit Page Start Register      */
X		char	dp_tbcr0;	/* Transmit Byte Count Register 0    */
X		char	dp_tbcr1;	/* Transmit Byte Count Register 1    */
X		char	dp_isr;		/* Interrupt Status Register         */
X		char	dp_rsar0;	/* Remote Start Address Register 0   */
X		char	dp_rsar1;	/* Remote Start Address Register 1   */
X		char	dp_rbcr0;	/* Remote Byte Count Register 0      */
X		char	dp_rbcr1;	/* Remote Byte Count Register 1      */
X		char	dp_rcr;		/* Receive Configuration Register    */
X		char	dp_tcr;		/* Transmit Configuration Register   */
X		char	dp_dcr;		/* Data Configuration Register       */
X		char	dp_imr;		/* Interrupt Mask Register           */
X	} dp_pg0wr;
X	struct pg1rdwr {		/* Page 1, read/write -------------- */
X		char	dp_cr;		/* Command Register                  */
X		char	dp_par0;	/* Physical Address Register 0       */
X		char	dp_par1;	/* Physical Address Register 1       */
X		char	dp_par2;	/* Physical Address Register 2       */
X		char	dp_par3;	/* Physical Address Register 3       */
X		char	dp_par4;	/* Physical Address Register 4       */
X		char	dp_par5;	/* Physical Address Register 5       */
X		char	dp_curr;	/* Current Page Register             */
X		char	dp_mar0;	/* Multicast Address Register 0      */
X		char	dp_mar1;	/* Multicast Address Register 1      */
X		char	dp_mar2;	/* Multicast Address Register 2      */
X		char	dp_mar3;	/* Multicast Address Register 3      */
X		char	dp_mar4;	/* Multicast Address Register 4      */
X		char	dp_mar5;	/* Multicast Address Register 5      */
X		char	dp_mar6;	/* Multicast Address Register 6      */
X		char	dp_mar7;	/* Multicast Address Register 7      */
X	} dp_pg1rdwr;
X} dp8390;
X
X/* Bits in dp_cr */
X
X#define CR_STP		0x01		/* Stop: software reset              */
X#define CR_STA		0x02		/* Start: activate NIC               */
X#define CR_TXP		0x04		/* Transmit Packet                   */
X#define CR_DMA		0x38		/* Mask for DMA control              */
X#	define CR_DM_NOP	0x00	/* DMA: No Operation                 */
X#	define CR_DM_RR		0x08	/* DMA: Remote Read                  */
X#	define CR_DM_RW		0x10	/* DMA: Remote Write                 */
X#	define CR_DM_SP		0x18	/* DMA: Send Packet                  */
X#	define CR_DM_ABORT	0x20	/* DMA: Abort Remote DMA Operation   */
X#define CR_PS		0xC0		/* Mask for Page Select              */
X#	define CR_PS_P0		0x00	/* Register Page 0                   */
X#	define CR_PS_P1		0x40	/* Register Page 1                   */
X#	define CR_PS_T0		0x80	/* Test Mode Register Map ??         */
X#	define CR_SP_T1		0xC0	/* Test Mode Register Map ??         */
X
X/* Bits in dp_isr */
X
X#define ISR_PRX		0x01		/* Packet Received with no errors    */
X#define ISR_PTX		0x02		/* Packet Transmitted with no errors */
X#define ISR_RXE		0x04		/* Receive Error                     */
X#define ISR_TXE		0x08		/* Transmit Error                    */
X#define ISR_OVW		0x10		/* Overwrite Warning                 */
X#define ISR_CNT		0x20		/* Counter Overflow                  */
X#define ISR_RDC		0x40		/* Remote DMA Complete               */
X#define ISR_RST		0x80		/* Reset Status                      */
X
X/* Bits in dp_imr */
X
X#define IMR_PRXE	0x01		/* Packet Received iEnable           */
X#define IMR_PTXE	0x02		/* Packet Transmitted iEnable        */
X#define IMR_RXEE	0x04		/* Receive Error iEnable             */
X#define IMR_TXEE	0x08		/* Transmit Error iEnable            */
X#define IMR_OVWE	0x10		/* Overwrite Warning iEnable         */
X#define IMR_CNTE	0x20		/* Counter Overflow iEnable          */
X#define IMR_RDCE	0x40		/* DMA Complete iEnable              */
X
X/* Bits in dp_dcr */
X
X#define DCR_WTS		0x01		/* Word Transfer Select              */
X#	define DCR_BYTEWIDE	0x00	/* WTS: byte wide transfers          */
X#	define DCR_WORDWIDE	0x01	/* WTS: word wide transfers          */
X#define DCR_BOS		0x02		/* Byte Order Select                 */
X#	define DCR_LTLENDIAN	0x00	/* BOS: Little Endian                */
X#	define DCR_BIGENDIAN	0x02	/* BOS: Big Endian                   */
X#define DCR_LAS		0x04		/* Long Address Select               */
X#define DCR_BMS		0x08		/* Burst Mode Select                 */
X#define DCR_AR		0x10		/* Autoinitialize Remote             */
X#define DCR_FTS		0x60		/* Fifo Threshold Select             */
X#	define DCR_2BYTES	0x00	/* 2 bytes                           */
X#	define DCR_4BYTES	0x40	/* 4 bytes                           */
X#	define DCR_8BYTES	0x20	/* 8 bytes                           */
X#	define DCR_12BYTES	0x60	/* 12 bytes                          */
X
X/* Bits in dp_tcr */
X
X#define TCR_CRC		0x01		/* Inhibit CRC                       */
X#define TCR_ELC		0x06		/* Encoded Loopback Control          */
X#	define TCR_NORMAL	0x00	/* ELC: Normal Operation             */
X#	define TCR_INTERNAL	0x02	/* ELC: Internal Loopback            */
X#	define TCR_0EXTERNAL	0x04	/* ELC: External Loopback LPBK=0     */
X#	define TCR_1EXTERNAL	0x06	/* ELC: External Loopback LPBK=1     */
X#define TCR_ATD		0x08		/* Auto Transmit                     */
X#define TCR_OFST	0x10		/* Collision Offset Enable (be nice) */
X
X/* Bits in dp_tsr */
X
X#define TSR_PTX		0x01		/* Packet Transmitted (without error)*/
X#define TSR_DFR		0x02		/* Transmit Deferred                 */
X#define TSR_COL		0x04		/* Transmit Collided                 */
X#define TSR_ABT		0x08		/* Transmit Aborted                  */
X#define TSR_CRS		0x10		/* Carrier Sense Lost                */
X#define TSR_FU		0x20		/* Fifo Underrun                     */
X#define TSR_CDH		0x40		/* CD Heartbeat                      */
X#define TSR_OWC		0x80		/* Out of Window Collision           */
X
X/* Bits in tp_rcr */
X
X#define RCR_SEP		0x01		/* Save Errored Packets              */
X#define RCR_AR		0x02		/* Accept Runt Packets               */
X#define RCR_AB		0x04		/* Accept Broadcast                  */
X#define RCR_AM		0x08		/* Accept Multicast                  */
X#define RCR_PRO		0x10		/* Physical Promiscuous              */
X#define RCR_MON		0x20		/* Monitor Mode                      */
X
X/* Bits in dp_rsr */
X
X#define RSR_PRX		0x01		/* Packet Received Intact            */
X#define RSR_CRC		0x02		/* CRC Error                         */
X#define RSR_FAE		0x04		/* Frame Alignment Error             */
X#define RSR_FO		0x08		/* FIFO Overrun                      */
X#define RSR_MPA		0x10		/* Missed Packet                     */
X#define RSR_PHY		0x20		/* Multicast Address Match !!        */
X#define RSR_DIS		0x40		/* Receiver Disabled                 */
X
X
Xstruct rcvdheader {
X	char	rp_status;		/* Copy of rsr                       */
X	char	rp_next;		/* Pointer to next packet            */
X	char	rp_rbcl;		/* Receive Byte Count Low            */
X	char	rp_rbch;		/* Receive Byte Count High           */
X};
+ END-OF-FILE dp8390.h
chmod 'u=rw,g=r,o=r' 'dp8390.h'
set `wc -c 'dp8390.h'`
count=$1
case $count in
8035)	:;;
*)	echo 'Bad character count in ''dp8390.h' >&2
		echo 'Count should be 8035' >&2
esac
echo Extracting 'dp8390info.h'
sed 's/^X//' > 'dp8390info.h' << '+ END-OF-FILE ''dp8390info.h'
X/*
X * parameters for driver for
X * National Semiconductor DP8390 Network Interface Controller
X */
X
Xextern
Xstruct dp8390info {
X	vir_bytes	dpi_devaddr;	/* device address */
X	char		dpi_pstart;	/* start of recv ring */
X	char		dpi_pstop;	/* end of recv ring */
X	phys_bytes	dpi_membase;	/* memory address of page 0 */
X	phys_bytes	dpi_tbuf;	/* memory address of transmit buffer */
X} dp8390info;
X
+ END-OF-FILE dp8390info.h
chmod 'u=rw,g=r,o=r' 'dp8390info.h'
set `wc -c 'dp8390info.h'`
count=$1
case $count in
402)	:;;
*)	echo 'Bad character count in ''dp8390info.h' >&2
		echo 'Count should be 402' >&2
esac
echo Extracting 'dp8390stat.h'
sed 's/^X//' > 'dp8390stat.h' << '+ END-OF-FILE ''dp8390stat.h'
X#ifdef DPSTAT
X/* statistics from dp8390 */
Xstruct dpstat {
X	long	ds_read;	/* packets read */
X	long	ds_written;	/* packets written */
X        long    ds_fram;	/* Input framing errors */
X        long    ds_crc;		/* Input CRC errors */
X	long	ds_lost;	/* Packets lost */
X	long	ds_btint;	/* Bogus transmit interrupts */
X	long	ds_deferred;	/* Deferred packets */
X	long	ds_collisions;	/* Packets collided at least once */
X	long	ds_xcollisions;	/* Aborts due to excessive collisions */
X	long	ds_carlost;	/* Carrier sense lost */
X	long	ds_fifo;	/* Fifo underrun */
X	long	ds_heartbeat;	/* Heart beat failure */
X	long	ds_lcol;	/* Late collisions */
X};
X#define STINC(x) dpstat.x++
X#define STADD(x,y) dpstat.x += y
X#else
X#define STINC(x)        /* nothing */
X#define STADD(x,y)      /* nothing */
X#endif DPSTAT
+ END-OF-FILE dp8390stat.h
chmod 'u=rw,g=r,o=r' 'dp8390stat.h'
set `wc -c 'dp8390stat.h'`
count=$1
case $count in
821)	:;;
*)	echo 'Bad character count in ''dp8390stat.h' >&2
		echo 'Count should be 821' >&2
esac
echo Extracting 'eplinfo.h'
sed 's/^X//' > 'eplinfo.h' << '+ END-OF-FILE ''eplinfo.h'
X/*
X * parameters for initialisation of 
X * Western Digital Ethercard Plus, or WD8003E
X */
X
Xextern
Xstruct eplinfo {
X	vir_bytes	epi_devaddr;	/* device address */
X} eplinfo;
X
+ END-OF-FILE eplinfo.h
chmod 'u=rw,g=r,o=r' 'eplinfo.h'
set `wc -c 'eplinfo.h'`
count=$1
case $count in
181)	:;;
*)	echo 'Bad character count in ''eplinfo.h' >&2
		echo 'Count should be 181' >&2
esac
echo Extracting 'etherformat.h'
sed 's/^X//' > 'etherformat.h' << '+ END-OF-FILE ''etherformat.h'
X/* Format of packets on the Ethernet */
X
X#define AMOEBAPROTO 0x8145		/* Official Ethernet protocol number */
X
X#define ETHERBITS	0x80		/* These addresses on Ethernet */
X
Xtypedef struct
X{
X    char e[6];
X} Eth_addr;
X
Xtypedef struct
X{
X	Eth_addr	 f_dstaddr;
X	Eth_addr	 f_srcaddr;
X	unshort		 f_proto;
X	struct pktheader f_ah;
X} Framehdr;
X	
Xtypedef struct
X{
X	Framehdr	ep_fr;
X	char		ep_data[1490];
X} Etherpacket;
+ END-OF-FILE etherformat.h
chmod 'u=rw,g=r,o=r' 'etherformat.h'
set `wc -c 'etherformat.h'`
count=$1
case $count in
404)	:;;
*)	echo 'Bad character count in ''etherformat.h' >&2
		echo 'Count should be 404' >&2
esac
echo Extracting 'etherplus.c'
sed 's/^X//' > 'etherplus.c' << '+ END-OF-FILE ''etherplus.c'
X#include "../h/const.h"
X#include "../h/type.h"
X#include "../h/com.h"
X#include "const.h"
X#include "dp8390.h"
X#include "internet.h"
X#include "etherformat.h"
X#include "etherplus.h"
X#include "dp8390info.h"
X#include "eplinfo.h"
X#include "assert.h"
X
X/* macros for device I/O */
X
X#define input(devaddr, ep_register) \
X	inbyte((vir_bytes)&((struct eplusreg *) devaddr)->ep_register)
X#define output(devaddr, ep_register, value) \
X	outbyte((vir_bytes)&((struct eplusreg *) devaddr)->ep_register, value)
X
Xepl_init() {
X	register vir_bytes device;
X	register sum;
X
X	device = eplinfo.epi_devaddr;
X	assert((dp8390info.dpi_membase&0x81FFF)==0x80000);
X	sum =
X		input(device, epl_ea5) +
X		input(device, epl_ea4) +
X		input(device, epl_ea3) +
X		input(device, epl_ea2) +
X		input(device, epl_ea1) +
X		input(device, epl_ea0) +
X		input(device, epl_res2) +
X		input(device, epl_chksum);
X	if ((sum&0xFF) != 0xFF)
X		panic("No ethernet board", NO_NUM);
X	output(device, epl_ctlstatus, CTL_RESET);
X	output(device, epl_ctlstatus, CTL_MENABLE|((dp8390info.dpi_membase>>13)&CTL_MEMADDR));
X}
X
X
Xetheraddr(eaddr) Eth_addr *eaddr; {
X	register vir_bytes device;
X
X	device = eplinfo.epi_devaddr;
X	eaddr->e[0] = input(device, epl_ea0);
X	eaddr->e[1] = input(device, epl_ea1);
X	eaddr->e[2] = input(device, epl_ea2);
X	eaddr->e[3] = input(device, epl_ea3);
X	eaddr->e[4] = input(device, epl_ea4);
X	eaddr->e[5] = input(device, epl_ea5);
X}
+ END-OF-FILE etherplus.c
chmod 'u=rw,g=r,o=r' 'etherplus.c'
set `wc -c 'etherplus.c'`
count=$1
case $count in
1390)	:;;
*)	echo 'Bad character count in ''etherplus.c' >&2
		echo 'Count should be 1390' >&2
esac
echo Extracting 'etherplus.h'
sed 's/^X//' > 'etherplus.h' << '+ END-OF-FILE ''etherplus.h'
X/*
X * Western Digital Ethercard Plus, or WD8003E card
X *
X * This information seems to be guarded like the crown jewels
X */
X
Xstruct eplusreg {
X	char	epl_ctlstatus;		/* Control(write) and status(read)   */
X	char	epl_res1[7];
X	char	epl_ea0;		/* Most significant eaddr byte       */
X	char	epl_ea1;
X	char	epl_ea2;
X	char	epl_ea3;
X	char	epl_ea4;
X	char	epl_ea5;		/* Least significant eaddr byte      */
X	char	epl_res2;
X	char	epl_chksum;		/* sum from epl_ea0 upto here is 0xFF   */
X	dp8390	epl_dp8390;		/* NatSemi chip                      */
X};
X
X/* Bits in epl_ctlstatus */
X
X#define CTL_RESET	0x80		/* Software Reset                    */
X#define CTL_MENABLE	0x40		/* Memory Enable                     */
X#define CTL_MEMADDR	0x3F		/* Bits SA18-SA13, SA19 implicit 1   */
X
X#define STA_IIJ		0x7		/* Interrupt Indication Jumpers      */
+ END-OF-FILE etherplus.h
chmod 'u=rw,g=r,o=r' 'etherplus.h'
set `wc -c 'etherplus.h'`
count=$1
case $count in
826)	:;;
*)	echo 'Bad character count in ''etherplus.h' >&2
		echo 'Count should be 826' >&2
esac
echo Extracting 'exception.h'
sed 's/^X//' > 'exception.h' << '+ END-OF-FILE ''exception.h'
X#define CRASH		((unshort) 0xFF)
+ END-OF-FILE exception.h
chmod 'u=rw,g=r,o=r' 'exception.h'
set `wc -c 'exception.h'`
count=$1
case $count in
32)	:;;
*)	echo 'Bad character count in ''exception.h' >&2
		echo 'Count should be 32' >&2
esac
echo Extracting 'global.h'
sed 's/^X//' > 'global.h' << '+ END-OF-FILE ''global.h'
X/****************************************************************************/
X/*									    */
X/* (c) Copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands */
X/*									    */
X/*    This product is part of the  Amoeba  distributed operating system.    */
X/*									    */
X/*    Permission to use, sell, duplicate or disclose this software must be  */
X/* obtained in writing.  Requests for such permissions may be sent to	    */
X/*									    */
X/*									    */
X/*		Dr. Andrew S. Tanenbaum					    */
X/*		Dept. of Mathematics and Computer Science		    */
X/*		Vrije Universiteit					    */
X/*		Postbus 7161						    */
X/*		1007 MC Amsterdam					    */
X/*		The Netherlands						    */
X/*									    */
X/****************************************************************************/
X
X#define KERNEL		0
X#define USER		1
X
Xtypedef unshort address;
Xtypedef int func;
X
X#define bufptr		vir_bytes
X
X#define NOWHERE		((address) 0)
X#define SOMEWHERE	((address) -1)
X#define NILVECTOR	((func (*)()) 0)
X
X#ifdef lint
X#define ABSPTR(t, c)	(use(c), (t) 0)
X#else
X#define ABSPTR(t, c)	((t) (c))
X#endif
X
X#define bit(b)		(1 << (b))	/* simulate type 'bit' */
X
X#define lobyte(x)	((unshort) (x) & 0xFF)
X#define hibyte(x)	((unshort) (x) >> 8)
X#define concat(x, y)	((unshort) (x) << 8 | (unshort) (y) & 0xFF)
X
X#define sizeoftable(t)	(sizeof(t) / sizeof((t)[0]))
+ END-OF-FILE global.h
chmod 'u=rw,g=r,o=r' 'global.h'
set `wc -c 'global.h'`
count=$1
case $count in
1354)	:;;
*)	echo 'Bad character count in ''global.h' >&2
		echo 'Count should be 1354' >&2
esac
echo Extracting 'internet.h'
sed 's/^X//' > 'internet.h' << '+ END-OF-FILE ''internet.h'
X/****************************************************************************/
X/*									    */
X/* (c) Copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands */
X/*									    */
X/*    This product is part of the  Amoeba  distributed operating system.    */
X/*									    */
X/*    Permission to use, sell, duplicate or disclose this software must be  */
X/* obtained in writing.  Requests for such permissions may be sent to	    */
X/*									    */
X/*									    */
X/*		Dr. Andrew S. Tanenbaum					    */
X/*		Dept. of Mathematics and Computer Science		    */
X/*		Vrije Universiteit					    */
X/*		Postbus 7161						    */
X/*		1007 MC Amsterdam					    */
X/*		The Netherlands						    */
X/*									    */
X/****************************************************************************/
X
X#define PACKETSIZE	1490	/* network packet size - sizeof(framehdr) */
X
X#define BROADCAST	((address) 0xFF)
X
X#define TYPE		0x0F	/* message types */
X#define   LOCATE	0x01
X#define   HERE		0x02
X#define   REQUEST	0x03
X#define   REPLY		0x04
X#define   ACK		0x05
X#define   NAK		0x06
X#define	  ENQUIRY	0x07
X#define   ALIVE		0x08
X#define	  DEAD		0x09
X
X#define LAST		0x10	/* flags */
X#define RETRANS		0x20
X
Xstruct pktheader {
X	char	ph_dstnode;	/* 0: destination node */
X	char	ph_srcnode;	/* 1: source node */
X	char	ph_dsttask;	/* 2: destination task */
X	char	ph_srctask;	/* 3: source task */
X	char	ph_ident;	/* 4: transaction identifier */
X	char	ph_seq;		/* 5: fragment no. */
X	unshort	ph_size;	/* 6: total size of this packet */
X	char	ph_flags;	/* 8: some flags (not used) */
X	char	ph_type;	/* 9: locate, here, data, ack or nak (!= 0) */
X};
X
X#define ph_signal	ph_seq
X
X#define NOSEND		0
X#define SEND		1
X
X#define DONTKNOW	0
X#define LOCAL		1
X#define GLOBAL		2
X
X#define siteaddr(x)	lobyte(x)
X#define tasknum(x)	hibyte(x)
X
X#define pktfrom(ph)	((unshort) (ph->ph_srctask<<8 | ph->ph_srcnode & 0xFF))
X#define pktto(ph)	((unshort) (ph->ph_dsttask<<8 | ph->ph_dstnode & 0xFF))
+ END-OF-FILE internet.h
chmod 'u=rw,g=r,o=r' 'internet.h'
set `wc -c 'internet.h'`
count=$1
case $count in
1958)	:;;
*)	echo 'Bad character count in ''internet.h' >&2
		echo 'Count should be 1958' >&2
esac
echo Extracting 'makefile'
sed 's/^X//' > 'makefile' << '+ END-OF-FILE ''makefile'
X# The kernel dir contains xt_wini.c and at_wini.c.  Before running make
X# you must copy one of these to wini.c, depending on which controller you
X# have.  If you do not have a hard disk, you MUST choose one of them at random.
X# On a PC, cpp and cem are in /lib and will be removed to make space while
X# linking the kernel.  On an AT, they are in /usr/lib are are not removed.
X# This is because they have to be in /lib on a PC; the diskette is too small
X# for them to be in /usr/lib.  You can change this by editing commands/cc.c.
X#
X# Normally, MINIX scrolls the screen using the 6845's registers.  However,
X# on some EGA cards (those that are not IBM compatible), the 6845 is not
X# properly emulated.  On these machines, it is necessary to scroll in
X# software by copying. This is much slower, but it works. The CFLAGS flags are:
X#
X#  -Di8088	- required on an 8088/80286/80386 CPU; forbidden on a 68000
X#  -F		- run cpp and cem sequentially (used when memory is tight)
X#  -T.		- put temporaries in working directory (when RAM disk is small)
X#  -DAM_KERNEL	- includes code for Amoeba transactions
X#  -DNONET	- single machine, no Ethernet available (requires -DAM_KERNEL)
X#  -DSTATISTICS	- include code to collect Ethernet statistics
X#
X# Machines wishing to use Amoeba transactions should add -DAM_KERNEL to CFLAGS.
X# If there is no ethernet connection then also add -DNONET.  The ethernet
X# driver included in this distribution is for the Western Digital Ethercard
X# Plus.  If you want ethernet statistics then add -DSTATISTICS to CFLAGS.
X#
X# When making a kernel on a machine with limited RAM disk, it may be 
X# necessary to use -T. or even remove /lib/cem and /lib/cpp during asld.
X#
XCFLAGS	= -DAM_KERNEL -Di8088  -F -I../../kernel -I.
XA	= ../h
XH	= ../../h
XK	= ../../kernel
XLIB	= /usr/lib
X
XOBJ =	../../kernel/mpx88.s main.s tty.s floppy.s wini.s system.s proc.s \
X	clock.s memory.s printer.s amoeba.s conf.s dp8390.s util.s \
X	etherplus.s portcache.s trans.s table.s ../../kernel/klib88.s dmp.s
X
X
XCOBJS =	main.s tty.s floppy.s wini.s system.s proc.s clock.s memory.s \
X	amoeba.s conf.s dp8390.s util.s etherplus.s portcache.s trans.s \
X	printer.s table.s dmp.s
X
X
Xkernel:	makefile $(OBJ) $(LIB)/libc.a
X	@echo "Start linking Kernel."
X	@asld -o kernel $(OBJ) $(LIB)/libc.a $(LIB)/end.s
X	@echo "Kernel done.  "
X
Xclean:
X	rm -f $(COBJS) kernel
X
Xclock.s:	$K/const.h $K/type.h $H/const.h $H/type.h
Xclock.s:	$H/callnr.h
Xclock.s:	$H/com.h
Xclock.s:	$H/error.h
Xclock.s:	$H/signal.h
Xclock.s:	$K/glo.h
Xclock.s:	$K/proc.h
Xclock.s:	$K/clock.c
X	$(CC) $(CFLAGS) -c $K/clock.c
X
Xdmp.s:		$K/const.h $K/type.h $H/const.h $H/type.h
Xdmp.s:		$H/callnr.h
Xdmp.s:		$H/com.h
Xdmp.s:		$H/error.h
Xdmp.s:		$K/glo.h
Xdmp.s:		$K/proc.h
Xdmp.s:		$K/dmp.c
X	$(CC) $(CFLAGS) -c $K/dmp.c
X
Xfloppy.s:	$K/const.h $K/type.h $H/const.h $H/type.h
Xfloppy.s:	$H/callnr.h
Xfloppy.s:	$H/com.h
Xfloppy.s:	$H/error.h
Xfloppy.s:	$K/glo.h
Xfloppy.s:	$K/proc.h
Xfloppy.s:	$K/floppy.c
X	$(CC) $(CFLAGS) -c $K/floppy.c
X
Xmain.s:		$K/const.h $K/type.h $H/const.h $H/type.h
Xmain.s:		$H/callnr.h
Xmain.s:		$H/com.h
Xmain.s:		$H/error.h
Xmain.s:		$K/glo.h
Xmain.s:		$K/proc.h
Xmain.s:		$K/main.c
X	$(CC) $(CFLAGS) -c $K/main.c
X
Xmemory.s:	$K/const.h $K/type.h $H/const.h $H/type.h
Xmemory.s:	$H/callnr.h
Xmemory.s:	$H/com.h
Xmemory.s:	$H/error.h
Xmemory.s:	$K/proc.h
Xmemory.s:	$K/memory.c
X	$(CC) $(CFLAGS) -c $K/memory.c
X
Xprinter.s:	$K/const.h $K/type.h $H/const.h $H/type.h
Xprinter.s:	$H/callnr.h
Xprinter.s:	$H/com.h
Xprinter.s:	$H/error.h
Xprinter.s:	$K/proc.h
Xprinter.s:	$K/glo.h
Xprinter.s:	$K/printer.c
X	$(CC) $(CFLAGS) -c $K/printer.c
X
Xproc.s:		$K/const.h $K/type.h $H/const.h $H/type.h
Xproc.s:		$H/callnr.h
Xproc.s:		$H/com.h
Xproc.s:		$H/error.h
Xproc.s:		$K/glo.h
Xproc.s:		$K/proc.h
Xproc.s:		$K/proc.c
X	$(CC) $(CFLAGS) -c $K/proc.c
X
Xsystem.s:	$K/const.h $K/type.h $H/const.h $H/type.h
Xsystem.s:	$H/callnr.h
Xsystem.s:	$H/com.h
Xsystem.s:	$H/error.h
Xsystem.s:	$H/signal.h
Xsystem.s:	$K/glo.h
Xsystem.s:	$K/proc.h
Xsystem.s:	$K/system.c
X	$(CC) $(CFLAGS) -c $K/system.c
X
Xtable.s:	$K/const.h $K/type.h $H/const.h $H/type.h $H/com.h
Xtable.s:	$K/glo.h
Xtable.s:	$K/proc.h
Xtable.s:	$K/table.c
X	$(CC) $(CFLAGS) -c $K/table.c
X
Xtty.s:	$K/const.h $K/type.h $H/const.h $H/type.h
Xtty.s:	$H/callnr.h
Xtty.s:	$H/com.h
Xtty.s:	$H/error.h
Xtty.s:	$H/sgtty.h
Xtty.s:	$H/signal.h
Xtty.s:	$K/glo.h
Xtty.s:	$K/proc.h
Xtty.s:	$K/tty.c
X	$(CC) $(CFLAGS) -c $K/tty.c
X
Xwini.s:	$K/const.h $K/type.h $H/const.h $H/type.h
Xwini.s:	$H/callnr.h
Xwini.s:	$H/com.h
Xwini.s:	$H/error.h
Xwini.s:	$K/proc.h
Xwini.s:	$K/wini.c
X	$(CC) $(CFLAGS) -c $K/wini.c
X
Xamoeba.s: $A/amoeba.h
Xamoeba.s: $A/host_os.h
Xamoeba.s: $A/amparam.h
Xamoeba.s: $H/signal.h
Xamoeba.s: $H/type.h
Xamoeba.s: ./assert.h
Xamoeba.s: ./byteorder.h
Xamoeba.s: $K/const.h
Xamoeba.s: ./dp8390info.h
Xamoeba.s: ./etherformat.h
Xamoeba.s: $K/glo.h
Xamoeba.s: ./global.h
Xamoeba.s: ./internet.h
Xamoeba.s: ./mpx.H
Xamoeba.s: ./portcache.H
Xamoeba.s: $K/proc.h
Xamoeba.s: ./task.h
Xamoeba.s: ./trans.H
Xamoeba.s: $K/type.h
Xamoeba.s: amoeba.c
Xconf.s: $A/amoeba.h
Xconf.s: $A/host_os.h
Xconf.s: $H/type.h
Xconf.s: ./conf.h
Xconf.s: ./global.h
Xconf.s: ./mpx.H
Xconf.s: ./portcache.H
Xconf.s: ./task.h
Xconf.s: ./trans.H
Xconf.s: conf.c
Xdp8390.s: $H/com.h
Xdp8390.s: $H/const.h
Xdp8390.s: $H/error.h
Xdp8390.s: $H/type.h
Xdp8390.s: ./assert.h
Xdp8390.s: $K/const.h
Xdp8390.s: ./dp8390.h
Xdp8390.s: ./dp8390info.h
Xdp8390.s: ./dp8390stat.h
Xdp8390.s: ./etherformat.h
Xdp8390.s: ./internet.h
Xdp8390.s: dp8390.c
Xetherplus.s: $H/com.h
Xetherplus.s: $H/const.h
Xetherplus.s: $H/type.h
Xetherplus.s: ./assert.h
Xetherplus.s: $K/const.h
Xetherplus.s: ./dp8390.h
Xetherplus.s: ./dp8390info.h
Xetherplus.s: ./eplinfo.h
Xetherplus.s: ./etherformat.h
Xetherplus.s: ./etherplus.h
Xetherplus.s: ./internet.h
Xetherplus.s: etherplus.c
Xportcache.s: $A/amoeba.h
Xportcache.s: $H/const.h
Xportcache.s: $A/host_os.h
Xportcache.s: $H/type.h
Xportcache.s: ./assert.h
Xportcache.s: ./conf.h
Xportcache.s: $K/const.h
Xportcache.s: ./global.h
Xportcache.s: ./internet.h
Xportcache.s: ./mpx.H
Xportcache.s: ./portcache.H
Xportcache.s: ./task.h
Xportcache.s: ./trans.H
Xportcache.s: portcache.c
Xtrans.s: $A/amoeba.h
Xtrans.s: $H/const.h
Xtrans.s: $A/host_os.h
Xtrans.s: $H/type.h
Xtrans.s: ./amstat.h
Xtrans.s: ./assert.h
Xtrans.s: ./byteorder.h
Xtrans.s: $K/const.h
Xtrans.s: ./exception.h
Xtrans.s: ./global.h
Xtrans.s: ./internet.h
Xtrans.s: ./mpx.H
Xtrans.s: ./portcache.H
Xtrans.s: ./task.h
Xtrans.s: ./trans.H
Xtrans.s: trans.c
Xutil.s: $H/com.h
Xutil.s: $H/const.h
Xutil.s: $H/type.h
Xutil.s: ./assert.h
Xutil.s: $K/const.h
Xutil.s: ./dp8390.h
Xutil.s: ./dp8390info.h
Xutil.s: ./eplinfo.h
Xutil.s: $K/proc.h
Xutil.s: $K/type.h
Xutil.s: util.c
+ END-OF-FILE makefile
chmod 'u=rw,g=r,o=r' 'makefile'
set `wc -c 'makefile'`
count=$1
case $count in
6567)	:;;
*)	echo 'Bad character count in ''makefile' >&2
		echo 'Count should be 6567' >&2
esac
echo Extracting 'mpx.H'
sed 's/^X//' > 'mpx.H' << '+ END-OF-FILE ''mpx.H'
X/****************************************************************************/
X/*									    */
X/* (c) Copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands */
X/*									    */
X/*    This product is part of the  Amoeba  distributed operating system.    */
X/*									    */
X/*    Permission to use, sell, duplicate or disclose this software must be  */
X/* obtained in writing.  Requests for such permissions may be sent to	    */
X/*									    */
X/*									    */
X/*		Dr. Andrew S. Tanenbaum					    */
X/*		Dept. of Mathematics and Computer Science		    */
X/*		Vrije Universiteit					    */
X/*		Postbus 7161						    */
X/*		1007 MC Amsterdam					    */
X/*		The Netherlands						    */
X/*									    */
X/****************************************************************************/
X
Xstruct mpx {
X	short	MX_active;		/* is a transaction in progress */
X	unshort	MX_flags;		/* flags - see below */
X	int	MX_proc_nr;		/* task identifier */
X	header	MX_hdr;			/* storage space for header */
X} tk_mpx;
X
X#ifdef MPX
X
X#define mx_flags	tk_mpx.MX_flags
X#define mx_active	tk_mpx.MX_active
X#define mx_proc_nr	tk_mpx.MX_proc_nr
X#define	mx_hdr		tk_mpx.MX_hdr
X
X
X/* bits in flags: */
X#define RUNNABLE	bit(0)		/* task is runnable */
X#define NESTED		bit(1)		/* nested getreq, trans or putrep */
X#define	BETWEEN		bit(2)		/* between getreq and putrep */
X#else
X
X#define tk_mpx		tk_dummy	/* other modules must not touch it */
X
X#endif
+ END-OF-FILE mpx.H
chmod 'u=rw,g=r,o=r' 'mpx.H'
set `wc -c 'mpx.H'`
count=$1
case $count in
1427)	:;;
*)	echo 'Bad character count in ''mpx.H' >&2
		echo 'Count should be 1427' >&2
esac
echo Extracting 'portcache.H'
sed 's/^X//' > 'portcache.H' << '+ END-OF-FILE ''portcache.H'
X/****************************************************************************/
X/*									    */
X/* (c) Copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands */
X/*									    */
X/*    This product is part of the  Amoeba  distributed operating system.    */
X/*									    */
X/*    Permission to use, sell, duplicate or disclose this software must be  */
X/* obtained in writing.  Requests for such permissions may be sent to	    */
X/*									    */
X/*									    */
X/*		Dr. Andrew S. Tanenbaum					    */
X/*		Dept. of Mathematics and Computer Science		    */
X/*		Vrije Universiteit					    */
X/*		Postbus 7161						    */
X/*		1007 MC Amsterdam					    */
X/*		The Netherlands						    */
X/*									    */
X/****************************************************************************/
X
Xstruct portcache {
X	address PE_location;
X	struct task *PE_link;
X} tk_portcache;
X
X#ifdef PORTCACHE
X
X#define pe_location	tk_portcache.PE_location
X#define pe_link		tk_portcache.PE_link
X
X#else 
X
X#define tk_portcache	tk_dummy	/* other modules must not touch it */
X
X#endif
X
X#define NOWAIT		0
X#define WAIT		1
X
X#define LOOK		0
X#define DELETE		1
+ END-OF-FILE portcache.H
chmod 'u=rw,g=r,o=r' 'portcache.H'
set `wc -c 'portcache.H'`
count=$1
case $count in
1139)	:;;
*)	echo 'Bad character count in ''portcache.H' >&2
		echo 'Count should be 1139' >&2
esac
echo Extracting 'portstat.h'
sed 's/^X//' > 'portstat.h' << '+ END-OF-FILE ''portstat.h'
Xstruct portstat {
X	long pts_alloc;
X	long pts_aged;
X	long pts_full;
X	long pts_wakeup;
X	long pts_here;
X	long pts_lookup;
X	long pts_flocal;
X	long pts_fglobal;
X	long pts_portask;
X	long pts_portyes;
X	long pts_locate;
X	long pts_nolocate;
X	long pts_relocate;
X};
+ END-OF-FILE portstat.h
chmod 'u=rw,g=r,o=r' 'portstat.h'
set `wc -c 'portstat.h'`
count=$1
case $count in
255)	:;;
*)	echo 'Bad character count in ''portstat.h' >&2
		echo 'Count should be 255' >&2
esac
echo Extracting 'task.h'
sed 's/^X//' > 'task.h' << '+ END-OF-FILE ''task.h'
X/****************************************************************************/
X/*									    */
X/* (c) Copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands */
X/*									    */
X/*    This product is part of the  Amoeba  distributed operating system.    */
X/*									    */
X/*    Permission to use, sell, duplicate or disclose this software must be  */
X/* obtained in writing.  Requests for such permissions may be sent to	    */
X/*									    */
X/*									    */
X/*		Dr. Andrew S. Tanenbaum					    */
X/*		Dept. of Mathematics and Computer Science		    */
X/*		Vrije Universiteit					    */
X/*		Postbus 7161						    */
X/*		1007 MC Amsterdam					    */
X/*		The Netherlands						    */
X/*									    */
X/****************************************************************************/
X
X#ifdef BUFFERED				/* HACK */
X#define BUFSIZE		100
X#define NETBUF		((buffer) -1)
X
Xtypedef unshort buffer;
X#endif
X
Xstruct task {
X
X#include "mpx.H"			/* mpx module */
X#include "trans.H"			/* trans module */
X#include "portcache.H"			/* portcache module */
X	char *tk_aux;			/* auxiliary pointer */
X	/* really a hack to make process task more efficient */
X
X};
X
Xextern struct task *curtask, *uppertask;
Xextern unshort ntask;
X
X#define NILTASK		((struct task *) 0)
+ END-OF-FILE task.h
chmod 'u=rw,g=r,o=r' 'task.h'
set `wc -c 'task.h'`
count=$1
case $count in
1259)	:;;
*)	echo 'Bad character count in ''task.h' >&2
		echo 'Count should be 1259' >&2
esac
echo Extracting 'trans.H'
sed 's/^X//' > 'trans.H' << '+ END-OF-FILE ''trans.H'
X/****************************************************************************/
X/*									    */
X/* (c) Copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands */
X/*									    */
X/*    This product is part of the  Amoeba  distributed operating system.    */
X/*									    */
X/*    Permission to use, sell, duplicate or disclose this software must be  */
X/* obtained in writing.  Requests for such permissions may be sent to	    */
X/*									    */
X/*									    */
X/*		Dr. Andrew S. Tanenbaum					    */
X/*		Dept. of Mathematics and Computer Science		    */
X/*		Vrije Universiteit					    */
X/*		Postbus 7161						    */
X/*		1007 MC Amsterdam					    */
X/*		The Netherlands						    */
X/*									    */
X/****************************************************************************/
X
Xstruct trans {
X	char		TS_state;	/* see below */
X	char		TS_flags;	/* several flags - see below */
X	char		TS_clident;	/* ident number for client */
X	char		TS_svident;	/* ident number for server */
X	char		TS_ident;	/* transaction identifier */
X	char		TS_seq;		/* fragment sequence number */
X	char		TS_count;	/* max. number timer may expire */
X	char		TS_signal;	/* signal being sent to the server */
X	unshort		TS_addr;	/* network address of this task */
X	unshort		TS_timer;	/* timer, decremented every sweep */
X	unshort		TS_cltim;	/* client crash timer */
X	address		TS_client;	/* if serving: who's the client */
X	address		TS_server;	/* if in trans: who's the server */
X	port		TS_portcache;	/* this port was used the last time */
X	header	       *TS_rhdr;	/* saved param in getreq or trans */
X	header	       *TS_xhdr;	/* saved param in putrep or trans */
X	bufptr		TS_rbuf;	/* receiver buffer */
X	bufptr		TS_xbuf;	/* transmitter buffer */
X	unshort		TS_rcnt;	/* size of rbuf */
X	unshort		TS_xcnt;	/* size of xbuf */
X	unshort		TS_offset;	/* offset in buffer */
X	unshort		TS_maxloc;	/* max. location time in seconds */
X	long		TS_totloc;	/* total location time in ticks */
X	long		TS_totsvr;	/* total server time in ticks */
X#ifdef BUFFERED
X	address		TS_sender;	/* task that sent the buffer */
X	char	       *TS_savehdr;	/* saved header pointer */
X	buffer		TS_buffer;	/* buffer */
X	unshort		TS_bufcnt;	/* buffer size */
X	unshort		TS_what;	/* REQUEST or REPLY */
X#endif
X} tk_trans;
X
X#ifdef TRANS
X
X#define ts_state	tk_trans.TS_state
X#define ts_flags	tk_trans.TS_flags
X#define ts_clident	tk_trans.TS_clident
X#define ts_svident	tk_trans.TS_svident
X#define ts_ident	tk_trans.TS_ident
X#define ts_seq		tk_trans.TS_seq
X#define ts_timer	tk_trans.TS_timer
X#define ts_count	tk_trans.TS_count
X#define ts_signal	tk_trans.TS_signal
X#define ts_addr		tk_trans.TS_addr
X#define ts_cltim	tk_trans.TS_cltim
X#define ts_client	tk_trans.TS_client
X#define ts_server	tk_trans.TS_server
X#define ts_portcache	tk_trans.TS_portcache
X#define ts_rhdr		tk_trans.TS_rhdr
X#define ts_xhdr		tk_trans.TS_xhdr
X#define ts_rbuf		tk_trans.TS_rbuf
X#define ts_xbuf		tk_trans.TS_xbuf
X#define ts_rcnt		tk_trans.TS_rcnt
X#define ts_xcnt		tk_trans.TS_xcnt
X#define ts_offset	tk_trans.TS_offset
X#define ts_maxloc	tk_trans.TS_maxloc
X#define	ts_totloc	tk_trans.TS_totloc
X#define ts_totsvr	tk_trans.TS_totsvr
X#define ts_sender	tk_trans.TS_sender
X#define ts_savehdr	tk_trans.TS_savehdr
X#define ts_buffer	tk_trans.TS_buffer
X#define ts_bufcnt	tk_trans.TS_bufcnt
X#define ts_what		tk_trans.TS_what
X
X/* possible values of ts_state */
X#define IDLE		0
X#define SENDING		1
X#define DONE		2
X#define ACKED		3
X#define NACKED		4
X#define FAILED		5
X#define WAITBUF		6
X#define RECEIVING	7
X#define ABORT		8
X#define MEMFAULT	9
X
X/* possible flags in ts_flags */
X#define LOCATING	bit(0)	/* blocked in trans locating a port */
X#define PUTREQ		bit(1)	/* blocked in trans sending a request */
X#define GETREQ		bit(2)	/* blocked in getreq */
X#define PUTREP		bit(3)	/* blocked in putrep */
X#define GETREP		bit(4)	/* blocked in trans getting a reply */
X#define SERVING		bit(5)	/* running between getreq and putrep */
X
X#else 
X
X#define tk_trans	tk_dummy	/* other modules must not touch it */
X
X#endif
+ END-OF-FILE trans.H
chmod 'u=rw,g=r,o=r' 'trans.H'
set `wc -c 'trans.H'`
count=$1
case $count in
4005)	:;;
*)	echo 'Bad character count in ''trans.H' >&2
		echo 'Count should be 4005' >&2
esac
echo Extracting 'util.c'
sed 's/^X//' > 'util.c' << '+ END-OF-FILE ''util.c'
X#include "../h/const.h"
X#include "../h/type.h"
X#include "../h/com.h"
X#include "const.h"
X#include "type.h"
X#include "proc.h"
X#include "dp8390.h"
X#include "assert.h"
X#include "dp8390info.h"
X#include "eplinfo.h"
X
X#define  PIC_enable()	port_out(INT_CTL, ENABLE)
X
Xextern char get_byte();
X
Xstruct eplinfo eplinfo = {0x280};
X
Xstruct dp8390info dp8390info = {0x290, 6, 27, 0xC4000, 0xC4000};
X
Xinbyte(port)
X    vir_bytes port;
X{
X    int value;
X
X    port_in(port, &value);
X    return value;
X}
X
Xoutbyte(port, value)
X    vir_bytes port;
X    int value;
X{
X    port_out(port, value);
X}
X
Xgetheader(paddr, pkthead)
X    phys_bytes paddr;
X    struct rcvdheader *pkthead;
X{
X    vir_bytes  seg;
X
X    assert((paddr&0xFFF0000F)==0L);
X    seg = paddr>>4;
X    pkthead->rp_status = get_byte(seg,0);
X    pkthead->rp_next = get_byte(seg,1);
X    pkthead->rp_rbcl = get_byte(seg,2);
X    pkthead->rp_rbch = get_byte(seg,3);
X}
X
X
Xshort
Xgetbint(paddr)
X    phys_bytes paddr;
X{
X    vir_bytes seg,offset;
X
X    seg = paddr >> 4;
X    offset = paddr & 0xF;
X    return (((short)get_byte(seg, offset)&0xFF)<<8) + (short)(get_byte(seg, offset+1)&0xFF);
X}
X
X/*
Xgetbyte(paddr)
Xphys_bytes paddr;
X{
X    vir_bytes	seg;
X    vir_bytes	offset;
X
X    seg = paddr >> 4;
X    offset = paddr & 0xf;
X    return get_byte(seg, offset);
X}
X
X
Xvp_copy(procnr, seg, vir_addr, phys_addr, count)
X    int		procnr;
X    int 	seg;
X    vir_bytes 	vir_addr;
X    phys_bytes 	phys_addr;
X    vir_bytes 	count;
X{
X    phys_bytes 	u_phys;
X    register struct proc *rp;
X    phys_bytes umap();
X
X    rp = proc_addr(procnr);
X    u_phys = umap(rp, seg, vir_addr, count);
X    assert(u_phys!=0L);
X    phys_copy(u_phys, phys_addr, (phys_bytes)count);
X}
X
Xpv_copy(phys_addr, procnr, seg, vir_addr, count)
X    phys_bytes 	phys_addr;
X    int		procnr;
X    int 	seg;
X    vir_bytes 	vir_addr;
X    vir_bytes 	count;
X{
X    phys_bytes 	vir_phys;
X    register struct proc *rp;
X    phys_bytes umap();
X
X    rp = proc_addr(procnr);
X    vir_phys = umap(rp, seg, vir_addr, count);
X    assert(vir_phys!=0L);
X    phys_copy(phys_addr, vir_phys, (phys_bytes)count);
X}
X*/
+ END-OF-FILE util.c
chmod 'u=rw,g=r,o=r' 'util.c'
set `wc -c 'util.c'`
count=$1
case $count in
2063)	:;;
*)	echo 'Bad character count in ''util.c' >&2
		echo 'Count should be 2063' >&2
esac
exit 0