/* ps_direct.h
 *
 * Support for SCSI Direct Access Devices
 *
 * $Header: /smsa/bsd:include/dev/ps_direct.h:bsd  1.12  $
 * $Source: /smsa/bsd:include/dev/ps_direct.h: $
 *
 * Copyright (c) 1989 Acorn Computers Ltd., Cambridge, England
 *
 */

#ifndef	__dev_ps_direct_h
#define	__dev_ps_direct_h

#ifdef _KERNEL
#ifndef	__dev_ps_device_h
#include "ps_device.h"
#endif

extern Proc_Vec direct;
#endif/*_KERNEL*/

/* Device Class Dependent SCSI Command Codes */
#define READ                  (0x08)
#define WRITE                 (0x0a)
#define READ_CAPACITY	      (0x25)
#define READ_EXTENDED         (0x28)
#define WRITE_EXTENDED        (0x2a)

/* Partition Table Information */

#define MAX_PARTITION             (8)
#define TEXT                     (16)
#define END_OF_DISC      (0xFFFFFFFF)
#define ID_MARK          (0x4A657320)

typedef struct {
  unsigned int     start;	/* offset of partition from block 0 */
  unsigned int     length;	/* length of partition in blocks    */
  unsigned int     flags;	/* flags to indicate state          */
          char     text[TEXT];	/* identifying text for partition   */
} Partition;

typedef struct {
  long      time_stamp;		/* monotonic id for table */
  Partition pt[MAX_PARTITION];	/* array of partitions    */
} Table;

typedef struct {
  unsigned int     id;		/* marker to indicate UNIX Info */
  Table            pt;		/* partition table */
} UNIX_Info;

typedef struct
{
  unsigned int     OpenList;    /* list of open devices */
  Table            pt;          /* partition table */
} LUN_Stats;

/* Flags for Partition Table */
#define PT_VALID              (1<<0)
#define PT_READ_ONLY          (1<<1)

/* Names for partitions */
#define P_ROOT                    (0)
#define P_SWAP                    (1)
#define P_BOOT			  (6)
#define P_ALL                     (7)

/* Bit shifts for OpenList */
#define BLOCK_PT_SHIFT MAX_PARTITION

/*
 * ioctls
 */

/*
 * Reading and Writing the Partition Table (RAM copy)
 */

#define WRITEPART     _IOW('d', 0, Table *)
#define READPART      _IOW('d', 1, Table *)

/*
 * Writing the Block size (RAM copy)
 */

#define WRITEBLOCK    _IOW('d', 2, int)

/* Partition Indication bits */

#define PARTITION_BITS (0x07)

#endif/*__dev_ps_direct_h*/

/* EOF ps_direct.h */
