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