/* Set the terminal to a specified display mode. In this driver, we only support mode 0. */
EFI_STATUS EFIAPI TerminalConOutSetMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber)
/* Set the terminal to a specified display mode. In this driver, we only support mode 0. */
EFI_STATUS EFIAPI TerminalConOutSetMode(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN UINTN ModeNumber)
{
  EFI_STATUS    Status;
  TERMINAL_DEV  *TerminalDevice;
  TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This);
  if (ModeNumber >= (UINTN)This->Mode->MaxMode) {
    return EFI_UNSUPPORTED;
  }
  This->Mode->Mode = (INT32)ModeNumber;
  This->ClearScreen (This);
  TerminalDevice->OutputEscChar = TRUE;
  Status                        = This->OutputString (This, mSetModeString);
  TerminalDevice->OutputEscChar = FALSE;
  if (EFI_ERROR (Status)) {
    return EFI_DEVICE_ERROR;
  }
  This->Mode->Mode = (INT32)ModeNumber;
  Status = This->ClearScreen (This);
  if (EFI_ERROR (Status)) {
    return EFI_DEVICE_ERROR;
  }
  return EFI_SUCCESS;
}