2014-10-30

Dell UltraSharp U2212HM Power Consumption Table / Estimate

The Dell U2212HM's OSD menu shows a bar labeled "Energy Use" that goes from 1 (least watts) to 20 (most).  I wanted to see what the actual correlation was, so I broke out my kill-a-watt.   The simple testing method was to change the brightness from lowest to highest, which tracked with the energy use bar. (Aside: Setting the contrast almost to black results in a 1w decrease, even with brightness at 100%).

Monitor resolution was 1080x1920 (Portrait Mode), with Gmail open while changing brightness.  Values listed are average: there was an up to .8w variance from start of a bar to end. (For example, going from 3 bars to 4 showed 13.8, and right before going to 5 was 14.4)
Energy Use to Watt Correlation
Bars1234567891011121314151617181920
Watts (avg) 11.8 12.4 13.4 14.0 14.6 15.3 15.8 16.4 17.2 17.7 18.2 18.8 19.4 20.0 21.0 22.5 23.8 25.0 26.4 27.9
With a colorful video playing, at 20 bars energy use, the power consumption was around 26w.  Full screen open pdf of the manual (islands of black text on oceans of white) resulted in the highest consumption, at 28.1w*.  Dell's conservative value in the specs ('normal') is 30w; the kill-a-watt measurement supports this.

Based on an energy cost calculator, the yearly cost to leave this monitor on 24/7 at the highest observed energy use (28w) (.672 kWh/day) at 12 cent per kWh is $29.43/yr ($2.42/mo, $.08/day).  

Using 'good enough' brightness for me (15 bars)(21w) and assuming a more realistic 16 hour a day use (ignoring marathons of sexual transgression with the red bulls) gives .336 kWh/day, costing $.04/day, $1.21/mo, or $14.72 a year.   (x2 for its twin)

I remain opposed to running the numbers on the 27", at least, until I set up nircmd such that I'm turning all three off with a hotkey. 

*This doesn't account for using the USB or sound bar.

2014-07-31

Hardware FDE with Intel SSD 330 on Intel DH67BL Motherboard

To be able to make full use of the built-in AES encryption on the Intel SSD 330 with the Intel DH67BL desktop motherboard...
  1. Move BIOS block jumper to 'maintenance mode' position.
  2. Boot.
  3. Set hard drive password.
  4. Move BIOS block jumper back to normal position.
  5. Boot.
Notes:
  • To set a longer password than 13 characters, use hdat2 (mhdd seems to have a difficult time with AHCI, and since we're hotplugging...)- boot system without drive powered up, or, hard reset drive when in hdat2 and rescan, and then set password.  The BIOS prompt WILL allow entry of longer passwords, just not setting them. 
  • Removing a drive with a password set causes the option to set password in the BIOS security menu to disappear.  However, once maintenance mode has been entered and a password set, it seems from then on, hooking up a drive with a password set will work. (i.e., reattaching drive gets the initial password prompt on boot and menu entries in setup->security.)

Yeah.  A rant comes forth, now.

That very simple procedure is the hard won wisdom from a week of exploring many much more difficult divergent tangents, since there's nothing in Intel's documentation about this, and Intel's own 'support' crew (Intel Community) apparently aren't familiar with it.

It might seem like a no brainer, and it should have been.

The BIOS prompt to set a hard drive password does not initially appear in 'normal' mode.

If you hook up a hard drive with a password set on it, the BIOS does not prompt for a password, and the prompt to set a hard drive password does not appear in the BIOS security tab.

To make things even more fun, the BIOS on this board sets SECURITY FREEZE LOCK and has no option to disable it, so just using mhdd/hdat2/victoria after boot every time isn't an option, nor is hacking out an .efi module. (hdat2 seems to be able to power off the drive; it doesn't reset it; hard resetting really seems to be the only way to do it.)   And --- one can't simply use the atasx extension here --- the nasty frankenstein BIOS (it's even worse than an Insyde one, God help us all) is apparently signed, so even if you figured out how to force a PCI ROM module in it... you wouldn't be able to flash it.

Finding the 'maintenance mode' was a lucky bit of 'so simple it ... oh, for shit's sake, these fucking firmware engineers need to be lined up against a wall' discovery; I'd found a tool which would sort of let me extract the .bio file (UEFITool), and was working at figuring out how to modify the setup forms to display the menu items to allow setting the hdd password.  Donovan6000's blog, filled with astoundingly useful and indepth tutorials, and his Universal IFR Extractor, were instrumental in this.  However, his tool didn't actually parse the dumped VARSTORE data, which made it harder to pursue the solution I wanted to try before actually attempting to mod the BIOS: just change some nvram variables.  I forked his project to display the information, and make the correlation trivial, but, found the whole 'just set the damn jumper' thing prior to going any deeper.

So, for someone adventurous, in an EFI shell ( Tianocore --- I tried 'refind'; seriously gimped piece of crap; doesn't have any of the built-in help, and doesn't implement dmpstore -s or -l!) just try setting 3DD0DE67-02D7-4129-914A-9F377CC34B0D:IDESecDev:00 to 0x01 and save screwing with the jumper... or, perhaps, there are desktop boards out there with the capability but no jumper.

I did have a save of the nvram before and after 'enabling' the hdd password.  For handy reference for anyone who might care, here's what's different after:
Variable NV+RT+BS 'Efi:MonotonicCounter' DataSize = 4
- Seems to track boots; not relevant.

Variable NV+RT+BS 'A56074DB-65FE-45F7-BD21-2D2BDD8E9652:LegacyDevOrder' DataSize = A
  00000000: 02 00 00 00 06 00 11 00-12 00                    *..........*
Variable NV+RT+BS 'A56074DB-65FE-45F7-BD21-2D2BDD8E9652:LegacyDevChecksum' DataSize = 4
  00000000: 11 AC 12 6B                                      *...k*
to
Variable NV+RT+BS 'A56074DB-65FE-45F7-BD21-2D2BDD8E9652:LegacyDevOrder' DataSize = A
  00000000: 02 00 00 00 06 00 01 00-11 00                    *..........*
Variable NV+RT+BS 'A56074DB-65FE-45F7-BD21-2D2BDD8E9652:LegacyDevChecksum' DataSize = 4
  00000000: 01 15 11 6B                                      *...k*
Presumably that's part of the SSD being hooked up (wasn't for initial dump).

Variable NV+RT+BS '1B838190-4625-4EAD-ABC9-CD5E6AF18FE0:HiiDB' DataSize = 8
  00000000: 18 C0 8A DA 00 00 00 00-                         *........*
to
Variable NV+RT+BS '1B838190-4625-4EAD-ABC9-CD5E6AF18FE0:HiiDB' DataSize = 8
  00000000: 18 F0 8A DA 00 00 00 00-                         *........*

This looks like it might be related to displaying the setup menu item for hard drive passwords(?). HiiDB: UEFI HII (Part 4): Strings

Variable NV+RT+BS 'EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9:MaintenanceSetup' DataSize = 29D
  000000B0: 00 00 00 00 00 02 00 00-00 00 00 01 00 01 00 01  *................*
  000000C0: 00 01 00 01 00 00 00 01-00 00 00 00 00 00 00 00  *................*
  000000D0: 00 07 00 00 00 00 00 00-00 00 00 01 00 01 59 65  *..............Ye*
  000000E0: 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  *................*
to: 
Variable NV+RT+BS 'EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9:MaintenanceSetup' DataSize = 29D
  000000B0: 00 00 00 00 00 00 00 00-00 00 00 01 00 01 00 01  *................*
  000000C0: 00 01 00 01 00 00 00 01-00 00 00 00 00 00 00 00  *................*
  000000D0: 00 07 00 00 00 00 00 00-00 00 00 01 00 01 00 61  *...............a*
  000000E0: 07 AC 00 00 00 00 00 00-00 00 00 00 00 00 00 00  *................*
Since these compares are after the jumper is in the normal position, then this may be relevant. 

Variable NV+RT+BS 'Efi:BootOrder' DataSize = 4
  00000000: 01 00 05 00                                      *....*
to
Variable NV+RT+BS 'Efi:BootOrder' DataSize = 4
  00000000: 01 00 02 00                                      *....*
Seems obvious and not relevant.

Variable NV+RT+BS 'EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9:Setup' DataSize = 29D
  000000A0: 00 00 00 01 00 20 00 00-00 00 00 01 00 00 00 00  *..... ..........*
  000000B0: 00 00 00 00 00 02 00 00-00 00 00 01 00 01 00 01  *................*
  000000C0: 00 01 00 01 00 00 00 01-00 00 00 00 00 00 00 00  *................*
  000000D0: 00 07 00 00 00 00 00 00-00 00 00 01 00 01 9D 9F  *................*
  000000E0: D6 98 00 00 00 00 00 00-00 00 00 00 00 00 00 00  *................*
to
Variable NV+RT+BS 'EC87D643-EBA4-4BB5-A1E5-3F3E36B20DA9:Setup' DataSize = 29D
  000000A0: 00 00 00 01 00 20 00 00-00 00 00 01 00 00 00 00  *..... ..........*
  000000B0: 00 00 00 00 00 00 00 00-00 00 00 01 00 01 00 01  *................*
  000000C0: 00 01 00 01 00 00 00 01-00 00 00 00 00 00 00 00  *................*
  000000D0: 00 07 00 00 00 00 00 00-00 00 00 01 00 01 EC FF  *................*
  000000E0: 2C 4A 00 00 00 00 00 00-00 00 00 00 00 00 00 00  *,J..............*

And for the truly masochistic, here's the relevant(?) form dump (something to pursue might be seeing if the password's actually stored in the nvram when set from the BIOS...):
Form Set: Security {0E 24 43 D6 87 EC A4 EB B5 4B A1 E5 3F 3E 36 B2 0D A9 A5 03 DD 04 00 00 00 00 00 00 00 00 04 00 00 00 9D 02}
0x40FD2 Variable Store (32): {24 20}
Name: [ IDESecDev ] {49 44 45 53 65 63 44 65 76 00}
GUID: [ 3DD0DE67-02D7-4129-914A-9F377CC34B0D ] {67 DE D0 3D D7 02 29 41 91 4A 9F 37 7C C3 4B 0D}
  ID: [ 0xF015 ] {15 F0}
Size: [ 144 ] {90 00}
0x40FF2 Form: Security, Form ID: 0x4 {01 06 04 00 A5 03}
0x40FF8 Suppress If: {0A 03 00}
0x40FFB Variable 0x3B[2] equals 0x0 {12 07 3B 00 02 00 00}
0x41002 Not {17 02}
0x41004 Text: Supervisor Password :  {03 0B 20 00 B7 03 B9 03 00 00 00}
0x4100F End If {18 02}
0x41011 Suppress If: {0A 03 00}
0x41014 Variable 0x3B[2] equals 0x0 {12 07 3B 00 02 00 00}
0x4101B Text: Supervisor Password :  {03 0B 20 00 B7 03 BB 03 00 00 00}
0x41026 End If {18 02}
0x41028 Suppress If: {0A 03 00}
0x4102B Variable 0x13[2] equals 0x0 {12 07 13 00 02 00 00}
0x41032 Not {17 02}
0x41034 Text: User Password :  {03 0B 20 00 B8 03 BA 03 00 00 00}
0x4103F End If {18 02}
0x41041 Suppress If: {0A 03 00}
0x41044 Variable 0x13[2] equals 0x0 {12 07 13 00 02 00 00}
0x4104B Text: User Password :  {03 0B 20 00 B8 03 BC 03 00 00 00}
0x41056 End If {18 02}
0x41058 Suppress If: {0A 03 00}
0x4105B Variable Store Select: 0xF015 {25 04 15 F0}
0x4105F Variable 0xC[2] equals value in list (0x0) {14 09 0C 00 02 01 00 00 00}
0x41068 Variable 0x0[2] equals value in list (0x0) {14 09 00 00 02 01 00 00 00}
0x41071 Variable Store Select: 0x0 {25 04 00 00}
0x41075 Variable 0xB5[1] equals value in list (0x1) {14 09 B5 00 01 01 00 01 00}
0x4107E Or {16 02}
0x41080 Or {16 02}
0x41082 Text: Master Key Hard Disk Drive Password : {03 0B 04 00 97 04 BB 03 00 00 00}
0x4108D End If {18 02}
0x4108F Suppress If: {0A 03 00}
0x41092 Variable Store Select: 0xF015 {25 04 15 F0}
0x41096 Variable 0xC[2] equals value in list (0x1) {14 09 0C 00 02 01 00 01 00}
0x4109F Variable 0x0[2] equals value in list (0x0) {14 09 00 00 02 01 00 00 00}
0x410A8 Variable Store Select: 0x0 {25 04 00 00}
0x410AC Variable 0xB5[1] equals value in list (0x1) {14 09 B5 00 01 01 00 01 00}
0x410B5 Or {16 02}
0x410B7 Or {16 02}
0x410B9 Text: Master Key Hard Disk Drive Password : {03 0B 04 00 97 04 B9 03 00 00 00}
0x410C4 End If {18 02}
0x410C6 Suppress If: {0A 03 00}
0x410C9 Variable Store Select: 0xF015 {25 04 15 F0}
0x410CD Variable 0xA[2] equals value in list (0x0) {14 09 0A 00 02 01 00 00 00}
0x410D6 Variable 0x0[2] equals value in list (0x0) {14 09 00 00 02 01 00 00 00}
0x410DF Variable Store Select: 0x0 {25 04 00 00}
0x410E3 Variable 0xB5[1] equals value in list (0x1) {14 09 B5 00 01 01 00 01 00}
0x410EC Or {16 02}
0x410EE Or {16 02}
0x410F0 Text: Hard Disk Drive Password : {03 0B 04 00 96 04 BB 03 00 00 00}
0x410FB End If {18 02}
0x410FD Suppress If: {0A 03 00}
0x41100 Variable Store Select: 0xF015 {25 04 15 F0}
0x41104 Variable 0xA[2] equals value in list (0x1) {14 09 0A 00 02 01 00 01 00}
0x4110D Variable 0x0[2] equals value in list (0x0) {14 09 00 00 02 01 00 00 00}
0x41116 Variable Store Select: 0x0 {25 04 00 00}
0x4111A Variable 0xB5[1] equals value in list (0x1) {14 09 B5 00 01 01 00 01 00}
0x41123 Or {16 02}
0x41125 Or {16 02}
0x41127 Text: Hard Disk Drive Password : {03 0B 04 00 96 04 B9 03 00 00 00}
0x41132 End If {18 02}
0x41134 Subtitle:  {02 04 20 00}
0x41138 Suppress If: {0A 03 00}
0x4113B Variable 0x41 equals 0x1 {22 06 41 00 01 00}
0x41141 Variable 0x41 equals 0x2 {22 06 41 00 02 00}
0x41147 Or {16 02}
0x41149 Password: Set Supervisor Password, Variable: 0x3B[40] {08 10 3B 00 28 A8 03 A9 03 04 00 10 02 14 01 00}
0x41159 End If {18 02}
0x4115B Grayout If: {19 03 00}
0x4115E Variable 0x42 equals 0x1 {22 06 42 00 01 00}
0x41164 Password: Set User Password, Variable: 0x13[40] {08 10 13 00 28 A6 03 A7 03 04 01 10 02 14 01 00}
0x41174 End If {18 02}
0x41176 Grayout If: {19 03 00}
0x41179 Variable 0x42 equals 0x1 {22 06 42 00 01 00}
0x4117F Suppress If: {0A 03 00}
0x41182 Variable 0x13[2] equals 0x0 {12 07 13 00 02 00 00}
0x41189 Selectable: Clear User Password, Form ID: 0x4 {0F 0B 04 00 AC 03 AD 03 04 04 10}
0x41194 End If0x41194 End If {18 02}
0x41196 Grayout If: {19 03 00}
0x41199 Variable 0x21E[1] equals 0x2 {12 07 1E 02 01 02 00}
0x411A0 Variable 0x41 equals 0x1 {22 06 41 00 01 00}
0x411A6 Or {16 02}
0x411A8 Suppress If: {0A 03 00}
0x411AB Variable 0x21E[1] equals 0x1 {12 07 1E 02 01 01 00}
0x411B2 Variable 0x41 equals 0x2 {22 06 41 00 02 00}
0x411B8 Variable 0x3B[2] equals 0x0 {12 07 3B 00 02 00 00}
0x411BF Or {16 02}
0x411C1 Or {16 02}
0x411C3 Setting: User Access Level, Variable: 0x21D[1] {05 09 1D 02 01 BD 03 BE 03}
0x411CC Option: No Access, Value: 0x0 {09 09 BF 03 00 00 10 00 00}
0x411D5 Option: View Only, Value: 0x1 {09 09 C0 03 01 00 13 00 00}
0x411DE Option: Limited, Value: 0x2 {09 09 C1 03 02 00 10 00 00}
0x411E7 Option: Full Access, Value: 0x3 {09 09 C2 03 03 00 10 00 00}
0x411F0 End of Options {10 02}
0x411F2 End If0x411F2 End If {18 02}
0x411F4 Subtitle:  {02 04 20 00}
0x411F8 Suppress If: {0A 03 00}
0x411FB Variable Store Select: 0xF015 {25 04 15 F0}
0x411FF Variable 0x0[2] equals 0x0 {12 07 00 00 02 00 00}
0x41206 Variable Store Select: 0x0 {25 04 00 00}
0x4120A Variable 0xB5[1] equals 0x1 {12 07 B5 00 01 01 00}
0x41211 Or {16 02}
0x41213 Grayout If: {19 03 00}
0x41216 Variable Store Select: 0xF015 {25 04 15 F0}
0x4121A Variable 0xE[2] equals 0x0 {12 07 0E 00 02 00 00}
0x41221 Variable 0x41 equals 0x1 {22 06 41 00 01 00}
0x41227 Or {16 02}
0x41229 Password: Set Master Key Hard Disk Drive Password, Variable: 0x50[64] {08 10 50 00 40 9B 04 9C 04 00 00 00 02 20 01 00}
0x41239 End If0x41239 End If {18 02}
0x4123B Suppress If: {0A 03 00}
0x4123E Variable 0x0[2] equals 0x0 {12 07 00 00 02 00 00}
0x41245 Variable Store Select: 0x0 {25 04 00 00}
0x41249 Variable 0xB5[1] equals 0x1 {12 07 B5 00 01 01 00}
0x41250 Or {16 02}
0x41252 Grayout If: {19 03 00}
0x41255 Variable 0x41 equals 0x1 {22 06 41 00 01 00}
0x4125B Variable Store Select: 0xF015 {25 04 15 F0}
0x4125F Password: Set Hard Disk Drive Password, Variable: 0x10[64] {08 10 10 00 40 99 04 9A 04 04 40 10 02 20 01 00}
0x4126F End If0x4126F End If {18 02}
0x41271 Subtitle:  {02 04 20 00}
0x41275 Grayout If: {19 03 00}
0x41278 Variable Store Select: 0x0 {25 04 00 00}
0x4127C Variable 0x220[1] equals 0x2 {12 07 20 02 01 02 00}
0x41283 Variable 0x41 equals 0x1 {22 06 41 00 01 00}
0x41289 Or {16 02}
0x4128B Suppress If: {0A 03 00}
0x4128E Variable 0x220[1] equals 0x1 {12 07 20 02 01 01 00}
0x41295 Setting: Chassis Intrusion, Variable: 0x21F[1] {05 09 1F 02 01 C3 03 C5 03}
0x4129E Option: Disable, Value: 0x0 {09 09 E6 00 00 00 10 00 00}
0x412A7 Option: Log Only, Value: 0x1 {09 09 90 04 01 00 13 00 00}
0x412B0 Option: Pause POST, Value: 0x2 {09 09 C4 03 02 00 10 00 00}
0x412B9 End of Options {10 02}
0x412BB End If0x412BB End If {18 02}
0x412BD Grayout If: {19 03 00}
0x412C0 Variable 0x222[1] equals 0x2 {12 07 22 02 01 02 00}
0x412C7 Variable 0x41 equals 0x1 {22 06 41 00 01 00}
0x412CD Or {16 02}
0x412CF Suppress If: {0A 03 00}
0x412D2 Variable 0x222[1] equals 0x1 {12 07 22 02 01 01 00}
0x412D9 Variable 0x4E equals 0x0 {22 06 4E 00 00 00}
0x412DF Or {16 02}
0x412E1 Setting: Execute Disable Bit, Variable: 0x221[1] {05 09 21 02 01 C7 03 C8 03}
0x412EA Option: Disable, Value: 0x0 {09 09 E6 00 00 00 10 00 00}
0x412F3 Option: Enable, Value: 0x1 {09 09 E5 00 01 00 13 00 00}
0x412FC End of Options {10 02}
0x412FE End If0x412FE End If {18 02}
0x41300 Grayout If: {19 03 00}
0x41303 Variable 0x224[1] equals 0x2 {12 07 24 02 01 02 00}
0x4130A Variable 0x41 equals 0x1 {22 06 41 00 01 00}
0x41310 Or {16 02}
0x41312 Suppress If: {0A 03 00}
0x41315 Variable 0x224[1] equals 0x1 {12 07 24 02 01 01 00}
0x4131C Variable 0x6C equals 0x0 {22 06 6C 00 00 00}
0x41322 Or {16 02}
0x41324 Setting: Intel® Virtualization Technology, Variable: 0x223[1] {05 09 23 02 01 AE 03 AF 03}
0x4132D Option: Disable, Value: 0x0 {09 09 E6 00 00 00 10 00 00}
0x41336 Option: Enable, Value: 0x1 {09 09 E5 00 01 00 13 00 00}
0x4133F End of Options {10 02}
0x41341 End If0x41341 End If {18 02}
0x41343 End Form {0B 02}
0x41345 End Form Set {0D 02}

References (Link Dump):

  1. http://vxlabs.com/2012/12/22/ssds-with-usable-built-in-hardware-based-full-disk-encryption/
  2. http://ark.intel.com/products/67288/Intel-SSD-330-Series-180GB-SATA-6Gbs-25nm-MLC
  3. http://www.intel.com/p/en_US/support/highlights/ssdc/ssd-330
  4. http://www.intel.com/content/www/us/en/motherboards/desktop-motherboards/desktop-board-dh67bl.html
  5. https://communities.intel.com/thread/53404
  6. http://www.intel.com/support/ssdc/hpssd/sb/CS-034543.htm
  7. https://github.com/NikolajSchlej/UEFITool
  8. http://donovan6000.blogspot.com/2014/02/universal-ifr-extractor.html
  9. http://wiki.phoenix.com/wiki/index.php/EFI_IFR_VARSTORE
  10. http://uefidk.intel.com/blog/accessing-uefi-variables-linux
  11. https://github.com/sstahlman/Universal-IFR-Extractor/releases/tag/v0.6.1a
  12. http://www.thepromisedlan.org/archives/tag/firmware
  13. https://svn.code.sf.net/p/edk2/code/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
  14. http://uefi.blogspot.com/2009/10/uefi-hii-part-4-strings.html

2013-06-09

Easy Mode Data Recovery: Maxtor HDD PCB Exchange

Disclaimer: You shouldn't put your valuable data in danger by following advice you find on Internet blogs.

Maxtor drives tend to accept PCB swaps, making data recovery when it's only a burnt chip (ST 2DPS20V, in this case) nearly effortless.

I had some worthwhile* data in need of recovery.

In 2009, 80gb donor drives were still expensive ($75 to $100).  

Now, they're under $30 on ebay (the one that worked for me was $26.99 with shipping.)

See references for what's (probably) needed for a donor match.

Image of PCBs and Drive Shells
Overview
PCBs and Shells
Image of Damaged PCB
Damaged
PCB
Image of a burnt 2DPS20V MOSFET
Crispy Chip
Zoomed Out View of Donor PCB
Donor
PCB
Zoomed In On 2DPS20V MOSFET
Pristine Chip












After switching boards, I simply booted Hiren's on a diag system and copied the data off to a network share.

If you find yourself in similar circumstances, perhaps consider this much cheaper (and brainlessly easy) route before sending it into the pros.

Tools Needed:
T8 Torx
Donor Drive PCB
Cavalier Attitude With General Disregard For Important Data

Drive PCB Specs:
Burnt: Code: YAR41BW0 N,M,G,A TLA: 6Y080L0422611 AAB Date: 08 Nov 2005 PCB: M6FYA
Donor: Code: YAR41BW0 N,M,B,A TLA: 6Y080L0422611 AAB Date: 02 Dec 2005 PCB: M6FYA

* Porn. Of course I mean porn. Also the schematics for a working cold fusion reactor, and an unaltered copy of the United States Constitution.

References:
Newbies Start Here - Scott Moulton's Site
HowTO How To replace Maxtor Calypso III board
PCB layout - Maxtor DiamondMax Plus 9 ATA/133
Repair and Recover Maxtor Hard Drives
Maxtor Hard Drive PCB swapping replacement guide
HDD ICs
P-CHANNEL 20V - 0.14 ohm - 2.5A SO-8 2.7V-DRIVE STripFET™ II MOSFET PLUS SCHOTTKY DIODE

2011-02-08

Acer easyStore H340: Using EON to Fool It Into Being Less of a Piece of Trash

Initially, I planned on using FreeNAS on the H340; I downloaded the images (both the 0.7 and the 0.8 beta) and then tried to piece together enough from the scattered bits of advice on the interwebs to make it work.

I was unsuccessful.

While some very helpful tutorials exist (specifically, HappyBison's) and FreeNAS users tend to be friendly and knowledgeable, it seems there is little interest (from what I was able to see) from the actual developer(s) of FreeNAS in having it used on consumer devices such as the easyStore.

As an example of this, the only post in the FreeNAS forum with instructions specific to actually loading it on the H340 was banished to a final obscure demise in the 'scripts' forum. (Rather than, say, something silly like the "Install" forum, where it was originally posted, and then moved from by an admin.)

Combined with what appears to be a large increase in size of the .08 version, it became apparent to me trying to continue with FreeNAS was likely less than ideal: I guess the company now maintaining it has hardware to sell?  Whatever the case, I did try multiple USB sticks with different versions, blindly, on the H340, with no success. When I was finally able to see output, both releases (stable and beta) were crapping themselves in different places.  Both worked just fine booting in a VM.

Regarding output: In my vanity and do-it-yourself zeal, I had attempted to follow the schematics for building a custom 'debug' cable: I now have a 17" LCD with a sadly frayed pigtail as a lasting testament to my ineptitude at doing so. (It was already somewhat trashed: No, really, it was, before I touched it!) (I also have spare terminals and those little plastic doodads.  Note to self: Software people should stick to software and stay away from the scary electronics stuff.)

Ranting:
After my utter fail at making my own debug cable, I gave in and just bought the Zotac from Newegg: not because it's perfect for the job (it's not) or because it's really very good (it's not), but because it was the cheapest pcie x1 gfx card I could find. Note here: I'm not a fan of the H340. The design is ... lacking in many ways. I realize it's consumer level. I realize the stated audience for it (running Windows Home Server) is unlikely to have much interest in tearing it apart.  I realize if they didn't make it so braindead, people would just enjoy having a small form factor [insert need here] computer, and then they wouldn't buy the more expensive, just as craptastic, Acer products.  Still: even though I got it for under $300 on Black Friday, I regret not having pulled the trigger on the Intel SS2400 instead.  Or, for that matter, hindsight being what it is, just spending a little extra and building a nice NAS with quality parts; any monetary savings on this long ago evaporated with the timesink of it.

Why the need for the video card in the first place?  Because... just taking out the hard drive isn't enough to get it to boot off a usb device.  By the time I got to the point of testing booting off a hard drive with an image, I was sick of screwing with it (I just bought the damn gfx card.) However, it likely would have worked.
H340 with Zotac Card

What didn't work was booting from PXE or off anything usb: floppy, cdrom, or flash.  My educated guess why not: With the default boot order, the internal flash gets first priority, which naturally has the Windows Home Server recovery; only after using the gfx card was I able to watch the WHS "recovery server" defecate all over itself on every boot.

For the brave folks wandering here, and maybe trying to save themselves $65, you can try the following blindly (and let me know if it works for you):
(Note: this is with no hard drives attached, no network cable, and a flash drive hooked up. YMMV.)
Enable debug jumper.
Plug in USB keyboard.
Turn on H340. Wait until numlock on keyboard comes on. Hit F2.
You should now be on the BIOS setup screen - try the following Konami codes:
To change "After Power Failure: [Last State]" to off:
(from Information to Main)
(from Main to Advanced)
 (from Hardware Monitor to Advanced Chipset Control)
 (from Advanced Chipset Control to After Power Failure:)
Enter (select menu - is at Last State)
(select "Stay Off")
Enter
F10 (Save And Exit)
Enter ("Yes" should be selected in the "Do you really want to save and exit?" prompt)
H340 Default Boot Order

Change Boot Order: (This should make your boot order: PCI BEV, USB CDROM, USB Key, USB HDD (this is the SMI)
(Info to Main)
(Main to Advanced)
(Advanced to Boot)
3 ("Loads default boot sequence" Options 1-4)
F10 (Save and Exit)
Enter ("Yes")
F12 Boot Menu

Accessing Boot Menu: Turn on H340. Wait until numlock blinks twice. Hit F12. (see picture...)

So, after setting the BIOS to boot off a thumb drive, EON NAS booted without a hitch to its prompt.  At this point, it should be possible to SSH in, and, here's the really really hard part to get EON installed on the SMI drive:

install.sh

Yup.  Just that.

Backtracking slightly, when FreeNAS wasn't booting (blindly) I looked for another option, and found EON. I hadn't heard anything about it before, but it seemed like what I needed: Small, maintained, with documentation AND the proper driver for the Marvell (yukon) NIC already integrated.  The only drawback being it's Solaris, which was completely alien to me.  After a bit of mucking about with it, thought, I found it's similar enough to linux and bsd that the learning curve for basic usage was quite short.

Unfortunately, I didn't do enough research (R'ingTFM) beforehand, so, note: Get the CIFS version. I got the Samba version.  To me, it seemed like the same thing, and the difference wasn't elaborated on (at least, anywhere I'd seen).  So, what's the difference? CIFS has kernel support and seems to be easier to tie in with ZFS, with perhaps a small performance boost.

Samba is just what you're likely used to: a smb.conf file and all the usual Samba options you've become accustomed to. While it was simple setting it up (I just used most of what I already had on my main system) most of the instructions for sharing with OpenSolaris seem to be targetted towards CIFS installs.  While getting a share going with the Samba version is cake, it feels as though the 'right' way would have been to have used the CIFS version.

Regardless, here's how I got to the point of having EON booting on the H340:
Downloaded EON 64-bit x86 Samba ISO Image Version 0.60.0
Mounted in VMware
Booted
Install.sh to usb flash drive in vm.
Move flash drive to H340.
Boot.
Log in.
Run install.sh.
Fin!
Installing EON to SMI flash

Further notes:
Just in case I ever need it (perhaps I'm feeling like hurting myself and don't have anything sharp, so need a dull, blunt pain?):
(Make sure you used a flash drive with plenty of space)
dd if=/dev/dsk/c1t0d0p0 of=/mnt/eon0/WHS_Firwmare_Backup.bin bs=512
This should be done before doing install.sh; now you can abuse the internal flash without quite the same cold dread.

Setting up EON is pretty simple: EON's creator (Andre Lue) has pretty comprehensive documentation on his site.  As an aside, before I broke down and ordered the gfx card, I still thought I was screwing up something with copying the images to my flash drives, and emailed Andre with obviously n00b questions: despite the unorthodox pestering (he seems to usually provide support via his blog and the OSOL forums) I got responses with much helpful advice; most of it already available had I bothered reading his blog in the first place. (For example, dealing with the issue of booting in a VM (-B disable-pcieb=true).  The other reasons notwithstanding, I can wholeheartedly recommend EON simply because of the caliber and character of its creator.

Some random notes/gotchas:
/mnt/eon0/boot/x86.eon is what grub actually uses.  x86.eon.oem is the backup.  If you're sure your current boot works, you can get rid of the .oem one.  To get rid of the e1000g0 driver, if you boot in a VM initially, you'll likely need to remove the net file manually.

smartctl: initially, was causing the crappy WD green drives to get stuck in a spin (and report the temperature at over 450°c, heh!).  I hadn't bothered to process the FAQ, where the proper syntax is listed.  The problem? It needs _12_ byte commands not 16 byte commands.  So, this works fine:
# smartctl -d sat,12 -A /dev/rdsk/c1t0d0
smartctl version 5.38 [i386-pc-solaris2.11] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/
=== START OF READ SMART DATA SECTION ===
SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   200   200   051    Pre-fail  Always       -       0
  3 Spin_Up_Time            0x0027   170   154   021    Pre-fail  Always       -       8475
  4 Start_Stop_Count        0x0032   100   100   000    Old_age   Always       -       43
  5 Reallocated_Sector_Ct   0x0033   200   200   140    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x002e   100   253   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       26
 10 Spin_Retry_Count        0x0032   100   253   000    Old_age   Always       -       0
 11 Calibration_Retry_Count 0x0032   100   253   000    Old_age   Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       31
192 Power-Off_Retract_Count 0x0032   200   200   000    Old_age   Always       -       25
193 Load_Cycle_Count        0x0032   200   200   000    Old_age   Always       -       122
194 Temperature_Celsius     0x0022   109   105   000    Old_age   Always       -       43
196 Reallocated_Event_Count 0x0032   200   200   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   200   200   000    Old_age   Always       -       4
198 Offline_Uncorrectable   0x0030   200   200   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   200   200   000    Old_age   Always       -       165
200 Multi_Zone_Error_Rate   0x0008   200   200   000    Old_age   Offline      -       0

(Output above is the drive that came with the H340.)  I've yet to figure out what (if anything) to do about the lack of TLER support, but I did use wdidle3 /d (via a flash drive boot) to turn off the stupid 8 second head parking; the Load Cycle Count hasn't grown much since. Also, I added the following to my power.conf to compensate (and yes, I could have set wdidle3 /s300, but this way, it's in OSOL's hands and not WDs...):

device-thresholds       /dev/dsk/c1t0d0 5m
device-thresholds       /dev/dsk/c1t1d0 5m
device-thresholds       /dev/dsk/c1t2d0 5m
device-thresholds       /dev/dsk/c1t3d0 5m

Notes about getting the binary kit installed; Andre's instructions are clear for it, but there aren't really any decent instructions on actually making IPS 'do stuff' --- so, attempting to install the man pages for OpenSolaris:
/pool/pkg-toolkit-sunos-i386/pkg/bin/pkg install -v SUNWman
(and SUNWdoc...)
and trying to use /usr/bincatman -w (to create the windex file), never gave me working manpages: Not essential, but somewhat annoying for an OSOL newb. I managed to stop myself just short of trying to get gcc on the h340; at some point, one recognizes it's JUST for sharing files and stops messing with it.

Speaking of sharing, one small hiccup: nmbd isn't enabled by default. (It's installed, just not started.)  So, for folks wanting the H340 to advertise itself, you need this:
http://wikis.sun.com/display/BigAdmin/Enabling+Browsing+with+Samba+in+Solaris+10+Update+4

Unresolved stuff:

  • - The stupid blinking 'i'; possible to fix by using the freebsd driver posted in the WHS forums and porting to OSOL? Not a huge issue, since it's in a closet.
  • - Temperature: drives run _hot_.  Is this just WD braindeadedness, or the crappy design of the H340? (Samsungs in a ReadyNAS stay around 32°C-35°C with load...4x 2TB WD Caviar Greens idle at 44°C-49°C). 
  • - Upgrading version of ZFS... comes with version 22, current is 31?
Jumbo Frames:
vi /kernel/drv/yukonx.conf and uncomment JumboFrames_Inst0="On";
Add /kernel/drv/yukonx.conf to /mnt/eon0/.backup

References and Resources:
EON ZFS Storage
Home Fileserver: ZFS File Systems
Solaris ZFS Administration Guide
ZFS Cheatsheet
Oracle Solaris 10 Docs
Solaris Service Management Facility Quickstart Guide
OpenSolaris New User FAQ
How Solaris Disk Device Names Work
Searchable Solaris Manpages
Blog post about WDTLER
WD's craptastic page on parking issue
Linux LED driver for H340
Configuring Jumbo Frames
Yukonx Reference (Settings)

2010-12-25

... In Which It Is Revealed How An AHCI Bug Makes One's Insyde(s) Freeze

I found this code in Intel's AHCI Option ROM from the Insyde BIOS. It appears to be code to build the Translated Device Parameter Table (which is a slightly different1 implementation than the one documented in the Enhanced Working T13 Draft 1126DT).

Psuedo code  (version: Serial ATA AHCI BIOS, Version iSrc 1.20_E.0019 07092009):

Function Create TDPT for drive
    Read partition table with INT13 0x201
    If read fails, or 0xAA55 signature isn't present, goto Calculate
    Get head,sectors from FIRST Partition table entry, Ending CHS values
    heads = head+1  (because of 255 limit in partition table)
    For each partition entry
        If BOOTABLE (entry[0] == 0x80) goto UsePartition
    EndFor
    For each partition entry
        if (entry[0] == 0) and (entry[4] != 0) goto UsePartition
    EndFor


Calculate
    Call CalculateCHS - using DPT and physical size
    if no need for translation, return GOOD
    Goto CreateTDPT with cylinders, heads, sectors


UsePartition:
    Read first sector of partition with INT13 0x4200
    If the word at offset 0x1A is less than 0x100,
      and the word at offset 0x18 is less than 0x40
    then
        set heads to the byte at offset 0x1A
        set sectors to the byte at offset 0x18
    fi
    tracksize = heads * sectors
    if tracksize == 0, Goto Calculate
    DWORD size = (DPT[heads]*DPT[sectors])*DPT[cylinders]
    WORD cylinders = size / tracksize <--- Bad!
    -- if the result is greater than 65536, a divide overflow occurs
    -- which isn't handled by the BIOSes
    if (cylinders > 1024) cylinders = 1024
    if ((heads == DPT[heads]) && (sectors == DPT[sectors])) return GOOD


CreateTDPT:
    WORD at DPT[8]  = DPT[0] - Save original cylinders
    BYTE at DPT[10] = DPT[2] - Save original heads
    BYTE at DPT[7]  = DPT[3] - Save original sectors
    WORD at DPT[0]  = cylinders
    BYTE at DPT[2]  = heads
    BYTE at DPT[3]  = sectors
    BYTE at DPT[5]  = 8 if heads greater than 8, otherwise 0
    BYTE at DPT[4]  = 0xA0
    BYTE at DPT[15] = SUM( DPT[0] .. DPT[14] )

So, what goes wrong? When it breaks, it starts with bad values from the partition table, and tries to fix it with values from the boot parameter block, if it finds "valid" numbers there for heads and sectors (that is, less than or equal to 0xFF and 0x3F, respectively). When these values aren't right,  due to full disk encryption, an operating system other than Microsoft Windows, or malicious intent:
  • It uses the ending head/sector of the first partition to size the translation layer.
  • Windows 7 with 100MB partition results in unexpected values for INT13, FUNCTION=8 (eg, 0x13 heads).
  • It stores those values into the Translated Device Parameter Table..  and then some other code comes along and uses those values. While I can't find where those values are causing the exception, anything doing C/H/S translation will be unhappy.
Looking back at version Serial ATA AHCI BIOS, Version iSrc 1.20E (Gigabyte Desktop Motherboard), I found that it doesn't read from the BPB at all.  I speculate the extra read of the NTFS boot-sector was to workaround a problem on Insyde BIOS.   This version can be crashed if the two bytes in the partition table are small enough and will hang with error code 23. Award BIOS will function OK with the other unexpected values, but Insyde BIOS will still crash if it sees them.

Finally, one HP system with an Insyde BIOS has the latest(?) 'fixed' version (Serial ATA AHCI BIOS, Version iSrc 1.20_E.0024 12212009), which reads from both the partition table and the BPB, also adding  still more checks. Unfortunately, it seems as though someone messed up and added a further bug, as it doesn't actually use any of the values it reads, but rather discards them all.

New and improved UsePartition (Serial ATA AHCI BIOS, Version iSrc 1.20_E.0024 12212009):
Read first sector of partition with INT13 0x4200
if the word at offset 0x1FE is not equal 0xAA55
   and the byte at offset 0 is not equal 0xEB
   and the word at offset 0x1A is less than 0x100
then
    set heads to the byte at offset 0x1A
fi
if (tracks == 0) or ((sectors & 0x3F) == 0) Goto Calculate
-- New bug: Since sectors can be at most 0x3F from partition table
-- the newer version ALWAYS goes off to Calculate the CHS
if (sectors & 0xC0) == 0)  Goto Calculate
tracksize = heads * sectors
if tracksize == 0, Goto Calculate
DWORD size = (DPT[heads]*DPT[sectors])*DPT[cylinders]
WORD cylinders = size / tracksize <-- Uber dangerous
-- if the result is greater than 65536, a divide overflow occurs
-- which isn't handled by the BIOSes.
if (cylinders > 1024) cylinders = 1024
if ((heads == DPT[heads]) && (sectors == DPT[sectors])) return GOOD
Goto CreateTDPT

A year later and neither Acer nor Gigabyte are providing fixed BIOSes.

1Expected Final TDPT Values from a 60GB SSD:
          WORD Logical Cylinders   0x400
    BYTE Heads               0xFF
    BYTE Sectors             0x3F
    BYTE Signature           0xA0
    BYTE HeadsAbove8Flag     0x08
    BYTE Ignored             0x00
    BYTE Physical Sectors    0x3F
    WORD Physical Cylinders  0x3FFF
    BYTE Physical Heads      0x10
    BYTE Ignored[4]          0x0
    BYTE Checksum            0x89