Remove unused variable and function

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2606 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2007-05-30 08:17:24 +00:00
parent b19cfa69e7
commit 21500a434a
3 changed files with 149 additions and 175 deletions

View File

@ -57,25 +57,6 @@ EFI_DRIVER_BINDING_PROTOCOL gUnixSerialIoDriverBinding = {
NULL NULL
}; };
STATIC
VOID
PrintSerialParameter(
UNIX_SERIAL_IO_PRIVATE_DATA *Private
)
{
struct termios Options;
if (Private->UnixThunk->Tcgetattr (Private->UnixHandle, &Options) == 0) {
DEBUG ((EFI_D_INFO, "Serial[0x%x]:Input mode: 0x%x\r\n", Private->UnixHandle, Options.c_iflag));
DEBUG ((EFI_D_INFO, "Serial[0x%x]:Output mode: 0x%x\r\n", Private->UnixHandle, Options.c_oflag));
DEBUG ((EFI_D_INFO, "Serial[0x%x]:Control flag: 0x%x\r\n", Private->UnixHandle, Options.c_cflag));
DEBUG ((EFI_D_INFO, "Serial[0x%x]:Local mode flag: 0x%x\r\n", Private->UnixHandle, Options.c_lflag));
DEBUG ((EFI_D_INFO, "Serial[0x%x]:Line discipline: 0x%x\r\n", Private->UnixHandle, Options.c_line));
DEBUG ((EFI_D_INFO, "Serial[0x%x]:Input Speed: 0x%x\r\n", Private->UnixHandle, Options.c_ispeed));
DEBUG ((EFI_D_INFO, "Serial[0x%x]:Output Speed: 0x%x\r\n", Private->UnixHandle, Options.c_ospeed));
}
}
STATIC STATIC
UINTN UINTN
ConvertBaud2Unix ( ConvertBaud2Unix (
@ -1134,7 +1115,6 @@ Returns:
UNIX_SERIAL_IO_PRIVATE_DATA *Private; UNIX_SERIAL_IO_PRIVATE_DATA *Private;
UINTN Result; UINTN Result;
UINTN Status; UINTN Status;
struct termios Options;
UINT32 Bits; UINT32 Bits;
EFI_TPL Tpl; EFI_TPL Tpl;
UINTN Bytes; UINTN Bytes;

View File

@ -1,52 +1,52 @@
/*++ /*++
Copyright (c) 2004, 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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
UnixThunk.h
Abstract:
This protocol allows an EFI driver in the Unix emulation environment
to make Posix calls.
NEVER make an Unix call directly, always make the call via this protocol.
There are no This pointers on the protocol member functions as they map
exactly into Unix system calls.
--*/
#ifndef _UNIX_THUNK_H_
#define _UNIX_THUNK_H_
#include <sys/termios.h>
#define EFI_UNIX_THUNK_PROTOCOL_GUID \ Copyright (c) 2004, 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
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
UnixThunk.h
Abstract:
This protocol allows an EFI driver in the Unix emulation environment
to make Posix calls.
NEVER make an Unix call directly, always make the call via this protocol.
There are no This pointers on the protocol member functions as they map
exactly into Unix system calls.
--*/
#ifndef _UNIX_THUNK_H_
#define _UNIX_THUNK_H_
#include <sys/termios.h>
#define EFI_UNIX_THUNK_PROTOCOL_GUID \
{ \
0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \ 0xf2e98868, 0x8985, 0x11db, {0x9a, 0x59, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35 } \
} }
typedef typedef
VOID VOID
(*UnixSleep) ( (*UnixSleep) (
unsigned long Milliseconds unsigned long Milliseconds
); );
typedef typedef
VOID VOID
(*UnixExit) ( (*UnixExit) (
int status // exit code for all threads int status // exit code for all threads
); );
typedef typedef
VOID VOID
(*UnixSetTimer) (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs)); (*UnixSetTimer) (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs));
@ -138,55 +138,51 @@ typedef
EFI_STATUS EFI_STATUS
(*UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, (*UnixUgaCreate)(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo,
CONST CHAR16 *Title); CONST CHAR16 *Title);
typedef
int
(*UnixTcflush) (int fildes, int queue_selector);
typedef
void
(*UnixPerror) (__const char *__s);
typedef
void
(*UnixPrintf) (const char* format, ...);
typedef
int
(*UnixIoCtl) (int fd, unsigned long int __request, ...);
typedef
int
(*UnixFcntl) (int __fd, int __cmd, ...);
typedef
int
(*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed);
typedef
int
(*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed);
typedef
int
(*UnixTcgetattr) (int __fd, struct termios *__termios_p);
typedef
int
(*UnixTcsetattr) (int __fd, int __optional_actions,
__const struct termios *__termios_p);
// typedef
// int
// (*UnixTcflush) (int fildes, int queue_selector);
#define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('L', 'N', 'X', 'T')
typedef struct _EFI_UNIX_THUNK_PROTOCOL {
UINT64 Signature;
UnixSleep Sleep; typedef
UnixExit Exit; void
(*UnixPerror) (__const char *__s);
typedef
int
(*UnixIoCtl) (int fd, unsigned long int __request, ...);
typedef
int
(*UnixFcntl) (int __fd, int __cmd, ...);
typedef
int
(*UnixCfsetispeed) (struct termios *__termios_p, speed_t __speed);
typedef
int
(*UnixCfsetospeed) (struct termios *__termios_p, speed_t __speed);
typedef
int
(*UnixTcgetattr) (int __fd, struct termios *__termios_p);
typedef
int
(*UnixTcsetattr) (int __fd, int __optional_actions,
__const struct termios *__termios_p);
//
//
//
#define EFI_UNIX_THUNK_PROTOCOL_SIGNATURE EFI_SIGNATURE_32 ('L', 'N', 'X', 'T')
typedef struct _EFI_UNIX_THUNK_PROTOCOL {
UINT64 Signature;
UnixSleep Sleep;
UnixExit Exit;
UnixSetTimer SetTimer; UnixSetTimer SetTimer;
UnixGetLocalTime GetLocalTime; UnixGetLocalTime GetLocalTime;
UnixGmTime GmTime; UnixGmTime GmTime;
@ -217,16 +213,15 @@ typedef struct _EFI_UNIX_THUNK_PROTOCOL {
UnixUTime UTime; UnixUTime UTime;
UnixTcflush Tcflush; UnixTcflush Tcflush;
UnixUgaCreate UgaCreate; UnixUgaCreate UgaCreate;
UnixPerror Perror; UnixPerror Perror;
UnixPrintf Printf; UnixIoCtl IoCtl;
UnixIoCtl IoCtl; UnixFcntl Fcntl;
UnixFcntl Fcntl; UnixCfsetispeed Cfsetispeed;
UnixCfsetispeed Cfsetispeed; UnixCfsetospeed Cfsetospeed;
UnixCfsetospeed Cfsetospeed; UnixTcgetattr Tcgetattr;
UnixTcgetattr Tcgetattr; UnixTcsetattr Tcsetattr;
UnixTcsetattr Tcsetattr;
} EFI_UNIX_THUNK_PROTOCOL; } EFI_UNIX_THUNK_PROTOCOL;
extern EFI_GUID gEfiUnixThunkProtocolGuid; extern EFI_GUID gEfiUnixThunkProtocolGuid;
#endif #endif

View File

@ -1,43 +1,43 @@
/*++ /*++
Copyright (c) 2004 - 2006, Intel Corporation Copyright (c) 2004 - 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: Module Name:
UnixThunk.c UnixThunk.c
Abstract: Abstract:
Since the SEC is the only program in our emulation we Since the SEC is the only program in our emulation we
must use a Tiano mechanism to export APIs to other modules. must use a Tiano mechanism to export APIs to other modules.
This is the role of the EFI_UNIX_THUNK_PROTOCOL. This is the role of the EFI_UNIX_THUNK_PROTOCOL.
The mUnixThunkTable exists so that a change to EFI_UNIX_THUNK_PROTOCOL The mUnixThunkTable exists so that a change to EFI_UNIX_THUNK_PROTOCOL
will cause an error in initializing the array if all the member functions will cause an error in initializing the array if all the member functions
are not added. It looks like adding a element to end and not initializing are not added. It looks like adding a element to end and not initializing
it may cause the table to be initaliized with the members at the end being it may cause the table to be initaliized with the members at the end being
set to zero. This is bad as jumping to zero will crash. set to zero. This is bad as jumping to zero will crash.
gUnix is a a public exported global that contains the initialized gUnix is a a public exported global that contains the initialized
data. data.
--*/ --*/
#include "SecMain.h" #include "SecMain.h"
#include "Library/UnixLib.h" #include "Library/UnixLib.h"
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
#include <signal.h> #include <signal.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <termio.h> #include <termio.h>
static int settimer_initialized; static int settimer_initialized;
@ -156,8 +156,8 @@ GetErrno(void)
extern EFI_STATUS extern EFI_STATUS
UgaCreate(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, CONST CHAR16 *Title); UgaCreate(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, CONST CHAR16 *Title);
EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = { EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = {
EFI_UNIX_THUNK_PROTOCOL_SIGNATURE, EFI_UNIX_THUNK_PROTOCOL_SIGNATURE,
msSleep, /* Sleep */ msSleep, /* Sleep */
exit, /* Exit */ exit, /* Exit */
SetTimer, SetTimer,
@ -189,16 +189,15 @@ EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = {
chmod, chmod,
utime, utime,
tcflush, tcflush,
UgaCreate, UgaCreate,
perror, perror,
printf, ioctl,
ioctl, fcntl,
fcntl, cfsetispeed,
cfsetispeed, cfsetospeed,
cfsetospeed, tcgetattr,
tcgetattr,
tcsetattr tcsetattr
}; };
EFI_UNIX_THUNK_PROTOCOL *gUnix = &mUnixThunkTable; EFI_UNIX_THUNK_PROTOCOL *gUnix = &mUnixThunkTable;