ide/libata: fix ata_id_is_cfa() (take 3)
PATCH 1/1 ide/libata: fix ata_id_is_cfa() (take 3)
When checking for the CFA feature set support, ata_id_is_cfa() tests bit 2 in word 82 of the identify data instead the word 83; it also checks the ATA/PI version support in the word 80 (which the CompactFlash specifications have as reserved), this having no slightest chance to work on the modern CF cards that don't have 0x848A in the word 0...
---
The patch has been updated to keep Alan feeling safe; there's a hope however that his paranoia will assume more consistent form. :-)
I'm not sure who should queue this patch... it's against Linus' tree.
include/linux/ata.h | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-)
include/linux/ata.h +10 -5
@@ -731,12 +731,17 @@ static inline int ata_id_current_chs_valstatic inline int ata_id_is_cfa (const u16 *id) { -if (id[ATA_ID_CONFIG ] ==0x848A )/* Standard CF */ +if (id[ATA_ID_CONFIG ] ==0x848A )/* Traditional CF */ return 1 ; -/* Could be CF hiding as standard ATA */ -if (ata_id_major_version (id) >=3 && - id[ATA_ID_COMMAND_SET_1 ] !=0xFFFF && - (id[ATA_ID_COMMAND_SET_1 ] & (1 <<2 ))) +/* +* CF specs don't require specific value in the word 0 anymore and yet +* they forbid to report the ATA version in the word 80 and require the +* CFA feature set support to be indicated in the word 83 in this case. +* Let's hope that the modern cards at least follow the word 80 rule +* because some certainly don't follow the word 83 rule... :-/ +*/ +if (!id[ATA_ID_MAJOR_VER ] && + (id[ATA_ID_COMMAND_SET_2 ] &0xC004 ) ==0x4004 )return 1 ;return 0 ; }
Quoted 7 lines · On Tue, 27 Jan 2009 17:19:52 +0400 Sergei Shtylyov <[email protected]>…
When checking for the CFA feature set support,
ata_id_is_cfa()tests bit 2 in word 82 of the identify data instead the word 83; it also checks the ATA/PI version support in the word 80 (which the CompactFlash specifications have as reserved), this having no slightest chance to work on the modern CF cards that don't have0x848Ain the word 0...Signed-off-by Sergei Shtylyov <[email protected]>
Quoted 9 lines · Alan Cox
Quoted 6 lines · On Tue, 27 Jan 2009 17:19:52 +0400 Sergei Shtylyov <[email protected]>…
When checking for the CFA feature set support,
ata_id_is_cfa()tests bit 2 in word 82 of the identify data instead the word 83; it also checks the ATA/PI version support in the word 80 (which the CompactFlash specifications have as reserved), this having no slightest chance to work on the modern CF cards that don't have0x848Ain the word 0...
Quoted 3 lines
Quoted 1 line
Signed-off-by Sergei Shtylyov <[email protected]>Acked-by Alan Cox <[email protected]>
I'll send it upstream, thanks all!
Quoted 11 lines · Jeff Garzik
Quoted 9 lines
Quoted 7 lines
When checking for the CFA feature set support,
ata_id_is_cfa()tests bit 2 in word 82 of the identify data instead the word 83; it also checks the ATA/PI version support in the word 80 (which the CompactFlash specifications have as reserved), this having no slightest chance to work on the modern CF cards that don't have0x848Ain the word 0...Signed-off-by Sergei Shtylyov <[email protected]>Acked-by Alan Cox <[email protected]>I'll send it upstream, thanks all!
Hold up please, Mark gave us an example that it doesnt recognize because
it does report the ATA version in word 80.
MBR, Sergei
Quoted 6 lines · Hello, I wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
When checking for the CFA feature set support,
ata_id_is_cfa()tests bit 2 in word 82 of the identify data instead the word 83; it also checks the ATA/PI version support in the word 80 (which the CompactFlash specifications have as reserved), this having no slightest chance to work on the modern CF cards that don't have0x848Ain the word 0...
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Sergei Shtylyov <[email protected]>Acked-by Alan Cox <[email protected]>I'll send it upstream, thanks all!
Hold up please, Mark gave us an example that it doesnt recognize
because it does report the ATA version in word 80.
s/it/his card/
MBR, Sergei
Quoted 9 lines · Alan Cox
Quoted 6 lines · On Tue, 27 Jan 2009 17:19:52 +0400 Sergei Shtylyov <[email protected]>…
When checking for the CFA feature set support,
ata_id_is_cfa()tests bit 2 in word 82 of the identify data instead the word 83; it also checks the ATA/PI version support in the word 80 (which the CompactFlash specifications have as reserved), this having no slightest chance to work on the modern CF cards that don't have0x848Ain the word 0...
Quoted 3 lines
Quoted 1 line
Signed-off-by Sergei Shtylyov <[email protected]>Acked-by Alan Cox <[email protected]>
..
Any chance you two could figure out this one below? It *is* a CF card, but doesn't show up as such.
/dev/sda:
044a 3fff 0000 000f 0000 0240 003f 03bc 0000 0000 5052 4554 4543 2020 2020 2020 3031 3233 3541 4545 0002 0002 0004 3230 3038 3038 3035 4346 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 8001 0000 0300 0000 0200 0000 0007 3fff 000f 003f 3c4f 00ec 0100 0000 03bc 0000 0007 0003 0078 0078 0078 0078 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 0000 700b 400c 4003 0001 0000 0003 207f 0001 0000 0000 fffe 600f 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0009 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 81f4 0000 0000 0092 001b 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Quoted 17 lines · Mark Lord
Quoted 9 lines
Quoted 7 lines
When checking for the CFA feature set support,
ata_id_is_cfa()tests bit 2 in word 82 of the identify data instead the word 83; it also checks the ATA/PI version support in the word 80 (which the CompactFlash specifications have as reserved), this having no slightest chance to work on the modern CF cards that don't have0x848Ain the word 0...Signed-off-by Sergei Shtylyov <[email protected]>Acked-by Alan Cox <[email protected]>..
Any chance you two could figure out this one below? It *is* a CF card, but doesn't show up as such.
/dev/sda:
Quoted 11 lines
044a 3fff 0000 000f 0000 0240 003f 03bc 0000 0000 5052 4554 4543 2020 2020 2020 3031 3233 3541 4545 0002 0002 0004 3230 3038 3038 3035 4346 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 8001 0000 0300 0000 0200 0000 0007 3fff 000f 003f 3c4f 00ec 0100 0000 03bc 0000 0007 0003 0078 0078 0078 0078 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 0000 700b 400c 4003 0001 0000 0003
ATA device, with non-removable media
Model Number: CF
Serial Number: PRETEC 01235AEE
Firmware Revision: 20080805Standards:
Supported: 4
Likely used: 6
Here's what I was afraid of: it does report the ATA revision in word 80.
Otherwise, it seems pretty standard modern CF. What are we to do now, Alan?
Quoted 10 lines
207f 0001 0000 0000 fffe 600f 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0009 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 81f4 0000 0000 0092 001b 0000 0000 0000
Here are the words 160-167.; word 163 reports PIO6 and MWDMA3 max, PIO6
selected...
MBR, Sergei
Quoted 53 lines · Sergei Shtylyov
Quoted 17 lines · Mark Lord
Quoted 9 lines
Quoted 7 lines
When checking for the CFA feature set support,
ata_id_is_cfa()tests bit 2 in word 82 of the identify data instead the word 83; it also checks the ATA/PI version support in the word 80 (which the CompactFlash specifications have as reserved), this having no slightest chance to work on the modern CF cards that don't have0x848Ain the word 0...Signed-off-by Sergei Shtylyov <[email protected]>Acked-by Alan Cox <[email protected]>..
Any chance you two could figure out this one below? It *is* a CF card, but doesn't show up as such.
/dev/sda:Quoted 11 lines
044a 3fff 0000 000f 0000 0240 003f 03bc 0000 0000 5052 4554 4543 2020 2020 2020 3031 3233 3541 4545 0002 0002 0004 3230 3038 3038 3035 4346 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 8001 0000 0300 0000 0200 0000 0007 3fff 000f 003f 3c4f 00ec 0100 0000 03bc 0000 0007 0003 0078 0078 0078 0078 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 0000 700b 400c 4003 0001 0000 0003
ATA device, with non-removable media
Model Number: CF Serial Number: PRETEC 01235AEE Firmware Revision: 20080805Standards:
Supported: 4
Likely used: 6Here's what I was afraid of: it does report the ATA revision in word
80. Otherwise, it seems pretty standard modern CF. What are we to do now, Alan?Quoted 10 lines
207f 0001 0000 0000 fffe 600f 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0009 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 81f4 0000 0000 0092 001b 0000 0000 0000
Quoted 2 lines
Here are the words 160-167.; word 163 reports PIO6 and MWDMA3 max,
PIO6 selected...
..
Note that, in hdparm-prerelease, I now do something very similar to the libata patch, except I skip the !id[82] check. This works for this card, at least.
-ml
Quoted 37 lines · Mark Lord
Quoted 36 lines
Quoted 17 lines
Quoted 9 lines
Quoted 7 lines
When checking for the CFA feature set support,
ata_id_is_cfa()tests bit 2 in word 82 of the identify data instead the word 83; it also checks the ATA/PI version support in the word 80 (which the CompactFlash specifications have as reserved), this having no slightest chance to work on the modern CF cards that don't have0x848Ain the word 0...Signed-off-by Sergei Shtylyov <[email protected]>Acked-by Alan Cox <[email protected]>..
Any chance you two could figure out this one below? It *is* a CF card, but doesn't show up as such.
/dev/sda:Quoted 11 lines
044a 3fff 0000 000f 0000 0240 003f 03bc 0000 0000 5052 4554 4543 2020 2020 2020 3031 3233 3541 4545 0002 0002 0004 3230 3038 3038 3035 4346 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 8001 0000 0300 0000 0200 0000 0007 3fff 000f 003f 3c4f 00ec 0100 0000 03bc 0000 0007 0003 0078 0078 0078 0078 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 0000 700b 400c 4003 0001 0000 0003
ATA device, with non-removable media
Model Number: CF Serial Number: PRETEC 01235AEE Firmware Revision: 20080805Standards:
Supported: 4
Likely used: 6
Quoted 2 lines
Quoted 2 lines
Here's what I was afraid of: it does report the ATA revision in
word 80. Otherwise, it seems pretty standard modern CF. What are we to do now, Alan?
Mark, too bad that you haven't joined the argument before...
Quoted 11 lines
Quoted 10 lines
Quoted 10 lines
207f 0001 0000 0000 fffe 600f 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0009 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 81f4 0000 0000 0092 001b 0000 0000 0000
Quoted 7 lines
Quoted 2 lines
Here are the words 160-167.; word 163 reports PIO6 and MWDMA3 max,
PIO6 selected.....
Note that, in hdparm-prerelease, I now do something very similar to the libata patch, except I skip the !id[82] check. This works
!id[80] you mean?
Quoted 3 lines
for this card, at least.
-ml
MBR, Sergei
Quoted 58 lines · Sergei Shtylyov
Quoted 37 lines · Mark Lord
Quoted 36 lines
Quoted 17 lines
Quoted 9 lines
Quoted 7 lines
When checking for the CFA feature set support,
ata_id_is_cfa()tests bit 2 in word 82 of the identify data instead the word 83; it also checks the ATA/PI version support in the word 80 (which the CompactFlash specifications have as reserved), this having no slightest chance to work on the modern CF cards that don't have0x848Ain the word 0...Signed-off-by Sergei Shtylyov <[email protected]>Acked-by Alan Cox <[email protected]>..
Any chance you two could figure out this one below? It *is* a CF card, but doesn't show up as such.
/dev/sda:Quoted 11 lines
044a 3fff 0000 000f 0000 0240 003f 03bc 0000 0000 5052 4554 4543 2020 2020 2020 3031 3233 3541 4545 0002 0002 0004 3230 3038 3038 3035 4346 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 8001 0000 0300 0000 0200 0000 0007 3fff 000f 003f 3c4f 00ec 0100 0000 03bc 0000 0007 0003 0078 0078 0078 0078 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 0000 700b 400c 4003 0001 0000 0003
ATA device, with non-removable media
Model Number: CF Serial Number: PRETEC 01235AEE Firmware Revision: 20080805Standards:
Supported: 4
Likely used: 6Quoted 2 lines
Quoted 2 lines
Here's what I was afraid of: it does report the ATA revision in
word 80. Otherwise, it seems pretty standard modern CF. What are we to do now, Alan?Mark, too bad that you haven't joined the argument before...
Quoted 13 lines
Quoted 13 lines
Quoted 10 lines
207f 0001 0000 0000 fffe 600f 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0009 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 81f4 0000 0000 0092 001b 0000 0000 0000
Here are the words 160-167.; word 163 reports PIO6 and MWDMA3 max,
PIO6 selected...
Quoted 6 lines
Quoted 4 lines
..
Note that, in hdparm-prerelease, I now do something very similar to the libata patch, except I skip the !id[82] check. This works
!id[80] you mean?
..
Yeah.. I've lost the libata patch posting now.
Pity we cannot also check for the signature of 0x044a (word-0) as per the CFA spec, but I believe I tried that once here and found some hard disks that got misidentified as a result. :)
Thanks for poking at this stuff.
-ml
Quoted 34 lines · Sergei Shtylyov
Quoted 21 lines · Mark Lord
Quoted 10 lines
Quoted 10 lines
When checking for the CFA feature set support,
ata_id_is_cfa()tests bit 2 in
word 82 of the identify data instead the word 83; it also checks the ATA/PI
version support in the word 80 (which the CompactFlash specifications have as
reserved), this having no slightest chance to work on the modern CF cards that
don't have0x848Ain the word 0...Quoted 3 lines
Quoted 1 line
Signed-off-by Sergei Shtylyov <[email protected]>Acked-by Alan Cox <[email protected]>..
Any chance you two could figure out this one below? It *is* a CF card, but doesn't show up as such.
/dev/sda:Quoted 11 lines
044a 3fff 0000 000f 0000 0240 003f 03bc 0000 0000 5052 4554 4543 2020 2020 2020 3031 3233 3541 4545 0002 0002 0004 3230 3038 3038 3035 4346 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 8001 0000 0300 0000 0200 0000 0007 3fff 000f 003f 3c4f 00ec 0100 0000 03bc 0000 0007 0003 0078 0078 0078 0078 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 0000 700b 400c 4003 0001 0000 0003
Quoted 7 lines
ATA device, with non-removable media
Model Number: CF Serial Number: PRETEC 01235AEE Firmware Revision: 20080805Standards:
Supported: 4
Likely used: 6
My Kingston CF reports:
Model Number: CF CARD 1GB Serial Number: CF1GB 00004DCA Firmware Revision: 20070709
Quoted 15 lines
Here's what I was afraid of: it does report the ATA revision in word
80. Otherwise, it seems pretty standard modern CF. What are we to do now, Alan?Quoted 10 lines
207f 0001 0000 0000 fffe 600f 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0009 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 81f4 0000 0000 0092 001b 0000 0000 0000
Quoted 4 lines
Here are the words 160-167.; word 163 reports PIO6 and MWDMA3 max, PIO6
selected...MBR, Sergei
Here is my Kingston CF Card:
044a 078e 0000 0010 0000 0240 003f 001d bf20 0000 4643 4731 2042 3030 3030 4434 4143 0000 0000 0000 0002 0002 0004 3032 3730 3730 3930 4643 4320 5241 2044 4731 0042 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 8001 0000 0300 0000 0200 0000 0003 078e 0010 003f bf20 001d 0100 bf20 001d 0000 0407 0003 0078 0078 0078 0078 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 0000 0002 0001 0000 0002 0000 0000 0000 0000 0000 400f 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 81f4 0000 0000 0492 001b 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
May be we should rely on "CF" in "Model number". This would not cover all CF cards, but could catch some modern. But anyway we have to collect more different CF cards statistic first.
Regards, Dmitry Gryazin.
Re: ide/libata: fix ata_id_is_cfa() .. hdparm-9.10
For the convenience of folks looking at CF cards and other issues here, I've just put out hdparm-9.10 https://sourceforge.net/projects/hdparm/
with improved CF card detection, and corrected reporting of CF mwdma modes.
If you haven't upgraded in a while, this might be an excuse to do so.
Cheers
Mark
Quoted 29 lines · Mark Lord
Any chance you two could figure out this one below? It *is* a CF card, but doesn't show up as such.
/dev/sda:
044a 3fff 0000 000f 0000 0240 003f 03bc 0000 0000 5052 4554 4543 2020 2020 2020 3031 3233 3541 4545 0002 0002 0004 3230 3038 3038 3035 4346 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 2020 8001 0000 0300 0000 0200 0000 0007 3fff 000f 003f 3c4f 00ec 0100 0000 03bc 0000 0007 0003 0078 0078 0078 0078 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0010 0000 700b 400c 4003 0001 0000 0003 207f 0001 0000 0000 fffe 600f 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0009 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 81f4 0000 0000 0092 001b 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
Quoted 8 lines
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
..
Speaking of which.. these cards retail for only $99 delivered (eBay), in case anyone was looking for a cheap-ish SSD for an older notebook. Reads at up to 40+MBytes/sec, writes are in the 20MB/sec range.
Cheers