Annotation of kernel/bsd/dev/ppc/drvATADisk/ATADiskInternal.h, revision 1.1.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:  * ATADiskInt.h - private categories and typedefs for ATADisk class.
                     30:  *
                     31:  * HISTORY 
                     32:  * 07-Jul-1994  Rakesh Dubey at NeXT
                     33:  *     Created from original driver written by David Somayajulu.
                     34:  */
                     35:  
                     36: #ifdef DRIVER_PRIVATE
                     37: 
                     38: #ifndef        _BSD_DEV_ATADISKINTERNAL_H
                     39: #define _BSD_DEV_ATADISKINTERNAL_H
                     40: 
                     41: #import <driverkit/return.h>
                     42: #import <driverkit/driverTypes.h>
                     43: #import "ATADisk.h"
                     44: #import "IdeCntPublic.h"
                     45: 
                     46: /*
                     47:  * Condition variable states for ioQueueLock.
                     48:  */
                     49: #define NO_WORK_AVAILABLE      0
                     50: #define WORK_AVAILABLE         1
                     51: 
                     52: /*
                     53:  * Kernel-specific types.
                     54:  */
                     55: #define NUM_IDE_DEV            (MAX_IDE_DRIVES * MAX_IDE_CONTROLLERS)  // 4
                     56: 
                     57: #define NUM_IDE_PART           8
                     58: #define IDE_LIVE_PART          (NUM_IDE_PART-1)
                     59: 
                     60: 
                     61: typedef struct {
                     62:     /*
                     63:      * One per unit. Note that the physDevice (live partition), the raw
                     64:      * device, and the block devices for a given disk all share the same
                     65:      * physbuf. Block devices don't use physbuf; arbitration for access to
                     66:      * physbuf by the raw and live devices is done by physio(). 
                     67:      */
                     68:     struct buf *physbuf;   /* for phys I/O */
                     69: 
                     70: }       Ide_dev_t;
                     71: 
                     72: __private_extern__ void ide_init_idmap(id);
                     73: __private_extern__ IODevAndIdInfo *ide_idmap();
                     74: 
                     75: /*
                     76:  * General utility methods in ATADiskInternal.m.
                     77:  */
                     78: @interface ATADisk(Internal)
                     79: 
                     80: /*
                     81:  * Print details about the drive. 
                     82:  */
                     83: -(void)printInfo:(ideIdentifyInfo_t *)ideIdentifyInfo unit:(unsigned int)unit;
                     84: 
                     85: /*
                     86:  * Probe for existing drive.
                     87:  */
                     88: - (BOOL)ideDiskInit:(unsigned int)diskUnit target:(unsigned int)unit;
                     89: 
                     90: - (IOReturn)initIdeDrive;
                     91: 
                     92: /*
                     93:  * One-time only initialization.
                     94:  */
                     95: - initResources:controller;
                     96: 
                     97: /*
                     98:  * Free up local resources. 
                     99:  */
                    100: - free;
                    101: 
                    102: 
                    103: /*
                    104:  * Alloc/free command buffers.
                    105:  */
                    106: - (ideBuf_t *)allocIdeBuf:(void *)pending;
                    107: - (void)freeIdeBuf:(ideBuf_t *)ideBuf;
                    108: 
                    109: /*
                    110:  * Common read/write routine.
                    111:  */
                    112: - (IOReturn) deviceRwCommon : (IdeCmd_t)command
                    113:                  block: (u_int) deviceBlock
                    114:                  length : (u_int)length
                    115:                  buffer : (void *)buffer
                    116:                  client : (vm_task_t)client
                    117:                  pending : (void *)pending
                    118:                  actualLength : (u_int *)actualLength;
                    119: 
                    120: /*
                    121:  * -- Enqueue an ideBuf_t on ioQueue<Disk,Nodisk>
                    122:  * -- wake up the I/O thread
                    123:  * -- wait for I/O complete (if ideBuf->pending == NULL)
                    124:  */
                    125: - (IOReturn)enqueueIdeBuf      : (ideBuf_t *)ideBuf;
                    126: 
                    127: /*
                    128:  * Either wake up the thread which is waiting on the ideCmdBuf, or send an 
                    129:  * ioComplete back to client. ideCmdBuf->status must be valid.
                    130:  */
                    131: - (void)ideIoComplete          : (ideBuf_t *)ideBuf;
                    132: 
                    133: /*
                    134:  * Main command dispatch method.
                    135:  */
                    136: - (void)ideCmdDispatch                 : (ideBuf_t *)ideBuf;
                    137: 
                    138: - (IOReturn) ideXfrIoReq:(ideIoReq_t *)ideIoReq;
                    139: /*
                    140:  * Common read/write method.
                    141:  */
                    142: - (IOReturn)ideRwCommon        : (ideBuf_t *)ideBuf;
                    143: 
                    144: - (void)logRwErr               : (const char *)errType 
                    145:                          block : (int)block
                    146:                         status : (ide_return_t)status
                    147:                       readFlag : (BOOL)readFlag;
                    148: 
                    149: /*
                    150:  * Unlock ioQLock, updating condition variable as appropriate.
                    151:  */
                    152: - (void)unlockIoQLock;
                    153: 
                    154: /*
                    155:  * Top-level I/O thread.
                    156:  */
                    157: volatile void ideThread(ATADisk *idisk);
                    158: 
                    159: @end   /* ATADisk(Internal) */
                    160: 
                    161: #endif /* _BSD_DEV_ATADISKINTERNAL_H */
                    162: 
                    163: #endif /* DRIVER_PRIVATE */
                    164: 

unix.superglobalmegacorp.com

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