]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Library/EdkDxeSalLib/Ipf/AsmIpfCpuCache.s
Updated the Runtime Driver to use the MDE libs for cache flush and removed local...
[mirror_edk2.git] / EdkModulePkg / Library / EdkDxeSalLib / Ipf / AsmIpfCpuCache.s
1 //++
2 // Copyright (c) 2006, Intel Corporation
3 // All rights reserved. This program and the accompanying materials
4 // are licensed and made available under the terms and conditions of the BSD License
5 // which accompanies this distribution. The full text of the license may be found at
6 // http://opensource.org/licenses/bsd-license.php
7 //
8 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10 //
11 // Module Name:
12 //
13 // IpfCpuCache.s
14 //
15 // Abstract:
16 //
17 // Contains Misc assembly procedures to support IPF CPU AP.
18 //
19 // Revision History:
20 //
21 //--
22
23 .file "IpfCpuCache.s"
24
25 #include "IpfMacro.i"
26 #include "IpfDefines.h"
27
28 //-----------------------------------------------------------------------------
29 //++
30 // Flush Cache
31 //
32 // Arguments :
33
34 // Input = in0 = Starting Address to Flush.
35 // Input = in1 = Length in bytes.
36 // Input = b0 = return branch register.
37 // On Entry :
38 //
39 // Return Value:
40 //
41 // VOID
42 // SalFlushCache (
43 // IN UINT64 BaseToFlush,
44 // IN UINT64 LengthToFlush
45 // );
46 //
47 //--
48 //---------------------------------------------------------------------------
49 PROCEDURE_ENTRY (SalFlushCache)
50
51 NESTED_SETUP (5,8,0,0)
52
53 mov loc2 = ar.lc
54
55 mov loc3 = in0 // Start address.
56 mov loc4 = in1;; // Length in bytes.
57
58 cmp.eq p6,p7 = loc4, r0;; // If Length is zero then don't flush any cache
59 (p6) br.spnt.many DoneFlushingC;;
60
61 add loc4 = loc4,loc3
62 mov loc5 = 1;;
63 sub loc4 = loc4, loc5 ;; // the End address to flush
64
65 dep loc3 = r0,loc3,0,5
66 dep loc4 = r0,loc4,0,5;;
67 shr loc3 = loc3,5
68 shr loc4 = loc4,5;; // 32 byte cache line
69
70 sub loc4 = loc4,loc3;; // total flush count, It should be add 1 but
71 // the br.cloop will first execute one time
72 mov loc3 = in0
73 mov loc5 = 32
74 mov ar.lc = loc4;;
75
76 StillFlushingC:
77 fc loc3;;
78 sync.i;;
79 srlz.i;;
80 add loc3 = loc5,loc3;;
81 br.cloop.sptk.few StillFlushingC;;
82
83 DoneFlushingC:
84 mov ar.lc = loc2
85 NESTED_RETURN
86
87 PROCEDURE_EXIT (SalFlushCache)
88