Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

mimisc.c

Go to the documentation of this file.
00001 /*++ 00002 00003 #include "intelcopy.h" 00004 00005 Module Name: 00006 00007 mimisc.c 00008 00009 Abstract: 00010 00011 This module contains misllaneous IA64 specific memory management routines. 00012 00013 00014 Author: 00015 00016 ky 28-Jun-96 00017 00018 Revision History: 00019 00020 00021 --*/ 00022 00023 #include "mi.h" 00024 00025 00026 00027 // 00028 // memory types 00029 // 00030 00031 typedef enum _MEM_TYPES { 00032 RegularMemory, 00033 MemoryMappedIo, 00034 VideoDisplayBuffer, 00035 IoPort, 00036 RomMemory 00037 } MEM_TYPES; 00038 00039 00040 typedef struct _CACHE_ATTRIBUTE_DESCRIPTOR { 00041 LIST_ENTRY ListEntry; 00042 MEM_TYPES MemTypes; 00043 ULONG CacheAttribute; 00044 PFN_NUMBER BasePage; 00045 PFN_NUMBER PageCount; 00046 } CACHE_ATTRIBUTE_DESCRIPTOR, *PCACHE_ATTRIBUTE_DESCRIPTOR; 00047 00048 00049 LIST_ENTRY MmCacheAttributeDescriptorListHead; 00050 00051 // 00052 // default memory cache attributes set within PTE: 00053 // 00054 00055 ULONG MmDefaultCacheAttribute = MM_PTE_MA_WBU; // cacheable, write-back, unordered 00056 00057 00058 00059 ULONG 00060 MiCheckMemoryAttribute( 00061 IN PFN_NUMBER PageFrameNumber 00062 ) 00063 00064 /*++ 00065 00066 Routine Descrition: 00067 00068 This function examines the physical address which is given 00069 by the physical page frame number, and returns the cache 00070 attributes type for that page. The returned value is used to specify 00071 the MemoryAttribute field in the HARDWARE_PTE structure to map 00072 that page. 00073 00074 This function searches the cache descriptor attribute link 00075 lists to see if the specific cache attribute is defined for 00076 that physical address range. 00077 00078 If the physical address range is not defined in the cache 00079 descriptor attribute link lists, returns the default memory 00080 attribute. 00081 00082 Arguments: 00083 00084 PageFrameIndex - Supplies the physical page frame number to be 00085 examined for the cache attribute. 00086 00087 Return Value: 00088 00089 Returns a cache attribute type for the supplied physical page 00090 frame number. 00091 00092 Environment: 00093 00094 Kernel Mode Only. 00095 00096 --*/ 00097 00098 { 00099 PLIST_ENTRY NextMd; 00100 00101 NextMd = MmCacheAttributeDescriptorListHead.Flink; 00102 00103 While (NextMd != MmCacheAttributeDescriptorListHead) { 00104 00105 CacheAttributeDescriptor = CONTAINING_RECORD(NextMd, 00106 CACHE_ATTRIBUTE_DESCRIPTOR, 00107 ListEntry); 00108 00109 if ((PageFrameNumber >= CacheAttributeDescriptor.BasePage) || 00110 (PageFrameNumber < CacheAttributeDescriptor.PageCount)) { 00111 00112 return (CacheAttributeDescriptor.CacheAttribute); 00113 00114 } 00115 00116 NextMd = CacheAttributeDescriptor->ListEntry.Flink; 00117 } 00118 00119 // 00120 // if the cache memory descriptor is not found, 00121 // return the default cache attribute, MmDefaultCacheAttribute. 00122 // 00123 00124 return (MmDefaultCacheAttribute); 00125 00126 } 00127 00128 00129 00130 // 00131 // MmDisableCache yields 0 if cachable, 1 if uncachable. 00132 // 00133 00134 UCHAR MmDisableCache[16] = {0, 0, 0, 0, 0, 0, 0, 0 00135 1, 1, 0, 1, 0, 1, 0, 0}; 00136 00137 00138 00139 MiDisableCaching( 00140 IN PMMPTE PointerPte; 00141 ) 00142 00143 /*++ 00144 00145 Routine Description: 00146 00147 This macro takes a valid PTE and sets the caching state to be 00148 disabled. 00149 00150 Argments 00151 00152 PTE - Supplies a pointer to the valid PTE. 00153 00154 Return Value: 00155 00156 None. 00157 00158 Environment: 00159 00160 Kernel mode 00161 00162 --*/ 00163 00164 { 00165 ULONG CacheAttribute; 00166 00167 CacheAttribute = MiCheckMemoryAttribute(TempPte.u.Hard.PageFrameNumber); 00168 00169 if (MmDisableCache[CacheAttribute]) { 00170 00171 // 00172 // The returned CacheAttributes indicate uncachable. 00173 // 00174 00175 PointerPte->u.Hard.MemAttribute = CacheAttribute; 00176 00177 } else { 00178 00179 // 00180 // Set the most conservative cache memory attribute, 00181 // UCO (Uncachable, Non-coalescing, Sequential & Non- 00182 // speculative and Ordered. 00183 // 00184 00185 PointerPte->u.Hard.MemAttribute = MM_PTE_MA_UCO; 00186 00187 } 00188 } 00189 00190 00191 00192

Generated on Sat May 15 19:40:48 2004 for test by doxygen 1.3.7