mirror of https://github.com/acidanthera/audk.git
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@14020 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
94952554cc
commit
890ff9a498
|
@ -4,7 +4,7 @@
|
|||
All assertions for bit field operations are handled bit field functions in the
|
||||
Base Library.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 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
|
||||
|
@ -156,6 +156,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.
|
||||
|
@ -196,6 +197,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.
|
||||
|
@ -236,6 +238,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.
|
||||
|
@ -278,6 +281,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.
|
||||
|
@ -436,6 +441,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.
|
||||
|
@ -476,6 +482,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.
|
||||
|
@ -516,6 +523,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.
|
||||
|
@ -558,6 +566,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.
|
||||
|
@ -716,6 +726,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.
|
||||
|
@ -756,6 +767,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.
|
||||
|
@ -796,6 +808,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.
|
||||
|
@ -838,6 +851,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.
|
||||
|
@ -996,6 +1011,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.
|
||||
|
@ -1036,6 +1052,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.
|
||||
|
@ -1076,6 +1093,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.
|
||||
|
@ -1118,6 +1136,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.
|
||||
|
@ -1276,6 +1296,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1317,6 +1338,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1358,6 +1380,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1400,6 +1423,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1558,6 +1583,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1599,6 +1625,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1640,6 +1667,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1682,6 +1710,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1840,6 +1870,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1881,6 +1912,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1922,6 +1954,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -1964,6 +1997,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -2122,6 +2157,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -2163,6 +2199,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -2204,6 +2241,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
@ -2246,6 +2284,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 MMIO register to write.
|
||||
@param StartBit The ordinal of the least significant bit in the bit field.
|
||||
|
|
Loading…
Reference in New Issue