summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BasePciExpressLib
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:05 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit2f88bd3a1296c522317f1c21377876de63de5be7 (patch)
treeba47875489cc5698061275a495983e9dea3be098 /MdePkg/Library/BasePciExpressLib
parent1436aea4d5707e672672a11bda72be2c63c936c3 (diff)
downloadedk2-2f88bd3a1296c522317f1c21377876de63de5be7.tar.gz
edk2-2f88bd3a1296c522317f1c21377876de63de5be7.tar.bz2
edk2-2f88bd3a1296c522317f1c21377876de63de5be7.zip
MdePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'MdePkg/Library/BasePciExpressLib')
-rw-r--r--MdePkg/Library/BasePciExpressLib/PciExpressLib.c478
1 files changed, 254 insertions, 224 deletions
diff --git a/MdePkg/Library/BasePciExpressLib/PciExpressLib.c b/MdePkg/Library/BasePciExpressLib/PciExpressLib.c
index 910dd75bb4..df937ec1fb 100644
--- a/MdePkg/Library/BasePciExpressLib/PciExpressLib.c
+++ b/MdePkg/Library/BasePciExpressLib/PciExpressLib.c
@@ -10,7 +10,6 @@
**/
-
#include <Base.h>
#include <Library/BaseLib.h>
@@ -19,7 +18,6 @@
#include <Library/DebugLib.h>
#include <Library/PcdLib.h>
-
/**
Assert the validity of a PCI address. A valid PCI address should contain 1's
only in the low 28 bits. PcdPciExpressBaseSize limits the size to the real
@@ -72,12 +70,12 @@ PciExpressRegisterForRuntimeAccess (
@return The base address of PCI Express.
**/
-VOID*
+VOID *
GetPciExpressBaseAddress (
VOID
)
{
- return (VOID*)(UINTN) PcdGet64 (PcdPciExpressBaseAddress);
+ return (VOID *)(UINTN)PcdGet64 (PcdPciExpressBaseAddress);
}
/**
@@ -95,7 +93,7 @@ PcdPciExpressBaseSize (
VOID
)
{
- return (UINTN) PcdGet64 (PcdPciExpressBaseSize);
+ return (UINTN)PcdGet64 (PcdPciExpressBaseSize);
}
/**
@@ -117,14 +115,15 @@ PcdPciExpressBaseSize (
UINT8
EFIAPI
PciExpressRead8 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
- return MmioRead8 ((UINTN) GetPciExpressBaseAddress () + Address);
+
+ return MmioRead8 ((UINTN)GetPciExpressBaseAddress () + Address);
}
/**
@@ -147,15 +146,16 @@ PciExpressRead8 (
UINT8
EFIAPI
PciExpressWrite8 (
- IN UINTN Address,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINT8 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
- return MmioWrite8 ((UINTN) GetPciExpressBaseAddress () + Address, Value);
+
+ return MmioWrite8 ((UINTN)GetPciExpressBaseAddress () + Address, Value);
}
/**
@@ -182,15 +182,16 @@ PciExpressWrite8 (
UINT8
EFIAPI
PciExpressOr8 (
- IN UINTN Address,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
- return MmioOr8 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);
+
+ return MmioOr8 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
}
/**
@@ -217,15 +218,16 @@ PciExpressOr8 (
UINT8
EFIAPI
PciExpressAnd8 (
- IN UINTN Address,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINT8 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
- return MmioAnd8 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);
+
+ return MmioAnd8 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);
}
/**
@@ -254,17 +256,18 @@ PciExpressAnd8 (
UINT8
EFIAPI
PciExpressAndThenOr8 (
- IN UINTN Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioAndThenOr8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
AndData,
OrData
);
@@ -296,17 +299,18 @@ PciExpressAndThenOr8 (
UINT8
EFIAPI
PciExpressBitFieldRead8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioBitFieldRead8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit
);
@@ -340,18 +344,19 @@ PciExpressBitFieldRead8 (
UINT8
EFIAPI
PciExpressBitFieldWrite8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioBitFieldWrite8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
Value
@@ -389,18 +394,19 @@ PciExpressBitFieldWrite8 (
UINT8
EFIAPI
PciExpressBitFieldOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioBitFieldOr8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
OrData
@@ -438,18 +444,19 @@ PciExpressBitFieldOr8 (
UINT8
EFIAPI
PciExpressBitFieldAnd8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioBitFieldAnd8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData
@@ -491,19 +498,20 @@ PciExpressBitFieldAnd8 (
UINT8
EFIAPI
PciExpressBitFieldAndThenOr8 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT8) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT8)-1;
}
+
return MmioBitFieldAndThenOr8 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData,
@@ -531,14 +539,15 @@ PciExpressBitFieldAndThenOr8 (
UINT16
EFIAPI
PciExpressRead16 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
- return MmioRead16 ((UINTN) GetPciExpressBaseAddress () + Address);
+
+ return MmioRead16 ((UINTN)GetPciExpressBaseAddress () + Address);
}
/**
@@ -562,15 +571,16 @@ PciExpressRead16 (
UINT16
EFIAPI
PciExpressWrite16 (
- IN UINTN Address,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINT16 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
- return MmioWrite16 ((UINTN) GetPciExpressBaseAddress () + Address, Value);
+
+ return MmioWrite16 ((UINTN)GetPciExpressBaseAddress () + Address, Value);
}
/**
@@ -598,15 +608,16 @@ PciExpressWrite16 (
UINT16
EFIAPI
PciExpressOr16 (
- IN UINTN Address,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
- return MmioOr16 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);
+
+ return MmioOr16 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
}
/**
@@ -634,15 +645,16 @@ PciExpressOr16 (
UINT16
EFIAPI
PciExpressAnd16 (
- IN UINTN Address,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINT16 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
- return MmioAnd16 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);
+
+ return MmioAnd16 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);
}
/**
@@ -672,17 +684,18 @@ PciExpressAnd16 (
UINT16
EFIAPI
PciExpressAndThenOr16 (
- IN UINTN Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioAndThenOr16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
AndData,
OrData
);
@@ -715,17 +728,18 @@ PciExpressAndThenOr16 (
UINT16
EFIAPI
PciExpressBitFieldRead16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioBitFieldRead16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit
);
@@ -760,18 +774,19 @@ PciExpressBitFieldRead16 (
UINT16
EFIAPI
PciExpressBitFieldWrite16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioBitFieldWrite16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
Value
@@ -810,18 +825,19 @@ PciExpressBitFieldWrite16 (
UINT16
EFIAPI
PciExpressBitFieldOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioBitFieldOr16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
OrData
@@ -860,18 +876,19 @@ PciExpressBitFieldOr16 (
UINT16
EFIAPI
PciExpressBitFieldAnd16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioBitFieldAnd16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData
@@ -914,19 +931,20 @@ PciExpressBitFieldAnd16 (
UINT16
EFIAPI
PciExpressBitFieldAndThenOr16 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT16) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT16)-1;
}
+
return MmioBitFieldAndThenOr16 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData,
@@ -954,14 +972,15 @@ PciExpressBitFieldAndThenOr16 (
UINT32
EFIAPI
PciExpressRead32 (
- IN UINTN Address
+ IN UINTN Address
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
- return MmioRead32 ((UINTN) GetPciExpressBaseAddress () + Address);
+
+ return MmioRead32 ((UINTN)GetPciExpressBaseAddress () + Address);
}
/**
@@ -985,15 +1004,16 @@ PciExpressRead32 (
UINT32
EFIAPI
PciExpressWrite32 (
- IN UINTN Address,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINT32 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
- return MmioWrite32 ((UINTN) GetPciExpressBaseAddress () + Address, Value);
+
+ return MmioWrite32 ((UINTN)GetPciExpressBaseAddress () + Address, Value);
}
/**
@@ -1021,15 +1041,16 @@ PciExpressWrite32 (
UINT32
EFIAPI
PciExpressOr32 (
- IN UINTN Address,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
- return MmioOr32 ((UINTN) GetPciExpressBaseAddress () + Address, OrData);
+
+ return MmioOr32 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
}
/**
@@ -1057,15 +1078,16 @@ PciExpressOr32 (
UINT32
EFIAPI
PciExpressAnd32 (
- IN UINTN Address,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINT32 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
- return MmioAnd32 ((UINTN) GetPciExpressBaseAddress () + Address, AndData);
+
+ return MmioAnd32 ((UINTN)GetPciExpressBaseAddress () + Address, AndData);
}
/**
@@ -1095,17 +1117,18 @@ PciExpressAnd32 (
UINT32
EFIAPI
PciExpressAndThenOr32 (
- IN UINTN Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioAndThenOr32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
AndData,
OrData
);
@@ -1138,17 +1161,18 @@ PciExpressAndThenOr32 (
UINT32
EFIAPI
PciExpressBitFieldRead32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioBitFieldRead32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit
);
@@ -1183,18 +1207,19 @@ PciExpressBitFieldRead32 (
UINT32
EFIAPI
PciExpressBitFieldWrite32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioBitFieldWrite32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
Value
@@ -1233,18 +1258,19 @@ PciExpressBitFieldWrite32 (
UINT32
EFIAPI
PciExpressBitFieldOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioBitFieldOr32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
OrData
@@ -1283,18 +1309,19 @@ PciExpressBitFieldOr32 (
UINT32
EFIAPI
PciExpressBitFieldAnd32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioBitFieldAnd32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData
@@ -1337,19 +1364,20 @@ PciExpressBitFieldAnd32 (
UINT32
EFIAPI
PciExpressBitFieldAndThenOr32 (
- IN UINTN Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINTN Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
ASSERT_INVALID_PCI_ADDRESS (Address);
- if (Address >= PcdPciExpressBaseSize()) {
- return (UINT32) -1;
+ if (Address >= PcdPciExpressBaseSize ()) {
+ return (UINT32)-1;
}
+
return MmioBitFieldAndThenOr32 (
- (UINTN) GetPciExpressBaseAddress () + Address,
+ (UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData,
@@ -1384,17 +1412,18 @@ PciExpressBitFieldAndThenOr32 (
UINTN
EFIAPI
PciExpressReadBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress);
- if (StartAddress >= PcdPciExpressBaseSize()) {
- return (UINTN) -1;
+ if (StartAddress >= PcdPciExpressBaseSize ()) {
+ return (UINTN)-1;
}
+
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
if (Size == 0) {
@@ -1413,41 +1442,41 @@ PciExpressReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = PciExpressRead8 (StartAddress);
- StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ StartAddress += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
//
// Read a word if StartAddress is word aligned
//
- WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
//
// Read as many double words as possible
//
- WriteUnaligned32 ((UINT32 *) Buffer, (UINT32) PciExpressRead32 (StartAddress));
+ WriteUnaligned32 ((UINT32 *)Buffer, (UINT32)PciExpressRead32 (StartAddress));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
//
// Read the last remaining word if exist
//
- WriteUnaligned16 ((UINT16 *) Buffer, (UINT16) PciExpressRead16 (StartAddress));
+ WriteUnaligned16 ((UINT16 *)Buffer, (UINT16)PciExpressRead16 (StartAddress));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1488,17 +1517,18 @@ PciExpressReadBuffer (
UINTN
EFIAPI
PciExpressWriteBuffer (
- IN UINTN StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINTN StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
+ UINTN ReturnValue;
ASSERT_INVALID_PCI_ADDRESS (StartAddress);
- if (StartAddress >= PcdPciExpressBaseSize()) {
- return (UINTN) -1;
+ if (StartAddress >= PcdPciExpressBaseSize ()) {
+ return (UINTN)-1;
}
+
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
if (Size == 0) {
@@ -1516,47 +1546,47 @@ PciExpressWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);
StartAddress += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (StartAddress & 2) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((StartAddress & 2) != 0)) {
//
// Write a word if StartAddress is word aligned
//
- PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
+ PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
//
// Write as many double words as possible
//
- PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32*)Buffer));
+ PciExpressWrite32 (StartAddress, ReadUnaligned32 ((UINT32 *)Buffer));
StartAddress += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
//
// Write the last remaining word if exist
//
- PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16*)Buffer));
+ PciExpressWrite16 (StartAddress, ReadUnaligned16 ((UINT16 *)Buffer));
StartAddress += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
//
// Write the last remaining byte if exist
//
- PciExpressWrite8 (StartAddress, *(UINT8*)Buffer);
+ PciExpressWrite8 (StartAddress, *(UINT8 *)Buffer);
}
return ReturnValue;