ata: fix ata_id_has_dipm()
ACS-5 section
7.13.6.36 Word 78: Serial ATA features supported
states that:
If word 76 is not 0000h or FFFFh, word 78 reports the features supported
by the device. If this word is not supported, the word shall be cleared
to zero.
(This text also exists in really old ACS standards, e.g. ACS-3.)
The problem with ata_id_has_dipm() is that the while it performs a
check against 0 and 0xffff, it performs the check against
ATA_ID_FEATURE_SUPP (word 78), the same word where the feature bit
is stored.
Fix this by performing the check against ATA_ID_SATA_CAPABILITY
(word 76), like required by the spec. The feature bit check itself
is of course still performed against ATA_ID_FEATURE_SUPP (word 78).
Additionally, move the macro to the other ATA_ID_FEATURE_SUPP macros
(which already have this check), thus making it more likely that the
next ATA_ID_FEATURE_SUPP macro that is added will include this check.
Fixes: ca77329fb7
("[libata] Link power management infrastructure")
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
This commit is contained in:
Родитель
a5fb6bf853
Коммит
630624cb1b
|
@ -574,6 +574,10 @@ struct ata_bmdma_prd {
|
|||
((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \
|
||||
((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \
|
||||
((id)[ATA_ID_FEATURE_SUPP] & (1 << 7)))
|
||||
#define ata_id_has_dipm(id) \
|
||||
((((id)[ATA_ID_SATA_CAPABILITY] != 0x0000) && \
|
||||
((id)[ATA_ID_SATA_CAPABILITY] != 0xffff)) && \
|
||||
((id)[ATA_ID_FEATURE_SUPP] & (1 << 3)))
|
||||
#define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))
|
||||
#define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))
|
||||
#define ata_id_u32(id,n) \
|
||||
|
@ -597,17 +601,6 @@ static inline bool ata_id_has_hipm(const u16 *id)
|
|||
return val & (1 << 9);
|
||||
}
|
||||
|
||||
static inline bool ata_id_has_dipm(const u16 *id)
|
||||
{
|
||||
u16 val = id[ATA_ID_FEATURE_SUPP];
|
||||
|
||||
if (val == 0 || val == 0xffff)
|
||||
return false;
|
||||
|
||||
return val & (1 << 3);
|
||||
}
|
||||
|
||||
|
||||
static inline bool ata_id_has_fua(const u16 *id)
|
||||
{
|
||||
if ((id[ATA_ID_CFSSE] & 0xC000) != 0x4000)
|
||||
|
|
Загрузка…
Ссылка в новой задаче