plan 9 kernel history: overview | file list | diff list

1993/0915/pc/scsi.c (diff list | history)

pc/scsi.c on 1993/0915
1993/0915    
#include "u.h" 
#include "../port/lib.h" 
#include "mem.h" 
#include "dat.h" 
#include "fns.h" 
#include "io.h" 
#include "../port/error.h" 
 
/* 
 * Known to devscsi.c. 
int scsidebugs[8]; 
int scsiownid = CtlrID; 
 */ 
 
void 
initscsi(void) 
{ 
} 
 
/* 
 * Quick hack. Need to do a better job of dynamic initialisation 
 * for machines with peculiar memory/cache restictions. 
 * Also, what about 16Mb address limit on the Adaptec? 
 */ 
static ulong bufdatasize; 
 
void 
scsibufreset(ulong datasize) 
{ 
	bufdatasize = datasize; 
} 
 
Scsibuf * 
scsibuf(void) 
{ 
	Scsibuf *b; 
 
	b = smalloc(sizeof(*b)); 
	b->virt = smalloc(bufdatasize); 
	b->phys = (void *)(PADDR(b->virt)); 
	return b; 
} 
 
void 
scsifree(Scsibuf *b) 
{ 
	free(b->virt); 
	free(b); 
} 
 
/* 
 * Hack for devvid 
 */ 
Scsibuf * 
scsialloc(ulong n) 
{ 
	Scsibuf *b; 
 
	b = smalloc(sizeof(*b)); 
	b->virt = smalloc(n); 
	b->phys = (void *)(PADDR(b->virt)); 
	return b; 
} 
 
extern int (*aha1542reset(void))(Scsi*, int); 
extern int (*ultra14freset(void))(Scsi*, int); 
 
static int (*exec)(Scsi*, int); 
 
int 
scsiexec(Scsi *p, int rflag) 
{ 
	if(exec == 0) 
		error(Enonexist); 
	return (*exec)(p, rflag); 
} 
 
void 
resetscsi(void) 
{ 
	if(exec = aha1542reset()) 
		return; 
	exec = ultra14freset(); 
} 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)