diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2020-07-08 12:26:04 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2020-11-03 19:29:26 +0000 |
commit | 066d471ae6dd34eda370c5f610adaefa1029bab9 (patch) | |
tree | cf1659b5473b1990932111d1587aa0e1865cc7b7 | |
parent | 8029c898084787ca1e9e2d02afeff19de117aaed (diff) | |
download | rockbox-066d471ae6dd34eda370c5f610adaefa1029bab9.tar.gz rockbox-066d471ae6dd34eda370c5f610adaefa1029bab9.zip |
ATA: Check to see if the ATA device is solid-state (WIP)
Not all devices advertise this flag, unfortunately.
Change-Id: I6d666febdfcba7598e4d29df7d05c0a288e15158
-rw-r--r-- | firmware/drivers/ata.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 39c305c3df..db39255256 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -332,6 +332,19 @@ static ICODE_ATTR void copy_write_sectors(const unsigned char* buf, | |||
332 | } | 332 | } |
333 | #endif /* !ATA_OPTIMIZED_WRITING */ | 333 | #endif /* !ATA_OPTIMIZED_WRITING */ |
334 | 334 | ||
335 | static inline int ata_disk_isssd(void) | ||
336 | { | ||
337 | /* offset 217 is "Nominal Rotation rate" | ||
338 | 0x0000 == Not reported | ||
339 | 0x0001 == Solid State | ||
340 | 0x0401 -> 0xffe == RPM | ||
341 | All others reserved | ||
342 | |||
343 | Some CF cards return 0x0100 (ie byteswapped 0x0001) so accept either | ||
344 | */ | ||
345 | return (identify_info[217] == 0x0001 || identify_info[217] == 0x0100); | ||
346 | } | ||
347 | |||
335 | static int ata_transfer_sectors(unsigned long start, | 348 | static int ata_transfer_sectors(unsigned long start, |
336 | int incount, | 349 | int incount, |
337 | void* inbuf, | 350 | void* inbuf, |