]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Minor refinement for USB modules.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 13 Jan 2009 08:46:31 +0000 (08:46 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 13 Jan 2009 08:46:31 +0000 (08:46 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7257 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.h
MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassCbi.c
MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.c
MdeModulePkg/Bus/Usb/UsbMouseDxe/UsbMouse.h

index 1ccc8784d028960f9ca1d0388dbc3b62a0281f84..74f19c3278183ed6f3db32b6e882fe0c0ba3a0e4 100644 (file)
@@ -120,7 +120,7 @@ USBKeyboardDriverBindingSupported (
 }\r
 \r
 /**\r
 }\r
 \r
 /**\r
-  Starts the device with this driver.\r
+  Starts the keyboard device with this driver.\r
 \r
   This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,\r
   initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage\r
 \r
   This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,\r
   initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage\r
@@ -219,7 +219,7 @@ USBKeyboardDriverBindingStart (
   EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;\r
 \r
   //\r
   EndpointNumber = UsbKeyboardDevice->InterfaceDescriptor.NumEndpoints;\r
 \r
   //\r
-  // Traverse endpoints to find interrupt endpoints\r
+  // Traverse endpoints to find interrupt endpoint\r
   //\r
   Found = FALSE;\r
   for (Index = 0; Index < EndpointNumber; Index++) {\r
   //\r
   Found = FALSE;\r
   for (Index = 0; Index < EndpointNumber; Index++) {\r
@@ -230,7 +230,7 @@ USBKeyboardDriverBindingStart (
              &EndpointDescriptor\r
              );\r
 \r
              &EndpointDescriptor\r
              );\r
 \r
-    if ((EndpointDescriptor.Attributes & 0x03) == USB_ENDPOINT_INTERRUPT) {\r
+    if ((EndpointDescriptor.Attributes & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT) {\r
       //\r
       // We only care interrupt endpoint here\r
       //\r
       //\r
       // We only care interrupt endpoint here\r
       //\r
@@ -392,7 +392,7 @@ ErrorExit:
     if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {\r
       gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);\r
     }\r
     if (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx != NULL) {\r
       gBS->CloseEvent (UsbKeyboardDevice->SimpleInputEx.WaitForKeyEx);\r
     }\r
-    gBS->FreePool (UsbKeyboardDevice);\r
+    FreePool (UsbKeyboardDevice);\r
     UsbKeyboardDevice = NULL;\r
   }\r
   gBS->CloseProtocol (\r
     UsbKeyboardDevice = NULL;\r
   }\r
   gBS->CloseProtocol (\r
@@ -515,7 +515,7 @@ USBKeyboardDriverBindingStop (
     FreeUnicodeStringTable (UsbKeyboardDevice->ControllerNameTable);\r
   }\r
 \r
     FreeUnicodeStringTable (UsbKeyboardDevice->ControllerNameTable);\r
   }\r
 \r
-  gBS->FreePool (UsbKeyboardDevice);\r
+  FreePool (UsbKeyboardDevice);\r
 \r
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
@@ -815,7 +815,7 @@ KbdFreeNotifyList (
     Link = GetFirstNode (NotifyList);\r
     NotifyNode = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE);\r
     RemoveEntryList (Link);\r
     Link = GetFirstNode (NotifyList);\r
     NotifyNode = CR (Link, KEYBOARD_CONSOLE_IN_EX_NOTIFY, NotifyEntry, USB_KB_CONSOLE_IN_EX_NOTIFY_SIGNATURE);\r
     RemoveEntryList (Link);\r
-    gBS->FreePool (NotifyNode);\r
+    FreePool (NotifyNode);\r
   }\r
   \r
   return EFI_SUCCESS;\r
   }\r
   \r
   return EFI_SUCCESS;\r
@@ -1165,7 +1165,7 @@ USBKeyboardUnregisterKeyNotify (
                       NULL\r
                       );\r
       ASSERT_EFI_ERROR (Status);\r
                       NULL\r
                       );\r
       ASSERT_EFI_ERROR (Status);\r
-      gBS->FreePool (CurrentNotify);            \r
+      FreePool (CurrentNotify);            \r
       return EFI_SUCCESS;\r
     }\r
   }\r
       return EFI_SUCCESS;\r
     }\r
   }\r
index f8248300ee307d30efcf4c4a2c90297d02eb46a3..84950beab934a6ad8b0358cd5c274d65fbecb729 100644 (file)
@@ -209,7 +209,7 @@ USBKeyboardDriverBindingSupported (
   );\r
 \r
 /**\r
   );\r
 \r
 /**\r
-  Starts the device with this driver.\r
+  Starts the keyboard device with this driver.\r
 \r
   This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,\r
   initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage\r
 \r
   This function produces Simple Text Input Protocol and Simple Text Input Ex Protocol,\r
   initializes the keyboard device, and submit Asynchronous Interrupt Transfer to manage\r
index 3c72822a6deb7a001adbe962566e03966e59fcf6..48972ae0a6367831d5ddf067517472ca36c05b12 100644 (file)
@@ -413,7 +413,7 @@ GetCurrentKeyboardLayout (
                             KeyboardLayout\r
                             );\r
     if (EFI_ERROR (Status)) {\r
                             KeyboardLayout\r
                             );\r
     if (EFI_ERROR (Status)) {\r
-      gBS->FreePool (KeyboardLayout);\r
+      FreePool (KeyboardLayout);\r
       KeyboardLayout = NULL;\r
     }\r
   }\r
       KeyboardLayout = NULL;\r
     }\r
   }\r
@@ -814,7 +814,6 @@ InitUSBKeyboard (
   //\r
   // Set boot protocol for the USB Keyboard.\r
   // This driver only supports boot protocol.\r
   //\r
   // Set boot protocol for the USB Keyboard.\r
   // This driver only supports boot protocol.\r
-  // The device that does not support boot protocol is not supported.\r
   //\r
   if (Protocol != BOOT_PROTOCOL) {\r
     UsbSetProtocolRequest (\r
   //\r
   if (Protocol != BOOT_PROTOCOL) {\r
     UsbSetProtocolRequest (\r
@@ -871,33 +870,36 @@ InitUSBKeyboard (
   ZeroMem (UsbKeyboardDevice->LastKeyCodeArray, sizeof (UINT8) * 8);\r
 \r
   //\r
   ZeroMem (UsbKeyboardDevice->LastKeyCodeArray, sizeof (UINT8) * 8);\r
 \r
   //\r
-  // Set a timer for repeat keys' generation.\r
+  // Create event for repeat keys' generation.\r
   //\r
   if (UsbKeyboardDevice->RepeatTimer != NULL) {\r
     gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);\r
     UsbKeyboardDevice->RepeatTimer = NULL;\r
   }\r
 \r
   //\r
   if (UsbKeyboardDevice->RepeatTimer != NULL) {\r
     gBS->CloseEvent (UsbKeyboardDevice->RepeatTimer);\r
     UsbKeyboardDevice->RepeatTimer = NULL;\r
   }\r
 \r
-  Status = gBS->CreateEvent (\r
-                  EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
-                  TPL_NOTIFY,\r
-                  USBKeyboardRepeatHandler,\r
-                  UsbKeyboardDevice,\r
-                  &UsbKeyboardDevice->RepeatTimer\r
-                  );\r
+  gBS->CreateEvent (\r
+         EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
+         TPL_NOTIFY,\r
+         USBKeyboardRepeatHandler,\r
+         UsbKeyboardDevice,\r
+         &UsbKeyboardDevice->RepeatTimer\r
+         );\r
 \r
 \r
+  //\r
+  // Create event for delayed recovery, which deals with device error.\r
+  //\r
   if (UsbKeyboardDevice->DelayedRecoveryEvent != NULL) {\r
     gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);\r
     UsbKeyboardDevice->DelayedRecoveryEvent = NULL;\r
   }\r
 \r
   if (UsbKeyboardDevice->DelayedRecoveryEvent != NULL) {\r
     gBS->CloseEvent (UsbKeyboardDevice->DelayedRecoveryEvent);\r
     UsbKeyboardDevice->DelayedRecoveryEvent = NULL;\r
   }\r
 \r
-  Status = gBS->CreateEvent (\r
-                  EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
-                  TPL_NOTIFY,\r
-                  USBKeyboardRecoveryHandler,\r
-                  UsbKeyboardDevice,\r
-                  &UsbKeyboardDevice->DelayedRecoveryEvent\r
-                  );\r
+  gBS->CreateEvent (\r
+         EVT_TIMER | EVT_NOTIFY_SIGNAL,\r
+         TPL_NOTIFY,\r
+         USBKeyboardRecoveryHandler,\r
+         UsbKeyboardDevice,\r
+         &UsbKeyboardDevice->DelayedRecoveryEvent\r
+         );\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
index c6c8f8d11b27780a7ebc33cf10368078aea8c4a4..ab669463c8c1b62a43e7eb3ca82fc19251c36bfd 100644 (file)
@@ -121,13 +121,13 @@ UsbBotInit (
   if (Context != NULL) {\r
     *Context = UsbBot;\r
   } else {\r
   if (Context != NULL) {\r
     *Context = UsbBot;\r
   } else {\r
-    gBS->FreePool (UsbBot);\r
+    FreePool (UsbBot);\r
   }\r
 \r
   return EFI_SUCCESS;\r
 \r
 ON_ERROR:\r
   }\r
 \r
   return EFI_SUCCESS;\r
 \r
 ON_ERROR:\r
-  gBS->FreePool (UsbBot);\r
+  FreePool (UsbBot);\r
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
 \r
@@ -587,7 +587,7 @@ UsbBotCleanUp (
   IN  VOID                    *Context\r
   )\r
 {\r
   IN  VOID                    *Context\r
   )\r
 {\r
-  gBS->FreePool (Context);\r
+  FreePool (Context);\r
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
index d1424e2f754b1138c1d1437d658467c9ce0b6911..4de18d4bb90d70c2ec5ff8738bc98096c4a4ef23 100644 (file)
@@ -146,13 +146,13 @@ UsbCbiInit (
   if (Context != NULL) {\r
     *Context = UsbCbi;\r
   } else {\r
   if (Context != NULL) {\r
     *Context = UsbCbi;\r
   } else {\r
-    gBS->FreePool (UsbCbi);\r
+    FreePool (UsbCbi);\r
   }\r
  \r
   return EFI_SUCCESS;\r
 \r
 ON_ERROR:\r
   }\r
  \r
   return EFI_SUCCESS;\r
 \r
 ON_ERROR:\r
-  gBS->FreePool (UsbCbi);\r
+  FreePool (UsbCbi);\r
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
 \r
@@ -605,6 +605,6 @@ UsbCbiCleanUp (
   IN  VOID                   *Context\r
   )\r
 {\r
   IN  VOID                   *Context\r
   )\r
 {\r
-  gBS->FreePool (Context);\r
+  FreePool (Context);\r
   return EFI_SUCCESS;\r
 }\r
   return EFI_SUCCESS;\r
 }\r
index f13d26527e30020ded14b5dc47a1aaf323a2ce6e..e8b53f6c9fbd824003d3c275d02e2f5174137094 100644 (file)
@@ -854,7 +854,6 @@ UsbMouseReset (
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Event notification function for SIMPLE_POINTER.WaitForInput event.\r
 \r
 /**\r
   Event notification function for SIMPLE_POINTER.WaitForInput event.\r
 \r
@@ -881,7 +880,6 @@ UsbMouseWaitForInput (
   }\r
 }\r
 \r
   }\r
 }\r
 \r
-\r
 /**\r
   Handler for Delayed Recovery event.\r
 \r
 /**\r
   Handler for Delayed Recovery event.\r
 \r
index 7c0ff785a254f34e2a2e31e54255dad2d4a609f9..d13ae69fc3451a7d65823180d05d2a3f1d7377c3 100644 (file)
@@ -291,6 +291,63 @@ UsbMouseComponentNameGetControllerName (
   OUT CHAR16                                          **ControllerName\r
   );\r
 \r
   OUT CHAR16                                          **ControllerName\r
   );\r
 \r
+//\r
+// Functions of EFI_SIMPLE_POINTER_PROTOCOL\r
+//\r
+\r
+/**\r
+  Retrieves the current state of a pointer device.\r
+    \r
+  @param  This                  A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance.                                   \r
+  @param  MouseState            A pointer to the state information on the pointer device.\r
+                                \r
+  @retval EFI_SUCCESS           The state of the pointer device was returned in State.\r
+  @retval EFI_NOT_READY         The state of the pointer device has not changed since the last call to\r
+                                GetState().                                                           \r
+  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to retrieve the pointer device's\r
+                                current state.                                                           \r
+  @retval EFI_INVALID_PARAMETER MouseState is NULL.                                                           \r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetMouseState (\r
+  IN   EFI_SIMPLE_POINTER_PROTOCOL  *This,\r
+  OUT  EFI_SIMPLE_POINTER_STATE     *MouseState\r
+  );\r
+\r
+/**                                                                 \r
+  Resets the pointer device hardware.\r
+  \r
+  @param  This                  A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance.\r
+  @param  ExtendedVerification  Indicates that the driver may perform a more exhaustive\r
+                                verification operation of the device during reset.\r
+                                \r
+  @retval EFI_SUCCESS           The device was reset.\r
+  @retval EFI_DEVICE_ERROR      The device is not functioning correctly and could not be reset.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UsbMouseReset (\r
+  IN EFI_SIMPLE_POINTER_PROTOCOL    *This,\r
+  IN BOOLEAN                        ExtendedVerification\r
+  );\r
+\r
+/**\r
+  Event notification function for SIMPLE_POINTER.WaitForInput event.\r
+\r
+  @param  Event        Event to be signaled when there's input from mouse.\r
+  @param  Context      Points to USB_MOUSE_DEV instance.\r
\r
+**/\r
+VOID\r
+EFIAPI\r
+UsbMouseWaitForInput (\r
+  IN  EFI_EVENT               Event,\r
+  IN  VOID                    *Context\r
+  );\r
+\r
 //\r
 // Internal worker functions\r
 //\r
 //\r
 // Internal worker functions\r
 //\r
@@ -355,59 +412,6 @@ OnMouseInterruptComplete (
   IN  UINT32      Result\r
   );\r
 \r
   IN  UINT32      Result\r
   );\r
 \r
-/**\r
-  Retrieves the current state of a pointer device.\r
-    \r
-  @param  This                  A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance.                                   \r
-  @param  MouseState            A pointer to the state information on the pointer device.\r
-                                \r
-  @retval EFI_SUCCESS           The state of the pointer device was returned in State.\r
-  @retval EFI_NOT_READY         The state of the pointer device has not changed since the last call to\r
-                                GetState().                                                           \r
-  @retval EFI_DEVICE_ERROR      A device error occurred while attempting to retrieve the pointer device's\r
-                                current state.                                                           \r
-  @retval EFI_INVALID_PARAMETER MouseState is NULL.                                                           \r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-GetMouseState (\r
-  IN   EFI_SIMPLE_POINTER_PROTOCOL  *This,\r
-  OUT  EFI_SIMPLE_POINTER_STATE     *MouseState\r
-  );\r
-\r
-/**                                                                 \r
-  Resets the pointer device hardware.\r
-  \r
-  @param  This                  A pointer to the EFI_SIMPLE_POINTER_PROTOCOL instance.\r
-  @param  ExtendedVerification  Indicates that the driver may perform a more exhaustive\r
-                                verification operation of the device during reset.\r
-                                \r
-  @retval EFI_SUCCESS           The device was reset.\r
-  @retval EFI_DEVICE_ERROR      The device is not functioning correctly and could not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-UsbMouseReset (\r
-  IN EFI_SIMPLE_POINTER_PROTOCOL    *This,\r
-  IN BOOLEAN                        ExtendedVerification\r
-  );\r
-\r
-/**\r
-  Event notification function for SIMPLE_POINTER.WaitForInput event.\r
-\r
-  @param  Event        Event to be signaled when there's input from mouse.\r
-  @param  Context      Points to USB_MOUSE_DEV instance.\r
\r
-**/\r
-VOID\r
-EFIAPI\r
-UsbMouseWaitForInput (\r
-  IN  EFI_EVENT               Event,\r
-  IN  VOID                    *Context\r
-  );\r
-\r
 /**\r
   Handler for Delayed Recovery event.\r
 \r
 /**\r
   Handler for Delayed Recovery event.\r
 \r