Annotation of drvEIDE/EIDE.drvproj/EIDE.lksproj/AtapiCnt.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * "Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.0 (the 'License').  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License."
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: /*
        !            25:  * Copyright 1997-1998 by Apple Computer, Inc., All rights reserved.
        !            26:  * Copyright 1994-1997 NeXT Software, Inc., All rights reserved.
        !            27:  *
        !            28:  * AtapiCnt.h - Interface for ATAPI controller class. 
        !            29:  *
        !            30:  * HISTORY 
        !            31:  * 31-Aug-1994         Rakesh Dubey at NeXT 
        !            32:  *     Created.
        !            33:  */
        !            34: 
        !            35: #ifndef _ATAPI_CNT_H
        !            36: #define _ATAPI_CNT_H 1
        !            37: 
        !            38: #import <driverkit/scsiTypes.h>
        !            39: #import <driverkit/IOSCSIController.h>
        !            40: #import "AtapiCntCmds.h"
        !            41: 
        !            42: /*
        !            43:  * We will preallocate command buffers for doing I/O. This avoids a deadlock
        !            44:  * situation when we are running very low on memory. Comment out this #define
        !            45:  * if this behavior is not desired.
        !            46:  */
        !            47: #define NO_ATAPI_RUNTIME_MEMORY_ALLOCATION
        !            48: 
        !            49: /*
        !            50:  * Commands to be executed by I/O thread.
        !            51:  */
        !            52: typedef enum {
        !            53:     ATAPI_CNT_IOREQ,                   /* process IdeIoReq_t */
        !            54:     ATAPI_CNT_ABORT,                   /* abort pending "needsDisk" I/Os */
        !            55:     ATAPI_CNT_THREAD_ABORT,            /* thread abort */
        !            56: } atapiCmd_t;
        !            57: 
        !            58: /*
        !            59:  * Command buffer. These are enqueued on one of the I/O queues by exported
        !            60:  * methods and dequeued and processed by the I/O thread.
        !            61:  */
        !            62: typedef  struct {
        !            63:     atapiCmd_t         command;                /* IOREQ or abort */
        !            64:     atapiIoReq_t       *atapiIoReq;    /* command block passed to controller */
        !            65:     void                       *buffer;
        !            66:     vm_task_t          client;
        !            67:     id                         waitLock;               /* NXConditionLock  */
        !            68:     sc_status_t                status;
        !            69:     queue_chain_t      link;
        !            70:     queue_chain_t      bufLink;
        !            71: } atapiBuf_t;
        !            72: 
        !            73: /*
        !            74:  * Mode sense/select - Mode Parameter Header.
        !            75:  */
        !            76: typedef struct {
        !            77:        unsigned char mdl1;             // mode data length MSB
        !            78:        unsigned char mdl0;             // mode data length LSB
        !            79:        unsigned char mt;               // medium type
        !            80:        unsigned char rsvd0;
        !            81:        unsigned char rsvd1;
        !            82:        unsigned char rsvd2;
        !            83:        unsigned char rsvd3;
        !            84:        unsigned char rsvd4;
        !            85: } atapiMPH_t;
        !            86: 
        !            87: /*
        !            88:  * Mode sense/select - Mode Parameter List.
        !            89:  */
        !            90: typedef struct {
        !            91:        atapiMPH_t              mph;
        !            92:        unsigned char   pageData[MODSEL_DATA_LEN * 2];
        !            93: } atapiMPL_t;
        !            94: 
        !            95: @interface AtapiController:IOSCSIController
        !            96: {
        !            97: @private
        !            98:     /*
        !            99:      * The queues on which all I/Os are enqueued by exported methods. 
        !           100:      */
        !           101:     queue_head_t       _ioQueueNodisk; /* for all I/O */
        !           102: 
        !           103: #ifdef NO_ATAPI_RUNTIME_MEMORY_ALLOCATION
        !           104:     queue_head_t       _atapiBufQueue;
        !           105:     id                 _atapiBufLock;
        !           106: #define MAX_NUM_ATAPIBUF               64
        !           107:     atapiBuf_t         _atapiBufPool[MAX_NUM_ATAPIBUF];
        !           108: #endif NO_ATAPI_RUNTIME_MEMORY_ALLOCATION
        !           109: 
        !           110:     /*
        !           111:      * NXConditionLock - protects the queues; I/O thread sleeps on this. 
        !           112:      */
        !           113:     id                         _ioQLock;
        !           114:     
        !           115:     id _ataController;                 /* ATA controller */
        !           116: 
        !           117:        /*
        !           118:         * Mode sense/select Mode Parameter List. Used to translate
        !           119:         * from ATAPI format to SCSI or vice-versa.
        !           120:         */
        !           121:        atapiMPL_t      modeData;
        !           122: }
        !           123: 
        !           124: + (BOOL)probe : deviceDescription;
        !           125: + (IODeviceStyle)deviceStyle;          /* override IOSCSIController    */
        !           126: + (Protocol **)requiredProtocols;
        !           127: 
        !           128: - (sc_status_t) executeRequest         : (IOSCSIRequest *)scsiReq 
        !           129:                        buffer : (void *)buffer 
        !           130:                        client : (vm_task_t)client;
        !           131:                         
        !           132: - (BOOL) maptoAtapiCmd:(atapiIoReq_t *)atapiIoReq      /* map SCSI -> ATAPI */
        !           133:                 buffer:(void *)buffer newBuffer:(atapiMPL_t *)mode;    
        !           134: 
        !           135: - (BOOL) maptoSCSICmd:(atapiIoReq_t *)atapiIoReq buffer:(void *)buffer
        !           136:                 newBuffer:(atapiMPL_t *)mode;
        !           137: 
        !           138: - (BOOL) emulateSCSICmd:(atapiIoReq_t *)atapiIoReq 
        !           139:                 buffer:(void *)buffer;         /* fake these */
        !           140: 
        !           141: - (sc_status_t)resetSCSIBus;
        !           142: 
        !           143: @end
        !           144: 
        !           145: /*
        !           146:  * So that we can use ATAPI naming convention and still use the ATA
        !           147:  * registers.
        !           148:  */
        !           149: #define InterruptReason                sectCnt
        !           150: #define byteCountLow           cylLow
        !           151: #define byteCountHigh          cylHigh
        !           152: #define driveSelect            drHead
        !           153: 
        !           154: #define ATAPI_NLUNS            1
        !           155: 
        !           156: #endif /* _ATAPI_CNT_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.