Acidanthera UEFI Development Kit based on EDK II edk2-stable202311
Go to file
Laszlo Ersek 897efb977f MdeModulePkg/ScsiBusDxe: don't produce ScsiIo for nonexistent LUNs, part 1
The SPC-4 spec says about the INQUIRY data, in "Table 138 -- Peripheral
qualifier":

> Qualifier = 011b  The device server is not capable of supporting a
>                   peripheral device on this logical unit. For this
>                   peripheral qualifier the peripheral device type shall
>                   be set to 1Fh. All other peripheral device type values
>                   are reserved for this peripheral qualifier.

Accordingly, the DiscoverScsiDevice() function returns FALSE if
Peripheral_Qualifier is 3 decimal, but Peripheral_Type differs from 1Fh.
This is a valid sanity check -- such combinations are reserved.

When Peripheral_Qualifier is 3, and Peripheral_Type is 1Fh, then
DiscoverScsiDevice() returns TRUE. While this combination is not reserved,
returning TRUE for it is incorrect: Peripheral_Type 1Fh stands for
"Unknown or no device type", and this combination is returned in
particular when the INQUIRY command was directed to a nonexistent LUN.
Quoting the spec:

> In response to an INQUIRY command received by an incorrect logical unit,
> the SCSI target device shall return the INQUIRY data with the peripheral
> qualifier set to the value defined in 6.4.2. [...]
>
> [...]
>
> The PERIPHERAL QUALIFIER field and PERIPHERAL DEVICE TYPE field identify
> the peripheral device connected to the logical unit. If the SCSI target
> device is not capable of supporting a peripheral device connected to
> this logical unit, the device server shall set these fields to 7Fh
> (i.e., PERIPHERAL QUALIFIER field set to 011b and PERIPHERAL DEVICE TYPE
> field set to 1Fh).

The consequence of this bug is that for each nonexistent Target/LUN pair,
we produce a useless ScsiIo protocol interface. The internal
"ScsiIoDevice->ScsiDeviceType" field will be set to 0x1f, and it will be
returned to higher-level SCSI drivers when they call
ScsiIo->GetDeviceType().

Given that 0x1f means "Unknown or no device type", no higher-level driver
can ever support it, so these ScsiIo protocol interfaces are useless.

The fix is to return FALSE for the (Peripheral_Qualifier=3,
Peripheral_Type=0x1f) combination. With that however we reject the whole
Peripheral_Qualifier=3 space (justifiedly -- see the definition above),
which lets us simplify the code.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2017-08-19 00:38:42 +02:00
AppPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
ArmPkg ArmPkg/ArmDmaLib: use double buffering only for bus master write 2017-08-17 15:32:30 +01:00
ArmPlatformPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
ArmVirtPkg ArmVirtPkg/FdtPL011SerialPortLib: call PL011UartLib in all SerialPortLib APIs 2017-08-17 14:13:23 +02:00
BaseTools BaseTools: Fix Segmentation fault: 11 when build AppPkg with XCODE5 2017-08-14 15:41:40 +08:00
BeagleBoardPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
Conf EDK II: Add .gitignore 2014-10-14 16:08:15 +00:00
CorebootModulePkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
CorebootPayloadPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
CryptoPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
DuetPkg DuetPkg: Fix Xcode 9 Beta treating 32-bit left shift as undefined 2017-08-11 08:44:54 +08:00
EdkCompatibilityPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
EdkShellBinPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
EdkShellPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
EmbeddedPkg EmbeddedPkg/AndroidFastboot: split android boot header 2017-08-07 17:25:57 +01:00
EmulatorPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
FatBinPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
FatPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
IntelFrameworkModulePkg IntelFrameworkModulePkg: Fix Xcode 9 Beta treating 32-bit left shift as undefined 2017-08-11 08:46:15 +08:00
IntelFrameworkPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
IntelFsp2Pkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
IntelFsp2WrapperPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
IntelFspPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
IntelFspWrapperPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
IntelSiliconPkg IntelSiliconPkg/IntelVTdDxe: Update function comments 2017-08-17 11:47:01 +08:00
MdeModulePkg MdeModulePkg/ScsiBusDxe: don't produce ScsiIo for nonexistent LUNs, part 1 2017-08-19 00:38:42 +02:00
MdePkg MdePkg/BaseLib: Update internal LinkedList verifications. 2017-08-16 16:55:32 +08:00
NetworkPkg NetworkPkg/Ip6Dxe: Fix the bug when checking the DataSize 2017-08-17 08:18:27 +08:00
Nt32Pkg Nt32/PlatformBootManagerLib: Enable STD_ERROR on all consoles 2017-08-15 08:30:55 -07:00
Omap35xxPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
OptionRomPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
OvmfPkg OvmfPkg/build.sh: select the GCC49 toolchain settings for gcc-7.* 2017-08-17 11:30:52 +02:00
PcAtChipsetPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
PerformancePkg PerformancePkg DP: Init CustomCumulativeData.MinDur 2017-08-14 16:55:44 +08:00
QuarkPlatformPkg QuarkPlatformPkg/Readme.md: Bring Readme.md up to date 2017-08-10 09:44:24 -07:00
QuarkSocPkg QuarkSocPkg/QNCSmmDispatcher: Fix use after free issue #2 2017-08-16 19:42:17 -07:00
SecurityPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
ShellBinPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
ShellPkg ShellPkg: Update header file including style 2017-08-16 16:55:27 +08:00
SignedCapsulePkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
SourceLevelDebugPkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
StdLib edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
StdLibPrivateInternalFiles edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
UefiCpuPkg UefiCpuPkg/PiSmmCpuDxeSmm: Add CPUID MCA support check 2017-08-17 10:49:50 -07:00
UnixPkg UnixPkg: Remove UnixPkg files (It is replaced by EmulatorPkg) 2013-07-29 21:09:55 +00:00
Vlv2DeviceRefCodePkg edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
Vlv2TbltDevicePkg Vlv2TbltDevicePkg: Remove reference deprecated macro. 2017-08-07 15:28:13 +08:00
.gitignore edk2: Add .DS_Store to .gitignore for macOS 2017-05-19 15:14:34 -07:00
BuildNotes2.txt BaseTools: Updated BuildNotes URLs 2016-03-25 09:46:44 +08:00
Contributions.txt edk2: Fix typo in Contributions.txt 2017-08-16 17:50:44 +08:00
Edk2Setup.bat Edk2Setup.bat: Fix build errors from VS tools PREFIX ENV missing 2016-11-05 09:10:58 +08:00
License.txt edk2: Move License.txt file to root 2017-08-03 11:02:17 -07:00
Maintainers.txt Maintainers.txt: Update the maintainer for SourceLevelDebugPkg 2017-08-17 12:48:19 +08:00
Readme.md edk2: Add Readme.md to root of edk2 repository 2017-08-03 11:02:25 -07:00
edksetup.bat BaseTools: suppress usage instructions with rebuild options 2017-07-04 10:16:13 +08:00
edksetup.sh BaseTools/edksetup.sh: fix invalid test for current working directory 2017-08-10 12:54:58 +08:00

Readme.md

EDK II Project

A modern, feature-rich, cross-platform firmware development environment for the UEFI and PI specifications from www.uefi.org.

Contributions to the EDK II open source project are covered by the TianoCore Contribution Agreement 1.1

The majority of the content in the EDK II open source project uses a BSD 2-Clause License. The EDK II open source project contains the following components that are covered by additional licenses:

The EDK II Project is composed of packages. The maintainers for each package are listed in Maintainers.txt.

Resources