diff options
author | andrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-04-07 21:50:16 +0000 |
---|---|---|
committer | andrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-04-07 21:50:16 +0000 |
commit | e0c2cc6f8975adde2c8605ae7fd76237bbcc7539 (patch) | |
tree | 8064bba5cad15c0b20808e586c918df39557f786 /ShellPkg/Library/UefiShellNetwork1CommandsLib | |
parent | 392fa5a63bcbf477107007d5df9c437520cb113d (diff) | |
download | edk2-platforms-e0c2cc6f8975adde2c8605ae7fd76237bbcc7539.tar.xz |
Fix Xcode, clang, and ARM build and link issues.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11513 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellNetwork1CommandsLib')
5 files changed, 28 insertions, 102 deletions
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ia32/Tsc.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ia32/Tsc.c deleted file mode 100644 index e2eae99077..0000000000 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ia32/Tsc.c +++ /dev/null @@ -1,28 +0,0 @@ -/** @file
- The implement to read TSC in IA32 platform.
-
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-
- 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.
-
-**/
-
-#include <Library/BaseLib.h>
-
-/**
- Reads and returns the current value of the Time Stamp Counter (TSC).
-
- @return The current value of TSC.
-
-**/
-UINT64
-ReadTime ()
-{
- return AsmReadTsc ();
-}
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ipf/Itc.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ipf/Itc.c deleted file mode 100644 index 131e5c0e30..0000000000 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ipf/Itc.c +++ /dev/null @@ -1,28 +0,0 @@ -/** @file
- The implement to read ITC in IA64 platform.
-
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-
- 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.
-
-**/
-
-#include <Library/BaseLib.h>
-
-/**
- Reads and returns the current value of the Interval Timer Counter Register (ITC).
-
- @return The current value of ITC.
-
-**/
-UINT64
-ReadTime ()
-{
- return AsmReadItc ();
-}
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c index ab7658c45b..10d38d8022 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c @@ -185,11 +185,6 @@ NetChecksum ( @return The current value of the register.
**/
-UINT64
-EFIAPI
-ReadTime (
- VOID
- );
STATIC CONST SHELL_PARAM_ITEM PingParamList[] = {
{
@@ -220,6 +215,32 @@ STATIC CONST SHELL_PARAM_ITEM PingParamList[] = { STATIC CONST CHAR16 *mDstString;
STATIC CONST CHAR16 *mSrcString;
STATIC UINT64 mFrequency = 0;
+EFI_CPU_ARCH_PROTOCOL *gCpu = NULL;
+
+UINT64
+EFIAPI
+ReadTime (
+ VOID
+ )
+{
+ static UINT64 CurrentTick = 0;
+ UINT64 TimerPeriod;
+ EFI_STATUS Status;
+
+ ASSERT (gCpu != NULL);
+
+ Status = gCpu->GetTimerValue (gCpu, 0, &CurrentTick, &TimerPeriod);
+ if (EFI_ERROR (Status)) {
+ //
+ // The WinntGetTimerValue will return EFI_UNSUPPORTED. Set the
+ // TimerPeriod by ourselves.
+ //
+ CurrentTick += 1000000;
+ }
+
+ return CurrentTick;
+}
+
/**
Get and caculate the frequency in tick/ms.
@@ -236,17 +257,15 @@ GetFrequency ( )
{
EFI_STATUS Status;
- EFI_CPU_ARCH_PROTOCOL *Cpu;
UINT64 CurrentTick;
UINT64 TimerPeriod;
- Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **) &Cpu);
-
+ Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **) &gCpu);
if (EFI_ERROR (Status)) {
return Status;
}
- Status = Cpu->GetTimerValue (Cpu, 0, &CurrentTick, &TimerPeriod);
+ Status = gCpu->GetTimerValue (gCpu, 0, &CurrentTick, &TimerPeriod);
if (EFI_ERROR (Status)) {
TimerPeriod = DEFAULT_TIMER_PERIOD;
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf index 51dca82b48..3ff1676cde 100644 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf +++ b/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf @@ -30,15 +30,6 @@ Ping.c
Ifconfig.c
-[Sources.IA32]
- Ia32/Tsc.c
-
-[Sources.X64]
- X64/Tsc.c
-
-[Sources.IPF]
- Ipf/Itc.c
-
[Packages]
MdePkg/MdePkg.dec
ShellPkg/ShellPkg.dec
diff --git a/ShellPkg/Library/UefiShellNetwork1CommandsLib/X64/Tsc.c b/ShellPkg/Library/UefiShellNetwork1CommandsLib/X64/Tsc.c deleted file mode 100644 index b3e7bdbb96..0000000000 --- a/ShellPkg/Library/UefiShellNetwork1CommandsLib/X64/Tsc.c +++ /dev/null @@ -1,28 +0,0 @@ -/** @file
- The implement to read TSC in X64 platform.
-
- Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
-
- 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.
-
-**/
-
-#include <Library/BaseLib.h>
-
-/**
- Reads and returns the current value of Time Stamp Counter (TSC).
-
- @return The current value of TSC
-
-**/
-UINT64
-ReadTime ()
-{
- return AsmReadTsc ();
-}
|