Переглянути джерело

ATA devices are now asynchronous. The ATA layer itself now performs the

async_wait(), though we may wish to move this higher up the stack, and
consider making the block device model asynchronous.  (There is only a
marginal cost for synchronous devices, since they can simply call
async_done() before returning; async_wait() will work seamlessly in this
situation).
tags/v0.9.3
Michael Brown 18 роки тому
джерело
коміт
99ef98d0bf

+ 4
- 5
src/drivers/ata/aoedev.c Переглянути файл

@@ -30,15 +30,14 @@
30 30
  *
31 31
  * @v ata		ATA device
32 32
  * @v command		ATA command
33
- * @ret rc		Return status code
33
+ * @ret aop		Asynchronous operation
34 34
  */
35
-static int aoe_command ( struct ata_device *ata,
36
-			 struct ata_command *command ) {
35
+static struct async_operation * aoe_command ( struct ata_device *ata,
36
+					      struct ata_command *command ) {
37 37
 	struct aoe_device *aoedev
38 38
 		= container_of ( ata, struct aoe_device, ata );
39 39
 
40
-	aoe_issue ( &aoedev->aoe, command );
41
-	return async_wait ( &aoedev->aoe.aop );
40
+	return aoe_issue ( &aoedev->aoe, command );
42 41
 }
43 42
 
44 43
 /**

+ 2
- 1
src/drivers/block/ata.c Переглянути файл

@@ -20,6 +20,7 @@
20 20
 #include <string.h>
21 21
 #include <assert.h>
22 22
 #include <byteswap.h>
23
+#include <gpxe/async.h>
23 24
 #include <gpxe/blockdev.h>
24 25
 #include <gpxe/ata.h>
25 26
 
@@ -48,7 +49,7 @@ ata_command ( struct ata_device *ata, struct ata_command *command ) {
48 49
 	      ( unsigned long long ) command->cb.lba.native,
49 50
 	      command->cb.count.native );
50 51
 
51
-	return ata->command ( ata, command );	
52
+	return async_wait ( ata->command ( ata, command ) );
52 53
 }
53 54
 
54 55
 /**

+ 2
- 1
src/include/gpxe/aoe.h Переглянути файл

@@ -115,7 +115,8 @@ struct aoe_session {
115 115
 
116 116
 extern void aoe_open ( struct aoe_session *aoe );
117 117
 extern void aoe_close ( struct aoe_session *aoe );
118
-extern void aoe_issue ( struct aoe_session *aoe, struct ata_command *command );
118
+extern struct async_operation * aoe_issue ( struct aoe_session *aoe,
119
+					    struct ata_command *command );
119 120
 
120 121
 /** An AoE device */
121 122
 struct aoe_device {

+ 5
- 3
src/include/gpxe/ata.h Переглянути файл

@@ -11,6 +11,8 @@
11 11
  *
12 12
  */
13 13
 
14
+struct async_operation;
15
+
14 16
 /**
15 17
  * An ATA Logical Block Address
16 18
  *
@@ -191,10 +193,10 @@ struct ata_device {
191 193
 	 *
192 194
 	 * @v ata		ATA device
193 195
 	 * @v command		ATA command
194
-	 * @ret rc		Return status code
196
+	 * @ret aop		Asynchronous operation
195 197
 	 */
196
-	int ( * command ) ( struct ata_device *ata,
197
-			    struct ata_command *command );
198
+	struct async_operation * ( * command ) ( struct ata_device *ata,
199
+						 struct ata_command *command );
198 200
 };
199 201
 
200 202
 extern int init_atadev ( struct ata_device *ata );

+ 4
- 1
src/net/aoe.c Переглянути файл

@@ -274,14 +274,17 @@ void aoe_close ( struct aoe_session *aoe ) {
274 274
  *
275 275
  * @v aoe		AoE session
276 276
  * @v command		ATA command
277
+ * @ret aop		Asynchronous operation
277 278
  *
278 279
  * Only one command may be issued concurrently per session.  This call
279 280
  * is non-blocking; use async_wait() to wait for the command to
280 281
  * complete.
281 282
  */
282
-void aoe_issue ( struct aoe_session *aoe, struct ata_command *command ) {
283
+struct async_operation * aoe_issue ( struct aoe_session *aoe,
284
+				     struct ata_command *command ) {
283 285
 	aoe->command = command;
284 286
 	aoe->status = 0;
285 287
 	aoe->command_offset = 0;
286 288
 	aoe_send_command ( aoe );
289
+	return &aoe->aop;
287 290
 }

Завантаження…
Відмінити
Зберегти