Annotation of kernel/bsd/dev/ppc/drvATADisk/ATADisk.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: /*
        !            26:  * Copyright 1997-1998 by Apple Computer, Inc., All rights reserved.
        !            27:  * Copyright 1994-1997 NeXT Software, Inc., All rights reserved.
        !            28:  *
        !            29:  * ATADisk.h - Exported Interface for IDE/ATA Disk device class. 
        !            30:  *
        !            31:  * HISTORY 
        !            32:  *
        !            33:  * 04-Mar-1996  Rakesh Dubey at NeXT
        !            34:  *     Modified so that no memory is allocated at run-time.
        !            35:  *
        !            36:  * 07-Jul-1994  Rakesh Dubey at NeXT
        !            37:  *     Created from original driver written by David Somayajulu.
        !            38:  */
        !            39: 
        !            40: #ifdef DRIVER_PRIVATE
        !            41: 
        !            42: #ifndef        _BSD_DEV_ATADISK_H
        !            43: #define _BSD_DEV_ATADISK_H 1
        !            44: 
        !            45: #import <driverkit/return.h>
        !            46: #import <driverkit/driverTypes.h>
        !            47: #import <driverkit/IODisk.h>
        !            48: #import <driverkit/kernelDiskMethods.h>
        !            49: 
        !            50: #if (IO_DRIVERKIT_VERSION == 330)
        !            51: #import <mach/time_stamp.h>
        !            52: #else
        !            53: #import <kern/queue.h>
        !            54: #import <kern/time_stamp.h>
        !            55: #endif
        !            56: 
        !            57: #import <kernserv/clock_timer.h>
        !            58: #import "IdeCntPublic.h"
        !            59: 
        !            60: /*
        !            61:  * We will preallocate command buffers for doing I/O. This avoids a deadlock
        !            62:  * situation when we are running very low on memory. Comment out this #define
        !            63:  * if this behavior is not desired.
        !            64:  */
        !            65: #define NO_ATA_RUNTIME_MEMORY_ALLOCATION
        !            66: 
        !            67: /*
        !            68:  * Commands to be executed by I/O thread.
        !            69:  */
        !            70: typedef enum {
        !            71:     IDEC_IOREQ,                        /* process IdeIoReq_t */
        !            72:     IDEC_READ,                 /* normal read */
        !            73:     IDEC_WRITE,                        /* normal write */
        !            74:     IDEC_ABORT,                        /* abort pending "needsDisk" I/Os */
        !            75:     IDEC_THREAD_ABORT,         /* thread abort */
        !            76:     IDEC_INIT,                 /* initialize the ide drive */
        !            77: } IdeCmd_t;
        !            78: 
        !            79: /*
        !            80:  * Command buffer. These are enqueued on one of the I/O queues by exported
        !            81:  * methods and dequeued and processed by the I/O thread.
        !            82:  */
        !            83: typedef  struct {
        !            84:     IdeCmd_t   command;        /* IDEC_IOREQ, etc. */
        !            85:     ideIoReq_t *ideIoReq;      /* command block passed to controller,
        !            86:                                   (IDEC_IOREQ only) */
        !            87:     u_int      block;          /* IDE_READ and IDE_WRITE only */
        !            88:     u_int      blockCnt;       /* ditto */
        !            89:     void       *buf;           /* where to r/w, for all except IDEC_IOREQ */
        !            90:     vm_task_t  client;         /* address space containing *buf */
        !            91:     id         waitLock;       /* NXConditionLock  */
        !            92:     void       *pending;       /* if non-NULL, async request; this is */
        !            93:                                /* used to ioComplete: the operation. */
        !            94: 
        !            95:     unsigned   needsDisk:1,
        !            96:                oneWay:1;       /* 1 ==> no I/O complete */
        !            97:     
        !            98:     /*
        !            99:      * Fields valid at I/O complete time.
        !           100:      */
        !           101:     u_int      bytesXfr;       /* bytes actually moved 
        !           102:                                  (IDEC_{READ,WRITE} only) */
        !           103:     IOReturn   status;         /* result */
        !           104:     
        !           105:     queue_chain_t link;
        !           106:     queue_chain_t bufLink;
        !           107:     
        !           108: } ideBuf_t;
        !           109: 
        !           110: @interface ATADisk:IODisk<IODiskReadingAndWriting, IOPhysicalDiskMethods>
        !           111: {
        !           112: @private
        !           113:     /*
        !           114:      * The queues on which all I/Os are enqueued by exported methods. 
        !           115:      */
        !           116:     queue_head_t       _ioQueueDisk;   /* for I/Os requiring disk */
        !           117:     queue_head_t       _ioQueueNodisk; /* for other I/O */
        !           118: 
        !           119: #ifdef NO_ATA_RUNTIME_MEMORY_ALLOCATION
        !           120:     queue_head_t       _ideBufQueue;
        !           121:     id                 _ideBufLock;
        !           122: #define MAX_NUM_ATABUF         128
        !           123:     ideBuf_t           _ideBufPool[MAX_NUM_ATABUF];
        !           124: #endif NO_ATA_RUNTIME_MEMORY_ALLOCATION
        !           125:     
        !           126:     /*
        !           127:      * NXConditionLock - protects the queues; I/O thread sleeps on this. 
        !           128:      */
        !           129:     id                         _ioQLock;
        !           130:     
        !           131:     /*
        !           132:      * The pseudo controller to streamline interrupts, resets and diagnostics
        !           133:      * commands. 
        !           134:      */
        !           135:     id                 _cntrlr;
        !           136:     
        !           137:     /*
        !           138:      * Commands to read and write from the disk are cached here. 
        !           139:      */
        !           140:     unsigned           _ideReadCommand;
        !           141:     unsigned           _ideWriteCommand;
        !           142: 
        !           143:     unsigned           _ideReadCommandPIO;
        !           144:     unsigned           _ideWriteCommandPIO;
        !           145: 
        !           146:     u_int              _ideControllerType;
        !           147: 
        !           148:    ideDriveInfo_t      _ideInfo;
        !           149:     unsigned           _driveNum;
        !           150:     unsigned char      _ideDriveName[32];
        !           151: }
        !           152: 
        !           153: /*
        !           154:  * Probe is invoked at load time. It determines what devices are on the
        !           155:  * bus and alloc's and init:'s an instance of this class for each one.
        !           156:  */
        !           157: + (BOOL)probe:deviceDescription;
        !           158: + (IODeviceStyle) deviceStyle;
        !           159: + (Protocol **) requiredProtocols;
        !           160: + (BOOL)hd_devsw_init:deviceDescription;
        !           161: 
        !           162: - (ideDriveInfo_t)ideGetDriveInfo;
        !           163: - (id)cntrlr;
        !           164: - (unsigned)driveNum;
        !           165: 
        !           166: @end
        !           167: 
        !           168: #endif /* _BSD_DEV_ATADISK_H */
        !           169: 
        !           170: #endif /* DRIVER_PRIVATE */

unix.superglobalmegacorp.com

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