From b7c51c9cf4864df6aabb99a1ae843becd577237c Mon Sep 17 00:00:00 2001 From: raywu Date: Fri, 15 Jun 2018 00:00:50 +0800 Subject: init. 1AQQW051 --- Core/CPU/x64/MiscLib/Misc.asm | 124 ++++++++++++++++++++++++++++++++++++ Core/CPU/x64/MiscLib/MiscX64Lib.cif | 10 +++ Core/CPU/x64/MiscLib/MiscX64Lib.mak | 74 +++++++++++++++++++++ Core/CPU/x64/MiscLib/MiscX64Lib.sdl | 19 ++++++ 4 files changed, 227 insertions(+) create mode 100644 Core/CPU/x64/MiscLib/Misc.asm create mode 100644 Core/CPU/x64/MiscLib/MiscX64Lib.cif create mode 100644 Core/CPU/x64/MiscLib/MiscX64Lib.mak create mode 100644 Core/CPU/x64/MiscLib/MiscX64Lib.sdl (limited to 'Core/CPU/x64/MiscLib') diff --git a/Core/CPU/x64/MiscLib/Misc.asm b/Core/CPU/x64/MiscLib/Misc.asm new file mode 100644 index 0000000..facdd89 --- /dev/null +++ b/Core/CPU/x64/MiscLib/Misc.asm @@ -0,0 +1,124 @@ +;********************************************************************** +;********************************************************************** +;** ** +;** (C)Copyright 1985-2010, American Megatrends, Inc. ** +;** ** +;** All Rights Reserved. ** +;** ** +;** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +;** ** +;** Phone: (770)-246-8600 ** +;** ** +;********************************************************************** +;********************************************************************** + +;********************************************************************** +; $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/CPU Core/MiscX64Lib/Misc.asm 2 10/04/12 9:17a Davidhsieh $ +; +; $Revision: 2 $ +; +; $Date: 10/04/12 9:17a $ +;********************************************************************** +; Revision History +; ---------------- +; $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/CPU Core/MiscX64Lib/Misc.asm $ +; +; 2 10/04/12 9:17a Davidhsieh +; Add MpMtrrSynchUpEntry and MpMtrrSynchUpExit procedures +; +; 1 5/15/12 5:41a Davidhsieh +; +; 1 5/08/12 6:02a Dukeyeh +; [TAG] EIP89382 +; [Category] Improvement +; [Description] clear direction flag inside Timer callback function. +; [Files] MiscX64Lib.cif +; Misc.asm +; MiscX64Lib.sdl +; MiscX64Lib.mak +; +; 6 1/13/10 2:13p Felixp +; +;********************************************************************** +; +; +; Name: Misc +; +; Description: +; +; +;********************************************************************** + +.code + +ClearDirectionFlag Proc + cld + ret +ClearDirectionFlag endp + +MpMtrrSynchUpEntry PROC PUBLIC + ; + ; Enter no fill cache mode, CD=1(Bit30), NW=0 (Bit29) + ; + mov rax, cr0 + and rax, 0DFFFFFFFh + or rax, 040000000h + mov cr0, rax + ; + ; Flush cache + ; + wbinvd + ; + ; Clear PGE flag Bit 7 + ; + mov rax, cr4 + mov rdx, rax + and rax, 0FFFFFF7Fh + mov cr4, rax + ; + ; Flush all TLBs + ; + mov rax, cr3 + mov cr3, rax + + mov rax, rdx + + ret + +MpMtrrSynchUpEntry ENDP + +MpMtrrSynchUpExit PROC PUBLIC + ; + ; Flush all TLBs the second time + ; + mov rax, cr3 + mov cr3, rax + ; + ; Enable Normal Mode caching CD=NW=0, CD(Bit30), NW(Bit29) + ; + mov rax, cr0 + and rax, 09FFFFFFFh + mov cr0, rax + ; + ; Set PGE Flag in CR4 if set + ; + mov cr4, rcx + ret + +MpMtrrSynchUpExit ENDP + +END + +;********************************************************************** +;********************************************************************** +;** ** +;** (C)Copyright 1985-2010, American Megatrends, Inc. ** +;** ** +;** All Rights Reserved. ** +;** ** +;** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +;** ** +;** Phone: (770)-246-8600 ** +;** ** +;********************************************************************** +;********************************************************************** \ No newline at end of file diff --git a/Core/CPU/x64/MiscLib/MiscX64Lib.cif b/Core/CPU/x64/MiscLib/MiscX64Lib.cif new file mode 100644 index 0000000..c05edf2 --- /dev/null +++ b/Core/CPU/x64/MiscLib/MiscX64Lib.cif @@ -0,0 +1,10 @@ + + name = "MiscX64Lib" + category = ModulePart + LocalRoot = "Core\CPU\x64\MiscLib" + RefName = "MiscX64Lib" +[files] +"Misc.asm" +"MiscX64Lib.sdl" +"MiscX64Lib.mak" + diff --git a/Core/CPU/x64/MiscLib/MiscX64Lib.mak b/Core/CPU/x64/MiscLib/MiscX64Lib.mak new file mode 100644 index 0000000..61e7446 --- /dev/null +++ b/Core/CPU/x64/MiscLib/MiscX64Lib.mak @@ -0,0 +1,74 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2006, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 6145-F Northbelt Pkwy, Norcross, GA 30071 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/CPU Core/MiscX64Lib/MiscX64Lib.mak 1 5/15/12 5:41a Davidhsieh $ +# +# $Revision: 1 $ +# +# $Date: 5/15/12 5:41a $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/Haswell/AMI Cpu PKG/CPU Core/MiscX64Lib/MiscX64Lib.mak $ +# +# 1 5/15/12 5:41a Davidhsieh +# +# 1 5/08/12 6:02a Dukeyeh +# [TAG] EIP89382 +# [Category] Improvement +# [Description] clear direction flag inside Timer callback function. +# [Files] MiscX64Lib.cif +# Misc.asm +# MiscX64Lib.sdl +# MiscX64Lib.mak +# +# 1 10/13/06 8:37p Felixp +# +#********************************************************************** +# +# +# Name: MiscX64Lib.mak +# +# Description: +# +# +#********************************************************************** +MiscX64Lib : $(BUILD_DIR)\MiscX64Lib.mak MiscX64LibBin + +$(BUILD_DIR)\MiscX64Lib.mak : $(MiscX64Lib_DIR)\$(@B).cif $(MiscX64Lib_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(MiscX64Lib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +!IF "$(PROCESSOR)"=="x64" +AmiDxeLibBin : $(BUILD_DIR)\MiscX64Lib.lib +$(BUILD_DIR)\MiscX64Lib.lib : MiscX64Lib +!ENDIF + +MiscX64LibBin : + $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\ + /f $(BUILD_DIR)\MiscX64Lib.mak all\ + TYPE=LIBRARY +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2006, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 6145-F Northbelt Pkwy, Norcross, GA 30071 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** \ No newline at end of file diff --git a/Core/CPU/x64/MiscLib/MiscX64Lib.sdl b/Core/CPU/x64/MiscLib/MiscX64Lib.sdl new file mode 100644 index 0000000..a9c676e --- /dev/null +++ b/Core/CPU/x64/MiscLib/MiscX64Lib.sdl @@ -0,0 +1,19 @@ +TOKEN + Name = "MiscX64Lib_SUPPORT" + Value = "1" + Help = "Main switch to enable MiscX64Lib support in Project" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes +End + +PATH + Name = "MiscX64Lib_DIR" +End + +MODULE + Help = "Includes MiscX64Lib.mak to Project" + File = "MiscX64Lib.mak" +End + -- cgit v1.2.3