summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordtang2 <dtang2@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-13 06:36:11 +0000
committerdtang2 <dtang2@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-13 06:36:11 +0000
commit71a62114eb16255adaf886be35edecf0045bb494 (patch)
tree79873d22e4a8b23eab65bcee3ca8c7c108e42d6c
parenta98f11c5b9663638bca1fd7518a783c33c420039 (diff)
downloadedk2-platforms-71a62114eb16255adaf886be35edecf0045bb494.tar.xz
1. Add the GLOBAL_REMOVE_IF_UNREFERENCED to globe variables which are used only in debug version;
2. Use ZeroMem to replace gBS->SetMem; 3. Remove marked code; 4. Add IsHub judgement in UsbPortReset function to following EFI1.1 spec; 5. Add brackets for macro definition git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1740 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c8
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h13
-rw-r--r--EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c59
-rw-r--r--EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h2
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/usb.c4
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c14
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.h6
-rw-r--r--EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbio.c16
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/Cbi0.c13
-rw-r--r--EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c13
-rw-r--r--EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c1
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageData.h2
-rw-r--r--EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c1
13 files changed, 86 insertions, 66 deletions
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c
index 4975c8c187..c6105eb0b5 100644
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c
+++ b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.c
@@ -22,8 +22,10 @@ Revision History
#include "Ehci.h"
-UINTN gEHCDebugLevel = EFI_D_INFO;
-UINTN gEHCErrorLevel = EFI_D_ERROR;
+
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN gEHCDebugLevel = EFI_D_INFO;
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN gEHCErrorLevel = EFI_D_ERROR;
+
//
// Prototypes
@@ -886,7 +888,7 @@ EhciReset (
//
Status = SetFrameListBaseAddr (
HcDev,
- GET_0B_TO_31B (HcDev->PeriodicFrameListBuffer)
+ (UINT32)GET_0B_TO_31B (HcDev->PeriodicFrameListBuffer)
);
if (EFI_ERROR (Status)) {
Status = EFI_DEVICE_ERROR;
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h
index f22ce1a3e6..ede8b43d2c 100644
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h
+++ b/EdkModulePkg/Bus/Pci/Ehci/Dxe/Ehci.h
@@ -27,8 +27,10 @@ Revision History
//
#include <IndustryStandard/pci22.h>
-extern UINTN gEHCDebugLevel;
-extern UINTN gEHCErrorLevel;
+
+GLOBAL_REMOVE_IF_UNREFERENCED extern UINTN gEHCDebugLevel;
+GLOBAL_REMOVE_IF_UNREFERENCED extern UINTN gEHCErrorLevel;
+
#define STALL_1_MACRO_SECOND 1
#define STALL_1_MILLI_SECOND 1000 * STALL_1_MACRO_SECOND
@@ -192,10 +194,11 @@ extern EFI_COMPONENT_NAME_PROTOCOL gEhciComponentName;
#define OUTPUT_PACKET_ID 0xE1
#define ERROR_PACKET_ID 0x55
-#define bit(a) 1 << (a)
+#define bit(a) (1 << (a))
+
+#define GET_0B_TO_31B(Addr) (((UINTN) Addr) & (0xffffffff))
+#define GET_32B_TO_63B(Addr) ((UINTN)RShiftU64((UINTN) Addr, 32) & (0xffffffff))
-#define GET_0B_TO_31B(Addr) (UINT32) (UINTN) (Addr)
-#define GET_32B_TO_63B(Addr) (UINT32) (RShiftU64(((UINT64) (UINTN) (Addr)), 32) & 0xffffffff)
//
// Ehci Data and Ctrl Structures
diff --git a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c b/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c
index b6864ad058..1226d569cf 100644
--- a/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c
+++ b/EdkModulePkg/Bus/Pci/Ehci/Dxe/EhciSched.c
@@ -340,7 +340,7 @@ Returns:
//
// Init fields in Qh
//
- gBS->SetMem (*QhPtrPtr, sizeof (EHCI_QH_ENTITY), 0);
+ ZeroMem (*QhPtrPtr, sizeof (EHCI_QH_ENTITY));
//
// Software field
@@ -699,7 +699,8 @@ Returns:
//
// Init fields in Qtd
//
- gBS->SetMem (*QtdPtrPtr, sizeof (EHCI_QTD_ENTITY), 0);
+
+ ZeroMem (*QtdPtrPtr, sizeof (EHCI_QTD_ENTITY));
//
// Software field
@@ -1386,7 +1387,7 @@ Returns:
Value = NULL;
if (!HwQtdPtr->AltNextQtdTerminate) {
- Value = (EHCI_QTD_HW *) (UINTN) GET_0B_TO_31B (HwQtdPtr->AltNextQtdPointer << 5);
+ Value = (EHCI_QTD_HW *) GET_0B_TO_31B (HwQtdPtr->AltNextQtdPointer << 5);
}
return Value;
@@ -1417,7 +1418,7 @@ Returns:
Value = NULL;
if (!HwQtdPtr->NextQtdTerminate) {
- Value = (EHCI_QTD_HW *) (UINTN) GET_0B_TO_31B (HwQtdPtr->NextQtdPointer << 5);
+ Value = (EHCI_QTD_HW *) GET_0B_TO_31B (HwQtdPtr->NextQtdPointer << 5);
}
return Value;
@@ -1727,7 +1728,7 @@ Returns:
//
// Not Null FrameList
//
- FindQhHwPtr = (EHCI_QH_HW *) (UINTN) GET_0B_TO_31B (FrameEntryPtr->LinkPointer << 5);
+ FindQhHwPtr = (EHCI_QH_HW *) GET_0B_TO_31B (FrameEntryPtr->LinkPointer << 5);
FindQhPtr = (EHCI_QH_ENTITY *) GET_QH_ENTITY_ADDR (FindQhHwPtr);
//
// FindQh is Left/Right to Qh
@@ -1742,12 +1743,12 @@ Returns:
//
if (NULL != FindQhPtr->Next) {
FindQhPtr->Next->Prev = QhPtr;
- QhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(FindQhPtr->Next->Qh)) >> 5);
+ QhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(FindQhPtr->Next->Qh) >> 5);
QhPtr->Qh.SelectType = QH_SELECT_TYPE;
QhPtr->Qh.QhTerminate = FALSE;
}
- FindQhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (((UINTN)&(QhPtr->Qh)) >> 5);
+ FindQhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
FindQhPtr->Qh.SelectType = QH_SELECT_TYPE;
FindQhPtr->Qh.QhTerminate = FALSE;
@@ -1762,7 +1763,7 @@ Returns:
//
// Qh is the First one in Frame[0] List
//
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(QhPtr->Qh)) >> 5);
+ FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
FrameEntryPtr->SelectType = QH_SELECT_TYPE;
FrameEntryPtr->LinkTerminate = FALSE;
} else {
@@ -1770,12 +1771,12 @@ Returns:
// Qh is not the First one in Frame[0] List
//
FindQhPtr->Prev->Next = QhPtr;
- FindQhPtr->Prev->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(QhPtr->Qh)) >> 5);
+ FindQhPtr->Prev->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
FindQhPtr->Prev->Qh.SelectType = QH_SELECT_TYPE;
FindQhPtr->Prev->Qh.QhTerminate = FALSE;
}
- QhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(FindQhPtr->Qh)) >> 5);
+ QhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(FindQhPtr->Qh) >> 5);
QhPtr->Qh.SelectType = QH_SELECT_TYPE;
QhPtr->Qh.QhTerminate = FALSE;
@@ -1786,7 +1787,7 @@ Returns:
//
// Link Qh after FindQh, Qh is the Last one
//
- FindQhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(QhPtr->Qh)) >> 5);
+ FindQhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
FindQhPtr->Prev->Qh.SelectType = QH_SELECT_TYPE;
FindQhPtr->Qh.QhTerminate = FALSE;
@@ -1798,7 +1799,7 @@ Returns:
//
// Null FrameList
//
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(QhPtr->Qh)) >> 5);
+ FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
FrameEntryPtr->SelectType = QH_SELECT_TYPE;
FrameEntryPtr->LinkTerminate = FALSE;
}
@@ -1812,7 +1813,7 @@ Returns:
FrameIndex += QhPtr->Interval;
while (FrameIndex < HcDev->PeriodicFrameListLength) {
FrameEntryPtr = (FRAME_LIST_ENTRY *) (FrameEntryPtr + QhPtr->Interval);
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(QhPtr->Qh)) >> 5);
+ FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
FrameEntryPtr->SelectType = QH_SELECT_TYPE;
FrameEntryPtr->LinkTerminate = FALSE;
FrameIndex += QhPtr->Interval;
@@ -1825,7 +1826,7 @@ Returns:
while (FrameIndex < HcDev->PeriodicFrameListLength) {
FrameEntryPtr = (FRAME_LIST_ENTRY *) (FrameEntryPtr + QhPtr->Interval);
if ((FrameIndex % QhPtr->Prev->Interval) != 0) {
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(QhPtr->Qh)) >> 5);
+ FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
FrameEntryPtr->SelectType = QH_SELECT_TYPE;
FrameEntryPtr->LinkTerminate = FALSE;
}
@@ -1843,7 +1844,7 @@ Returns:
//
// Not Null FrameList
//
- FindQhHwPtr = (EHCI_QH_HW *) (UINTN) GET_0B_TO_31B (FrameEntryPtr->LinkPointer << 5);
+ FindQhHwPtr = (EHCI_QH_HW *) GET_0B_TO_31B (FrameEntryPtr->LinkPointer << 5);
FindQhPtr = (EHCI_QH_ENTITY *) GET_QH_ENTITY_ADDR (FindQhHwPtr);
//
// FindQh is Last Qh in the Asynchronous List, Link Qh after FindQh
@@ -1852,7 +1853,7 @@ Returns:
FindQhPtr = FindQhPtr->Next;
}
- FindQhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(QhPtr->Qh)) >> 5);
+ FindQhPtr->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
FindQhPtr->Qh.SelectType = QH_SELECT_TYPE;
FindQhPtr->Qh.QhTerminate = FALSE;
@@ -1862,7 +1863,7 @@ Returns:
//
// Null FrameList
//
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(QhPtr->Qh)) >> 5);
+ FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Qh) >> 5);
FrameEntryPtr->SelectType = QH_SELECT_TYPE;
FrameEntryPtr->LinkTerminate = FALSE;
}
@@ -1929,7 +1930,7 @@ Returns:
}
} else {
while (FrameIndex < HcDev->PeriodicFrameListLength) {
- FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(QhPtr->Next->Qh)) >> 5);
+ FrameEntryPtr->LinkPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Next->Qh) >> 5);
FrameEntryPtr->SelectType = QH_SELECT_TYPE;
FrameEntryPtr->LinkTerminate = FALSE;
FrameEntryPtr += Interval;
@@ -1949,7 +1950,7 @@ Returns:
QhPtr->Prev->Qh.SelectType = 0;
QhPtr->Prev->Qh.QhTerminate = TRUE;
} else {
- QhPtr->Prev->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (((UINTN) &(QhPtr->Next->Qh)) >> 5);
+ QhPtr->Prev->Qh.QhHorizontalPointer = (UINT32) GET_0B_TO_31B (&(QhPtr->Next->Qh) >> 5);
QhPtr->Prev->Qh.SelectType = QH_SELECT_TYPE;
QhPtr->Prev->Qh.QhTerminate = FALSE;
}
@@ -2110,6 +2111,12 @@ Returns:
ASSERT (QtdHwPtr);
//
+ // Allow buffer address range across 4G.
+ // But EFI_USB_MAX_BULK_BUFFER_NUM = 1, so don't allow
+ // seperate buffer array.
+ //
+
+ //
// Set BufferPointer0, ExtBufferPointer0 and Offset
//
QtdHwPtr->BufferPointer0 = (UINT32) (GET_0B_TO_31B (DataPtr) >> 12);
@@ -2125,7 +2132,7 @@ Returns:
}
QtdHwPtr->BufferPointer1 = QtdHwPtr->BufferPointer0 + 1;
- QtdHwPtr->ExtBufferPointer1 = QtdHwPtr->ExtBufferPointer0;
+ QtdHwPtr->ExtBufferPointer1 = (QtdHwPtr->BufferPointer1 == 0) ? (QtdHwPtr->ExtBufferPointer0 + 1) : QtdHwPtr->ExtBufferPointer0;
//
// Set BufferPointer2 and ExtBufferPointer2
@@ -2136,7 +2143,7 @@ Returns:
}
QtdHwPtr->BufferPointer2 = QtdHwPtr->BufferPointer1 + 1;
- QtdHwPtr->ExtBufferPointer2 = QtdHwPtr->ExtBufferPointer0;
+ QtdHwPtr->ExtBufferPointer2 = (QtdHwPtr->BufferPointer2 == 0) ? (QtdHwPtr->ExtBufferPointer1 + 1) : QtdHwPtr->ExtBufferPointer1;
//
// Set BufferPointer3 and ExtBufferPointer3
@@ -2147,7 +2154,7 @@ Returns:
}
QtdHwPtr->BufferPointer3 = QtdHwPtr->BufferPointer2 + 1;
- QtdHwPtr->ExtBufferPointer3 = QtdHwPtr->ExtBufferPointer0;
+ QtdHwPtr->ExtBufferPointer3 = (QtdHwPtr->BufferPointer2 == 0) ? (QtdHwPtr->ExtBufferPointer2 + 1) : QtdHwPtr->ExtBufferPointer2;
//
// Set BufferPointer4 and ExtBufferPointer4
@@ -2158,7 +2165,7 @@ Returns:
}
QtdHwPtr->BufferPointer4 = QtdHwPtr->BufferPointer3 + 1;
- QtdHwPtr->ExtBufferPointer4 = QtdHwPtr->ExtBufferPointer0;
+ QtdHwPtr->ExtBufferPointer4 = (QtdHwPtr->BufferPointer3 == 0) ? (QtdHwPtr->ExtBufferPointer3 + 1) : QtdHwPtr->ExtBufferPointer3;
exit:
return ;
@@ -2865,8 +2872,8 @@ Returns:
}
(*ErrQtdPos)++;
- QtdHwPtr = GetQtdNextPointer (QtdHwPtr);
- QtdPtr = (EHCI_QTD_ENTITY *) GET_QTD_ENTITY_ADDR (QtdHwPtr);
+ QtdPtr = QtdPtr->Next;
+ QtdHwPtr = &(QtdPtr->Qtd);
}
@@ -3026,7 +3033,7 @@ Returns:
}
QtdHwPtr = &(AsyncRequestPtr->QhPtr->FirstQtdPtr->Qtd);
- ReceiveBuffer = (UINT8 *) (UINTN) GET_0B_TO_31B ((QtdHwPtr->BufferPointer0 << 12) | AsyncRequestPtr->QhPtr->FirstQtdPtr->StaticCurrentOffset);
+ ReceiveBuffer = (UINT8 *) GET_0B_TO_31B ((QtdHwPtr->BufferPointer0 << 12) | AsyncRequestPtr->QhPtr->FirstQtdPtr->StaticCurrentOffset);
CopyMem (
ProcessBuffer,
ReceiveBuffer,
diff --git a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h b/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h
index ab9a5b6a0e..c224a16ac6 100644
--- a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h
+++ b/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.h
@@ -59,7 +59,7 @@ Revision History
//
#define NORMAL_MEMORY_BLOCK_UNIT_IN_PAGES 1
-#define bit(a) 1 << (a)
+#define bit(a) (1 << (a))
//
// ////////////////////////////////////////////////////////////////////////
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usb.c b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usb.c
index 474e38829e..272161083b 100644
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usb.c
+++ b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usb.c
@@ -696,7 +696,7 @@ UsbSetConfiguration (
--*/
{
- LIST_ENTRY *NextEntry;
+ LIST_ENTRY *NextEntry;
CONFIG_DESC_LIST_ENTRY *ConfigEntry;
UINT32 Status;
EFI_STATUS Result;
@@ -752,7 +752,7 @@ UsbSetDefaultConfiguration (
{
CONFIG_DESC_LIST_ENTRY *ConfigEntry;
UINT16 ConfigValue;
- LIST_ENTRY *NextEntry;
+ LIST_ENTRY *NextEntry;
if (IsListEmpty (&UsbIoDev->ConfigDescListHead)) {
return EFI_DEVICE_ERROR;
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c
index 1d1f44d638..d9387a60b1 100644
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c
+++ b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.c
@@ -23,8 +23,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "usbbus.h"
-UINTN gUSBDebugLevel = EFI_D_INFO;
-UINTN gUSBErrorLevel = EFI_D_ERROR;
+
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN gUSBDebugLevel = EFI_D_INFO;
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN gUSBErrorLevel = EFI_D_ERROR;
//
// The UsbBusProtocol is just used to locate USB_BUS_CONTROLLER
@@ -2328,17 +2329,18 @@ UsbPortReset (
--*/
{
USB_IO_CONTROLLER_DEVICE *UsbIoController;
- EFI_STATUS Status;
UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
+ if (IsHub (UsbIoController)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
//
// Since at this time, this device has already been configured,
// it needs to be re-configured.
//
- Status = ParentPortReset (UsbIoController, TRUE, 0);
-
- return Status;
+ return ParentPortReset (UsbIoController, TRUE, 0);
}
EFI_STATUS
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.h b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.h
index 47f0fd804f..8dd36f35d4 100644
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.h
+++ b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.h
@@ -30,8 +30,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "hub.h"
#include "usbutil.h"
-extern UINTN gUSBDebugLevel;
-extern UINTN gUSBErrorLevel;
+
+GLOBAL_REMOVE_IF_UNREFERENCED extern UINTN gUSBDebugLevel;
+GLOBAL_REMOVE_IF_UNREFERENCED extern UINTN gUSBErrorLevel;
+
#define MICROSECOND 10000
#define ONESECOND (1000 * MICROSECOND)
diff --git a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbio.c b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbio.c
index eb563b8e8b..afd2e46541 100644
--- a/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbio.c
+++ b/EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbio.c
@@ -181,6 +181,19 @@ VOID
InitializeUsbIoInstance (
IN USB_IO_CONTROLLER_DEVICE *UsbIoController
)
+/*++
+
+Routine Description:
+
+ Initialize the instance of UsbIo controller
+
+Arguments:
+
+ UsbIoController - A pointer to controller structure of UsbIo
+
+Returns:
+
+--*/
{
//
// Copy EFI_USB_IO protocol instance
@@ -349,11 +362,10 @@ UsbBulkTransfer (
UINT8 DataToggle;
UINT8 OldToggle;
EFI_STATUS RetStatus;
-
USB_IO_CONTROLLER_DEVICE *UsbIoController;
ENDPOINT_DESC_LIST_ENTRY *EndPointListEntry;
- UINT32 TransferResult;
UINT8 DataBuffersNumber;
+ UINT32 TransferResult;
DataBuffersNumber = 1;
UsbIoController = USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS (This);
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/Cbi0.c b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/Cbi0.c
index afd4d623c3..913ac225e9 100644
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/Cbi0.c
+++ b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi0/Cbi0.c
@@ -354,21 +354,18 @@ Cbi0DriverBindingStart (
//
if (EndpointDescriptor.Attributes == 0x02) {
if (EndpointDescriptor.EndpointAddress & 0x80) {
- CopyMem (&UsbCbiDev->BulkInEndpointDescriptor, &EndpointDescriptor, sizeof(EndpointDescriptor));
- // UsbCbiDev->BulkInEndpointDescriptor = EndpointDescriptor;
- EndpointExistMask |= bit (0);
+ CopyMem (&UsbCbiDev->BulkInEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
+ EndpointExistMask |= bit (0);
} else {
- CopyMem (&UsbCbiDev->BulkOutEndpointDescriptor, &EndpointDescriptor, sizeof(EndpointDescriptor));
- // UsbCbiDev->BulkOutEndpointDescriptor = EndpointDescriptor;
- EndpointExistMask |= bit (1);
+ CopyMem (&UsbCbiDev->BulkOutEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
+ EndpointExistMask |= bit (1);
}
}
//
// We parse interrupt endpoint
//
if (EndpointDescriptor.Attributes == 0x03) {
- CopyMem (&UsbCbiDev->InterruptEndpointDescriptor, &EndpointDescriptor, sizeof(EndpointDescriptor));
- // UsbCbiDev->InterruptEndpointDescriptor = EndpointDescriptor;
+ CopyMem (&UsbCbiDev->InterruptEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
EndpointExistMask |= bit (2);
}
diff --git a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c
index 3f1b02cf70..dd1c927dae 100644
--- a/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c
+++ b/EdkModulePkg/Bus/Usb/UsbCbi/Dxe/Cbi1/cbi1.c
@@ -309,12 +309,10 @@ CBI1DriverBindingStart (
//
if (EndpointDescriptor.Attributes == 0x02) {
if (EndpointDescriptor.EndpointAddress & 0x80) {
- CopyMem (&UsbCbiDev->BulkInEndpointDescriptor, &EndpointDescriptor, sizeof(EndpointDescriptor));
- //UsbCbiDev->BulkInEndpointDescriptor = EndpointDescriptor;
- } else {
- CopyMem (&UsbCbiDev->BulkOutEndpointDescriptor, &EndpointDescriptor, sizeof(EndpointDescriptor));
- //UsbCbiDev->BulkOutEndpointDescriptor = EndpointDescriptor;
- }
+ CopyMem (&UsbCbiDev->BulkInEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
+ } else {
+ CopyMem (&UsbCbiDev->BulkOutEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
+ }
Found = TRUE;
}
@@ -322,8 +320,7 @@ CBI1DriverBindingStart (
// We parse interrupt endpoint
//
if (EndpointDescriptor.Attributes == 0x03) {
- CopyMem (&UsbCbiDev->InterruptEndpointDescriptor, &EndpointDescriptor, sizeof(EndpointDescriptor));
- //UsbCbiDev->InterruptEndpointDescriptor = EndpointDescriptor;
+ CopyMem (&UsbCbiDev->InterruptEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
Found = TRUE;
}
diff --git a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c b/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c
index a9cdbc8760..a59de11998 100644
--- a/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c
+++ b/EdkModulePkg/Bus/Usb/UsbKb/Dxe/efikey.c
@@ -297,7 +297,6 @@ USBKeyboardDriverBindingStart (
// We only care interrupt endpoint here
//
CopyMem (&UsbKeyboardDevice->IntEndpointDescriptor, &EndpointDescriptor, sizeof (EndpointDescriptor));
- //UsbKeyboardDevice->IntEndpointDescriptor = EndpointDescriptor;
Found = TRUE;
}
}
diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageData.h b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageData.h
index 598c82e220..45433edfc2 100644
--- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageData.h
+++ b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageData.h
@@ -25,7 +25,7 @@ Revision History
//
// bit definition
//
-#define bit(a) 1 << (a)
+#define bit(a) (1 << (a))
//
// timeout unit is in millisecond.
diff --git a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c
index b8ed813ea2..3d6a6d977b 100644
--- a/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c
+++ b/EdkModulePkg/Bus/Usb/UsbMassStorage/Dxe/UsbMassStorageHelper.c
@@ -924,7 +924,6 @@ UsbFloppyDetectMedia (
Status = EFI_SUCCESS;
FloppyStatus = EFI_SUCCESS;
CopyMem (&OldMediaInfo, UsbFloppyDevice->BlkIo.Media, sizeof (OldMediaInfo));
- //OldMediaInfo = *UsbFloppyDevice->BlkIo.Media;
*MediaChange = FALSE;
NeedReadCapacity = TRUE;