Add ASSERT() for BitField operations to make sure the input value is valid.
Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Kinney, Michael D <Michael.D.Kinney@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14019 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
All assertions for bit field operations are handled bit field functions in the
|
||||
Base Library.
|
||||
|
||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -153,6 +153,7 @@ IoBitFieldRead8 (
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -193,6 +194,7 @@ IoBitFieldWrite8 (
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -233,6 +235,7 @@ IoBitFieldOr8 (
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -275,6 +278,8 @@ IoBitFieldAnd8 (
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -433,6 +438,7 @@ IoBitFieldRead16 (
|
||||
If StartBit is greater than 15, then ASSERT().
|
||||
If EndBit is greater than 15, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -473,6 +479,7 @@ IoBitFieldWrite16 (
|
||||
If StartBit is greater than 15, then ASSERT().
|
||||
If EndBit is greater than 15, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -513,6 +520,7 @@ IoBitFieldOr16 (
|
||||
If StartBit is greater than 15, then ASSERT().
|
||||
If EndBit is greater than 15, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -555,6 +563,8 @@ IoBitFieldAnd16 (
|
||||
If StartBit is greater than 15, then ASSERT().
|
||||
If EndBit is greater than 15, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -713,6 +723,7 @@ IoBitFieldRead32 (
|
||||
If StartBit is greater than 31, then ASSERT().
|
||||
If EndBit is greater than 31, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -753,6 +764,7 @@ IoBitFieldWrite32 (
|
||||
If StartBit is greater than 31, then ASSERT().
|
||||
If EndBit is greater than 31, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -793,6 +805,7 @@ IoBitFieldOr32 (
|
||||
If StartBit is greater than 31, then ASSERT().
|
||||
If EndBit is greater than 31, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -835,6 +848,8 @@ IoBitFieldAnd32 (
|
||||
If StartBit is greater than 31, then ASSERT().
|
||||
If EndBit is greater than 31, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -993,6 +1008,7 @@ IoBitFieldRead64 (
|
||||
If StartBit is greater than 63, then ASSERT().
|
||||
If EndBit is greater than 63, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1033,6 +1049,7 @@ IoBitFieldWrite64 (
|
||||
If StartBit is greater than 63, then ASSERT().
|
||||
If EndBit is greater than 63, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1073,6 +1090,7 @@ IoBitFieldOr64 (
|
||||
If StartBit is greater than 63, then ASSERT().
|
||||
If EndBit is greater than 63, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1115,6 +1133,8 @@ IoBitFieldAnd64 (
|
||||
If StartBit is greater than 63, then ASSERT().
|
||||
If EndBit is greater than 63, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Port The I/O port to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1273,6 +1293,7 @@ MmioBitFieldRead8 (
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1314,6 +1335,7 @@ MmioBitFieldWrite8 (
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1355,6 +1377,7 @@ MmioBitFieldOr8 (
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1397,6 +1420,8 @@ MmioBitFieldAnd8 (
|
||||
If StartBit is greater than 7, then ASSERT().
|
||||
If EndBit is greater than 7, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1555,6 +1580,7 @@ MmioBitFieldRead16 (
|
||||
If StartBit is greater than 15, then ASSERT().
|
||||
If EndBit is greater than 15, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1596,6 +1622,7 @@ MmioBitFieldWrite16 (
|
||||
If StartBit is greater than 15, then ASSERT().
|
||||
If EndBit is greater than 15, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1637,6 +1664,7 @@ MmioBitFieldOr16 (
|
||||
If StartBit is greater than 15, then ASSERT().
|
||||
If EndBit is greater than 15, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1679,6 +1707,8 @@ MmioBitFieldAnd16 (
|
||||
If StartBit is greater than 15, then ASSERT().
|
||||
If EndBit is greater than 15, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1837,6 +1867,7 @@ MmioBitFieldRead32 (
|
||||
If StartBit is greater than 31, then ASSERT().
|
||||
If EndBit is greater than 31, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1878,6 +1909,7 @@ MmioBitFieldWrite32 (
|
||||
If StartBit is greater than 31, then ASSERT().
|
||||
If EndBit is greater than 31, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1919,6 +1951,7 @@ MmioBitFieldOr32 (
|
||||
If StartBit is greater than 31, then ASSERT().
|
||||
If EndBit is greater than 31, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -1961,6 +1994,8 @@ MmioBitFieldAnd32 (
|
||||
If StartBit is greater than 31, then ASSERT().
|
||||
If EndBit is greater than 31, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -2119,6 +2154,7 @@ MmioBitFieldRead64 (
|
||||
If StartBit is greater than 63, then ASSERT().
|
||||
If EndBit is greater than 63, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -2160,6 +2196,7 @@ MmioBitFieldWrite64 (
|
||||
If StartBit is greater than 63, then ASSERT().
|
||||
If EndBit is greater than 63, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -2201,6 +2238,7 @@ MmioBitFieldOr64 (
|
||||
If StartBit is greater than 63, then ASSERT().
|
||||
If EndBit is greater than 63, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
@@ -2243,6 +2281,8 @@ MmioBitFieldAnd64 (
|
||||
If StartBit is greater than 63, then ASSERT().
|
||||
If EndBit is greater than 63, then ASSERT().
|
||||
If EndBit is less than StartBit, then ASSERT().
|
||||
If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().
|
||||
|
||||
@param Address The MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
Reference in New Issue
Block a user