[parisc-linux-cvs] 2.4.17-pa20

Thomas Bogendoerfer tsbogend@alpha.franken.de
Wed, 6 Feb 2002 01:04:39 +0100


Patch for 2.4.17-pa20:

Index: arch/parisc/kernel/drivers.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/drivers.c,v
retrieving revision 1.40
diff -u -p -r1.40 drivers.c
--- arch/parisc/kernel/drivers.c	2002/02/05 19:51:25	1.40
+++ arch/parisc/kernel/drivers.c	2002/02/05 21:28:43
@@ -214,6 +214,8 @@ get_node_path(struct parisc_device *dev,
 	int i = 5;
 	path->mod = dev->hw_path;
 	memset(&path->bc, -1, 6);
+	if (dev == &root)
+		return;
 	for (dev = dev->parent; dev != &root; dev = dev->parent) {
 		path->bc[i--] = dev->hw_path;
 	}
Index: arch/parisc/lib/io.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/lib/io.c,v
retrieving revision 1.7
diff -u -p -r1.7 io.c
--- arch/parisc/lib/io.c	2001/12/03 05:10:00	1.7
+++ arch/parisc/lib/io.c	2002/02/05 23:41:55
@@ -171,30 +171,30 @@ void insw (unsigned long port, void *dst
 		while (count>=2) {
 			
 			count -= 2;
-			l = inw(port) << 16;
-			l |= inw(port);
+			l = cpu_to_le16(inw(port)) << 16;
+			l |= cpu_to_le16(inw(port));
 			*(unsigned int *) dst = l;
 			((unsigned int *) dst)++;
 		}
 		if (count) {
-			*(unsigned short *) dst = inw(port);
+			*(unsigned short *) dst = cpu_to_le16(inw(port));
 		}
 		break;
 	
 	 case 0x02:			/* Buffer 16-bit aligned */
-		*(unsigned short *) dst = inw(port);
+		*(unsigned short *) dst = cpu_to_le16(inw(port));
 		((unsigned short *) dst)++;
 		count--;
 		while (count>=2) {
 			
 			count -= 2;
-			l = inw(port) << 16;
-			l |= inw(port);
+			l = cpu_to_le16(inw(port)) << 16;
+			l |= cpu_to_le16(inw(port));
 			*(unsigned int *) dst = l;
 			((unsigned int *) dst)++;
 		}
 		if (count) {
-			*(unsigned short *) dst = inw(port);
+			*(unsigned short *) dst = cpu_to_le16(inw(port));
 		}
 		break;
 		
@@ -204,12 +204,12 @@ void insw (unsigned long port, void *dst
 		 * in this case, 16bit will have to do -- DE */
 		--count;
 		
-		l = inw(port);
+		l = cpu_to_le16(inw(port));
 		*(unsigned char *) dst = l >> 8;
 		((unsigned char *) dst)++;
 		while (count--)
 		{
-			l2 = inw(port);
+			l2 = cpu_to_le16(inw(port));
 			*(unsigned short *) dst = (l & 0xff) << 8 | (l2 >> 8);
 			((unsigned short *) dst)++;
 			l = l2;
@@ -239,7 +239,7 @@ void insl (unsigned long port, void *dst
 	 case 0x00:			/* Buffer 32-bit aligned */
 		while (count--)
 		{
-			*(unsigned int *) dst = inl(port);
+			*(unsigned int *) dst = cpu_to_le32(inl(port));
 			((unsigned int *) dst)++;
 		}
 		break;
@@ -247,13 +247,13 @@ void insl (unsigned long port, void *dst
 	 case 0x02:			/* Buffer 16-bit aligned */
 		--count;
 		
-		l = inl(port);
+		l = cpu_to_le32(inl(port));
 		*(unsigned short *) dst = l >> 16;
 		((unsigned short *) dst)++;
 		
 		while (count--)
 		{
-			l2 = inl(port);
+			l2 = cpu_to_le32(inl(port));
 			*(unsigned int *) dst = (l & 0xffff) << 16 | (l2 >> 16);
 			((unsigned int *) dst)++;
 			l = l2;
@@ -263,14 +263,14 @@ void insl (unsigned long port, void *dst
 	 case 0x01:			/* Buffer 8-bit aligned */
 		--count;
 		
-		l = inl(port);
+		l = cpu_to_le32(inl(port));
 		*(unsigned char *) dst = l >> 24;
 		((unsigned char *) dst)++;
 		*(unsigned short *) dst = (l >> 8) & 0xffff;
 		((unsigned short *) dst)++;
 		while (count--)
 		{
-			l2 = inl(port);
+			l2 = cpu_to_le32(inl(port));
 			*(unsigned int *) dst = (l & 0xff) << 24 | (l2 >> 8);
 			((unsigned int *) dst)++;
 			l = l2;
@@ -280,12 +280,12 @@ void insl (unsigned long port, void *dst
 	 case 0x03:			/* Buffer 8-bit aligned */
 		--count;
 		
-		l = inl(port);
+		l = cpu_to_le32(inl(port));
 		*(unsigned char *) dst = l >> 24;
 		((unsigned char *) dst)++;
 		while (count--)
 		{
-			l2 = inl(port);
+			l2 = cpu_to_le32(inl(port));
 			*(unsigned int *) dst = (l & 0xffffff) << 8 | l2 >> 24;
 			((unsigned int *) dst)++;
 			l = l2;
@@ -333,17 +333,17 @@ void outsw (unsigned long port, const vo
 			count -= 2;
 			l = *(unsigned int *) src;
 			((unsigned int *) src)++;
-			outw(l >> 16, port);
-			outw(l & 0xffff, port);
+			outw(le16_to_cpu(l >> 16), port);
+			outw(le16_to_cpu(l & 0xffff), port);
 		}
 		if (count) {
-			outw(*(unsigned short*)src, port);
+			outw(le16_to_cpu(*(unsigned short*)src), port);
 		}
 		break;
 	
 	 case 0x02:			/* Buffer 16-bit aligned */
 		
-		outw(*(unsigned short*)src, port);
+		outw(le16_to_cpu(*(unsigned short*)src), port);
 		((unsigned short *) src)++;
 		count--;
 		
@@ -351,11 +351,11 @@ void outsw (unsigned long port, const vo
 			count -= 2;
 			l = *(unsigned int *) src;
 			((unsigned int *) src)++;
-			outw(l >> 16, port);
-			outw(l & 0xffff, port);
+			outw(le16_to_cpu(l >> 16), port);
+			outw(le16_to_cpu(l & 0xffff), port);
 		}
 		if (count) {
-			outw(*(unsigned short*)src, port);
+			outw(le16_to_cpu(*(unsigned short*)src), port);
 		}
 		break;
 		
@@ -371,11 +371,11 @@ void outsw (unsigned long port, const vo
 			count--;
 			l2 = *(unsigned short *) src;
 			((unsigned short *) src)++;
-			outw(l | l2 >> 8, port);
+			outw(le16_to_cpu(l | l2 >> 8), port);
 		        l = l2 << 8;
 		}
 		l2 = *(unsigned char *) src;
-		outw (l | l2>>8, port);
+		outw (le16_to_cpu(l | l2>>8), port);
 		break;
 	
 	}
@@ -400,7 +400,7 @@ void outsl (unsigned long port, const vo
 	 case 0x00:			/* Buffer 32-bit aligned */
 		while (count--)
 		{
-			outl(*(unsigned int *) src, port);
+			outl(le32_to_cpu(*(unsigned int *) src), port);
 			((unsigned int *) src)++;
 		}
 		break;
@@ -415,11 +415,11 @@ void outsl (unsigned long port, const vo
 		{
 			l2 = *(unsigned int *) src;
 			((unsigned int *) src)++;
-			outl (l << 16 | l2 >> 16, port);
+			outl (le32_to_cpu(l << 16 | l2 >> 16), port);
 			l = l2;
 		}
 		l2 = *(unsigned short *) src;
-		outl (l << 16 | l2, port);
+		outl (le32_to_cpu(l << 16 | l2), port);
 		break;
 	 case 0x01:			/* Buffer 8-bit aligned */
 		--count;
@@ -432,11 +432,11 @@ void outsl (unsigned long port, const vo
 		{
 			l2 = *(unsigned int *) src;
 			((unsigned int *) src)++;
-			outl (l | l2 >> 24, port);
+			outl (le32_to_cpu(l | l2 >> 24), port);
 			l = l2 << 8;
 		}
 		l2 = *(unsigned char *) src;
-		outl (l | l2, port);
+		      outl (le32_to_cpu(l | l2), port);
 		break;
 	 case 0x03:			/* Buffer 8-bit aligned */
 		--count;
@@ -447,13 +447,13 @@ void outsl (unsigned long port, const vo
 		{
 			l2 = *(unsigned int *) src;
 			((unsigned int *) src)++;
-			outl (l | l2 >> 8, port);
+			outl (le32_to_cpu(l | l2 >> 8), port);
 			l = l2 << 24;
 		}
 		l2  = *(unsigned short *) src << 16;
 		((unsigned short *) src)++;
 		l2 |= *(unsigned char *) src;
-		outl (l | l2, port);
+		outl (le32_to_cpu(l | l2), port);
 		break;
 	}
 }
Index: drivers/gsc/eisa.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/gsc/eisa.c,v
retrieving revision 1.14
diff -u -p -r1.14 eisa.c
--- drivers/gsc/eisa.c	2002/01/13 16:01:17	1.14
+++ drivers/gsc/eisa.c	2002/02/05 23:45:34
@@ -79,14 +79,14 @@ unsigned char eisa_in8(unsigned short po
 unsigned short eisa_in16(unsigned short port)
 {
 	if (EISA_bus)
-		return gsc_readw(eisa_permute(port));
+		return le16_to_cpu(gsc_readw(eisa_permute(port)));
 	return 0xffff;
 }
 
 unsigned int eisa_in32(unsigned short port)
 {
 	if (EISA_bus)
-		return gsc_readl(eisa_permute(port));
+		return le32_to_cpu(gsc_readl(eisa_permute(port)));
 	return 0xffffffff;
 }
 
@@ -99,13 +99,13 @@ void eisa_out8(unsigned char data, unsig
 void eisa_out16(unsigned short data, unsigned short port)
 {
 	if (EISA_bus)	
-		gsc_writew(data, eisa_permute(port));
+		gsc_writew(cpu_to_le16(data), eisa_permute(port));
 }
 
 void eisa_out32(unsigned int data, unsigned short port)
 {
 	if (EISA_bus)
-		gsc_writel(data, eisa_permute(port));
+		gsc_writel(cpu_to_le32(data), eisa_permute(port));
 }
 
 /* Interrupt handling */
Index: drivers/gsc/wax.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/gsc/wax.c,v
retrieving revision 1.19
diff -u -p -r1.19 wax.c
--- drivers/gsc/wax.c	2002/02/02 15:25:14	1.19
+++ drivers/gsc/wax.c	2002/02/05 23:47:35
@@ -117,7 +117,7 @@ wax_init_chip(struct parisc_device *dev)
 	wax->eim = ((u32) gsc_irq.txn_addr) | gsc_irq.txn_data;
 
 	/* enable IRQ's for devices below WAX */
-//	gsc_writel(wax->eim, wax->hpa + OFFSET_IAR);
+	gsc_writel(wax->eim, wax->hpa + OFFSET_IAR);
 
 	/* Done init'ing, register this driver */
 	ret = gsc_common_irqsetup(dev, wax);
Index: include/asm-parisc/ide.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/ide.h,v
retrieving revision 1.4
diff -u -p -r1.4 ide.h
--- include/asm-parisc/ide.h	2001/08/24 13:01:48	1.4
+++ include/asm-parisc/ide.h	2002/02/05 23:26:35
@@ -97,11 +97,85 @@ typedef union {
 #define ide_request_region(from,extent,name)	request_region((from), (extent), (name))
 #define ide_release_region(from,extent)		release_region((from), (extent))
 
+#define T_CHAR          (0x0000)        /* char:  don't touch  */
+#define T_SHORT         (0x4000)        /* short: 12 -> 21     */
+#define T_INT           (0x8000)        /* int:   1234 -> 4321 */
+#define T_TEXT          (0xc000)        /* text:  12 -> 21     */
+
+#define T_MASK_TYPE     (0xc000)
+#define T_MASK_COUNT    (0x3fff)
+
+#define D_CHAR(cnt)     (T_CHAR  | (cnt))
+#define D_SHORT(cnt)    (T_SHORT | (cnt))
+#define D_INT(cnt)      (T_INT   | (cnt))
+#define D_TEXT(cnt)     (T_TEXT  | (cnt))
+
+static u_short driveid_types[] = {
+	D_SHORT(10),	/* config - vendor2 */
+	D_TEXT(20),	/* serial_no */
+	D_SHORT(3),	/* buf_type - ecc_bytes */
+	D_TEXT(48),	/* fw_rev - model */
+	D_CHAR(2),	/* max_multsect - vendor3 */
+	D_SHORT(1),	/* dword_io */
+	D_CHAR(2),	/* vendor4 - capability */
+	D_SHORT(1),	/* reserved50 */
+	D_CHAR(4),	/* vendor5 - tDMA */
+	D_SHORT(4),	/* field_valid - cur_sectors */
+	D_INT(1),	/* cur_capacity */
+	D_CHAR(2),	/* multsect - multsect_valid */
+	D_INT(1),	/* lba_capacity */
+	D_SHORT(194)	/* dma_1word - reservedyy */
+};
+
+#define num_driveid_types       (sizeof(driveid_types)/sizeof(*driveid_types))
+
+static __inline__ void ide_fix_driveid(struct hd_driveid *id)
+{
+	u_char *p = (u_char *)id;
+	int i, j, cnt;
+	u_char t;
+
+	for (i = 0; i < num_driveid_types; i++) {
+		cnt = driveid_types[i] & T_MASK_COUNT;
+		switch (driveid_types[i] & T_MASK_TYPE) {
+		case T_CHAR:
+			p += cnt;
+			break;
+		case T_SHORT:
+			for (j = 0; j < cnt; j++) {
+				t = p[0];
+				p[0] = p[1];
+				p[1] = t;
+				p += 2;
+			}
+			break;
+		case T_INT:
+			for (j = 0; j < cnt; j++) {
+				t = p[0];
+				p[0] = p[3];
+				p[3] = t;
+				t = p[1];
+				p[1] = p[2];
+				p[2] = t;
+				p += 4;
+			}
+			break;
+		case T_TEXT:
+			for (j = 0; j < cnt; j += 2) {
+				t = p[0];
+				p[0] = p[1];
+				p[1] = t;
+				p += 2;
+			}
+			break;
+		};
+	}
+}
+
 /*
  * The following are not needed for the non-m68k ports
  */
 #define ide_ack_intr(hwif)		(1)
-#define ide_fix_driveid(id)		do {} while (0)
 #define ide_release_lock(lock)		do {} while (0)
 #define ide_get_lock(lock, hdlr, data)	do {} while (0)
 
-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                 [ Alexander Viro on linux-kernel ]