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