diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2010-09-20 06:02:51 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2010-09-20 06:02:51 +0000 |
commit | 9844e20bc88783a482ceaeed5eeebd0daf66d9fc (patch) | |
tree | 99f6120ff1cf1e895842e397a9a48a8390d86f5a /sys/dev | |
parent | 2c4148e47d2ea0662f176401457ef131d916cf50 (diff) |
define and use macros for looking at ncq bits.
requested by and ok krw@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/atascsi.c | 6 | ||||
-rw-r--r-- | sys/dev/ata/atascsi.h | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c index c7fc9616fba..6061fa26185 100644 --- a/sys/dev/ata/atascsi.c +++ b/sys/dev/ata/atascsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.c,v 1.93 2010/09/19 23:13:02 dlg Exp $ */ +/* $OpenBSD: atascsi.c,v 1.94 2010/09/20 06:02:50 dlg Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -252,8 +252,8 @@ atascsi_probe(struct scsi_link *link) return (0); if (as->as_capability & ASAA_CAP_NCQ && - (letoh16(ap->ap_identify.satacap) & (1 << 8))) { - qdepth = (letoh16(ap->ap_identify.qdepth) & 0x1f) + 1; + ISSET(letoh16(ap->ap_identify.satacap), ATA_SATACAP_NCQ)) { + qdepth = ATA_QDEPTH(letoh16(ap->ap_identify.qdepth)); qdepth = MIN(qdepth, as->as_ncqdepth); if (ISSET(as->as_capability, ASAA_CAP_NEEDS_RESERVED)) qdepth--; diff --git a/sys/dev/ata/atascsi.h b/sys/dev/ata/atascsi.h index 396c4c0aa49..42d23800462 100644 --- a/sys/dev/ata/atascsi.h +++ b/sys/dev/ata/atascsi.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atascsi.h,v 1.42 2010/07/03 00:41:58 kettenis Exp $ */ +/* $OpenBSD: atascsi.h,v 1.43 2010/09/20 06:02:50 dlg Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -86,7 +86,12 @@ struct ata_identify { u_int16_t typtime[2]; /* 71 */ u_int16_t reserved5[2]; /* 73 */ u_int16_t qdepth; /* 75 */ +#define ATA_QDEPTH(_q) (((_q) & 0x1f) + 1) u_int16_t satacap; /* 76 */ +#define ATA_SATACAP_GEN1 0x0002 +#define ATA_SATACAP_GEN2 0x0004 +#define ATA_SATACAP_NCQ 0x0100 +#define ATA_SATACAP_PWRMGMT 0x0200 u_int16_t reserved6; /* 77 */ u_int16_t satafsup; /* 78 */ u_int16_t satafen; /* 79 */ |