From 878ddf1fc3540a715f63594ed22b6929e881afb4 Mon Sep 17 00:00:00 2001 From: bbahnsen Date: Fri, 21 Apr 2006 22:54:32 +0000 Subject: Initial import. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3 6f19259b-4bc3-4df7-8a09-765794883524 --- .../BaseCacheMaintenanceLib.mbd | 30 ++++++ .../BaseCacheMaintenanceLib.msa | 57 +++++++++++ MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c | 85 +++++++++++++++++ .../BaseCacheMaintenanceLib/Ipf/CallPalProc.s | 38 ++++++++ MdePkg/Library/BaseCacheMaintenanceLib/Ipf/Cpu.s | 106 +++++++++++++++++++++ MdePkg/Library/BaseCacheMaintenanceLib/IpfCache.c | 95 ++++++++++++++++++ MdePkg/Library/BaseCacheMaintenanceLib/build.xml | 47 +++++++++ MdePkg/Library/BaseCacheMaintenanceLib/x86Cache.c | 95 ++++++++++++++++++ 8 files changed, 553 insertions(+) create mode 100644 MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.mbd create mode 100644 MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.msa create mode 100644 MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c create mode 100644 MdePkg/Library/BaseCacheMaintenanceLib/Ipf/CallPalProc.s create mode 100644 MdePkg/Library/BaseCacheMaintenanceLib/Ipf/Cpu.s create mode 100644 MdePkg/Library/BaseCacheMaintenanceLib/IpfCache.c create mode 100644 MdePkg/Library/BaseCacheMaintenanceLib/build.xml create mode 100644 MdePkg/Library/BaseCacheMaintenanceLib/x86Cache.c (limited to 'MdePkg/Library/BaseCacheMaintenanceLib') diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.mbd b/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.mbd new file mode 100644 index 0000000000..a0be253d11 --- /dev/null +++ b/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.mbd @@ -0,0 +1,30 @@ + + + + + BaseCacheMaintenanceLib + 123dd843-57c9-4158-8418-ce68b3944ce7 + 0 + FIX ME! + 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. + + 2006-03-09 23:16 + 2006-03-19 15:17 + + diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.msa b/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.msa new file mode 100644 index 0000000000..4fd80ab9bd --- /dev/null +++ b/MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.msa @@ -0,0 +1,57 @@ + + + + + BaseCacheMaintenanceLib + BASE + LIBRARY + 123dd843-57c9-4158-8418-ce68b3944ce7 + 0 + Library Dependencies:BaseLib + FIX ME! + 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. + + 0 + 2006-03-09 23:16 + 2006-03-19 15:17 + + + CacheMaintenanceLib + BaseLib + + + + x86Cache.c + + + x86Cache.c + + + EbcCache.c + + + IpfCache.c + Ipf/Cpu.s + Ipf/CallPalProc.s + + + + MdePkg + + diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c b/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c new file mode 100644 index 0000000000..a7e36236c5 --- /dev/null +++ b/MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c @@ -0,0 +1,85 @@ +/** @file + Cache Maintenance Functions. + + 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. + +**/ + +VOID +EFIAPI +InvalidateInstructionCache ( + VOID + ) +{ +} + +VOID * +EFIAPI +InvalidateInstructionCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + return Address; +} + +VOID +EFIAPI +WriteBackInvalidateDataCache ( + VOID + ) +{ +} + +VOID * +EFIAPI +WriteBackInvalidateDataCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + return Address; +} + +VOID +EFIAPI +WriteBackDataCache ( + VOID + ) +{ +} + +VOID * +EFIAPI +WriteBackDataCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + return Address; +} + +VOID +EFIAPI +InvalidateDataCache ( + VOID + ) +{ +} + +VOID * +EFIAPI +InvalidateDataCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + return Address; +} diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/Ipf/CallPalProc.s b/MdePkg/Library/BaseCacheMaintenanceLib/Ipf/CallPalProc.s new file mode 100644 index 0000000000..18b0f5815a --- /dev/null +++ b/MdePkg/Library/BaseCacheMaintenanceLib/Ipf/CallPalProc.s @@ -0,0 +1,38 @@ +/// @file +/// Contains an implementation of CallPalProcStatic on 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: CallPalProc.s +/// +/// + +.auto +.text + +.proc CallPalProcStatic +.type CallPalProcStatic, @function +CallPalProcStatic:: + mov r9 = ar.k5 + mov r8 = ip + add r8 = (PalProcReturn - CallPalProcStatic), r8 + mov r28 = r32 + mov b7 = r9 + mov r29 = r33 + mov r30 = r34 + mov r31 = r35 + mov r32 = b0 + mov b0 = r8 + br.sptk b7 +PalProcReturn: + mov b0 = r32 + br.ret.sptk.many b0 +.endp CallPalProcStatic diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/Ipf/Cpu.s b/MdePkg/Library/BaseCacheMaintenanceLib/Ipf/Cpu.s new file mode 100644 index 0000000000..4f144c683e --- /dev/null +++ b/MdePkg/Library/BaseCacheMaintenanceLib/Ipf/Cpu.s @@ -0,0 +1,106 @@ +//++ +// 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: +// +// Cpu.s +// +// Abstract: +// +// +// Revision History: +// +//-- + + .file "Cpu.s" + .radix D + .section .text, "ax", "progbits" + .align 32 + .section .pdata, "a", "progbits" + .align 4 + .section .xdata, "a", "progbits" + .align 8 + .section .data, "wa", "progbits" + .align 16 + .section .rdata, "a", "progbits" + .align 16 + .section .bss, "wa", "nobits" + .align 16 + .section .tls$, "was", "progbits" + .align 16 + .section .sdata, "was", "progbits" + .align 16 + .section .sbss, "was", "nobits" + .align 16 + .section .srdata, "as", "progbits" + .align 16 + .section .rdata, "a", "progbits" + .align 16 + .section .rtcode, "ax", "progbits" + .align 32 + .type InvalidateInstructionCacheRange# ,@function + .global InvalidateInstructionCacheRange# +// Function compile flags: /Ogsy + .section .rtcode + +// Begin code for function: InvalidateInstructionCacheRange: + .proc InvalidateInstructionCacheRange# + .align 32 +InvalidateInstructionCacheRange: +// File e:\tmp\pioflush.c + { .mii //R-Addr: 0X00 + alloc r3=2, 0, 0, 0 //11, 00000002H + cmp4.leu p0,p6=32, r33;; //15, 00000020H + (p6) mov r33=32;; //16, 00000020H + } + { .mii //R-Addr: 0X010 + nop.m 0 + zxt4 r29=r33;; //21 + dep.z r30=r29, 0, 5;; //21, 00000005H + } + { .mii //R-Addr: 0X020 + cmp4.eq p0,p7=r0, r30 //21 + shr.u r28=r29, 5;; //19, 00000005H + (p7) adds r28=1, r28;; //22, 00000001H + } + { .mii //R-Addr: 0X030 + nop.m 0 + shl r27=r28, 5;; //25, 00000005H + zxt4 r26=r27;; //25 + } + { .mfb //R-Addr: 0X040 + add r31=r26, r32 //25 + nop.f 0 + nop.b 0 + } +$L143: + { .mii //R-Addr: 0X050 + fc r32 //27 + adds r32=32, r32;; //28, 00000020H + cmp.ltu p14,p15=r32, r31 //29 + } + { .mfb //R-Addr: 0X060 + nop.m 0 + nop.f 0 + (p14) br.cond.dptk.few $L143#;; //29, 880000/120000 + } + { .mmi + sync.i;; + srlz.i + nop.i 0;; + } + { .mfb //R-Addr: 0X070 + nop.m 0 + nop.f 0 + br.ret.sptk.few b0;; //31 + } +// End code for function: + .endp InvalidateInstructionCacheRange# +// END diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/IpfCache.c b/MdePkg/Library/BaseCacheMaintenanceLib/IpfCache.c new file mode 100644 index 0000000000..b0d017bd7a --- /dev/null +++ b/MdePkg/Library/BaseCacheMaintenanceLib/IpfCache.c @@ -0,0 +1,95 @@ +/** @file + Cache Maintenance Functions. + + 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. + +**/ + +typedef struct { + UINT64 Status; + UINT64 r9; + UINT64 r10; + UINT64 r11; +} PAL_PROC_RETURN; + +PAL_PROC_RETURN +CallPalProcStatic ( + IN UINT64 Arg1, + IN UINT64 Arg2, + IN UINT64 Arg3, + IN UINT64 Arg4 + ); + +VOID +EFIAPI +InvalidateInstructionCache ( + VOID + ) +{ + CallPalProcStatic (1, 1, 1, 0); +} + +VOID +EFIAPI +WriteBackInvalidateDataCache ( + VOID + ) +{ + CallPalProcStatic (1, 2, 1, 0); +} + +VOID * +EFIAPI +WriteBackInvalidateDataCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + WriteBackInvalidateDataCache (); + return Address; +} + +VOID +EFIAPI +WriteBackDataCache ( + VOID + ) +{ + CallPalProcStatic (1, 2, 0, 0); +} + +VOID * +EFIAPI +WriteBackDataCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + WriteBackDataCache (); + return Address; +} + +VOID +EFIAPI +InvalidateDataCache ( + VOID + ) +{ +} + +VOID * +EFIAPI +InvalidateDataCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + return Address; +} diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/build.xml b/MdePkg/Library/BaseCacheMaintenanceLib/build.xml new file mode 100644 index 0000000000..0df03c4356 --- /dev/null +++ b/MdePkg/Library/BaseCacheMaintenanceLib/build.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MdePkg/Library/BaseCacheMaintenanceLib/x86Cache.c b/MdePkg/Library/BaseCacheMaintenanceLib/x86Cache.c new file mode 100644 index 0000000000..f86d9d6221 --- /dev/null +++ b/MdePkg/Library/BaseCacheMaintenanceLib/x86Cache.c @@ -0,0 +1,95 @@ +/** @file + Cache Maintenance Functions. + + 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: x86Cache.c + +**/ + +VOID +EFIAPI +InvalidateInstructionCache ( + VOID + ) +{ + return; +} + +VOID * +EFIAPI +InvalidateInstructionCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + return Address; +} + +VOID +EFIAPI +WriteBackInvalidateDataCache ( + VOID + ) +{ + AsmWbinvd (); +} + +VOID * +EFIAPI +WriteBackInvalidateDataCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + if (Length != 0) { + AsmWbinvd (); + } + return Address; +} + +VOID +EFIAPI +WriteBackDataCache ( + VOID + ) +{ + AsmWbinvd (); +} + +VOID * +EFIAPI +WriteBackDataCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + AsmWbinvd (); + return Address; +} + +VOID +EFIAPI +InvalidateDataCache ( + VOID + ) +{ + AsmInvd (); +} + +VOID * +EFIAPI +InvalidateDataCacheRange ( + IN VOID *Address, + IN UINTN Length + ) +{ + return Address; +} -- cgit v1.2.3