/*++\r
\r
-Copyright (c) 2006 - 2007, Intel Corporation\r
+Copyright (c) 2006 - 2009, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
--*/\r
\r
#include "UnixSerialIo.h"\r
-#include <termio.h>\r
\r
EFI_DRIVER_BINDING_PROTOCOL gUnixSerialIoDriverBinding = {\r
UnixSerialIoDriverBindingSupported,\r
NULL\r
};\r
\r
-STATIC\r
UINTN\r
ConvertBaud2Unix (\r
UINT64 BaudRate\r
return -1;\r
}\r
\r
-STATIC\r
UINTN\r
ConvertByteSize2Unix (\r
UINT8 DataBit\r
return -1;\r
}\r
\r
-STATIC\r
VOID\r
ConvertParity2Unix (\r
struct termios *Options,\r
}\r
}\r
\r
-STATIC \r
VOID\r
ConvertStopBit2Unix (\r
struct termios *Options,\r
UnixHandle = UnixIo->UnixThunk->Open (AsciiDevName, O_RDWR | O_NOCTTY, 0);\r
\r
if (UnixHandle == -1) {\r
- DEBUG ((EFI_D_INFO, "Faile to open serial device, %s!\r\n", UnixIo->EnvString ));\r
+ DEBUG ((EFI_D_INFO, "Failed to open serial device, %s!\r\n", UnixIo->EnvString ));\r
UnixIo->UnixThunk->Perror (AsciiDevName);\r
Status = EFI_DEVICE_ERROR;\r
goto Error;\r
return EFI_DEVICE_ERROR;\r
}\r
\r
+ Bits = 0;\r
if ((Status & TIOCM_CTS) == TIOCM_CTS) {\r
Bits |= EFI_SERIAL_CLEAR_TO_SEND;\r
}\r
--*/\r
{\r
UNIX_SERIAL_IO_PRIVATE_DATA *Private;\r
+ EFI_STATUS Status;\r
UINT8 *ByteBuffer;\r
UINT32 TotalBytesWritten;\r
UINT32 BytesToGo;\r
Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This); \r
\r
ByteBuffer = (UINT8 *) Buffer;\r
+ Status = EFI_SUCCESS;\r
TotalBytesWritten = 0;\r
\r
if (Private->SoftwareLoopbackEnable || Private->HardwareLoopbackEnable) {\r
&ByteBuffer[TotalBytesWritten],\r
BytesToGo\r
);\r
+ if (BytesWritten == -1) {\r
+ Status = EFI_DEVICE_ERROR;\r
+ break;\r
+ }\r
\r
if (Private->HardwareFlowControl) {\r
//\r
\r
gBS->RestoreTPL (Tpl);\r
\r
- return EFI_SUCCESS;\r
+ return Status;\r
}\r
\r
EFI_STATUS\r