/* $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
 */

#ident	"$Header: pmap_space.c 1.12 90/01/25 $"

/*
 * conf_pmap.c
 *	Configuration for phys-mapped memory driver.
 */

/* $Log:	pmap_space.c,v $
 */

#include "sys/types.h"
#include "sys/devsw.h"
#include "sys/param.h"
#include "sys/hwparam.h"
#include "sys/pmap.h"
#include "config.h"

/*
 * Initialize units:
 *	0-(_PMAP_NUMDEV-1) are reserved (can be run-time set by ioctl or
 *		changed here).  _PMAP_NUMDEV is the number specified on the
 *		"pseudo-device pmap" entry in the configuration file.
 *
 * RESERVE:	reserves a slot in the table; must be run-time filled out with
 *		PMAPIOCSETP to be useful.
 * PHYS:	set up a phys-mapped address range.  System services are not
 *		allowed where this is mapped.  Use for things that can't
 *		behave as generally as a memory board (eg, MBAd's).
 * NPMEM:	set up a non-paged memory address range.  System services
 *		are allowed where this is mapped.  Use for things like
 *		special purpose reserved memory (eg, for an accelerator).
 */

#define	ALM(m,i)	(PA_MBAd(m)+0xd0000+(i)*CLBYTES) /* ALM[i] on MBAd[m] */
#define	RESERVE		{ 0 }				/* reserve space */
#define	PHYS(a,s)	{ a, (s)/NBPG, 0 }		/* phys-map */
#define	NPMEM(a,s)	{ a, (s)/NBPG, PMAP_NPMEM }	/* non-paged mem */

struct	pmap_unit pmap_unit[_PMAP_NUMDEV];
/*
 * The pmap units can be statically initialized by initializing the
 * pmap_unit array entries here with the macros provided above.
 * The _PMAP_NUMDEV in the pmap_unit pmap_unit[_PMAP_NUMDEV] declaration,
 * must be larger than the number of entries declared.  _PMAP_NUMDEV is
 * the number specified on the "pseudo-device pmap" entry in the
 * configuration file.
 */


int	pmap_nunit = sizeof(pmap_unit)/(sizeof(pmap_unit[0]));

extern int pmapmmap();
extern int pmapioctl();
extern int pmapclose();
extern int pmapopen();
extern int nulldev();
extern int nostrmsgio();
extern int nostrpoll();

struct devops pmapdevops = {
	pmapopen,		/* d_open */
	pmapclose,		/* d_close */
	nulldev,		/* d_strategy */
	nulldev,		/* d_minphys */
	nulldev,		/* d_psize */
	nulldev,		/* d_print */
	nulldev,		/* d_read */
	nulldev,		/* d_write */
	pmapioctl,		/* d_ioctl */
	pmapmmap,		/* d_mmap */
	nulldev,		/* d_intr */
	NULL,			/* d_str */
	nostrmsgio,		/* d_strmsgio */
	nostrpoll		/* d_strpoll */
};
