]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseIoLibIntrinsic/IoHighLevel.c
Add ASSERT() for BitField operations to make sure the input value is valid.
[mirror_edk2.git] / MdePkg / Library / BaseIoLibIntrinsic / IoHighLevel.c
index d35485b6d7457af9ccdb711446dead781b4c6c81..ab1ddf4c424ef633d521301e02c9686ffbc37bab 100644 (file)
@@ -4,7 +4,7 @@
   All assertions for bit field operations are handled bit field functions in the\r
   Base Library.\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -152,6 +152,7 @@ IoBitFieldRead8 (
   If StartBit is greater than 7, then ASSERT().\r
   If EndBit is greater than 7, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -192,6 +193,7 @@ IoBitFieldWrite8 (
   If StartBit is greater than 7, then ASSERT().\r
   If EndBit is greater than 7, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -232,6 +234,7 @@ IoBitFieldOr8 (
   If StartBit is greater than 7, then ASSERT().\r
   If EndBit is greater than 7, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -274,6 +277,8 @@ IoBitFieldAnd8 (
   If StartBit is greater than 7, then ASSERT().\r
   If EndBit is greater than 7, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -437,6 +442,7 @@ IoBitFieldRead16 (
   If StartBit is greater than 15, then ASSERT().\r
   If EndBit is greater than 15, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -478,6 +484,7 @@ IoBitFieldWrite16 (
   If StartBit is greater than 15, then ASSERT().\r
   If EndBit is greater than 15, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -519,6 +526,7 @@ IoBitFieldOr16 (
   If StartBit is greater than 15, then ASSERT().\r
   If EndBit is greater than 15, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -562,6 +570,8 @@ IoBitFieldAnd16 (
   If StartBit is greater than 15, then ASSERT().\r
   If EndBit is greater than 15, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -725,6 +735,7 @@ IoBitFieldRead32 (
   If StartBit is greater than 31, then ASSERT().\r
   If EndBit is greater than 31, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -766,6 +777,7 @@ IoBitFieldWrite32 (
   If StartBit is greater than 31, then ASSERT().\r
   If EndBit is greater than 31, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -807,6 +819,7 @@ IoBitFieldOr32 (
   If StartBit is greater than 31, then ASSERT().\r
   If EndBit is greater than 31, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -850,6 +863,8 @@ IoBitFieldAnd32 (
   If StartBit is greater than 31, then ASSERT().\r
   If EndBit is greater than 31, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1013,6 +1028,7 @@ IoBitFieldRead64 (
   If StartBit is greater than 63, then ASSERT().\r
   If EndBit is greater than 63, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1054,6 +1070,7 @@ IoBitFieldWrite64 (
   If StartBit is greater than 63, then ASSERT().\r
   If EndBit is greater than 63, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1095,6 +1112,7 @@ IoBitFieldOr64 (
   If StartBit is greater than 63, then ASSERT().\r
   If EndBit is greater than 63, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1138,6 +1156,8 @@ IoBitFieldAnd64 (
   If StartBit is greater than 63, then ASSERT().\r
   If EndBit is greater than 63, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Port      The I/O port to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1296,6 +1316,7 @@ MmioBitFieldRead8 (
   If StartBit is greater than 7, then ASSERT().\r
   If EndBit is greater than 7, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1337,6 +1358,7 @@ MmioBitFieldWrite8 (
   If StartBit is greater than 7, then ASSERT().\r
   If EndBit is greater than 7, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1378,6 +1400,7 @@ MmioBitFieldOr8 (
   If StartBit is greater than 7, then ASSERT().\r
   If EndBit is greater than 7, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1420,6 +1443,8 @@ MmioBitFieldAnd8 (
   If StartBit is greater than 7, then ASSERT().\r
   If EndBit is greater than 7, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1582,6 +1607,7 @@ MmioBitFieldRead16 (
   If StartBit is greater than 15, then ASSERT().\r
   If EndBit is greater than 15, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1624,6 +1650,7 @@ MmioBitFieldWrite16 (
   If StartBit is greater than 15, then ASSERT().\r
   If EndBit is greater than 15, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1666,6 +1693,7 @@ MmioBitFieldOr16 (
   If StartBit is greater than 15, then ASSERT().\r
   If EndBit is greater than 15, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1709,6 +1737,8 @@ MmioBitFieldAnd16 (
   If StartBit is greater than 15, then ASSERT().\r
   If EndBit is greater than 15, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1871,6 +1901,7 @@ MmioBitFieldRead32 (
   If StartBit is greater than 31, then ASSERT().\r
   If EndBit is greater than 31, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1913,6 +1944,7 @@ MmioBitFieldWrite32 (
   If StartBit is greater than 31, then ASSERT().\r
   If EndBit is greater than 31, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1955,6 +1987,7 @@ MmioBitFieldOr32 (
   If StartBit is greater than 31, then ASSERT().\r
   If EndBit is greater than 31, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -1998,6 +2031,8 @@ MmioBitFieldAnd32 (
   If StartBit is greater than 31, then ASSERT().\r
   If EndBit is greater than 31, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2160,6 +2195,7 @@ MmioBitFieldRead64 (
   If StartBit is greater than 63, then ASSERT().\r
   If EndBit is greater than 63, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2202,6 +2238,7 @@ MmioBitFieldWrite64 (
   If StartBit is greater than 63, then ASSERT().\r
   If EndBit is greater than 63, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2244,6 +2281,7 @@ MmioBitFieldOr64 (
   If StartBit is greater than 63, then ASSERT().\r
   If EndBit is greater than 63, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r
@@ -2287,6 +2325,8 @@ MmioBitFieldAnd64 (
   If StartBit is greater than 63, then ASSERT().\r
   If EndBit is greater than 63, then ASSERT().\r
   If EndBit is less than StartBit, then ASSERT().\r
+  If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
+  If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT().\r
 \r
   @param  Address   The MMIO register to write.\r
   @param  StartBit  The ordinal of the least significant bit in the bit field.\r