|
|
1.1 ! root 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 [email protected] ! 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: Copyright 1988, 1989 by Intel Corporation, Santa Clara, California. ! 28: ! 29: All Rights Reserved ! 30: ! 31: Permission to use, copy, modify, and distribute this software and ! 32: its documentation for any purpose and without fee is hereby ! 33: granted, provided that the above copyright notice appears in all ! 34: copies and that both the copyright notice and this permission notice ! 35: appear in supporting documentation, and that the name of Intel ! 36: not be used in advertising or publicity pertaining to distribution ! 37: of the software without specific, written prior permission. ! 38: ! 39: INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE ! 40: INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, ! 41: IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR ! 42: CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM ! 43: LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, ! 44: NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION ! 45: WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ! 46: */ ! 47: ! 48: /* Copyright (c) 1987, 1988 TOSHIBA Corp. */ ! 49: /* All Rights Reserved */ ! 50: ! 51: #ident "@(#)m765.h 1.13 - 88/02/17" ! 52: ! 53: /******************************************************************* ! 54: * ! 55: * Toshiba Floppy Driver for UNIX System V R3 ! 56: * ! 57: * June 21, 1988 ! 58: * ! 59: * Intended Drive Units: ! 60: * Worldwide - Model No. ND-356 3.5" unformatted 2MB/1MB ! 61: * UNIX Media Type Name: 2HD512/2DD512/2D512/1D512. ! 62: * ! 63: * In Japan Only - Model No. ND-355 3.5" unformatted 1.6MB/1MB ! 64: * UNIX Media Type Name: 2HC1024/2HC512/2HC256/2DD512/2D512/1D512. ! 65: * ! 66: * Worldwide - Model No. ND-04DT-A 5.25" unformatted 500 KB ! 67: * UNIX Media Type Name: 2D512/1D512. ! 68: * ! 69: * In Japan Only - Model No. ND-08DE 5.25" unformatted 1.6MB/1MB ! 70: * UNIX Media Type Name: 2HC1024/2HC512/2HC256/2DD512/2D512/1D512. ! 71: * ! 72: * Use with other devices may require modification. ! 73: * ! 74: * Notes: ! 75: * For further detail regarding drive units contact ! 76: * Toshiba America,Inc. Disk Products Division, ! 77: * Irvine, CA (714) 583-3000. ! 78: * ! 79: *******************************************************************/ ! 80: ! 81: /* ! 82: * fdcmd.c_rbmtr ! 83: * ! 84: * |--+--+--+--+--+--+--+--| ! 85: * | | | | | | | | | ! 86: * |--+--+--+--+--+--+--+--| ! 87: * ^ ^ ^ ^ ! 88: * | | | |--- unit0 motor on flag ! 89: * | | |------ unit1 motor on flag ! 90: * | |--------------- unit0 recalibrate flag ! 91: * |------------------ unit1 recalibrate flag ! 92: */ ! 93: #define MTRMASK 0x003 /* mask motor_flag for get status */ ! 94: #define MTRRST 0x0fc /* reset motor_flag data */ ! 95: #define RBSHIFT 0x004 /* shift count for recalibrate data */ ! 96: #define RBRST 0x0cf /* reset recalibrate data */ ! 97: ! 98: /* ! 99: * fdcmd.c_intr ! 100: * ! 101: * |--+--+--+--+--+--+--+--| ! 102: * | | | | | | | | | ! 103: * |--+--+--+--+--+--+--+--| ! 104: * ^ ^ ^ ^ ^ ^ ^ ^ ! 105: * reserved --+ | | | | | | +--- read/write flag ! 106: * reserved -----+ | | | | +------ seek flag ! 107: * reserved --------+ | | +------ seek flag for retry ! 108: * recalibrate/seek flag(for open) ----------+ +--------- recalibrate flag ! 109: */ ! 110: #define RWFLAG 0x001 ! 111: #define SKFLAG 0x002 ! 112: #define SKEFLAG 0x004 ! 113: #define RBFLAG 0x008 ! 114: #define WUPFLAG 0x010 ! 115: #define CMDRST 0x000 ! 116: ! 117: /* ! 118: * fddrtab.dr_type ! 119: * ! 120: * +---+---+---+---+---+---+---+---+ ! 121: * | | | | | | | | | ! 122: * +---+---+---+---+---+---+---+---+ ! 123: * ^ ^ ^ ^ ^ ! 124: * | | | | |----------- rapid seek flag ! 125: * |---| | | 0: normal seek ! 126: * | | | 1: rapid seek ! 127: * | | |--------------- detect format ! 128: * | | 0: no detect ! 129: * | | 1: format type OK ! 130: * | |------------------- 40 or 80 cylinder(for 2hc/2dd drive) ! 131: * | 0: 80 cylinder ! 132: * | 1: 40 cylinder ! 133: * |------------------------- transfer rate(for read/write/format) ! 134: * 00: 500kbps 10: 250kbps ! 135: * 01: 300kbps 11: reserved ! 136: */ ! 137: #define RPSEEK 0x00 /* rapid seek */ ! 138: #define RAPID 0x08 /* rapid seek flag */ ! 139: #define OKTYPE 0x10 /* media change flag */ ! 140: #define DOUBLE 0x20 /* double/single step change */ ! 141: #define NMSEEK 0x80 /* normal seek */ ! 142: #define RATEMASK 0xc0 /* transfer parameter mask data */ ! 143: ! 144: /* ! 145: * device number ! 146: * ! 147: * 15 10 9 8 7 0 ! 148: * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ ! 149: * | 0 0 0 0 0 0 0 1| | 0| 0| 0| 0| | ! 150: * +-----------+-----+-----+--+--+--+--+-----------+ ! 151: * ^ ^ ^ ^ ^ ^ ! 152: * |____________________| |__| |__| ! 153: * | | | ! 154: * | | |- media type ! 155: * major number | 0: 3.50" 720 KB ! 156: * |- unit number 1: 3.50" 1.44 Meg ! 157: * 2: 5.25" 360 KB ! 158: * 3: 5.25" 1.20 Meg ! 159: */ ! 160: #define UNIT(dev) ((dev & 0xc0)>>6) /* get unit number */ ! 161: #define MEDIATYPE(dev) (dev & 0x03) /* get media type */ ! 162: /***************************************************************************** ! 163: ! 164: wait time / timeout count ! 165: ! 166: *****************************************************************************/ ! 167: #define STSCHKCNT 0x2800 /* For check status */ ! 168: #define ITOUT HZ*5 /* interrupt timeout count */ ! 169: #define TOUT HZ/4 /* media type check timeout count */ ! 170: #define MTRSTOP HZ*2 /* motor off time */ ! 171: #define SEEKWAIT HZ/100*3 /* head_lock time */ ! 172: ! 173: /****************************************************************************** ! 174: ! 175: define for FDC ! 176: ! 177: ******************************************************************************/ ! 178: /* FDC register */ ! 179: #define CTRLREG(ADDR) (ADDR) /* controle register */ ! 180: #define STSREG(ADDR) ((ADDR)+2) /* status register */ ! 181: #define DATAREG(ADDR) ((ADDR)+3) /* data register */ ! 182: #define VFOREG(ADDR) ((ADDR)+5) /* vfo register */ ! 183: ! 184: /* CTRLREG flags */ ! 185: #define FDC_RST 0x04 ! 186: #define MTR_ON 0x04 ! 187: #define DMAREQ 0x08 ! 188: #define RDY 0x40 ! 189: #define BSY 0x80 ! 190: ! 191: /* status for command_out */ ! 192: #define FD_OSTS 0x00 /* For output check */ ! 193: #define FD_ISTS 0x40 /* For input check */ ! 194: #define DTOCPU 0x40 ! 195: #define DATAOK 0x80 ! 196: ! 197: /* Command for FDC */ ! 198: #define SPCCMD 0x03 /* Specify command */ ! 199: #define RBCMD 0x07 /* Recalibrate command */ ! 200: #define SISCMD 0x08 /* Sense interrupt status command */ ! 201: #define SEEKCMD 0x0f /* seek command */ ! 202: #define RDM 0xe6 /* FDC READ command */ ! 203: #define RDMV 0x42e6 /* VERIFY READ command */ ! 204: #define WTM 0xc5 /* FDC WRITE command */ ! 205: #define FMTM 0x4d /* FDC FORMAT command */ ! 206: #define FMTDATA 0x5e /* format data */ ! 207: ! 208: /* check value */ ! 209: #define OPENBIT 0x80 /* VFO check define */ ! 210: #define BYTEMASK 0xff ! 211: ! 212: /* FDC error code define */ ! 213: #define ERROR 0xff ! 214: #define EBBHARD 128 ! 215: #define EBBSOFT 129 ! 216: #define ST0AT 0x40 ! 217: #define ST0IC 0x80 ! 218: #define ST0OK 0xc0 ! 219: #define ADDRERR 0x01 ! 220: #define WTPRT 0x02 ! 221: #define NOREC 0x03 ! 222: #define OVERRUN 0x04 ! 223: #define CRCERR 0x05 ! 224: #define FDCERR 0x06 ! 225: #define TIMEOUT 0x08 ! 226: #define DOORERR 0x09 ! 227: ! 228: /****************************************************************************** ! 229: ! 230: define for DMA ! 231: ! 232: *****************************************************************************/ ! 233: /* DMA register */ ! 234: #define DMACMD1 0x08 /* DMA #1 command register */ ! 235: #define DMAMSK1 0x0f /* DMA #1 all mask register */ ! 236: #define DMABPFF 0x0c ! 237: #define DMAMODE 0x0b ! 238: #define DMAADDR 0x04 ! 239: #define DMAPAGE 0x81 ! 240: #define DMACNT 0x05 ! 241: #define DMAMSK 0x0a ! 242: ! 243: /* dma set data */ ! 244: #define DMARD 0x46 /* DMA read mode */ ! 245: #define DMAWT 0x4a /* DMA write mode */ ! 246: #define DMAVRF 0x42 /* DMA verify mode */ ! 247: ! 248: #define DMADATA0 0x00 /* DMA #2 all mask data */ ! 249: #define DMADATA1 0x0b /* DMA #1 all mask data */ ! 250: #define CHANNEL2 0x02 ! 251: ! 252: #define SRTHUT 0xdf ! 253: #define HLTND 0x02 ! 254: #define DTL 0xff ! 255: ! 256: /****************************************************************************** ! 257: ! 258: etc. define ! 259: ! 260: *****************************************************************************/ ! 261: #define SPL spl5 /* Same as in i386at/autoconf.c */ ! 262: #define MAXUNIT 4 /* Max unit number */ ! 263: #define BLKSIZE 512 /* block size */ ! 264: ! 265: /* fdcmd.c_stsflag */ ! 266: #define MTRFLAG 0x01 ! 267: #define MTROFF 0x02 ! 268: #define INTROUT 0x04 ! 269: ! 270: /* fdcmd.c_devflag (media check flag . etc.) */ ! 271: #define FDMCHK 0x01 ! 272: #define FDWAIT 0x02 ! 273: #define STRCHK 0x04 ! 274: #define STRWAIT 0x08 ! 275: ! 276: /* fdcmd.c_dcount */ ! 277: #define FDCCNT 9 /* Command table for read/write/format (FDC) */ ! 278: #define RWCNT 9 /* Read/Write command count */ ! 279: #define FMTCNT 6 /* format command count */ ! 280: ! 281: struct fdcmd { ! 282: int c_rbmtr; /* moter & rcalibrate flag */ ! 283: int c_intr; /* intr flag */ ! 284: int c_stsflag; /* moter flag */ ! 285: int c_mtrid; /* motor off queue id */ ! 286: int c_timeid; /* interrupt timeout id */ ! 287: int c_devflag; /* device status */ ! 288: int c_dcount; /* Read/Write/Format data count */ ! 289: int c_rwdata[FDCCNT]; /* Read/Write/Format cmd (FDC) */ ! 290: int c_saddr; /* cmd seek address */ ! 291: }; ! 292: ! 293: /* fdmbuf.b_rberr/fdmbuf.b_seekerr/fdmbuf.b_rwerr */ ! 294: #define MEDIARD 0x01 ! 295: #define MEDIASEEK 0x01 ! 296: #define SRETRY 0x03 ! 297: #define MRETRY 0x30 ! 298: #define LRETRY 0x300 ! 299: #define SRMASK 0x0f ! 300: #define MRMASK 0xf0 ! 301: #define RMRMASK 0xff0 ! 302: #define LRMASK 0xf00 ! 303: #define MINC 0x10 ! 304: #define LINC 0x100 ! 305: ! 306: struct ctrl_info { ! 307: struct unit_info *b_unitf; /* first buffer for this dev */ ! 308: struct unit_info *b_uip; /* like b_unit */ ! 309: struct unit_info *b_wup; /* unit to wake up when WUPFLAG */ ! 310: short b_rberr; /* rb error count (for recovery) */ ! 311: short b_seekerr; /* seek error count (for recovery) */ ! 312: short b_rwerr; /* r/w error count (for recovery) */ ! 313: short b_status; /* error status */ ! 314: struct buf *b_buf; /* set bp address */ ! 315: caddr_t b_xferaddr; /* trasfer address */ ! 316: unsigned int b_xfercount; /* total transfer count */ ! 317: unsigned int b_xferdma; /* dma transfer count */ ! 318: int usebuf; /* use private dma page */ ! 319: caddr_t b_vbuf; /* virtual address for dma page */ ! 320: vm_offset_t b_pbuf; /* physical dma page (model_dep.c) */ ! 321: daddr_t b_sector; /* read/write sector */ ! 322: struct fdcmd b_cmd; /* set command table address */ ! 323: }; ! 324: ! 325: #define FMTID 4 ! 326: struct fmttbl { ! 327: unsigned char cyl; ! 328: unsigned char head; ! 329: unsigned char sector; ! 330: unsigned char s_type; ! 331: }; ! 332: ! 333: struct fddrtab { ! 334: u_short dr_ncyl; /* cylinder count */ ! 335: u_short dr_spc; /* actual sectors/cylinder */ ! 336: daddr_t p_nsec; /* disk length (sector count) */ ! 337: char dr_nsec; /* sector per track */ ! 338: char dr_type; /* media type */ ! 339: char dr_rwgpl; /* Read / Write Gap length */ ! 340: char dr_fgpl; /* Format Gap length */ ! 341: }; ! 342: ! 343: struct unit_info { ! 344: struct unit_info *b_unitf; /* next slave */ ! 345: struct buf *av_forw; /* head of I/O queue (b_forw) */ ! 346: int b_seekaddr; /* cylinder address */ ! 347: u_short addr; ! 348: struct fddrtab d_drtab; /* floppy disk parameter */ ! 349: struct bus_device *dev; ! 350: struct fdcmd *b_cmd; /* set command table address */ ! 351: char wakeme; /* set if someone wants to be woken */ ! 352: }; ! 353: ! 354: #define HZ 100 /* 100 ticks/second of the clock */ ! 355: #define NBPSCTR 512 /* Bytes per LOGICAL disk sector */ ! 356: /* These should be added to ! 357: "sys/param.h". */ ! 358: #define PAGESIZ 4096 ! 359: #ifdef MACH_KERNEL ! 360: #define PZERO 25 ! 361: #define PRIBIO 20 ! 362: ! 363: #define B_VERIFY IO_SPARE_START ! 364: #define B_FORMAT (IO_SPARE_START << 1) ! 365: ! 366: #define b_pfcent io_mode ! 367: ! 368: #endif MACH_KERNEL
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.