summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
Commit message (Collapse)AuthorAgeFilesLines
* MdeModulePkg/XhciDxe: fix a bug on TRB check in async int transferFeng Tian2016-07-251-1/+5
| | | | | | | | | | | | | The last TRB in transfer ring is a LINK type TRB, which shouldn't be accounted as a valid item in IsAsyncIntTrb(). Without this fix, the original algo will bring issue on those URBs whose TRBs crosses the transfer ring. Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/UsbBus: reduce the port status polling before port resetFeng Tian2016-07-252-29/+19
| | | | | | | | | | | | | | | | | | This change is used to remove the port status polling in port reset functions. Why it's needed is because: 1) The same polling on same port has taken place prior to this removed one. See UsbEnumeratePort()->GetPortStatus(). So this polling in UsbEnumerateNewDev()->ResetPort() is redundant. 2) EDKII Xhci driver hooks all GetPortStatus() operations. If we don't remove this one, XHCI driver's XhcPollPortStatusChange() may enter twice in reset process and wrongly think the device is unplugged. Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/UsbBus: remove redundant host controller reset in UsbBusFeng Tian2016-07-251-4/+1
| | | | | | | | | | | The Host Controller reset has been done at EDKII UHCI/EHCI/XHCI, The original code will do twice host controller initialization which is unnecessary. It also bring issues on some USB HCs. Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg RamDiskDxe: Not use hardcode 'SectionInstance' to locate SSDTHao Wu2016-07-201-22/+36
| | | | | | | | | | | | This commit will scan all the EFI raw section instances within the module's FV to make sure the NVDIMM root device SSDT can be properly located. Cc: Feng Tian <feng.tian@intel.com> Cc: Zhang Chao B <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
* MdeModulePkg/PciHostBridgeDxe: fix Ia32 GCC44 build errorLaszlo Ersek2016-07-181-1/+1
| | | | | | | | | | | | | | | | | > cc1: warnings being treated as errors > MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c: > In function 'GetProposedResources': > MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.c:1388: > error: integer constant is too large for 'long' type Append a ULL suffix to the replacement text of PCI_RESOURCE_LESS that is aligned with the style of the EFI_RESOURCE_SATISFIED and EFI_RESOURCE_NOT_SATISFIED macros. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg: Fix bug in TCP which not sending out ACK in certain circumstance.Fu Siyuan2016-07-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Consider the situation as shown in below chart. The last ACK message has acknowledged the Tcb->RcvWl2, and all the segments until Tcb->RcvNxt have been received by TCP driver. The Tcb->RcvNxt is not acknowledged due to the delayed ACK. In this case an incoming segment (Seg->Seq, Seg->End) should not be accepted by TCP driver, and an immediate ACK is required. Current TcpSeqAcceptable() thought it’s an acceptable segment incorrectly, it continues the TcpInput() process instead of sending out an ACK and droping the segment immediately. Tcb->RcvWl2 Tcb->RcvNxt Tcb->RcvWl2 + Tcb->RcvWnd Seg->Seq Seg->End | | | | | | | ---+-----+---------------+-------------+--------------------------+----------- <income segment> <----Acceptable Range--- --> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-By: Eugene Cohen <eugene@hp.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-By: Ye Ting <ting.ye@intel.com>
* MdeModulePkg/PciBusDxe: recognize hotplug-capable PCIe portsLaszlo Ersek2016-07-132-0/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Section 7.8.2 of the PCI Express specification (r4.0 v0.3), entitled "PCI Express Capabilities Register (Offset 02h)", and section 7.8.9 "Slot Capabilities Register (Offset 14h)" of the same, describe the conditions when a PCIe port should be considered "supporting hotplug": - it should be a root complex port or a switch downstream port, and - it should have the "Slot Implemented" bit set in the Express Capabilities Register, and - it should have the "Hot-Plug Capable" bit set in the Slot Capabilities Register. The first two sub-conditions are already implemented in at least two open source projects I could find: - in SeaBIOS by Marcel Apfelbaum: "hw/pci: reserve IO and mem for pci express downstream ports with no devices attached" <https://code.coreboot.org/p/seabios/source/commit/3aa31d7d6375>, - in edk2 itself, in the implementation of the "PCI" UEFI Shell command: see the "PcieExplainTypeSlot" case label in function PciExplainPciExpress(), file "ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c". PciBusDxe recognizes such PCIe ports as bridges, but it doesn't realize they support hotplug. In turn PciBusDxe omits getting any resource padding information from the platform's EFI_PCI_HOT_PLUG_INIT_PROTOCOL for these bridges: GatherPpbInfo() [PciEnumeratorSupport.c] GetResourcePaddingPpb() [PciResourceSupport.c] GetResourcePaddingForHpb() [PciHotPlugSupport.c] IsPciHotPlugBus() [PciHotPlugSupport.c] // // returns FALSE // // // the following is not reached: // gPciHotPlugInit->GetResourcePadding() Implement a function called SupportsPcieHotplug() for identifying such ports, and call it from IsPciHotPlugBus() (after the call to IsSHPC()). Cc: "Johnson, Brian J." <bjohnson@sgi.com> Cc: Alex Williamson <alex.williamson@redhat.com> Cc: Andrew Fish <afish@apple.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Marcel Apfelbaum <marcel@redhat.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ruiyu Ni <Ruiyu.ni@intel.com>
* MdeModulePkg/PciBusDxe: look for the right capability in IsSHPC()Laszlo Ersek2016-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PCI Hot Plug capability register block is marked with capability ID 0x0C (EFI_PCI_CAPABILITY_ID_SHPC), not 0x06 (EFI_PCI_CAPABILITY_ID_HOTPLUG). This bug prevents PciBusDxe from recognizing whether a PCI-to-PCI bridge supports hotplug. In turn the platform's EFI_PCI_HOT_PLUG_INIT_PROTOCOL is not consulted for resource padding information: GatherPpbInfo() [PciEnumeratorSupport.c] GetResourcePaddingPpb() [PciResourceSupport.c] GetResourcePaddingForHpb() [PciHotPlugSupport.c] IsPciHotPlugBus() [PciHotPlugSupport.c] IsSHPC() [PciHotPlugSupport.c] // // returns FALSE // // // the following is not reached: // gPciHotPlugInit->GetResourcePadding() Look for the correct capability ID. Cc: "Johnson, Brian J." <bjohnson@sgi.com> Cc: Alex Williamson <alex.williamson@redhat.com> Cc: Andrew Fish <afish@apple.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Marcel Apfelbaum <marcel@redhat.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Ruiyu Ni <Ruiyu.ni@intel.com>
* MdeModulePkg AtaBusDxe: Fix ATA commands cannot be sent to some devicesHao Wu2016-07-121-3/+3
| | | | | | | | | | | | If there is no port multiplier (PortMultiplierPort = 0xFFFF), current code in functions TransferAtaDevice() and TrustTransferAtaDevice() will always set the DEV bit of the ATA device register. It causes that ATA commands cannot be sent to some ATA hard drives. Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
* MdeModulePkg: Fix build error in the PXE driver.Fu Siyuan2016-07-121-1/+1
| | | | | | | Fix the build error introduced by 0a28d02d9fb5293757c507e592a4d0404a7ecf74. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
* MdeModulePkg MemoryProfile: ASSERT to ensure 'DriverInfoData' is not NULLHao Wu2016-07-122-0/+2
| | | | | | | | | | | | Code logic ensures that the pointer 'DriverInfoData' will not be NULL when it is used. Add ASSERT as warning for case that will not happen. Cc: Star Zeng <star.zeng@intel.com> 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: Update PXE driver to follow edk2 coding standards.Fu Siyuan2016-07-122-4/+4
| | | | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-by: Samer El-Haj-Mahmoud <smahmoud@lenovo.com> Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
* MdeModulePkg: Fix typos in comments and variablesGiri P Mudusuru2016-07-1145-200/+200
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - abstrated to abstracted - accessibla to accessible - addres to address - apropriate to appropriate - arry to array - availabe to available - avaliable to available - becasue to because - correponding to corresponding - etablished to established - exeuction to execution - extensiable to extensible - fileds to fields - loadding to loading - ptototypes to prototypes - prococol protocol - requried to required - resoruce to resource - runing to running - uild to build Cc: Star Zeng <star.zeng@intel.com> Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Giri P Mudusuru <giri.p.mudusuru@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
* MdeModulePkg SdBlockIoPei: Initialize 'SwitchResp' elements before usingHao Wu2016-07-111-0/+1
| | | | | | | | | | The commit makes sure that the elements in array 'SwitchResp' get initialized before being used. Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
* MdeModulePkg MemoryProfile.h:two bytes of Reserved[4] as ActionStringOffsetStar Zeng2016-07-091-3/+2
| | | | | | | | | | | | | | | | | | | | At 94092aa60341a3e4b1e1ea7c362781b8404ac538, we extended MEMORY_PROFILE_ALLOC_INFO to add ActionStringOffset and Reserved2[6] fields, that was not aware the Reserved[4] field can be reused to have better memory profile database size efficiency. With the patch, PcdMemoryProfilePropertyMask|0x3 and PcdMemoryProfileMemoryType|0xffff, the memory profile database size can be reduced as below on my sample platform. UefiMemoryProfileSize - 0x1597A8 -> UefiMemoryProfileSize - 0x12AB28 SmramProfileSize - 0xCF68 -> SmramProfileSize - 0xB8E8 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: Jiewen Yao <jiewen.yao@intel.com>
* ArmPkg ArmVirtPkg MdeModulePkg: switch to separate ArmMmuLibArd Biesheuvel2016-07-072-2/+2
| | | | | | | | | | | | Switch all users of ArmLib that depend on the MMU routines to the new, separate ArmMmuLib. This needs to occur in one go, since the MMU routines are removed from ArmLib build at the same time, to prevent conflicting symbols. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg/BootMaintUiLib: Update menus when open BMM formDandan Bi2016-07-073-9/+46
| | | | | | | | | | | | | | | | BootMaintenanceManagerUiLib depend on the LeagcyBootMaintUiLib to show the legacy menus. So we need to do the actions related to LegacyUi in BMM after the LeagcyBootMaintUiLib have been initialized. So now : 1). update menus (including legacy menus), 2) re-scan boot options (including legacy boot option) when opening the BMM form. We think when opening BMM form, the LeagcyBootMaintUiLib must have been initialized. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@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> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDB: Record fail info if fail to save data for EfiVarStoreDandan Bi2016-07-071-0/+3
| | | | | | | | | | | | | | | | | HiiConfigRoutingRouteConfig function returns 'Progress' to indicate the failure info in the ConfigResp string. But when fail to route the ConfigResp for EfiVarStore, it doesn't return the correct failure info. Now this patch is to fix this issue and add debug info let user know the reason of failure. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Chao Zhang <chao.b.zhang@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> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
* MdeModulePkg/Bds: MemoryTypeInformation excludes boot option mem useRuiyu Ni2016-07-073-40/+19
| | | | | | | | | | | | The patch re-orders the sequences by putting updating memory type information before loading the boot option so that the reserved memory usage by HTTP RAM disk boot can be excluded by the memory type information updating. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Sunny Wang <sunnywang@hpe.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
* MdeModulePkg: Fix IPv4 stack potential disappeared issueJiaxin Wu2016-07-073-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | IP4_CONFIG2_INSTANCE->DataItem is used to save the configuration data to NV variable. When the policy is changed from static to DHCP, DnsServers info will be cleaned from DataItem first (See Ip4Config2SetPolicy), it's correct because DnsServers info should not be saved to NV variable. But if there is any DnsServers info received from DHCP message, it will be reset to DataItem again (See Ip4Config2SetDnsServerWorker), which may cause the NV variable contain the DnsServers info while the policy is DHCP (See Ip4Config2WriteConfigData). Then, while the platform is reset, the issue happened. Because Ip4Config2DataTypeDnsServer is set under DHCP policy, which is not allowed by UEFI Spec and error returned. This patch is used to resolve this potential issue. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Zhang Lubo <lubo.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Zhang Lubo <lubo.zhang@intel.com> Reviewed-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
* MdeModulePkg/BootMaintUi: Add error handling codes when AllocatePool failBi, Dandan2016-07-063-26/+35
| | | | | | | | | | | | | | The AllocateCopyPool in function ExtractFileNameFromDevicePath may return NULL, so need to do error handling. This patch is to add error handling codes for function ExtractFileNameFromDevicePath and its caller functions. Cc: Eric Dong <eric.dong@intel.com> Cc: Hao Wu <hao.a.wu@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> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/UefiHiiLib: Add error handling codes when AllocatePool failBi, Dandan2016-07-061-2/+12
| | | | | | | | Cc: Eric Dong <eric.dong@intel.com> Cc: Hao Wu <hao.a.wu@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 UefiPxeBcDxe: Fix build error for lastest VS2015 compilerHao Wu2016-07-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | The UefiPxeBcDxe module encounters a build error for IA32 arch using the latest version of VS2015: UefiPxe4BcDxe.lib(PxeBcDhcp.obj) : error LNK2001: unresolved external symbol __allmul The cause is line 1659 in file MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcDhcp.c. The third parameter for gBS->SetTimer() function is of type UINT64, so the multiplication should use the MultU64x32() function. Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Cc: Wu Jiaxin <jiaxin.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com> Reviewed-By: Wu Jiaxin <jiaxin.wu@intel.com>
* MdeModulePkg: Skip registering BootManagerMenu if absentSunny Wang2016-07-053-25/+70
| | | | | | | | | | | | | | | | | This is a enhancement to support the case when platform firmware doesn't support Boot Manager Menu. For now, if BootManagerMenu FFS can not be retrieved from FV, BDS core code will still register a boot option for it. Then, this non-functional boot option will still be booted by user's request (like HotKey or Exit from shell) to cause additional boot time and error status code reported. Therefore, it would be good to skip BootManagerMenu boot option registration and then return error status and Invalid BootOption data for this case so that the BootManagerBoot() or other consumers can directly return without doing anything. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Sunny Wang <sunnywang@hpe.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
* MdeModulePkg MemoryProfileInfo: Handle "/" character in the PDB pathStar Zeng2016-07-051-1/+1
| | | | | | | 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg DxeIplPeim: Add ASSERTs for unexpected AllocatePages failureHao Wu2016-07-051-1/+3
| | | | | | | | Cc: Star Zeng <star.zeng@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> 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 MemoryProfile: Add ASSERTs to make sure pointers are not NULLHao Wu2016-07-052-0/+6
| | | | | | | | | | | | Code logic ensures that both pointers 'DriverInfoData' and 'AllocInfoData' will not be NULL when they are used. Add ASSERTs as warning for cases that will not happen. Cc: Star Zeng <star.zeng@intel.com> 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/EmmcDxe: Don't expose BlockIo interface for RPMB partitionFeng Tian2016-07-011-93/+45
| | | | | | | | | | | | | This change is to avoid UEFI SCT failure as UEFI SCT has no knowledge about how to accessing a EMMC RPMB partition. The user needs to access RPMB partition should get access through EFI_SD_MMC_PASS_THRU protocol with authentication key & mac. Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg/SdMmc: update TPL to notify to fix UEFI SCT hangFeng Tian2016-07-015-40/+75
| | | | | | | | | | | | | | | | | | We have to upgrade the TPL level used by SdMmc stack because the following flow: DiskIo2ReadWriteDisk() in logical partition -> PartitionReadBlocksEx() in logical partition at TPL callback level -> ProbeMediaStatusEx() with sync request -> DiskIo2ReadWriteDisk() in physical partition -> waiting for async task completion. if the low layer driver doesn't run at TPL_NOTIFY level, it will have no time to trigger async task and cause system hang. Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
* MdeModulePkg PiSmmCoreMemoryAllocLib: Extend to support MemoryProfileLibStar Zeng2016-07-019-23/+490
| | | | | | | 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg DxeCoreMemoryAllocationLib: Extend to support MemoryProfileLibStar Zeng2016-07-019-29/+503
| | | | | | | 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg: Implement new library instance SmmMemoryAllocationProfileLibStar Zeng2016-07-015-0/+1369
| | | | | | | 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg: Implement new library instance UefiMemoryAllocationProfileLibStar Zeng2016-07-015-0/+1236
| | | | | | | 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg: Introduce new library class MemoryProfileLibStar Zeng2016-07-012-0/+57
| | | | | | | | | Provides services to record memory profile of multilevel caller. 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg MemoryProfileInfo: Enhance output info for memory leak detectionStar Zeng2016-07-012-162/+725
| | | | | | | 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg PiSmmCore: Enhance memory profile for memory leak detectionStar Zeng2016-07-016-315/+1110
| | | | | | | | | | | | | 1. Produce SMM memory profile protocol. 2. Consume PcdMemoryProfilePropertyMask to support disable recording at the start. 3. Consume PcdMemoryProfileDriverPath to control which drivers need memory profile data. 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg DxeCore: Add lock to pretect memory profile AllocInfo listStar Zeng2016-07-011-0/+26
| | | | | | | 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg DxeCore: Enhance memory profile for memory leak detectionStar Zeng2016-07-015-233/+657
| | | | | | | | | | | | | | 1. Implement include GetRecordingState/SetRecordingState/Record for memory profile protocol. 2. Consume PcdMemoryProfilePropertyMask to support disable recording at the start. 3. Consume PcdMemoryProfileDriverPath to control which drivers need memory profile data. 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg: Extend memory profile definitions for memory leak detectionStar Zeng2016-07-013-11/+213
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current memory profile feature: 1. Shows which line of code calls gBS->AllocateXXX(). But most entries are from MemoryAllocationLib. 2. Records at the start. 3. Records all modules. Enhanced memory profile feature: 1. User can know which line of code calls AllocateXXX() API instead of gBS->Allocate(). 2. User can know which line of code calls a specific API that will call AllocateXXX(). 3. User can know total memory allocated by a specific line of code. 4. User can configure to record single module. 5. User can configure when to enable recording. 6. User can know RVA<->Symbol (Function, Source, Line). For the enhanced memory profile feature, 1. Extend MEMORY_PROFILE_DRIVER_INFO to include PdbString. 2. Extend MEMORY_PROFILE_ALLOC_INFO to include ActionString. 3. Extend MEMORY_PROFILE_ACTION to indicate action in memory allocation lib and user defined action. 4. Extend memory profile protocol to include GetRecordingState/ SetRecordingState/Record. 5. Define SMM memory profile protocol. 6. Extend PcdMemoryProfilePropertyMask to support disable recording at the start. 7. Introduce new PCD PcdMemoryProfileDriverPath to control which drivers need memory profile data. 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg/PiSmmCore: Replace BASE_4GB with MAX_ADDRESS check.Jiewen Yao2016-07-012-2/+2
| | | | | | | | | | | | | | | PI specification Vol 4 - SMM does not have any limitation of BASE_4GB for SMM. So we should replace BASE_4GB check with MAX_ADDRESS check to make sure the SMM memory is accessible by SMM Core. Cc: Jeff Fan <jeff.fan@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
* MdeModulePkg VariableInfo: Fix GCC build failureStar Zeng2016-06-301-0/+1
| | | | | | | | | GCC build failure: 'RealCommSize' may be used uninitialized 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: Giri P Mudusuru <giri.p.mudusuru@intel.com>
* MdeModulePkg VariableInfo: Use fixed buffer for smm comm bufferStar Zeng2016-06-293-33/+50
| | | | | | | 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg DxeSmmPerformanceLib: Add missing UefiLib in *.inf at de2459dStar Zeng2016-06-291-0/+1
| | | | | | | | Cc: Jiewen Yao <jiewen.yao@intel.com> 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: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg/XhciDxe:Fix usb desc length check logicFeng Tian2016-06-291-2/+32
| | | | | | Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Evgeny Yakovlev <insoreiges@gmail.com>
* MdeModulePkg/UsbBusDxe: Fixed USB descriptor length checkEvgeny Yakovlev2016-06-291-2/+2
| | | | | | | | | | | | | | According to spec if the length of a descriptor is smaller than what the specification defines, then the host shall ignore it. However if the size is greater than expected the host will ignore the extra bytes and start looking for the next descriptor at the end of actual length returned. Original check did not handle the latter case correctly and only allowed descriptors with lengths exactly as defined in specification. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Evgeny Yakovlev <insoreiges@gmail.com> Reviewed-by: Feng Tian <feng.tian@intel.com>
* MdeModulePkg/MemoryStatusCode: Expose the DXE memory status code table.Cinnamon Shia2016-06-297-49/+73
| | | | | | | | | | | Let data of DXE memory status code can be used by other modules. 1. Save the address of DXE memory status code table to DxeConfigurationTable. 2. Save the address of SMM memory status code table to SmmConfigurationTable. 3. Move RUNTIME_MEMORY_STATUSCODE_HEADER to its public header file. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Cinnamon Shia <cinnamon.shia@hpe.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg/HiiDatabaseDxe: Add ASSERT before using the pointer 'String'Dandan Bi2016-06-281-4/+4
| | | | | | | | | | | | | | The 'Sting' is returned by the function GetUnicodeStringTextAndSize. If it is NULL, function GetUnicodeStringTextAndSize will return EFI_OUT_OF_RESOURCES, and error handling codes will cover it. So the pointer 'Sting' can not be NULL when using it. So we can add the ASSERT codes. Cc: Eric Dong <eric.dong@intel.com> Cc: Hao Wu <hao.a.wu@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 BootScriptExecutorDxe: Convert X64/S3Asm.asm to NASMLiming Gao2016-06-281-28/+29
| | | | | | | Use real nasm instruction to replace DB bytes. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com>
* MdeModulePkg BootScriptExecutorDxe: Convert X64/S3Asm.asm to NASMJordan Justen2016-06-282-0/+136
| | | | | | | | The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert X64/S3Asm.asm to X64/S3Asm.nasm Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
* MdeModulePkg BootScriptExecutorDxe: Convert IA32/S3Asm.asm to NASMLiming Gao2016-06-281-12/+13
| | | | | | | Use real nasm instruction to replace DB bytes. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com>