1 | ====================================================================
|
---|
2 | eComStation AHCI Driver
|
---|
3 | ====================================================================
|
---|
4 |
|
---|
5 |
|
---|
6 | Introduction
|
---|
7 | ============
|
---|
8 |
|
---|
9 | OS2AHCI is an AHCI driver for eComStation. It supports both ATA and
|
---|
10 | ATAPI devices in a single driver, thus there's no need for an
|
---|
11 | ATAPI/CDROM filter driver.
|
---|
12 |
|
---|
13 |
|
---|
14 | Copyrights
|
---|
15 | ==========
|
---|
16 |
|
---|
17 | Copyright (c) 2011 thi.guten Software Development
|
---|
18 | Copyright (c) 2011 Mensys B.V.
|
---|
19 |
|
---|
20 | Authors: Christian Mueller, Markus Thielen
|
---|
21 |
|
---|
22 | Parts copied from/inspired by the Linux AHCI driver;
|
---|
23 | those parts are (c) Linux AHCI/ATA maintainers
|
---|
24 |
|
---|
25 | This program is free software; you can redistribute it and/or modify
|
---|
26 | it under the terms of the GNU General Public License as published by
|
---|
27 | the Free Software Foundation; either version 2 of the License, or
|
---|
28 | (at your option) any later version.
|
---|
29 |
|
---|
30 | This program is distributed in the hope that it will be useful,
|
---|
31 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
32 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
33 | GNU General Public License for more details.
|
---|
34 |
|
---|
35 | You should have received a copy of the GNU General Public License
|
---|
36 | along with this program; if not, write to the Free Software
|
---|
37 | Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
---|
38 | MA 02111-1307 USA
|
---|
39 |
|
---|
40 |
|
---|
41 | Licensing and Source Code
|
---|
42 | =========================
|
---|
43 |
|
---|
44 | The *binary* delivery of OS2AHCI.ADD as obtained from ecomstation.nl,
|
---|
45 | or as part of packaged eComStation releases, is licensed to run with
|
---|
46 | eComStation, only.
|
---|
47 |
|
---|
48 | The source code can be retrieved from http://svn.ecomstation.nl;
|
---|
49 | in compliance to the GNU General Public License, the source code
|
---|
50 | can of course be modified/compiled to run on other products as long
|
---|
51 | as modifications will also be published as outlined in the GNU GPL2.
|
---|
52 |
|
---|
53 | The toolchain required for compilation consists of:
|
---|
54 |
|
---|
55 | - Microsoft C600
|
---|
56 | - Microsoft Assembler (MASM)
|
---|
57 | - IBM OS/2 DDK for Warp 3 or later
|
---|
58 |
|
---|
59 |
|
---|
60 | Installation
|
---|
61 | ============
|
---|
62 |
|
---|
63 | - Copy the driver file, OS2AHCI.ADD, to C:\OS2\BOOT
|
---|
64 |
|
---|
65 | - Add the following line to CONFIG.SYS:
|
---|
66 | BASEDEV=OS2AHCI.ADD
|
---|
67 |
|
---|
68 |
|
---|
69 | Driver Command Line Options
|
---|
70 | ===========================
|
---|
71 |
|
---|
72 | Global Options
|
---|
73 |
|
---|
74 | Option Description
|
---|
75 | ------------------------------------------------------------------------------
|
---|
76 | /c:<addr> Set debug COM port base address in hex (default = 3f8);
|
---|
77 | if used, this option should come before any /d options.
|
---|
78 | /d Debug output on COM port; multiple "/d" options will
|
---|
79 | increase verbosity:
|
---|
80 | 1 = requests
|
---|
81 | 2 = detailed
|
---|
82 | 3 = verbose, including MMIO operations
|
---|
83 | /g:<vendor>:<device> Add generic PCI ID to list of supported AHCI adapters
|
---|
84 | (e.g. /g:8086:2829)
|
---|
85 | /t Perform thorough PCI ID scan; default = on, can be
|
---|
86 | turned off with /!t to perform only a PCI class scan
|
---|
87 | /r Reset ports during initialization (default = off
|
---|
88 | unless the [Intel] AHCI was found to be initialized
|
---|
89 | by the BIOS to SATA mode)
|
---|
90 | /a Set adapter for adapter-specific options
|
---|
91 | (default = -1, all adapters)
|
---|
92 | /p Set port for port-specific options
|
---|
93 | (default = -1, all ports)
|
---|
94 |
|
---|
95 | Adapter-specific Options
|
---|
96 |
|
---|
97 | Option Description
|
---|
98 | ------------------------------------------------------------------------------
|
---|
99 | /i Ignore current adapter
|
---|
100 |
|
---|
101 | Port-specific Options
|
---|
102 |
|
---|
103 | Option Description
|
---|
104 | ------------------------------------------------------------------------------
|
---|
105 | /s Enable SCSI emulation for ATAPI units (default = off)
|
---|
106 | SCSI emulation is required for tools like cdrecord.
|
---|
107 | /n Enable NCQ (Native Command Queuing) for hard disks
|
---|
108 | (default = off)
|
---|
109 | /ls Set link speed (default = 0):
|
---|
110 | 0 = maximum,
|
---|
111 | 1 = limit to generation 1
|
---|
112 | 2 = limit to generation 2
|
---|
113 | 3 = limit to generation 3
|
---|
114 | /lp Set link power management (default = 0):
|
---|
115 | 0 = full power management,
|
---|
116 | 1 = transitions to "partial slumber state" disabled,
|
---|
117 | 2 = transitions to "slumber state" disabled,
|
---|
118 | 3 = transitions to both partial and slumber states
|
---|
119 | disabled
|
---|
120 | /4 Force track size to be 56 sectors regardless of the
|
---|
121 | reported disk geometry to optimize partition boundaries
|
---|
122 | for hard disks with 4096 byte sectors.
|
---|
123 |
|
---|
124 | Port-specific options depend on the currently active adapter
|
---|
125 | and port selector (/a and /p). Those selectors are -1 per default
|
---|
126 | which means "all" adapters/ports. The scope can be reduced by limiting
|
---|
127 | it to an adapter (/a) or an adapter and a port (/a and /p). The scope
|
---|
128 | can be reset by setting the corresponding option back to -1.
|
---|
129 |
|
---|
130 | For example:
|
---|
131 |
|
---|
132 | BASEDEV=OS2AHCI.ADD /n /a:0 /p:5 /!n /a:1 /p:-1 /!n
|
---|
133 |
|
---|
134 | This has the following effect:
|
---|
135 |
|
---|
136 | - Enable NCQ for all hard disks
|
---|
137 | - Disable NCQ for hard disk on adapter #0, port #5
|
---|
138 | - Disable NCQ for all hard disks on adapter #1
|
---|
139 |
|
---|
140 |
|
---|
141 | Native Command Queuing
|
---|
142 | ======================
|
---|
143 |
|
---|
144 | Native Command Queuing (NCQ) is a feature which allows sending multiple I/O
|
---|
145 | requests to hard disks before waiting for any of the requests to complete,
|
---|
146 | much like Tagged Command Queuing for SCSI devices. This allows the disks
|
---|
147 | to reorder I/O requests to minimize head movements, resulting in improved
|
---|
148 | performance when executing random I/Os. In practice, this will be most
|
---|
149 | noticable when multiple programs request I/O services to different parts
|
---|
150 | of the disk -- a single program typically won't queue up I/O's but instead
|
---|
151 | will wait for each I/O to complete (with the exception of programs like
|
---|
152 | database servers).
|
---|
153 |
|
---|
154 | While we believe NCQ will work with the majority of controllers and hard
|
---|
155 | disks, it's currently turned off by default until we have more feedback
|
---|
156 | from eComStation users. In order to turn on NCQ, just add the command line
|
---|
157 | option "/n" to OS2AHCI.ADD.
|
---|
158 |
|
---|
159 |
|
---|
160 | Interoperability With IDE Drivers
|
---|
161 | =================================
|
---|
162 |
|
---|
163 | There are three kinds of IDE/ATA/SATA controllers:
|
---|
164 |
|
---|
165 | 1. Legacy controller (IDE or SATA) without AHCI support
|
---|
166 | This kind of controller will only be recognized by IDE drivers
|
---|
167 | (IBM1S506.ADD or DANIS506.ADD).
|
---|
168 |
|
---|
169 | 2. AHCI-capable controller which supports IDE/SATA legacy interfaces
|
---|
170 | This kind of controller will work with IDE or AHCI drivers and it's
|
---|
171 | up to the user to decide which driver to use.
|
---|
172 |
|
---|
173 | 3. AHCI-only controller
|
---|
174 | This kind of controller will only be recognized by OS2AHCI.
|
---|
175 |
|
---|
176 | If there's a mix of controllers of types 1 and 3, both an IDE and an AHCI
|
---|
177 | driver will be required.
|
---|
178 |
|
---|
179 | If type 2 controllers are involved, it's up to the user to decide which
|
---|
180 | driver to use. Both DANIS506.ADD and OS2AHCI.ADD will verify whether another
|
---|
181 | driver has already allocated the corresponding adapter, thus the only
|
---|
182 | decision to take for mixed configurations is whether type-2 controllers
|
---|
183 | should be handled by DANIS506.ADD or OS2AHCI.ADD and this can be done by
|
---|
184 | having the desired driver's BASEDEV statement coming first in CONFIG.SYS.
|
---|
185 |
|
---|
186 | NOTE: Older versions of DANIS506.ADD did not verify whether the resources
|
---|
187 | of a particular adapter were already allocated by another driver.
|
---|
188 | DANIS506.ADD 1.8.8 or later is required for this to work.
|
---|
189 |
|
---|
190 | When using earlier versions of DANI1S506.ADD, the options "/A:x /I"
|
---|
191 | will be required to tell DANI1S506.ADD to ignore adapters to be
|
---|
192 | driven by OS2AHCI.ADD. The same applies to IBM1S506.ADD
|
---|
193 |
|
---|
194 | Mixed Controller Example
|
---|
195 | ------------------------
|
---|
196 |
|
---|
197 | Assume a DELL D630 or a Thinkpad T60. The hard disk is attached to the
|
---|
198 | SATA/AHCI controller of the ICH-7 hub while the CDROM is attached to the
|
---|
199 | legacy PATA IDE controller. This allows two different configurations:
|
---|
200 |
|
---|
201 | 1. Drive HDD and CDROM via DANIS506.ADD
|
---|
202 | 2. Drive HDD via OS2AHCI.ADD and CDROM via DANI1S506.ADD
|
---|
203 |
|
---|
204 | OS2AHCI.ADD can't drive the CDROM because it's attached to a legacy PATA
|
---|
205 | IDE controller which doesn't support AHCI.
|
---|
206 |
|
---|
207 | - If OS2AHCI.ADD comes first in CONFIG.SYS, it will take over the SATA/AHCI
|
---|
208 | controller and drive the HDD. DANIS506.ADD will take care of the PATA/IDE
|
---|
209 | controller for the CDROM.
|
---|
210 | - If DANIS506.ADD comes first in CONFIG.SYS, it will take over both the
|
---|
211 | SATA/AHCI controller and OS2AHCI.ADD will silently exit.
|
---|
212 |
|
---|
213 | Advantages of AHCI
|
---|
214 | ------------------
|
---|
215 |
|
---|
216 | The interfaces provided by the various [Intel] controllers could be
|
---|
217 | summarized like this (the term ATA as driver interface being a bit of our
|
---|
218 | own invention):
|
---|
219 |
|
---|
220 | - Intel PIIX: IDE (I/O registers) and ATA (taskfile)
|
---|
221 | - Intel ICH6: IDE (I/O registers), ATA (taskfile) and SATA
|
---|
222 | (FIS, vendor-specific)
|
---|
223 | - Intel ICH7: IDE (I/O registers), ATA (taskfile), SATA
|
---|
224 | (FIS, vendor-specific) and AHCI (FIS)
|
---|
225 | - Intel PCH: AHCI (FIS)
|
---|
226 |
|
---|
227 | Taskfiles are regions in memory with ATA commands which the IDE/ATA
|
---|
228 | controller can read and process autonomously. FIS (Frame Information
|
---|
229 | Structures) are pretty much the same but they are specific to the SATA
|
---|
230 | communication protocol on the serial link. The most important FIS type
|
---|
231 | for AHCI drivers is the H2D (host to device) FIS which basically contains
|
---|
232 | the ATA command to be executed.
|
---|
233 |
|
---|
234 | The big advantage of AHCI controllers, apart from being vendor-neutral,
|
---|
235 | is that they take care of a lot of things which previous-generation
|
---|
236 | drivers like DANI1S506 would have to do step by step. For example, in
|
---|
237 | order to send an ATAPI command, DANIS506 would have to do the following:
|
---|
238 |
|
---|
239 | * Send ATA "PACKET" command to device (via IDE registers, ATA taskfiles
|
---|
240 | or SATA FIS)
|
---|
241 | * Wait until device signals via interrupt it's ready for the ATAPI command
|
---|
242 | * Send ATAPI command to device via PIO
|
---|
243 | * Wait until device signals via interrupt it's ready to transfer data
|
---|
244 | * Send/Receive any data that might come along with the ATAPI command via
|
---|
245 | PIO, or wait for DMA transfer to complete
|
---|
246 | * Wait until device signals via interrupt that command and data transfer
|
---|
247 | have completed
|
---|
248 |
|
---|
249 | For OS2AHCI, the same operation looks like this:
|
---|
250 |
|
---|
251 | * Fill in AHCI command header, FIS with ATA "PACKET" command and the ATAPI
|
---|
252 | command
|
---|
253 | * Tell port engine to process the command
|
---|
254 | * Wait until controller signals via interrupt that command and data
|
---|
255 | transfer have completed
|
---|
256 |
|
---|
257 | The AHCI controller automatically takes care of all underlying bits and
|
---|
258 | pieces. OS2AHCI doesn't even have to know whether a particular message is
|
---|
259 | sent via PIO or DMA because this is handled by the AHCI controller, too.
|
---|
260 | And the whole concept of PIO and DMA is only relevant between AHCI controller
|
---|
261 | and the device -- all transfers between OS2AHCI and the AHCI controller are
|
---|
262 | always done via DMA.
|
---|
263 |
|
---|