1 |
876 |
rherveille |
/*
|
2 |
|
|
atadevice_cmdi.h -- ATA Device command interpreter
|
3 |
|
|
Copyright (C) 2002 Richard Herveille, rherveille@opencores.org
|
4 |
|
|
|
5 |
|
|
This file is part of OpenRISC 1000 Architectural Simulator
|
6 |
|
|
|
7 |
|
|
This program is free software; you can redistribute it and/or modify
|
8 |
|
|
it under the terms of the GNU General Public License as published by
|
9 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
10 |
|
|
(at your option) any later version
|
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with this program; if not, write to the Free Software
|
19 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
20 |
|
|
*/
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
/**********************************************************************/
|
24 |
|
|
/* define FIRMWARE revision; current revision of OR1Ksim ATA code. */
|
25 |
|
|
/* coded using the release date (yyyymmdd, but shuffled) */
|
26 |
919 |
rherveille |
#define FIRMWARE "02207031"
|
27 |
876 |
rherveille |
|
28 |
|
|
|
29 |
|
|
/**********************************************************************/
|
30 |
|
|
/* Define default CHS translation parameters */
|
31 |
|
|
/* bytes per sector */
|
32 |
|
|
#define BYTES_PER_SECTOR 512
|
33 |
|
|
|
34 |
|
|
/* number of default heads ( -1) */
|
35 |
|
|
#define HEADS 7
|
36 |
|
|
|
37 |
|
|
/* number of default sectors per track */
|
38 |
|
|
#define SECTORS 32
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
/**********************************************************************/
|
42 |
|
|
/* Define supported DMA and PIO modes */
|
43 |
|
|
/* define the highest Multiword DMA mode; 2, 1, 0, -1(no DMA) */
|
44 |
|
|
#define MWDMA 2
|
45 |
|
|
|
46 |
|
|
/* define the highest supported PIO mode; 4, 3, 2, 1, 0(obsolete) */
|
47 |
|
|
#define PIO 4
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
/**********************************************************************/
|
51 |
|
|
/* Define DMA and PIO cycle times */
|
52 |
|
|
/* define the minimum Multiword DMA cycle time per word (in nsec) */
|
53 |
|
|
#define MIN_MWDMA_CYCLE_TIME 100
|
54 |
|
|
|
55 |
|
|
/* define the manufacturer's recommended Multiword DMA cycle time */
|
56 |
|
|
#define RECOMMENDED_MWDMA_CYCLE_TIME 100
|
57 |
|
|
|
58 |
|
|
/* define the minimum PIO cycle time per word (in nsec), no IORDY */
|
59 |
|
|
#define MIN_PIO_CYCLE_TIME_NO_IORDY 100
|
60 |
|
|
|
61 |
|
|
/* define the minimum PIO cycle time per word (in nsec), with IORDY */
|
62 |
|
|
#define MIN_PIO_CYCLE_TIME_IORDY 100
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
/**********************************************************************/
|
66 |
|
|
/* Define supported command sets */
|
67 |
|
|
/* 1=command is supported */
|
68 |
|
|
/* 0=command is not (yet) supported */
|
69 |
|
|
#define SUPPORT_NOP_CMD 0
|
70 |
|
|
#define SUPPORT_READ_BUFFER_CMD 0
|
71 |
|
|
#define SUPPORT_WRITE_BUFFER_CMD 0
|
72 |
|
|
#define SUPPORT_HOST_PROTECTED_AREA 0
|
73 |
|
|
#define SUPPORT_DEVICE_RESET_CMD 1
|
74 |
|
|
#define SUPPORT_SERVICE_INTERRUPT 0
|
75 |
|
|
#define SUPPORT_RELEASE_INTERRUPT 0
|
76 |
|
|
#define SUPPORT_LOOKAHEAD 0
|
77 |
|
|
#define SUPPORT_WRITE_CACHE 0
|
78 |
|
|
#define SUPPORT_POWER_MANAGEMENT 0
|
79 |
|
|
#define SUPPORT_REMOVABLE_MEDIA 0
|
80 |
|
|
#define SUPPORT_SECURITY_MODE 0
|
81 |
|
|
#define SUPPORT_SMART 0
|
82 |
|
|
#define SUPPORT_SET_MAX 0
|
83 |
|
|
#define SET_FEATURES_REQUIRED_AFTER_POWER_UP 0
|
84 |
|
|
#define SUPPORT_POWER_UP_IN_STANDBY_MODE 0
|
85 |
|
|
#define SUPPORT_REMOVABLE_MEDIA_NOTIFICATION 0
|
86 |
|
|
#define SUPPORT_APM 0
|
87 |
|
|
#define SUPPORT_CFA 0
|
88 |
|
|
#define SUPPORT_READ_WRITE_DMA_QUEUED 0
|
89 |
|
|
#define SUPPORT_DOWNLOAD_MICROCODE 0
|
90 |
|
|
|
91 |
|
|
/*
|
92 |
|
|
Queue depth defines the maximum queue depth supported by the device.
|
93 |
|
|
This includes all commands for which the command acceptance has occured
|
94 |
|
|
and command completion has not occured. This value is used for the DMA
|
95 |
|
|
READ/WRITE QUEUE command.
|
96 |
|
|
|
97 |
|
|
QUEUE_DEPTH = actual_queue_depth -1
|
98 |
|
|
*/
|
99 |
|
|
#define QUEUE_DEPTH 0
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
/**********************************************************************/
|
104 |
|
|
/* Internal defines */
|
105 |
|
|
#define PACKET_SIGNATURE 1
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
/*
|
109 |
|
|
----------------
|
110 |
|
|
-- Prototypes --
|
111 |
|
|
----------------
|
112 |
|
|
*/
|
113 |
|
|
int ata_device_execute_cmd(ata_device *device);
|
114 |
|
|
|
115 |
|
|
void ata_device_reset_cmd(ata_device *device);
|
116 |
|
|
void ata_execute_device_diagnostics_cmd(ata_device *device);
|
117 |
|
|
void ata_identify_device_cmd(ata_device *device);
|
118 |
|
|
void ata_initialize_device_parameters_cmd(ata_device *device);
|
119 |
|
|
void ata_read_sectors_cmd(ata_device *device);
|