summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/PciSegmentLibSegmentInfo
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/PciSegmentLibSegmentInfo
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/PciSegmentLibSegmentInfo')
-rw-r--r--MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c4
-rw-r--r--MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c30
-rw-r--r--MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c409
-rw-r--r--MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h8
4 files changed, 230 insertions, 221 deletions
diff --git a/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c b/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c
index b0d51c45be..deab86a47a 100644
--- a/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c
+++ b/MdePkg/Library/PciSegmentLibSegmentInfo/BasePciSegmentLib.c
@@ -20,7 +20,7 @@
**/
UINTN
PciSegmentLibVirtualAddress (
- IN UINTN Address
+ IN UINTN Address
)
{
return Address;
@@ -59,6 +59,6 @@ PciSegmentRegisterForRuntimeAccess (
SegmentInfo = GetPciSegmentInfo (&Count);
PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count);
- );
+ );
return RETURN_SUCCESS;
}
diff --git a/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c b/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
index 75931d46e0..a6860b471f 100644
--- a/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
+++ b/MdePkg/Library/PciSegmentLibSegmentInfo/DxeRuntimePciSegmentLib.c
@@ -22,19 +22,19 @@
/// Define table for mapping PCI Segment MMIO physical addresses to virtual addresses at OS runtime
///
typedef struct {
- UINTN PhysicalAddress;
- UINTN VirtualAddress;
+ UINTN PhysicalAddress;
+ UINTN VirtualAddress;
} PCI_SEGMENT_RUNTIME_REGISTRATION_TABLE;
///
/// Set Virtual Address Map Event
///
-EFI_EVENT mDxeRuntimePciSegmentLibVirtualNotifyEvent = NULL;
+EFI_EVENT mDxeRuntimePciSegmentLibVirtualNotifyEvent = NULL;
///
/// The number of PCI devices that have been registered for runtime access.
///
-UINTN mDxeRuntimePciSegmentLibNumberOfRuntimeRanges = 0;
+UINTN mDxeRuntimePciSegmentLibNumberOfRuntimeRanges = 0;
///
/// The table of PCI devices that have been registered for runtime access.
@@ -44,7 +44,7 @@ PCI_SEGMENT_RUNTIME_REGISTRATION_TABLE *mDxeRuntimePciSegmentLibRegistrationTab
///
/// The table index of the most recent virtual address lookup.
///
-UINTN mDxeRuntimePciSegmentLibLastRuntimeRange = 0;
+UINTN mDxeRuntimePciSegmentLibLastRuntimeRange = 0;
/**
Convert the physical PCI Express MMIO addresses for all registered PCI devices
@@ -60,8 +60,8 @@ DxeRuntimePciSegmentLibVirtualNotify (
IN VOID *Context
)
{
- UINTN Index;
- EFI_STATUS Status;
+ UINTN Index;
+ EFI_STATUS Status;
//
// If there have been no runtime registrations, then just return
@@ -75,14 +75,14 @@ DxeRuntimePciSegmentLibVirtualNotify (
// virtual addresses.
//
for (Index = 0; Index < mDxeRuntimePciSegmentLibNumberOfRuntimeRanges; Index++) {
- Status = EfiConvertPointer (0, (VOID **) &(mDxeRuntimePciSegmentLibRegistrationTable[Index].VirtualAddress));
+ Status = EfiConvertPointer (0, (VOID **)&(mDxeRuntimePciSegmentLibRegistrationTable[Index].VirtualAddress));
ASSERT_EFI_ERROR (Status);
}
//
// Convert table pointer that is allocated from EfiRuntimeServicesData to a virtual address.
//
- Status = EfiConvertPointer (0, (VOID **) &mDxeRuntimePciSegmentLibRegistrationTable);
+ Status = EfiConvertPointer (0, (VOID **)&mDxeRuntimePciSegmentLibRegistrationTable);
ASSERT_EFI_ERROR (Status);
}
@@ -194,7 +194,7 @@ PciSegmentRegisterForRuntimeAccess (
// Convert Address to a ECAM address at the beginning of the PCI Configuration
// header for the specified PCI Bus/Dev/Func
//
- Address &= ~(UINTN)EFI_PAGE_MASK;
+ Address &= ~(UINTN)EFI_PAGE_MASK;
SegmentInfo = GetPciSegmentInfo (&Count);
EcamAddress = PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count);
@@ -204,9 +204,11 @@ PciSegmentRegisterForRuntimeAccess (
if (EfiAtRuntime ()) {
return RETURN_UNSUPPORTED;
}
+
if (sizeof (UINTN) == sizeof (UINT32)) {
ASSERT (EcamAddress < BASE_4GB);
}
+
Address = (UINTN)EcamAddress;
//
@@ -246,7 +248,8 @@ PciSegmentRegisterForRuntimeAccess (
if (NewTable == NULL) {
return RETURN_OUT_OF_RESOURCES;
}
- mDxeRuntimePciSegmentLibRegistrationTable = NewTable;
+
+ mDxeRuntimePciSegmentLibRegistrationTable = NewTable;
mDxeRuntimePciSegmentLibRegistrationTable[mDxeRuntimePciSegmentLibNumberOfRuntimeRanges].PhysicalAddress = Address;
mDxeRuntimePciSegmentLibRegistrationTable[mDxeRuntimePciSegmentLibNumberOfRuntimeRanges].VirtualAddress = Address;
mDxeRuntimePciSegmentLibNumberOfRuntimeRanges++;
@@ -263,10 +266,11 @@ PciSegmentRegisterForRuntimeAccess (
**/
UINTN
PciSegmentLibVirtualAddress (
- IN UINTN Address
+ IN UINTN Address
)
{
- UINTN Index;
+ UINTN Index;
+
//
// If SetVirtualAddressMap() has not been called, then just return the physical address
//
diff --git a/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c b/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c
index a76e9d9adf..c6cc32d463 100644
--- a/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c
+++ b/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.c
@@ -10,13 +10,13 @@
#include "PciSegmentLibCommon.h"
typedef struct {
- UINT32 Register : 12;
- UINT32 Function : 3;
- UINT32 Device : 5;
- UINT32 Bus : 8;
- UINT32 Reserved1 : 4;
- UINT32 Segment : 16;
- UINT32 Reserved2 : 16;
+ UINT32 Register : 12;
+ UINT32 Function : 3;
+ UINT32 Device : 5;
+ UINT32 Bus : 8;
+ UINT32 Reserved1 : 4;
+ UINT32 Segment : 16;
+ UINT32 Reserved2 : 16;
} PCI_SEGMENT_LIB_ADDRESS_STRUCTURE;
/**
@@ -32,31 +32,34 @@ typedef struct {
**/
UINTN
PciSegmentLibGetEcamAddress (
- IN UINT64 Address,
- IN CONST PCI_SEGMENT_INFO *SegmentInfo,
- IN UINTN Count
+ IN UINT64 Address,
+ IN CONST PCI_SEGMENT_INFO *SegmentInfo,
+ IN UINTN Count
)
{
while (Count != 0) {
if (SegmentInfo->SegmentNumber == ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Segment) {
break;
}
+
SegmentInfo++;
Count--;
}
+
ASSERT (Count != 0);
ASSERT (
(((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Reserved1 == 0) &&
(((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Reserved2 == 0)
- );
+ );
ASSERT (((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Bus >= SegmentInfo->StartBusNumber);
ASSERT (((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Bus <= SegmentInfo->EndBusNumber);
Address = SegmentInfo->BaseAddress + PCI_ECAM_ADDRESS (
- ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Bus,
- ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Device,
- ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Function,
- ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Register);
+ ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Bus,
+ ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Device,
+ ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Function,
+ ((PCI_SEGMENT_LIB_ADDRESS_STRUCTURE *)&Address)->Register
+ );
if (sizeof (UINTN) == sizeof (UINT32)) {
ASSERT (Address < BASE_4GB);
@@ -81,11 +84,11 @@ PciSegmentLibGetEcamAddress (
UINT8
EFIAPI
PciSegmentRead8 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioRead8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count));
@@ -108,12 +111,12 @@ PciSegmentRead8 (
UINT8
EFIAPI
PciSegmentWrite8 (
- IN UINT64 Address,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINT8 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioWrite8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value);
@@ -139,12 +142,12 @@ PciSegmentWrite8 (
UINT8
EFIAPI
PciSegmentOr8 (
- IN UINT64 Address,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), OrData);
@@ -169,12 +172,12 @@ PciSegmentOr8 (
UINT8
EFIAPI
PciSegmentAnd8 (
- IN UINT64 Address,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINT8 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAnd8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData);
@@ -203,13 +206,13 @@ PciSegmentAnd8 (
UINT8
EFIAPI
PciSegmentAndThenOr8 (
- IN UINT64 Address,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAndThenOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData);
@@ -239,13 +242,13 @@ PciSegmentAndThenOr8 (
UINT8
EFIAPI
PciSegmentBitFieldRead8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldRead8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit);
@@ -278,14 +281,14 @@ PciSegmentBitFieldRead8 (
UINT8
EFIAPI
PciSegmentBitFieldWrite8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldWrite8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, Value);
@@ -321,14 +324,14 @@ PciSegmentBitFieldWrite8 (
UINT8
EFIAPI
PciSegmentBitFieldOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData);
@@ -364,14 +367,14 @@ PciSegmentBitFieldOr8 (
UINT8
EFIAPI
PciSegmentBitFieldAnd8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAnd8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData);
@@ -410,15 +413,15 @@ PciSegmentBitFieldAnd8 (
UINT8
EFIAPI
PciSegmentBitFieldAndThenOr8 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT8 AndData,
- IN UINT8 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT8 AndData,
+ IN UINT8 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAndThenOr8 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData, OrData);
@@ -441,11 +444,11 @@ PciSegmentBitFieldAndThenOr8 (
UINT16
EFIAPI
PciSegmentRead16 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioRead16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count));
@@ -469,12 +472,12 @@ PciSegmentRead16 (
UINT16
EFIAPI
PciSegmentWrite16 (
- IN UINT64 Address,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINT16 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioWrite16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value);
@@ -503,12 +506,12 @@ PciSegmentWrite16 (
UINT16
EFIAPI
PciSegmentOr16 (
- IN UINT64 Address,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), OrData);
@@ -535,12 +538,12 @@ PciSegmentOr16 (
UINT16
EFIAPI
PciSegmentAnd16 (
- IN UINT64 Address,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINT16 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAnd16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData);
@@ -570,13 +573,13 @@ PciSegmentAnd16 (
UINT16
EFIAPI
PciSegmentAndThenOr16 (
- IN UINT64 Address,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAndThenOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData);
@@ -607,13 +610,13 @@ PciSegmentAndThenOr16 (
UINT16
EFIAPI
PciSegmentBitFieldRead16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldRead16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit);
@@ -647,14 +650,14 @@ PciSegmentBitFieldRead16 (
UINT16
EFIAPI
PciSegmentBitFieldWrite16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldWrite16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, Value);
@@ -691,14 +694,14 @@ PciSegmentBitFieldWrite16 (
UINT16
EFIAPI
PciSegmentBitFieldOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData);
@@ -735,14 +738,14 @@ PciSegmentBitFieldOr16 (
UINT16
EFIAPI
PciSegmentBitFieldAnd16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAnd16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData);
@@ -782,15 +785,16 @@ PciSegmentBitFieldAnd16 (
UINT16
EFIAPI
PciSegmentBitFieldAndThenOr16 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT16 AndData,
- IN UINT16 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT16 AndData,
+ IN UINT16 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
+
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAndThenOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData, OrData);
}
@@ -812,11 +816,11 @@ PciSegmentBitFieldAndThenOr16 (
UINT32
EFIAPI
PciSegmentRead32 (
- IN UINT64 Address
+ IN UINT64 Address
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioRead32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count));
@@ -840,12 +844,12 @@ PciSegmentRead32 (
UINT32
EFIAPI
PciSegmentWrite32 (
- IN UINT64 Address,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINT32 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioWrite32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value);
@@ -872,12 +876,12 @@ PciSegmentWrite32 (
UINT32
EFIAPI
PciSegmentOr32 (
- IN UINT64 Address,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), OrData);
@@ -904,12 +908,12 @@ PciSegmentOr32 (
UINT32
EFIAPI
PciSegmentAnd32 (
- IN UINT64 Address,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINT32 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAnd32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData);
@@ -939,13 +943,13 @@ PciSegmentAnd32 (
UINT32
EFIAPI
PciSegmentAndThenOr32 (
- IN UINT64 Address,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioAndThenOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), AndData, OrData);
@@ -976,13 +980,13 @@ PciSegmentAndThenOr32 (
UINT32
EFIAPI
PciSegmentBitFieldRead32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldRead32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit);
@@ -1016,14 +1020,14 @@ PciSegmentBitFieldRead32 (
UINT32
EFIAPI
PciSegmentBitFieldWrite32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 Value
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 Value
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldWrite32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, Value);
@@ -1059,14 +1063,14 @@ PciSegmentBitFieldWrite32 (
UINT32
EFIAPI
PciSegmentBitFieldOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, OrData);
@@ -1102,14 +1106,14 @@ PciSegmentBitFieldOr32 (
UINT32
EFIAPI
PciSegmentBitFieldAnd32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAnd32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData);
@@ -1149,15 +1153,16 @@ PciSegmentBitFieldAnd32 (
UINT32
EFIAPI
PciSegmentBitFieldAndThenOr32 (
- IN UINT64 Address,
- IN UINTN StartBit,
- IN UINTN EndBit,
- IN UINT32 AndData,
- IN UINT32 OrData
+ IN UINT64 Address,
+ IN UINTN StartBit,
+ IN UINTN EndBit,
+ IN UINT32 AndData,
+ IN UINT32 OrData
)
{
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
+
SegmentInfo = GetPciSegmentInfo (&Count);
return MmioBitFieldAndThenOr32 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData, OrData);
}
@@ -1188,20 +1193,20 @@ PciSegmentBitFieldAndThenOr32 (
UINTN
EFIAPI
PciSegmentReadBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- OUT VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ OUT VOID *Buffer
)
{
- UINTN ReturnValue;
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
- UINTN Address;
+ UINTN ReturnValue;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Address;
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
SegmentInfo = GetPciSegmentInfo (&Count);
- Address = PciSegmentLibGetEcamAddress (StartAddress, SegmentInfo, Count);
+ Address = PciSegmentLibGetEcamAddress (StartAddress, SegmentInfo, Count);
if (Size == 0) {
return 0;
@@ -1219,19 +1224,19 @@ PciSegmentReadBuffer (
// Read a byte if StartAddress is byte aligned
//
*(volatile UINT8 *)Buffer = MmioRead8 (Address);
- Address += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Address += sizeof (UINT8);
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (Address & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((Address & BIT1) != 0)) {
//
// Read a word if StartAddress is word aligned
//
WriteUnaligned16 (Buffer, MmioRead16 (Address));
Address += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1240,8 +1245,8 @@ PciSegmentReadBuffer (
//
WriteUnaligned32 (Buffer, MmioRead32 (Address));
Address += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1250,8 +1255,8 @@ PciSegmentReadBuffer (
//
WriteUnaligned16 (Buffer, MmioRead16 (Address));
Address += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
if (Size >= sizeof (UINT8)) {
@@ -1291,20 +1296,20 @@ PciSegmentReadBuffer (
UINTN
EFIAPI
PciSegmentWriteBuffer (
- IN UINT64 StartAddress,
- IN UINTN Size,
- IN VOID *Buffer
+ IN UINT64 StartAddress,
+ IN UINTN Size,
+ IN VOID *Buffer
)
{
- UINTN ReturnValue;
- UINTN Count;
- PCI_SEGMENT_INFO *SegmentInfo;
- UINTN Address;
+ UINTN ReturnValue;
+ UINTN Count;
+ PCI_SEGMENT_INFO *SegmentInfo;
+ UINTN Address;
ASSERT (((StartAddress & 0xFFF) + Size) <= 0x1000);
SegmentInfo = GetPciSegmentInfo (&Count);
- Address = PciSegmentLibGetEcamAddress (StartAddress, SegmentInfo, Count);
+ Address = PciSegmentLibGetEcamAddress (StartAddress, SegmentInfo, Count);
if (Size == 0) {
return 0;
@@ -1321,20 +1326,20 @@ PciSegmentWriteBuffer (
//
// Write a byte if StartAddress is byte aligned
//
- MmioWrite8 (Address, *(UINT8*)Buffer);
+ MmioWrite8 (Address, *(UINT8 *)Buffer);
Address += sizeof (UINT8);
- Size -= sizeof (UINT8);
- Buffer = (UINT8*)Buffer + 1;
+ Size -= sizeof (UINT8);
+ Buffer = (UINT8 *)Buffer + 1;
}
- if (Size >= sizeof (UINT16) && (Address & BIT1) != 0) {
+ if ((Size >= sizeof (UINT16)) && ((Address & BIT1) != 0)) {
//
// Write a word if StartAddress is word aligned
//
MmioWrite16 (Address, ReadUnaligned16 (Buffer));
Address += sizeof (UINT16);
- Size -= sizeof (UINT16);
- Buffer = (UINT16*)Buffer + 1;
+ Size -= sizeof (UINT16);
+ Buffer = (UINT16 *)Buffer + 1;
}
while (Size >= sizeof (UINT32)) {
@@ -1343,8 +1348,8 @@ PciSegmentWriteBuffer (
//
MmioWrite32 (Address, ReadUnaligned32 (Buffer));
Address += sizeof (UINT32);
- Size -= sizeof (UINT32);
- Buffer = (UINT32*)Buffer + 1;
+ Size -= sizeof (UINT32);
+ Buffer = (UINT32 *)Buffer + 1;
}
if (Size >= sizeof (UINT16)) {
@@ -1353,15 +1358,15 @@ PciSegmentWriteBuffer (
//
MmioWrite16 (Address, ReadUnaligned16 (Buffer));
Address += 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
//
- MmioWrite8 (Address, *(UINT8*)Buffer);
+ MmioWrite8 (Address, *(UINT8 *)Buffer);
}
return ReturnValue;
diff --git a/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h b/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h
index 4668372816..f103bf6c26 100644
--- a/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h
+++ b/MdePkg/Library/PciSegmentLibSegmentInfo/PciSegmentLibCommon.h
@@ -27,7 +27,7 @@
**/
UINTN
PciSegmentLibVirtualAddress (
- IN UINTN Address
+ IN UINTN Address
);
/**
@@ -43,9 +43,9 @@ PciSegmentLibVirtualAddress (
**/
UINTN
PciSegmentLibGetEcamAddress (
- IN UINT64 Address,
- IN CONST PCI_SEGMENT_INFO *SegmentInfo,
- IN UINTN Count
+ IN UINT64 Address,
+ IN CONST PCI_SEGMENT_INFO *SegmentInfo,
+ IN UINTN Count
);
#endif