Reprogramming the EEPROM on Myri-10G NICs
-----------------------------------------

The Myri-10G NIC's EEPROM consists mainly of two parts:
 - a primary NIC-bootloader (and fallback firmware)
 - an upgradeable firmware

This document describes the procedure to reprogram the EEPROM on
the Myri-10G NICs, and should ONLY be performed if Myricom explicitly
recommends it.

Warning:  The procedure described below will yield a Myri-10G NIC
*******   inoperable if a power loss or other kind of interruption
          occurs during the reprogramming of the EEPROM.

Table of Contents:
-----------------

  I. Instructions to reprogram the EEPROM on one NIC.
 II. Reprogramming all of the NICs in a cluster.
III. Suppressing manual confirmation during the reprogramming.
 IV. Reprogramming the EEPROM on multiple NICs within the same machine.
  V. Example output from reprogramming one NIC.

I. Instructions to reprogram the EEPROM on one NIC:
--------------------------------------------------

1. Download the following tarball:

   http://www.myri.org/loic/10g-tools/myri-10g-eeprom-<version>.tar.gz

   This tarball provides the following tools:

   myri-10g-eeprom-<version>/lload:  to reset a NIC
   myri-10g-eeprom-<version>/myri_info: examine the EEPROM contents
   myri-10g-eeprom-<version>/mcp0_replace-<version>:  reprogram the eeprom.

   and you must be root to execute these commands.

2. Unload any MX-10G or Myri10GE driver and reboot the machine, verifying
   that no Myrinet-related driver is loaded before proceeding.

3. Execute: 
   # ./myri_info 
   and locate the TAG= string in the output to identify the version of 
   the EEPROM of your NIC.

4. Check that your power supply is reliable, and that there is not a
   scheduled shutdown on the machine while you are upgrading.

5. Execute:
   # ./mcp0_replace-<version>
   and verify that you receive the following confirmation output:

   "Programming finished, verification succeeded"

   For a full listing of all of the output produced, refer to the 
   section below entitled "Example output from Reprogramming one NIC".

   In the unlikely event that the reprogramming fails:
    * leave the machine on
    * do not reboot
    * do not execute lload
    * try re-executing mcp0_replace-<version> one more time
    * if the procedure still fails: request help from Myricom Technical
      Support, help@myri.com, and send the full output of the failed 
      "mcp0_replace-<version>" execution, as well as the full output of
      "myri_info -v -c".

6. Execute
   # ./myri_info
   again, and verify that in the new contents of the eeprom, the
   TAG= string has been updated as well as the "EEPROM MCP"
   versions.

7. Force the NIC to use the new firmware (only if the previous tests
   succeeded normally), by either:
    * rebooting the machine, or
    * executing "lload -i" to reset the NIC.

8. After verifying again that "myri_info" works fine, you can now be
   confident that your NIC is working based on the new EEPROM
   contents.

II. Reprogramming all of the NICs in a cluster:
----------------------------------------------

We recommend that you first manually reprogram one NIC using the above 
procedure.

When reprogramming many NICs in succession, it is important to reprogram the
NICs serially (not starting a new NIC before making sure the procedure has
succeeded on the previous one).  Otherwise, if the procedure fails, you
risk all NICs being inoperable in case of an error.

We recommend using the included script to reprogram multiple NICs:

  myri-10g-eeprom-<version>/myri-eeprom-batch.sh

Pass the list of nodes to reprogram as command line arguments, for instance:

/<fullpath>/myri-10g-eeprom-<version>/myri-eeprom-batch.sh node0 node1 node2 .. node10


III. Suppressing manual confirmation during the reprogramming:
-------------------------------------------------------------

For each NIC programming operation, the program asks the user to
manually enter yes.

mcp0_replace-<version> has a -fff option to skip the "yes" confirmation
test, which is useful when you want to batch reprogram many NICs (after 
making sure everything works OK on a couple of them).

You can use:
# ./mcp0_replace-<version> -fff

or

# /<fullpath>/myri-10g-eeprom-<version>/myri-eeprom-batch.sh -fff node0 node1 .. node10

IV. Reprogramming the EEPROM on multiple NICs within the same machine:
---------------------------------------------------------------------

For a machine with several Myri-10G NICs, you can use the -b<board_num>
option to specify which NIC is the target of the operation.  The
programs "mcp0_replace-<version>", "myri-eeprom-batch.sh", and
"myri_info" all accept this -b<board_num> option.

Examples:
# ./myri_info -b1
# ./mcp0_replace-<version> -b1


V. Example output from reprogramming one NIC:
--------------------------------------------

# tar xzf myri-10g-eeprom-beta5.tar.gz
# cd myri-10g-eeprom-beta5
# ./myri_info
[ various info ]
#  ./mcp0_replace-beta5
Setting string specs in eeprom to following current NIC settings:
MAC=00:60:dd:47:e5:08
SN=280497
PWR=100
PC=10G-PCIE-8A-C
PN=09-03327

Found eeprom header at 0x11200:disabled protection

Preparing to reprogram EEPROM with img contained in ./mcp0_replace-beta5, len=165407

DANGER: Power Loss during programming will make the card unusable
It will need to be reprogrammed in Myricom Lab

If program is interrupted while programming, restart it *BEFORE* rebooting
       or you card will be dead at next reboot

Do you want to continue (enter yes)?yes
*********PROGRAMMING STARTED ******************
................................

Programming finished, verification succeeded

# ./myri_info
...
TAG=production_beta5-uba
...
[ *don't* do the ./lload -i command or reboot if if the mcp0_replace-beta5 execution above failed ]
# ./lload -i
Saving NIC Conf-space
Resetting NIC through PIO
Rereading ID
NIC has restarting, restoring PCI conf-space
# ./myri_info
...
Running MCP:
   ETH ::1.4.0 2006/05/01 21:20:30 myri10ge firmware
