Commit Graph

17 Commits

Author SHA1 Message Date
Hao Wu 4ff5fd203c IntelFrameworkModulePkg: Refine type cast for pointer subtraction
For pointer subtraction, the result is of type "ptrdiff_t". According to
the C11 standard (Committee Draft - April 12, 2011):

"When two pointers are subtracted, both shall point to elements of the
same array object, or one past the last element of the array object; the
result is the difference of the subscripts of the two array elements. The
size of the result is implementation-defined, and its type (a signed
integer type) is ptrdiff_t defined in the <stddef.h> header. If the result
is not representable in an object of that type, the behavior is
undefined."

In our codes, there are cases that the pointer subtraction is not
performed by pointers to elements of the same array object. This might
lead to potential issues, since the behavior is undefined according to C11
standard.

Also, since the size of type "ptrdiff_t" is implementation-defined. Some
static code checkers may warn that the pointer subtraction might underflow
first and then being cast to a bigger size. For example:

UINT8  *Ptr1, *Ptr2;
UINTN  PtrDiff;
...
PtrDiff = (UINTN) (Ptr1 - Ptr2);

The commit will refine the pointer subtraction expressions by casting each
pointer to UINTN first and then perform the subtraction:

PtrDiff = (UINTN) Ptr1 - (UINTN) Ptr2;

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2017-03-06 14:14:46 +08:00
Gary Lin 70d3fe9dad IntelFrameworkModulePkg: Fix typos in comments
- stoping -> stopping
- Pointion -> Position
- Arrary -> Array
- reseting -> resetting
- excute -> execute
- isTRUE -> is TRUE
- connectted -> connected
- Retrive -> Retrieve
- dirvers -> drivers
- funciton -> function
- paramter -> parameter
- availible -> available
- permenent -> permanent
- boundry -> boundary

Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2016-10-24 09:09:06 +08:00
David Woodhouse ff247afd22 IntelFrameworkModulePkg: Update LegacyBiosDxe to use UmaAddress and UmaSize in CSM 0.98.
The UmaAddress/UmaSize fields allows the CSM to have writable memory 
between the top of the option ROMs and the start of its read-only code segment.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Reviewed-by: Elvin Li <elvin.li@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17131 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-08 01:44:22 +00:00
Jeff Fan 1a45b15eae Add type cast on variable before operation.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Eric Dong <Eric.Dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15778 6f19259b-4bc3-4df7-8a09-765794883524
2014-08-08 05:52:01 +00:00
Eric Dong 613382e922 Update code to support VS2013 tool chain.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15692 6f19259b-4bc3-4df7-8a09-765794883524
2014-07-28 07:41:49 +00:00
li-elvin ee65c5083b Check if video device exists before trying to install Video OpROM.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14335 6f19259b-4bc3-4df7-8a09-765794883524
2013-05-09 08:47:09 +00:00
li-elvin 007f932de6 Add OpROM code type check to ensure OpROM is PCAT legacy OpROM when an OpROM is passed to InstallPciRom.
Signed-off-by: Li Elvin <elvin.li@intel.com>
Reviewed-by: Ni Ruiyu <ruiyu.ni@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14260 6f19259b-4bc3-4df7-8a09-765794883524
2013-04-12 07:34:27 +00:00
li-elvin 0934a60581 Call LegacyBiosInstallVgaRom to shadow Legacy VBIOS instead of LegacyBiosInstallPciRom during legacy boot.
Signed-off-by: Li Elvin <elvin.li@intel.com>
Reviewed-by: Ni Ruiyu <ruiyu.ni@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14205 6f19259b-4bc3-4df7-8a09-765794883524
2013-03-15 01:34:21 +00:00
li-elvin 22921b02ab Remove 0xc8000 check when searching PNP header. Remove the check about the size of Init code when validating if PCI 3.0 OPROM is successfully started.
Signed-off-by: Li Elvin <elvin.li@intel.com>
Reviewed-by: Ni Ruiyu <ruiyu.ni@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13944 6f19259b-4bc3-4df7-8a09-765794883524
2012-11-15 02:10:44 +00:00
li-elvin cb38c322f0 Add missing status code in several modules.
Signed-off-by: Li Elvin <elvin.li@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Ni Ruiyu <ruiyu.ni@intel.com>
Reviewed-by: Gao Liming <liming.gao@intel.com>
Reviewed-by: Tian Feng <feng.tian@intel.com>
Reviewed-by: Fan Jeff <jeff.fan@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13889 6f19259b-4bc3-4df7-8a09-765794883524
2012-10-30 04:19:03 +00:00
niruiyu 7f446eba26 Handle the case when OpROM wants to completely remove itself.
Signed-off-by: Ruiyu Ni<ruiyu.ni@intel.com>
Reviewed-by: Elvin Li<elvin.li@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13736 6f19259b-4bc3-4df7-8a09-765794883524
2012-09-24 02:57:47 +00:00
li-elvin edf4af6fb9 Check if active video mode is changed after OpROM starts, if active video mode is not changed, skip INT10 calls to improve performance.
Signed-off-by: Li Elvin <elvin.li@intel.com>
Reviewed-by: Yao Jiewen<jiewen.yao@intel.com>


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13609 6f19259b-4bc3-4df7-8a09-765794883524
2012-08-13 09:33:49 +00:00
rsun3 94020bb40f Improve robustness when scanning PCI Option ROM.
Signed-off-by: rsun3
Reviewed-by: geekboy15a


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13095 6f19259b-4bc3-4df7-8a09-765794883524
2012-03-14 03:17:17 +00:00
li-elvin 091bb7138b InstallOpROM in CSM driver could be enhanced to start video when RomImage is passed in directly.
Signed-off-by: li-elvin
Reviewed-by: niruiyu


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12521 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-10 07:54:47 +00:00
li-elvin befbc4f3fb Use PCD for PMM size and EndOpromShadowAddress to remove hard code value in CSM module.
Signed-off-by: li-elvin
Reviewed-by: jyao1

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12519 6f19259b-4bc3-4df7-8a09-765794883524
2011-10-10 01:43:13 +00:00
li-elvin 16adc27692 Add RomImage pointer NULL check.
Signed-off-by: li-elvin
Reviewed-by: niruiyu


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12473 6f19259b-4bc3-4df7-8a09-765794883524
2011-09-29 06:35:51 +00:00
jljusten bcecde140a IntelFrameworkModulePkg: Add Compatibility Support Module (CSM) drivers
Added these drivers:
* LegacyBiosDxe
* BlockIoDxe
* KeyboardDxe
* Snp16Dxe
* VideoDxe

Signed-off-by: jljusten
Reviewed-by: mdkinney
Reviewed-by: geekboy15a

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11905 6f19259b-4bc3-4df7-8a09-765794883524
2011-06-27 23:32:56 +00:00