diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2007-02-28 13:38:05 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2007-02-28 13:38:05 +0000 |
commit | 5bcf755413bb28c6ebd9ba449594bf61d4f80022 (patch) | |
tree | 6d1938c5f6ee3db8abdf2dc02637e26caf02bc6d /sys/dev | |
parent | 487091106c2df889915a8d9d4cdaac39ae0310b5 (diff) |
when allocating an xfer, preinit several values according to the port its
destined for. add ata_exec, which will push the xfer on the right path.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/atascsi.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c index bc104a7b2d6..b223a5e476e 100644 --- a/sys/dev/ata/atascsi.c +++ b/sys/dev/ata/atascsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.c,v 1.8 2007/02/28 13:23:23 dlg Exp $ */ +/* $OpenBSD: atascsi.c,v 1.9 2007/02/28 13:38:04 dlg Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -78,7 +78,9 @@ struct pool ata_xfer_pool; void ata_init(void); void ata_destroy(void); -struct ata_xfer *ata_get_xfer(int); +int ata_exec(struct atascsi *, struct ata_xfer *); + +struct ata_xfer *ata_get_xfer(struct ata_port *, int); void ata_put_xfer(struct ata_xfer *); struct atascsi * @@ -283,13 +285,25 @@ ata_destroy(void) pool_destroy(&ata_xfer_pool); } + +int +ata_exec(struct atascsi *as, struct ata_xfer *xa) +{ + xa->state = ATA_S_PENDING; + return (as->as_methods->ata_cmd(as->as_cookie, xa)); +} struct ata_xfer * -ata_get_xfer(int nosleep) +ata_get_xfer(struct ata_port *ap, int nosleep) { struct ata_xfer *xa; xa = pool_get(&ata_xfer_pool, nosleep ? PR_NOWAIT : PR_WAITOK); + if (xa != NULL) { + bzero(&xa->cmd, sizeof(xa->cmd)); + xa->port = ap; + xa->state = ATA_S_SETUP; + } return (xa); } @@ -299,5 +313,3 @@ ata_put_xfer(struct ata_xfer *xa) { pool_put(&ata_xfer_pool, xa); } - - |