fdvar.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1989-1994,1997-1998,2000 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_FDVAR_H
#define _SYS_FDVAR_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef OTYPCNT
#define OTYPCNT 5
#endif
#ifndef NDKMAP
#define NDKMAP 8
#endif
/*
* Compile with our without high level interrupt in trap window
*/
/* #define NO_TRAPWIN_INTR */
/*
* plus other manifest defines....
*/
#define FDUNITSHIFT (3)
/*
* Structure definitions for the floppy driver.
*/
/*
* floppy disk command and status block.
*
* Needed to execute a command. Since the floppy chip is
* single threaded with respect to having only one drive
* active at a time, this block of information is only
* valid for the length of a commnand and gets rewritten
* for each command.
*/
#ifndef _ASM
struct fdcsb {
};
#endif /* !_ASM */
/*
* defines for csb_opflags
*/
#define CSB_CMDTO 0x01
/*
* csb_read flags
*/
#define CSB_NULL 0x0
#define CSB_READ 0x1
#define CSB_WRITE 0x2
#ifndef _ASM
#ifndef _GENASSYM
/*
* Define a structure to hold the packed default labels,
* based on the real dk_label structure - but shorter
* than 512 bytes. Now only used to define default info
*/
struct packed_label {
unsigned short dkl_rpm; /* rotations per minute */
unsigned short dkl_pcyl; /* # physical cylinders */
unsigned short dkl_apc; /* alternates per cylinder */
unsigned short dkl_intrlv; /* interleave factor */
unsigned short dkl_ncyl; /* # of data cylinders */
unsigned short dkl_acyl; /* # of alternate cylinders */
unsigned short dkl_nhead; /* # of heads in this partition */
unsigned short dkl_nsect; /* # of 512 byte sectors per track */
};
/*
* Per drive data
*/
struct fdunit {
/*
* Packed label for this unit
*/
/*
* Pointer to iostat statistics
*/
/*
* Layered open counters
*/
/*
* Regular open type flags. If
* NDKMAP gets > 8, change the
* uchar_t type.
*
* Open types BLK, MNT, CHR, SWP
* assumed to be values 0-3.
*/
/*
* Exclusive open flags (per partition).
*
* The rules are that in order to open
* a partition exclusively, the partition
* must be completely closed already. Once
* any partition of the device is opened
* exclusively, no other open on that
* partition may succeed until the partition
* is closed.
*
* If NDKMAP gets > 8, this must change.
*/
char un_curfdtype; /* current driver characteristics */
/* type. If -1, then it was set */
/* via an ioctl. Note that a close */
/* and then and open loses the */
/* ioctl set characteristics. */
int un_unit_no; /* drive id number */
int un_ejected;
short un_state; /* Current power level of drive */
};
/* unit flags (state info) */
/* (the presence of a diskette is another matter) */
/* registers with current speed */
#endif /* !_GENASSYM */
/* unit flags for power (un_power) */
/*
* --------| fd_detach:DDI_SUSPEND ncmds may be != 0 |-----------|
* |running|------------------------------------------>| |
* |NORMAL | fd_attach:DDI_RESUME | |
* | |<------------------------------------------| SUSPENDED |
* | | | |
* | | -------------
* | | ^
* | | |DDI_SUSPEND
* | | |
* | | fd_power: PM_LEVEL_OFF, ncmds == 0 -------------
* | |------------------------------------------->|STOPPED |
* | | fd_power: PM_LEVEL_ON | |
* | |<-------------------------------------------| |
* -------- ------------|
*
* running => FD_STATE_NORMAL
*
*/
/* flags for power levels for auto power management */
/* a place to keep some statistics on what's going on */
struct fdstat {
/* first operations */
int rd; /* count reads */
int wr; /* count writes */
int recal; /* count recalibrates */
int form; /* count format_tracks */
int other; /* count other ops */
/* then errors */
int reset; /* count resets */
int to; /* count timeouts */
int de; /* count data errors */
int bfmt; /* count bad format errors */
};
/*
* Per controller data
*/
struct fdctlr {
/* data access handle for controller */
};
#endif /* !_ASM */
/* types of controllers supported by this driver */
#define FDCTYPE_82072 0x0001
#define FDCTYPE_82077 0x0002
#define FDCTYPE_CTRLMASK 0x000f
/* types of io chips which indicates the type of auxio register */
#define FDCTYPE_MACHIO 0x0010
#define FDCTYPE_SLAVIO 0x0020
#define FDCTYPE_CHEERIO 0x0040
#define FDCTYPE_SB 0x0080
#define FDCTYPE_AUXIOMASK 0x00f0
/* Method used for transferring data */
#define FDCTYPE_TRNSFER_MASTK 0xf000
/*
* Early revs of the 82077 have a bug by which they
* will not respond to the TC (Terminal count) signal.
* Because this behavior is exhibited on the clone machines
* for which the 077 code has been targeted, special workaround
*/
#define FDCTYPE_TCBUG 0x0100
#define FDCTYPE_BUGMASK 0x0f00
/*
* Controller flags
*/
#ifndef _ASM
/*
* Miscellaneous
*/
/*
* the levels are for severity
*/
#define FDEP_L0 0 /* chatty as can be - for debug! */
#define FDERRPRINT(l, m, args) \
/*
* for each function, we can mask off its printing by clearing its bit in
* the fderrmask. Some functions (attach, ident) share a mask bit
*/
#endif /* !_ASM */
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_FDVAR_H */