/* vdfmt.h 1.8 90/06/24 */
* VERSAbus disk controller (vd) disk formatter.
#include "tahoevba/vbaparam.h"
#include "tahoevba/vdreg.h"
extern struct cpdcb_i cpin
; /* found in cons.c */
* Poll console and return 1 if input is present.
(uncache(&cpin.cp_hdr.cp_unit), (cpin.cp_hdr.cp_unit&CPDONE))
* Configuration parameters
#define MAXCTLR 8 /* Maximum # of controllers */
#define MAXDRIVE 16 /* Max drives per controller */
#define NUMMAP 1 /* # Cyls in bad sector map */
#define NUMMNT 1 /* # cyls for diagnostics */
#define NUMREL 3 /* # Cyls in relocation area */
#define NUMSYS (NUMREL+NUMMNT+NUMMAP) /* Total cyls used by system */
#define MAXSECS_PER_TRK 72 /* at 512 bytes/sector */
#define MAXTRKSIZ ((512/sizeof(long)) * MAXSECS_PER_TRK)
#define bytes_trk (lab->d_nsectors * lab->d_secsize)
(DCBS_NRDY|DCBS_IVA|DCBS_NEM|DCBS_DPE|DCBS_OAB|DCBS_WPT|DCBS_SKI|DCBS_OCYL)
(DCBS_UDE|DCBS_DCE|DCBS_DSE|DCBS_DSL|DCBS_TOP|DCBS_TOM|DCBS_CCD|\
#define HEADER_ERROR (DCBS_HCRC|DCBS_HCE)
#define WPT (short)(NRM | VDWPT)
#define RELOC_SECTOR (short)(VDALT)
#define ALT_SECTOR (short)(VDALT)
typedef enum { false, true } boolean
;
typedef enum { u_false
, u_true
, u_unknown
} uncertain
;
* Free bad block allocation bit map
enum { ALLOCATED
, NOTALLOCATED
} free_status
;
typedef enum { SINGLE_SECTOR
, FULL_TRACK
} rel_type
; /* relocation type */
boolean
read_bad_sector_map();
op_tbl operations
[NUMOPS
];
* Operation bit mask values (must match order in operations table)
#define FORMAT_OP 0x01 /* Format operation bit */
#define VERIFY_OP 0x02 /* Verify operation bit */
#define RELOCATE_OP 0x04 /* Relocate operation bit */
#define INFO_OP 0x08 /* Info operation bit */
#define CORRECT_OP 0x10 /* Correct operation bit */
#define PROFILE_OP 0x20 /* Profile operation bit */
#define EXERCISE_OP 0x40 /* Exercise operation bit */
extern int format(), verify(), relocate(), info();
extern int correct(), profile(), exercise();
* Operation table type and definitions
op_spec ops_to_do
[MAXCTLR
][MAXDRIVE
];
* Contains all the current parameters
* Different environments for setjumps
jmp_buf reset_environ
; /* Use when reset is issued */
jmp_buf quit_environ
; /* Use when you want to quit what your doing */
jmp_buf abort_environ
; /* Use when nothing can be done to recover */
* Flaw map definitions and storage
short bs_cyl
; /* Cylinder position of flaw */
short bs_trk
; /* Track position of flaw */
long bs_offset
; /* (byte) Position of flaw on track */
long bs_length
; /* Length (in bits) of flaw */
dskadr bs_alt
; /* Addr of alt sector (all 0 if none) */
enum { flaw_map
, scanning
, operator } bs_how
; /* How it was found */
* Controller specific information
fmt_err
*(*decode_pos
)();
ctlr_info c_info
[MAXCTLR
];
* Drive specific information
#define d_traksize d_drivedata[1]
#define d_pat d_drivedata[2]
drive_info d_info
[MAXCTLR
][MAXDRIVE
];
struct disklabel vdproto
[];
* Structure of the bad-sector map on the disk.
* The original bs_map did not have the magic number or "checksum,"
unsigned int bs_magic
; /* magic (0x12344321) */
unsigned int bs_cksum
; /* checksum (0) */
unsigned int bs_id
; /* Pack id */
unsigned int bs_count
; /* number of known bad sectors */
unsigned int bs_max
; /* Maximum allowable bad sectors */
#define MAX_FLAWMAP(x) (((x) - sizeof(bs_map)) / sizeof(bs_entry))
#define MAX_FLAWS MAX_FLAWMAP(MAXTRKSIZ*sizeof(long))
#define BSMAGIC 0x12344321
bs_map Offset_bad_map
; /* offset by bs_magic+cksum */
#define offset_bad_map bs_map_space.Offset_bad_map
bs_map bs_map
; /* aligned with track buffer */
#define norm_bad_map bs_map_space.Norm_bad_map.bs_map
long track
[MAXTRKSIZ
]; /* disk track is read here */
#define map_space bs_map_space.space.track
* Pattern buffers and the sort
fmt_free free_tbl
[NUMREL
*MAXTRKS
][MAXSECS_PER_TRK
];
struct mdcb mdcb
; /* Master device control block */
struct dcb dcb
; /* Device control blocks */
long pattern_0
[MAXTRKSIZ
], pattern_1
[MAXTRKSIZ
];
long pattern_2
[MAXTRKSIZ
], pattern_3
[MAXTRKSIZ
];
long pattern_4
[MAXTRKSIZ
], pattern_5
[MAXTRKSIZ
];
long pattern_6
[MAXTRKSIZ
], pattern_7
[MAXTRKSIZ
];
long pattern_8
[MAXTRKSIZ
], pattern_9
[MAXTRKSIZ
];
long pattern_10
[MAXTRKSIZ
], pattern_11
[MAXTRKSIZ
];
long pattern_12
[MAXTRKSIZ
], pattern_13
[MAXTRKSIZ
];
long pattern_14
[MAXTRKSIZ
], pattern_15
[MAXTRKSIZ
];
long *pattern_address
[16]; /* pointers to pattern_* */
* Double buffer for scanning existing
* file systems and general scratch
char flaw_junk
[1024]; /* Fill up 518 byte block */
unsigned long esdi_flaw_sync
;
unsigned short esdi_flaw_cyl
;
unsigned char esdi_flaw_trk
;
unsigned char esdi_flaw_sec
;
unsigned char esdi_flags
;
unsigned char esdi_ecc_1
[2];
unsigned char esdi_pad_1
[2];
unsigned char esdi_plo_sync
[26];
unsigned long esdi_data_sync
;
unsigned char esdi_month
;
unsigned char esdi_pad_2
[2];
unsigned char esdi_flaws
[50][5]; /* see esdi_flaw_entry */
unsigned char esdi_ecc_2
[2];
unsigned char esdi_pad_3
[2];
char esdi_flaw_junk
[1024]; /* Fill up block */
esdi_flaw_header esdi_header
;
esdi_flaw_data esdi_data
;
** since each flaw entry is 5 bytes and this forces alignment problems we
** define a structure here so that the entries can be BCOPYed into a
** reasonable work area before access.
unsigned short esdi_flaw_cyl
;
unsigned short esdi_flaw_offset
;
unsigned char esdi_flaw_length
;
#define ESDI1SYNC 0x00fe /* 0x00f8 */