summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c')
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c93
1 files changed, 42 insertions, 51 deletions
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c b/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c
index 44bcde4..9aa138f 100644
--- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c
+++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c
@@ -9,7 +9,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "Uhci.h"
-
/**
Read a UHCI register.
@@ -21,21 +20,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
UINT16
UhciReadReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 Offset
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT32 Offset
)
{
UINT16 Data;
EFI_STATUS Status;
Status = PciIo->Io.Read (
- PciIo,
- EfiPciIoWidthUint16,
- USB_BAR_INDEX,
- Offset,
- 1,
- &Data
- );
+ PciIo,
+ EfiPciIoWidthUint16,
+ USB_BAR_INDEX,
+ Offset,
+ 1,
+ &Data
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "UhciReadReg: PciIo Io.Read error: %r at offset %d\n", Status, Offset));
@@ -46,7 +45,6 @@ UhciReadReg (
return Data;
}
-
/**
Write data to UHCI register.
@@ -57,28 +55,27 @@ UhciReadReg (
**/
VOID
UhciWriteReg (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 Offset,
- IN UINT16 Data
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT32 Offset,
+ IN UINT16 Data
)
{
EFI_STATUS Status;
Status = PciIo->Io.Write (
- PciIo,
- EfiPciIoWidthUint16,
- USB_BAR_INDEX,
- Offset,
- 1,
- &Data
- );
+ PciIo,
+ EfiPciIoWidthUint16,
+ USB_BAR_INDEX,
+ Offset,
+ 1,
+ &Data
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "UhciWriteReg: PciIo Io.Write error: %r at offset %d\n", Status, Offset));
}
}
-
/**
Set a bit of the UHCI Register.
@@ -89,19 +86,18 @@ UhciWriteReg (
**/
VOID
UhciSetRegBit (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 Offset,
- IN UINT16 Bit
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT32 Offset,
+ IN UINT16 Bit
)
{
UINT16 Data;
Data = UhciReadReg (PciIo, Offset);
- Data = (UINT16) (Data |Bit);
+ Data = (UINT16)(Data |Bit);
UhciWriteReg (PciIo, Offset, Data);
}
-
/**
Clear a bit of the UHCI Register.
@@ -112,19 +108,18 @@ UhciSetRegBit (
**/
VOID
UhciClearRegBit (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN UINT32 Offset,
- IN UINT16 Bit
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN UINT32 Offset,
+ IN UINT16 Bit
)
{
UINT16 Data;
Data = UhciReadReg (PciIo, Offset);
- Data = (UINT16) (Data & ~Bit);
+ Data = (UINT16)(Data & ~Bit);
UhciWriteReg (PciIo, Offset, Data);
}
-
/**
Clear all the interrutp status bits, these bits
are Write-Clean.
@@ -134,7 +129,7 @@ UhciClearRegBit (
**/
VOID
UhciAckAllInterrupt (
- IN USB_HC_DEV *Uhc
+ IN USB_HC_DEV *Uhc
)
{
UhciWriteReg (Uhc->PciIo, USBSTS_OFFSET, 0x3F);
@@ -149,7 +144,6 @@ UhciAckAllInterrupt (
}
}
-
/**
Stop the host controller.
@@ -162,12 +156,12 @@ UhciAckAllInterrupt (
**/
EFI_STATUS
UhciStopHc (
- IN USB_HC_DEV *Uhc,
- IN UINTN Timeout
+ IN USB_HC_DEV *Uhc,
+ IN UINTN Timeout
)
{
- UINT16 UsbSts;
- UINTN Index;
+ UINT16 UsbSts;
+ UINTN Index;
UhciClearRegBit (Uhc->PciIo, USBCMD_OFFSET, USBCMD_RS);
@@ -188,7 +182,6 @@ UhciStopHc (
return EFI_TIMEOUT;
}
-
/**
Check whether the host controller operates well.
@@ -200,10 +193,10 @@ UhciStopHc (
**/
BOOLEAN
UhciIsHcWorking (
- IN EFI_PCI_IO_PROTOCOL *PciIo
+ IN EFI_PCI_IO_PROTOCOL *PciIo
)
{
- UINT16 UsbSts;
+ UINT16 UsbSts;
UsbSts = UhciReadReg (PciIo, USBSTS_OFFSET);
@@ -215,7 +208,6 @@ UhciIsHcWorking (
return TRUE;
}
-
/**
Set the UHCI frame list base address. It can't use
UhciWriteReg which access memory in UINT16.
@@ -226,20 +218,20 @@ UhciIsHcWorking (
**/
VOID
UhciSetFrameListBaseAddr (
- IN EFI_PCI_IO_PROTOCOL *PciIo,
- IN VOID *Addr
+ IN EFI_PCI_IO_PROTOCOL *PciIo,
+ IN VOID *Addr
)
{
- EFI_STATUS Status;
- UINT32 Data;
+ EFI_STATUS Status;
+ UINT32 Data;
- Data = (UINT32) ((UINTN) Addr & 0xFFFFF000);
+ Data = (UINT32)((UINTN)Addr & 0xFFFFF000);
Status = PciIo->Io.Write (
PciIo,
EfiPciIoWidthUint32,
USB_BAR_INDEX,
- (UINT64) USB_FRAME_BASE_OFFSET,
+ (UINT64)USB_FRAME_BASE_OFFSET,
1,
&Data
);
@@ -249,7 +241,6 @@ UhciSetFrameListBaseAddr (
}
}
-
/**
Disable USB Emulation.
@@ -258,10 +249,10 @@ UhciSetFrameListBaseAddr (
**/
VOID
UhciTurnOffUsbEmulation (
- IN EFI_PCI_IO_PROTOCOL *PciIo
+ IN EFI_PCI_IO_PROTOCOL *PciIo
)
{
- UINT16 Command;
+ UINT16 Command;
Command = 0;