The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386at/fdreg.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1993,1991,1990,1989 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /* 
   27  * HISTORY
   28  * $Log:        fdreg.h,v $
   29  * Revision 2.6  93/08/02  21:44:01  mrt
   30  *      Put the free copyright on this file, again.
   31  *      [93/07/22            mrt]
   32  * 
   33  * Revision 2.5  93/01/24  13:15:42  danner
   34  *      Make unit_info.addr a u_short to make inb and friends happy.
   35  *      [93/01/18            rvb]
   36  * 
   37  * Revision 2.4  91/10/07  17:25:31  af
   38  *      More mg32 changes
   39  *      [91/10/07            rvb]
   40  *      New chips/busses.[ch] nomenclature.
   41  *      [91/09/09  17:11:55  rvb]
   42  * 
   43  *      Synched again with 2.5.
   44  *      [91/09/04            rvb]
   45  * 
   46  * Revision 2.3  91/05/14  16:23:11  mrt
   47  *      Correcting copyright
   48  * 
   49  * Revision 2.2  91/02/14  14:42:36  mrt
   50  *      New, Improved, compatible with new fd.c
   51  *      [91/01/28  15:33:58  rvb]
   52  * 
   53  * Revision 1.6.1.5  90/11/27  13:44:40  rvb
   54  *      Synched 2.5 & 3.0 at I386q (r1.6.1.5) & XMK35 (r2.4)
   55  *      [90/11/15            rvb]
   56  * 
   57  * Revision 1.6.1.4  90/09/18  08:38:29  rvb
   58  *      Flush setparms from here.
   59  *      [90/09/08            rvb]
   60  * 
   61  * Revision 2.3  90/08/27  22:01:00  dbg
   62  *      Flush ushort.
   63  *      [90/07/17            dbg]
   64  * 
   65  * Revision 1.6.1.3  90/07/27  11:26:42  rvb
   66  *      Fix Intel Copyright as per B. Davies authorization.
   67  *      [90/07/27            rvb]
   68  * 
   69  * Revision 2.2  90/05/03  15:45:27  dbg
   70  *      Change for pure kernel.
   71  *      [90/04/19            dbg]
   72  * 
   73  * Revision 1.6.1.2  90/01/08  13:30:22  rvb
   74  *      Add Intel copyright.
   75  *      [90/01/08            rvb]
   76  * 
   77  * Revision 1.6.1.1  89/10/22  11:34:43  rvb
   78  *      Received from Intel October 5, 1989.
   79  *      [89/10/13            rvb]
   80  * 
   81  * Revision 1.6  89/09/25  12:27:00  rvb
   82  *      Flush B_VERFIY and B_FORMAT
   83  *      [89/09/23            rvb]
   84  * 
   85  * Revision 1.5  89/09/20  17:29:17  rvb
   86  *      It bothers me that we are changing a constant here so that
   87  *      25 Mhz machines will loop for a full 1msec.  There has to be
   88  *      a way to set cpuspeed once we find out the kind of machine and
   89  *      clock speed.
   90  *      [89/09/20            rvb]
   91  * 
   92  * Revision 1.4  89/03/09  20:07:10  rpd
   93  *      More cleanup.
   94  * 
   95  * Revision 1.3  89/02/26  12:40:12  gm0w
   96  *      Changes for cleanup.
   97  * 
   98  * 
   99  */
  100  
  101 /*
  102   Copyright 1988, 1989 by Intel Corporation, Santa Clara, California.
  103 
  104                 All Rights Reserved
  105 
  106 Permission to use, copy, modify, and distribute this software and
  107 its documentation for any purpose and without fee is hereby
  108 granted, provided that the above copyright notice appears in all
  109 copies and that both the copyright notice and this permission notice
  110 appear in supporting documentation, and that the name of Intel
  111 not be used in advertising or publicity pertaining to distribution
  112 of the software without specific, written prior permission.
  113 
  114 INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
  115 INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
  116 IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
  117 CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  118 LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
  119 NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  120 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  121 */
  122 
  123 /*      Copyright (c) 1987, 1988 TOSHIBA Corp.          */
  124 /*              All Rights Reserved                     */
  125 
  126 #ident  "@(#)m765.h     1.13 - 88/02/17"
  127 
  128 /*******************************************************************
  129  *
  130  *       Toshiba Floppy Driver for UNIX System V R3
  131  *
  132  *                                      June 21, 1988 
  133  *
  134  *      Intended Drive Units:
  135  *              Worldwide - Model No. ND-356  3.5" unformatted 2MB/1MB
  136  *              UNIX Media Type Name: 2HD512/2DD512/2D512/1D512.
  137  *
  138  *              In Japan Only - Model No. ND-355  3.5" unformatted 1.6MB/1MB
  139  *              UNIX Media Type Name: 2HC1024/2HC512/2HC256/2DD512/2D512/1D512.
  140  *
  141  *              Worldwide - Model No. ND-04DT-A  5.25" unformatted 500 KB
  142  *              UNIX Media Type Name: 2D512/1D512.
  143  *
  144  *              In Japan Only - Model No. ND-08DE  5.25" unformatted 1.6MB/1MB
  145  *              UNIX Media Type Name: 2HC1024/2HC512/2HC256/2DD512/2D512/1D512.
  146  *
  147  *              Use with other devices may require modification.
  148  *
  149  *      Notes:
  150  *              For further detail regarding drive units contact 
  151  *              Toshiba America,Inc. Disk Products Division,
  152  *              Irvine, CA (714) 583-3000.
  153  *
  154  *******************************************************************/
  155 
  156 /*
  157  *      fdcmd.c_rbmtr
  158  *
  159  *              |--+--+--+--+--+--+--+--|
  160  *              |  |  |  |  |  |  |  |  |
  161  *              |--+--+--+--+--+--+--+--|
  162  *                     ^  ^        ^  ^
  163  *                     |  |        |  |--- unit0 motor on flag
  164  *                     |  |        |------ unit1 motor on flag
  165  *                     |  |--------------- unit0 recalibrate flag
  166  *                     |------------------ unit1 recalibrate flag
  167  */
  168 #define MTRMASK         0x003           /* mask motor_flag for get status */
  169 #define MTRRST          0x0fc           /* reset motor_flag data */
  170 #define RBSHIFT         0x004           /* shift count for recalibrate data */
  171 #define RBRST           0x0cf           /* reset recalibrate data */
  172 
  173 /*
  174  *      fdcmd.c_intr
  175  *
  176  *                                |--+--+--+--+--+--+--+--|
  177  *                                |  |  |  |  |  |  |  |  |
  178  *                                |--+--+--+--+--+--+--+--|
  179  *                                  ^  ^  ^  ^  ^  ^  ^  ^
  180  *                      reserved  --+  |  |  |  |  |  |  +--- read/write flag
  181  *                      reserved  -----+  |  |  |  |  +------ seek flag
  182  *                      reserved  --------+  |  |  +------ seek flag for retry
  183  * recalibrate/seek flag(for open) ----------+  +--------- recalibrate flag
  184  */
  185 #define RWFLAG          0x001
  186 #define SKFLAG          0x002
  187 #define SKEFLAG         0x004
  188 #define RBFLAG          0x008
  189 #define WUPFLAG         0x010
  190 #define CMDRST          0x000   
  191 
  192 /* 
  193  *      fddrtab.dr_type 
  194  *
  195  *        +---+---+---+---+---+---+---+---+
  196  *        |   |   |   |   |   |   |   |   |
  197  *        +---+---+---+---+---+---+---+---+
  198  *          ^   ^   ^   ^   ^
  199  *          |   |   |   |   |----------- rapid seek flag
  200  *          |---|   |   |                  0: normal seek
  201  *            |     |   |                  1: rapid seek
  202  *            |     |   |--------------- detect format
  203  *            |     |                      0: no detect
  204  *            |     |                      1: format type OK
  205  *            |     |------------------- 40 or 80 cylinder(for 2hc/2dd drive)
  206  *            |                            0: 80 cylinder
  207  *            |                            1: 40 cylinder
  208  *            |------------------------- transfer rate(for read/write/format)
  209  *                                         00: 500kbps  10: 250kbps
  210  *                                         01: 300kbps  11: reserved
  211  */
  212 #define RPSEEK          0x00            /* rapid seek */
  213 #define RAPID           0x08            /* rapid seek flag */
  214 #define OKTYPE          0x10            /* media change flag */
  215 #define DOUBLE          0x20            /* double/single step change */
  216 #define NMSEEK          0x80            /* normal seek */
  217 #define RATEMASK        0xc0            /* transfer parameter mask data */
  218 
  219 /*
  220  *      device number
  221  *
  222  *       15             10  9  8  7                    0
  223  *      +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
  224  *      | 0  0  0  0  0  0  0  1|     | 0| 0| 0| 0|     |
  225  *      +-----------+-----+-----+--+--+--+--+-----------+
  226  *        ^                    ^  ^  ^              ^  ^ 
  227  *        |____________________|  |__|              |__|
  228  *                  |              |                 |
  229  *                  |              |                 |- media type
  230  *             major number        |                    0: 3.50"  720 KB
  231  *                                 |- unit number       1: 3.50" 1.44 Meg
  232  *                                                      2: 5.25"  360 KB
  233  *                                                      3: 5.25" 1.20 Meg
  234  */
  235 #define UNIT(dev)       ((dev & 0xc0)>>6)       /* get unit number */
  236 #define MEDIATYPE(dev)  (dev & 0x03)            /* get media type */
  237 /*****************************************************************************
  238  
  239                 wait time / timeout count
  240 
  241  *****************************************************************************/
  242 #define STSCHKCNT       0x2800          /* For check status */
  243 #define ITOUT           HZ*5            /* interrupt timeout count */
  244 #define TOUT            HZ/4            /* media type check timeout count */
  245 #define MTRSTOP         HZ*2            /* motor off time */
  246 #define SEEKWAIT        HZ/100*3        /* head_lock time */
  247 
  248 /******************************************************************************
  249  
  250                 define for FDC
  251 
  252  ******************************************************************************/
  253 /* FDC register */
  254 #define CTRLREG(ADDR)   (ADDR)          /* controle register */
  255 #define STSREG(ADDR)    ((ADDR)+2)      /* status register */
  256 #define DATAREG(ADDR)   ((ADDR)+3)      /* data register */
  257 #define VFOREG(ADDR)    ((ADDR)+5)      /* vfo register */
  258 
  259 /* CTRLREG flags */
  260 #define FDC_RST         0x04
  261 #define MTR_ON          0x04
  262 #define DMAREQ          0x08
  263 #define RDY             0x40
  264 #define BSY             0x80
  265 
  266 /* status for command_out */
  267 #define FD_OSTS         0x00            /* For output check */
  268 #define FD_ISTS         0x40            /* For input check */
  269 #define DTOCPU          0x40
  270 #define DATAOK          0x80
  271 
  272 /* Command for FDC */
  273 #define SPCCMD          0x03            /* Specify command */
  274 #define RBCMD           0x07            /* Recalibrate command */
  275 #define SISCMD          0x08            /* Sense interrupt status command */
  276 #define SEEKCMD         0x0f            /* seek command */
  277 #define RDM             0xe6            /* FDC READ command */
  278 #define RDMV            0x42e6          /* VERIFY READ command */
  279 #define WTM             0xc5            /* FDC WRITE command */
  280 #define FMTM            0x4d            /* FDC FORMAT command */
  281 #define FMTDATA         0x5e            /* format data */
  282 
  283 /* check value */
  284 #define OPENBIT         0x80            /* VFO check define */
  285 #define BYTEMASK        0xff
  286 
  287 /* FDC error code define */
  288 #define ERROR           0xff
  289 #define EBBHARD         128
  290 #define EBBSOFT         129
  291 #define ST0AT           0x40
  292 #define ST0IC           0x80
  293 #define ST0OK           0xc0
  294 #define ADDRERR         0x01
  295 #define WTPRT           0x02
  296 #define NOREC           0x03
  297 #define OVERRUN         0x04
  298 #define CRCERR          0x05
  299 #define FDCERR          0x06
  300 #define TIMEOUT         0x08
  301 #define DOORERR         0x09
  302 
  303 /******************************************************************************
  304  
  305                 define for DMA
  306 
  307  *****************************************************************************/
  308 /* DMA register */
  309 #define DMACMD1         0x08            /* DMA #1 command register      */
  310 #define DMAMSK1         0x0f            /* DMA #1 all mask register     */
  311 #define DMABPFF         0x0c
  312 #define DMAMODE         0x0b
  313 #define DMAADDR         0x04
  314 #define DMAPAGE         0x81
  315 #define DMACNT          0x05
  316 #define DMAMSK          0x0a
  317 
  318 /* dma set data */
  319 #define DMARD           0x46            /* DMA read mode                */
  320 #define DMAWT           0x4a            /* DMA  write mode              */
  321 #define DMAVRF          0x42            /* DMA verify mode              */
  322 
  323 #define DMADATA0        0x00            /* DMA #2 all mask data         */
  324 #define DMADATA1        0x0b            /* DMA #1 all mask data         */
  325 #define CHANNEL2        0x02
  326 
  327 #define SRTHUT          0xdf
  328 #define HLTND           0x02
  329 #define DTL             0xff
  330 
  331 /******************************************************************************
  332  
  333                 etc. define
  334 
  335  *****************************************************************************/
  336 #define SPL             spl5    /* Same as in i386at/autoconf.c */
  337 #define MAXUNIT         4       /* Max unit number */
  338 #define BLKSIZE         512     /* block size      */
  339 
  340 /* fdcmd.c_stsflag      */
  341 #define MTRFLAG 0x01
  342 #define MTROFF  0x02
  343 #define INTROUT 0x04
  344 
  345 /* fdcmd.c_devflag (media check flag . etc.) */
  346 #define FDMCHK          0x01
  347 #define FDWAIT          0x02
  348 #define STRCHK          0x04
  349 #define STRWAIT         0x08
  350 
  351 /* fdcmd.c_dcount */
  352 #define FDCCNT  9       /* Command table for read/write/format (FDC) */
  353 #define RWCNT   9       /* Read/Write command count */
  354 #define FMTCNT  6       /* format command count */
  355 
  356 struct  fdcmd {
  357         int     c_rbmtr;                /* moter & rcalibrate flag */
  358         int     c_intr;                 /* intr flag */
  359         int     c_stsflag;              /* moter flag */
  360         int     c_mtrid;                /* motor off queue id */
  361         int     c_timeid;               /* interrupt timeout id */
  362         int     c_devflag;              /* device status   */
  363         int     c_dcount;               /* Read/Write/Format data count */
  364         int     c_rwdata[FDCCNT];       /* Read/Write/Format cmd (FDC) */
  365         int     c_saddr;                /* cmd seek address */
  366 };
  367 
  368 /* fdmbuf.b_rberr/fdmbuf.b_seekerr/fdmbuf.b_rwerr */
  369 #define MEDIARD         0x01
  370 #define MEDIASEEK       0x01
  371 #define SRETRY          0x03
  372 #define MRETRY          0x30
  373 #define LRETRY          0x300
  374 #define SRMASK          0x0f
  375 #define MRMASK          0xf0
  376 #define RMRMASK         0xff0
  377 #define LRMASK          0xf00
  378 #define MINC            0x10
  379 #define LINC            0x100
  380 
  381 struct  ctrl_info {
  382         struct  unit_info *b_unitf;     /* first buffer for this dev       */
  383         struct  unit_info *b_uip;       /* like b_unit                     */
  384         struct  unit_info *b_wup;       /* unit to wake up when WUPFLAG    */
  385         short   b_rberr;                /* rb error count (for recovery)   */
  386         short   b_seekerr;              /* seek error count (for recovery) */
  387         short   b_rwerr;                /* r/w error count (for recovery)  */
  388         short   b_status;               /* error status                    */
  389         struct  buf     *b_buf;         /* set bp address                  */
  390         caddr_t b_xferaddr;             /* trasfer address                 */
  391         unsigned int b_xfercount;       /* total transfer count            */
  392         unsigned int b_xferdma;         /* dma transfer count              */
  393         daddr_t b_sector;               /* read/write sector               */
  394         struct  fdcmd   b_cmd;          /* set command table address       */
  395 };
  396 
  397 #define FMTID   4
  398 struct fmttbl {
  399         unsigned char cyl;
  400         unsigned char head;
  401         unsigned char sector;
  402         unsigned char s_type;
  403 };
  404 
  405 struct  fddrtab {
  406         u_short dr_ncyl;        /* cylinder count                */
  407         u_short dr_spc;         /* actual sectors/cylinder       */
  408         daddr_t p_nsec;         /* disk length (sector count)    */
  409         char    dr_nsec;        /* sector per track              */
  410         char    dr_type;        /* media type                    */
  411         char    dr_rwgpl;       /* Read / Write Gap length       */
  412         char    dr_fgpl;        /* Format Gap length             */
  413 };
  414 
  415 struct  unit_info {
  416         struct unit_info *b_unitf;      /* next slave                 */
  417         struct buf       *av_forw;      /* head of I/O queue (b_forw) */
  418         int              b_seekaddr;    /* cylinder address           */
  419         u_short          addr;
  420         struct fddrtab   d_drtab;       /* floppy disk parameter      */
  421         struct bus_device *dev;
  422         struct fdcmd     *b_cmd;        /* set command table address  */
  423         char             wakeme;        /* set if someone wants to be woken */
  424 };
  425 
  426 #define HZ              100             /* 100 ticks/second of the clock */
  427 #define NBPSCTR         512             /* Bytes per LOGICAL disk sector */
  428                                         /* These should be added to 
  429                                            "sys/param.h". */
  430 #define PAGESIZ         4096
  431 #ifdef  MACH_KERNEL
  432 #define PZERO           25
  433 #define PRIBIO          20
  434 
  435 #define B_VERIFY        IO_SPARE_START
  436 #define B_FORMAT        (IO_SPARE_START << 1)
  437 
  438 #define b_pfcent        io_mode
  439 
  440 #endif  MACH_KERNEL

Cache object: 3bf0f7e12333211e40d4c38c77d6c92d


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.