Annotation of kernel/bsd/dev/ppc/drvPPCATA/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.1 (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 by Apple Computer, Inc., all rights reserved.
        !            26: /*
        !            27:  * Copyright (c) 1994-1997 NeXT Software, Inc.  All rights reserved. 
        !            28:  *
        !            29:  * AtapiCnt.h - Interface for ATAPI controller class. 
        !            30:  *
        !            31:  * HISTORY 
        !            32:  * 31-Aug-1994         Rakesh Dubey at NeXT 
        !            33:  *     Created.
        !            34:  */
        !            35: 
        !            36: #import <driverkit/scsiTypes.h>
        !            37: #import <driverkit/IOSCSIController.h>
        !            38: #import "AtapiCntCmds.h"
        !            39: 
        !            40: /*
        !            41:  * We will preallocate command buffers for doing I/O. This avoids a deadlock
        !            42:  * situation when we are running very low on memory. Comment out this #define
        !            43:  * if this behavior is not desired.
        !            44:  */
        !            45: #define NO_ATAPI_RUNTIME_MEMORY_ALLOCATION
        !            46: 
        !            47: /*
        !            48:  * Commands to be executed by I/O thread.
        !            49:  */
        !            50: typedef enum {
        !            51:     ATAPI_CNT_IOREQ,                   /* process IdeIoReq_t */
        !            52:     ATAPI_CNT_ABORT,                   /* abort pending "needsDisk" I/Os */
        !            53:     ATAPI_CNT_THREAD_ABORT,            /* thread abort */
        !            54: } atapiCmd_t;
        !            55: 
        !            56: /*
        !            57:  * Command buffer. These are enqueued on one of the I/O queues by exported
        !            58:  * methods and dequeued and processed by the I/O thread.
        !            59:  */
        !            60: typedef  struct {
        !            61:     atapiCmd_t command;        /* IOREQ or abort */
        !            62:     atapiIoReq_t *atapiIoReq;  /* command block passed to controller */
        !            63:     void       *buffer;
        !            64:     vm_task_t  client;
        !            65:     id         waitLock;       /* NXConditionLock  */
        !            66:     sc_status_t        status;
        !            67:     queue_chain_t link;
        !            68:     queue_chain_t bufLink;
        !            69: } atapiBuf_t;
        !            70: 
        !            71: 
        !            72: @interface AtapiController:IOSCSIController
        !            73: {
        !            74: @private
        !            75:     /*
        !            76:      * The queues on which all I/Os are enqueued by exported methods. 
        !            77:      */
        !            78:     queue_head_t       _ioQueueNodisk; /* for all I/O */
        !            79: 
        !            80: #ifdef NO_ATAPI_RUNTIME_MEMORY_ALLOCATION
        !            81:     queue_head_t       _atapiBufQueue;
        !            82:     id                 _atapiBufLock;
        !            83: #define MAX_NUM_ATAPIBUF               64
        !            84:     atapiBuf_t         _atapiBufPool[MAX_NUM_ATAPIBUF];
        !            85: #endif NO_ATAPI_RUNTIME_MEMORY_ALLOCATION
        !            86: 
        !            87:     /*
        !            88:      * NXConditionLock - protects the queues; I/O thread sleeps on this. 
        !            89:      */
        !            90:     id                         _ioQLock;
        !            91:     
        !            92:     id _ataController;                 /* ATA controller */
        !            93: }
        !            94: 
        !            95: + (BOOL)probe : deviceDescription;
        !            96: + (IODeviceStyle)deviceStyle;          /* override IOSCSIController    */
        !            97: + (Protocol **)requiredProtocols;
        !            98: 
        !            99: - (sc_status_t) executeRequest         : (IOSCSIRequest *)scsiReq 
        !           100:                        buffer : (void *)buffer 
        !           101:                        client : (vm_task_t)client;
        !           102:                         
        !           103: - (BOOL) maptoAtapiCmd:(atapiIoReq_t *)atapiIoReq      /* map SCSI -> ATAPI */
        !           104:                 buffer:(void *)buffer; 
        !           105: 
        !           106: - (BOOL) emulateSCSICmd:(atapiIoReq_t *)atapiIoReq 
        !           107:                 buffer:(void *)buffer;         /* fake these */
        !           108: 
        !           109: - (sc_status_t)resetSCSIBus;
        !           110: 
        !           111: - (void)getDMAAlignment:(IODMAAlignment *)alignment;
        !           112: 
        !           113: - (unsigned) maxTransfer;
        !           114: @end
        !           115: 
        !           116: /*
        !           117:  * So that we can use ATAPI naming convention and still use the ATA
        !           118:  * registers.
        !           119:  */
        !           120: #define InterruptReason                sectCnt
        !           121: #define byteCountLow           cylLow
        !           122: #define byteCountHigh          cylHigh
        !           123: #define driveSelect            drHead
        !           124: 
        !           125: #define ATAPI_NLUNS            1

unix.superglobalmegacorp.com

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