對磁碟機韌體更新進行疑難排解Troubleshooting drive firmware updates

適用於:Windows 10、Windows Server (半年度管道)、Applies to: Windows 10, Windows Server (Semi-Annual Channel),

Windows 10 版本 1703 和更新版本,以及 Windows Server (半年度管道) 包含可更新已使用韌體升級 AQ (其他辨識符號) 透過 PowerShell 取得認證之 HDD 和 SSD 韌體的功能。Windows 10, version 1703 and newer, and Windows Server (Semi-Annual Channel) include the capability to update firmware of HDDs and SSDs that have been certified with the Firmware Upgradeable AQ (Additional Qualifier) via PowerShell.

您可以在下列位置找到更多有關此功能的資訊:You can find more information about this feature here:

韌體更新可能會因為各種原因而失敗。Firmware updates may fail for various reasons. 本文章的目的是要協助您進行進階疑難排解。The purpose of this article is to help with advanced troubleshooting.

注意

視問題而定,本文中的資訊可能不足以完全偵錯所有可能的失敗情況。Information in this article, depending on the issue, may not be sufficient to fully debug all possible failure cases.

常見問題Common issues

從架構上來說,這項新功能需要依賴 Windows 儲存堆疊所實作的 API,PowerShell 會呼叫到這些 API。Architecturally, this new capability relies on APIs implemented in the Windows storage stack, which PowerShell calls into. 儲存堆疊需要仰賴驅動程式和硬體,才能正確實作業界定義的命令。The storage stack relies on drivers and hardware to properly implement industry defined commands. 這就產生了許多可能發生失敗的問題點。This yields several points at which failures can occur. 最常發覺的問題:The most commonly observed issues are:

  1. 指定的磁碟機無法正確實作業界標準命令 (沒有 AQ)A given drive does not properly implement the industry-standard commands (does not have the AQ)
  2. 執行更新所需的 API 未實作或有錯誤 (如果使用協力廠商驅動程式)The APIs needed to perform the update are not implemented or faulty (if 3rd party drivers are used)
  3. API 運作正常,但是韌體本身有問題 (映像無效/損毀、…)The APIs work, but there is an issue with the firmware itself (invalid/corrupt image, …)

下列各節根據使用的是 Microsoft 還是協力廠商的驅動程式,概述疑難排解資訊。The following sections outline troubleshooting information, depending on whether Microsoft or 3rd party drivers are used.

識別不適當的硬體Identifying inappropriate hardware

識別裝置是否支援正確命令集最快速方法就是,直接啟動 PowerShell,並將磁碟的象徵 PhysicalDisk 物件傳遞至 Get-StorageFirmwareInfo Cmdlet。The quickest way to identify if a device supports the correct command set is to simply launch PowerShell and pass a disk's representing PhysicalDisk object into the Get-StorageFirmwareInfo cmdlet. 以下是範例:Here is an example:

Get-PhysicalDisk -SerialNumber 15140F55976D | Get-StorageFirmwareInformation

輸出範例如下︰And here's example output:

PhysicalDisk          : MSFT_PhysicalDisk (ObjectId = "{1}\\TOKLIMA-DL380\root/Microsoft/Windo...)
SupportsUpdate        : True
NumberOfSlots         : 1
ActiveSlotNumber      : 0
SlotNumber            : {0}
IsSlotWritable        : {True}
FirmwareVersionInSlot : {0013}

SupportsUpdate 欄位 (至少 SATA 和 NVMe 裝置的這個欄位) 將會指出內建 PowerShell 功能是否可以用來升級韌體。The SupportsUpdate field, at least for SATA and NVMe devices, will indicate if the built-in PowerShell functionality can be used to update firmware.

無法使用業界標準命令查詢適當命令支援時,SupportsUpdate 欄位對於 SAS 連結裝置永遠回報 "True"。The SupportsUpdate field will always report “True” for SAS-attached devices, as querying for the appropriate command support is not possible with industry-standard commands.

要驗證 SAS 裝置是否支援所需的命令集,有兩個方式可以選擇︰To validate if a SAS device supports the required command set, two options exist:

  1. 透過 Update-StorageFirmware Cmdlet,以適當的韌體映像來試試看,或者Try it out via the Update-StorageFirmware cmdlet with an appropriate firmware image, or
  2. 查閱 Windows Server Catalogue 來找出哪些 SAS 裝置已成功取得韌體更新 AQ (https://www.windowsservercatalog.com/)Consult the Windows Server Catalogue to identify which SAS devices have successfully gained the FW Update AQ (https://www.windowsservercatalog.com/)

修復選項Remediation options

如果您測試中的特定裝置不支援適當命令集,請向廠商查詢以了解是否有更新的韌體提供所需的命令集,或是查閱 Windows Server 目錄以確認裝置是否有實作適當命令集的來源。If a given device you are testing does not support the appropriate command set, either query your vendor to see if an updated firmware is available that provides the needed command set, or consult the Windows Server Catalogue to identify devices for sourcing that implement the appropriate command set.

協力廠商驅動程式 (SAS) 疑難排解Troubleshooting with 3rd-Party drivers (SAS)

與硬體最密切互動的軟體元件是 Windows 儲存堆疊中的 Mini-Port 驅動程式。The software components that most closely interact with hardware are mini-port drivers in the Windows storage stack. 對於一些像 SATA 及 NVMe 這樣的存放裝置通訊協定,Microsoft 會提供原生 Windows 驅動程式。For some storage protocols, such as SATA and NVMe, Microsoft provides native Windows drivers. 這些驅動程式可以提供額外的偵錯資訊。These drivers allow for additional debug information. 不過,第三方硬體和軟體廠商可以自行撰寫他們裝置的 Miniport 驅動程式,但其偵錯資訊支援層級可能會有所不同。3rd party hardware and software vendors however are free to write their own miniport drivers for their devices and their support level for debug information may vary.

若要在不考慮 Miniport 驅動程式的情況下,確認韌體下載發生的狀況,並啟用儲存堆疊中由上向傳送的 API,請參閱下列事件記錄檔通道:To identify what happened to the firmware download and activate APIs sent down the storage stack, regardless of miniport driver, consult the following event log channel:

事件檢視器 - 應用程式及服務記錄檔 - Microsoft - Windows - StorDiag - Microsoft-Windows-存放裝置-ClassPnP/操作Event Viewer - Application and Services Logs - Microsoft - Windows - StorDiag - Microsoft-Windows-Storage-ClassPnP/Operational

此通道記錄有關向下傳送至 Miniport 驅動程式之 Windows API 及其回應的資訊。This channel records information about the Windows APIs sent down to the miniport drivers and what their responses are. 例如,嘗試將韌體映像下載到透過未正確實作由 SAS 至 SATA 所需轉譯之 SAS HBA 連接的 SATA 裝置時,會顯示下面出現的錯誤條件:For example, the error condition shown directly below is exhibited when attempting to download a firmware image to a SATA device, which is connected through a SAS HBA that does not properly implement the needed translation from SAS to SATA:

Get-PhysicalDisk -SerialNumber 44GS103UT5EW | Update-StorageFirmware -ImagePath C:\Firmware\J3E160@3.enc -SlotNumber 0

以下是輸出的範例:Here's an example of the output:

Update-StorageFirmware : Failed

Extended information:
A warning or error has been encountered during storage firmware update.
Incorrect function.

Activity ID: {1224482b-2315-4a38-81eb-27bb7de19c00}
At line:1 char:47
+ ... S103UT5EW | Update-StorageFirmware -ImagePath C:\Firmware\J3E160@3.en ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Update-StorageFirmware], CimException
+ FullyQualifiedErrorId : StorageWMI 4,Microsoft.Management.Infrastructure.CimCmdlets.InvokeCimMethodCommand,Update-StorageFirmware

PowerShell 會擲回錯誤,並且收到表示所呼叫之功能 (亦即核心 API) 不正確的資訊。PowerShell will throw an error and has received the information that the function called (i.e. Kernel API) was incorrect. 這可能表示 API 不是由協力廠商 SAS Mini-Port 埠驅動程式所實作 (本案例即是如此),或是 API 因其他緣故 (例如下載區段未對齊) 而失敗。This could mean that either the API was not implemented by the 3rd party SAS mini-port driver (true in this case), or that the API was failed for another reason, such as a misalignment of download segments.

EventData
DeviceGUID  {132EDB55-6BAC-A3A0-C2D5-203C7551D700}
DeviceNumber    1
Vendor  ATA 
Model   TOSHIBA THNSNJ12
FirmwareVersion 6101
SerialNumber    44GS103UT5EW
DownLevelIrpStatus  0xc0000185
SrbStatus   132
ScsiStatus  2
SenseKey    5
AdditionalSenseCode 36
AdditionalSenseCodeQualifier    0
CdbByteCount    10
CdbBytes    3B0E0000000001000000
NumberOfRetriesDone 0

通道中的 ETW 事件 507 顯示 SCSI SRB 要求失敗,並提供其他資訊「SenseKey 為 '5' (要求無效)」和「AdditionalSense 資訊為 '36' (CDB 中有不正確的欄位)」。The ETW event 507 from the channel shows that a SCSI SRB request failed and provides the additional information that SenseKey was ‘5’ (Illegal Request), and that AdditionalSense information was ‘36’ (Illegal Field in CDB).

注意

此資訊是由前述 Miniport 提供,而該資訊的正確性取決於 Miniport 驅動程式的實作和複雜性。This information is provided directly by the miniport in question and the accuracy of this information will depend on the implementation and sophistication of the miniport driver.

如果 Miniport 驅動程式沒有釐清錯誤碼之間的分別,不同的錯誤條件有可能會顯示相同的錯誤碼。It is possible that different error condition exhibit the same error codes, if the miniport driver does not disambiguate between them. 例如,嘗試透過 SAS HBA 將無效的韌體映像下載到 SATA 裝置 (預期此裝置會失敗) 可能會轉譯成相同的失敗碼。For example, trying to download an invalid firmware image through a SAS HBA to a SATA device (which the device is expected to fail) may be translated to the same failure codes.

在通訊協定為混合式且發生轉譯 (亦即 SATA 後置 SAS) 的情況下,最好要測試直接與 SATA 控制連接的 SATA 裝置,以排除其有潛在問題。In cases where protocols are mixed and translations occur, i.e. SATA behind SAS, it is best to test the SATA device directly connected to a SATA controller to rule it out as a potential problem.

修復選項Remediation options

如果協力廠商驅動程式經辨識為無法實作所需的 API 或轉譯,則可以swap to the Microsoft 提供的 SATA (StorAHCI.sys) 和 NVMe (StorNVMe.sys) 替代驅動程式,或是連絡提供 SAS 驅動程式的 OEM 或 HBA 廠商,並查詢是否有提供正確支援的較新版本。If the 3rd party driver is identified as not implementing the needed APIs or translations, it is possible to either swap to the Microsoft provided alternatives for SATA (StorAHCI.sys) and NVMe (StorNVMe.sys), or reach out to the OEM or HBA vendor that provided the SAS driver and query if a newer version with the proper support exists.

Microsoft 驅動程式 (SATA/NVMe) 其他疑難排解Additional troubleshooting with Microsoft drivers (SATA/NVMe)

使用 Windows 原生驅動程式 (例如 StorAHCI.sys 或 StorNVMe.sys) 來支援存放裝置時,可以在韌體更新作業期間取得有關可能失敗情況的其他資訊。When Windows-native drivers, such as StorAHCI.sys or StorNVMe.sys are used to power storage devices, it is possible to get additional information about possible failure cases during firmware update operations.

除了「ClassPnP 操作」通道以外,StorAHCI 和 StorNVMe 會在下列 ETW 通道中記錄裝置的通訊協定特定傳回碼:Beyond the ClassPnP Operational channel, StorAHCI and StorNVMe will log the device’s protocol specific return codes in the following ETW channel:

事件檢視器 - 應用程式及服務記錄檔 - Microsoft - Windows - StorDiag - Microsoft-Windows-存放裝置-StorPort/診斷Event Viewer - Application and Services Logs - Microsoft - Windows - StorDiag - Microsoft-Windows-Storage-StorPort/Diagnose

預設不會顯示診斷記錄檔,但可以按一下事件檢視器中的 [檢視],並從下拉式功能表選取 [顯示分析與偵錯記錄] 來啟用/顯示。The diagnostic logs are not shown by default and can be activated/shown by clicking on “View” in EventViewer and selecting “Show Analytics and Debug Logs” from the drop-down menu.

若要收集這些進階記錄檔項目,請啟用記錄檔、重現韌體更新失敗,並儲存診斷記錄檔。To gather these advanced log entries, enable the log, reproduce the firmware update failure, and save the diagnostic log.

以下是有關 SATA 裝置因下載映像無效 (事件識別碼:258) 而失敗的韌體更新範例:Here is an example of a firmware update on a SATA device failing, because the image to be downloaded was invalid (Event ID: 258):

EventData
MiniportName    storahci
MiniportEventId 19
MiniportEventDescription    Firmware Activate Completion
PortNumber  0
Bus 2
Target  0
LUN 0
Irp 0xffff8c84cd45aca0
Srb 0xffffab0024030bc0
Parameter1Name  SrbStatus
Parameter1Value 130
Parameter2Name  ReturnCode
Parameter2Value 0
Parameter3Name  FeaturesReg
Parameter3Value 15
Parameter4Name  SectorCountReg
Parameter4Value 0
Parameter5Name  DriveHeadReg
Parameter5Value 160
Parameter6Name  CommandReg
Parameter6Value 146
Parameter7Name  NULL
Parameter7Value 0
Parameter8Name  NULL
Parameter8Value 0

上述事件的參數值 2 至 6 包含詳細的裝置資訊。The above event contains detailed device information in parameter values 2 through 6. 我們在這裡看到了各種 ATA 暫存器值。Here we are looking at various ATA register values. ATA ACS 規格可以用來解碼下面的下載微碼命令失敗值:The ATA ACS specification can be used to decode the below values for failure of a Download Microcode command:

  • 傳回碼:0 (0000 0000) (不適用 - 無意義,因為沒有傳輸任何承載)Return Code: 0 (0000 0000) (N/A - meaningless since no payload was transferred)
  • 功能:15 (0000 1111) (位元 1 設定為 '1',表示「中止」)Features: 15 (0000 1111) (Bit 1 is set to ‘1’ and indicates “abort”)
  • 磁區計數:0 (0000 0000) (不適用)SectorCount: 0 (0000 0000) (N/A)
  • 磁碟機磁頭:160 (1010 0000) (不適用 – 只有過時的位元已設定)DriveHead: 160 (1010 0000) (N/A – only obsolete bits are set)
  • 命令:146 (1001 0010) (位元 1 設定為 '1',表示感應資料可用性)Command: 146 (1001 0010) (Bit 1 is set to ‘1’ indicating the availability of sense data)

這就是說,韌體更新作業已由裝置中止。This tells us that the firmware update operation was aborted by the device.

搭配 Windows 原生 NVMe 驅動程式 (StorNVMe.sys) 使用 NVMe 裝置時,此通道提供類似的偵錯資訊層級。A similar level of debug information is available in this channel when using NVMe devices with the Windows-native NVMe driver (StorNVMe.sys).