|
|
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: * IdeDisk.h - Exported Interface for IDE Disk device class. ! 29: * ! 30: * HISTORY ! 31: * ! 32: * 04-Mar-1996 Rakesh Dubey at NeXT ! 33: * Modified so that no memory is allocated at run-time. ! 34: * ! 35: * 07-Jul-1994 Rakesh Dubey at NeXT ! 36: * Created from original driver written by David Somayajulu. ! 37: */ ! 38: ! 39: #ifdef DRIVER_PRIVATE ! 40: ! 41: #ifndef _BSD_DEV_IDEDISK_H ! 42: #define _BSD_DEV_IDEDISK_H 1 ! 43: ! 44: #import <driverkit/return.h> ! 45: #import <driverkit/driverTypes.h> ! 46: #import <driverkit/IODisk.h> ! 47: #import <driverkit/kernelDiskMethods.h> ! 48: ! 49: #if (IO_DRIVERKIT_VERSION == 330) ! 50: #import <mach/time_stamp.h> ! 51: #else ! 52: #import <kern/queue.h> ! 53: #import <kern/time_stamp.h> ! 54: #endif ! 55: ! 56: #import <kernserv/clock_timer.h> ! 57: #import "IdeCntPublic.h" ! 58: ! 59: /* ! 60: * We will preallocate command buffers for doing I/O. This avoids a deadlock ! 61: * situation when we are running very low on memory. Comment out this #define ! 62: * if this behavior is not desired. ! 63: */ ! 64: #define NO_ATA_RUNTIME_MEMORY_ALLOCATION ! 65: ! 66: /* ! 67: * Commands to be executed by I/O thread. ! 68: */ ! 69: typedef enum { ! 70: IDEC_IOREQ, /* process IdeIoReq_t */ ! 71: IDEC_READ, /* normal read */ ! 72: IDEC_WRITE, /* normal write */ ! 73: IDEC_ABORT, /* abort pending "needsDisk" I/Os */ ! 74: IDEC_THREAD_ABORT, /* thread abort */ ! 75: IDEC_INIT, /* initialize the ide drive */ ! 76: } IdeCmd_t; ! 77: ! 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: ! 111: ! 112: @interface IdeDisk:IODisk<IODiskReadingAndWriting, IOPhysicalDiskMethods> ! 113: { ! 114: @private ! 115: /* ! 116: * The queues on which all I/Os are enqueued by exported methods. ! 117: */ ! 118: queue_head_t _ioQueueDisk; /* for I/Os requiring disk */ ! 119: queue_head_t _ioQueueNodisk; /* for other I/O */ ! 120: ! 121: #ifdef NO_ATA_RUNTIME_MEMORY_ALLOCATION ! 122: queue_head_t _ideBufQueue; ! 123: id _ideBufLock; ! 124: #define MAX_NUM_ATABUF 128 ! 125: ideBuf_t _ideBufPool[MAX_NUM_ATABUF]; ! 126: #endif NO_ATA_RUNTIME_MEMORY_ALLOCATION ! 127: ! 128: /* ! 129: * NXConditionLock - protects the queues; I/O thread sleeps on this. ! 130: */ ! 131: id _ioQLock; ! 132: ! 133: /* ! 134: * The pseudo controller to streamline interrupts, resets and diagnostics ! 135: * commands. ! 136: */ ! 137: id _cntrlr; ! 138: ! 139: /* ! 140: * Commands to read and write from the disk are cached here. ! 141: */ ! 142: unsigned _ideReadCommand; ! 143: unsigned _ideWriteCommand; ! 144: ! 145: ideDriveInfo_t _ideInfo; ! 146: unsigned _driveNum; ! 147: unsigned char _ideDriveName[32]; ! 148: } ! 149: ! 150: /* ! 151: * Probe is invoked at load time. It determines what devices are on the ! 152: * bus and alloc's and init:'s an instance of this class for each one. ! 153: */ ! 154: + (BOOL)probe:deviceDescription; ! 155: + (IODeviceStyle) deviceStyle; ! 156: + (Protocol **) requiredProtocols; ! 157: + (BOOL)hd_devsw_init:deviceDescription; ! 158: ! 159: - (ideDriveInfo_t)ideGetDriveInfo; ! 160: - (id)cntrlr; ! 161: - (unsigned)driveNum; ! 162: ! 163: @end ! 164: ! 165: #endif /* _BSD_DEV_IDEDISK_H */ ! 166: ! 167: #endif /* DRIVER_PRIVATE */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.