VIA:
64-bit fixes. Bumped driver date and patchlevel.
diff --git a/shared-core/via_drv.h b/shared-core/via_drv.h
index f29877c..4eaa8b7 100644
--- a/shared-core/via_drv.h
+++ b/shared-core/via_drv.h
@@ -28,7 +28,7 @@
 
 #define DRIVER_NAME		"via"
 #define DRIVER_DESC		"VIA Unichrome / Pro"
-#define DRIVER_DATE		"20050508"
+#define DRIVER_DATE		"20050523"
 
 #define DRIVER_MAJOR		2
 #define DRIVER_MINOR		6
@@ -36,8 +36,8 @@
 
 #include "via_verifier.h"
 
-#define VIA_PCI_BUF_SIZE 120000
-#define VIA_FIRE_BUF_SIZE  2048
+#define VIA_PCI_BUF_SIZE 60000
+#define VIA_FIRE_BUF_SIZE  1024
 #define VIA_NUM_IRQS 2
 
 
diff --git a/shared-core/via_ds.h b/shared-core/via_ds.h
index e7179d3..be9c7f9 100644
--- a/shared-core/via_ds.h
+++ b/shared-core/via_ds.h
@@ -30,7 +30,7 @@
 
 /* Set Data Structure */
 #define SET_SIZE 5000
-typedef unsigned int ITEM_TYPE;
+typedef unsigned long ITEM_TYPE;
 
 typedef struct {
 	ITEM_TYPE val;
diff --git a/shared-core/via_mm.c b/shared-core/via_mm.c
index cf286b4..c22712f 100644
--- a/shared-core/via_mm.c
+++ b/shared-core/via_mm.c
@@ -144,7 +144,7 @@
 
 	if (i < MAX_CONTEXT) {
 		set_t *set;
-		unsigned int item;
+		ITEM_TYPE item;
 		int retval;
 
 		DRM_DEBUG("find socket %d, context = %d\n", i, context);
@@ -153,7 +153,7 @@
 		set = global_ppriv[i].sets[0];
 		retval = via_setFirst(set, &item);
 		while (retval) {
-			DRM_DEBUG("free video memory 0x%x\n", item);
+			DRM_DEBUG("free video memory 0x%lx\n", item);
 			via_mmFreeMem((PMemBlock) item);
 			retval = via_setNext(set, &item);
 		}
@@ -163,7 +163,7 @@
 		set = global_ppriv[i].sets[1];
 		retval = via_setFirst(set, &item);
 		while (retval) {
-			DRM_DEBUG("free agp memory 0x%x\n", item);
+			DRM_DEBUG("free agp memory 0x%lx\n", item);
 			via_mmFreeMem((PMemBlock) item);
 			retval = via_setNext(set, &item);
 		}
@@ -228,7 +228,7 @@
 	block = via_mmAllocMem(FBHeap, fb.size, 5, 0);
 	if (block) {
 		fb.offset = block->ofs;
-		fb.free = (unsigned int)block;
+		fb.free = (unsigned long)block;
 		if (!add_alloc_set(fb.context, VIDEO, fb.free)) {
 			DRM_DEBUG("adding to allocation set fails\n");
 			via_mmFreeMem((PMemBlock) fb.free);
@@ -265,7 +265,7 @@
 	block = via_mmAllocMem(AgpHeap, agp.size, 5, 0);
 	if (block) {
 		agp.offset = block->ofs;
-		agp.free = (unsigned int)block;
+		agp.free = (unsigned long)block;
 		if (!add_alloc_set(agp.context, AGP, agp.free)) {
 			DRM_DEBUG("adding to allocation set fails\n");
 			via_mmFreeMem((PMemBlock) agp.free);
@@ -329,7 +329,7 @@
 		retval = -1;
 	}
 
-	DRM_DEBUG("free fb, free = %d\n", fb.free);
+	DRM_DEBUG("free fb, free = %ld\n", fb.free);
 
 	return retval;
 }
@@ -352,7 +352,7 @@
 		retval = -1;
 	}
 
-	DRM_DEBUG("free agp, free = %d\n", agp.free);
+	DRM_DEBUG("free agp, free = %ld\n", agp.free);
 
 	return retval;
 }
diff --git a/shared-core/via_mm.h b/shared-core/via_mm.h
index 38d591a..d57efda 100644
--- a/shared-core/via_mm.h
+++ b/shared-core/via_mm.h
@@ -28,7 +28,7 @@
 	unsigned int context;
 	unsigned int size;
 	unsigned long offset;
-	unsigned int free;
+	unsigned long free;
 } drm_via_mm_t;
 
 typedef struct {
diff --git a/shared/via.h b/shared/via.h
index 9a21e89..ae69f65 100644
--- a/shared/via.h
+++ b/shared/via.h
@@ -30,7 +30,7 @@
 
 #define DRIVER_NAME		"via"
 #define DRIVER_DESC		"VIA Unichrome / Pro"
-#define DRIVER_DATE		"20050508"
+#define DRIVER_DATE		"20050523"
 
 #define DRIVER_MAJOR		2
 #define DRIVER_MINOR		6
diff --git a/shared/via_drv.h b/shared/via_drv.h
index 8227b73..18c6da7 100644
--- a/shared/via_drv.h
+++ b/shared/via_drv.h
@@ -27,8 +27,8 @@
 #include "via_drm.h"
 #include "via_verifier.h"
 
-#define VIA_PCI_BUF_SIZE 120000
-#define VIA_FIRE_BUF_SIZE  2048
+#define VIA_PCI_BUF_SIZE 60000
+#define VIA_FIRE_BUF_SIZE  1024
 #define VIA_NUM_IRQS 2
 
 
diff --git a/shared/via_ds.h b/shared/via_ds.h
index cdcb645..f9e0b95 100644
--- a/shared/via_ds.h
+++ b/shared/via_ds.h
@@ -31,7 +31,7 @@
 
 /* Set Data Structure */
 #define SET_SIZE 5000
-typedef unsigned int ITEM_TYPE;
+typedef unsigned long ITEM_TYPE;
 
 typedef struct {
 	ITEM_TYPE val;
diff --git a/shared/via_mm.c b/shared/via_mm.c
index d450cdd..aca9d7d 100644
--- a/shared/via_mm.c
+++ b/shared/via_mm.c
@@ -142,7 +142,7 @@
 
 	if (i < MAX_CONTEXT) {
 		set_t *set;
-		unsigned int item;
+		ITEM_TYPE item;
 		int retval;
 
 		DRM_DEBUG("find socket %d, context = %d\n", i, context);
@@ -151,7 +151,7 @@
 		set = global_ppriv[i].sets[0];
 		retval = via_setFirst(set, &item);
 		while (retval) {
-			DRM_DEBUG("free video memory 0x%x\n", item);
+			DRM_DEBUG("free video memory 0x%lx\n", item);
 			via_mmFreeMem((PMemBlock) item);
 			retval = via_setNext(set, &item);
 		}
@@ -161,7 +161,7 @@
 		set = global_ppriv[i].sets[1];
 		retval = via_setFirst(set, &item);
 		while (retval) {
-			DRM_DEBUG("free agp memory 0x%x\n", item);
+			DRM_DEBUG("free agp memory 0x%lx\n", item);
 			via_mmFreeMem((PMemBlock) item);
 			retval = via_setNext(set, &item);
 		}
@@ -169,6 +169,8 @@
 
 		global_ppriv[i].used = 0;
 	}
+	via_release_futex(dev_priv, context); 
+
 	
 #if defined(__linux__)
 	/* Linux specific until context tracking code gets ported to BSD */
@@ -223,7 +225,7 @@
 	block = via_mmAllocMem(FBHeap, fb.size, 5, 0);
 	if (block) {
 		fb.offset = block->ofs;
-		fb.free = (unsigned int)block;
+		fb.free = (unsigned long)block;
 		if (!add_alloc_set(fb.context, VIDEO, fb.free)) {
 			DRM_DEBUG("adding to allocation set fails\n");
 			via_mmFreeMem((PMemBlock) fb.free);
@@ -260,7 +262,7 @@
 	block = via_mmAllocMem(AgpHeap, agp.size, 5, 0);
 	if (block) {
 		agp.offset = block->ofs;
-		agp.free = (unsigned int)block;
+		agp.free = (unsigned long)block;
 		if (!add_alloc_set(agp.context, AGP, agp.free)) {
 			DRM_DEBUG("adding to allocation set fails\n");
 			via_mmFreeMem((PMemBlock) agp.free);
@@ -324,7 +326,7 @@
 		retval = -1;
 	}
 
-	DRM_DEBUG("free fb, free = %d\n", fb.free);
+	DRM_DEBUG("free fb, free = %ld\n", fb.free);
 
 	return retval;
 }
@@ -347,7 +349,7 @@
 		retval = -1;
 	}
 
-	DRM_DEBUG("free agp, free = %d\n", agp.free);
+	DRM_DEBUG("free agp, free = %ld\n", agp.free);
 
 	return retval;
 }
diff --git a/shared/via_mm.h b/shared/via_mm.h
index ea83a0b..02a7251 100644
--- a/shared/via_mm.h
+++ b/shared/via_mm.h
@@ -28,7 +28,7 @@
 	unsigned int context;
 	unsigned int size;
 	unsigned long offset;
-	unsigned int free;
+	unsigned long free;
 } drm_via_mm_t;
 
 typedef struct {