raise TPL to TPL_CALLBACK level at DriverBindingStart() for all usb-related modules, which prevent DriverBindingStop() from being invoked when DriverBindingStart() runs.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10460 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
erictian 2010-05-05 05:21:38 +00:00
parent b9d5a7f1dc
commit 15cc67e616
6 changed files with 45 additions and 12 deletions

View File

@ -154,7 +154,9 @@ USBKeyboardDriverBindingStart (
UINT8 PollingInterval; UINT8 PollingInterval;
UINT8 PacketSize; UINT8 PacketSize;
BOOLEAN Found; BOOLEAN Found;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
// //
// Open USB I/O Protocol // Open USB I/O Protocol
// //
@ -167,7 +169,7 @@ USBKeyboardDriverBindingStart (
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; goto ErrorExit1;
} }
UsbKeyboardDevice = AllocateZeroPool (sizeof (USB_KB_DEV)); UsbKeyboardDevice = AllocateZeroPool (sizeof (USB_KB_DEV));
@ -381,6 +383,7 @@ USBKeyboardDriverBindingStart (
FALSE FALSE
); );
gBS->RestoreTPL (OldTpl);
return EFI_SUCCESS; return EFI_SUCCESS;
// //
@ -407,6 +410,10 @@ ErrorExit:
This->DriverBindingHandle, This->DriverBindingHandle,
Controller Controller
); );
ErrorExit1:
gBS->RestoreTPL (OldTpl);
return Status; return Status;
} }

View File

@ -833,7 +833,10 @@ USBMassDriverBindingStart (
UINT8 MaxLun; UINT8 MaxLun;
EFI_STATUS Status; EFI_STATUS Status;
EFI_USB_IO_PROTOCOL *UsbIo; EFI_USB_IO_PROTOCOL *UsbIo;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Transport = NULL; Transport = NULL;
Context = NULL; Context = NULL;
MaxLun = 0; MaxLun = 0;
@ -842,7 +845,7 @@ USBMassDriverBindingStart (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: UsbMassInitTransport (%r)\n", Status)); DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: UsbMassInitTransport (%r)\n", Status));
return Status; goto Exit;
} }
if (MaxLun == 0) { if (MaxLun == 0) {
// //
@ -867,7 +870,7 @@ USBMassDriverBindingStart (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: OpenDevicePathProtocol By Driver (%r)\n", Status)); DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: OpenDevicePathProtocol By Driver (%r)\n", Status));
return Status; goto Exit;
} }
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
@ -887,7 +890,7 @@ USBMassDriverBindingStart (
This->DriverBindingHandle, This->DriverBindingHandle,
Controller Controller
); );
return Status; goto Exit;
} }
// //
@ -911,6 +914,8 @@ USBMassDriverBindingStart (
DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: UsbMassInitMultiLun (%r) with Maxlun=%d\n", Status, MaxLun)); DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: UsbMassInitMultiLun (%r) with Maxlun=%d\n", Status, MaxLun));
} }
} }
Exit:
gBS->RestoreTPL (OldTpl);
return Status; return Status;
} }

View File

@ -149,7 +149,9 @@ USBMouseAbsolutePointerDriverBindingStart (
UINT8 PollingInterval; UINT8 PollingInterval;
UINT8 PacketSize; UINT8 PacketSize;
BOOLEAN Found; BOOLEAN Found;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
// //
// Open USB I/O Protocol // Open USB I/O Protocol
// //
@ -162,7 +164,7 @@ USBMouseAbsolutePointerDriverBindingStart (
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; goto ErrorExit1;
} }
UsbMouseAbsolutePointerDevice = AllocateZeroPool (sizeof (USB_MOUSE_ABSOLUTE_POINTER_DEV)); UsbMouseAbsolutePointerDevice = AllocateZeroPool (sizeof (USB_MOUSE_ABSOLUTE_POINTER_DEV));
@ -324,6 +326,7 @@ USBMouseAbsolutePointerDriverBindingStart (
FALSE FALSE
); );
gBS->RestoreTPL (OldTpl);
return EFI_SUCCESS; return EFI_SUCCESS;
// //
@ -348,6 +351,9 @@ ErrorExit:
} }
} }
ErrorExit1:
gBS->RestoreTPL (OldTpl);
return Status; return Status;
} }

View File

@ -149,7 +149,9 @@ USBMouseDriverBindingStart (
UINT8 PollingInterval; UINT8 PollingInterval;
UINT8 PacketSize; UINT8 PacketSize;
BOOLEAN Found; BOOLEAN Found;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
// //
// Open USB I/O Protocol // Open USB I/O Protocol
// //
@ -162,7 +164,7 @@ USBMouseDriverBindingStart (
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; goto ErrorExit1;
} }
UsbMouseDevice = AllocateZeroPool (sizeof (USB_MOUSE_DEV)); UsbMouseDevice = AllocateZeroPool (sizeof (USB_MOUSE_DEV));
@ -324,6 +326,8 @@ USBMouseDriverBindingStart (
FALSE FALSE
); );
gBS->RestoreTPL (OldTpl);
return EFI_SUCCESS; return EFI_SUCCESS;
// //
@ -348,6 +352,8 @@ ErrorExit:
} }
} }
ErrorExit1:
gBS->RestoreTPL (OldTpl);
return Status; return Status;
} }

View File

@ -125,7 +125,9 @@ DiskIoDriverBindingStart (
{ {
EFI_STATUS Status; EFI_STATUS Status;
DISK_IO_PRIVATE_DATA *Private; DISK_IO_PRIVATE_DATA *Private;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
Private = NULL; Private = NULL;
// //
@ -140,7 +142,7 @@ DiskIoDriverBindingStart (
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; goto ErrorExit1;
} }
// //
@ -177,6 +179,8 @@ ErrorExit:
); );
} }
ErrorExit1:
gBS->RestoreTPL (OldTpl);
return Status; return Status;
} }

View File

@ -194,7 +194,9 @@ PartitionDriverBindingStart (
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
PARTITION_DETECT_ROUTINE *Routine; PARTITION_DETECT_ROUTINE *Routine;
BOOLEAN MediaPresent; BOOLEAN MediaPresent;
EFI_TPL OldTpl;
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
// //
// Check RemainingDevicePath validation // Check RemainingDevicePath validation
// //
@ -204,7 +206,8 @@ PartitionDriverBindingStart (
// if yes, return EFI_SUCCESS // if yes, return EFI_SUCCESS
// //
if (IsDevicePathEnd (RemainingDevicePath)) { if (IsDevicePathEnd (RemainingDevicePath)) {
return EFI_SUCCESS; Status = EFI_SUCCESS;
goto Exit;
} }
} }
@ -217,7 +220,7 @@ PartitionDriverBindingStart (
EFI_OPEN_PROTOCOL_GET_PROTOCOL EFI_OPEN_PROTOCOL_GET_PROTOCOL
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; goto Exit;
} }
// //
// Get the Device Path Protocol on ControllerHandle's handle // Get the Device Path Protocol on ControllerHandle's handle
@ -231,7 +234,7 @@ PartitionDriverBindingStart (
EFI_OPEN_PROTOCOL_BY_DRIVER EFI_OPEN_PROTOCOL_BY_DRIVER
); );
if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) { if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
return Status; goto Exit;
} }
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
@ -249,7 +252,7 @@ PartitionDriverBindingStart (
This->DriverBindingHandle, This->DriverBindingHandle,
ControllerHandle ControllerHandle
); );
return Status; goto Exit;
} }
OpenStatus = Status; OpenStatus = Status;
@ -312,6 +315,8 @@ PartitionDriverBindingStart (
); );
} }
Exit:
gBS->RestoreTPL (OldTpl);
return Status; return Status;
} }