/* ps_device.h
 *
 * Definitions for procedures implemented by each SCSI Device Class
 *
 * $Header: /smsa/bsd:include/dev/ps_device.h:bsd  1.10  $
 * $Source: /smsa/bsd:include/dev/ps_device.h: $
 *
 * Copyright (c) 1989 Acorn Computers Ltd., Cambridge, England
 *
 */

#ifndef	__dev_ps_device_h
#define	__dev_ps_device_h

#ifndef	__dev_ps_structs_h
#include "ps_structs.h"
#endif
#ifndef	__dev_ps_irq_h
#include "ps_irq.h"
#endif

/*
 * Implementations for individual SCSI Device Classes are free
 * to use bits 0-2 in the minor device byte for their own flags.
 * All others are reserved.
 */

/* Device Class Independent SCSI Command Codes */
#define TEST_UNIT_READY       (0x00)
#define REQUEST_SENSE         (0x03)
#define INQUIRY               (0x12)
#define MODE_SENSE            (0x1A)
#define ALLOW_REMOVAL         (0x1e)
#define PREVENT_REMOVAL       (0x1f)	/* technically reserved, but needed
					 * to distinguish between prevent &
					 * allow medium removal */

/* Open and Close */
typedef int (*dev_init) (SCSI_System,
			 SCSI_Cmd *,
			 int /* t_id */,
			 int /* lun  */);

typedef int (*dev_open) (SCSI_System,
			 int /* t_id  */,
			 int /* minor */,
			 int /* type */,
			 int /* flag  */);

typedef int (*dev_close)(SCSI_System,
			 int /* t_id  */,
			 int /* minor */,
			 int /* type */);

/* Block Device Specific */
typedef int (*dev_strategy)(SCSI_System,
			    int   /* t_id                                 */,
			    int   /* minor                                */,
			    int * /* IN start block (DEV_BSIZE)           */
			          /* OUT:                                 */
			          /* VALIDATE sort order (-1 for none)    */
			          /* CALCULATE start block (device block) */,
			    int * /* IN byte count                        */
			          /* OUT block count                      */,
			    long* /* bytes NOT xfer'd                     */,
			    int   /* read/write                           */,
			    int   /* action: VALIDATE / CALCULATE         */);

typedef int (*dev_size)(SCSI_System,
			int     /* t_id */,
			int     /* minor */);

/* Character Device Specific */
typedef int (*dev_ioctl)(SCSI_System,
			 int    /* req   */,
			 char * /* argp  */,
			 int    /* t_id  */,
			 int    /* minor */,
			 int    /* flag  */);

/* Command Block Administration */
typedef int (*dev_cdb)(SCSI_Context *  /* con  */,
		       int             /* size */,
		       int             /* lba  */);

typedef struct {
  dev_init      init;
  dev_open      open;
  dev_close     close;
  dev_strategy  strategy;
  dev_ioctl     ioctl;
  dev_size      size;
  dev_cdb       cdb;
} Proc_Vec;

#endif/*__dev_ps_device_h*/

/* EOF ps_device.h */
