VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware2/VBoxPkg/VBoxIdeBusDxe/IdeData.h@ 33110

Last change on this file since 33110 was 33027, checked in by vboxsync, 14 years ago

EFI: legal notes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
1/* $Id: IdeData.h 33027 2010-10-11 06:17:12Z vboxsync $ */
2/** @file
3 * IdeData.h
4 */
5
6/*
7 * Copyright (C) 2009-2010 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18/** @file
19 Header file for IDE Bus Driver's Data Structures
20
21 Copyright (c) 2006 - 2007 Intel Corporation. <BR>
22 All rights reserved. This program and the accompanying materials
23 are licensed and made available under the terms and conditions of the BSD License
24 which accompanies this distribution. The full text of the license may be found at
25 http://opensource.org/licenses/bsd-license.php
26
27 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
28 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
29
30**/
31
32#ifndef _IDE_DATA_H_
33#define _IDE_DATA_H_
34
35#include <IndustryStandard/Atapi.h>
36
37//
38// common constants
39//
40#define STALL_1_MILLI_SECOND 1000 // stall 1 ms
41#define STALL_1_SECOND 1000000 // stall 1 second
42typedef enum {
43 IdePrimary = 0,
44 IdeSecondary = 1,
45 IdeMaxChannel = 2
46} EFI_IDE_CHANNEL;
47
48typedef enum {
49 IdeMaster = 0,
50 IdeSlave = 1,
51 IdeMaxDevice = 2
52} EFI_IDE_DEVICE;
53
54typedef enum {
55 IdeMagnetic, /* ZIP Drive or LS120 Floppy Drive */
56 IdeCdRom, /* ATAPI CDROM */
57 IdeHardDisk, /* Hard Disk */
58 Ide48bitAddressingHardDisk, /* Hard Disk larger than 120GB */
59 IdeUnknown
60} IDE_DEVICE_TYPE;
61
62typedef enum {
63 SenseNoSenseKey,
64 SenseDeviceNotReadyNoRetry,
65 SenseDeviceNotReadyNeedRetry,
66 SenseNoMedia,
67 SenseMediaChange,
68 SenseMediaError,
69 SenseOtherSense
70} SENSE_RESULT;
71
72typedef enum {
73 AtaUdmaReadOp,
74 AtaUdmaReadExtOp,
75 AtaUdmaWriteOp,
76 AtaUdmaWriteExtOp
77} ATA_UDMA_OPERATION;
78
79//
80// IDE Registers
81//
82typedef union {
83 UINT16 Command; /* when write */
84 UINT16 Status; /* when read */
85} IDE_CMD_OR_STATUS;
86
87typedef union {
88 UINT16 Error; /* when read */
89 UINT16 Feature; /* when write */
90} IDE_ERROR_OR_FEATURE;
91
92typedef union {
93 UINT16 AltStatus; /* when read */
94 UINT16 DeviceControl; /* when write */
95} IDE_ALTSTATUS_OR_DEVICECONTROL;
96
97//
98// IDE registers set
99//
100typedef struct {
101 UINT16 Data;
102 IDE_ERROR_OR_FEATURE Reg1;
103 UINT16 SectorCount;
104 UINT16 SectorNumber;
105 UINT16 CylinderLsb;
106 UINT16 CylinderMsb;
107 UINT16 Head;
108 IDE_CMD_OR_STATUS Reg;
109
110 IDE_ALTSTATUS_OR_DEVICECONTROL Alt;
111 UINT16 DriveAddress;
112
113 UINT16 MasterSlave;
114 UINT16 BusMasterBaseAddr;
115} IDE_BASE_REGISTERS;
116
117//
118// IDE registers' base addresses
119//
120typedef struct {
121 UINT16 CommandBlockBaseAddr;
122 UINT16 ControlBlockBaseAddr;
123 UINT16 BusMasterBaseAddr;
124} IDE_REGISTERS_BASE_ADDR;
125
126//
127// Bit definitions in Programming Interface byte of the Class Code field
128// in PCI IDE controller's Configuration Space
129//
130#define IDE_PRIMARY_OPERATING_MODE BIT0
131#define IDE_PRIMARY_PROGRAMMABLE_INDICATOR BIT1
132#define IDE_SECONDARY_OPERATING_MODE BIT2
133#define IDE_SECONDARY_PROGRAMMABLE_INDICATOR BIT3
134
135
136//
137// Bus Master Reg
138//
139#define BMIC_NREAD BIT3
140#define BMIC_START BIT0
141#define BMIS_INTERRUPT BIT2
142#define BMIS_ERROR BIT1
143
144#define BMICP_OFFSET 0x00
145#define BMISP_OFFSET 0x02
146#define BMIDP_OFFSET 0x04
147#define BMICS_OFFSET 0x08
148#define BMISS_OFFSET 0x0A
149#define BMIDS_OFFSET 0x0C
150
151//
152// Time Out Value For IDE Device Polling
153//
154
155//
156// ATATIMEOUT is used for waiting time out for ATA device
157//
158
159//
160// 1 second
161//
162#define ATATIMEOUT 1000
163
164//
165// ATAPITIMEOUT is used for waiting operation
166// except read and write time out for ATAPI device
167//
168
169//
170// 1 second
171//
172#define ATAPITIMEOUT 1000
173
174//
175// ATAPILONGTIMEOUT is used for waiting read and
176// write operation timeout for ATAPI device
177//
178
179//
180// 2 seconds
181//
182#define CDROMLONGTIMEOUT 2000
183
184//
185// 5 seconds
186//
187#define ATAPILONGTIMEOUT 5000
188
189//
190// 10 seconds
191//
192#define ATASMARTTIMEOUT 10000
193
194
195//
196// ATAPI6 related data structure definition
197//
198
199//
200// The maximum sectors count in 28 bit addressing mode
201//
202#define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff
203
204#pragma pack(1)
205
206typedef struct {
207 UINT32 RegionBaseAddr;
208 UINT16 ByteCount;
209 UINT16 EndOfTable;
210} IDE_DMA_PRD;
211
212#pragma pack()
213
214#define SETFEATURE TRUE
215#define CLEARFEATURE FALSE
216
217///
218/// PIO mode definition
219///
220typedef enum _ATA_PIO_MODE_ {
221 AtaPioModeBelow2,
222 AtaPioMode2,
223 AtaPioMode3,
224 AtaPioMode4
225} ATA_PIO_MODE;
226
227//
228// Multi word DMA definition
229//
230typedef enum _ATA_MDMA_MODE_ {
231 AtaMdmaMode0,
232 AtaMdmaMode1,
233 AtaMdmaMode2
234} ATA_MDMA_MODE;
235
236//
237// UDMA mode definition
238//
239typedef enum _ATA_UDMA_MODE_ {
240 AtaUdmaMode0,
241 AtaUdmaMode1,
242 AtaUdmaMode2,
243 AtaUdmaMode3,
244 AtaUdmaMode4,
245 AtaUdmaMode5
246} ATA_UDMA_MODE;
247
248#define ATA_MODE_CATEGORY_DEFAULT_PIO 0x00
249#define ATA_MODE_CATEGORY_FLOW_PIO 0x01
250#define ATA_MODE_CATEGORY_MDMA 0x04
251#define ATA_MODE_CATEGORY_UDMA 0x08
252
253#pragma pack(1)
254
255typedef struct {
256 UINT8 ModeNumber : 3;
257 UINT8 ModeCategory : 5;
258} ATA_TRANSFER_MODE;
259
260typedef struct {
261 UINT8 Sector;
262 UINT8 Heads;
263 UINT8 MultipleSector;
264} ATA_DRIVE_PARMS;
265
266#pragma pack()
267//
268// IORDY Sample Point field value
269//
270#define ISP_5_CLK 0
271#define ISP_4_CLK 1
272#define ISP_3_CLK 2
273#define ISP_2_CLK 3
274
275//
276// Recovery Time field value
277//
278#define RECVY_4_CLK 0
279#define RECVY_3_CLK 1
280#define RECVY_2_CLK 2
281#define RECVY_1_CLK 3
282
283//
284// Slave IDE Timing Register Enable
285//
286#define SITRE BIT14
287
288//
289// DMA Timing Enable Only Select 1
290//
291#define DTE1 BIT7
292
293//
294// Pre-fetch and Posting Enable Select 1
295//
296#define PPE1 BIT6
297
298//
299// IORDY Sample Point Enable Select 1
300//
301#define IE1 BIT5
302
303//
304// Fast Timing Bank Drive Select 1
305//
306#define TIME1 BIT4
307
308//
309// DMA Timing Enable Only Select 0
310//
311#define DTE0 BIT3
312
313//
314// Pre-fetch and Posting Enable Select 0
315//
316#define PPE0 BIT2
317
318//
319// IOREY Sample Point Enable Select 0
320//
321#define IE0 BIT1
322
323//
324// Fast Timing Bank Drive Select 0
325//
326#define TIME0 BIT0
327
328#endif
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette