[parisc-linux-cvs] 2.4.18-pa3

Thomas Bogendoerfer tsbogend@alpha.franken.de
Mon, 4 Mar 2002 00:12:13 +0100


I've commited some 64 bit cleanups, which let me boot a 64bit kernel
on my C160 and access the mmapped framebuffer without an HPMC.
Unfortunately X won't start up because there are some ioctl wrappers
missing. Also ncr53c8xx has issues with 64bit, but nothing obvious 
(and I know it worked on my Alpha, so maybe it's a big-endian/64 bit
issue).

Thomas.


Index: arch/parisc/kernel/entry.S
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/entry.S,v
retrieving revision 1.89
diff -u -p -r1.89 entry.S
--- arch/parisc/kernel/entry.S	2002/02/23 18:45:35	1.89
+++ arch/parisc/kernel/entry.S	2002/03/03 21:26:11
@@ -1045,6 +1045,8 @@ dtlb_miss_20w:
 	space_to_prot   spc prot        /* create prot id from space */
 	depd            pte,8,7,prot    /* add in prot bits from pte */
 
+	extrd,u,*=      pte,_PAGE_NO_CACHE_BIT+32,1,r0
+	depdi		1,12,1,prot
 	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
 	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
 	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
@@ -1122,6 +1124,8 @@ nadtlb_miss_20w:
 	space_to_prot   spc prot        /* create prot id from space */
 	depd            pte,8,7,prot    /* add in prot bits from pte */
 
+	extrd,u,*=      pte,_PAGE_NO_CACHE_BIT+32,1,r0
+	depdi		1,12,1,prot
 	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
 	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
 	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
@@ -1739,6 +1743,8 @@ dbit_nolock_20w:
 	space_to_prot   spc prot        /* create prot id from space */
 	depd            pte,8,7,prot    /* add in prot bits from pte */
 
+	extrd,u,*=      pte,_PAGE_NO_CACHE_BIT+32,1,r0
+	depdi		1,12,1,prot
 	extrd,u,*=      pte,_PAGE_USER_BIT+32,1,r0
 	depdi		7,11,3,prot   /* Set for user space (1 rsvd for read) */
 	extrd,u,*= 	pte,_PAGE_GATEWAY_BIT+32,1,r0
Index: drivers/char/hilkbd.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/char/hilkbd.c,v
retrieving revision 1.15
diff -u -p -r1.15 hilkbd.c
--- drivers/char/hilkbd.c	2001/12/27 21:54:13	1.15
+++ drivers/char/hilkbd.c	2002/03/02 15:32:45
@@ -35,7 +35,7 @@
 #include <asm/hil.h>
 #include <asm/keyboard.h>
 
-unsigned int hil_base;	/* HPA for the HIL device */
+unsigned long hil_base;	/* HPA for the HIL device */
 unsigned int hil_irq;
 
 #elif defined(CONFIG_HP300)
@@ -450,7 +450,7 @@ hil_init_chip(struct parisc_device *dev)
 	hil_base = dev->hpa;
 	hil_irq  = dev->irq;
 	
-	printk(KERN_INFO "Found HIL at 0x%x, IRQ %d\n", hil_base, hil_irq);
+	printk(KERN_INFO "Found HIL at 0x%lx, IRQ %d\n", hil_base, hil_irq);
 
 	return hil_keyb_init();
 }
Index: drivers/net/lasi_82596.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/net/lasi_82596.c,v
retrieving revision 1.28
diff -u -p -r1.28 lasi_82596.c
--- drivers/net/lasi_82596.c	2002/02/10 03:09:03	1.28
+++ drivers/net/lasi_82596.c	2002/03/03 22:34:10
@@ -145,13 +145,13 @@ static char version[] __devinitdata =
  */
 
 #ifdef __BIG_ENDIAN
-#define WSWAPrfd(x)  ((struct i596_rfd *) (((u32)(x)<<16) | ((((u32)(x)))>>16)))
-#define WSWAPrbd(x)  ((struct i596_rbd *) (((u32)(x)<<16) | ((((u32)(x)))>>16)))
-#define WSWAPiscp(x) ((struct i596_iscp *)(((u32)(x)<<16) | ((((u32)(x)))>>16)))
-#define WSWAPscb(x)  ((struct i596_scb *) (((u32)(x)<<16) | ((((u32)(x)))>>16)))
-#define WSWAPcmd(x)  ((struct i596_cmd *) (((u32)(x)<<16) | ((((u32)(x)))>>16)))
-#define WSWAPtbd(x)  ((struct i596_tbd *) (((u32)(x)<<16) | ((((u32)(x)))>>16)))
-#define WSWAPchar(x) ((char *)            (((u32)(x)<<16) | ((((u32)(x)))>>16)))
+#define WSWAPrfd(x)  (((u32)(x)<<16) | ((((u32)(x)))>>16))
+#define WSWAPrbd(x)  (((u32)(x)<<16) | ((((u32)(x)))>>16))
+#define WSWAPiscp(x) (((u32)(x)<<16) | ((((u32)(x)))>>16))
+#define WSWAPscb(x)  (((u32)(x)<<16) | ((((u32)(x)))>>16))
+#define WSWAPcmd(x)  (((u32)(x)<<16) | ((((u32)(x)))>>16))
+#define WSWAPtbd(x)  (((u32)(x)<<16) | ((((u32)(x)))>>16))
+#define WSWAPchar(x) (((u32)(x)<<16) | ((((u32)(x)))>>16))
 #define ISCP_BUSY	0x00010000
 #define MACH_IS_APRICOT	0
 #else
@@ -196,7 +196,7 @@ static int rx_copybreak = 100;
 #define PKT_BUF_SZ	1536
 #define MAX_MC_CNT	64
 
-#define I596_NULL ((void *)0xffffffff)
+#define I596_NULL ((u32)0xffffffff)
 
 #define CMD_EOL		0x8000	/* The last command of the list, stop. */
 #define CMD_SUSP	0x4000	/* Suspend after doing cmd. */
@@ -231,7 +231,7 @@ enum commands {
 struct i596_reg {
 	unsigned short porthi;
 	unsigned short portlo;
-	unsigned long ca;
+	u32            ca;
 };
 
 #define EOF		0x8000
@@ -240,9 +240,9 @@ struct i596_reg {
 struct i596_tbd {
 	unsigned short size;
 	unsigned short pad;
-	struct i596_tbd *next;
-	char *data;
-	long cache_pad[5];		/* Total 32 bytes... */
+	dma_addr_t     next;
+	dma_addr_t     data;
+	u32 cache_pad[5];		/* Total 32 bytes... */
 };
 
 /* The command structure has two 'next' pointers; v_next is the address of
@@ -259,17 +259,21 @@ struct i596_cmd {
 	struct i596_cmd *v_next;	/* Address from CPUs viewpoint */
 	unsigned short status;
 	unsigned short command;
-	struct i596_cmd *b_next;	/* Address from i596 viewpoint */
+	dma_addr_t     b_next;	/* Address from i596 viewpoint */
 };
 
 struct tx_cmd {
 	struct i596_cmd cmd;
-	struct i596_tbd *tbd;
+	dma_addr_t     tbd;
 	unsigned short size;
 	unsigned short pad;
 	struct sk_buff *skb;		/* So we can free it after tx */
 	dma_addr_t dma_addr;
-	long cache_pad[1];		/* Total 32 bytes... */
+#ifdef __LP64__
+	u32 cache_pad[6];		/* Total 64 bytes... */
+#else    
+	u32 cache_pad[1];		/* Total 32 bytes... */
+#endif    
 };
 
 struct tdr_cmd {
@@ -297,27 +301,34 @@ struct cf_cmd {
 struct i596_rfd {
 	unsigned short stat;
 	unsigned short cmd;
-	struct i596_rfd *b_next;	/* Address from i596 viewpoint */
-	struct i596_rbd *rbd;
+	dma_addr_t     b_next;	/* Address from i596 viewpoint */
+	dma_addr_t     rbd;
 	unsigned short count;
 	unsigned short size;
 	struct i596_rfd *v_next;	/* Address from CPUs viewpoint */
 	struct i596_rfd *v_prev;
-	long cache_pad[2];		/* Total 32 bytes... */
+#ifndef __LP64__    
+	u32 cache_pad[2];		/* Total 32 bytes... */
+#endif    
 };
 
 struct i596_rbd {
+    /* hardware data */
     unsigned short count;
     unsigned short zero1;
-    struct i596_rbd *b_next;
-    unsigned char *b_data;		/* Address from i596 viewpoint */
+    dma_addr_t     b_next;
+    dma_addr_t     b_data;		/* Address from i596 viewpoint */
     unsigned short size;
     unsigned short zero2;
+    /* driver data */
     struct sk_buff *skb;
     struct i596_rbd *v_next;
-    struct i596_rbd *b_addr;		/* This rbd addr from i596 view */
+    dma_addr_t     b_addr;		/* This rbd addr from i596 view */
     unsigned char *v_data;		/* Address from CPUs viewpoint */
 					/* Total 32 bytes... */
+#ifdef __LP64__
+    u32 cache_pad[4];
+#endif    
 };
 
 /* These values as chosen so struct i596_private fits in one page... */
@@ -328,27 +339,27 @@ struct i596_rbd {
 struct i596_scb {
 	unsigned short status;
 	unsigned short command;
-	struct i596_cmd *cmd;
-	struct i596_rfd *rfd;
-	unsigned long crc_err;
-	unsigned long align_err;
-	unsigned long resource_err;
-	unsigned long over_err;
-	unsigned long rcvdt_err;
-	unsigned long short_err;
+	dma_addr_t    cmd;
+	dma_addr_t    rfd;
+	u32           crc_err;
+	u32           align_err;
+	u32           resource_err;
+	u32           over_err;
+	u32           rcvdt_err;
+	u32           short_err;
 	unsigned short t_on;
 	unsigned short t_off;
 };
 
 struct i596_iscp {
-	unsigned long stat;
-	struct i596_scb *scb;
+	u32           stat;
+	dma_addr_t    scb;
 };
 
 struct i596_scp {
-	unsigned long sysbus;
-	unsigned long pad;
-	struct i596_iscp *iscp;
+	u32           sysbus;
+	u32            pad;
+	dma_addr_t    iscp;
 };
 
 struct i596_private {
@@ -363,14 +374,14 @@ struct i596_private {
 	struct i596_rbd rbds[RX_RING_SIZE]	__attribute__((aligned(32)));
 	struct tx_cmd tx_cmds[TX_RING_SIZE]	__attribute__((aligned(32)));
 	struct i596_tbd tbds[TX_RING_SIZE]	__attribute__((aligned(32)));
-	unsigned long stat;
+	u32    stat;
 	int last_restart;
 	struct i596_rfd *rfd_head;
 	struct i596_rbd *rbd_head;
 	struct i596_cmd *cmd_tail;
 	struct i596_cmd *cmd_head;
 	int cmd_backlog;
-	unsigned long last_cmd;
+	u32    last_cmd;
 	struct net_device_stats stats;
 	int next_tx_cmd;
 	int options;
@@ -420,7 +431,7 @@ static inline void CA(struct net_device 
 }
 
 
-static inline void MPU_PORT(struct net_device *dev, int c, volatile void *x)
+static inline void MPU_PORT(struct net_device *dev, int c, dma_addr_t x)
 {
 	struct i596_private *lp = (struct i596_private *) dev->priv;
 
@@ -449,7 +460,7 @@ static inline int wait_istat(struct net_
 		CHECK_INV(&(lp->iscp), sizeof(struct i596_iscp));
 	}
 	if (!delcnt) {
-		printk("%s: %s, iscp.stat %04lx, didn't clear\n",
+		printk("%s: %s, iscp.stat %04x, didn't clear\n",
 		     dev->name, str, lp->iscp.stat);
 		return -1;
 	}
@@ -482,28 +493,28 @@ static void i596_display_data(struct net
 	struct i596_rfd *rfd;
 	struct i596_rbd *rbd;
 
-	printk("lp and scp at %p, .sysbus = %08lx, .iscp = %p\n",
+	printk("lp and scp at %p, .sysbus = %08x, .iscp = %08x\n",
 	       &lp->scp, lp->scp.sysbus, lp->scp.iscp);
-	printk("iscp at %p, iscp.stat = %08lx, .scb = %p\n",
+	printk("iscp at %p, iscp.stat = %08x, .scb = %08x\n",
 	       &lp->iscp, lp->iscp.stat, lp->iscp.scb);
 	printk("scb at %p, scb.status = %04x, .command = %04x,"
-		" .cmd = %p, .rfd = %p\n",
+		" .cmd = %08x, .rfd = %08x\n",
 	       &lp->scb, lp->scb.status, lp->scb.command,
 		lp->scb.cmd, lp->scb.rfd);
-	printk("   errors: crc %lx, align %lx, resource %lx,"
-               " over %lx, rcvdt %lx, short %lx\n",
+	printk("   errors: crc %x, align %x, resource %x,"
+               " over %x, rcvdt %x, short %x\n",
 		lp->scb.crc_err, lp->scb.align_err, lp->scb.resource_err,
 		lp->scb.over_err, lp->scb.rcvdt_err, lp->scb.short_err);
 	cmd = lp->cmd_head;
-	while (cmd != I596_NULL) {
-		printk("cmd at %p, .status = %04x, .command = %04x, .b_next = %p\n",
+	while (cmd != NULL) {
+		printk("cmd at %p, .status = %04x, .command = %04x, .b_next = %08x\n",
 		  cmd, cmd->status, cmd->command, cmd->b_next);
 		cmd = cmd->v_next;
 	}
 	rfd = lp->rfd_head;
 	printk("rfd_head = %p\n", rfd);
 	do {
-		printk ("   %p .stat %04x, .cmd %04x, b_next %p, rbd %p,"
+		printk ("   %p .stat %04x, .cmd %04x, b_next %08x, rbd %08x,"
                         " count %04x\n",
 			rfd, rfd->stat, rfd->cmd, rfd->b_next, rfd->rbd,
 			rfd->count);
@@ -512,7 +523,7 @@ static void i596_display_data(struct net
 	rbd = lp->rbd_head;
 	printk("rbd_head = %p\n", rbd);
 	do {
-		printk("   %p .count %04x, b_next %p, b_data %p, size %04x\n",
+		printk("   %p .count %04x, b_next %08x, b_data %08x, size %04x\n",
 			rbd, rbd->count, rbd->b_next, rbd->b_data, rbd->size);
 		rbd = rbd->v_next;
 	} while (rbd != lp->rbd_head);
@@ -533,7 +544,7 @@ static void i596_error(int irq, void *de
 }
 #endif
 
-#define virt_to_dma(lp,v) ((char *)(v)-(char *)(lp)+(char *)((lp)->dma_addr))
+#define virt_to_dma(lp,v) ((lp)->dma_addr + (dma_addr_t)((unsigned long)(v)-(unsigned long)(lp)))
 
 static inline void init_rx_bufs(struct net_device *dev)
 {
@@ -579,7 +590,7 @@ static inline void init_rx_bufs(struct n
 	lp->rfd_head = lp->rfds;
 	lp->scb.rfd = WSWAPrfd(virt_to_dma(lp,lp->rfds));
 	rfd = lp->rfds;
-	rfd->rbd = lp->rbd_head;
+	rfd->rbd = WSWAPrbd(virt_to_dma(lp,lp->rbd_head));
 	rfd->v_prev = lp->rfds + rx_ring_size - 1;
 	rfd = lp->rfds + rx_ring_size - 1;
 	rfd->v_next = lp->rfds;
@@ -652,14 +663,15 @@ static int init_i596_mem(struct net_devi
 	lp->iscp.stat = ISCP_BUSY;
 	lp->cmd_backlog = 0;
 
-	lp->cmd_head = lp->scb.cmd = I596_NULL;
+	lp->cmd_head = NULL;
+        lp->scb.cmd = I596_NULL;
 
 	DEB(DEB_INIT,printk("%s: starting i82596.\n", dev->name));
 
 	CHECK_WBACK(&(lp->scp), sizeof(struct i596_scp));
 	CHECK_WBACK(&(lp->iscp), sizeof(struct i596_iscp));
 
-	MPU_PORT(dev, PORT_ALTSCP, (void *)virt_to_dma(lp,&lp->scp));	
+	MPU_PORT(dev, PORT_ALTSCP, virt_to_dma(lp,&lp->scp));	
 
 	CA(dev);
 
@@ -736,7 +748,7 @@ static inline int i596_rx(struct net_dev
 	CHECK_INV(rfd, sizeof(struct i596_rfd));
 	while ((rfd->stat) & STAT_C) {	/* Loop while complete frames */
 		if (rfd->rbd == I596_NULL)
-			rbd = I596_NULL;
+			rbd = NULL;
 		else if (rfd->rbd == lp->rbd_head->b_addr) {
 			rbd = lp->rbd_head;
 			CHECK_INV(rbd, sizeof(struct i596_rbd));
@@ -744,12 +756,12 @@ static inline int i596_rx(struct net_dev
 		else {
 			printk("%s: rbd chain broken!\n", dev->name);
 			/* XXX Now what? */
-			rbd = I596_NULL;
+			rbd = NULL;
 		}
-		DEB(DEB_RXFRAME, printk("  rfd %p, rfd.rbd %p, rfd.stat %04x\n",
+		DEB(DEB_RXFRAME, printk("  rfd %p, rfd.rbd %08x, rfd.stat %04x\n",
 			rfd, rfd->rbd, rfd->stat));
 		
-		if (rbd != I596_NULL && ((rfd->stat) & STAT_OK)) {
+		if (rbd != NULL && ((rfd->stat) & STAT_OK)) {
 			/* a good frame */
 			int pkt_len = rbd->count & 0x3fff;
 			struct sk_buff *skb = rbd->skb;
@@ -831,7 +843,7 @@ memory_squeeze:
 
 		/* Clear the buffer descriptor count and EOF + F flags */
 
-		if (rbd != I596_NULL && (rbd->count & 0x4000)) {
+		if (rbd != NULL && (rbd->count & 0x4000)) {
 			rbd->count = 0;
 			lp->rbd_head = rbd->v_next;
 			CHECK_WBACK_INV(rbd, sizeof(struct i596_rbd));
@@ -868,7 +880,7 @@ static inline void i596_cleanup_cmd(stru
 {
 	struct i596_cmd *ptr;
 
-	while (lp->cmd_head != I596_NULL) {
+	while (lp->cmd_head != NULL) {
 		ptr = lp->cmd_head;
 		lp->cmd_head = ptr->v_next;
 		lp->cmd_backlog--;
@@ -885,12 +897,14 @@ static inline void i596_cleanup_cmd(stru
 				lp->stats.tx_errors++;
 				lp->stats.tx_aborted_errors++;
 
-				ptr->v_next = ptr->b_next = I596_NULL;
+				ptr->v_next = NULL;
+				ptr->b_next = I596_NULL;
 				tx_cmd->cmd.command = 0;  /* Mark as free */
 				break;
 			}
 		default:
-			ptr->v_next = ptr->b_next = I596_NULL;
+			ptr->v_next = NULL;
+			ptr->b_next = I596_NULL;
 		}
 		CHECK_WBACK_INV(ptr, sizeof(struct i596_cmd));
 	}
@@ -901,7 +915,7 @@ static inline void i596_cleanup_cmd(stru
 }
 
 
-static inline void i596_reset(struct net_device *dev, struct i596_private *lp, int ioaddr)
+static inline void i596_reset(struct net_device *dev, struct i596_private *lp)
 {
 	unsigned long flags;
 
@@ -933,19 +947,19 @@ static inline void i596_reset(struct net
 static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd)
 {
 	struct i596_private *lp = (struct i596_private *) dev->priv;
-	int ioaddr = dev->base_addr;
 	unsigned long flags;
 
 	DEB(DEB_ADDCMD,printk("i596_add_cmd cmd_head %p\n", lp->cmd_head));
 
 	cmd->status = 0;
 	cmd->command |= (CMD_EOL | CMD_INTR);
-	cmd->v_next = cmd->b_next = I596_NULL;
+	cmd->v_next = NULL;
+	cmd->b_next = I596_NULL;
 	CHECK_WBACK(cmd, sizeof(struct i596_cmd));
 
 	spin_lock_irqsave (&lp->lock, flags);
 
-	if (lp->cmd_head != I596_NULL) {
+	if (lp->cmd_head != NULL) {
 		lp->cmd_tail->v_next = cmd;
 		lp->cmd_tail->b_next = WSWAPcmd(virt_to_dma(lp,&cmd->status));
 		CHECK_WBACK(lp->cmd_tail, sizeof(struct i596_cmd));
@@ -970,7 +984,7 @@ static void i596_add_cmd(struct net_devi
 
 		printk("%s: command unit timed out, status resetting.\n", dev->name);
 #if 1
-		i596_reset(dev, lp, ioaddr);
+		i596_reset(dev, lp);
 #endif
 	}
 }
@@ -1039,7 +1053,6 @@ out:
 static void i596_tx_timeout (struct net_device *dev)
 {
 	struct i596_private *lp = (struct i596_private *) dev->priv;
-	int ioaddr = dev->base_addr;
 
 	/* Transmitter timeout, serious problems. */
 	DEB(DEB_ERRORS,printk("%s: transmit timed out, status resetting.\n",
@@ -1051,7 +1064,7 @@ static void i596_tx_timeout (struct net_
 	if (lp->last_restart == lp->stats.tx_packets) {
 		DEB(DEB_ERRORS,printk ("Resetting board.\n"));
 		/* Shutdown and restart */
-		i596_reset (dev, lp, ioaddr);
+		i596_reset (dev, lp);
 	} else {
 		/* Issue a channel attention signal */
 		DEB(DEB_ERRORS,printk ("Kicking board.\n"));
@@ -1074,8 +1087,8 @@ static int i596_start_xmit(struct sk_buf
 	short length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
 	dev->trans_start = jiffies;
 
-	DEB(DEB_STARTTX,printk("%s: i596_start_xmit(%x,%x) called\n", dev->name,
-				skb->len, (unsigned int)skb->data));
+	DEB(DEB_STARTTX,printk("%s: i596_start_xmit(%x,%p) called\n", dev->name,
+				skb->len, skb->data));
 
 	netif_stop_queue(dev);
 
@@ -1149,12 +1162,12 @@ static int __devinit i82596_probe(struct
 			    sizeof(struct i596_rfd));
 	    return -ENODEV;
 	}
-	if (sizeof(struct i596_rbd) != 32) {
+	if ((sizeof(struct i596_rbd) % 32) != 0) {
 	    printk("82596: sizeof(struct i596_rbd) = %d\n",
 			    sizeof(struct i596_rbd));
 	    return -ENODEV;
 	}
-	if (sizeof(struct tx_cmd) != 32) {
+	if ((sizeof(struct tx_cmd) % 32) != 0) {
 	    printk("82596: sizeof(struct tx_cmd) = %d\n",
 			    sizeof(struct tx_cmd));
 	    return -ENODEV;
@@ -1164,11 +1177,13 @@ static int __devinit i82596_probe(struct
 			    sizeof(struct i596_tbd));
 	    return -ENODEV;
 	}
+#ifndef __LP64__
 	if (sizeof(struct i596_private) > 4096) {
 	    printk("82596: sizeof(struct i596_private) = %d\n",
 			    sizeof(struct i596_private));
 	    return -ENODEV;
 	}
+#endif
 
 	if (!dev->base_addr || !dev->irq)
 		return -ENODEV;
@@ -1269,7 +1284,7 @@ static void i596_interrupt(int irq, void
 		if ((status & 0x2000))
 			DEB(DEB_INTS,printk("%s: i596 interrupt command unit inactive %x.\n", dev->name, status & 0x0700));
 
-		while (lp->cmd_head != I596_NULL) {
+		while (lp->cmd_head != NULL) {
 			CHECK_INV(lp->cmd_head, sizeof(struct i596_cmd));
 			if (!(lp->cmd_head->status & STAT_C))
 				break;
@@ -1331,7 +1346,8 @@ static void i596_interrupt(int irq, void
 				ptr->command = 0;
 				break;
 			}
-			ptr->v_next = ptr->b_next = I596_NULL;
+			ptr->v_next = NULL;
+		        ptr->b_next = I596_NULL;
 			CHECK_WBACK(ptr, sizeof(struct i596_cmd));
 			lp->last_cmd = jiffies;
 		}
@@ -1341,7 +1357,7 @@ static void i596_interrupt(int irq, void
 		 * only add to the cmd queue when the CU is stopped.
 		 */
 		ptr = lp->cmd_head;
-		while ((ptr != I596_NULL) && (ptr != lp->cmd_tail)) {
+		while ((ptr != NULL) && (ptr != lp->cmd_tail)) {
 			struct i596_cmd *prev = ptr;
 
 			ptr->command &= 0x1fff;
@@ -1349,7 +1365,7 @@ static void i596_interrupt(int irq, void
 			CHECK_WBACK_INV(prev, sizeof(struct i596_cmd));
 		}
 
-		if ((lp->cmd_head != I596_NULL))
+		if ((lp->cmd_head != NULL))
 			ack_cmd |= CUC_START;
 		lp->scb.cmd = WSWAPcmd(virt_to_dma(lp,&lp->cmd_head->status));
 		CHECK_WBACK_INV(&lp->scb, sizeof(struct i596_scb));
Index: drivers/video/sti/sticore.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticore.c,v
retrieving revision 1.36
diff -u -p -r1.36 sticore.c
--- drivers/video/sti/sticore.c	2002/02/21 17:26:50	1.36
+++ drivers/video/sti/sticore.c	2002/03/03 22:21:16
@@ -100,7 +100,7 @@ static const struct sti_conf_flags defau
 void
 sti_inq_conf(struct sti_struct *sti)
 {
-	struct sti_conf_inptr inptr = { NULL };
+	struct sti_conf_inptr inptr = { 0 };
 	unsigned long flags;
 	s32 ret;
 
@@ -123,9 +123,9 @@ void
 sti_putc(struct sti_struct *sti, int c, int y, int x)
 {
 	struct sti_font_inptr inptr = {
-		(u32) sti->font->raw,
+		STI_PTR(sti->font->raw),
 		c_index(sti, c), c_fg(sti, c), c_bg(sti, c),
-		x * sti->font_width, y * sti->font_height, NULL
+		x * sti->font_width, y * sti->font_height, 0
 	};
 	struct sti_font_outptr outptr = { 0, };
 	s32 ret;
@@ -154,7 +154,7 @@ sti_set(struct sti_struct *sti, int src_
 		src_x, src_y ,
 		src_x, src_y ,
 		width, height,
-		NULL
+		0
 	};
 	struct sti_blkmv_outptr outptr = { 0, };
 	s32 ret;
@@ -177,7 +177,7 @@ sti_clear(struct sti_struct *sti, int sr
 		src_x * sti->font_width, src_y * sti->font_height,
 		src_x * sti->font_width, src_y * sti->font_height,
 		width * sti->font_width, height* sti->font_height,
-		NULL
+		0
 	};
 	struct sti_blkmv_outptr outptr = { 0, };
 	s32 ret;
@@ -204,7 +204,7 @@ sti_bmove(struct sti_struct *sti, int sr
 		src_x * sti->font_width, src_y * sti->font_height,
 		dst_x * sti->font_width, dst_y * sti->font_height,
 		width * sti->font_width, height* sti->font_height,
-		NULL
+		0
 	};
 	struct sti_blkmv_outptr outptr = { 0, };
 	s32 ret;
@@ -336,7 +336,7 @@ sti_dump_globcfg(struct sti_glob_cfg *gl
 		"regions at %08x %08x %08x %08x\n"
 		"regions at %08x %08x %08x %08x\n"
 		"reent_lvl %d\n"
-		"save_addr %p\n",
+		"save_addr %08x\n",
 		glob_cfg->text_planes,
 		glob_cfg->onscreen_x, glob_cfg->onscreen_y,
 		glob_cfg->offscreen_x, glob_cfg->offscreen_y,
@@ -355,7 +355,7 @@ sti_dump_globcfg(struct sti_glob_cfg *gl
 		"in friendly mode: %d\n"
 		"power consumption %d watts\n"
 		"freq ref %d\n"
-		"sti_mem_addr %p (size=%d bytes)\n",
+		"sti_mem_addr %08x (size=%d bytes)\n",
 		cfg->curr_mon,
 		cfg->friendly_boot,
 		cfg->power,
@@ -459,7 +459,7 @@ sti_init_glob_cfg(struct sti_struct *sti
 
 	glob_cfg_ext->sti_mem_addr = STI_PTR(sti_mem_addr);
 
-	sti->glob_cfg = STI_PTR(glob_cfg);
+	sti->glob_cfg = glob_cfg;
 	
 	return 0;
 }
@@ -656,7 +656,7 @@ struct sti_rom * __init
 sti_get_bmode_rom (unsigned long address)
 {
 	struct sti_rom *raw;
-	unsigned long size;
+	u32 size;
         struct sti_rom_font *raw_font, *font_start;
     
 	sti_bmode_rom_copy(address + BMODE_LAST_ADDR_OFFS, sizeof(size), &size);
@@ -743,16 +743,8 @@ sti_read_rom(int wordmode, struct sti_st
 	sti->font = sti_select_font(sti->rom, sti_search_font);
 	sti->font_width = sti->font->raw->width;
 	sti->font_height = sti->font->raw->height;
-	if (wordmode)
-		sti->font->raw = STI_PTR(sti->font->raw);
-	else {
-		void *rf = sti_bmode_font_raw(sti->font);
-		
-		if (rf)
-			sti->font->raw = STI_PTR(rf);
-		else
-			goto out_err;
-	}
+	if (!wordmode)
+	        sti->font->raw = sti_bmode_font_raw(sti->font);
 
 	sti->sti_mem_request = raw->sti_mem_req;
 	sti->graphics_id[0] = raw->graphics_id[0];
@@ -873,7 +865,7 @@ test_rom:
 		goto out_err;
 
 	sti_inq_conf(sti);
-	sti_dump_globcfg(PTR_STI(sti->glob_cfg), sti->sti_mem_request);
+	sti_dump_globcfg(sti->glob_cfg, sti->sti_mem_request);
 	sti_dump_outptr(sti);
 	
 	printk(KERN_INFO "STI device: %s\n", sti->outptr.dev_name );
Index: drivers/video/sti/sticore.h
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticore.h,v
retrieving revision 1.22
diff -u -p -r1.22 sticore.h
--- drivers/video/sti/sticore.h	2002/02/21 17:26:50	1.22
+++ drivers/video/sti/sticore.h	2002/03/03 22:43:40
@@ -52,21 +52,21 @@ static int inline STI_CALL( unsigned lon
 
 #else /* !USE_HPPA_IOREMAP */
 
-#define STI_PTR(p)	( (typeof(p)) virt_to_phys(p) )
-#define PTR_STI(p)	( (typeof(p)) phys_to_virt((unsigned long)p) )
+#define STI_PTR(p)	( virt_to_phys(p) )
+#define PTR_STI(p)	( phys_to_virt((long)p) )
 #define STI_CALL(func, flags, inptr, outptr, glob_cfg) \
        ({                                                      \
                pdc_sti_call( func, (unsigned long)STI_PTR(flags), \
                                    (unsigned long)STI_PTR(inptr), \
                                    (unsigned long)STI_PTR(outptr), \
-                                   (unsigned long)(glob_cfg)); \
+                                   (unsigned long)STI_PTR(glob_cfg)); \
        })
 
 #endif /* USE_HPPA_IOREMAP */
 
 
-#define sti_onscreen_x(sti) (PTR_STI(sti->glob_cfg)->onscreen_x)
-#define sti_onscreen_y(sti) (PTR_STI(sti->glob_cfg)->onscreen_y)
+#define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x)
+#define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y)
 
 /* sti_font_xy() use the native font ROM ! */
 #define sti_font_x(sti) (PTR_STI(sti->font)->width)
@@ -118,8 +118,8 @@ struct sti_glob_cfg_ext {
 	 u8 friendly_boot;		/* in friendly boot mode */
 	s16 power;			/* power calculation (in Watts) */
 	s32 freq_ref;			/* frequency refrence */
-	s32 *sti_mem_addr;		/* pointer to global sti memory (size=sti_mem_request) */
-	u32 *future_ptr;		/* pointer to future data */
+	u32 sti_mem_addr;		/* pointer to global sti memory (size=sti_mem_request) */
+	u32 future_ptr; 		/* pointer to future data */
 };
 
 struct sti_glob_cfg {
@@ -132,8 +132,8 @@ struct sti_glob_cfg {
 	s16 total_y;			/* frame buffer height in pixels */
 	u32 region_ptrs[STI_REGION_MAX]; /* region pointers */
 	s32 reent_lvl;			/* storage for reentry level value */
-	s32 *save_addr;			/* where to save or restore reentrant state */
-	struct sti_glob_cfg_ext *ext_ptr; /* pointer to extended glob_cfg data structure */
+	u32 save_addr;			/* where to save or restore reentrant state */
+	u32 ext_ptr;			/* pointer to extended glob_cfg data structure */
 };
 
 
@@ -159,26 +159,26 @@ struct sti_init_flags {
 	u32 caller_kernel : 1;	/* set only by kernel for each call */
 	u32 caller_other : 1;	/* set only by non-[BR/K] caller */
 	u32 pad	: 14;		/* pad to word boundary */
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 
 struct sti_init_inptr_ext {
 	u8  config_mon_type;	/* configure to monitor type */
 	u8  pad[1];		/* pad to word boundary */
 	u16 inflight_data;	/* inflight data possible on PCI */
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 
 struct sti_init_inptr {
 	s32 text_planes;	/* number of planes to use for text */
-	struct sti_init_inptr_ext *ext_ptr; /* pointer to extended init_graph inptr data structure*/
+	u32 ext_ptr;		 /* pointer to extended init_graph inptr data structure*/
 };
 
 
 struct sti_init_outptr {
 	s32 errno;		/* error number on failure */
 	s32 text_planes;	/* number of planes used for text */
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 
 
@@ -188,17 +188,17 @@ struct sti_init_outptr {
 struct sti_conf_flags {
 	u32 wait : 1;		/* should routine idle wait or not */
 	u32 pad : 31;		/* pad to word boundary */
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 
 struct sti_conf_inptr {
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 
 struct sti_conf_outptr_ext {
 	u32 crt_config[3];	/* hardware specific X11/OGL information */	
 	u32 crt_hdw[3];
-	u32 *future_ptr;
+	u32 future_ptr;
 };
 
 struct sti_conf_outptr {
@@ -214,7 +214,7 @@ struct sti_conf_outptr {
 	s32 planes;		/* number of fb planes in system */
 	 u8 dev_name[STI_DEV_NAME_LENGTH]; /* null terminated product name */
 	u32 attributes;		/* flags denoting attributes */
-	struct sti_conf_outptr_ext *ext_ptr; /* pointer to future data */
+	u32 ext_ptr;		/* pointer to future data */
 };
 
 struct sti_rom {
@@ -300,19 +300,19 @@ struct sti_font_inptr {
 	u8 bg_color;		/* background color of character */
 	s16 dest_x;		/* X location of character upper left */
 	s16 dest_y;		/* Y location of character upper left */
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 
 struct sti_font_flags {
 	u32 wait : 1;		/* should routine idle wait or not */
 	u32 non_text : 1;	/* font unpack/move in non_text planes =1, text =0 */
 	u32 pad : 30;		/* pad to word boundary */
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 	
 struct sti_font_outptr {
 	s32 errno;		/* error number on failure */
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 
 /* STI blockmove structs */
@@ -323,7 +323,7 @@ struct sti_blkmv_flags {
 	u32 clear : 1;		/* clear during move? */
 	u32 non_text : 1;	/* block move in non_text planes =1, text =0 */
 	u32 pad : 28;		/* pad to word boundary */
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 
 struct sti_blkmv_inptr {
@@ -335,12 +335,12 @@ struct sti_blkmv_inptr {
 	s16 dest_y;		/* dest upper left pixel y location */
 	s16 width;		/* block width in pixels */
 	s16 height;		/* block height in pixels */
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 
 struct sti_blkmv_outptr {
 	s32 errno;		/* error number on failure */
-	u32 *future_ptr;	/* pointer to future data */
+	u32 future_ptr; 	/* pointer to future data */
 };
 
 
Index: drivers/video/sti/stifb.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/stifb.c,v
retrieving revision 1.28
diff -u -p -r1.28 stifb.c
--- drivers/video/sti/stifb.c	2002/02/27 20:11:49	1.28
+++ drivers/video/sti/stifb.c	2002/03/03 22:30:43
@@ -79,10 +79,16 @@
 
 extern struct display_switch fbcon_sti; /* fbcon-sti.c */
 
+#ifdef __LP64__
 /* return virtual address */
 #define REGION_BASE(fb_info, index) \
-	PTR_STI(fb_info->sti->glob_cfg)->region_ptrs[index]
-	
+	(fb_info->sti->glob_cfg->region_ptrs[index] | 0xffffffff00000000)
+#else
+/* return virtual address */
+#define REGION_BASE(fb_info, index) \
+	fb_info->sti->glob_cfg->region_ptrs[index]
+#endif
+
 #define NGLEDEVDEPROM_CRT_REGION 1
 
 typedef struct {
@@ -319,8 +325,8 @@ CRX24_ENABLE_DISABLE_DISPLAY(struct stif
 static void
 ARTIST_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable) 
 {
-	unsigned long DregsMiscVideo = REG_21;
-	unsigned long DregsMiscCtl = REG_27;
+	u32 DregsMiscVideo = REG_21;
+	u32 DregsMiscCtl = REG_27;
 	
 	SETUP_HW(fb);
 	if (enable) {
@@ -402,7 +408,7 @@ ARTIST_ENABLE_DISABLE_DISPLAY(struct sti
 	WRITE_WORD(val, fb, REG_6)
 
 #define NGLE_LONG_FB_ADDRESS(fbaddrbase, x, y) (		\
-	(unsigned long) (fbaddrbase) +				\
+	(u32) (fbaddrbase) +				\
 	    (	(unsigned int)  ( (y) << 13      ) |		\
 		(unsigned int)  ( (x) << 2       )	)	\
 	)
@@ -428,7 +434,7 @@ ARTIST_ENABLE_DISABLE_DISPLAY(struct sti
 static void
 HYPER_ENABLE_DISABLE_DISPLAY(struct stifb_info *fb, int enable)
 {
-	unsigned long DregsHypMiscVideo = REG_33;
+	u32 DregsHypMiscVideo = REG_33;
 	unsigned int value;
 	SETUP_HW(fb);
 	value = READ_WORD(fb, DregsHypMiscVideo);
@@ -516,7 +522,7 @@ rattlerSetupPlanes(struct stifb_info *fb
 
 /* typedef of LUT (Colormap) BLT Control Register */
 typedef union	/* Note assumption that fields are packed left-to-right */
-{	unsigned long   all;
+{	u32 all;
 	struct
 	{
 		unsigned enable              :  1;
@@ -596,7 +602,7 @@ setHyperLutBltCtl(struct stifb_info *fb,
 static void hyperUndoITE(struct stifb_info *fb)
 {
 	int nFreeFifoSlots = 0;
-	unsigned long fbAddr;
+	u32 fbAddr;
 
 	NGLE_LOCK(fb);
 
@@ -619,7 +625,7 @@ static void hyperUndoITE(struct stifb_in
 	fbAddr = NGLE_LONG_FB_ADDRESS(0, 1532, 0);
 	NGLE_BINC_SET_DSTADDR(fb, fbAddr);
 	NGLE_REALLY_SET_IMAGE_PLANEMASK(fb, 0xffffff);
-	NGLE_BINC_SET_DSTMASK(fb, ~0UL);
+	NGLE_BINC_SET_DSTMASK(fb, 0xffffffff);
 
 	/* Finally, write a zero to clear the mask */
 	NGLE_BINC_WRITE32(fb, 0);
@@ -642,9 +648,9 @@ ngleDepth24_ClearImagePlanes(struct stif
 static void
 ngleResetAttrPlanes(struct stifb_info *fb, unsigned int ctlPlaneReg)
 {
-	int	nFreeFifoSlots = 0;
-	unsigned long packed_dst;
-	unsigned long packed_len;
+	int nFreeFifoSlots = 0;
+	u32 packed_dst;
+	u32 packed_len;
 
 	NGLE_LOCK(fb);
 
@@ -694,9 +700,9 @@ ngleResetAttrPlanes(struct stifb_info *f
 static void
 ngleClearOverlayPlanes(struct stifb_info *fb, int mask, int data)
 {
-    	int nFreeFifoSlots = 0;
-        unsigned long packed_dst;
-        unsigned long packed_len;
+	int nFreeFifoSlots = 0;
+	u32 packed_dst;
+	u32 packed_len;
     
 	NGLE_LOCK(fb);
 
@@ -896,8 +902,8 @@ SETUP_HCRX(struct stifb_info *fb)
 /* ------------------- driver specific functions --------------------------- */
 
 static int
-stifb_getcolreg(unsigned regno, unsigned *red, unsigned *green,
-	      unsigned *blue, unsigned *transp, struct fb_info *info)
+stifb_getcolreg(u_int regno, u_int *red, u_int *green,
+	      u_int *blue, u_int *transp, struct fb_info *info)
 {
 	struct stifb_info *fb = (struct stifb_info *) info;
 
@@ -912,8 +918,8 @@ stifb_getcolreg(unsigned regno, unsigned
 }
 
 static int
-stifb_setcolreg(unsigned regno, unsigned red, unsigned green,
-	      unsigned blue, unsigned transp, struct fb_info *info)
+stifb_setcolreg(u_int regno, u_int red, u_int green,
+	      u_int blue, u_int transp, struct fb_info *info)
 {
 	struct stifb_info *fb = (struct stifb_info *) info;
 
@@ -947,12 +953,12 @@ stifb_setcolreg(unsigned regno, unsigned
 static void
 stifb_loadcmap(struct stifb_info *fb)
 {
-	unsigned long color;
+	u32 color;
 	int i;
 
 	if (!fb->cmap_reload)
 		return;
-	
+
 	START_IMAGE_COLORMAP_ACCESS(fb);
 	for (i = 0; i < 256; i++) {
 		if (fb->var.bits_per_pixel > 8) {
@@ -1160,7 +1166,7 @@ stifb_switch(int con, struct fb_info *in
 	struct stifb_info *fb = (struct stifb_info *)info;
 	
 	/* Do we have to save the colormap ? */
-	if (fb_display[fb->currcon].cmap.len)
+	if (fb->currcon != -1 && fb_display[fb->currcon].cmap.len)
 		fb_get_cmap(&fb_display[fb->currcon].cmap, 1, stifb_getcolreg, info);
 
 	fb->currcon = con;
@@ -1283,6 +1289,9 @@ stifb_init_fb(struct sti_struct *sti, in
 			sti_rom_address = fb->sti->regions_phys[0];
 		else
 			sti_rom_address = fb->sti->regions_phys[1];
+#ifdef __LP64__
+	        sti_rom_address |= 0xffffffff00000000;
+#endif
 		fb->deviceSpecificConfig = __raw_readl(sti_rom_address);
 		if (IS_24_DEVICE(fb)) {
 			if (force_bpp == 8 || force_bpp == 32)
@@ -1316,14 +1325,18 @@ stifb_init_fb(struct sti_struct *sti, in
 
 
 	/* get framebuffer pysical and virtual base addr & len */	
+#ifdef __LP64__
+	fix->smem_start = fb->sti->regions_phys[1] | 0xffffffff00000000;
+#else
 	fix->smem_start = fb->sti->regions_phys[1];
-	fix->line_length = (PTR_STI(fb->sti->glob_cfg)->total_x * bpp) / 8;
+#endif
+	fix->line_length = (fb->sti->glob_cfg->total_x * bpp) / 8;
 	if (!fix->line_length)
 		fix->line_length = 2048; /* default */
 	if (fb->sti->pd)
 		fix->smem_len = pci_resource_len(fb->sti->pd, 0);
 	else
-		fix->smem_len = PTR_STI(fb->sti->glob_cfg)->total_y *
+		fix->smem_len = fb->sti->glob_cfg->total_y *
 				fix->line_length;
 	fix->accel = FB_ACCEL_NONE;
 


-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                 [ Alexander Viro on linux-kernel ]