summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c')
-rw-r--r--MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c b/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c
index cad5ad7..99d9208 100644
--- a/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c
+++ b/MdeModulePkg/Bus/I2c/I2cDxe/I2cBus.c
@@ -1,8 +1,8 @@
/** @file
- This file implements I2C IO Protocol which enables the user to manipulate a single
+ This file implements I2C IO Protocol which enables the user to manipulate a single
I2C device independent of the host controller and I2C design.
- Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -76,7 +76,7 @@ VENDOR_DEVICE_PATH gVendorDevicePathTemplate = {
};
//
-// Driver name table
+// Driver name table
//
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mI2cBusDriverNameTable[] = {
{ "eng;en", (CHAR16 *) L"I2C Bus Driver" },
@@ -241,12 +241,12 @@ I2cBusComponentNameGetControllerName (
/**
Check if the child of I2C controller has been created.
- @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
+ @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
@param[in] Controller I2C controller handle.
@param[in] RemainingDevicePath A pointer to the remaining portion of a device path.
@param[in] RemainingHasControllerNode Indicate if RemainingDevicePath contains CONTROLLER_DEVICE_PATH.
@param[in] RemainingControllerNumber Controller number in CONTROLLER_DEVICE_PATH.
-
+
@retval EFI_SUCCESS The child of I2C controller is not created.
@retval Others The child of I2C controller has been created or other errors happen.
@@ -266,11 +266,11 @@ CheckRemainingDevicePath (
UINTN EntryCount;
UINTN Index;
BOOLEAN SystemHasControllerNode;
- UINT32 SystemControllerNumber;
+ UINT32 SystemControllerNumber;
SystemHasControllerNode = FALSE;
SystemControllerNumber = 0;
-
+
Status = gBS->OpenProtocolInformation (
Controller,
&gEfiI2cHostProtocolGuid,
@@ -280,7 +280,7 @@ CheckRemainingDevicePath (
if (EFI_ERROR (Status)) {
return Status;
}
-
+
for (Index = 0; Index < EntryCount; Index++) {
if ((OpenInfoBuffer[Index].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) {
Status = gBS->OpenProtocol (
@@ -294,7 +294,7 @@ CheckRemainingDevicePath (
if (!EFI_ERROR (Status)) {
//
// Find vendor device path node and compare
- //
+ //
while (!IsDevicePathEnd (SystemDevicePath)) {
if ((DevicePathType (SystemDevicePath) == HARDWARE_DEVICE_PATH) &&
(DevicePathSubType (SystemDevicePath) == HW_VENDOR_DP)) {
@@ -469,7 +469,7 @@ I2cBusDriverSupported (
//
// Determine if the I2C Host Protocol is available
//
- Status = gBS->OpenProtocol (
+ Status = gBS->OpenProtocol (
Controller,
&gEfiI2cHostProtocolGuid,
(VOID **) &I2cHost,
@@ -489,7 +489,7 @@ I2cBusDriverSupported (
if (Status == EFI_ALREADY_STARTED) {
- if ((RemainingDevicePath == NULL) ||
+ if ((RemainingDevicePath == NULL) ||
((RemainingDevicePath != NULL) && IsDevicePathEnd (RemainingDevicePath))) {
//
// If RemainingDevicePath is NULL or is the End of Device Path Node, return EFI_SUCCESS.
@@ -498,7 +498,7 @@ I2cBusDriverSupported (
} else {
//
// Test if the child with the RemainingDevicePath has already been created.
- //
+ //
Status = CheckRemainingDevicePath (
This,
Controller,
@@ -647,7 +647,7 @@ I2cBusDriverStart (
Status = EFI_OUT_OF_RESOURCES;
goto Error;
}
-
+
/*
+----------------+
.->| I2C_BUS_CONTEXT|<----- This file Protocol (gEfiCallerIdGuid) installed on I2C Controller handle
@@ -660,7 +660,7 @@ I2cBusDriverStart (
| I2C IO Protocol Structure | <----- I2C IO Protocol
| |
+----------------------------+
-
+
*/
I2cBusContext->I2cHost = I2cHost;
I2cBusContext->I2cEnumerate = I2cEnumerate;
@@ -672,9 +672,9 @@ I2cBusDriverStart (
// Parent controller device path used to create children device path
//
I2cBusContext->ParentDevicePath = ParentDevicePath;
-
+
I2cBusContext->DriverBindingHandle = This->DriverBindingHandle;
-
+
Status = gBS->InstallMultipleProtocolInterfaces (
&Controller,
&gEfiCallerIdGuid,
@@ -698,7 +698,7 @@ Error:
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "I2cBus: Start() function failed, Status = %r\n", Status));
if (ParentDevicePath != NULL) {
- gBS->CloseProtocol (
+ gBS->CloseProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
@@ -716,14 +716,14 @@ Error:
}
if (I2cEnumerate != NULL) {
- gBS->CloseProtocol (
+ gBS->CloseProtocol (
Controller,
&gEfiI2cEnumerateProtocolGuid,
This->DriverBindingHandle,
Controller
);
}
-
+
if (I2cBusContext != NULL) {
Status = gBS->UninstallMultipleProtocolInterfaces (
&Controller,
@@ -783,7 +783,7 @@ I2cBusDriverStop (
UINTN Index;
if (NumberOfChildren == 0) {
- gBS->CloseProtocol (
+ gBS->CloseProtocol (
Controller,
&gEfiDevicePathProtocolGuid,
This->DriverBindingHandle,
@@ -880,14 +880,14 @@ RegisterI2cDevice (
// Default DeviceIndex
//
RemainingPathDeviceIndex = 0;
-
+
//
// Determine the controller number in Controller Node Device Path when RemainingDevicePath is not NULL.
//
if (RemainingDevicePath != NULL) {
//
// Check if there is a controller node appended after vendor node
- //
+ //
DevPathNode = NextDevicePathNode (RemainingDevicePath);
if ((DevicePathType (DevPathNode) == HARDWARE_DEVICE_PATH) &&
(DevicePathSubType(DevPathNode) == HW_CONTROLLER_DP)) {
@@ -965,7 +965,7 @@ RegisterI2cDevice (
//
if ((!CompareGuid (&((VENDOR_DEVICE_PATH *)RemainingDevicePath)->Guid, Device->DeviceGuid)) ||
(RemainingPathDeviceIndex != Device->DeviceIndex)) {
- continue;
+ continue;
}
}
@@ -1015,7 +1015,7 @@ RegisterI2cDevice (
ReleaseI2cDeviceContext (I2cDeviceContext);
continue;
}
-
+
//
// Create the child handle
//
@@ -1040,7 +1040,7 @@ RegisterI2cDevice (
// Free resources for this I2C device
//
ReleaseI2cDeviceContext (I2cDeviceContext);
- continue;
+ continue;
}
if (RemainingDevicePath != NULL) {
@@ -1074,7 +1074,7 @@ RegisterI2cDevice (
The upper layer driver writer provides the following to the platform
vendor:
-
+
1. Vendor specific GUID for the I2C part
2. Guidance on proper construction of the slave address array when the
I2C device uses more than one slave address. The I2C bus protocol
@@ -1192,7 +1192,7 @@ ReleaseI2cDeviceContext (
if (I2cDeviceContext == NULL) {
return;
}
-
+
if (I2cDeviceContext->DevicePath != NULL) {
FreePool (I2cDeviceContext->DevicePath);
}
@@ -1282,12 +1282,12 @@ UnRegisterI2cDevice (
);
return Status;
}
-
+
//
// Free resources for this I2C device
//
ReleaseI2cDeviceContext (I2cDeviceContext);
-
+
return EFI_SUCCESS;
}
@@ -1310,12 +1310,12 @@ I2cBusDevicePathAppend (
)
{
EFI_DEVICE_PATH_PROTOCOL *PreviousDevicePath;
-
+
PreviousDevicePath = NULL;
//
// Build vendor device path
- //
+ //
CopyMem (&gVendorDevicePathTemplate.Guid, I2cDeviceContext->I2cDevice->DeviceGuid, sizeof (EFI_GUID));
I2cDeviceContext->DevicePath = AppendDevicePathNode (
I2cDeviceContext->I2cBusContext->ParentDevicePath,
@@ -1325,13 +1325,13 @@ I2cBusDevicePathAppend (
if (I2cDeviceContext->DevicePath == NULL) {
return EFI_OUT_OF_RESOURCES;
}
-
+
if ((BuildControllerNode) && (I2cDeviceContext->DevicePath != NULL)) {
//
// Build the final I2C device path with controller node
//
PreviousDevicePath = I2cDeviceContext->DevicePath;
- gControllerDevicePathTemplate.ControllerNumber = I2cDeviceContext->I2cDevice->DeviceIndex;
+ gControllerDevicePathTemplate.ControllerNumber = I2cDeviceContext->I2cDevice->DeviceIndex;
I2cDeviceContext->DevicePath = AppendDevicePathNode (
I2cDeviceContext->DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &gControllerDevicePathTemplate
@@ -1379,7 +1379,7 @@ InitializeI2cBus(
);
ASSERT_EFI_ERROR (Status);
-
+
return Status;
}