[Prism54-devel] sparc64 patch

Clint Adams schizo@debian.org
Sat, 17 Jan 2004 11:24:45 -0500


Since sparc64 uses 64-bit pointers, I used this patch to deal with
Bug#39.  Obviously, doing this unconditionally will break 32-bit kernels.

diff -ur prism54-cvs-latest/ksrc/islpci_dev.c prism54-64/ksrc/islpci_dev.c
--- prism54-cvs-latest/ksrc/islpci_dev.c	2004-01-17 09:13:13.000000000 -0500
+++ prism54-64/ksrc/islpci_dev.c	2004-01-17 10:59:39.401340000 -0500
@@ -533,8 +533,8 @@
 
 		/* configure the queue entry at the beginning of the memory block */
 		pointerq = &priv->_queue_slots[counter];
-		pointerq->host_address = (u32) queue_base_addr;
-		pointerq->dev_address = (u32) queue_bus_addr;
+		pointerq->host_address = (u64) queue_base_addr;
+		pointerq->dev_address = (u64) queue_bus_addr;
 		pointerq->size = MGMT_FRAME_SIZE;
 		pointerq->fragments = 1;
 
diff -ur prism54-cvs-latest/ksrc/islpci_dev.h prism54-64/ksrc/islpci_dev.h
--- prism54-cvs-latest/ksrc/islpci_dev.h	2004-01-17 09:13:13.000000000 -0500
+++ prism54-64/ksrc/islpci_dev.h	2004-01-17 10:57:10.219542000 -0500
@@ -45,8 +45,8 @@
 
 typedef struct {
 	struct list_head _list;
-	u32 host_address;	/* mem address for the host */
-	u32 dev_address;	/* mem address for the device */
+	u64 host_address;	/* mem address for the host */
+	u64 dev_address;	/* mem address for the device */
 	u16 size;		/* size of memory block or queue */
 	u16 fragments;		/* nr of fragments in data part */
 } islpci_qentry_t;
diff -ur prism54-cvs-latest/ksrc/islpci_eth.c prism54-64/ksrc/islpci_eth.c
--- prism54-cvs-latest/ksrc/islpci_eth.c	2004-01-13 15:46:42.000000000 -0500
+++ prism54-64/ksrc/islpci_eth.c	2004-01-17 10:53:47.267098000 -0500
@@ -139,9 +139,9 @@
 	/* Check alignment and WDS frame formatting. The start of the packet should
 	 * be aligned on a 4-byte boundary. If WDS is enabled add another 6 bytes
 	 * and add WDS address information */
-	if (((int) skb->data & 0x03) | init_wds) {
+	if (((u64) skb->data & 0x03) | init_wds) {
 		/* get the number of bytes to add and re-allign */
-		offset = (4 - (int) skb->data) & 0x03;
+		offset = (4 - (u64) skb->data) & 0x03;
 		offset += init_wds ? 6 : 0;
 
 		/* check whether the current skb can be used  */
@@ -154,7 +154,7 @@
 #endif
 
 			/* align the buffer on 4-byte boundary */
-			skb_reserve(skb, (4 - (int) skb->data) & 0x03);
+			skb_reserve(skb, (4 - (u64) skb->data) & 0x03);
 			if (init_wds) {
 				/* wds requires an additional address field of 6 bytes */
 				skb_put(skb, 6);
@@ -174,7 +174,7 @@
 		} else {
 			newskb =
 			    dev_alloc_skb(init_wds ? skb->len + 6 : skb->len);
-			newskb_offset = (4 - (int) newskb->data) & 0x03;
+			newskb_offset = (4 - (u64) newskb->data) & 0x03;
 
 			/* Check if newskb->data is aligned */
 			if (newskb_offset)
@@ -291,7 +291,7 @@
 	size = le16_to_cpu(control_block->rx_data_low[index].size);
 	skb = priv->data_low_rx[index];
 	offset = ((u32) le32_to_cpu(control_block->rx_data_low[index].address) -
-		  (u32) skb->data) & 3;
+		  (u64) skb->data) & 3;
 
 #if VERBOSE > SHOW_ERROR_MESSAGES
 	DEBUG(SHOW_TRACING,
diff -ur prism54-cvs-latest/ksrc/islpci_mgt.c prism54-64/ksrc/islpci_mgt.c
--- prism54-cvs-latest/ksrc/islpci_mgt.c	2004-01-12 17:16:32.000000000 -0500
+++ prism54-64/ksrc/islpci_mgt.c	2004-01-17 10:58:08.740247000 -0500
@@ -424,7 +424,7 @@
 		 int flags, void *data, int length, int use_tunnel_oid)
 {
 	int fragments, counter;
-	u32 source, destination;
+	u64 source, destination;
 	islpci_qentry_t *entry;
 
 #if VERBOSE > SHOW_ERROR_MESSAGES
@@ -466,7 +466,7 @@
 		return -1;
 	}
 	/* queue the frame(s) in the transmit shadow queue */
-	for (counter = 0, source = (u32) data; counter < fragments; counter++) {
+	for (counter = 0, source = (u64) data; counter < fragments; counter++) {
 		u16 fragment_size = 0;
 
 		/* get an entry from the free queue for hosting the frame */