From ccd55824e79865a04b1c872bda4af0f1de1f50be Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Tue, 25 Aug 2009 07:29:13 +0000 Subject: 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 --- UnixPkg/UnixSerialIoDxe/UnixSerialIo.c | 14 ++++++++++---- UnixPkg/UnixSerialIoDxe/UnixSerialIo.h | 8 +++++++- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'UnixPkg/UnixSerialIoDxe') 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 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 #include #include + +#ifdef __APPLE__ +#else #include #include +#endif + #include #include -- cgit v1.2.3