VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/VBoxPkg/VBoxIdeBusDxe/IdeData.h@ 48947

Last change on this file since 48947 was 48947, checked in by vboxsync, 11 years ago

Devices: Whitespace and svn:keyword cleanups by scm.

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

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