site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Hi Chris, thanks for the reply. My comments follow inline. On Sep 10, 2008, at 8:00 PM, Chris Sarcone wrote: Brian -- Under section 6.54.1.6 "Error outputs" Apple's SMART sample code does not do this: http://developer.apple.com/samplecode/SMARTQuery/listing3.html We'll continue testing with this change in place. /*! @function SMARTReturnStatus ... @result Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService, kIOReturnExclusiveAccess if it is already opened by another client. */ No, I believe it indicates the sample code is incorrect. Thanks again. Brian Bergstrand <http://www.bergstrand.org/brian/> PGP Key ID: 0xB6C7B6A2 _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I filed a bug (rdar:// 6184934) about this exact same error being returned from an SATA SMART service provider. I can reliably reproduce the bug on both my 2006 iMac and 2007 MBP, but the bug was closed by Apple as not reproducible because I don't have a SATA sniffer to get SATA dump. This sample code is incorrect. I suggest you review the ATA-7 Command Set reference. "If the device does not support this command, if SMART is not enabled, or if the values in the Features, LBA Mid, or LBA High registers are invalid, the device shall return command aborted." Have you validated via the IDENTIFY DEVICE data that SMART is enabled? Your sample code does not enable SMART operations before asking for SMART status...Apple's code does. All it does is query the IDENTIFY data to see if SMART is supported and that is not necessary with 10.4.9 or later because IOKit publishes the property key "kIOPropertySMARTCapableKey" in device objects who are SMART capable; this latter method is used by the bug sample code. In addition, our app has been using this same SMART code for 4 years without issue on Panther and Tiger. Only in Leopard did we start seeing these bogus error returns at random. However, I did make a change to our code to get the IDENTIFY data and test if SMART is enabled and if not enable it. This seems to have helped, as there were no bogus errors during a 10 hour run of querying the status every 4.5 minutes. But in that time period, never did the device report SMART was disabled. So it appears Leopard changed something so that IDENTIFY must be executed before reliably querying for SMART status. // If SMART is not enabled, enable it u_int16_t ATAbuf[256]; if (kIOReturnSuccess == (*sipp)->GetATAIdentifyData(sipp, ATAbuf, sizeof(ATAbuf), NULL)) { // word 85,bit 0 is "SMART feature set enabled" if (0 == ATAbuf[kATAIdentifyCommandExtension2] & (1<<0)) (void)(*sipp)->SMARTEnableDisableOperations(sipp, TRUE); } // Query for SMART status If you interpret this error as SMART errors it maps to "SMART test aborted by host". That would be an incorrect assumption as to error mappings. Fair enough, but the header doc for the method is ambiguous on how to interpret non-standard errors: So is there some more general AHCI/SATA problem? As I said this code worked without issue under Tiger and Panther, so something in Leopard changed. This email sent to site_archiver@lists.apple.com
participants (1)
-
Brian Bergstrand