RedfishPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the RedfishPkg 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: Abner Chang <abner.chang@hpe.com>
This commit is contained in:
committed by
mergify[bot]
parent
5220bd211d
commit
39de741e2d
@@ -33,20 +33,20 @@ RedfishCreateSmbiosTable42 (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
REDFISH_INTERFACE_DATA *DeviceDescriptor;
|
||||
UINT8 DeviceDataLength;
|
||||
UINT8 DeviceType;
|
||||
EFI_STATUS Status;
|
||||
MC_HOST_INTERFACE_PROTOCOL_RECORD *ProtocolRecord;
|
||||
VOID *ProtocolRecords;
|
||||
VOID *NewProtocolRecords;
|
||||
UINT8 ProtocolCount;
|
||||
UINT8 CurrentProtocolsDataLength;
|
||||
UINT8 NewProtocolsDataLength;
|
||||
UINT8 ProtocolDataSize;
|
||||
SMBIOS_TABLE_TYPE42 *Type42Record;
|
||||
EFI_SMBIOS_PROTOCOL *Smbios;
|
||||
EFI_SMBIOS_HANDLE MemArrayMappedAddrSmbiosHandle;
|
||||
REDFISH_INTERFACE_DATA *DeviceDescriptor;
|
||||
UINT8 DeviceDataLength;
|
||||
UINT8 DeviceType;
|
||||
EFI_STATUS Status;
|
||||
MC_HOST_INTERFACE_PROTOCOL_RECORD *ProtocolRecord;
|
||||
VOID *ProtocolRecords;
|
||||
VOID *NewProtocolRecords;
|
||||
UINT8 ProtocolCount;
|
||||
UINT8 CurrentProtocolsDataLength;
|
||||
UINT8 NewProtocolsDataLength;
|
||||
UINT8 ProtocolDataSize;
|
||||
SMBIOS_TABLE_TYPE42 *Type42Record;
|
||||
EFI_SMBIOS_PROTOCOL *Smbios;
|
||||
EFI_SMBIOS_HANDLE MemArrayMappedAddrSmbiosHandle;
|
||||
|
||||
//
|
||||
// Get platform Redfish host interface device type descriptor data.
|
||||
@@ -57,46 +57,55 @@ RedfishCreateSmbiosTable42 (
|
||||
DEBUG ((DEBUG_ERROR, "%a: No Redfish host interface descriptor is provided on this platform.", __FUNCTION__));
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
DEBUG((DEBUG_ERROR, "%a: Fail to get device descriptor, %r.", __FUNCTION__, Status));
|
||||
|
||||
DEBUG ((DEBUG_ERROR, "%a: Fail to get device descriptor, %r.", __FUNCTION__, Status));
|
||||
return Status;
|
||||
}
|
||||
if (DeviceType != REDFISH_HOST_INTERFACE_DEVICE_TYPE_USB_V2 &&
|
||||
DeviceType != REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2
|
||||
) {
|
||||
|
||||
if ((DeviceType != REDFISH_HOST_INTERFACE_DEVICE_TYPE_USB_V2) &&
|
||||
(DeviceType != REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2)
|
||||
)
|
||||
{
|
||||
DEBUG ((DEBUG_ERROR, "%a: Only support either protocol type 04h or 05h as Redfish host interface.", __FUNCTION__));
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
if (DeviceType == REDFISH_HOST_INTERFACE_DEVICE_TYPE_PCI_PCIE_V2) {
|
||||
DeviceDataLength = DeviceDescriptor->DeviceDescriptor.PciPcieDeviceV2.Length;
|
||||
} else {
|
||||
DeviceDataLength = DeviceDescriptor->DeviceDescriptor.UsbDeviceV2.Length;
|
||||
}
|
||||
|
||||
//
|
||||
// Loop to get platform Redfish host interface protocol type data.
|
||||
//
|
||||
ProtocolRecord = NULL;
|
||||
ProtocolRecords = NULL;
|
||||
NewProtocolRecords = NULL;
|
||||
Type42Record = NULL;
|
||||
ProtocolCount = 0;
|
||||
ProtocolRecord = NULL;
|
||||
ProtocolRecords = NULL;
|
||||
NewProtocolRecords = NULL;
|
||||
Type42Record = NULL;
|
||||
ProtocolCount = 0;
|
||||
CurrentProtocolsDataLength = 0;
|
||||
NewProtocolsDataLength = 0;
|
||||
NewProtocolsDataLength = 0;
|
||||
while (TRUE) {
|
||||
Status = RedfishPlatformHostInterfaceProtocolData (&ProtocolRecord, ProtocolCount);
|
||||
if (Status == EFI_NOT_FOUND) {
|
||||
break;
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Fail to get Redfish host interafce protocol type data.", __FUNCTION__));
|
||||
if (ProtocolRecords != NULL) {
|
||||
FreePool (ProtocolRecords);
|
||||
}
|
||||
|
||||
if (ProtocolRecord != NULL) {
|
||||
FreePool (ProtocolRecord);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
ProtocolDataSize = sizeof (MC_HOST_INTERFACE_PROTOCOL_RECORD) - sizeof(ProtocolRecord->ProtocolTypeData) + ProtocolRecord->ProtocolTypeDataLen;
|
||||
|
||||
ProtocolDataSize = sizeof (MC_HOST_INTERFACE_PROTOCOL_RECORD) - sizeof (ProtocolRecord->ProtocolTypeData) + ProtocolRecord->ProtocolTypeDataLen;
|
||||
NewProtocolsDataLength += ProtocolDataSize;
|
||||
if (ProtocolRecords == NULL) {
|
||||
ProtocolRecords = AllocateZeroPool (NewProtocolsDataLength);
|
||||
@@ -104,29 +113,34 @@ RedfishCreateSmbiosTable42 (
|
||||
FreePool (ProtocolRecord);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CopyMem ((VOID *)ProtocolRecords, (VOID *)ProtocolRecord, ProtocolDataSize);
|
||||
NewProtocolRecords = ProtocolRecords;
|
||||
} else {
|
||||
NewProtocolRecords = ReallocatePool(CurrentProtocolsDataLength, NewProtocolsDataLength, (VOID *)ProtocolRecords);
|
||||
NewProtocolRecords = ReallocatePool (CurrentProtocolsDataLength, NewProtocolsDataLength, (VOID *)ProtocolRecords);
|
||||
if (NewProtocolRecords == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for Redfish host interface protocol data."));
|
||||
FreePool (ProtocolRecords);
|
||||
FreePool (ProtocolRecord);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
CopyMem (
|
||||
(VOID *)((UINT8 *)NewProtocolRecords + CurrentProtocolsDataLength),
|
||||
(VOID *)ProtocolRecord,
|
||||
ProtocolDataSize
|
||||
);
|
||||
}
|
||||
|
||||
FreePool (ProtocolRecord);
|
||||
CurrentProtocolsDataLength = NewProtocolsDataLength;
|
||||
ProtocolCount ++;
|
||||
};
|
||||
ProtocolCount++;
|
||||
}
|
||||
|
||||
if (ProtocolCount == 0) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
//
|
||||
// Construct SMBIOS Type 42h for Redfish host inteface.
|
||||
//
|
||||
@@ -140,13 +154,13 @@ RedfishCreateSmbiosTable42 (
|
||||
// 06h+n number of protocols defined for the host interface (typically 1)
|
||||
// 07h+n Include a Protocol Record for each protocol supported.
|
||||
//
|
||||
Type42Record = (SMBIOS_TABLE_TYPE42 *) AllocateZeroPool (
|
||||
sizeof (SMBIOS_TABLE_TYPE42) - 4
|
||||
+ DeviceDataLength
|
||||
+ 1 /// For Protocol Record Count
|
||||
+ CurrentProtocolsDataLength
|
||||
+ 2 /// Double NULL terminator/
|
||||
);
|
||||
Type42Record = (SMBIOS_TABLE_TYPE42 *)AllocateZeroPool (
|
||||
sizeof (SMBIOS_TABLE_TYPE42) - 4
|
||||
+ DeviceDataLength
|
||||
+ 1 /// For Protocol Record Count
|
||||
+ CurrentProtocolsDataLength
|
||||
+ 2 /// Double NULL terminator/
|
||||
);
|
||||
if (Type42Record == NULL) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ON_EXIT;
|
||||
@@ -154,10 +168,10 @@ RedfishCreateSmbiosTable42 (
|
||||
|
||||
Type42Record->Hdr.Type = EFI_SMBIOS_TYPE_MANAGEMENT_CONTROLLER_HOST_INTERFACE;
|
||||
Type42Record->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE42) - 4
|
||||
+ DeviceDataLength
|
||||
+ 1
|
||||
+ CurrentProtocolsDataLength;
|
||||
Type42Record->Hdr.Handle = 0;
|
||||
+ DeviceDataLength
|
||||
+ 1
|
||||
+ CurrentProtocolsDataLength;
|
||||
Type42Record->Hdr.Handle = 0;
|
||||
Type42Record->InterfaceType = MCHostInterfaceTypeNetworkHostInterface; // Network Host Interface
|
||||
|
||||
//
|
||||
@@ -189,34 +203,38 @@ RedfishCreateSmbiosTable42 (
|
||||
//
|
||||
// 5. Add Redfish interface data record to SMBIOS table 42
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
|
||||
Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&Smbios);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
MemArrayMappedAddrSmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
|
||||
Status = Smbios->Add (
|
||||
Smbios,
|
||||
NULL,
|
||||
&MemArrayMappedAddrSmbiosHandle,
|
||||
(EFI_SMBIOS_TABLE_HEADER*) Type42Record
|
||||
);
|
||||
Status = Smbios->Add (
|
||||
Smbios,
|
||||
NULL,
|
||||
&MemArrayMappedAddrSmbiosHandle,
|
||||
(EFI_SMBIOS_TABLE_HEADER *)Type42Record
|
||||
);
|
||||
DEBUG ((DEBUG_INFO, "RedfishPlatformDxe: Smbios->Add() - %r\n", Status));
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
ON_EXIT:
|
||||
if (DeviceDescriptor != NULL) {
|
||||
FreePool (DeviceDescriptor);
|
||||
}
|
||||
|
||||
if (NewProtocolRecords != NULL) {
|
||||
FreePool (NewProtocolRecords);
|
||||
}
|
||||
|
||||
if (Type42Record != NULL) {
|
||||
FreePool (Type42Record);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -232,8 +250,8 @@ ON_EXIT:
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
RedfishHostInterfaceDxeEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
//
|
||||
|
Reference in New Issue
Block a user