Tuesday, February 25, 2014

Fun with Firmware Upgrades

Another wonderful thing about having a full working Virtualisation and Multiple OS test server is that [at last] I've had time to play with an old favourite of mine

Firmware Upgrades

From the beginning ...

Going back in time some of my earliest Hardware cards had fixed, that is to say invariant Integrated circuits.  I'm going to use some actual pictures and examples to make it all so clear.

This is my classic 1977 Cromemco TUART Card Revision E

This provides 2 serial and 2 parallel ports.

If you consult My Card Revisions Weblink  you will see several files for the Tuart Card ...  Say for Revision E

 -----------------------------------------------------------------------                             MODIFICATION LEVEL SUMMARY

          Product Code         P/N                       Product Type TU-ART    
          Page 1 of 2          Date Issued 08/01/83      Revision E           
        =======================================================================           Mod Level 1      Reference #              Date Released 07/19/79
        -----------------------------------------------------------------------           Change: 1) For Tu-Arts used with 3703 printers only:
                     Cut IC7-5 to J3-22 and insert R28 (see ML 7) between
                     these two terminals.

          Reason: 1) This mod cuts ringing on the strobe line which can
                     cause the 3703 printer to print extraneous characters.
        -----------------------------------------------------------------------           Mod Level 2      Reference #              Date Released 11/16/79
          Change: 1) Cut pin 26 of 26 pin CA connectors (#017-0012).

          Reason: 1) A polarizing key will be added to all cables attached
                     to these connectors to guarantee correct mating of
                     cable to connector.
        -----------------------------------------------------------------------           Mod Level 3      Reference #              Date Released 03/26/80
          Change: 1) Superceded by Mod Level 6.
        -----------------------------------------------------------------------           Mod Level 4      Reference #              Date Released 08/06/80
          Change: 1) Put 1K resistor between IC24-10 and IC24-14.
                  2) Put 1K resistor between IC42-1 and IC42-14.
                  3) Put 1K resistor between IC1-13 and IC1-16.

          Reason: 1) To pull-up outputs of IC28 (74S288) when Tu-Art is not
                     being addressed and the 288 is tri-stated (See ECO 203.).
        -----------------------------------------------------------------------           Mod Level 5      Reference #              Date Released 08/07/80
          Change: 1) Replace metal screws & washers with nylon screws &
                     washers, at the locations indicated: IC37-7905/7946.

          Reason: 1) This regulators heatsink is electrical hot.  Nylon
                     hardware will alert users to this effect.
        -----------------------------------------------------------------------           Mod Level 6      Reference #              Date Released 10/03/80
          Change: 1) (Supercedes Mod Level 3)
                     Remove D2, pull IC34 pin 5.
                     Jump IC13-12 to IC10-6.
                     Jump IC13-13 to IC13-2.
                     Jump IC13-11 to IC34-5 on the chip.
                  2) IC34: replace the 7400 with 74LS00.

          Reason: 1) To improve input thresholds for the worst case
                     in the interrupt priority chain.  This change
                     replaces equivalent DTL "AND" function with TTL
                  2) The 74LS00 is preferable to the 7400.
        -----------------------------------------------------------------------           Mod Level 7      Reference #              Date Released 08/11/81
          Change: 1) Supercedes Mod Level 1
                     R28: change for 22ohm resistor to 47ohm.
                     To be done on all Tu-Arts.

          Reason: 1) R28 is added in series to the Data Strobe line (D7)
                     to reduce ringing when a Centronics printer is used
                     (port B).  R28 value should be 47ohm, 22ohm is
        -----------------------------------------------------------------------           Mod Level 8      Reference #              Date Released 03/30/81
          Change: 1) All 74LS04's should be TI only.
                     New part no. 010-0066-1.

          Reason: 1) Chips other than TI fail to oscillate (which oscillation
                     depends of change of gain in linear region).

And so with a soldering Iron in hand this leads to this:

A more modern way would be to control some functionality using a Microprocessor controlled card, driven with some software in a ROM  (Read Only Memory) or even  PROM  (Programmable Read Only Memory) or even memory that can be /flashed/ using a special low level program.

Example Early Microprocessor Controlled Card - Cromemco Octart

The Cromemco Octart had its own Z80 processor and Memory and so was an entirely self contained computer in its own right.

Moving onto Disk Controllers, Cromemco also implemented dedicated Z80 computers to perform hard disk operations using the STDC and ESDC Seagate and ESDI disk interface cards respectively.

If you click on the photograph you can see the large horizontally mounted Zilog Z80 Processor.

Here is the source code to the ESDC track format:

; ***********************************************************************
;   format track
;   ENTRY   HL points to buffer preamble
; ***********************************************************************
tw_wr:  push    hl
ld      hl,ciowp_init       ; point to cio initialization string
ld      c,cioctrl           ; control port address
ld      b,ciowp_siz         ; size of string
ld      hl,dmawp_init       ; point to dma init string
ld      b,dmawp_siz-1       ; don't include go command
ld      c,dmabase           ; base address of dma chip
in      a,waitam            ; wait for index
ld      a,(iy+es_wdsel)     ;  /
out     cyl_type,a          ; /
outi                        ; start dma
ld      a,(norsel)          ; normal code
out     cyl_type,a          ; /
pop     hl                  ; restore pointer

ciowp_init:                         ; random read cio initialization string
db      016h,0ffh           ; CT1 MSB counter
db      017h,0ffh           ; CT1 LSB counter
db      00ah,006h           ; Start counter
ciowp_siz:equ    $-ciowp_init       ; length of string

db      0c3h                ; reset
db      062h                ; block length follows
dw      22000               ; size of write
db      060h                ; cycle specs
db      002h                ; 2 cycle transfer
db      088h                ; stop on match
db      0ffh                ; never stop mask
db      0adh                ; port b address follows
dw      wrapbyte            ; address of wrape around write pattern
db      082h                ; rdy, ce, stop specs
db      0cfh                ; load registers
db      087h                ; start dma
dmawp_siz:equ    $-dmawp_init       

wrapbyte:db     000h                ; pattern for wrap around write

Don't forget this code was loaded onto the card  (i.e. firmware) and executed by the onboard Z80 to make (in this case disk formatting) work.

Firmware Upgrades today
Consumer firmware upgrades are today discouraged but you might still need to perform either a Motherboard of Hard Disk firmware upgrade.

In my experiments I tested DISK firmware upgrades for the following manufacturers with results:

Seagate: Best tools and resources!  To get things to work I had to boot from DOS or from a custom generated CDROM and worse, connect the drive to be upgraded to a specific port on a specific SATA controller.

Hitachi: Hitachi Hi-Test was eventually located and installed. But this OEM utility was so old that it did not actually work even in an old 32bit windows native environment.  

Crucial: Newer M4 and M500 drives have windows friendly upgrade tools.   C300 not so good.  Would not work even from a customised boot CDROM.

OCZ: Windows Friendly tool that works

Western Digital.  Have a Universal Firmware Updater but this does not cover its older desktop 3.5" drives.

Plug for Seagate Tools

Seagate Tools for Windows worked fine under x64 and displayed Seagate and non Seagate drives and allowed testing

Seagate Drive Detect was similarly useful

HDtune Pro is also a good tool to have bought.  You can use it for performance stats before and after any firmware upgrade as well as 

Feature and SMART health counter display.

OEM position in 2014
Nearly ever conceivable component of your electronics now has upgradable firmware.  There are a series of proprietary and vendor specific tools that are not released to the public to upgrade all kinds of devices.

To my great fascination I found out that some of the Power Supplies on my last IBM, large AIX computer actually contained an embedded Linux computer to report statistics on each Power Supply to send reports to a service processor. Amazing!

Consumer Position in 2014
Today Manufacturers are doing their level best to discourage user Firmware upgrades.    Since a firmware upgrade done wrong can /brick/ your device they figure it is best left alone.

In some exceptional cases though, particularly for newer SSD manufacturers have finally realised that the customer needs a simple, idiot proof tool that works directly under Microsoft Windows or exceptionally Mac OSX

HD tune Pro
Seagate Tools
Seagate Drive Detect

Crucial SSD Disk Firmware