forked from analogdevicesinc/linux
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
thunderbolt: Add support for host and device NVM firmware upgrade
Starting from Intel Falcon Ridge the NVM firmware can be upgraded by using DMA configuration based mailbox commands. If we detect that the host or device (device support starts from Intel Alpine Ridge) has the DMA configuration based mailbox we expose NVM information to the userspace as two separate Linux NVMem devices: nvm_active and nvm_non_active. The former is read-only portion of the active NVM which firmware upgrade tools can be use to find out suitable NVM image if the device identification strings are not enough. The latter is write-only portion where the new NVM image is to be written by the userspace. It is up to the userspace to find out right NVM image (the kernel does very minimal validation). The ICM firmware itself authenticates the new NVM firmware and fails the operation if it is not what is expected. We also expose two new sysfs files per each switch: nvm_version and nvm_authenticate which can be used to read the active NVM version and start the upgrade process. We also introduce safe mode which is the mode a switch goes when it does not have properly authenticated firmware. In this mode the switch only accepts a couple of commands including flashing a new NVM firmware image and triggering power cycle. This code is based on the work done by Amir Levy and Michael Jamet. Signed-off-by: Michael Jamet <[email protected]> Signed-off-by: Mika Westerberg <[email protected]> Reviewed-by: Yehezkel Bernat <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Andreas Noever <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
- Loading branch information
Showing
8 changed files
with
706 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,3 +82,29 @@ Description: This attribute contains unique_id string of this device. | |
This is either read from hardware registers (UUID on | ||
newer hardware) or based on UID from the device DROM. | ||
Can be used to uniquely identify particular device. | ||
|
||
What: /sys/bus/thunderbolt/devices/.../nvm_version | ||
Date: Sep 2017 | ||
KernelVersion: 4.13 | ||
Contact: [email protected] | ||
Description: If the device has upgradeable firmware the version | ||
number is available here. Format: %x.%x, major.minor. | ||
If the device is in safe mode reading the file returns | ||
-ENODATA instead as the NVM version is not available. | ||
|
||
What: /sys/bus/thunderbolt/devices/.../nvm_authenticate | ||
Date: Sep 2017 | ||
KernelVersion: 4.13 | ||
Contact: [email protected] | ||
Description: When new NVM image is written to the non-active NVM | ||
area (through non_activeX NVMem device), the | ||
authentication procedure is started by writing 1 to | ||
this file. If everything goes well, the device is | ||
restarted with the new NVM firmware. If the image | ||
verification fails an error code is returned instead. | ||
|
||
When read holds status of the last authentication | ||
operation if an error occurred during the process. This | ||
is directly the status value from the DMA configuration | ||
based mailbox before the device is power cycled. Writing | ||
0 here clears the status. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.