fdc.h revision ca925f54ccacc64abb1dc147c736397a9ccaab0e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_FDC_H
#define _SYS_FDC_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef OTYPCNT
#define OTYPCNT 5
#endif
typedef struct xlate_tbl {
int value;
} xlate_tbl_t;
/*
* the floppy disk minor device number is interpreted as follows:
*
* 7 6 5 4 3 2 1 0
* +---------+-----+
* | drive | part|
* +---------+-----+
* where:
* drive = instance
* part = partition
*/
/*
* plus other manifest defines....
*/
#define NFDUN 4
/*
* Floppy drive / diskette type numbers.
*/
#define FMT_5H 0
#define FMT_5Q 1
#define FMT_5D9 2
#define FMT_5D8 3
#define FMT_5D4 4
#define FMT_5D16 5
#define FMT_3E 6
#define FMT_3H 7
#define FMT_3I 8
#define FMT_3M 9
#define FMT_3D 10
#define FMT_AUTO 11
#define FMT_MAX 11
#define FMT_UNKWN 11
/*
* Mini- and Micro- Diskettes Attributes Structure
*/
struct fdattr {
};
/*
* Miscellaneous
*/
#define FDWRITE 0 /* for fdrw() flag */
/*
* Per floppy-drive / diskette state structure
*/
struct fdisk {
int d_media; /* drive media capacities */
int d_bpsshf; /* shift count for bytes to sector */
/*
* Regular open type flags.
* 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.
*/
/*
* Current drive characteristics type.
* If -1, then it was set via an ioctl. Note that a close
* and then an open loses the ioctl set characteristics.
*/
signed char d_curfdtype;
int d_media_timeout; /* media detection timeout */
int d_ejected;
char d_vtoc_volume[LEN_DKL_VVOL];
char d_vtoc_asciilabel[LEN_DKL_ASCII];
};
/* 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 */
};
/*
* 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 command and gets rewritten
* for each command.
*/
enum fxstate {
};
enum fmtrstate {
};
enum fmtrinput {
};
struct fdcsb {
int csb_handle_bound; /* DMA handle has been bound */
};
/*
* defines for csb_opflags
*/
#define CSB_CMDTO 0x01
#define CSB_CMDDMA 0x03
#define CSB_CMDNGNR 0x07
/*
* 82077AA Controller modes
*/
enum fdcmode077 {
FDCMODE_PS2, /* not supported */
};
/*
* Per controller data
*/
struct fdcntlr {
int c_number; /* logical controller number */
int c_regbase; /* base i/o address */
int c_dmachan; /* DMA channel number */
int c_intprio; /* interrupt priority */
int c_intvec; /* interrupt vector num */
int c_chip;
/*
* floppy controller register values
*/
};
/*
* Controller flags
*/
/*
* FDC operations
*/
struct fcobjops {
int (*fco_abort)(); /* controller abort */
int (*fco_dkinfo)(); /* get disk controller info */
int (*fco_select)(); /* select / deselect unit */
int (*fco_getchng)(); /* get media change */
int (*fco_resetchng)(); /* reset media change */
int (*fco_rcseek)(); /* recal / seek */
int (*fco_rwbuf)(); /* read /write request */
int (*fco_rw)(); /* read /write sector */
int (*fco_format)(); /* format track */
int (*fco_rwioctl)(); /* raw ioctl */
};
/*
* FDC unit object
*/
struct fcu_obj {
};
/* unit flags (state info) */
#ifdef _VPIX
#define DRV_NONE 0x00
#define DRV_DBL 0x01
#define DRV_QUAD 0x02
/* ioctl numbers used by VPIX */
#endif
#ifdef __cplusplus
}
#endif
#endif /* !_SYS_FDC_H */