]> git.proxmox.com Git - mirror_edk2.git/commit
MdeModulePkg/UsbMass: Fix hot-plug USB CDROM can't be recognized
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 13 Feb 2018 07:21:48 +0000 (15:21 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Thu, 15 Feb 2018 06:17:22 +0000 (14:17 +0800)
commit6461344c318cd43a5494c0302e142a0cbe386d52
treee930429f61098438e8f5c88e02e1c4aa49522e30
parentee33344c595709ef7642c52d27a16f21e692b856
MdeModulePkg/UsbMass: Fix hot-plug USB CDROM can't be recognized

In below calling stack:
UsbBootIsUnitReady()
 UsbBootExecCmdWithRetry()
  UsbBootExecCmd()
    UsbBootRequestSense()
When USB CDROM is hot-plugged, UsbBootRequestSense() retrieves sense
key (6 = UnitAttention), additional sense code (29h = Power ON).
But it wrongly maps such sense data to Device Error status.
It causes UsbBootExecCmd() executed again.
In the second time call to UsbBootExecCmd(), UsbBootRequestSense()
retrieves sense key (6 = UnitAttention), additional sense code
(28h = media changed).

The above analysis explains why hot-plug USB CDROM cannot be
recognized after below commit:
SHA1 a662afb5b023a187ef638d3cb0e0c313ad39a7fc
* MdeModulePkg/UsbStorage: Fix "map -r" cannot detect media change,
which removes the media changed status check in UsbBootDetectMedia().

The proper fix to this problem is to map the ASC (additional sense
code 29h) properly to success status so that no second call to
UsbBootExecCmd() is made.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.h