|
|
1.1 root 1: /*
2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * The contents of this file constitute Original Code as defined in and
7: * are subject to the Apple Public Source License Version 1.1 (the
8: * "License"). You may not use this file except in compliance with the
9: * License. Please obtain a copy of the License at
10: * http://www.apple.com/publicsource and read it before using this file.
11: *
12: * This Original Code and all software distributed under the License are
13: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17: * License for the specific language governing rights and limitations
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /*
23: *
24: * ATADevice.h
25: *
26: */
27:
28: typedef struct ATAIdentify
29: {
30: UInt16 generalConfiguration;
31: UInt16 logicalCylinders;
32: UInt16 reserved_1[1];
33: UInt16 logicalHeads;
34: UInt16 reserved_2[2];
35: UInt16 logicalSectorsPerTrack;
36: UInt16 reserved_3[3];
37: char serialNumber[20];
38: UInt16 reserved_4[3];
39: char firmwareRevision[8];
40: char modelNumber[40];
41: UInt16 multipleModeSectors;
42: UInt16 reserved_5[1];
43: UInt16 capabilities1;
44: UInt16 capabilities2;
45: UInt16 pioMode;
46: UInt16 reserved_6[1];
47: UInt16 validFields;
48: UInt16 currentLogicalCylinders;
49: UInt16 currentLogicalHeads;
50: UInt16 currentLogicalSectorsPerTrack;
51: UInt16 currentAddressableSectors[2];
52: UInt16 currentMultipleModeSectors;
53: UInt16 userAddressableSectors[2];
54: UInt16 reserved_7[1];
55: UInt16 dmaModes;
56: UInt16 advancedPIOModes;
57: UInt16 minDMACycleTime;
58: UInt16 recDMACycleTime;
59: UInt16 minPIOCycleTimeNoIORDY;
60: UInt16 minPIOCyclcTimeIORDY;
61: UInt16 reserved_8[2];
62: UInt16 busReleaseLatency;
63: UInt16 serviceLatency;
64: UInt16 reserved_9[2];
65: UInt16 queueDepth;
66: UInt16 reserved_10[4];
67: UInt16 versionMajor;
68: UInt16 versionMinor;
69: UInt16 commandSetsSupported1;
70: UInt16 commandSetsSupported2;
71: UInt16 commandSetsSupported3;
72: UInt16 commandSetsEnabled1;
73: UInt16 commandSetsEnabled2;
74: UInt16 commandSetsDefault;
75: UInt16 ultraDMAModes;
76: UInt16 securityEraseTime;
77: UInt16 securityEnhancedEraseTime;
78: UInt16 currentAdvPowerMgtValue;
79: UInt16 reserved_11[35];
80: UInt16 removableMediaSupported;
81: UInt16 securityStatus;
82: UInt16 reserved_12[127];
83: };
84:
85:
86: typedef struct ATAPIInquiry
87: {
88: char reserved[8];
89: char vendorName[8];
90: char productName[16];
91: char productRevision[4];
92: };
93:
94: typedef struct ATAPISenseData
95: {
96: char reserved[32];
97: };
98:
99: #define MAX_ATA_REGS 9
100:
101: enum ATARegs
102: {
103: /*
104: * ATA Register ordinals
105: */
106: ataRegData = 0x00,
107: ataRegFeatures = 0x01,
108: ataRegSectorCount = 0x02,
109: ataRegSectorNumber = 0x03,
110: ataRegCylinderLow = 0x04,
111: ataRegCylinderHigh = 0x05,
112: ataRegDriveHead = 0x06,
113: ataRegCommand = 0x07,
114:
115: ataRegError = 0x01,
116: ataRegStatus = 0x07,
117:
118: ataRegDeviceControl = 0x08,
119:
120: ataRegAltStatus = 0x08,
121:
122: /*
123: * ATAPI Register ordinals
124: */
125: atapiRegData = 0x00,
126: atapiRegFeatures = 0x01,
127: atapiRegIntReason = 0x02,
128: atapiRegByteCountLow = 0x04,
129: atapiRegByteCountHigh = 0x05,
130: atapiRegDeviceSelect = 0x06,
131: atapiRegCommand = 0x07,
132:
133: atapiRegError = 0x01,
134: atapiRegStatus = 0x07,
135:
136: atapiRegDeviceControl = 0x08,
137:
138: atapiRegAlternateStatus = 0x08,
139: };
140:
141: enum ATAPIIntReason
142: {
143: atapiIntReasonCD = 0x01,
144: atapiIntReasonIO = 0x02,
145: atapiIntReasonREL = 0x04,
146: atapiIntReasonTagBit = 0x08,
147: atapiIntReasonTagMask = 0xf8,
148: };
149:
150: enum ATACommand
151: {
152: ataModeCHS = 0xa0,
153: ataModeLBA = 0xe0,
154:
155: ataCommandSetFeatures = 0xef,
156:
157: ataCommandIdentify = 0xec,
158:
159: ataCommandReadSector = 0x20,
160:
161: atapiCommandReset = 0x08,
162: atapiCommandPacket = 0xa0,
163: atapiCommandIdentify = 0xa1,
164: };
165:
166: enum ATAFeatures
167: {
168: ataFeatureTransferMode = 0x03,
169: ataTransferModePIODefault = 0x00, // SectorCount settings (or'd w/Mode)
170: ataTransferModePIOwFC = 0x08,
171: ataTransferModeDMA = 0x20,
172: ataTransferModeUltraDMA33 = 0x40,
173: ataTransferModeMask = 0x07,
174: };
175:
176:
177: enum ATAStatus
178: {
179: ataStatusERR = 0x01,
180: ataStatusIDX = 0x02,
181: ataStatusECC = 0x04,
182: ataStatusDRQ = 0x08,
183: ataStatusSC = 0x10,
184: ataStatusDF = 0x20,
185: ataStatusDRDY = 0x40,
186: ataStatusBSY = 0x80,
187:
188: atapiStatusCHK = 0x01,
189: atapiStatusDRQ = 0x08,
190: atapiStatusSERV = 0x10,
191: atapiStatusDMRD = 0x20,
192: atapiStatusDRDY = 0x40,
193: atapiStatusBSY = 0x80,
194: };
195:
196: enum ATAError
197: {
198: ataErrorNM = 0x02,
199: ataErrorABRT = 0x04,
200: ataErrorMCR = 0x08,
201: ataErrorIDNF = 0x10,
202: ataErrorMC = 0x20,
203: ataErrorWP = 0x40,
204:
205: atapiErrorILI = 0x01,
206: atapiErrorEOM = 0x02,
207: atapiErrorABRT = 0x04,
208: atapiSenseKeyBit = 0x10,
209: atapiSenseKeyMask = 0xf0,
210: };
211:
212: enum ATADeviceControl
213: {
214: ataDevControlnIEN = 0x02,
215: ataDevControlSRST = 0x04,
216: };
217:
218: enum ATASignatures
219: {
220: ataSignatureSectorCount = 0x01,
221: ataSignatureSectorNumber = 0x01,
222: ataSignatureCylinderLow = 0x00,
223: ataSignatureCylinderHigh = 0x00,
224:
225: atapiSignatureCylinderLow = 0x14,
226: atapiSignatureCylinderHigh = 0xeb,
227: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.