--------------------------------------------------------------------------------------------
Usage and Command Line Options
--------------------------------------------------------------------------------------------
 * Same as regular README, except for options below

 Optional Arguments:
     --password PASSWORD ....Enables special operations when user supplies password 
     --aqc AQC_FILE ....Overrides flash using AQC_FILE
     --flash_erase .....Erase flash (overwrite with all 1's) then exit.
     -f [macfw|phyfw|oprom] PATHTOFILE
     --mac_addr_input
     --flash_fields [mac_addr=11-22-33-44-55-66] [subsys=0x00001111] [lane_width=1] [dev_id=0xXXXX]

	 
--------------------------
--password PASSWORD
--------------------------
 
 *NOTE: It is required to erase flash before attempting to override any values!

 Users can supply a password to enable the special menu item. Users will have the ability to
 program hardware values such as MAC Address, Device/Subsystem information, VPD data, etc.
 When the password is supplied, the special menu contains the following:
    
    HW SETTINGS: F DID 0xd107, SUBSYS 0x11D6A, x1, F MAC: 00-17-b6-00-00-0c

    Use FLASH to store special settings
    M) Toggle Mode (Current = Flash)

    1) Config File
    2) Select New FW and OpROM Driver
    3) PCIe Settings
    4) MAC Address
    6) Apply New Settings
    9) Clear all Changes
    0) Exit
    Special Settings Edit:

There are two methods to override hardware settings:
    1) An AQC config file may be supplied, which will set hardware values to predetermined values from aqc file.
    2) Users can supply FW file with option #2 and set hardware values individually. 
	
--------------------------
--aqc AQC_FILE
--------------------------
** RESTART WILL BE REQUIRED FOR CHANGES TO TAKE EFFECT
** (For Windows restart is not required, but still recommended. Since 1.3.9, the Windows diag can update PCIe fields without a reboot.)

The above special menu can apply new flash override settings after erasing flash and providing a new AQC file. 
This option performs the same sequence, except through the command line. Unlike the interactive mode, it is not
required for the user to manually erase the entire flash, since this command does this automatically at the beginning.

Explanation of AQC file:

The file is usually named something like "AQC108-Config.aqc" (it has to have a *.aqc extension, otherwise the diag
will raise an error). The file was intended to be used for flashing firmware with flash overrides, for multiple chips
in a row (if you want to just flash firmware without any overrides, you can use the -f option detailed in the normal readme).
The file is parsed as a YAML file, so the file has to obey the YAML syntax (if you want to skip any field, you can comment it
out by prepending a '#' character).

Explanation of fields:
1) FW_FILE: Path to clx file that will be flashed.
2) PCI Device ID/PCI Subsystem ID/PCI Subsystem Vendor ID: The configuration space ids. Should be a hex number with no more
than 4 digits (eg, 0xd108).
3) PCI Max Lane Width: The maximum number of lanes that our device will report to the system. Usually 1, 2 or 4.
4) MAC OUI/MAC Begin/MAC End/Count: Fields to program the MAC Address. The OUI is self explanatory, and covers the 1st 3 bytes
of the MAC Address. For the last 3 bytes, "MAC Begin" tells the diagnostic which value to use as the starting value and "Count"
provides the offset relative to "MAC Begin" (so to get the last 3 bytes, "Count" is added to "MAC Begin"). "MAC End" is the 
maximum value for the last 3 bytes: if "MAC Begin" + "Count" is equal to "MAC End", the diag will raise an error. To facilitate easy
burning of multiple chips, the "Count" is automatically incremented when one chip's flash is burnt. An example is
probably better:

	a. The user opens "AQC108-Config.aqc" and sees that "MAC OUI" is "00-17-b6", "MAC Begin" is "00-00-00", "MAC End" is "ff-ff-ff"
		and "Count" is 0x5. They run the diag with "--aqc ./temp/AQC108-Config.aqc --password [password here]". The chip's flash override
		section will be burned with a MAC Address of "00-17-b6-00-00-05" (MAC OUI for 1st 3 bytes, and MAC Begin + Count for last 3).
	b. Afterwards, the user opens "AQC108-Config.aqc" and everything remains the same, EXCEPT "Count" which has been changed to
		0x6 (incremented automatically by the diag). If the user swaps in a new chip, and runs the --aqc option again, the new chip's flash
		override section will be burned with "00-17-b6-00-00-06" (MAC OUI for 1st 3 bytes, and MAC Begin + Count for last 3).
	c. If the user does this for 20 chips, the "Count" will then read 0x19. 
	d. For the next batch of 20 chips, if the user wants these chips to start with "00-17-b6-00-f0-00", then the user would change 
		"MAC Begin" to "00-f0-00", and change Count back to 0x0 (otherwise, it will start at "00-17-b6-00-f0-19", because the Count was
		at 0x19 in step c). If the user keeps burning multiple chips with --aqc, they will have MAC Addreses of "00-17-b6-00-f0-00",
		"00-17-b6-00-f0-01", "00-17-b6-00-f0-02", etc (and Count will be incremented to 0x1, 0x2, etc automatically by the diag).
		
5) VPD: A nested structure which corresponds to the VPD structure detailed in the PCI-SIG specification. The "key_order" field
	should not be changed, but all other fields can be changed (most users leave the defaults).

---------------------------------------
-f [macfw|phyfw|oprom] PATHTOFILE
---------------------------------------

The above command can be used to update specific blocks of fw. Only one block can be updated at a time. 
The accepted file types are as follows:
macfw = clx, rombin
phyfw = clx, cld
oprom = clx, bin

--------------------------
--flash_fields [mac_addr=XX-XX-XX-XX-XX-XX] [subsys=0xXXXXXXXX] [dev_id=0xXXXX] [lane_width=1|2|4]
--------------------------
** RESTART WILL BE REQUIRED FOR CHANGES TO TAKE EFFECT
** (For Windows restart is not required, but still recommended. Since 1.3.9, the Windows diag can update PCIe fields without a reboot.)

** IT IS ALSO RECOMMENDED TO EXPLICITLY PROVIDE ALL 3 PCIE FIELDS (subsys, dev_id, lane_width), BUT IT IS NOT REQUIRED
** For example, if the user provides subsys and dev_id, the diag will use the default lane_width from configuration space.

This "--flash_fields" command is similar to the "--aqc" command above, since it is used to update the flash override fields. However, 
unlike that command, this command doesn't erase the flash, but instead patches the new values into the flash. As noted above, if the user 
provides less than 3 PCIe fields, the PCIe fields that aren't included will be taken from the configuration space.

Examples:
1) DIAG.exe --flash_fields mac_addr=00-17-b6-12-34-56 subsys=0x11d6a dev_id=0xd108 lane_width=1
	* everything provided by user, so all fields will be filled in
2) DIAG.exe --flash_fields mac_addr=00-17-b6-12-34-56 lane_width=4
	* if the current subsys==0x12345678 and dev_id==0xd107 in configuration space, that is what will be used for those 2 fields
	* everything else is provided by user
3) DIAG.exe --flash_fields mac_addr=00-17-b6-12-34-56
	* if the current subsys==0x12345678 and dev_id==0xd107 and lane_width==2 in configuration space, that is what will be used for those 3 fields
	* everything else is provided by user
4) DIAG.exe --flash_fields subsys=0x11d6a dev_id=0xd108 lane_width=1
	* if the current mac address for the card is 00-17-b6-55-55-55, then that is what will be kept
	* everything else is provided by user

--------------------------
--mac_addr_input
--------------------------

This option will only update the mac address. The user is prompted  for the MAC Address and they enter 
it (has to follow usual mac address formatting with dashes: eg, 00-17-b6-12-34-56)
