Browse Source

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 years ago
parent
commit
99ef98d0bf
5 changed files with 17 additions and 11 deletions
  1. 4
    5
      src/drivers/ata/aoedev.c
  2. 2
    1
      src/drivers/block/ata.c
  3. 2
    1
      src/include/gpxe/aoe.h
  4. 5
    3
      src/include/gpxe/ata.h
  5. 4
    1
      src/net/aoe.c

+ 4
- 5
src/drivers/ata/aoedev.c View File

30
  *
30
  *
31
  * @v ata		ATA device
31
  * @v ata		ATA device
32
  * @v command		ATA command
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
 	struct aoe_device *aoedev
37
 	struct aoe_device *aoedev
38
 		= container_of ( ata, struct aoe_device, ata );
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 View File

20
 #include <string.h>
20
 #include <string.h>
21
 #include <assert.h>
21
 #include <assert.h>
22
 #include <byteswap.h>
22
 #include <byteswap.h>
23
+#include <gpxe/async.h>
23
 #include <gpxe/blockdev.h>
24
 #include <gpxe/blockdev.h>
24
 #include <gpxe/ata.h>
25
 #include <gpxe/ata.h>
25
 
26
 
48
 	      ( unsigned long long ) command->cb.lba.native,
49
 	      ( unsigned long long ) command->cb.lba.native,
49
 	      command->cb.count.native );
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 View File

115
 
115
 
116
 extern void aoe_open ( struct aoe_session *aoe );
116
 extern void aoe_open ( struct aoe_session *aoe );
117
 extern void aoe_close ( struct aoe_session *aoe );
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
 /** An AoE device */
121
 /** An AoE device */
121
 struct aoe_device {
122
 struct aoe_device {

+ 5
- 3
src/include/gpxe/ata.h View File

11
  *
11
  *
12
  */
12
  */
13
 
13
 
14
+struct async_operation;
15
+
14
 /**
16
 /**
15
  * An ATA Logical Block Address
17
  * An ATA Logical Block Address
16
  *
18
  *
191
 	 *
193
 	 *
192
 	 * @v ata		ATA device
194
 	 * @v ata		ATA device
193
 	 * @v command		ATA command
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
 extern int init_atadev ( struct ata_device *ata );
202
 extern int init_atadev ( struct ata_device *ata );

+ 4
- 1
src/net/aoe.c View File

274
  *
274
  *
275
  * @v aoe		AoE session
275
  * @v aoe		AoE session
276
  * @v command		ATA command
276
  * @v command		ATA command
277
+ * @ret aop		Asynchronous operation
277
  *
278
  *
278
  * Only one command may be issued concurrently per session.  This call
279
  * Only one command may be issued concurrently per session.  This call
279
  * is non-blocking; use async_wait() to wait for the command to
280
  * is non-blocking; use async_wait() to wait for the command to
280
  * complete.
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
 	aoe->command = command;
285
 	aoe->command = command;
284
 	aoe->status = 0;
286
 	aoe->status = 0;
285
 	aoe->command_offset = 0;
287
 	aoe->command_offset = 0;
286
 	aoe_send_command ( aoe );
288
 	aoe_send_command ( aoe );
289
+	return &aoe->aop;
287
 }
290
 }

Loading…
Cancel
Save