/* $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: ssm_device.h 1.10 90/08/02 $"

#ifndef	_SYS_SSM_DEVICE_H_

/*
 * ssm_device.c
 *	Configuration include file for SSM
 */

/* $Log:	ssm_device.h,v $
 */

#ifdef INKERNEL

struct ssm_device {
    int         busnum;                   /* index into system bus table. */
    int         unit;                     /* Unit #, index into config table */
    int 	segsize;		  /* Size of a DMA segment */
    int		segalign;		  /* driver promises this alignment */
    int		nsegs;			  /* this device need this many segs */
    struct      driver_module   *driver;  /* pointer into "drivers[]" */
    struct      dev_on_bus      *on_bus;  /* points into drivers[].on_busses */
    struct      bus             *bus;
    struct      device_config   *config;
    struct      gen_device      *next;    /* Chain of devices on same bus */
    char       *map_origin;               /* sequent addr of map regs. */
    char       *bus_map_addr;             /* start of dma map, bus side. */
    long        map_extent;               /* # of bytes covered by map. */
    int         n_maps;                   /* Number of maps */
    int         nspaces;                  /* length of devreg, below */
    char       *devreg[1];                 /* could point to CSR or CB */
    /* here starts the ssm specific per device fields */
    struct ctlr_desc *cd;		/* System TOC descriptor address */
    long	*pic_flush_reg;		/* address of the pic flush register */
#ifdef SSM2_PIC_BUG
    char	pic_flush_method;	/* method of PIC flushing */
    long	*pic_flush_memory;	/* address of memory flush for PIC */
#else
    char	pad0;
    long	*pad1;
#endif  /* SSM2_PIC_BUG */
};


#ifdef SSM2_PIC_BUG
/*
 *  defines for pic_flush_method
 *	REG method is for SSM1
 *	MEMORY method is for SSM2 PIC chip bug
 */
#define SSM_PIC_FLUSH_REG	0x01
#define SSM_PIC_FLUSH_MEMORY	0x02
#endif  /* SSM_PIC_BUF */


/* 
 * Definitions from ssm.c 
 */
extern struct dev_on_bus ssm_on_busses[];
extern struct ssm_device ssm_devices[];

/* 
 * Interfaces defined in ssm_vme.c
 */
extern int ssm_vme_probe_setup();
extern int ssm_vme_dma_setup();
extern char *ssm_vme_dma_remap();
extern void ssm_vme_alloc_maps();
extern void ssm_vme_dma_done();
extern void ssm_vme_dma_flush();
extern int ssm_vme_intr_setup();

#define ssm_vme_ack_int ((void (*)())0)

/*
 * External interafaces available from xxx_scsi.c
 */
extern int ssm_ssm_scsi_probe_setup();
extern int ssm_ssm_scsi_intr_setup();
extern void ssm_ssm_scsi_alloc_maps();
extern int ssm_ssm_scsi_dma_setup();
extern void ssm_ssm_scsi_dma_done();
extern int ssm_scsi_polled_cmd();
extern ulong ssm_scsi_start_cmd();

/* 
 * Stubs for bus controller routines to work 
 * with the new autoconfig.
 */
#define ssm_ssm_scsi_dma_remap ((char *(*)())0)
#define ssm_ssm_scsi_dma_flush ((void (*)())0)
#define ssm_ssm_scsi_ack_int ((void (*)())0)

#endif /*INKERNEL*/

#define	_SYS_SSM_DEVICE_H_
#endif	/* _SYS_SSM_DEVICE_H_ */
