11 modified files
reactos/ntoskrnl/mm
diff -u -r1.26 -r1.27
--- iospace.c 10 Apr 2004 22:35:25 -0000 1.26
+++ iospace.c 15 May 2004 22:45:49 -0000 1.27
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: iospace.c,v 1.26 2004/04/10 22:35:25 gdalsnes Exp $
+/* $Id: iospace.c,v 1.27 2004/05/15 22:45:49 hbirr Exp $
*
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/mm/iospace.c
@@ -52,7 +52,7 @@
* Number of bytes to map;
*
* CacheEnable
- * TRUE if the range can be cached.
+ * Type of memory caching.
*
* RETURN VALUE
* The base virtual address which maps the region.
@@ -68,9 +68,10 @@
PVOID STDCALL
MmMapIoSpace (IN PHYSICAL_ADDRESS PhysicalAddress,
IN ULONG NumberOfBytes,
- IN BOOLEAN CacheEnable)
+ IN MEMORY_CACHING_TYPE CacheEnable)
{
PVOID Result;
+ ULONG Offset;
MEMORY_AREA* marea;
NTSTATUS Status;
ULONG i;
@@ -79,9 +80,20 @@
DPRINT("MmMapIoSpace(%lx, %d, %d)\n", PhysicalAddress, NumberOfBytes, CacheEnable);
+ if (CacheEnable != MmNonCached &&
+ CacheEnable != MmCached &&
+ CacheEnable != MmWriteCombined)
+ {
+ return NULL;
+ }
+
BoundaryAddressMultiple.QuadPart = 0;
- MmLockAddressSpace(MmGetKernelAddressSpace());
Result = NULL;
+ Offset = PhysicalAddress.u.LowPart % PAGE_SIZE;
+ NumberOfBytes += Offset;
+ PhysicalAddress.QuadPart -= Offset;
+
+ MmLockAddressSpace(MmGetKernelAddressSpace());
Status = MmCreateMemoryArea (NULL,
MmGetKernelAddressSpace(),
MEMORY_AREA_IO_MAPPING,
@@ -100,43 +112,23 @@
return (NULL);
}
Attributes = PAGE_EXECUTE_READWRITE | PAGE_SYSTEM;
- if (!CacheEnable)
+ if (CacheEnable != MmCached)
{
Attributes |= (PAGE_NOCACHE | PAGE_WRITETHROUGH);
}
- for (i = 0; (i < (PAGE_ROUND_UP(NumberOfBytes) / PAGE_SIZE)); i++)
+ for (i = 0; i < PAGE_ROUND_UP(NumberOfBytes); i += PAGE_SIZE, PhysicalAddress.QuadPart += PAGE_SIZE)
{
-#if !defined(__GNUC__)
- PHYSICAL_ADDRESS dummyJunkNeeded;
- dummyJunkNeeded.QuadPart = PhysicalAddress.QuadPart + (i * PAGE_SIZE);
-#endif
-
- Status =
- MmCreateVirtualMappingForKernel((char*)Result + (i * PAGE_SIZE),
- Attributes,
-#if defined(__GNUC__)
- (PHYSICAL_ADDRESS)
- (PhysicalAddress.QuadPart +
- (i * PAGE_SIZE))
-#else
- dummyJunkNeeded
-#endif
- );
+ Status = MmCreateVirtualMappingForKernel((char*)Result + i,
+ Attributes,
+ PhysicalAddress);
if (!NT_SUCCESS(Status))
{
DbgPrint("Unable to create virtual mapping\n");
KEBUGCHECK(0);
}
-#if defined(__GNUC__)
- MmMarkPageMapped((PHYSICAL_ADDRESS) (PhysicalAddress.QuadPart +
- (i * PAGE_SIZE)));
-#else
-
- MmMarkPageMapped(dummyJunkNeeded);
-#endif
-
+ MmMarkPageMapped(PhysicalAddress);
}
- return ((PVOID)((char*)Result + PhysicalAddress.QuadPart % PAGE_SIZE));
+ return ((PVOID)((char*)Result + Offset));
}
@@ -168,9 +160,14 @@
MmUnmapIoSpace (IN PVOID BaseAddress,
IN ULONG NumberOfBytes)
{
+ ULONG Offset;
+ Offset = (ULONG_PTR)BaseAddress % PAGE_SIZE;
+ BaseAddress = (PVOID)((PUCHAR)BaseAddress - Offset);
+ NumberOfBytes += Offset;
+
MmLockAddressSpace(MmGetKernelAddressSpace());
MmFreeMemoryArea(MmGetKernelAddressSpace(),
- (PVOID)(((ULONG)BaseAddress / PAGE_SIZE) * PAGE_SIZE),
+ BaseAddress,
NumberOfBytes,
NULL,
NULL);
reactos/apps/utils/pice/module
diff -u -r1.4 -r1.5
--- hercules.c 14 Jan 2002 22:04:08 -0000 1.4
+++ hercules.c 15 May 2004 22:45:50 -0000 1.5
@@ -441,7 +441,7 @@
attr.u.Asuchar = 0x07;
FrameBuffer.u.LowPart = 0xb0000;
- pScreenBufferHercules=MmMapIoSpace(FrameBuffer,FRAMEBUFFER_SIZE,FALSE);
+ pScreenBufferHercules=MmMapIoSpace(FrameBuffer,FRAMEBUFFER_SIZE,MmNonCached);
DPRINT((0,"VGA memory phys. 0xb0000 mapped to virt. 0x%x\n",pScreenBufferHercules));
reactos/apps/utils/pice/module
diff -u -r1.8 -r1.9
--- vga.c 30 Jun 2002 02:45:44 -0000 1.8
+++ vga.c 15 May 2004 22:45:50 -0000 1.9
@@ -516,11 +516,11 @@
// the real framebuffer
FrameBuffer.u.LowPart = 0xB8000;
- pScreenBufferHardwareVga = MmMapIoSpace(FrameBuffer,SCREEN_BUFFER_SIZE,FALSE);
+ pScreenBufferHardwareVga = MmMapIoSpace(FrameBuffer,SCREEN_BUFFER_SIZE,MmNonCached);
//The real font buffer
FontBuffer.u.LowPart = 0xA0000;
- pFontBufferVga = MmMapIoSpace(FontBuffer,FONTBUFFERSIZE,FALSE);
+ pFontBufferVga = MmMapIoSpace(FontBuffer,FONTBUFFERSIZE,MmNonCached);
// the console
pScreenBufferVga = PICE_malloc(SCREEN_BUFFER_SIZE,NONPAGEDPOOL);
reactos/drivers/bus/acpi/ospm
diff -u -r1.7 -r1.8
--- osl.c 14 Nov 2003 17:13:23 -0000 1.7
+++ osl.c 15 May 2004 22:45:50 -0000 1.8
@@ -148,7 +148,7 @@
}
Address.QuadPart = (ULONG)phys;
- *virt = MmMapIoSpace(Address, size, FALSE);
+ *virt = MmMapIoSpace(Address, size, MmNonCached);
if (!*virt)
return AE_ERROR;
reactos/drivers/dd/blue
diff -u -r1.45 -r1.46
--- blue.c 10 May 2004 18:02:19 -0000 1.45
+++ blue.c 15 May 2004 22:45:50 -0000 1.46
@@ -1,4 +1,4 @@
-/* $Id: blue.c,v 1.45 2004/05/10 18:02:19 gvg Exp $
+/* $Id: blue.c,v 1.46 2004/05/15 22:45:50 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -129,7 +129,7 @@
/* get pointer to video memory */
BaseAddress.QuadPart = VIDMEM_BASE;
DeviceExtension->VideoMemory =
- (PBYTE)MmMapIoSpace (BaseAddress, DeviceExtension->Rows * DeviceExtension->Columns * 2, FALSE);
+ (PBYTE)MmMapIoSpace (BaseAddress, DeviceExtension->Rows * DeviceExtension->Columns * 2, MmNonCached);
DeviceExtension->CursorSize = 5; /* FIXME: value correct?? */
DeviceExtension->CursorVisible = TRUE;
reactos/drivers/dd/bootvid
diff -u -r1.7 -r1.8
--- bootvid.c 4 Mar 2004 18:55:08 -0000 1.7
+++ bootvid.c 15 May 2004 22:45:50 -0000 1.8
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id: bootvid.c,v 1.7 2004/03/04 18:55:08 navaraf Exp $
+ * $Id: bootvid.c,v 1.8 2004/05/15 22:45:50 hbirr Exp $
*/
/* INCLUDES ******************************************************************/
@@ -123,7 +123,7 @@
PHYSICAL_ADDRESS PhysicalAddress;
PhysicalAddress.QuadPart = 0xA0000;
- VideoMemory = MmMapIoSpace(PhysicalAddress, 0x10000, FALSE);
+ VideoMemory = MmMapIoSpace(PhysicalAddress, 0x10000, MmNonCached);
return VideoMemory != NULL;
}
reactos/drivers/net/ndis/ndis
diff -u -r1.15 -r1.16
--- io.c 21 Feb 2004 12:58:49 -0000 1.15
+++ io.c 15 May 2004 22:45:50 -0000 1.16
@@ -714,7 +714,7 @@
PAGED_CODE();
ASSERT(VirtualAddress && MiniportAdapterHandle);
- *VirtualAddress = MmMapIoSpace(PhysicalAddress, Length, FALSE);
+ *VirtualAddress = MmMapIoSpace(PhysicalAddress, Length, MmNonCached);
if(!*VirtualAddress)
return NDIS_STATUS_RESOURCES;
@@ -887,7 +887,7 @@
NDIS_DbgPrint(MAX_TRACE, ("calling MmMapIoSpace\n"));
*PortOffset = 0;
- *PortOffset = MmMapIoSpace(TranslatedAddress, NumberOfPorts, 0);
+ *PortOffset = MmMapIoSpace(TranslatedAddress, NumberOfPorts, MmNonCached);
NDIS_DbgPrint(MAX_TRACE, ("Returning 0x%x for port range\n", *PortOffset));
if(!*PortOffset)
reactos/drivers/storage/scsiport
diff -u -r1.55 -r1.56
--- scsiport.c 23 Apr 2004 14:29:07 -0000 1.55
+++ scsiport.c 15 May 2004 22:45:50 -0000 1.56
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: scsiport.c,v 1.55 2004/04/23 14:29:07 hbirr Exp $
+/* $Id: scsiport.c,v 1.56 2004/05/15 22:45:50 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -346,7 +346,7 @@
MappedAddress = MmMapIoSpace(TranslatedAddress,
NumberOfBytes,
- FALSE);
+ MmNonCached);
DeviceBase = ExAllocatePool(NonPagedPool,
sizeof(SCSI_PORT_DEVICE_BASE));
reactos/drivers/video/videoprt
diff -u -r1.2 -r1.3
--- resource.c 19 Mar 2004 20:58:32 -0000 1.2
+++ resource.c 15 May 2004 22:45:51 -0000 1.3
@@ -18,7 +18,7 @@
* If not, write to the Free Software Foundation,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * $Id: resource.c,v 1.2 2004/03/19 20:58:32 navaraf Exp $
+ * $Id: resource.c,v 1.3 2004/05/15 22:45:51 hbirr Exp $
*/
#include "videoprt.h"
@@ -99,7 +99,7 @@
MappedAddress = MmMapIoSpace(
TranslatedAddress,
NumberOfUchars,
- FALSE);
+ MmNonCached);
if (MappedAddress)
{
reactos/hal/halx86
diff -u -r1.7 -r1.8
--- halinit.c 18 Mar 2004 19:58:35 -0000 1.7
+++ halinit.c 15 May 2004 22:45:51 -0000 1.8
@@ -1,4 +1,4 @@
-/* $Id: halinit.c,v 1.7 2004/03/18 19:58:35 dwelch Exp $
+/* $Id: halinit.c,v 1.8 2004/05/15 22:45:51 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@@ -73,7 +73,7 @@
/* Go to blue screen */
HalClearDisplay (0x17); /* grey on blue */
- HalpZeroPageMapping = MmMapIoSpace((LARGE_INTEGER)0LL, PAGE_SIZE, FALSE);
+ HalpZeroPageMapping = MmMapIoSpace((LARGE_INTEGER)0LL, PAGE_SIZE, MmNonCached);
}
return TRUE;
reactos/include/ddk
diff -u -r1.21 -r1.22
--- mmfuncs.h 20 Apr 2004 19:04:11 -0000 1.21
+++ mmfuncs.h 15 May 2004 22:45:51 -0000 1.22
@@ -1,6 +1,6 @@
#ifndef _INCLUDE_DDK_MMFUNCS_H
#define _INCLUDE_DDK_MMFUNCS_H
-/* $Id: mmfuncs.h,v 1.21 2004/04/20 19:04:11 gdalsnes Exp $ */
+/* $Id: mmfuncs.h,v 1.22 2004/05/15 22:45:51 hbirr Exp $ */
/* MEMORY MANAGMENT ******************************************************/
@@ -356,7 +356,7 @@
MmMapIoSpace (
PHYSICAL_ADDRESS PhysicalAddress,
ULONG NumberOfBytes,
- BOOLEAN CacheEnable
+ MEMORY_CACHING_TYPE CacheEnable
);
/*
* FUNCTION: Maps the pages described by a given MDL
CVSspam 0.2.8