mirror of https://github.com/ipxe/ipxe.git
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).pull/1/head
parent
cf96d325d8
commit
99ef98d0bf
|
@ -30,15 +30,14 @@
|
||||||
*
|
*
|
||||||
* @v ata ATA device
|
* @v ata ATA device
|
||||||
* @v command ATA command
|
* @v command ATA command
|
||||||
* @ret rc Return status code
|
* @ret aop Asynchronous operation
|
||||||
*/
|
*/
|
||||||
static int aoe_command ( struct ata_device *ata,
|
static struct async_operation * aoe_command ( struct ata_device *ata,
|
||||||
struct ata_command *command ) {
|
struct ata_command *command ) {
|
||||||
struct aoe_device *aoedev
|
struct aoe_device *aoedev
|
||||||
= container_of ( ata, struct aoe_device, ata );
|
= container_of ( ata, struct aoe_device, ata );
|
||||||
|
|
||||||
aoe_issue ( &aoedev->aoe, command );
|
return aoe_issue ( &aoedev->aoe, command );
|
||||||
return async_wait ( &aoedev->aoe.aop );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <byteswap.h>
|
#include <byteswap.h>
|
||||||
|
#include <gpxe/async.h>
|
||||||
#include <gpxe/blockdev.h>
|
#include <gpxe/blockdev.h>
|
||||||
#include <gpxe/ata.h>
|
#include <gpxe/ata.h>
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ ata_command ( struct ata_device *ata, struct ata_command *command ) {
|
||||||
( unsigned long long ) command->cb.lba.native,
|
( unsigned long long ) command->cb.lba.native,
|
||||||
command->cb.count.native );
|
command->cb.count.native );
|
||||||
|
|
||||||
return ata->command ( ata, command );
|
return async_wait ( ata->command ( ata, command ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -115,7 +115,8 @@ struct aoe_session {
|
||||||
|
|
||||||
extern void aoe_open ( struct aoe_session *aoe );
|
extern void aoe_open ( struct aoe_session *aoe );
|
||||||
extern void aoe_close ( struct aoe_session *aoe );
|
extern void aoe_close ( struct aoe_session *aoe );
|
||||||
extern void aoe_issue ( struct aoe_session *aoe, struct ata_command *command );
|
extern struct async_operation * aoe_issue ( struct aoe_session *aoe,
|
||||||
|
struct ata_command *command );
|
||||||
|
|
||||||
/** An AoE device */
|
/** An AoE device */
|
||||||
struct aoe_device {
|
struct aoe_device {
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
struct async_operation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An ATA Logical Block Address
|
* An ATA Logical Block Address
|
||||||
*
|
*
|
||||||
|
@ -191,9 +193,9 @@ struct ata_device {
|
||||||
*
|
*
|
||||||
* @v ata ATA device
|
* @v ata ATA device
|
||||||
* @v command ATA command
|
* @v command ATA command
|
||||||
* @ret rc Return status code
|
* @ret aop Asynchronous operation
|
||||||
*/
|
*/
|
||||||
int ( * command ) ( struct ata_device *ata,
|
struct async_operation * ( * command ) ( struct ata_device *ata,
|
||||||
struct ata_command *command );
|
struct ata_command *command );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -274,14 +274,17 @@ void aoe_close ( struct aoe_session *aoe ) {
|
||||||
*
|
*
|
||||||
* @v aoe AoE session
|
* @v aoe AoE session
|
||||||
* @v command ATA command
|
* @v command ATA command
|
||||||
|
* @ret aop Asynchronous operation
|
||||||
*
|
*
|
||||||
* Only one command may be issued concurrently per session. This call
|
* Only one command may be issued concurrently per session. This call
|
||||||
* is non-blocking; use async_wait() to wait for the command to
|
* is non-blocking; use async_wait() to wait for the command to
|
||||||
* complete.
|
* complete.
|
||||||
*/
|
*/
|
||||||
void aoe_issue ( struct aoe_session *aoe, struct ata_command *command ) {
|
struct async_operation * aoe_issue ( struct aoe_session *aoe,
|
||||||
|
struct ata_command *command ) {
|
||||||
aoe->command = command;
|
aoe->command = command;
|
||||||
aoe->status = 0;
|
aoe->status = 0;
|
||||||
aoe->command_offset = 0;
|
aoe->command_offset = 0;
|
||||||
aoe_send_command ( aoe );
|
aoe_send_command ( aoe );
|
||||||
|
return &aoe->aop;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue