mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 08:04:07 +02:00
Add support for the GetTimerValue() to the CPU AP for NT32. This also requires some performance counter APIs to be added to the WinNtThunk Protocol.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11403 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
975e881570
commit
831ff057d7
@ -1,6 +1,6 @@
|
|||||||
/**@file
|
/**@file
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
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
|
||||||
@ -25,6 +25,7 @@ Abstract:
|
|||||||
|
|
||||||
#include "CpuDriver.h"
|
#include "CpuDriver.h"
|
||||||
|
|
||||||
|
UINT64 mTimerPeriod;
|
||||||
|
|
||||||
CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
|
CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
|
||||||
CPU_ARCH_PROT_PRIVATE_SIGNATURE,
|
CPU_ARCH_PROT_PRIVATE_SIGNATURE,
|
||||||
@ -38,7 +39,7 @@ CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
|
|||||||
WinNtRegisterInterruptHandler,
|
WinNtRegisterInterruptHandler,
|
||||||
WinNtGetTimerValue,
|
WinNtGetTimerValue,
|
||||||
WinNtSetMemoryAttributes,
|
WinNtSetMemoryAttributes,
|
||||||
0,
|
1,
|
||||||
4
|
4
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -321,11 +322,18 @@ Returns:
|
|||||||
if (TimerValue == NULL) {
|
if (TimerValue == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
if (TimerIndex != 0) {
|
||||||
// No timer supported
|
return EFI_INVALID_PARAMETER;
|
||||||
//
|
}
|
||||||
return EFI_UNSUPPORTED;
|
|
||||||
|
gWinNt->QueryPerformanceCounter (TimerValue);
|
||||||
|
|
||||||
|
if (TimerPeriod != NULL) {
|
||||||
|
*TimerPeriod = mTimerPeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -518,8 +526,19 @@ Returns:
|
|||||||
|
|
||||||
--*/
|
--*/
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
UINT64 Frequency;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve the frequency of the performance counter in Hz.
|
||||||
|
//
|
||||||
|
gWinNt->QueryPerformanceFrequency (&Frequency);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Convert frequency in Hz to a clock period in femtoseconds.
|
||||||
|
//
|
||||||
|
mTimerPeriod = DivU64x64Remainder (1000000000000000, Frequency, NULL);
|
||||||
|
|
||||||
CpuUpdateSmbios ();
|
CpuUpdateSmbios ();
|
||||||
|
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**@file
|
/**@file
|
||||||
|
|
||||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
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
|
||||||
@ -39,6 +39,7 @@ Abstract:
|
|||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
#include <Library/WinNtLib.h>
|
||||||
|
|
||||||
|
|
||||||
extern UINT8 CpuStrings[];
|
extern UINT8 CpuStrings[];
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Component description file for Cpu module.
|
# Component description file for Cpu module.
|
||||||
#
|
#
|
||||||
# This CPU module abstracts the interrupt subsystem of a platform and the CPU-specific setjump-long pair.
|
# This CPU module abstracts the interrupt subsystem of a platform and the CPU-specific setjump-long pair.
|
||||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# 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
|
||||||
@ -48,6 +48,7 @@
|
|||||||
UefiDriverEntryPoint
|
UefiDriverEntryPoint
|
||||||
DebugLib
|
DebugLib
|
||||||
HiiLib
|
HiiLib
|
||||||
|
WinNtLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiWinNtIoProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
|
gEfiWinNtIoProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**@file
|
/**@file
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
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
|
||||||
@ -1104,6 +1104,19 @@ BOOL
|
|||||||
(WINAPI *WinNtFreeLibrary) (
|
(WINAPI *WinNtFreeLibrary) (
|
||||||
HANDLE ModHandle
|
HANDLE ModHandle
|
||||||
);
|
);
|
||||||
|
typedef
|
||||||
|
WINBASEAPI
|
||||||
|
BOOL
|
||||||
|
(WINAPI *WinNtQueryPerformanceCounter) (
|
||||||
|
LARGE_INTEGER *PerformanceCount
|
||||||
|
);
|
||||||
|
|
||||||
|
typedef
|
||||||
|
WINBASEAPI
|
||||||
|
BOOL
|
||||||
|
(WINAPI *WinNtQueryPerformanceFrequency) (
|
||||||
|
LARGE_INTEGER *Frequency
|
||||||
|
);
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@ -1269,7 +1282,10 @@ typedef struct {
|
|||||||
WinNtGetProcessHeap GetProcessHeap;
|
WinNtGetProcessHeap GetProcessHeap;
|
||||||
WinNtHeapAlloc HeapAlloc;
|
WinNtHeapAlloc HeapAlloc;
|
||||||
WinNtHeapFree HeapFree;
|
WinNtHeapFree HeapFree;
|
||||||
|
|
||||||
|
WinNtQueryPerformanceCounter QueryPerformanceCounter;
|
||||||
|
WinNtQueryPerformanceFrequency QueryPerformanceFrequency;
|
||||||
|
|
||||||
} EFI_WIN_NT_THUNK_PROTOCOL;
|
} EFI_WIN_NT_THUNK_PROTOCOL;
|
||||||
|
|
||||||
extern EFI_GUID gEfiWinNtThunkProtocolGuid;
|
extern EFI_GUID gEfiWinNtThunkProtocolGuid;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**@file
|
/**@file
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
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
|
||||||
@ -176,7 +176,9 @@ EFI_WIN_NT_THUNK_PROTOCOL mWinNtThunkTable = {
|
|||||||
DispatchMessage,
|
DispatchMessage,
|
||||||
GetProcessHeap,
|
GetProcessHeap,
|
||||||
HeapAlloc,
|
HeapAlloc,
|
||||||
HeapFree
|
HeapFree,
|
||||||
|
QueryPerformanceCounter,
|
||||||
|
QueryPerformanceFrequency
|
||||||
};
|
};
|
||||||
|
|
||||||
#pragma warning(default : 4996)
|
#pragma warning(default : 4996)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user