Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dkio(4S) — OS/MP 4.1A3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fd(4S)

ip(4P)

sd(4S)

xd(4S)

dkcl(8)

DKIO(4S)  —  DEVICES AND NETWORK INTERFACES

NAME

dkio − generic disk control operations

DESCRIPTION

All Solbourne disk drivers support a set of ioctl’s for disk formatting and labeling operations.  Basic to these ioctl’s are the definitions in <mfg/dkio.h>:


/∗ @(#) dkio.h 1.3@(#) Solbourne id 1/22/91 07:26:06 ∗/
/∗
 ∗ Copyright 1988 Solbourne Computer, Inc.
 ∗ All rights reserved.
 ∗/
/∗@(#)dkio.h 5.31 89/12/15 SMI∗/
 /∗
 ∗ Copyright (c) 1987 by Sun Microsystems, Inc.
 ∗/
 #ifndef _sun_dkio_h
#define_sun_dkio_h
 #include <sys/ioctl.h>
#include <mfg/dklabel.h>
 /∗
 ∗ Structures and definitions for disk io control commands
 ∗/
 /∗
 ∗ Structures used as data by ioctl calls.
 ∗/
 /∗
 ∗ Used for controller info
 ∗/
struct dk_info {
intdki_ctlr;/∗ controller address ∗/
shortdki_unit;/∗ unit (slave) address ∗/
shortdki_ctype;/∗ controller type ∗/
shortdki_flags;/∗ flags ∗/
};
 #defineDK_DEVLEN16/∗ device name max length, including ∗/
/∗ unit # & NULL (ie - "xyc1") ∗/
/∗
 ∗ Used for configuration info
 ∗/
struct dk_conf {
chardkc_cname[DK_DEVLEN];/∗ controller name (no unit #) ∗/
u_shortdkc_ctype;/∗ controller type ∗/
u_shortdkc_flags;/∗ flags ∗/
shortdkc_cnum;/∗ controller number ∗/
intdkc_addr;/∗ controller address ∗/
u_intdkc_space;/∗ controller bus type ∗/
intdkc_prio;/∗ interrupt priority ∗/
intdkc_vec;/∗ interrupt vector ∗/
chardkc_dname[DK_DEVLEN];/∗ drive name (no unit #) ∗/
shortdkc_unit;/∗ unit number ∗/
shortdkc_slave;/∗ slave number ∗/
};
 /∗
 ∗ Controller types
 ∗/
#defineDKC_UNKNOWN0
/∗ 1 used to be Interphase 2180 ∗/
#defineDKC_WDC28802
/∗ 3 used to be Interphase 2181 ∗/
/∗ 4 used to be Xylogics 440 ∗/
#defineDKC_DSD52155
#defineDKC_XY4506
#defineDKC_ACB40007
#defineDKC_MD218
/∗ 9 used to be Xylogics 751 ∗/
#defineDKC_NCRFLOPPY10
/∗ #defineDKC_XB140110 does not match dkinfo.c∗/
#defineDKC_XD705311
#defineDKC_XD753DKC_XD7053/∗ Solbourne ∗/
#defineDKC_XD753_SMDDKC_XD7053/∗ Solbourne ∗/
#defineDKC_SMSFLOPPY12
#defineDKC_SCSI_CCS13
#defineDKC_INTEL8207214/∗ floppy ctlr on campus and hydra ∗/
#defineDKC_PANTHER15
#define DKC_SUN_IPI1DKC_PANTHER/∗ Sun Panther VME/IPI controller ∗/
#defineDKC_MD16/∗ meta-disk (virtual-disk) driver ∗/
#define DKC_CDC_905717/∗ CDC 9057-321 (CM-3) IPI String Controller ∗/
#define DKC_FJ_M106018/∗ Fujitsu/Intellistor M1060 IPI-3 SC ∗/
/∗ Solbourne specific devices ... ∗/
#defineDKC_RF350030
#defineDKC_IOASIC31
#defineDKC_XD753_IPI32
 /∗ ASCII table of controller types used by dkinfo ... ∗/
#define DKC_ASCII_UNKNOWN"Unknown"
#define DKC_ASCII_UNKNOWN_2DKC_ASCII_UNKNOWN, DKC_ASCII_UNKNOWN
#define DKC_ASCII_UNKNOWN_4DKC_ASCII_UNKNOWN_2, DKC_ASCII_UNKNOWN_2
#define DKC_ASCII_UNKNOWN_8DKC_ASCII_UNKNOWN_4, DKC_ASCII_UNKNOWN_4
#define DKC_ASCII\
    {\
DKC_ASCII_UNKNOWN_2,/∗   0-1 ∗/\
"WDC 2880",/∗     2 ∗/\
DKC_ASCII_UNKNOWN_2,/∗   3-4 ∗/\
"DSD 5215",/∗     5 ∗/\
"Xylogics 450/451",/∗     6 ∗/\
"Adaptec ACB4000",/∗     7 ∗/\
"Emulex MD21",/∗     8 ∗/\
DKC_ASCII_UNKNOWN,/∗     9 ∗/\
"NCR SCSI Floppy",/∗    10 ∗/\
"xd: Xylogics 753",/∗    11 ∗/\
"SMS SCSI Floppy",/∗    12 ∗/\
"SCSI CCS",/∗    13 ∗/\
"Intel Floppy",/∗    14 ∗/\
"Panther",/∗    15 ∗/\
"Meta-disk",/∗    16 ∗/\
"CDC 9057-321",/∗    17 ∗/\
"Fujitsu M1060 IPI-3SC",/∗    18 ∗/\
DKC_ASCII_UNKNOWN,/∗    19 ∗/\
DKC_ASCII_UNKNOWN_2,/∗ 20-21 ∗/\
DKC_ASCII_UNKNOWN_8,/∗ 22-29 ∗/\
"sr: Ciprico RF-3500",/∗    30 ∗/\
"si: SCSI IOASIC",/∗    31 ∗/\
"xd: Xylogics SV-{67}800",/∗    32 ∗/\
DKC_ASCII_UNKNOWN\
    }
/∗
 ∗ Flags
 ∗/
#defineDKI_BAD1440x01/∗ use DEC std 144 bad sector fwding ∗/
#defineDKI_MAPTRK0x02/∗ controller does track mapping ∗/
#defineDKI_FMTTRK0x04/∗ formats only full track at a time ∗/
#defineDKI_FMTVOL0x08/∗ formats only full volume at a time ∗/
#defineDKI_FMTCYL0x10/∗ formats only full cylinders at a time ∗/
#define DKI_HEXUNIT0x20/∗ unit number is printed as 3 hex digits ∗/
/∗ Solbourne Specific Flags ... ∗/
#defineDKI_SEQOPT0x1000/∗ optimized for sequential operations ∗/
 /∗
 ∗ Used for drive info
 ∗/
struct dk_type {
u_short dkt_hsect;/∗ hard sector count (read only) ∗/
u_short dkt_promrev;/∗ prom revision (read only) ∗/
u_chardkt_drtype;/∗ drive type (ctlr specific) ∗/
u_chardkt_drstat;/∗ drive status (ctlr specific, ro) ∗/
};
 /∗
 ∗ Used for all partitions
 ∗/
struct dk_allmap {
struct dk_mapdka_map[NDKMAP];
};
 /∗
 ∗ Used for bad sector map
 ∗/
struct dk_badmap {
caddr_t dkb_bufaddr;/∗ address of user’s map buffer ∗/
};
 /∗
 ∗ Definition of a disk’s geometry
 ∗/
struct dk_geom {
unsigned shortdkg_ncyl;/∗ # of data cylinders ∗/
unsigned shortdkg_acyl;/∗ # of alternate cylinders ∗/
unsigned shortdkg_bcyl;/∗ cyl offset (for fixed head area) ∗/
unsigned shortdkg_nhead;/∗ # of heads ∗/
unsigned shortdkg_obs1;/∗ obsolete ∗/
unsigned shortdkg_nsect;/∗ # of data sectors per track ∗/
unsigned shortdkg_intrlv;/∗ interleave factor ∗/
unsigned shortdkg_obs2;/∗ obsolete ∗/
unsigned shortdkg_obs3;/∗ obsolete ∗/
unsigned shortdkg_apc;/∗ alternates per cyl (SCSI only) ∗/
unsigned shortdkg_rpm;/∗ revolutions per minute ∗/
unsigned shortdkg_pcyl;/∗ # of physical cylinders ∗/
unsigned shortdkg_extra[7];/∗ for compatible expansion ∗/
};
/∗
 ∗ These defines are for historic compatibility with old drivers.
 ∗/
#definedkg_bheaddkg_obs1/∗ used to be head offset ∗/
#definedkg_gap1dkg_obs2/∗ used to be gap1 ∗/
#definedkg_gap2dkg_obs3/∗ used to be gap2 ∗/
 /∗
 ∗ Used for generic commands
 ∗/
struct dk_cmd {
u_shortdkc_cmd;/∗ command to be executed ∗/
intdkc_flags;/∗ execution flags ∗/
daddr_tdkc_blkno;/∗ disk address for command ∗/
intdkc_secnt;/∗ sector count for command ∗/
caddr_tdkc_bufaddr;/∗ user’s buffer address ∗/
u_intdkc_buflen;/∗ size of user’s buffer ∗/
};
 /∗
 ∗ Execution flags.
 ∗/
#defineDK_SILENT0x01/∗ no error messages ∗/
#defineDK_DIAGNOSE0x02/∗ fail if any error occurs ∗/
#defineDK_ISOLATE0x04/∗ isolate from normal commands ∗/
#defineDK_READ0x08/∗ read from device ∗/
#defineDK_WRITE0x10/∗ write to device ∗/
 /∗
 ∗ Used for disk diagnostics
 ∗/
struct dk_diag {
u_shortdkd_errcmd;/∗ most recent command in error ∗/
daddr_tdkd_errsect;/∗ most recent sector in error ∗/
u_chardkd_errno;/∗ most recent error number ∗/
u_chardkd_severe;/∗ severity of most recent error ∗/
};
 /∗
 ∗ Used for getting disk error log.
 ∗/
struct dk_loghdr {
longdkl_entries;/∗ number of dk_log entries ∗/
longdkl_max_size;/∗ max. size of dk_log table ∗/
caddr_tdkl_logbfr;/∗ pointer to dk_log table ∗/
};
 /∗
 ∗ Disk error log table entry.
 ∗/
struct dk_log {
daddr_tblock;/∗ location of block in error ∗/
u_longcount;/∗ number of failures ∗/
shorttype;/∗ type of error (e.g. soft error) ∗/
shorterr1;/∗ primary error code (e.g sense key) ∗/
shorterr2;/∗ secondary error code ∗/
};
 /∗
 ∗ Dk_log type flags.
 ∗
 ∗ FIXME:  Really should specify dkd_errno error codes.
 ∗For some reason they’re specified in the drivers
 ∗instead of here??  Should also use those here for
 ∗dk_log.type too.
 ∗/
#defineDKL_SOFT0x01/∗ recoverable erro ∗/
#defineDKL_HARD0x02/∗ unrecoverable error ∗/
 /∗
 ∗ Used for floppies
 ∗/
struct fdk_char{
u_char medium;/∗ medium type. Unused, why have it? history! ∗/
int transfer_rate;/∗ transfer rate ∗/
int ncyl;/∗ number of cylinders ∗/
int nhead;/∗ number of heads ∗/
int sec_size;/∗ sector size ∗/
int secptrack;/∗ sectors per track ∗/
int steps;/∗ number of steps per  ∗/
};
 struct fdk_state {
intfkc_bsec;/∗ bytes per sector ∗/
int fkc_strack;/∗ sectors per track ∗/
intfkc_step;/∗ step rate ∗/
intfkc_rate;/∗ data rate ∗/
intfkc_error;/∗ error returned by controller ∗/
};
 struct fdk_cmd {/∗ used by generic command ∗/
struct dk_cmd dcmd;/∗ disk command info ∗/
struct fdk_state fstate; /∗ floppy state info ∗/
};
 /∗
 ∗ Floppy commands
 ∗/
#defineFKWRITE 1
#defineFKREAD  2
#defineFKSEEK3
#defineFKREZERO 4
#defineFKFORMAT_UNIT 5
#defineFKFORMAT_TRACK 6
 /∗
 ∗ Used by FDKGETCHANGE, return state of the sense disk change bit.
 ∗/
#defineFDKGC_HISTORY0x01/∗ disk has changed since last call ∗/
#defineFDKGC_CURRENT0x02/∗ current state of disk change ∗/
 /∗
 ∗ Used by FDK{G, S}ETDRIVECHAR
 ∗/
struct fdk_drive {
int fdd_ejectable;/∗ does the drive support eject? ∗/
int fdd_maxsearch;/∗ size of per-unit search table ∗/
 int fdd_writeprecomp;/∗ cyl to start write prcompensation ∗/
int fdd_writereduce;/∗ cyl to start recucing write current ∗/
int fdd_stepwidth;/∗ width of step pulse in 1 us units ∗/
int fdd_steprate;/∗ step rate in 100 us units ∗/
int fdd_headsettle;/∗ delay, in 100 us units ∗/
int fdd_headload;/∗ delay, in 100 us units ∗/
int fdd_headunload;/∗ delay, in 100 us units ∗/
int fdd_motoron;/∗ delay, in 100 ms units ∗/
int fdd_motoroff;/∗ delay, in 100 ms units ∗/
int fdd_precomplevel;/∗ bit shift, in nano-secs ∗/
int fdd_pins;/∗ defines meaning of pin 1, 2, 4, and 34 ∗/
int fdd_flags;/∗ TRUE READY, Starting Sector #, & Motor On ∗/
};
 /∗
 ∗ Used by FDK{G, S}ETSEARCH
 ∗/
struct fdk_search {
intfdk_numentries; /∗ number of elements in the table ∗/
struct fdk_char ∗fdk_search;
};
 /∗
 ∗ Used by F_RAW
 ∗/
struct fdraw {
charfr_cmd[10];/∗ user-supplied command bytes ∗/
short   fr_cnum;/∗ number of command bytes ∗/
char    fr_result[10];  /∗ controller-supplied result bytes ∗/
shortfr_nbytes;/∗ number to transfer if read/write command ∗/
char∗fr_addr;/∗ where to transfer if read/write command ∗/
};
 /∗
 ∗ Floppy raw commands
 ∗/
#defineFRAW_SPECIFY0x03
#defineFRAW_READID0x0a
#defineFRAW_SENSE_DRV0x04
#defineFRAW_REZERO0x07
#defineFRAW_SEEK0x0f
#defineFRAW_SENSE_INT0x08
#defineFRAW_FORMAT0x0d
#defineFRAW_READTRACK0x02
#defineFRAW_WRCMD0x05
#defineFRAW_RDCMD0x06
#defineFRAW_WRITEDEL0x09
#defineFRAW_READDEL0x0c
 /∗
 ∗ Severity values
 ∗/
#defineDK_NOERROR0
#defineDK_CORRECTED1
#defineDK_RECOVERED2
#defineDK_FATAL3
 /∗
 ∗ Error types
 ∗/
#defineDK_NONMEDIA0/∗ not caused by a media defect ∗/
#defineDK_ISMEDIA1/∗ caused by a media defect ∗/
  /∗
 ∗ Disk io control commands
 ∗/
#defineDKIOCGGEOM_IOR(d, 2, struct dk_geom)/∗ Get geometry ∗/
#defineDKIOCSGEOM_IOW(d, 3, struct dk_geom)/∗ Set geometry ∗/
#defineDKIOCGPART_IOR(d, 4, struct dk_map)/∗ Get partition info ∗/
#defineDKIOCSPART_IOW(d, 5, struct dk_map)/∗ Set partition info ∗/
#defineDKIOCINFO_IOR(d, 8, struct dk_info)/∗ Get info ∗/
#defineDKIOCGCONF_IOR(d, 126, struct dk_conf)/∗ Get conf info ∗/
#defineDKIOCSTYPE_IOW(d, 125, struct dk_type)/∗ Set drive info ∗/
#defineDKIOCGTYPE_IOR(d, 124, struct dk_type)/∗ Get drive info ∗/
#defineDKIOCSAPART_IOW(d, 123, struct dk_allmap)/∗ Set all partitions ∗/
#defineDKIOCGAPART_IOR(d, 122, struct dk_allmap)/∗ Get all partitions ∗/
#defineDKIOCSBAD_IOW(d, 121, struct dk_badmap)/∗ Set bad sector map ∗/
#defineDKIOCGBAD_IOW(d, 120, struct dk_badmap)/∗ Get bad sector map ∗/
#defineDKIOCSCMD_IOW(d, 119, struct dk_cmd)/∗ Set generic cmd ∗/
#defineDKIOCGLOG_IOR(d, 118, struct dk_loghdr)/∗ Get error log ∗/
#defineDKIOCGDIAG_IOR(d, 116, struct dk_diag)/∗ Get diagnostics ∗/
#defineDKIOCWCHK_IOWR(d, 115, int)/∗ Toggle write check ∗/
#defineFDKIOGCHAR_IOR(d, 114, struct fdk_char)/∗ GetCharacteristics ∗/
#defineFDKIOSCHAR_IOW(d, 113, struct fdk_char)/∗ SetCharacteristics ∗/
#defineFDKEJECT_IO(d, 112)/∗ Eject floppy disk ∗/
#defineFDKGETCHANGE_IOR(d, 111, int)/∗ Get diskchng stat ∗/
#defineFDKGETDRIVECHAR_IOR(d, 110, struct fdk_drive)/∗ Get drivechar ∗/
#defineFDKSETDRIVECHAR_IOW(d, 109, struct fdk_drive)/∗ Set drivechar ∗/
#defineFDKGETSEARCH_IOR(d, 108, struct fdk_search)/∗ Get search tbl ∗/
#defineFDKSETSEARCH_IOW(d, 107, struct fdk_search)/∗ Set search tbl ∗/
#defineFDKIOCSCMD_IOWR(d, 106, struct fdk_cmd)/∗ Floppy command ∗/
#defineF_RAW_IOWR(d, 105, struct fdraw)/∗ ECDstyle genericcmd∗/
 #ifdefsolbourne
/∗ Solbourne specific ioctls... ∗/
#defineDKIOCSTOP_IO(d,  150)/∗ Stop drive ∗/
#endifsolbourne
#endif /∗!_sun_dkio_h∗/

The DKIOCINFO ioctl returns a dk_info structure which tells the type of the controller and attributes about how bad-block processing is done on the controller.  The DKIOCGPART and DKIOCSPART get and set the controller’s current notion of the partition table for the disk (without changing the partition table on the disk itself), while the DKIOCGGEOM and DKIOCSGEOM ioctl’s do similar things for the per-drive geometry information. 

SEE ALSO

fd(4S), ip(4P), sd(4S), xd(4S), dkcl(8)

Solbourne Computer, Inc.  —  18 February 1988

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026