~kris/9p

9hist

85db0cc9f328a488b24d728dcea52388a7ba4a88 — David du Colombier 27 years ago 6f23ed5
Plan 9 from Bell Labs 1999-05-07
M alphapc/arch164.c => alphapc/arch164.c +5 -3
@@ 42,9 42,11 @@ sginit(void)
	for(pa = 0; pa < 8*1024*1024; pa += BY2PG)
		*pte++ = ((pa>>PGSHIFT)<<1)|1;

	wind[0x400/4] = ISAWINDOW|4|2|1;
	wind[0x400/4] = ISAWINDOW|2|1;
	wind[0x440/4] = 0x00700000;
	wind[0x480/4] = PADDR(sgmap);
	wind[0x480/4] = PADDR(sgmap)>>2;

	wind[0x100/4] = 3;	/* invalidate tlb cache */
}

static void *


@@ 110,7 112,7 @@ ciaerror(void)
static void
corehello(void)
{
	print("cpu%d: CIA revision %d; cnfg %lux cntrl %lux\n",
	print("cpu%d: CIA revision %ld; cnfg %lux cntrl %lux\n",
			0,	/* BUG */
			core[0x80/4] & 0x7f, core[0x140/4], core[0x100/4]);
	print("cpu%d: HAE_IO %lux\n", 0, core[0x440/4]);

M alphapc/audio.h => alphapc/audio.h +1 -1
@@ 2,7 2,7 @@ enum
{
	Bufsize		= 16*1024,	/* 92 ms each */
	Nbuf		= 16,		/* 1.5 seconds total */
	Dma		= 1,
	Dma		= 5,
	IrqAUDIO	= 5,
	SBswab		= 0,
};

M alphapc/devfloppy.c => alphapc/devfloppy.c +2 -2
@@ 56,14 56,12 @@ enum
FType floppytype[] =
{
 { "3½HD",	T1440kb, 512, 18, 2, 1, 80, 0x1B, 0x54,	0, },
/*
 { "3½DD",	T1440kb, 512,  9, 2, 1, 80, 0x1B, 0x54, 2, },
 { "3½DD",	T720kb,  512,  9, 2, 1, 80, 0x1B, 0x54, 2, },
 { "5¼HD",	T1200kb, 512, 15, 2, 1, 80, 0x2A, 0x50, 0, },
 { "5¼DD",	T1200kb, 512,  9, 2, 2, 40, 0x2A, 0x50, 1, },
 { "ATT3B1",	T1200kb, 512,  8, 2, 2, 48, 0x2A, 0x50, 1, },
 { "5¼DD",	T360kb,  512,  9, 2, 1, 40, 0x2A, 0x50, 2, },
 */
};

/*


@@ 806,6 804,8 @@ floppyxfer(FDrive *dp, int cmd, void *a, long off, long n)
		return 0;
	if(off + n > dp->t->cap)
		n = dp->t->cap - off;
if(cmd == Fread)
    memset(a, 0x55, n);

	/* retry on error (until it gets ridiculous) */
	tries = 0;

M alphapc/dma.c => alphapc/dma.c +17 -1
@@ 4,6 4,8 @@
#include	"dat.h"
#include	"fns.h"

#include	"io.h"

typedef struct DMAport	DMAport;
typedef struct DMA	DMA;
typedef struct DMAxfer	DMAxfer;


@@ 166,13 168,13 @@ dmasetup(int chan, void *va, long len, int isread)

	dp = &dma[(chan>>2)&1];
	chan = chan & 3;
	xp = &dp->x[chan];
//print("va%lux+", va);
#define tryPCI
#ifndef PCIWADDR
#define PCIWADDR(va)	PADDR(va)
#endif /* PCIWADDR */
#ifdef notdef
	xp = &dp->x[chan];

	/*
	 *  if this isn't kernel memory or crossing 64k boundary or above 16 meg


@@ 201,6 203,20 @@ dmasetup(int chan, void *va, long len, int isread)
#endif /* tryISA */
#ifdef tryPCI
	pa = PCIWADDR(va);
	if((((ulong)va)&0xF0000000) != KZERO){
		if(xp->bva == nil)
			return -1;
		if(len > xp->blen)
			len = xp->blen;
		if(!isread)
			memmove(xp->bva, va, len);
		xp->va = va;
		xp->len = len;
		xp->isread = isread;
		pa = PCIWADDR(xp->bva);
	}
	else
		xp->len = 0;
#endif /* tryPCI */

	/*

M alphapc/ether2114x.c => alphapc/ether2114x.c +2 -1
@@ 1326,6 1326,7 @@ reset(Ether* ether)
	uchar ea[Eaddrlen];
	static int scandone;

pcihinv(nil);
	if(scandone == 0){
		dec2114xpci();
		scandone = 1;


@@ 1418,5 1419,5 @@ reset(Ether* ether)
void
ether2114xlink(void)
{
	addethercard("21140",  reset);
	addethercard("2114x",  reset);
}

M alphapc/io.h => alphapc/io.h +26 -9
@@ 152,11 152,12 @@ typedef struct Pcidev {
	struct {
		ulong	bar;		/* base address */
		int	size;
	} mem[3];
	} mem[6];

	uchar	intl;			/* interrupt line */
	ushort	ccru;

	uchar	ccrp;
	uchar	ccru;
	uchar	ccrb;

	Pcidev*	list;
	Pcidev*	bridge;			/* down a bus */


@@ 182,12 183,18 @@ struct PCMmap {
 *  SCSI bus
 */
enum {
	MaxScsi		= 8,
	NTarget		= 8,		/* should be 16... */
	MaxTarget	= 16,
};
struct Target {

typedef struct Scsi Scsi;
typedef struct Target Target;
typedef struct SCSIdev SCSIdev;

typedef struct Target {
	int	ctlrno;
	int	target;
	Scsi*	ctlr;
	int	targetno;

	uchar*	inq;
	uchar*	scratch;



@@ 196,11 203,21 @@ struct Target {
	int	ok;
};

typedef int (*Scsiio)(Target*, int, uchar*, int, void*, int*);
typedef struct Scsi {
	ISAConf;
	int	ctlrno;
	Pcidev*	pcidev;
	int	(*io)(Target*, int, uchar*, int, void*, int*);
	void	*ctlr;
	int	ntarget;

	Scsi*	next;
} Scsi;

typedef struct SCSIdev {
	char*	type;
	Scsiio	(*reset)(int, ISAConf*);
	Scsi*	(*pnp)(void);
	int	(*reset)(Scsi*);
} SCSIdev;

#define PCIWINDOW	0x40000000

M alphapc/main.c => alphapc/main.c +6 -2
@@ 274,14 274,18 @@ char *confname[] =
{
	"ether0",
	"scsi0",
	"scsi1",
	"scsi2",
	"audio0",

};

char *confval[] =
{
	"type=21140",
	"type=aic7xxx",
	"type=2114x",
	"type=ata",
	"type=ata",
	"type=ata",
	"type=sb16",
};


M alphapc/pci.c => alphapc/pci.c +15 -10
@@ 40,11 40,12 @@ pciscan(int bno, Pcidev** list)
		maxfno = 0;
		for(fno = 0; fno <= maxfno; fno++){
			/*
			 * For this possible device, form the bus+device+function
			 * triplet needed to address it and try to read the vendor
			 * and device ID. If successful, allocate a device struct
			 * and start to fill it in with some useful information from
			 * the device's configuration space.
			 * For this possible device, form the
			 * bus+device+function triplet needed to address it
			 * and try to read the vendor and device ID.
			 * If successful, allocate a device struct and
			 * start to fill it in with some useful information
			 * from the device's configuration space.
			 */
			tbdf = MKBUS(BusPCI, bno, dno, fno);
			l = pcicfgrw32(tbdf, PciVID, 0, 1);


@@ 70,7 71,9 @@ pciscan(int bno, Pcidev** list)
			pcitail = p;

			p->intl = pcicfgr8(p, PciINTL);
			p->ccru = pcicfgr16(p, PciCCRu);
			p->ccrp = pcicfgr8(p, PciCCRp);
			p->ccru = pcicfgr8(p, PciCCRu);
			p->ccrb = pcicfgr8(p, PciCCRb);

			/*
			 * If the device is a multi-function device adjust the


@@ 84,7 87,7 @@ pciscan(int bno, Pcidev** list)
			 * If appropriate, read the base address registers
			 * and work out the sizes.
			 */
			switch(p->ccru>>8){
			switch(p->ccrb){

			case 0x01:		/* mass storage controller */
			case 0x02:		/* network controller */


@@ 129,7 132,7 @@ pciscan(int bno, Pcidev** list)
		/*
		 * Find PCI-PCI bridges and recursively descend the tree.
		 */
		if(p->ccru != ((0x06<<8)|0x04))
		if(p->ccrb != 0x06 || p->ccru != 0x04)
			continue;

		/*


@@ 311,14 314,16 @@ pcihinv(Pcidev* p)
	int i;
	Pcidev *t;

	if(pcicfgmode == -1)
		pcicfginit();
	if(p == nil) {
		p = pciroot;
		print("bus dev type vid  did intl memory\n");
	}
	for(t = p; t != nil; t = t->link) {
		print("%d  %2d/%d %.4ux %.4ux %.4ux %2d  ",
		print("%d  %2d/%d %.2ux %.2ux %.2ux %.4ux %.4ux %2d  ",
			BUSBNO(t->tbdf), BUSDNO(t->tbdf), BUSFNO(t->tbdf),
			t->ccru, t->vid, t->did, t->intl);
			t->ccrb, t->ccru, t->ccrp, t->vid, t->did, t->intl);

		for(i = 0; i < nelem(p->mem); i++) {
			if(t->mem[i].size == 0)

M pc/devfloppy.c => pc/devfloppy.c +1 -1
@@ 682,7 682,7 @@ floppyrecal(FDrive *dp)

/*
 *  if the controller or a specific drive is in a confused state,
 *  reset it and get back to a kown state
 *  reset it and get back to a known state
 */
static void
floppyrevive(void)

M pc/scsi.c => pc/scsi.c +6 -6
@@ 222,7 222,7 @@ scsiinv(int devno, int *type, Target **rt, uchar **inq, char *id)
}

int
scsitest(Target *t, char lun)
scsitest(Target *t, int lun)
{
	uchar cmd[6];



@@ 233,7 233,7 @@ scsitest(Target *t, char lun)
}

int
scsistart(Target *t, char lun, int s)
scsistart(Target *t, int lun, int s)
{
	uchar cmd[6];



@@ 245,7 245,7 @@ scsistart(Target *t, char lun, int s)
}

int
scsiinquiry(Target *t, char lun, void *data, int *datalen)
scsiinquiry(Target *t, int lun, void *data, int *datalen)
{
	uchar cmd[6];



@@ 257,7 257,7 @@ scsiinquiry(Target *t, char lun, void *data, int *datalen)
}

int
scsicap(Target *t, char lun, ulong *size, ulong *bsize)
scsicap(Target *t, int lun, ulong *size, ulong *bsize)
{
	int s, nbytes;
	uchar cmd[10], *d;


@@ 281,7 281,7 @@ scsicap(Target *t, char lun, ulong *size, ulong *bsize)
}

int
scsibio(Target *t, char lun, int dir, void *b, long n, long bsize, long bno)
scsibio(Target *t, int lun, int dir, void *b, long n, long bsize, long bno)
{
	uchar cmd[10];
	int s, cdbsiz, nbytes;


@@ 331,7 331,7 @@ static char *key[] =
};

int
scsireqsense(Target *t, char lun, void *data, int *nbytes, int quiet)
scsireqsense(Target *t, int lun, void *data, int *nbytes, int quiet)
{
	char *s;
	int n, status, try;

M port/devsd.c => port/devsd.c +1 -1
@@ 42,7 42,7 @@ struct Disk
{
	QLock;
	Target*	t;
	uchar	lun;
	int	lun;
	char	id[NAMELEN];
	char	vol[NAMELEN];


M port/portfns.h => port/portfns.h +6 -6
@@ 271,16 271,16 @@ void		scheddump(void);
void		schedinit(void);
int		screenbits(void);
#define		scsialloc(n)	mallocz((n)+512, 0)
int		scsibio(Target*, char, int, void*, long, long, long);
int		scsicap(Target*, char, ulong*, ulong*);
int		scsibio(Target*, int, int, void*, long, long, long);
int		scsicap(Target*, int, ulong*, ulong*);
int		scsierrstr(int);
int		scsiexec(Target*, int, uchar*, int, void*, int*);
#define		scsifree(p)	free(p)
int		scsiinquiry(Target*, char, void*, int*);
int		scsiinquiry(Target*, int, void*, int*);
int		scsiinv(int, int*, Target**, uchar**, char*);
int		scsireqsense(Target*, char, void*, int*, int);
int		scsistart(Target*, char, int);
int		scsitest(Target*, char);
int		scsireqsense(Target*, int, void*, int*, int);
int		scsistart(Target*, int, int);
int		scsitest(Target*, int);
Target*		scsiunit(int, int);
long		seconds(void);
ulong		segattach(Proc*, ulong, char *, ulong, ulong);