MdeModulePkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the MdeModulePkg 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>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:02 -08:00
committed by mergify[bot]
parent 7c7184e201
commit 1436aea4d5
994 changed files with 107608 additions and 101311 deletions

View File

@@ -17,12 +17,12 @@
//
STATIC
EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
EFI_UNICODE_STRING_TABLE mDriverNameTable[] = {
{ "eng;en", L"PCI I/O protocol emulation driver for non-discoverable devices" },
{ NULL, NULL }
{ NULL, NULL }
};
EFI_COMPONENT_NAME_PROTOCOL gComponentName;
EFI_COMPONENT_NAME_PROTOCOL gComponentName;
/**
Retrieves a Unicode string that is the user readable name of the UEFI Driver.
@@ -49,9 +49,9 @@ STATIC
EFI_STATUS
EFIAPI
NonDiscoverablePciGetDriverName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN CHAR8 *Language,
OUT CHAR16 **DriverName
)
{
return LookupUnicodeString2 (
@@ -93,24 +93,24 @@ STATIC
EFI_STATUS
EFIAPI
NonDiscoverablePciGetDeviceName (
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE DeviceHandle,
IN EFI_HANDLE ChildHandle,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
IN EFI_COMPONENT_NAME_PROTOCOL *This,
IN EFI_HANDLE DeviceHandle,
IN EFI_HANDLE ChildHandle,
IN CHAR8 *Language,
OUT CHAR16 **ControllerName
)
{
return EFI_UNSUPPORTED;
}
EFI_COMPONENT_NAME_PROTOCOL gComponentName = {
EFI_COMPONENT_NAME_PROTOCOL gComponentName = {
&NonDiscoverablePciGetDriverName,
&NonDiscoverablePciGetDeviceName,
"eng" // SupportedLanguages, ISO 639-2 language codes
};
EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) &NonDiscoverablePciGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) &NonDiscoverablePciGetDeviceName,
EFI_COMPONENT_NAME2_PROTOCOL gComponentName2 = {
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)&NonDiscoverablePciGetDriverName,
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)&NonDiscoverablePciGetDeviceName,
"en" // SupportedLanguages, RFC 4646 language codes
};

View File

@@ -10,16 +10,16 @@
#include <Protocol/DriverBinding.h>
#define MAX_NON_DISCOVERABLE_PCI_DEVICE_ID (32 * 256)
#define MAX_NON_DISCOVERABLE_PCI_DEVICE_ID (32 * 256)
STATIC UINTN mUniqueIdCounter = 0;
EFI_CPU_ARCH_PROTOCOL *mCpu;
STATIC UINTN mUniqueIdCounter = 0;
EFI_CPU_ARCH_PROTOCOL *mCpu;
//
// We only support the following device types
//
STATIC
CONST EFI_GUID * CONST
CONST EFI_GUID *CONST
SupportedNonDiscoverableDevices[] = {
&gEdkiiNonDiscoverableAhciDeviceGuid,
&gEdkiiNonDiscoverableEhciDeviceGuid,
@@ -63,27 +63,31 @@ STATIC
EFI_STATUS
EFIAPI
NonDiscoverablePciDeviceSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE DeviceHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE DeviceHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
NON_DISCOVERABLE_DEVICE *Device;
EFI_STATUS Status;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc;
INTN Idx;
NON_DISCOVERABLE_DEVICE *Device;
EFI_STATUS Status;
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Desc;
INTN Idx;
Status = gBS->OpenProtocol (DeviceHandle,
&gEdkiiNonDiscoverableDeviceProtocolGuid, (VOID **)&Device,
This->DriverBindingHandle, DeviceHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER);
Status = gBS->OpenProtocol (
DeviceHandle,
&gEdkiiNonDiscoverableDeviceProtocolGuid,
(VOID **)&Device,
This->DriverBindingHandle,
DeviceHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
return Status;
}
Status = EFI_UNSUPPORTED;
for (Idx = 0; Idx < ARRAY_SIZE (SupportedNonDiscoverableDevices); Idx++) {
if (CompareGuid (Device->Type, SupportedNonDiscoverableDevices [Idx])) {
if (CompareGuid (Device->Type, SupportedNonDiscoverableDevices[Idx])) {
Status = EFI_SUCCESS;
break;
}
@@ -98,17 +102,23 @@ NonDiscoverablePciDeviceSupported (
// that they only describe things that we can handle
//
for (Desc = Device->Resources; Desc->Desc != ACPI_END_TAG_DESCRIPTOR;
Desc = (VOID *)((UINT8 *)Desc + Desc->Len + 3)) {
if (Desc->Desc != ACPI_ADDRESS_SPACE_DESCRIPTOR ||
Desc->ResType != ACPI_ADDRESS_SPACE_TYPE_MEM) {
Desc = (VOID *)((UINT8 *)Desc + Desc->Len + 3))
{
if ((Desc->Desc != ACPI_ADDRESS_SPACE_DESCRIPTOR) ||
(Desc->ResType != ACPI_ADDRESS_SPACE_TYPE_MEM))
{
Status = EFI_UNSUPPORTED;
break;
}
}
CloseProtocol:
gBS->CloseProtocol (DeviceHandle, &gEdkiiNonDiscoverableDeviceProtocolGuid,
This->DriverBindingHandle, DeviceHandle);
gBS->CloseProtocol (
DeviceHandle,
&gEdkiiNonDiscoverableDeviceProtocolGuid,
This->DriverBindingHandle,
DeviceHandle
);
return Status;
}
@@ -130,13 +140,13 @@ STATIC
EFI_STATUS
EFIAPI
NonDiscoverablePciDeviceStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE DeviceHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE DeviceHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
NON_DISCOVERABLE_PCI_DEVICE *Dev;
EFI_STATUS Status;
NON_DISCOVERABLE_PCI_DEVICE *Dev;
EFI_STATUS Status;
ASSERT (mUniqueIdCounter < MAX_NON_DISCOVERABLE_PCI_DEVICE_ID);
if (mUniqueIdCounter >= MAX_NON_DISCOVERABLE_PCI_DEVICE_ID) {
@@ -148,10 +158,14 @@ NonDiscoverablePciDeviceStart (
return EFI_OUT_OF_RESOURCES;
}
Status = gBS->OpenProtocol (DeviceHandle,
Status = gBS->OpenProtocol (
DeviceHandle,
&gEdkiiNonDiscoverableDeviceProtocolGuid,
(VOID **)&Dev->Device, This->DriverBindingHandle,
DeviceHandle, EFI_OPEN_PROTOCOL_BY_DRIVER);
(VOID **)&Dev->Device,
This->DriverBindingHandle,
DeviceHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
);
if (EFI_ERROR (Status)) {
goto FreeDev;
}
@@ -163,8 +177,12 @@ NonDiscoverablePciDeviceStart (
// EFI_PCI_IO_PROTOCOL interface.
//
Dev->Signature = NON_DISCOVERABLE_PCI_DEVICE_SIG;
Status = gBS->InstallProtocolInterface (&DeviceHandle, &gEfiPciIoProtocolGuid,
EFI_NATIVE_INTERFACE, &Dev->PciIo);
Status = gBS->InstallProtocolInterface (
&DeviceHandle,
&gEfiPciIoProtocolGuid,
EFI_NATIVE_INTERFACE,
&Dev->PciIo
);
if (EFI_ERROR (Status)) {
goto CloseProtocol;
}
@@ -174,8 +192,12 @@ NonDiscoverablePciDeviceStart (
return EFI_SUCCESS;
CloseProtocol:
gBS->CloseProtocol (DeviceHandle, &gEdkiiNonDiscoverableDeviceProtocolGuid,
This->DriverBindingHandle, DeviceHandle);
gBS->CloseProtocol (
DeviceHandle,
&gEdkiiNonDiscoverableDeviceProtocolGuid,
This->DriverBindingHandle,
DeviceHandle
);
FreeDev:
FreePool (Dev);
@@ -199,19 +221,24 @@ STATIC
EFI_STATUS
EFIAPI
NonDiscoverablePciDeviceStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE DeviceHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE DeviceHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
NON_DISCOVERABLE_PCI_DEVICE *Dev;
EFI_STATUS Status;
EFI_PCI_IO_PROTOCOL *PciIo;
NON_DISCOVERABLE_PCI_DEVICE *Dev;
Status = gBS->OpenProtocol (DeviceHandle, &gEfiPciIoProtocolGuid,
(VOID **)&PciIo, This->DriverBindingHandle, DeviceHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
Status = gBS->OpenProtocol (
DeviceHandle,
&gEfiPciIoProtocolGuid,
(VOID **)&PciIo,
This->DriverBindingHandle,
DeviceHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -221,27 +248,33 @@ NonDiscoverablePciDeviceStop (
//
// Handle Stop() requests for in-use driver instances gracefully.
//
Status = gBS->UninstallProtocolInterface (DeviceHandle,
&gEfiPciIoProtocolGuid, &Dev->PciIo);
Status = gBS->UninstallProtocolInterface (
DeviceHandle,
&gEfiPciIoProtocolGuid,
&Dev->PciIo
);
if (EFI_ERROR (Status)) {
return Status;
}
gBS->CloseProtocol (DeviceHandle, &gEdkiiNonDiscoverableDeviceProtocolGuid,
This->DriverBindingHandle, DeviceHandle);
gBS->CloseProtocol (
DeviceHandle,
&gEdkiiNonDiscoverableDeviceProtocolGuid,
This->DriverBindingHandle,
DeviceHandle
);
FreePool (Dev);
return EFI_SUCCESS;
}
//
// The static object that groups the Supported() (ie. probe), Start() and
// Stop() functions of the driver together. Refer to UEFI Spec 2.3.1 + Errata
// C, 10.1 EFI Driver Binding Protocol.
//
STATIC EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {
STATIC EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {
&NonDiscoverablePciDeviceSupported,
&NonDiscoverablePciDeviceStart,
&NonDiscoverablePciDeviceStop,
@@ -263,14 +296,14 @@ STATIC EFI_DRIVER_BINDING_PROTOCOL gDriverBinding = {
EFI_STATUS
EFIAPI
NonDiscoverablePciDeviceDxeEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&mCpu);
ASSERT_EFI_ERROR(Status);
ASSERT_EFI_ERROR (Status);
return EfiLibInstallDriverBindingComponentName2 (
ImageHandle,

View File

@@ -24,7 +24,7 @@
#include <Protocol/Cpu.h>
#include <Protocol/PciIo.h>
#define NON_DISCOVERABLE_PCI_DEVICE_SIG SIGNATURE_32 ('P', 'P', 'I', 'D')
#define NON_DISCOVERABLE_PCI_DEVICE_SIG SIGNATURE_32 ('P', 'P', 'I', 'D')
#define NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO(PciIoPointer) \
CR (PciIoPointer, NON_DISCOVERABLE_PCI_DEVICE, PciIo, \
@@ -33,74 +33,74 @@
#define DEV_SUPPORTED_ATTRIBUTES \
(EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE)
#define PCI_ID_VENDOR_UNKNOWN 0xffff
#define PCI_ID_DEVICE_DONTCARE 0x0000
#define PCI_ID_VENDOR_UNKNOWN 0xffff
#define PCI_ID_DEVICE_DONTCARE 0x0000
extern EFI_CPU_ARCH_PROTOCOL *mCpu;
extern EFI_CPU_ARCH_PROTOCOL *mCpu;
typedef struct {
//
// The linked-list next pointer
//
LIST_ENTRY List;
LIST_ENTRY List;
//
// The address of the uncached allocation
//
VOID *HostAddress;
VOID *HostAddress;
//
// The number of pages in the allocation
//
UINTN NumPages;
UINTN NumPages;
//
// The attributes of the allocation
//
UINT64 Attributes;
UINT64 Attributes;
} NON_DISCOVERABLE_DEVICE_UNCACHED_ALLOCATION;
typedef struct {
UINT32 Signature;
UINT32 Signature;
//
// The bound non-discoverable device protocol instance
//
NON_DISCOVERABLE_DEVICE *Device;
NON_DISCOVERABLE_DEVICE *Device;
//
// The exposed PCI I/O protocol instance.
//
EFI_PCI_IO_PROTOCOL PciIo;
EFI_PCI_IO_PROTOCOL PciIo;
//
// The emulated PCI config space of the device. Only the minimally required
// items are assigned.
//
PCI_TYPE00 ConfigSpace;
PCI_TYPE00 ConfigSpace;
//
// The first virtual BAR to assign based on the resources described
// by the non-discoverable device.
//
UINT32 BarOffset;
UINT32 BarOffset;
//
// The number of virtual BARs we expose based on the number of
// resources
//
UINT32 BarCount;
UINT32 BarCount;
//
// The PCI I/O attributes for this device
//
UINT64 Attributes;
UINT64 Attributes;
//
// Whether this device has been enabled
//
BOOLEAN Enabled;
BOOLEAN Enabled;
//
// Linked list to keep track of uncached allocations performed
// on behalf of this device
//
LIST_ENTRY UncachedAllocationList;
LIST_ENTRY UncachedAllocationList;
//
// Unique ID for this device instance: needed so that we can report unique
// segment/bus/device number for each device instance. Note that this number
// may change when disconnecting/reconnecting the driver.
//
UINTN UniqueId;
UINTN UniqueId;
} NON_DISCOVERABLE_PCI_DEVICE;
/**
@@ -111,10 +111,10 @@ typedef struct {
**/
VOID
InitializePciIoProtocol (
NON_DISCOVERABLE_PCI_DEVICE *Device
NON_DISCOVERABLE_PCI_DEVICE *Device
);
extern EFI_COMPONENT_NAME_PROTOCOL gComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2;
extern EFI_COMPONENT_NAME_PROTOCOL gComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gComponentName2;
#endif