public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] Convert resource to u64 from unsigned long
@ 2005-01-13 23:28 Dave
  2005-01-14  5:48 ` Andreas Dilger
  0 siblings, 1 reply; 2+ messages in thread
From: Dave @ 2005-01-13 23:28 UTC (permalink / raw)
  To: akpm, torvalds, linux-kernel, smaurer, linux, dsaxena,
	drew.moseley, mporter

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

Fixed some of the drivers as example just to get working on i386.

Signed-off-by: Dave Jiang (dave.jiang@gmail.com)


-- 
-= Dave =-

Software Engineer - Advanced Development Engineering Team 
Storage Component Division - Intel Corp. 
mailto://dave.jiang @ intel
http://sourceforge.net/projects/xscaleiop/
----
The views expressed in this email are
mine alone and do not necessarily 
reflect the views of my employer
(Intel Corp.).

[-- Attachment #2: patch-driver_u64fix --]
[-- Type: application/octet-stream, Size: 5466 bytes --]

diff -Naur linux-2.6.11-rc1/drivers/ide/pci/cmd64x.c linux-2.6.11-rc1-u64/drivers/ide/pci/cmd64x.c
--- linux-2.6.11-rc1/drivers/ide/pci/cmd64x.c	2005-01-13 14:39:55.967192424 -0700
+++ linux-2.6.11-rc1-u64/drivers/ide/pci/cmd64x.c	2005-01-13 12:20:28.703209896 -0700
@@ -560,7 +560,7 @@
 #ifdef __i386__
 	if (dev->resource[PCI_ROM_RESOURCE].start) {
 		pci_write_config_byte(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-		printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
+		printk(KERN_INFO "%s: ROM enabled at 0x%" U64FMT "\n", name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 #endif
 
diff -Naur linux-2.6.11-rc1/drivers/ide/pci/hpt34x.c linux-2.6.11-rc1-u64/drivers/ide/pci/hpt34x.c
--- linux-2.6.11-rc1/drivers/ide/pci/hpt34x.c	2005-01-13 14:39:56.013185432 -0700
+++ linux-2.6.11-rc1-u64/drivers/ide/pci/hpt34x.c	2005-01-13 12:25:06.456984904 -0700
@@ -175,7 +175,7 @@
 		if (pci_resource_start(dev, PCI_ROM_RESOURCE)) {
 			pci_write_config_byte(dev, PCI_ROM_ADDRESS,
 				dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-			printk(KERN_INFO "HPT345: ROM enabled at 0x%08lx\n",
+			printk(KERN_INFO "HPT345: ROM enabled at 0x%" U64FMT "\n",
 				dev->resource[PCI_ROM_RESOURCE].start);
 		}
 		pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xF0);
diff -Naur linux-2.6.11-rc1/drivers/ide/pci/pdc202xx_new.c linux-2.6.11-rc1-u64/drivers/ide/pci/pdc202xx_new.c
--- linux-2.6.11-rc1/drivers/ide/pci/pdc202xx_new.c	2005-01-13 14:39:56.561102136 -0700
+++ linux-2.6.11-rc1-u64/drivers/ide/pci/pdc202xx_new.c	2005-01-13 12:25:38.448121512 -0700
@@ -277,7 +277,7 @@
 	if (dev->resource[PCI_ROM_RESOURCE].start) {
 		pci_write_config_dword(dev, PCI_ROM_ADDRESS,
 			dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-		printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n",
+		printk(KERN_INFO "%s: ROM enabled at 0x%" U64FMT "\n",
 			name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 
diff -Naur linux-2.6.11-rc1/drivers/ide/pci/pdc202xx_old.c linux-2.6.11-rc1-u64/drivers/ide/pci/pdc202xx_old.c
--- linux-2.6.11-rc1/drivers/ide/pci/pdc202xx_old.c	2005-01-13 14:39:56.562101984 -0700
+++ linux-2.6.11-rc1-u64/drivers/ide/pci/pdc202xx_old.c	2005-01-13 12:26:00.655745440 -0700
@@ -528,7 +528,7 @@
 	if (dev->resource[PCI_ROM_RESOURCE].start) {
 		pci_write_config_dword(dev, PCI_ROM_ADDRESS,
 			dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
-		printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n",
+		printk(KERN_INFO "%s: ROM enabled at 0x%" U64FMT "\n",
 			name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 

diff -Naur linux-2.6.11-rc1/drivers/serial/8250_pci.c linux-2.6.11-rc1-u64/drivers/serial/8250_pci.c
--- linux-2.6.11-rc1/drivers/serial/8250_pci.c	2004-12-24 14:35:23.000000000 -0700
+++ linux-2.6.11-rc1-u64/drivers/serial/8250_pci.c	2005-01-13 11:45:41.841461104 -0700
@@ -589,8 +589,19 @@
 	else
 		offset += idx * board->uart_offset;
 
+	/*
+	 * FIXME: apparently ia32 does not have u64 divide implementation
+	 * we cast the pci_resource_len to u32 for the time being
+	 * this probably should be fixed to support u64 for ia32
+	 * and other archs that do not have u64 divide 
+	 */
+#if BIS_PER_LONG == 64	
 	maxnr = (pci_resource_len(dev, bar) - board->first_offset) /
 		(8 << board->reg_shift);
+#else
+	maxnr = ((u32)pci_resource_len(dev, bar) - board->first_offset) /
+		(8 << board->reg_shift);
+#endif	
 
 	if (board->flags & FL_REGION_SZ_CAP && idx >= maxnr)
 		return 1;
diff -Naur linux-2.6.11-rc1/drivers/video/console/vgacon.c linux-2.6.11-rc1-u64/drivers/video/console/vgacon.c
--- linux-2.6.11-rc1/drivers/video/console/vgacon.c	2005-01-13 14:40:05.305772744 -0700
+++ linux-2.6.11-rc1-u64/drivers/video/console/vgacon.c	2005-01-13 11:45:41.842460952 -0700
@@ -190,7 +190,7 @@
 		vga_video_port_val = VGA_CRT_DM;
 		if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) {
 			static struct resource ega_console_resource =
-			    { "ega", 0x3B0, 0x3BF };
+			    { .name = "ega", .start = 0x3B0, .end = 0x3BF };
 			vga_video_type = VIDEO_TYPE_EGAM;
 			vga_vram_end = 0xb8000;
 			display_desc = "EGA+";
@@ -198,9 +198,9 @@
 					 &ega_console_resource);
 		} else {
 			static struct resource mda1_console_resource =
-			    { "mda", 0x3B0, 0x3BB };
+			    { .name = "mda", .start = 0x3B0, .end = 0x3BB };
 			static struct resource mda2_console_resource =
-			    { "mda", 0x3BF, 0x3BF };
+			    { .name = "mda", .start = 0x3BF, .end = 0x3BF };
 			vga_video_type = VIDEO_TYPE_MDA;
 			vga_vram_end = 0xb2000;
 			display_desc = "*MDA";
@@ -223,14 +223,14 @@
 
 			if (!ORIG_VIDEO_ISVGA) {
 				static struct resource ega_console_resource
-				    = { "ega", 0x3C0, 0x3DF };
+				    = { .name = "ega", .start = 0x3C0, .end = 0x3DF };
 				vga_video_type = VIDEO_TYPE_EGAC;
 				display_desc = "EGA";
 				request_resource(&ioport_resource,
 						 &ega_console_resource);
 			} else {
 				static struct resource vga_console_resource
-				    = { "vga+", 0x3C0, 0x3DF };
+				    = { .name = "vga+", .start = 0x3C0, .end = 0x3DF };
 				vga_video_type = VIDEO_TYPE_VGAC;
 				display_desc = "VGA+";
 				request_resource(&ioport_resource,
@@ -274,7 +274,7 @@
 			}
 		} else {
 			static struct resource cga_console_resource =
-			    { "cga", 0x3D4, 0x3D5 };
+			    { .name = "cga", .start = 0x3D4, .end = 0x3D5 };
 			vga_video_type = VIDEO_TYPE_CGA;
 			vga_vram_end = 0xba000;
 			display_desc = "*CGA";

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/5] Convert resource to u64 from unsigned long
  2005-01-13 23:28 [PATCH 2/5] Convert resource to u64 from unsigned long Dave
@ 2005-01-14  5:48 ` Andreas Dilger
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Dilger @ 2005-01-14  5:48 UTC (permalink / raw)
  To: Dave
  Cc: akpm, torvalds, linux-kernel, smaurer, linux, dsaxena,
	drew.moseley, mporter

[-- Attachment #1: Type: text/plain, Size: 1334 bytes --]

On Jan 13, 2005  16:28 -0700, Dave wrote:
> Fixed some of the drivers as example just to get working on i386.
> +     /*
> +      * FIXME: apparently ia32 does not have u64 divide implementation
> +      * we cast the pci_resource_len to u32 for the time being
> +      * this probably should be fixed to support u64 for ia32
> +      * and other archs that do not have u64 divide
> +      */
> +#if BIS_PER_LONG == 64
>       maxnr = (pci_resource_len(dev, bar) - board->first_offset) /
>               (8 << board->reg_shift);
> +#else
> +     maxnr = ((u32)pci_resource_len(dev, bar) - board->first_offset) /
> +             (8 << board->reg_shift);
> +#endif
                                                                                
One of the reasons that ia32 doesn't support 64-bit divide directly is
because it is a big red flag that you are probably doing something wrong.
This is a prime example - why do a divide when you could do a shift:
                                                                                
        maxnr = (pci_resource_len(dev, bar) - board->first_offset) >>
                (board->reg_shift + 3);

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://members.shaw.ca/adilger/             http://members.shaw.ca/golinux/


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-14  5:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-13 23:28 [PATCH 2/5] Convert resource to u64 from unsigned long Dave
2005-01-14  5:48 ` Andreas Dilger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox