Add Network1 profile.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11423 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey 2011-03-25 20:47:02 +00:00
parent 9586a35127
commit 68fb05272b
9 changed files with 3641 additions and 0 deletions

View File

@ -0,0 +1,28 @@
/** @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 ();
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
/** @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 ();
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,94 @@
/** @file
Main file for NULL named library for network1 shell command functions.
Copyright (c) 2010 - 2011, 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 "UefiShellNetwork1CommandsLib.h"
CONST CHAR16 gShellNetwork1FileName[] = L"ShellCommands";
EFI_HANDLE gShellNetwork1HiiHandle = NULL;
STATIC CONST EFI_GUID gShellNetwork1HiiGuid = \
{ \
0xf3d301bb, 0xf4a5, 0x45a8, { 0xb0, 0xb7, 0xfa, 0x99, 0x9c, 0x62, 0x37, 0xae } \
};
/**
return the file name of the help text file if not using HII.
@return The string pointer to the file name.
**/
CONST CHAR16*
EFIAPI
ShellCommandGetManFileNameNetwork1 (
VOID
)
{
return (gShellNetwork1FileName);
}
/**
Constructor for the Shell Network1 Commands library.
Install the handlers for Network1 UEFI Shell 2.0 profile commands.
@param ImageHandle The image handle of the process.
@param SystemTable The EFI System Table pointer.
@retval EFI_SUCCESS The shell command handlers were installed sucessfully.
@retval EFI_UNSUPPORTED The shell level required was not found.
**/
EFI_STATUS
EFIAPI
ShellNetwork1CommandsLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
gShellNetwork1HiiHandle = NULL;
//
// check our bit of the profiles mask
//
if ((PcdGet8(PcdShellProfileMask) & BIT3) == 0) {
return (EFI_UNSUPPORTED);
}
gShellNetwork1HiiHandle = HiiAddPackages (&gShellNetwork1HiiGuid, gImageHandle, UefiShellNetwork1CommandsLibStrings, NULL);
if (gShellNetwork1HiiHandle == NULL) {
return (EFI_DEVICE_ERROR);
}
//
// install our shell command handlers
//
ShellCommandRegisterCommandName(L"ping", ShellCommandRunPing , ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE , gShellNetwork1HiiHandle, STRING_TOKEN(STR_GET_HELP_PING));
ShellCommandRegisterCommandName(L"ifconfig",ShellCommandRunIfconfig , ShellCommandGetManFileNameNetwork1, 0, L"network1", TRUE , gShellNetwork1HiiHandle, STRING_TOKEN(STR_GET_HELP_IFCONFIG));
return (EFI_SUCCESS);
}
/**
Destructor for the library. free any resources.
@param ImageHandle The image handle of the process.
@param SystemTable The EFI System Table pointer.
**/
EFI_STATUS
EFIAPI
ShellNetwork1CommandsLibDestructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
if (gShellNetwork1HiiHandle != NULL) {
HiiRemovePackages(gShellNetwork1HiiHandle);
}
return (EFI_SUCCESS);
}

View File

@ -0,0 +1,79 @@
/** @file
header file for NULL named library for network1 shell command functions.
Copyright (c) 2010 - 2011, 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.
**/
#if !defined (_UEFI_SHELL_NETWORK1_COMMANDS_LIB_H_)
#define _UEFI_SHELL_NETWORK1_COMMANDS_LIB_H_
#include <Uefi.h>
#include <ShellBase.h>
#include <Protocol/Cpu.h>
#include <Protocol/ServiceBinding.h>
#include <Protocol/Ip6.h>
#include <Protocol/Ip6Config.h>
#include <Protocol/Ip4.h>
#include <Protocol/Ip4Config.h>
#include <Protocol/HiiConfigAccess.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/Arp.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/PcdLib.h>
#include <Library/ShellCommandLib.h>
#include <Library/ShellLib.h>
#include <Library/SortLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/HiiLib.h>
#include <Library/NetLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PrintLib.h>
#include <Guid/NicIp4ConfigNvData.h>
extern EFI_HANDLE gShellNetwork1HiiHandle;
/**
Function for 'ping' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunPing (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
/**
Function for 'ifconfig' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
SHELL_STATUS
EFIAPI
ShellCommandRunIfconfig (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
);
#endif

View File

@ -0,0 +1,75 @@
## @file
# Provides shell network1 functions
#
# Copyright (c) 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.
#
#
##
[Defines]
INF_VERSION = 0x00010006
BASE_NAME = UefiShellNetwork1CommandsLib
FILE_GUID = 9A929F7E-3861-45ce-87AB-7371219AE255
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER
CONSTRUCTOR = ShellNetwork1CommandsLibConstructor
DESTRUCTOR = ShellNetwork1CommandsLibDestructor
[Sources.common]
UefiShellNetwork1CommandsLib.uni
UefiShellNetwork1CommandsLib.c
UefiShellNetwork1CommandsLib.h
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
MdeModulePkg/MdeModulePkg.dec
[LibraryClasses]
MemoryAllocationLib
BaseLib
BaseMemoryLib
DebugLib
ShellCommandLib
ShellLib
UefiLib
UefiRuntimeServicesTableLib
UefiBootServicesTableLib
PcdLib
HiiLib
FileHandleLib
NetLib
[Guids]
[Pcd]
gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask # ALWAYS_CONSUMED
[Protocols]
gEfiCpuArchProtocolGuid # ALWAYS_CONSUMED
gEfiIp6ProtocolGuid # SOMETIMES_CONSUMED
gEfiIp6ServiceBindingProtocolGuid # SOMETIMES_CONSUMED
gEfiIp6ConfigProtocolGuid # SOMETIMES_CONSUMED
gEfiIp6ProtocolGuid # SOMETIMES_CONSUMED
gEfiIp6ServiceBindingProtocolGuid # SOMETIMES_CONSUMED
gEfiIp6ConfigProtocolGuid # SOMETIMES_CONSUMED

View File

@ -0,0 +1,28 @@
/** @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 ();
}