Commit Graph
910 Commits
Author SHA1 Message Date
Ard Biesheuvel 3d7ec26873 MdeModulePkg/DxeCapsuleLibFmp: pass progress callback only if it works
If the first call to UpdateImageProgress() fails, there is no point
in passing a pointer to it to Fmp->SetImage(), since it is highly
unlikely to succeed on any subsequent calls.

This permits the FMP implementation to fall back to an alternate means
of providing feedback to the user, e.g., via the console.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
(cherry picked from commit 1342bd4486)
2018-07-13 09:48:15 +08:00
Star Zeng cfc2c2415b MdeModulePkg DxeCapsuleLibFmp: Fix typo 'Press' to 'Process'
Cc: Michael D Kinney <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Ming Shao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
(cherry picked from commit a891bd7337)
2018-07-11 15:32:33 +08:00
Star Zeng a84e7870ae MdeModulePkg DxeCapsuleLibFmp: Fix wrong Index is used
DEBUG((
  DEBUG_ERROR,
  "ItemOffsetList[%d](0x%lx) < ItemOffsetList[%d](0x%x)\n",
  Index,
  ItemOffsetList[Index],
  Index,                       // Should be Index - 1
  ItemOffsetList[Index - 1]
  ));

Cc: Jiewen Yao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
(cherry picked from commit 0f3cd8a92b)
2018-07-09 13:38:58 +08:00
Ruiyu Ni 56bda6da0b MdeModulePkg/BmpSupportLib: Check PixelHeight/PixelWidth against 0
The patch adds check logic to make sure that for a input BMP file,
the width or height is not 0; for a input GOP blt buffer, the width
or height is not 0. Otherwise, UNSUPPORTED status is returned.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Cc: Michael D Kinney <[email protected]>
(cherry picked from commit 51fe5b5140)
2018-07-09 13:14:31 +08:00
Ruiyu Ni 0c3ac72a88 MdeModulePkg/BmpSupportLib: Correct debug message
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <[email protected]>
Cc: Michael D Kinney <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
(cherry picked from commit 2a9e1b97c9)
2018-07-09 13:14:30 +08:00
Kinney, Michael D 6ef1723114 MdeModulePkg/DxeCapsuleLibFmp: Add progress bar support
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

* Change Update_Image_Progress() to UpdateImageProcess()
* Call DisplayUpdateProgressLib from UpdateImageProgress().
* Split out a boot service and runtime version of
  UpdateImageProgress() so the DisplayUpdateProgressLib is
  not used at runtime.
* If gEdkiiFirmwareManagementProgressProtocolGuid is present,
  then use its progress bar color and watchdog timer value.
* If gEdkiiFirmwareManagementProgressProtocolGuid is not present,
  then use default progress bar color and 5 min watchdog timer.
* Remove Print() calls during capsule processing.  Instead,
  the DisplayUpdateProgressLib is used to inform the user
  of progress during a capsule update.

Cc: Star Zeng <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Sean Brogan <[email protected]>
Signed-off-by: Michael D Kinney <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Tested-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
(cherry picked from commit 5747610657)
2018-07-09 13:05:06 +08:00
Dandan Bi d8ea9f1d74 MdeModulePkg/DisplayUpdateProgressLib: Fix ECC issues
Make the comment align with Edk2 coding style.

Cc: Star Zeng <[email protected]>
Cc: Eric Dong <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
(cherry picked from commit ec50f7535b)
2018-07-09 13:05:04 +08:00
Michael D Kinney ea1572dc81 MdeModulePkg: Add DisplayUpdateProgressLib instances
https://bugzilla.tianocore.org/show_bug.cgi?id=801

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport

Add DisplayUpdateProgressLib instances for text consoles
and graphical consoles.

Cc: Sean Brogan <[email protected]>
Cc: Star Zeng <[email protected]>
Cc: Eric Dong <[email protected]>
Signed-off-by: Michael D Kinney <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Reviewed-by: Star Zeng <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
(cherry picked from commit 72b0a9bed9)
2018-07-09 12:57:40 +08:00
Dandan Bi 05d48dace8 MdeModulePkg: Fix coding style issues in file/function comments
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
(cherry picked from commit ae38c9765a)
2018-07-09 10:51:34 +08:00
Hao Wu 63bcec2f01 MdeModulePkg/BmpSupportLib: Refine type cast for pointer subtraction
Since the pointer subtraction here is not performed by pointers to
elements of the same array object. This might lead to potential issues,
such behavior is undefined according to C11 standard.

Refine the pointer subtraction expressions by casting each pointer to
UINTN first and then perform the subtraction.

Cc: Michael D Kinney <[email protected]>
Cc: Sean Brogan <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Ruiyu Ni <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
(cherry picked from commit 99576ee3fd)
2018-07-09 10:43:54 +08:00
Michael D Kinney ea5eab38ee MdeModulePkg/DxeCapsuleLibFmp: Use BmpSupportLib
https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Use BmpSupportLib to convert a BMP graphics image to a
GOP BLT buffer.

Cc: Sean Brogan <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Star Zeng <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Ruiyu Ni <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Reviewed-by: Bret Barkelew <[email protected]>
(cherry picked from commit 1ec2e7d0e8)
2018-07-06 19:27:44 +08:00
Kinney, Michael D 9a54b42353 MdeModulePkg: Add BmpSupportLib class and instance
https://bugzilla.tianocore.org/show_bug.cgi?id=800

Based on content from the following branch/commits:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d
https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135098f53d61
https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111f016dbd9b

Add BmpSupportLib class and instances that provides services to
convert a BMP graphics image to a GOP BLT buffer and to convert
a GOP BLT buffer to a BMP graphics image.

Cc: Sean Brogan <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Star Zeng <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Ruiyu Ni <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Reviewed-by: Bret Barkelew <[email protected]>
(cherry picked from commit 4123d6da70)
2018-07-06 19:27:42 +08:00
Ruiyu Ni fb304eb83f MdeModulePkg/DxeResetSystemLib: Avoid depending on UefiRuntimeLib
Current DxeResetSystemLib depends on UefiRuntimeLib because it calls
EfiResetSystem() API exposed by UefiRuntimeLib.

Due to the commit:
"MdePkg/UefiRuntimeLib: Do not allow to be linked by DXE driver"
which reverts UefiRuntimeLib to only support DXE_RUNTIME_DRIVER,
removing UefiRuntimeLib dependency makes the DxeResetSystemLib
can be used by DXE drivers.

The patch also disallows the DxeResetSystemLib to be linked by
runtime driver, SMM drivers.
Runtime driver cannot link to this library because the gRT is not
converted when entering to RT.
SMM driver cannot link to this library because calling RT services
from SMM after EndOfDxe violates security guideline.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Cc: Liming Gao <[email protected]>
(cherry picked from commit 6c252691c3)
2018-06-08 17:56:10 +08:00
Ruiyu Ni 61384921e0 MdeModulePkg/DxeCapsuleLibFmp: Add more check for the UX capsule
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
(cherry picked from commit d0976b9acc)
2018-03-16 17:37:27 +08:00
Liming Gao 7e3639367e MdeModulePkg BrotliLib: Rename function with the specific lib name
This change is to avoid the function conflict.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <[email protected]>
Cc: Star Zeng <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
(cherry picked from commit 792ace0ac3)
2018-03-16 15:52:44 +08:00
Star Zeng 320449821c MdeModulePkg LockBoxLib: Support LOCK_BOX_ATTRIBUTE_RESTORE_IN_S3_ONLY
With this flag, the LockBox can be restored in S3 resume only.
The LockBox can not be restored after SmmReadyToLock in normal boot
and after EndOfS3Resume in S3 resume.
It can not be set together with LOCK_BOX_ATTRIBUTE_RESTORE_IN_PLACE.

Cc: Jiewen Yao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
(cherry picked from commit 6bd4af305d)
2018-03-09 14:37:02 +08:00
Laszlo Ersek 5ee2485fc5 MdeModulePkg/UefiBootManagerLib: remove superfluous TimerLib dependency
In commit 3a039a567a ("MdeModulePkg/UefiBootManagerLib: Remove the
useless perf codes", 2018-02-12), the BmWriteBootToOsPerformanceData()
function was removed. No TimerLib API calls are left, thus remove the
TimerLib class dependency from "InternalBm.h" and "UefiBootManagerLib.inf"
as well.

Cc: Eric Dong <[email protected]>
Cc: Jaben Carsey <[email protected]>
Cc: Ruiyu Ni <[email protected]>
Cc: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
(cherry picked from commit bad0b5e871)
2018-03-03 21:20:41 +08:00
Dandan Bi 413b649783 MdeModulePkg/DxeCorePerfLib: Add status check instead of ASSERT
Currently DxeCorePerformanceLib will get SMM performance data based
on SMM communication handler. If SMM communication handler returns error,
the library will ASSERT. In fact, if SMM perf data is not found.
DXE perf data can still be dumped. So using status check instead of
ASSERT is better.

Cc: Liming Gao <[email protected]>
Cc: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
(cherry picked from commit c9f02a96d8)
2018-03-02 16:18:04 +08:00
Ruiyu Ni 82caf21987 MdeModulePkg/DebugLibReportStatusCode: Fix hang if format is too long
The previous commit 137ed15511
* MdeModulePkg/DebugLib: Print partial when format string is too long
copies partial format string to DEBUG_INFO buffer but when parsing
the format modifier, the original format string is still used.

The patch fixes this issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
(cherry picked from commit a7119c8152)
2018-03-02 13:46:01 +08:00
Kinney, Michael D ece2cc8ed7 MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with FMP
https://bugzilla.tianocore.org/show_bug.cgi?id=873

Update IsNestedFmpCapsule() to verify the CapsuleGuid in
the CapsuleHeader against the installed Firmware Management
Protocol instances.  The current logic that uses the ESRT
Table does not work because capsules are processed before
the ESRT Table is published at the Ready To Boot event.

Cc: Jiewen Yao <[email protected]>
Cc: Star Zeng <[email protected]>
Cc: Eric Dong <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Jiewen Yao <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Reviewed-by: Bret Barkelew <[email protected]>
(cherry picked from commit 7f0301e39a)
2018-02-24 11:20:44 +08:00
Ruiyu Ni 2d1a8a008f MdeModulePkg/ResetUtilityLib: Fix GCC build failure
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <[email protected]>
Cc: Dandan Bi <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>
(cherry picked from commit 5eecb45af0)
2018-02-14 09:19:48 +08:00
Dandan Bi 3827af5e5c MdeModulePkg/UefiBootManagerLib: Remove the useless perf codes
V2: Just update the commit message to reference the hash value of
new performance infrastructure.

Our new performance infrastructure (edk2 trunk commit hash value:
SHA-1: 73fef64f14 ~
SHA-1: 115eae650b) can support to
dump performance date form ACPI table in OS. So we can remove
the old perf code to write performance data to OS.

Cc: Liming Gao <[email protected]>
Cc: Ruiyu Ni <[email protected]>
Cc: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
(cherry picked from commit 3a039a567a)
2018-02-12 11:37:38 +08:00
Dandan Bi 7d675727fa MdeModulePkg/PerfLib: Add NULL pointer check for "Token"
"Token" is passed through the perf entry, it's may be NULL.
So we need to add NULL pointer check before reference it.

Cc: Liming Gao <[email protected]>
Cc: Star Zeng <[email protected]>
Cc: Jiewen Yao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
(cherry picked from commit c9faac275b)
2018-02-11 09:57:19 +08:00
Michael D Kinney 43cfd6a831 MdeModulePkg: Add ResetUtility library class and BASE instance
The library class that provides services to generate a GUID specific
reset, parse the GUID from a GUID specific reset, and build the
ResetData buffer for any type of reset that requires extra data.

Cc: Liming Gao <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <[email protected]>
Signed-off-by: Ruiyu Ni <[email protected]>
(cherry picked from commit e12ceb40ce)
2018-02-09 15:42:41 +08:00
Michael D Kinney fe71cd7948 MdeModulePkg: Add ResetSystemLib instances that call core services
Add a PEI instance of ResetSystemLib that calls the ResetSystem2()
service in the PEI Services Table.

Add a DXE instance of ResetSystemLib that calls the ResetSystem()
service in the UEFI Runtime Services Table.

These 2 library instances should be the default ResetSystemLib
mapping for most PEIMs and DXE drivers so all reset system requests
go through the core service.

Only the implementation of the core servies should use the
platform specific instance of the ResetSystemLib that actually
performs the hardware actions to reset the platform.

Cc: Liming Gao <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <[email protected]>
(cherry picked from commit ce3cd892c8)
2018-02-09 15:42:41 +08:00
Dandan Bi 20f8e6aad6 MdeModulePkg/SmmCorePerformanceLib:Track FPDT record in SMM phase
V3:
a. Handle the case when string is empty in String Record.
b. Use gEdkiiFpdtExtendedFirmwarePerformanceGuid to report status
code.
c. Refine the code logic.

V2:
Update SmmCorePerformanceLib to report the buffer address of
boot performance records instead of records contents.

Updated to convert Pref entry to FPDT record in SMM phase and then
export records to FPDT table.

Cc: Liming Gao <[email protected]>
Cc: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
(cherry picked from commit 2001f84e8c)
2018-02-09 15:37:18 +08:00
Dandan Bi ecb4b8a61d MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase
V4:
a.Update the GUID for status code in DxeCorePerformanceLib and
FirmwarePerformanceDxe.
b. Add check for Insert FPDT record in DxeCorePerformanceLib
to avoid re-entry case.

V3:
a. Handle the case when string is empty in String Record.
b. refine the code logic.

V2:
Update DxecorePerformanceLib to report the boot performance table
address instead of records contents.

Updated to convert Pref entry to FPDT record in DXE phase and then
allocate boot performance table to save the record and report
the address of boot performance table to FirmwarePerformanceDxe.

Cc: Liming Gao <[email protected]>
Cc: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
(cherry picked from commit 9609d24b19)
2018-02-09 15:37:17 +08:00
Dandan Bi 6a6e61d427 MdeModulePkg/PeiPerformance:Updated to track FPDT record in PEI phase
V3:Handle the case when string is empty in String Record.

Updated to convert Pref entry to FPDT record in PEI phase and then
report the records to DxeCorePerfLib through GUID hob.

Cc: Liming Gao <[email protected]>
Cc: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
(cherry picked from commit 9169f67690)
2018-02-09 15:37:17 +08:00
Jiaxin Wu c99948a2d1 MdeModulePkg/UefiBootManagerLib: Skip the DNS device path node check.
After HTTP boot successfully in home mode, the HTTP device path will be
updated accordingly. So, the new device path may be appended with a DNS
device path node. When executing home mode boot again, the original HTTP
device path will mismatch with the new updated one, which will cause the
HTTP boot failure. So, we need update the current match algorithm to match
the correct FilePath. Since the DNS device path is an optional, we can skip
it check.

This patch is to fix above issue.

Cc: Ruiyu Ni <[email protected]>
Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>
(cherry picked from commit 6945837e4c)
2018-01-25 13:40:17 +08:00
Wang Fan b6c446b77e MdeModulePkg/DxeIpIoLib: Fixed the error ASSERT incorrectly used in IpIoAddIp().
* In DxeIpIo, an ASSERT check is incorrectly used in IpIoAddIp(), which result
  debug image hang when this API is called, this patch is to fix this issue.

Cc: Jiaxin Wu <[email protected]>
Cc: Fu Siyuan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <[email protected]>
Reviewed-by: Jiaxin Wu <[email protected]>
(cherry picked from commit 6478baf891)
2018-01-17 08:32:02 +08:00
Ruiyu Ni ce45421cb6 MdeModulePkg/FrameBufferBltLib: Fix copying of unaligned memory
Contributed-under: TianoCore Contribution Agreement 1.1
Reported-by: Christian Ehrhardt <[email protected]>
Signed-off-by: Christian Ehrhardt <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>
Tested-by: Christian Ehrhardt <[email protected]>
(cherry picked from commit 0e58b55a46)
2018-01-16 15:33:01 +08:00
Ruiyu Ni a6f4c90a05 MdeModulePkg/FrameBufferBltLib: Fix a bug causing display corrupted
The Graphics Output Protocol's mode information specifies the
PixelsPerScanLine property. Most of the time this is identical to
HorizontalResolution. However, due to alignment requirements etc. it
may be slightly larger. I.e. each scan line will have some "pixels"
that are not visible on the screen but consume space in the frame
buffer.

If the graphics output protocol correctly initializes
HorizontalResolution to 1366 and PixelsPerScanLine to 1376. As a
result the graphics output is broken.

If setting HorizontalResolution to 1376 instead, the output is fine
(except for 10 invisible pixels on the right of the screen).

The patch fixes this bug by using PixelsPerScanLine when calculating
the line width.

Contributed-under: TianoCore Contribution Agreement 1.1
Reported-by: Christian Ehrhardt <[email protected]>
Signed-off-by: Christian Ehrhardt <[email protected]>
Signed-off-by: Ruiyu Ni <[email protected]>
Cc: Christian Ehrhardt <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Tested-by: Christian Ehrhardt <[email protected]>
(cherry picked from commit 5ae0723355)
2018-01-16 15:33:01 +08:00
Ruiyu Ni 20e16af964 MdeModulePkg/FrameBufferBltLib: Use UINT32 type for internal data
Unused ColorDepth was removed.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
Tested-by: Christian Ehrhardt <[email protected]>
(cherry picked from commit 043944c550)
2018-01-16 15:33:00 +08:00
Wang Fan 1378dd73eb MdeModulePkg: Did some code enhancement for DxeIpIoLib.
* In DxeIpIo, there are several places use ASSERT() to check input
  parameters without and descriptions or error handling. This patch
  fixed this issue.
* Fixed some incorrect descriptions in code commence.
* Remove unneeded Exit tag in function IpIoOpen and IpIoConfigIp.
* Add EFIAPI tag for function IpIoRefreshNeighbor.

Cc: Jiaxin Wu <[email protected]>
Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <[email protected]>
Reviewed-by: Jiaxin Wu <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
(cherry picked from commit 2b2087478c)
2018-01-16 11:12:14 +08:00
Wang Fan a5f3470200 MdeModulePkg: Freed the received packet buffer if it is not expected.
* When the packet is not normal packet or icmp error packet, the code
  does not recycle it by signal RecycleSignal event, and this will
  result some memory leak. This patch is to fix this issue.

Cc: Jiaxin Wu <[email protected]>
Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <[email protected]>
Reviewed-by: Jiaxin Wu <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
(cherry picked from commit 0a1bd0a35d)
2018-01-16 11:12:09 +08:00
Ruiyu Ni 5bf7864b8c MdeModulePkg/DebugLib: Print partial when format string is too long
Today's implementation prints nothing when the format string cannot
fit in the report status extended data buffer.
It confuses user.
The patch changes to print partial message by truncating the format
string when it's too long.

The missing enhancement is the extended data buffer only reserves 96
bytes for the var-args. When the format string is not very long but
contains 13 %lx or %p, the var-args buffer is too small. Today's
implementation prints nothing for this case.
This patch doesn't change such behavior.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
(cherry picked from commit 137ed15511)
2018-01-16 10:55:33 +08:00
Wang Fan e2cef60f80 MdeModulePkg/DxeNetLib: Add array range check in NetIp6IsNetEqual().
* The library API use array elements without any index range check, this
patch is to fix this issue to avoid null pointer reference.

V2
* Added an ASSERT check for the case PrefixLength equals to IP6_PREFIX_MAX.
* Synced some code descriptions to head file.

Cc: Fu Siyuan <[email protected]>
Cc: Jiaxin Wu <[email protected]>
Cc: Hao Wu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <[email protected]>
Reviewed-by: Hao Wu <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
Reviewed-by: Jiaxin Wu <[email protected]>
(cherry picked from commit e0e26f9c1f)
2018-01-12 11:10:45 +08:00
Bi, Dandan 69fabe97be MdeModulePkg/VarCheckHii: Update data type for variable "ArrayIndex"
In some case the ArrayIndex with UINT16 may be not large enough to
hold the multiplication result of HiiQuestion->VarOffset * 8;
So this patch update the data type to fix this potential issue.

Cc: Star Zeng <[email protected]>
Cc: Liming Gao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
(cherry picked from commit 427b2f41a6)
2018-01-10 14:56:14 +08:00
Wang Fan 02f4147f02 MdeModulePkg/DxeUdpIoLib: Did some code enhancement for UdpIoLib
* Added some ASSERT descriptions for library APIs.
* Added "Optional" option for Context parameter in UdpIoCancelDgrams().
* Added function return status check for UdpIoFreeIo().

Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Cc: Jiaxin Wu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
(cherry picked from commit 6d88babba3)
2018-01-09 09:19:55 +08:00
Wang, Jian J 8776b1ba58 MdeModulePkg/DxePrintLibPrint2Protocol: Fix incomplete print output
This is caused by a previous patch which tried to fix string over-read.
It's found that that patch for PrintLib in MdePkg will cause premature
terminating of loop used to traversing format string and cause incomplete
string output. Because this library uses similar code to do the same
job, it has the same issue too. So the fix is also the same.

Cc: Liming Gao <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
(cherry picked from commit b23276135a)
2018-01-04 13:41:09 +08:00
Wang Fan e4a45bb8b2 MdeModulePkg/DxeNetLib: Fix an error in packet length counting.
* In old implementation, the operation len-- assumes AsciiSPrint()
  has counted NULL terminator, and it's not correct. This patch is
  to fix this issue.

Cc: Fu Siyuan <[email protected]>
Cc: Ye Ting <[email protected]>
Cc: Jiaxin Wu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <[email protected]>
Reviewed-by: Jiaxin Wu <[email protected]>
2018-01-04 10:56:13 +08:00
Wang Fan 667fdaaac8 MdeModulePkg/DxeNetLib: Add parameter check and ASSERT handling.
* Library API should check the input parameters before use, or
  ASSERT to tell it has to meet some requirements. But in DxeNetLib,
  not all functions follows this rule.
* ASSERT shouldn't be used as error handling, add some handling code
  for errors.
* Add some ASSERT commence in function notes.

Cc: Fu Siyuan <[email protected]>
Cc: Ye Ting <[email protected]>
Cc: Jiaxin Wu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <[email protected]>
Reviewed-by: Jiaxin Wu <[email protected]>
2018-01-04 10:56:11 +08:00
Wang Fan d22bce7905 MdeModulePkg/DxeNetLib: Fix a potential issue in macro definition.
The NIC_ITEM_CONFIG_SIZE macro in DxeNetLib is defined as:
sizeof (NIC_IP4_CONFIG_INFO) + sizeof (EFI_IP4_ROUTE_TABLE) *
MAX_IP4_CONFIG_IN_VARIABLE. This macro should be surrounded
with parenthesis to avoid being incorrectly used.

Cc: Fu Siyuan <[email protected]>
Cc: Ye Ting <[email protected]>
Cc: Jiaxin Wu <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wang Fan <[email protected]>
Reviewed-by: Jiaxin Wu <[email protected]>
2018-01-04 10:56:10 +08:00
Star Zeng 6f992a1cd4 MdeModulePkg VarCheckPcd: Make sure the bin at required alignment
According to UEFI/PI spec, the AllocateXXXPool() interfaces should
return eight-byte aligned buffer that satisfies the required
HEADER_ALIGNMENT which is 4.

This patch adds ASSERT to make sure the bin at required alignment,
that can help catch the issue earlier about incorrect aligned buffer
returned from AllocateXXXPool().

Cc: Jian J Wang <[email protected]>
Cc: Jiewen Yao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Jian J Wang <[email protected]>
(cherry picked from commit cd16355bbf)
2018-01-02 09:58:17 +08:00
Star Zeng 010097b08c MdeModulePkg VarCheckHii: Make sure the bin at required alignment
According to UEFI/PI spec, the AllocateXXXPool() interfaces should
return eight-byte aligned buffer that satisfies the required
HEADER_ALIGNMENT which is 4.

This patch adds ASSERT to make sure the bin at required alignment,
that can help catch the issue earlier about incorrect aligned buffer
returned from AllocateXXXPool().

Cc: Jian J Wang <[email protected]>
Cc: Jiewen Yao <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <[email protected]>
Reviewed-by: Jian J Wang <[email protected]>
(cherry picked from commit 3d110afbca)
2018-01-02 09:58:16 +08:00
Wang, Jian J f0e60d2661 MdeModulePkg/DxePrintLibPrint2Protocol: fix GCC5 build break
Cc: Star Zeng <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Michael Kinney <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <[email protected]>
Reviewed-by: Eric Dong <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2017-12-29 09:45:49 +08:00
Jian J Wang 941b3c4845 MdeModulePkg/DxePrintLibPrint2Protocol: Fix error in Precision position calculation
Due to a potential hole in the stop condition of loop, the two continuous
access to ArgumentString (index, index+1) inside the loop might cause the
string ending character ('\0') and the byte after it to be read.

Cc: Michael D Kinney <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Star Zeng <[email protected]>
2017-12-28 11:12:35 +08:00
Jiaxin Wu 0d07e6fb53 MdeModulePkg/DxeHttpLib: Refine some coding style.
Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Cc: Wang Fan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
2017-12-27 16:28:56 +08:00
Jiaxin Wu 4a6f440f25 MdeModulePkg/DxeHttpLib: Correct some return Status.
Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Cc: Wang Fan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]>
2017-12-27 16:28:50 +08:00
Jiaxin Wu 0efeec8e20 MdeModulePkg/DxeHttpLib: Check the input parameters for some APIs.
Cc: Ye Ting <[email protected]>
Cc: Fu Siyuan <[email protected]>
Cc: Wang Fan <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <[email protected]>
Reviewed-by: Fu Siyuan <[email protected]
2017-12-27 16:28:45 +08:00