summaryrefslogtreecommitdiff
path: root/UnixPkg/UnixSerialIoDxe
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2009-08-25 07:29:13 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2009-08-25 07:29:13 +0000
commitccd55824e79865a04b1c872bda4af0f1de1f50be (patch)
treee67acf21c32a61eeaebf1f28d87df97732b80187 /UnixPkg/UnixSerialIoDxe
parent7f22d35110e43be45a0e16a2e944feebbf51e4ed (diff)
downloadedk2-platforms-ccd55824e79865a04b1c872bda4af0f1de1f50be.tar.xz
Integrate patch from Andrew Fish to make it run on OS X.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9194 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'UnixPkg/UnixSerialIoDxe')
-rw-r--r--UnixPkg/UnixSerialIoDxe/UnixSerialIo.c14
-rw-r--r--UnixPkg/UnixSerialIoDxe/UnixSerialIo.h8
2 files changed, 17 insertions, 5 deletions
diff --git a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c
index fa4e3aad36..edbfd0ad13 100644
--- a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c
+++ b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2006 - 2007, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -46,7 +46,6 @@ Abstract:
--*/
#include "UnixSerialIo.h"
-#include <termio.h>
EFI_DRIVER_BINDING_PROTOCOL gUnixSerialIoDriverBinding = {
UnixSerialIoDriverBindingSupported,
@@ -454,7 +453,7 @@ Returns:
UnixHandle = UnixIo->UnixThunk->Open (AsciiDevName, O_RDWR | O_NOCTTY, 0);
if (UnixHandle == -1) {
- DEBUG ((EFI_D_INFO, "Faile to open serial device, %s!\r\n", UnixIo->EnvString ));
+ DEBUG ((EFI_D_INFO, "Failed to open serial device, %s!\r\n", UnixIo->EnvString ));
UnixIo->UnixThunk->Perror (AsciiDevName);
Status = EFI_DEVICE_ERROR;
goto Error;
@@ -1125,6 +1124,7 @@ Returns:
return EFI_DEVICE_ERROR;
}
+ Bits = 0;
if ((Status & TIOCM_CTS) == TIOCM_CTS) {
Bits |= EFI_SERIAL_CLEAR_TO_SEND;
}
@@ -1206,6 +1206,7 @@ Returns:
--*/
{
UNIX_SERIAL_IO_PRIVATE_DATA *Private;
+ EFI_STATUS Status;
UINT8 *ByteBuffer;
UINT32 TotalBytesWritten;
UINT32 BytesToGo;
@@ -1219,6 +1220,7 @@ Returns:
Private = UNIX_SERIAL_IO_PRIVATE_DATA_FROM_THIS (This);
ByteBuffer = (UINT8 *) Buffer;
+ Status = EFI_SUCCESS;
TotalBytesWritten = 0;
if (Private->SoftwareLoopbackEnable || Private->HardwareLoopbackEnable) {
@@ -1250,6 +1252,10 @@ Returns:
&ByteBuffer[TotalBytesWritten],
BytesToGo
);
+ if (BytesWritten == -1) {
+ Status = EFI_DEVICE_ERROR;
+ break;
+ }
if (Private->HardwareFlowControl) {
//
@@ -1269,7 +1275,7 @@ Returns:
gBS->RestoreTPL (Tpl);
- return EFI_SUCCESS;
+ return Status;
}
EFI_STATUS
diff --git a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h
index 3a6c11ac37..bcd8018e4c 100644
--- a/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h
+++ b/UnixPkg/UnixSerialIoDxe/UnixSerialIo.h
@@ -1,6 +1,7 @@
/*++
-Copyright (c) 2006 - 2008, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
+Portions copyright (c) 2008-2009 Apple Inc.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -23,8 +24,13 @@ Abstract:
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
+
+#ifdef __APPLE__
+#else
#include <stdlib.h>
#include <termio.h>
+#endif
+
#include <fcntl.h>
#include <errno.h>