summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
Commit message (Collapse)AuthorAgeFilesLines
* MdeModulePkg/UefiHiiLib: Fix incorrect check for string lengthBi, Dandan2017-08-291-3/+12
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=681 For string opcode,when checking the valid string length, it should exclude the Null-terminated character. And for string in NameValue storage, need to exclude the varname and also need to convert the Config string length to Unicode string length. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg XhciDxe: Fix Map and Unmap inconsistencyStar Zeng2017-08-251-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | We found there are loops of *2* Maps and only *1* Unmap and the DMA buffer address is decreasing. It is caused by the below code flow. XhcAsyncInterruptTransfer -> XhcCreateUrb -> XhcCreateTransferTrb -> Map Urb->DataMap (1) Timer: loops of *2* Maps and only *1* Unmap XhcMonitorAsyncRequests -> XhcFlushAsyncIntMap -> Unmap and Map Urb->DataMap (2) XhcUpdateAsyncRequest -> XhcCreateTransferTrb -> Map Urb->DataMap (3) This patch is to eliminate (3). Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/DriverSample: Add sample case for popup protocolDandan Bi2017-08-235-5/+49
| | | | | | | | | | Add one sample case about how to use HiiPopup protocol to draw message box. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/DisplayEngine: Add implementation of HiiPopup protocolDandan Bi2017-08-235-3/+889
| | | | | | | | | | | Add the implementation of HiiPopup protocol in DisplayEngineDxe, since DisplayEngineDxe is responsible for drawing tasks. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/Library: Remove the self-reference in UdpIoLib/TcpIoLib/IpIoLibJiaxin Wu2017-08-233-6/+3
| | | | | | | | | Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Shao Ming <ming.shao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* MdeModulePkg/ScsiBusDxe: don't produce ScsiIo for nonexistent LUNs, part 2Laszlo Ersek2017-08-191-2/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SPC-4 says about INQUIRY, > 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 INQUIRY command shall > return CHECK CONDITION status only when the device server is unable to > return the requested INQUIRY data. When a device server takes the second branch, and returns CHECK CONDITION for a nonexistent LUN, the InquiryData structure in the DiscoverScsiDevice() function remains filled with the original zeros. DiscoverScsiDevice() then sees zero in both Peripheral_Qualifier and Peripheral_Type, and therefore ScsiBusDxe produces a ScsiIo protocol instance with device type zero, for the nonexistent LUN. Device type zero is EFI_SCSI_TYPE_DISK. Thus ScsiDiskDxe binds the bogus ScsiIo protocol interface, and produces a similarly bogus BlockIo interface on top. This ripples up to BDS, where UefiBootManagerLib can auto-generate bogus UEFI boot options for the nonexistent LUNs. This has been encountered with QEMU, after commit ded6ddc5a7b9 ("scsi: clarify sense codes for LUN0 emulation", 2017-08-04). QEMU now answers INQUIRY commands that were directed to nonexistent LUNs with: > DiscoverScsiDevice:1361: Lun=2 HostAdapterStatus=0 TargetStatus=2 > SenseDataLength=18 InquiryDataLength=96 > Sense { > Sense 000000 70 00 05 00 00 00 00 0A 00 00 00 00 25 00 00 00 > Sense 000010 00 00 > Sense } > Inquiry { > Inquiry 000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > Inquiry 000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > Inquiry 000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > Inquiry 000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > Inquiry 000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > Inquiry 000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 > Inquiry } The interesting fields are: - HostAdapterStatus=0 (OK), - TargetStatus=2 (CHECK CONDITION), - Sense/Error_Code=0x70 (Current error, Fixed description) - Sense/Sense_Key=0x05 (ILLEGAL REQUEST) According to SPC-4 "Table 41 -- Sense key descriptions (part 2 of 2)", ILLEGAL REQUEST is justified when "the command was addressed to an incorrect logical unit number". Thus, recognize this kind of answer for nonexistent LUNs. ( Checking the status fields and the sense data is justified anyway, according to the documentation of ScsiInquiryCommand(): > @retval EFI_SUCCESS The command was executed > successfully. See > HostAdapterStatus, > TargetStatus, SenseDataLength, > and SenseData in that order for > additional status information. ) 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>
* MdeModulePkg/ScsiBusDxe: remove redundant "else" after "break" statementLaszlo Ersek2017-08-191-3/+4
| | | | | | | | | | | | | | | The code after the "if" statement is only reachable if the first branch with the "break" is not taken. Therefore we can move the "else" branch after the "if" statement, simplifying 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>
* MdeModulePkg/ScsiBusDxe: don't produce ScsiIo for nonexistent LUNs, part 1Laszlo Ersek2017-08-191-9/+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>
* MdeModulePkg: Delete useless case codeSong, BinX2017-08-162-21/+0
| | | | | | | | | | | - Delete useless case code to fix /WHOLEARCHIVE build error with VS2015 tool chain Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bell Song <binx.song@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg: Delete never touched codeSong, BinX2017-08-162-4/+2
| | | | | | | | | | - Delete never touched code Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bell Song <binx.song@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg DxeCore: Enhance "ConvertPages: Incompatible memory types"Star Zeng2017-08-141-2/+7
| | | | | | | | | | | | | | | | | | | | When double free pages by FreePages() or allocate allocated pages by AllocatePages() with AllocateAddress type, the code will print debug message "ConvertPages: Incompatible memory types", but the debug message is not very obvious for the error paths by FreePages() or AllocatePages(). Refer https://lists.01.org/pipermail/edk2-devel/2017-August/013075.html for the discussion. This patch is to enhance the debug message for the error paths by FreePages() or AllocatePages. Cc: Liming Gao <liming.gao@intel.com> Cc: Andrew Fish <afish@apple.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg DxeCore: Fix double free pages on LoadImage failure pathStar Zeng2017-08-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=667 reported there is double free pages on LoadImage failure path. CoreLoadPeImage() ... return EFI_SUCCESS; Done: // // Free memory. // if (DstBufAlocated) { CoreFreePages (Image->ImageContext.ImageAddress, Image->NumberOfPages); } ... CoreUnloadAndCloseImage() ... if ((Image->ImageBasePage != 0) && FreePage) { CoreFreePages (Image->ImageBasePage, Image->NumberOfPages); } ... This patch is to follow the suggestion at https://lists.01.org/pipermail/edk2-devel/2017-August/013112.html to set Image->ImageContext.ImageAddress and Image->ImageBasePage to 0 after the free in CoreLoadPeImage(). Cc: Liming Gao <liming.gao@intel.com> Cc: Andrew Fish <afish@apple.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/UefiBootManagerLib: Support DNS device path descriptionJiaxin Wu2017-08-141-2/+11
| | | | | | | | | | | This patch is to update UEFI Boot manager to support DNS device path for HTTP(S) network boot. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* MdeModulePkg/EmmcDxe: Make sure no extra data is erased by EraseBlocksHao Wu2017-08-141-4/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | V3 changes: Add debug messages for new return path when successfully erase the specified blocks. Refine logic for calculating the size for writing zeros to device. V2 changes: The Trim command is not supported on all eMMC devices. For those devices that do not support such command, add codes to handle the scenario. Commit message: The current implementation of the Erase Block Protocol service EraseBlocks() uses the erase command. According to spec eMMC Electrical Standard 5.1, Section 6.6.9: The erasable unit of the eMMC is the "Erase Group"; Erase group is measured in write blocks that are the basic writable units of the Device. ... When the Erase is executed it will apply to all write blocks within an erase group. However, code logic in function EmmcEraseBlocks() does not check whether the blocks to be erased form complete erase groups. Missing such checks will lead to erasing extra data on the device. This commit will: a. If the device support the Trim command, use the Trim command to perform the erase operations for eMMC devices. According to the spec: Unlike the Erase command, the Trim function applies the erase operation to write blocks instead of erase groups. b. If the device does not support the Trim command, use the Erase command to erase the data in the erase groups. And write zeros to those blocks that cannot form a complete erase group. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/Ip4Dxe: Support SetData interface to clear specific configurationJiaxin Wu2017-08-111-95/+190
| | | | | | | | | | | UEFI Spec 2.7 adds the clarification on SetData interface usage to clear specific individual data types. This patch is to support this feature. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* MdeModulePkg: Variable: Fix typo in variable measureZhang, Chao B2017-08-091-1/+1
| | | | | | | | | | Fix variable measure debug message typo. Cc: Star Zeng <star.zeng@intel.com> Cc: Yao Jiewen <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chao Zhang <chao.b.zhang@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/NvmExpressDxe: Notify NVME HW when system reset happensRuiyu Ni2017-08-094-4/+210
| | | | | | | | | | | | | | | | | | | | | Per NVM Express Spec, software should notify NVME HW when shutdown occurs. The NVME controller requires notification for shutdown as part of its management of internal structures. Even with FUA, failing to notify the NVME controller to shutdown power off causes the NVME controller to take quite some time to organize its tables on the next power on. This time exceeds the normal timeout, so we would fail to boot the NVME disk. The host should set the Shutdown Notification (CC.SHN) field to 01b to indicate a normal shutdown operation. The controller indicates when shutdown processing is completed by updating the Shutdown Status (CSTS.SHST) field to 10b. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg SerialDxe: Process timeout consistently in SerialReadStar Zeng2017-08-081-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | https://lists.01.org/pipermail/edk2-devel/2017-July/012385.html reported the timeout processing in SerialRead is not consistent. Since SerialPortPoll only checks the status of serial port and returns immediately, and SerialPortRead does not really implement a time out mechanism and will always wait for enough input, it will cause below results: 1. If there is no serial input at all, this interface will return timeout immediately without any waiting; 2. If there is A characters in serial port FIFO, and caller requires A+1 characters, it will wait until a new input is coming and timeout will not really occur. This patch is to update SerialRead() to check SerialPortPoll() and read data through SerialPortRead() one byte by one byte, and check timeout against mSerialIoMode.Timeout if no input. Cc: Heyi Guo <heyi.guo@linaro.org> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/DisplayEngine: Fix incorrect display issueDandan Bi2017-08-041-10/+52
| | | | | | | | | | | | | | In a form, some new menus may be dynamically inserted between highlight menu and previous top of screen menu when some question are refreshed. So the highlight menu and previous top of screen menu perhaps can't be shown in one page. Existing codes miss to handle this case then will cause incorrect display.This patch is to fix this display issue. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg PeiCore: Install SEC HOB dataStar Zeng2017-08-044-3/+110
| | | | | | | | | | | | | If the EFI_SEC_HOB_DATA_PPI is in the list of PPIs passed to the PEI entry point, the PEI Foundation will call the GetHobs() member function and install all HOBs returned into the HOB list. It does this after installing all PPIs passed from SEC into the PPI database and before dispatching any PEIMs. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* edk2: Move License.txt file to rootMichael D Kinney2017-08-031-25/+0
| | | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=642 Add top level License.txt file with the BSD 2-Clause License that is used by the majority of the EKD II open source project content. Merge copyright statements from the BSD 2-Clause License files in each package directory and remove the duplication License.txt file from package directories. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Andrew Fish <afish@apple.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* edk2: Move TianoCore Contribution Agreement to rootMichael D Kinney2017-08-031-218/+0
| | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=629 Move Contributions.txt that contains the TianoCore Contribution Agreement 1.0 to the root of the edk2 repository and remove the duplicate Contributions.txt files from all packages. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Andrew Fish <afish@apple.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
* MdeModulePkg/Ufs: Set 'Data Segment Length' field for Write DescriptorHao Wu2017-08-022-0/+6
| | | | | | | | | | | | According to the Universal Flash Storage (UFS) Version 2.1 (JESD220C) spec Section 10.7.8.5, the DATA SEGMENT LENGTH field of the UPIU shall also be set to number of descriptor bytes to write. The origin codes miss the above operation. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/UfsPassThruDxe: Add impl of UFS Device Config ProtocolHao Wu2017-08-025-14/+383
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/DxeHttpLib: Fix spelling typo in EFI_HTTP_STATUS_CODEJiaxin Wu2017-08-021-1/+1
| | | | | | | | | | | | | "HTTP_STATUS_300_MULTIPLE_CHIOCES" This should instead be: "HTTP_STATUS_300_MULTIPLE_CHOICES" Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com>
* MdeModulePkg FirmwarePerfPei: Remove SEC performance data getting codeStar Zeng2017-08-013-47/+6
| | | | | | | | | | | | | | | | | Current SEC performance data getting code in FirmwarePerformancePei may get wrong SEC performance data if FirmwarePerformancePei executes after memory discovered. And as SecCore has added SecPerformancePpiCallBack to get SEC performance data and build HOB to convey the SEC performance data to DXE phase. This patch is to remove the SEC performance data getting code in FirmwarePerformancePei. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg PeiCore: Handle notification PPI from SECStar Zeng2017-08-013-19/+142
| | | | | | | | | | InstallPpi() will be used for normal PPI in PPI list from SEC, and NotifyPpi() will be used for notification PPI in PPI list from SEC. Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg PiSmmCoreMemoryAllocLib: Fix a FreePool() assertion issueStar Zeng2017-08-011-4/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | When PiSmmCore links against PeiDxeDebugLibReportStatusCode, the code flow below will cause a FreePool() assertion issue. PiSmmCoreMemoryAllocationLibConstructor() -> SmmInitializeMemoryServices() -> DEBUG ((DEBUG_INFO, "SmmAddMemoryRegion\n")) in SmmAddMemoryRegion() -> DebugPrint() -> REPORT_STATUS_CODE_EX() -> ReportStatusCodeEx() -> AllocatePool()/FreePool(PiSmmCoreMemoryAllocLib) -> ASSERT() at Head = CR (Buffer, POOL_HEAD, Data, POOL_HEAD_SIGNATURE) in CoreFreePoolI() of DxeCore Pool.c It is because at the point of FreePool() in the code flow above, mSmmCoreMemoryAllocLibSmramRanges/mSmmCoreMemoryAllocLibSmramRangeCount are not been initialized yet, the FreePool() will be directed to gBS->FreePool(), that is wrong. This patch is to temporarily use BootServicesData to hold the SmramRanges data before calling SmmInitializeMemoryServices(). Cc: Liming Gao <liming.gao@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/PciBus: Avoid hang when BUS pad resource is not in topRuiyu Ni2017-07-281-2/+4
| | | | | | | | | | | | PciScanBus() assumes the GetResourcePadding() puts BUS descriptor in the very beginning, if it's not, the Descriptors will be updated to point to middle of the pool buffer, which can cause FreePool(Descriptors) hang in DEBUG image. No functionality impact to RELEASE image. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/BMMUiLib: Check reset requirement before exiting UiAppBi, Dandan2017-07-273-1/+52
| | | | | | | | | | | | | | V2: Refine the comments. In UI page, some configuration change may require system reset. BootMaintenanceManagerUiLib misses this check before exiting UiApp to boot other boot options. Now add the check. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/BMUiLib: Check reset requirement before exiting UiAppBi, Dandan2017-07-273-3/+55
| | | | | | | | | | | | | | V2: Refine the comments. In UI page, some configuration change may require system reset. BootManagerUiLib misses this check before exiting UiApp to boot other boot options. Now add the check. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/SetupBrowser: Record the reset status in all SendFormBi, Dandan2017-07-273-13/+20
| | | | | | | | | | | | | | | | | After calling SendForm to enter front page, configuration change in some driver may require system reset. Currently the reset status is saved in SendForm level. Then SendForm can return the reset status. IsResetRequired API also can return the reset status before exiting browser. It return the reset status in current SendForm level now. But SendForm can be recursive called by some module.so the reset status in previous SendForm may be lost. Now change the IsResetRequired API to return the reset info no matter the reset is caught in any SendForm. Cc: Eric Dong <eric.dong@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg Xhci: Also RecoverHaltedEndpoint for BABBLE_ERRORStar Zeng2017-07-262-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=644 According to XHCI spec: 4.10.2.1 Stall Error 4.10.2.4 Babble Detected Error When a device transmits more data on the USB than the host controller is expecting for a transaction, it is defined to be babbling. In general, this is called a Babble Error. When a device sends more data than the TD Transfer Size bytes (TD Babble), unexpected activity that persists beyond a specified point in a (micro)frame (Frame Babble), or a packet greater than Max Packet Size (Packet Babble), the host controller shall set the Babble Detected Error in the Completion Code field of the TRB, generate an Error Event, and halt the endpoint (refer to Section 4.10.2.1). This patch is to also check for EFI_USB_ERR_BABBLE error returned as a TransferResult and then proceed to XhcRecoverhaltedEndPoint. Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg SmmLockBoxDxeLib: Get SmmCommRegion for COMM bufferStar Zeng2017-07-262-58/+147
| | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=593 Currently, SmmCommunciate fails in RestoreLockBox after SmmReadyToLock since COMM buffer is in stack instead of using SmmCommRegion by gEdkiiPiSmmCommunicationRegionTableGuid. This patch is to get SmmCommRegion by gEdkiiPiSmmCommunicationRegionTableGuid for COMM buffer Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Baraneedharan Anbazhagan <anbazhagan@hp.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg: Update NonDiscoverableDeviceRegistrationLib file header formatLiming Gao2017-07-261-2/+2
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg SmmAccess: Update comments to follow PI spec.Eric Dong2017-07-201-2/+3
| | | | | | | | | Cc: Jeff Fan <jeff.fan@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/DxeCore: Avoid accessing non-owned memoryRuiyu Ni2017-07-181-27/+27
| | | | | | | | | | | | | | | | | | | | The patch fixes two kinds of bugs in DxeCore that accesses memory which might be freed or owned by other modules. The two bugs don't cause functionality issue. 1. CoreValidateHandle() checks whether the handle is valid by validating its signature. The proper way is to check whether the handle is in the handle database. 2. CoreDisconnectControllersUsingProtocolInterface() and CoreOpenProtocol() de-reference Link pointer which is already freed. The proper way is to not de-reference the pointer. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/XhciDxe: Make comments align with functionBi, Dandan2017-07-111-0/+1
| | | | | | | | | Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/PartitionDxe: Add impl of Partition Information ProtocolHao Wu2017-07-116-88/+135
| | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Bret Barkelew <brbarkel@microsoft.com> Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg/EmmcDxe: Implementation of Disk Information ProtocolHao Wu2017-07-065-3/+281
| | | | | | | | | Adds the implementation of Disk Information Protocol for EMMC devices per PI 1.6 spec. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/SdDxe: Implementation of Disk Information ProtocolHao Wu2017-07-065-3/+277
| | | | | | | | | Adds the implementation of Disk Information Protocol for SD devices per PI 1.6 spec. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/NvmExpressDxe: Handle timeout for blocking PassThru reqHao Wu2017-07-061-1/+133
| | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=433 When a blocking NVMe PassThru request experiences timeout, the current codes in function NvmExpressPassThru() do not abort the timeout request while advancing synchronous Submission Queue tail. Therefore, it is possible to submit a new blocking PassThru request when the synchronous Submission Queue is full. The commit adds logic to abort the timeout request by resetting the NVMe controller when a timeout occurs for a blocking PassThru request. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/XhciDxe: Check timeout URB again after stopping endpointRuiyu Ni2017-07-054-29/+90
| | | | | | | | | | | This fixes BULK data loss when transfer is detected as timeout but finished just before stopping endpoint. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Feng Tian <feng.tian@intel.com>
* MdeModulePkg/XhciDxe: Separate common logic to XhcTransferRuiyu Ni2017-07-051-166/+132
| | | | | | | | | | | | The patch separates the common logic in XhcControlTransfer, XhcBulkTransfer and XhcSyncIntTransfer to a sub-routine XhcTransfer. It doesn't have functionality impact. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Feng Tian <feng.tian@intel.com>
* MdeModulePkg/XhciDxe: Dump the CMD/EVENT/INT/BULK ring informationRuiyu Ni2017-07-051-3/+24
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Feng Tian <feng.tian@intel.com>
* MdeModulePkg/XhciDxe: Refine IsTransferRingTrb and IsAsyncIntTrbRuiyu Ni2017-07-051-46/+44
| | | | | | | | | | | | | Current implementation of IsTransferRingTrb only checks whether the TRB is in the RING of the URB. The patch enhanced the logic to check that whether the TRB belongs to the transaction of URB. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Feng Tian <feng.tian@intel.com>
* MdeModulePkg CapsuleApp: Fix print info in BuildGatherList()Star Zeng2017-07-031-1/+1
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=614 Print (L"CapsuleApp: capsule data starts at 0x%X with size 0x%X\n", (UINTN) CapsuleBuffer, FileSize); It should use (UINTN) CapsuleBuffer[Index] and FileSize[Index] as parameter. Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Cloud Wang <winggundum82@163.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg ResetSystem: Update the comments of ResetSystem()Star Zeng2017-07-032-1/+12
| | | | | | | | | | | Update the comments of ResetSystem() that was missed by 37078045d717 and 28426918f0ea. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/ResetSystem: Implement ResetNotification protocolRuiyu Ni2017-07-034-16/+161
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/ResetSystem: Remove unnecessary global variableRuiyu Ni2017-07-031-7/+4
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>