📄 mscp.h
字号:
/* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)mscp.h 7.5 (Berkeley) 6/28/90 *//* * Definitions for the Mass Storage Control Protocol * I WISH I KNEW WHAT MORE OF THESE WERE. IT SURE WOULD BE NICE * IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS. *//* * Control message opcodes */#define M_OP_ABORT 0x01 /* Abort command */#define M_OP_GETCMDST 0x02 /* Get command status command */#define M_OP_GETUNITST 0x03 /* Get unit status command */#define M_OP_SETCTLRC 0x04 /* Set controller characteristics command */#define M_OP_SEREX 0x07 /* Serious exception end message */#define M_OP_AVAILABLE 0x08 /* Available command */#define M_OP_ONLINE 0x09 /* Online command */#define M_OP_SETUNITC 0x0a /* Set unit characteristics command */#define M_OP_DTACCPATH 0x0b /* Determine access paths command */#define M_OP_ACCESS 0x10 /* Access command */#define M_OP_COMPCD 0x11 /* Compare controller data command */#define M_OP_ERASE 0x12 /* Erase command */#define M_OP_FLUSH 0x13 /* Flush command */#define M_OP_REPLACE 0x14 /* Replace command */#define M_OP_COMPHD 0x20 /* Compare host data command */#define M_OP_READ 0x21 /* Read command */#define M_OP_WRITE 0x22 /* Write command */#define M_OP_AVAILATTN 0x40 /* Available attention message */#define M_OP_DUPUNIT 0x41 /* Duplicate unit number attention message */#define M_OP_ACCPATH 0x42 /* Access path attention message */#define M_OP_END 0x80 /* End message flag *//* * Generic command modifiers */#define M_MD_EXPRS 0x8000 /* Express request */#define M_MD_COMP 0x4000 /* Compare */#define M_MD_CLSEX 0x2000 /* Clear serious exception */#define M_MD_ERROR 0x1000 /* Force error */#define M_MD_SCCHH 0x0800 /* Suppress caching (high speed) */#define M_MD_SCCHL 0x0400 /* Suppress caching (low speed) */#define M_MD_SECOR 0x0200 /* Suppress error correction */#define M_MD_SEREC 0x0100 /* Suppress error recovery */#define M_MD_SSHDW 0x0080 /* Suppress shadowing */#define M_MD_WBKNV 0x0040 /* Write back (non-volatile) */#define M_MD_WBKVL 0x0020 /* Write back (volatile) */#define M_MD_WRSEQ 0x0010 /* Write shadow set one unit at a time *//* * AVAILABLE command modifiers */#define M_AVM_ALLCD 0x0002 /* All class drivers */#define M_AVM_SPINDOWN 0x0001 /* Spin down *//* * FLUSH command modifiers */#define M_FLM_FLUSHENU 0x0001 /* Flush entire unit */#define M_FLM_VOLATILE 0x0002 /* Volatile only *//* * GET UNIT STATUS command modifiers */#define M_GUM_NEXTUNIT 0x0001 /* Next unit *//* * ONLINE command modifiers */#define M_OLM_RIP 0x0001 /* Allow self destruction */#define M_OLM_IGNMF 0x0002 /* Ignore media format error *//* * ONLINE and SET UNIT CHARACTERISTICS command modifiers */#define M_OSM_ALTERHI 0x0020 /* Alter host identifier */#define M_OSM_SHADOWSP 0x0010 /* Shadow unit specified */#define M_OSM_CLEARWBL 0x0008 /* Clear write-back data lost */#define M_OSM_SETWRPROT 0x0004 /* Set write protect *//* * REPLACE command modifiers */#define M_RPM_PRIMARY 0x0001 /* Primary replacement block *//* * End message flags */#define M_EF_BBLKR 0x80 /* Bad block reported */#define M_EF_BBLKU 0x40 /* Bad block unreported */#define M_EF_ERLOG 0x20 /* Error log generated */#define M_EF_SEREX 0x10 /* Serious exception *//* * Controller flags */#define M_CF_ATTN 0x80 /* Enable attention messages */#define M_CF_MISC 0x40 /* Enable miscellaneous error log messages */#define M_CF_OTHER 0x20 /* Enable other host's error log messages */#define M_CF_THIS 0x10 /* Enable this host's error log messages */#define M_CF_MLTHS 0x04 /* Multi-host */#define M_CF_SHADW 0x02 /* Shadowing */#define M_CF_576 0x01 /* 576 byte sectors *//* * Unit flags */#define M_UF_REPLC 0x8000 /* Controller initiated bad block replacement */#define M_UF_INACT 0x4000 /* Inactive shadow set unit */#define M_UF_WRTPH 0x2000 /* Write protect (hardware) */#define M_UF_WRTPS 0x1000 /* Write protect (software or volume) */#define M_UF_SCCHH 0x8000 /* Suppress caching (high speed) */#define M_UF_SCCHL 0x4000 /* Suppress caching (low speed) */#define M_UF_RMVBL 0x0080 /* Removable media */#define M_UF_WBKNV 0x0040 /* Write back (non-volatile) */#define M_UF_576 0x0004 /* 576 byte sectors */#define M_UF_CMPWR 0x0002 /* Compare writes */#define M_UF_CMPRD 0x0001 /* Compare reads *//* * Error Log message format codes */#define M_FM_CTLRERR 0x00 /* Controller error */#define M_FM_BUSADDR 0x01 /* Host memory access error */#define M_FM_DISKTRN 0x02 /* Disk transfer error */#define M_FM_SDI 0x03 /* SDI error */#define M_FM_SMLDSK 0x04 /* Small disk error *//* * Error Log message flags */#define M_LF_SUCC 0x80 /* Operation successful */#define M_LF_CONT 0x40 /* Operation continuing */#define M_LF_SQNRS 0x01 /* Sequence number reset *//* * Status codes */#define M_ST_MASK 0x1f /* Status code mask */#define M_ST_SUCCESS 0x00 /* Success */#define M_ST_INVALCMD 0x01 /* Invalid command */#define M_ST_ABORTED 0x02 /* Command aborted */#define M_ST_OFFLINE 0x03 /* Unit offline */#define M_ST_AVAILABLE 0x04 /* Unit available */#define M_ST_MFMTERR 0x05 /* Media format error */#define M_ST_WRPROT 0x06 /* Write protected */#define M_ST_COMPERR 0x07 /* Compare error */#define M_ST_DATAERR 0x08 /* Data error */#define M_ST_HOSTBUFERR 0x09 /* Host buffer access error */#define M_ST_CTLRERR 0x0a /* Controller error */#define M_ST_DRIVEERR 0x0b /* Drive error */#define M_ST_DIAG 0x1f /* Message from an internal diagnostic *//* * Subcodes of M_ST_OFFLINE */#define M_OFFLINE_UNKNOWN (0 << 5) /* unknown or on other ctlr */#define M_OFFLINE_UNMOUNTED (1 << 5) /* unmounted or RUN/STOP at STOP */#define M_OFFLINE_INOPERATIVE (2 << 5) /* inoperative? */#define M_OFFLINE_DUPLICATE (4 << 5) /* duplicate unit number */#define M_OFFLINE_INDIAGNOSTIC (8 << 5) /* disabled by FS or diagnostic *//* * An MSCP packet begins with a header giving the length of * the entire packet (including the header itself)(?), two bytes * of device specific data, and the a whole bunch of variants * depending on message type. * * N.B.: In most cases we distinguish between a `command' and * an `end' variant as well. The command variant is that which * is given to the controller; the `end' variant is its response. *//* * Generic sequential message variant (command and response). */struct mscpv_seq { long seq_bytecount; /* byte count */#define seq_rbn seq_bytecount /* aka RBN (replace) */#define seq_outref seq_bytecount /* aka outref (abort/get cmd status) */ long seq_buffer; /* buffer descriptor */ long seq_mapbase; /* page map (first PTE) phys address */ long seq_xxx1; /* ? */ /* unused */ long seq_lbn; /* logical block number */ long seq_xxx2; /* ? */ /* unused */ long *seq_addr; /* pointer to cmd descriptor */ long seq_software[4]; /* reserved to software; unused */};/* * Set Controller Characteristics command variant */struct mscpv_sccc { u_short sccc_version; /* MSCP version number */ u_short sccc_ctlrflags; /* controller flags */ u_short sccc_hosttimo; /* host timeout */ u_short sccc_usefrac; /* use fraction */ long sccc_time; /* time and date */ long sccc_xxx1; /* ? */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -