/* This function makes sure all the current system drivers manage the correspoinding controllers if have. And at the same time, makes sure all the system controllers have driver to manage it if have.  */
VOID BmConnectAllDriversToAllControllers(VOID)
/* This function makes sure all the current system drivers manage the correspoinding controllers if have. And at the same time, makes sure all the system controllers have driver to manage it if have.  */
VOID BmConnectAllDriversToAllControllers(VOID)
{
  EFI_STATUS  Status;
  UINTN       HandleCount;
  EFI_HANDLE  *HandleBuffer;
  UINTN       Index;
  do {
    gBS->LocateHandleBuffer (
           AllHandles,
           NULL,
           NULL,
           &HandleCount,
           &HandleBuffer
           );
    for (Index = 0; Index < HandleCount; Index++) {
      gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);
    }
    if (HandleBuffer != NULL) {
      FreePool (HandleBuffer);
    }
    Status = gDS->Dispatch ();
  } while (!EFI_ERROR (Status));
}