]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Library/BaseLib/Ipf/FlushCacheRange.s
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Library / BaseLib / Ipf / FlushCacheRange.s
CommitLineData
2c7e5c2f
HT
1/// Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>\r
2/// This program and the accompanying materials \r
3eb9473e 3/// are licensed and made available under the terms and conditions of the BSD License \r
4/// which accompanies this distribution. The full text of the license may be found at \r
5/// http://opensource.org/licenses/bsd-license.php \r
6/// \r
7/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
8/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
9///\r
10/// Module Name:\r
11///\r
12/// FlushCacheRange.s\r
13///\r
14/// Abstract:\r
15///\r
16///\r
17\r
18.file "IpfCpuCache.s"\r
19\r
20#include "IpfMacro.i"\r
21#include "IpfDefines.h"\r
22\r
23//\r
24// Invalidates a range of instruction cache lines in the cache coherency domain\r
25// of the calling CPU.\r
26//\r
27// Invalidates the instruction cache lines specified by Address and Length. If\r
28// Address is not aligned on a cache line boundary, then entire instruction\r
29// cache line containing Address is invalidated. If Address + Length is not\r
30// aligned on a cache line boundary, then the entire instruction cache line\r
31// containing Address + Length -1 is invalidated. This function may choose to\r
32// invalidate the entire instruction cache if that is more efficient than\r
33// invalidating the specified range. If Length is 0, the no instruction cache\r
9e21d6d0 34// lines are invalidated. Address is returned. \r
35// This function is only available on IPF.\r
3eb9473e 36//\r
37// If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r
38//\r
39// @param Address The base address of the instruction cache lines to\r
40// invalidate. If the CPU is in a physical addressing mode, then\r
41// Address is a physical address. If the CPU is in a virtual\r
42// addressing mode, then Address is a virtual address.\r
43//\r
44// @param Length The number of bytes to invalidate from the instruction cache.\r
45//\r
46// @return Address\r
47// \r
48// VOID *\r
49// EFIAPI\r
9e21d6d0 50// AsmFlushCacheRange (\r
3eb9473e 51// IN VOID *Address,\r
52// IN UINTN Length\r
53// );\r
54//\r
9e21d6d0 55PROCEDURE_ENTRY (AsmFlushCacheRange)\r
3eb9473e 56\r
57 NESTED_SETUP (5,8,0,0)\r
58 \r
59 mov loc2 = ar.lc\r
60 \r
61 mov loc3 = in0 // Start address.\r
62 mov loc4 = in1;; // Length in bytes.\r
63 \r
64 cmp.eq p6,p7 = loc4, r0;; // If Length is zero then don't flush any cache\r
65 (p6) br.spnt.many DoneFlushingC;; \r
66 \r
67 add loc4 = loc4,loc3 \r
68 mov loc5 = 1;;\r
69 sub loc4 = loc4, loc5 ;; // the End address to flush\r
70 \r
71 dep loc3 = r0,loc3,0,5 \r
72 dep loc4 = r0,loc4,0,5;; \r
73 shr loc3 = loc3,5 \r
74 shr loc4 = loc4,5;; // 32 byte cache line\r
75 \r
76 sub loc4 = loc4,loc3;; // total flush count, It should be add 1 but \r
77 // the br.cloop will first execute one time \r
78 mov loc3 = in0 \r
79 mov loc5 = 32 \r
80 mov ar.lc = loc4;;\r
81\r
82StillFlushingC:\r
83 fc loc3;; \r
84 sync.i;;\r
85 srlz.i;;\r
86 add loc3 = loc5,loc3;;\r
87 br.cloop.sptk.few StillFlushingC;;\r
88\r
89DoneFlushingC: \r
90 mov ar.lc = loc2 \r
91 mov r8 = in0 // return *Address\r
92 NESTED_RETURN\r
93\r
9e21d6d0 94PROCEDURE_EXIT (AsmFlushCacheRange)\r
3eb9473e 95\r