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:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
High-level Io/Mmio functions.
|
||||
|
||||
Copyright (c) 2006 - 2011, 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
|
||||
@@ -144,6 +144,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.
|
||||
@@ -184,6 +185,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.
|
||||
@@ -224,6 +226,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.
|
||||
@@ -266,6 +269,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.
|
||||
@@ -424,6 +429,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.
|
||||
@@ -464,6 +470,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.
|
||||
@@ -504,6 +511,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.
|
||||
@@ -546,6 +554,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.
|
||||
@@ -704,6 +714,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.
|
||||
@@ -744,6 +755,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.
|
||||
@@ -784,6 +796,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.
|
||||
@@ -826,6 +839,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.
|
||||
@@ -984,6 +999,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.
|
||||
@@ -1024,6 +1040,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.
|
||||
@@ -1064,6 +1081,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.
|
||||
@@ -1106,6 +1124,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.
|
||||
@@ -1264,6 +1284,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.
|
||||
@@ -1305,6 +1326,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.
|
||||
@@ -1346,6 +1368,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.
|
||||
@@ -1388,6 +1411,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.
|
||||
@@ -1546,6 +1571,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.
|
||||
@@ -1587,6 +1613,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.
|
||||
@@ -1628,6 +1655,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.
|
||||
@@ -1670,6 +1698,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.
|
||||
@@ -1828,6 +1858,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.
|
||||
@@ -1869,6 +1900,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.
|
||||
@@ -1910,6 +1942,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.
|
||||
@@ -1952,6 +1985,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.
|
||||
@@ -2110,6 +2145,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.
|
||||
@@ -2151,6 +2187,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.
|
||||
@@ -2192,6 +2229,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.
|
||||
@@ -2234,6 +2272,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.
|
||||
|
Reference in New Issue
Block a user