/* Writes NumberOfBytes data bytes from Buffer to the serial device. The number of bytes actually written to the serial device is returned. If the return value is less than NumberOfBytes, then the write operation failed. If NumberOfBytes is zero, then return 0. */
UINTN EFIAPI SerialPortWrite(IN UINT8 *Buffer, IN UINTN NumberOfBytes)
/* Writes NumberOfBytes data bytes from Buffer to the serial device. The number of bytes actually written to the serial device is returned. If the return value is less than NumberOfBytes, then the write operation failed. If NumberOfBytes is zero, then return 0. */
UINTN EFIAPI SerialPortWrite(IN UINT8 *Buffer, IN UINTN NumberOfBytes)
{
  if (NumberOfBytes == 0) {
    return 0;
  }
  if (mHaveDbcn) {
    return SbiDbcnWrite (Buffer, NumberOfBytes);
  } else if (mHaveLegacyPutchar) {
    return SbiLegacyPutchar (Buffer, NumberOfBytes);
  }
  return 0;
}