Cleanup Cpu library class and CpuLib instance and BaseLib instance; and add comments for the confused logic in IfrSupportLib instance.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5694 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2008-08-20 09:15:34 +00:00
parent 4882bfdc7e
commit a8ff971524
15 changed files with 41 additions and 409 deletions

View File

@ -1,7 +1,7 @@
/** @file
Library that provides processor specific library services
Copyright (c) 2006, Intel Corporation
Copyright (c) 2006 - 2008, 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
@ -29,21 +29,6 @@ CpuSleep (
VOID
);
/**
Requests CPU to pause for a short period of time.
Requests CPU to pause for a short period of time. Typically used in MP
systems to prevent memory starvation while waiting for a spin lock.
**/
VOID
EFIAPI
CpuPause (
VOID
);
/**
Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU.

View File

@ -1,34 +0,0 @@
#------------------------------------------------------------------------------ ;
# Copyright (c) 2006, 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:
#
# CpuSleep.Asm
#
# Abstract:
#
# CpuSleep function
#
# Notes:
#
#------------------------------------------------------------------------------
.globl ASM_PFX(CpuSleep)
#------------------------------------------------------------------------------
# VOID
# EFIAPI
# CpuSleep (
# VOID
# );
#------------------------------------------------------------------------------
ASM_PFX(CpuSleep):
hlt
ret

View File

@ -1,39 +0,0 @@
;------------------------------------------------------------------------------ ;
; Copyright (c) 2006, 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:
;
; CpuSleep.Asm
;
; Abstract:
;
; CpuSleep function
;
; Notes:
;
;------------------------------------------------------------------------------
.386
.model flat,C
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuSleep (
; VOID
; );
;------------------------------------------------------------------------------
CpuSleep PROC
hlt
ret
CpuSleep ENDP
END

View File

@ -1,38 +0,0 @@
/** @file
CpuSleep function.
Copyright (c) 2006 - 2007, Intel Corporation<BR>
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.
**/
//
// Include common header file for this module.
//
/**
Places the CPU in a sleep state until an interrupt is received.
Places the CPU in a sleep state until an interrupt is received. If interrupts
are disabled prior to calling this function, then the CPU will be placed in a
sleep state indefinitely.
**/
VOID
EFIAPI
CpuSleep (
VOID
)
{
_asm {
hlt
}
}

View File

@ -1,34 +0,0 @@
#------------------------------------------------------------------------------ ;
# Copyright (c) 2006, 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:
#
# CpuSleep.S
#
# Abstract:
#
# CpuSleep function
#
# Notes:
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# VOID
# EFIAPI
# CpuSleep (
# VOID
# );
#------------------------------------------------------------------------------
.global ASM_PFX(CpuSleep)
ASM_PFX(CpuSleep):
hlt
ret

View File

@ -1,37 +0,0 @@
;------------------------------------------------------------------------------ ;
; Copyright (c) 2006, 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:
;
; CpuSleep.Asm
;
; Abstract:
;
; CpuSleep function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuSleep (
; VOID
; );
;------------------------------------------------------------------------------
CpuSleep PROC
hlt
ret
CpuSleep ENDP
END

View File

@ -62,7 +62,3 @@
[LibraryClasses.Ipf]
PalCallLib
[Pcd.common]

View File

@ -1,34 +0,0 @@
#------------------------------------------------------------------------------ ;
# Copyright (c) 2006, 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:
#
# CpuPause.Asm
#
# Abstract:
#
# CpuPause function
#
# Notes:
#
#------------------------------------------------------------------------------
.globl ASM_PFX(CpuPause)
#------------------------------------------------------------------------------
# VOID
# EFIAPI
# CpuPause (
# VOID
# );
#------------------------------------------------------------------------------
ASM_PFX(CpuPause):
pause
ret

View File

@ -1,40 +0,0 @@
;------------------------------------------------------------------------------ ;
; Copyright (c) 2006, 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:
;
; CpuPause.Asm
;
; Abstract:
;
; CpuPause function
;
; Notes:
;
;------------------------------------------------------------------------------
.686
.model flat,C
.xmm
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuPause (
; VOID
; );
;------------------------------------------------------------------------------
CpuPause PROC
pause
ret
CpuPause ENDP
END

View File

@ -1,36 +0,0 @@
/** @file
CpuPause function.
Copyright (c) 2006 - 2007, Intel Corporation<BR>
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.
**/
/**
Places the CPU in a pause state until an interrupt is
received.
Places the CPU in a pause state until an interrupt is
received. If interrupts are disabled prior to calling this
function, then the CPU will be placed in a pause state
indefinitely.
**/
VOID
EFIAPI
CpuPause (
VOID
)
{
_asm {
pause
}
}

View File

@ -1,25 +0,0 @@
/// @file
/// CpuPause() function for Itanium-based architecture.
///
/// Copyright (c) 2006, 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: CpuPause.s
///
///
.auto
.text
.proc CpuPause
.type CpuPause, @function
CpuPause::
hint @pause
br.ret.sptk.many b0
.endp

View File

@ -1,34 +0,0 @@
#------------------------------------------------------------------------------ ;
# Copyright (c) 2006, 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:
#
# CpuPause.S
#
# Abstract:
#
# CpuPause function
#
# Notes:
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# VOID
# EFIAPI
# CpuPause (
# VOID
# );
#------------------------------------------------------------------------------
.global ASM_PFX(CpuPause)
ASM_PFX(CpuPause):
pause
ret

View File

@ -1,37 +0,0 @@
;------------------------------------------------------------------------------ ;
; Copyright (c) 2006, 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:
;
; CpuPause.Asm
;
; Abstract:
;
; CpuPause function
;
; Notes:
;
;------------------------------------------------------------------------------
.code
;------------------------------------------------------------------------------
; VOID
; EFIAPI
; CpuPause (
; VOID
; );
;------------------------------------------------------------------------------
CpuPause PROC
pause
ret
CpuPause ENDP
END

View File

@ -119,6 +119,9 @@ InternalHiiLibPreparePackages (
//
for (Index = 0; Index < NumberOfPackages; Index++) {
PackageArray = (UINT8 *) VA_ARG (Marker, VOID *);
//
// CopyMem is used for UINT32 to cover the unaligned address access.
//
CopyMem (&PackageLength, PackageArray, sizeof (UINT32));
PackageLength -= sizeof (UINT32);
PackageArray += sizeof (UINT32);

View File

@ -127,6 +127,9 @@ CreateEndOpCode (
End.Header.Scope = 0;
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_END to cover the unaligned address access.
//
CopyMem (LocalBuffer, &End, sizeof (EFI_IFR_END));
Data->Offset += sizeof (EFI_IFR_END);
@ -174,6 +177,9 @@ CreateDefaultOpCode (
CopyMem (&Default.Value, Value, sizeof(EFI_IFR_TYPE_VALUE));
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_DEFAULT to cover the unaligned address access.
//
CopyMem (LocalBuffer, &Default, sizeof (EFI_IFR_DEFAULT));
Data->Offset += sizeof (EFI_IFR_DEFAULT);
@ -230,6 +236,9 @@ CreateActionOpCode (
Action.QuestionConfig = QuestionConfig;
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_ACTION to cover the unaligned address access.
//
CopyMem (LocalBuffer, &Action, sizeof (EFI_IFR_ACTION));
Data->Offset += sizeof (EFI_IFR_ACTION);
@ -276,6 +285,9 @@ CreateSubTitleOpCode (
Subtitle.Flags = Flags;
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_SUBTITLE to cover the unaligned address access.
//
CopyMem (LocalBuffer, &Subtitle, sizeof (EFI_IFR_SUBTITLE));
Data->Offset += sizeof (EFI_IFR_SUBTITLE);
@ -321,6 +333,9 @@ CreateTextOpCode (
Text.TextTwo = TextTwo;
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_TEXT to cover the unaligned address access.
//
CopyMem (LocalBuffer, &Text, sizeof (EFI_IFR_TEXT));
Data->Offset += sizeof (EFI_IFR_TEXT);
@ -377,6 +392,9 @@ CreateGotoOpCode (
Goto.FormId = FormId;
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_REF to cover the unaligned address access.
//
CopyMem (LocalBuffer, &Goto, sizeof (EFI_IFR_REF));
Data->Offset += sizeof (EFI_IFR_REF);
@ -429,6 +447,9 @@ CreateOneOfOptionOpCode (
OneOfOption.Type = Type;
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_ONF_OF_OPTION to cover the unaligned address access.
//
CopyMem (LocalBuffer, &OneOfOption, sizeof (EFI_IFR_ONE_OF_OPTION));
Data->Offset += sizeof (EFI_IFR_ONE_OF_OPTION);
}
@ -500,6 +521,9 @@ CreateOneOfOpCode (
ZeroMem ((VOID *) &OneOf.data, sizeof (MINMAXSTEP_DATA));
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_ONF_OF to cover the unaligned address access.
//
CopyMem (LocalBuffer, &OneOf, sizeof (EFI_IFR_ONE_OF));
Data->Offset += sizeof (EFI_IFR_ONE_OF);
@ -583,6 +607,9 @@ CreateOrderedListOpCode (
OrderedList.Flags = OrderedListFlags;
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_ORDERED_LIST to cover the unaligned address access.
//
CopyMem (LocalBuffer, &OrderedList, sizeof (EFI_IFR_ORDERED_LIST));
Data->Offset += sizeof (EFI_IFR_ORDERED_LIST);
@ -648,6 +675,9 @@ CreateCheckBoxOpCode (
CheckBox.Flags = CheckBoxFlags;
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_CHECKBOX to cover the unaligned address access.
//
CopyMem (LocalBuffer, &CheckBox, sizeof (EFI_IFR_CHECKBOX));
Data->Offset += sizeof (EFI_IFR_CHECKBOX);
@ -748,6 +778,9 @@ CreateNumericOpCode (
CopyMem (&Numeric.data, &MinMaxStep, sizeof (MINMAXSTEP_DATA));
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_NUMERIC to cover the unaligned address access.
//
CopyMem (LocalBuffer, &Numeric, sizeof (EFI_IFR_NUMERIC));
Data->Offset += sizeof (EFI_IFR_NUMERIC);
@ -823,6 +856,9 @@ CreateStringOpCode (
String.Flags = StringFlags;
LocalBuffer = (UINT8 *) Data->Data + Data->Offset;
//
// CopyMem is used for EFI_IFR_STRING to cover the unaligned address access.
//
CopyMem (LocalBuffer, &String, sizeof (EFI_IFR_STRING));
Data->Offset += sizeof (EFI_IFR_STRING);