All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] export e820 table on x86
@ 2002-11-21  2:00 Dave Hansen
  2002-11-21  2:09 ` Christoph Hellwig
  2002-11-21 22:50 ` Linus Torvalds
  0 siblings, 2 replies; 12+ messages in thread
From: Dave Hansen @ 2002-11-21  2:00 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel Mailing List

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

I stole a patch that Arjan did a while ago, and ported it up to 2.5:
http://www.kernelnewbies.org/kernels/rh80/SOURCES/linux-2.4.0-e820.patch

We need this so avoid making BIOS calls when using kexec.
-- 
Dave Hansen
haveblue@us.ibm.com

[-- Attachment #2: e820info-2.5.48+bk-0.patch --]
[-- Type: text/plain, Size: 3110 bytes --]

diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig
--- a/arch/i386/Kconfig	Wed Nov 20 17:47:54 2002
+++ b/arch/i386/Kconfig	Wed Nov 20 17:47:54 2002
@@ -636,6 +636,11 @@
 	  with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
 	  /dev/cpu/31/cpuid.
 
+config E820_PROC
+	bool 'E820 proc support' 
+	help
+	  This exports the BIOS memory map.  It is used by kexec
+
 config EDD
 	tristate "BIOS Enhanced Disk Drive calls determine boot disk (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
diff -Nru a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
--- a/arch/i386/kernel/Makefile	Wed Nov 20 17:47:54 2002
+++ b/arch/i386/kernel/Makefile	Wed Nov 20 17:47:54 2002
@@ -14,6 +14,7 @@
 obj-y				+= timers/
 obj-$(CONFIG_X86_BIOS_REBOOT)	+= reboot.o
 obj-$(CONFIG_MCA)		+= mca.o
+obj-$(CONFIG_E820_PROC)  	+= e820.o
 obj-$(CONFIG_X86_MSR)		+= msr.o
 obj-$(CONFIG_X86_CPUID)		+= cpuid.o
 obj-$(CONFIG_MICROCODE)		+= microcode.o
diff -Nru a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/i386/kernel/e820.c	Wed Nov 20 17:47:54 2002
@@ -0,0 +1,75 @@
+/* Copyright (c) 2001 Red Hat, Inc. All rights reserved.
+ * This software may be freely redistributed under the terms of the
+ * GNU General Public License.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Arjan van de Ven <arjanv@redhat.com
+ */
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/init.h>      /* for module_init/exit */
+#include <linux/proc_fs.h>
+#include <linux/module.h>
+#include <linux/version.h>
+#include <linux/types.h>
+
+#include <asm/e820.h>
+
+extern struct e820map e820;
+struct proc_dir_entry *e820_proc_entry;
+
+static int e820_proc_output(char *buffer, int bufsize)
+{
+        int i,bufpos=0;
+
+        for (i = 0; i < e820.nr_map; i++) {
+		/* FIXME: check for overflow */
+                bufpos += sprintf(buffer+bufpos,"%016Lx @ %016Lx ", 
+                        e820.map[i].size, e820.map[i].addr);
+		bufpos += sprintf(buffer+bufpos," %lu\n", e820.map[i].type);
+        }
+	return bufpos;
+}
+
+
+
+
+
+
+static int e820_read_proc(char *page, char **start, off_t off,
+                         int count, int *eof, void *data)
+{
+        int len = e820_proc_output (page,4096);
+        if (len <= off+count) *eof = 1;
+        *start = page + off;
+        len -= off;
+        if (len>count) len = count;
+        if (len<0) len = 0;
+        return len;
+}
+
+int e820_module_init(void)
+{        
+        /* /proc/e820info probably isn't the best place for it, need
+           to find a better one */
+	e820_proc_entry = create_proc_entry ("e820info", 0, NULL);
+	if (e820_proc_entry==NULL)
+		return -EIO;
+
+	e820_proc_entry->read_proc = e820_read_proc;
+	e820_proc_entry->owner = THIS_MODULE;
+
+	return 0;
+}
+
+
+void e820_module_exit(void)
+{
+	 remove_proc_entry ("e820info", e820_proc_entry);
+}
+
+module_init(e820_module_init);
+module_exit(e820_module_exit);
+

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

* Re: [PATCH] export e820 table on x86
  2002-11-21  2:00 [PATCH] export e820 table on x86 Dave Hansen
@ 2002-11-21  2:09 ` Christoph Hellwig
  2002-11-21 21:01   ` Dave Hansen
  2002-11-21 22:50 ` Linus Torvalds
  1 sibling, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2002-11-21  2:09 UTC (permalink / raw)
  To: Dave Hansen; +Cc: Linus Torvalds, Linux Kernel Mailing List

On Wed, Nov 20, 2002 at 06:00:35PM -0800, Dave Hansen wrote:
> I stole a patch that Arjan did a while ago, and ported it up to 2.5:
> http://www.kernelnewbies.org/kernels/rh80/SOURCES/linux-2.4.0-e820.patch
> 
> We need this so avoid making BIOS calls when using kexec.

It should at least use seq_file, and I'm not sure whether it wouldn't
better fit into sysfs (don't ask me where exactly :))


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

* Re: [PATCH] export e820 table on x86
  2002-11-21  2:09 ` Christoph Hellwig
@ 2002-11-21 21:01   ` Dave Hansen
  0 siblings, 0 replies; 12+ messages in thread
From: Dave Hansen @ 2002-11-21 21:01 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Linux Kernel Mailing List

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

Christoph Hellwig wrote:
> On Wed, Nov 20, 2002 at 06:00:35PM -0800, Dave Hansen wrote:
> 
>>I stole a patch that Arjan did a while ago, and ported it up to 2.5:
>>http://www.kernelnewbies.org/kernels/rh80/SOURCES/linux-2.4.0-e820.patch
>>
>>We need this so avoid making BIOS calls when using kexec.
> 
> It should at least use seq_file, and I'm not sure whether it wouldn't
> better fit into sysfs (don't ask me where exactly :))

Better?

-- 
Dave Hansen
haveblue@us.ibm.com

[-- Attachment #2: e820info-2.5.48+bk-3.patch --]
[-- Type: text/plain, Size: 3569 bytes --]

diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig
--- a/arch/i386/Kconfig	Thu Nov 21 12:59:44 2002
+++ b/arch/i386/Kconfig	Thu Nov 21 12:59:44 2002
@@ -636,6 +636,11 @@
 	  with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
 	  /dev/cpu/31/cpuid.
 
+config E820_PROC
+	bool 'E820 proc support' 
+	help
+	  This exports the BIOS memory map.  It is used by kexec
+
 config EDD
 	tristate "BIOS Enhanced Disk Drive calls determine boot disk (EXPERIMENTAL)"
 	depends on EXPERIMENTAL
diff -Nru a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
--- a/arch/i386/kernel/Makefile	Thu Nov 21 12:59:44 2002
+++ b/arch/i386/kernel/Makefile	Thu Nov 21 12:59:44 2002
@@ -14,6 +14,7 @@
 obj-y				+= timers/
 obj-$(CONFIG_X86_BIOS_REBOOT)	+= reboot.o
 obj-$(CONFIG_MCA)		+= mca.o
+obj-$(CONFIG_E820_PROC)  	+= e820.o
 obj-$(CONFIG_X86_MSR)		+= msr.o
 obj-$(CONFIG_X86_CPUID)		+= cpuid.o
 obj-$(CONFIG_MICROCODE)		+= microcode.o
diff -Nru a/arch/i386/kernel/e820.c b/arch/i386/kernel/e820.c
--- /dev/null	Wed Dec 31 16:00:00 1969
+++ b/arch/i386/kernel/e820.c	Thu Nov 21 12:59:44 2002
@@ -0,0 +1,98 @@
+/* Copyright (c) 2001 Red Hat, Inc. All rights reserved.
+ * This software may be freely redistributed under the terms of the
+ * GNU General Public License.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Arjan van de Ven <arjanv@redhat.com
+ * hacked to use seq_file by: Dave Hansen <haveblue@us.ibm.com>
+ */
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/init.h>      /* for module_init/exit */
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+#include <linux/module.h>
+#include <linux/version.h>
+#include <linux/types.h>
+
+#include <asm/e820.h>
+
+static void* e820info_start(struct seq_file *m, loff_t *pos)
+{
+	if ((unsigned long long)*pos < e820.nr_map ) 
+		return (void *)(unsigned long)((*pos)+1);
+	else 
+		return NULL;
+	
+}
+
+static void* e820info_next(struct seq_file *m, void *arg, loff_t *pos)
+{
+	(*pos)++;
+	return e820info_start(m, pos);
+}
+
+static int e820info_show(struct seq_file *m, void *arg)
+{
+	unsigned long off = (unsigned long)arg - 1;
+
+	seq_printf(m, "%016Lx @ %016Lx %lu\n",
+			e820.map[off].size, 
+			e820.map[off].addr, 
+			e820.map[off].type);
+			
+	return 0;
+}
+
+static void e820info_stop(struct seq_file *m, void *arg)
+{
+	kfree(m->private);
+	m->private = NULL;
+}
+
+static struct seq_operations e820info_op = {
+	.start = e820info_start,
+	.next = e820info_next,
+	.stop = e820info_stop,
+	.show = e820info_show,
+};
+
+extern struct seq_operations e820info_op;
+static int e820info_open(struct inode *inode, struct file *file)
+{
+	return seq_open(file, &e820info_op);
+}
+static struct file_operations proc_e820info_operations = {
+	.open		= e820info_open,
+	.read		= seq_read,
+	.llseek	 	= seq_lseek,
+	.release	= seq_release,
+};
+
+extern struct e820map e820;
+struct proc_dir_entry *e820_proc_entry;
+
+int e820_module_init(void)
+{	
+	/* /proc/e820info probably isn't the best place for it, need
+	   to find a better one */
+	e820_proc_entry = create_proc_entry ("e820info", 0, NULL);
+	if (e820_proc_entry==NULL)
+		return -EIO;
+
+	e820_proc_entry->owner = THIS_MODULE;
+	e820_proc_entry->proc_fops = &proc_e820info_operations;
+
+	return 0;
+}
+
+void e820_module_exit(void)
+{
+	 remove_proc_entry ("e820info", e820_proc_entry);
+}
+
+module_init(e820_module_init);
+module_exit(e820_module_exit);
+

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

* Re: [PATCH] export e820 table on x86
  2002-11-21  2:00 [PATCH] export e820 table on x86 Dave Hansen
  2002-11-21  2:09 ` Christoph Hellwig
@ 2002-11-21 22:50 ` Linus Torvalds
  2002-11-21 23:46   ` Dave Hansen
  1 sibling, 1 reply; 12+ messages in thread
From: Linus Torvalds @ 2002-11-21 22:50 UTC (permalink / raw)
  To: Dave Hansen; +Cc: Linux Kernel Mailing List


On Wed, 20 Nov 2002, Dave Hansen wrote:
>
> I stole a patch that Arjan did a while ago, and ported it up to 2.5:
> http://www.kernelnewbies.org/kernels/rh80/SOURCES/linux-2.4.0-e820.patch
> 
> We need this so avoid making BIOS calls when using kexec.

Hmm.. So

 - why isn't the info in /proc/iomem good enough - ie wouldn't it be 
   better to just extend resource handling to 64 bit instead of
   creating a new file.

 - please use the seq_file interfaces for new files if you do end up 
   creating new files.

		Linus


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

* Re: [PATCH] export e820 table on x86
  2002-11-21 22:50 ` Linus Torvalds
@ 2002-11-21 23:46   ` Dave Hansen
  2002-11-22  0:04     ` Linus Torvalds
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Hansen @ 2002-11-21 23:46 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel Mailing List, Eric W. Biederman

Linus Torvalds wrote:
> On Wed, 20 Nov 2002, Dave Hansen wrote:
> 
>>I stole a patch that Arjan did a while ago, and ported it up to 2.5:
>>http://www.kernelnewbies.org/kernels/rh80/SOURCES/linux-2.4.0-e820.patch
>>
>>We need this so avoid making BIOS calls when using kexec.
> 
>  - why isn't the info in /proc/iomem good enough - ie wouldn't it be 
>    better to just extend resource handling to 64 bit instead of
>    creating a new file.

It looks good enough.  The only irritating part is turning the "S3 
Inc. Trio 64 3D" or "ACPI Tables" back into the numberic e820 type.  I 
accomplished this in the previous patch by removing the printing of 
the name completely.  I thought it was silly to have the kernel 
printing out a pretty name just to have the userspace program parse it 
back into a number.  It saved a bug hunk of code in both the kernel 
and the kexec utility to skip the name.

What would you think of just adding another field to /proc/iomem which 
contains the e820 field type?  I've never seen any userspace use of 
iomem, but I would imagine that things like kudzu use it.  I wonder if 
they'll get tripped up if
50000000-50000fff : Texas Instruments PCI1450
changes into something like
50000000-50000fff : 2 : Texas Instruments PCI1450

>  - please use the seq_file interfaces for new files if you do end up 
>    creating new files.

I posted one this morning.

-- 
Dave Hansen
haveblue@us.ibm.com


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

* Re: [PATCH] export e820 table on x86
  2002-11-21 23:46   ` Dave Hansen
@ 2002-11-22  0:04     ` Linus Torvalds
  2002-11-22  0:53       ` H. Peter Anvin
                         ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Linus Torvalds @ 2002-11-22  0:04 UTC (permalink / raw)
  To: Dave Hansen; +Cc: Linux Kernel Mailing List, Eric W. Biederman


On Thu, 21 Nov 2002, Dave Hansen wrote:
> > 
> >  - why isn't the info in /proc/iomem good enough - ie wouldn't it be 
> >    better to just extend resource handling to 64 bit instead of
> >    creating a new file.
> 
> It looks good enough.  The only irritating part is turning the "S3 
> Inc. Trio 64 3D" or "ACPI Tables" back into the numberic e820 type.

Actually, those aren't part of the e820 map at all - Linux gets those from 
doing PCI probing, since the e820 table does not itself tell _what_ the 
resources are allocated for.

> What would you think of just adding another field to /proc/iomem which 
> contains the e820 field type?

Actually, it's already there, to some degree. See the case statement in	
register_memory() in arch/i386/kernel/setup.c, and see how all the e820 
information percolates down from the e820 array into a simple 
"request_resource()".

See also how we artificially only show 32-bit resources, because "struct
resource" uses "unsigned long". That's a design mistake, and it _should_
be "u64" (this actually could cause problems already on 64-bit PCI on
32-bit hosts, although it appears that nobody even tries to map devices
past the 4GB area anyway), but I've never had a test-case for fixing it
and seeing any difference.

In other words, I would suggest you fix that 64-bit issue, remove the
artificial limiting in setup.c, extend the "case" statement to cover any
cases you're interested in, and test it on something with >4GB of memory
to see that it works, and I'll be more than happy to take it.

Please?

		Linus


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

* Re: [PATCH] export e820 table on x86
  2002-11-22  0:04     ` Linus Torvalds
@ 2002-11-22  0:53       ` H. Peter Anvin
  2002-11-22  6:20       ` Eric W. Biederman
  2002-11-22  7:50       ` Dave Hansen
  2 siblings, 0 replies; 12+ messages in thread
From: H. Peter Anvin @ 2002-11-22  0:53 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <Pine.LNX.4.44.0211211556340.5779-100000@penguin.transmeta.com>
By author:    Linus Torvalds <torvalds@transmeta.com>
In newsgroup: linux.dev.kernel
> 
> See also how we artificially only show 32-bit resources, because "struct
> resource" uses "unsigned long". That's a design mistake, and it _should_
> be "u64" (this actually could cause problems already on 64-bit PCI on
> 32-bit hosts, although it appears that nobody even tries to map devices
> past the 4GB area anyway), but I've never had a test-case for fixing it
> and seeing any difference.
> 

Perhaps an abstract type, like resaddr_t, would make more sense?  That
way we'll have less of an issue when the next category of weird system
architecture comes along, which may want some kind of node-based
addressing, who knows...

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<amsp@zytor.com>

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

* Re: [PATCH] export e820 table on x86
  2002-11-22  0:04     ` Linus Torvalds
  2002-11-22  0:53       ` H. Peter Anvin
@ 2002-11-22  6:20       ` Eric W. Biederman
  2002-11-22  7:50       ` Dave Hansen
  2 siblings, 0 replies; 12+ messages in thread
From: Eric W. Biederman @ 2002-11-22  6:20 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Dave Hansen, Linux Kernel Mailing List

Linus Torvalds <torvalds@transmeta.com> writes:
> 
> In other words, I would suggest you fix that 64-bit issue, remove the
> artificial limiting in setup.c, extend the "case" statement to cover any
> cases you're interested in, and test it on something with >4GB of memory
> to see that it works, and I'll be more than happy to take it.

Sounds like a plan.  If Dave doesn't get to it I will take a look, at
it.  It's a nice clean way of getting the information out of the
kernel, and it is already there.

Eric


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

* Re: [PATCH] export e820 table on x86
  2002-11-22  0:04     ` Linus Torvalds
  2002-11-22  0:53       ` H. Peter Anvin
  2002-11-22  6:20       ` Eric W. Biederman
@ 2002-11-22  7:50       ` Dave Hansen
  2002-11-22  8:00         ` Linus Torvalds
  2 siblings, 1 reply; 12+ messages in thread
From: Dave Hansen @ 2002-11-22  7:50 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel Mailing List, Eric W. Biederman

Linus Torvalds wrote:
>>What would you think of just adding another field to /proc/iomem which 
>>contains the e820 field type?
> 
> Actually, it's already there, to some degree. See the case statement in	
> register_memory() in arch/i386/kernel/setup.c, and see how all the e820 
> information percolates down from the e820 array into a simple 
> "request_resource()".

Ahh, I see how the E820_RAM results in "System RAM" from 
register_memory().  I was just trying to be lazy in the userspace app. 


> In other words, I would suggest you fix that 64-bit issue, remove the
> artificial limiting in setup.c, extend the "case" statement to cover any
> cases you're interested in, and test it on something with >4GB of memory
> to see that it works, and I'll be more than happy to take it.

I've been concentrating on exactly replicating the e820 table from 
when the initial boot happened.  Is this vital, or can we be a bit 
more relaxed once the kernel has already booted once?  Also, it 
appears that one of my entries has gone away by the time that I can 
"cat /proc/iomem"

from bootup:
  BIOS-e820: 0000000000000000 - 000000000009dc00 (usable)
  BIOS-e820: 000000000009dc00 - 00000000000a0000 (reserved)
  BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
  BIOS-e820: 0000000000100000 - 000000003fff9380 (usable)
  BIOS-e820: 000000003fff9380 - 0000000040000000 (ACPI data)
  BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
  BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
  BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved)

I added a " e820" onto the end of each of the cases in 
register_memory().  Where does the "00000000000e0000 - 
0000000000100000 (reserved)" entry go?  I wonder if it is vital to the 
next boot...

0000000000000000-000000000009dbff : System RAM e820
000000000009dc00-000000000009ffff : reserved e820
00000000000a0000-00000000000bffff : Video RAM area
00000000000c0000-00000000000c7fff : Video ROM
00000000000ca000-00000000000cfdff : Extension ROM
00000000000f0000-00000000000fffff : System ROM
0000000000100000-000000003fff937f : System RAM e820
   0000000000100000-000000000027c244 : Kernel code
   000000000027c245-00000000002eb71f : Kernel data
000000003fff9380-000000003fffffff : ACPI Tables e820
00000000ec3fc000-00000000ec3fffff : Alteon Networks Inc. AceNIC
00000000efbfd000-00000000efbfdfff : QLogic Corp. ISP1020 Fast-wide SC
00000000efbfe000-00000000efbfefff : Adaptec AIC-7899P U160/m (#2)
   00000000efbfe000-00000000efbfefff : aic7xxx
00000000efbff000-00000000efbfffff : Adaptec AIC-7899P U160/m
   00000000efbff000-00000000efbfffff : aic7xxx
00000000f0000000-00000000f7ffffff : S3 Inc. Savage 4
00000000feb00000-00000000feb7ffff : S3 Inc. Savage 4
00000000febfe000-00000000febfefff : ServerWorks OSB4/CSB5 USB Contro
00000000febffc00-00000000febffc1f : Advanced Micro Devic 79c970
00000000fec00000-00000000fec00fff : reserved e820
00000000fee00000-00000000fee00fff : reserved e820
00000000fff80000-00000000ffffffff : reserved e820


-- 
Dave Hansen
haveblue@us.ibm.com


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

* Re: [PATCH] export e820 table on x86
  2002-11-22  7:50       ` Dave Hansen
@ 2002-11-22  8:00         ` Linus Torvalds
  2002-11-22 17:17           ` Eric W. Biederman
  0 siblings, 1 reply; 12+ messages in thread
From: Linus Torvalds @ 2002-11-22  8:00 UTC (permalink / raw)
  To: Dave Hansen; +Cc: Linux Kernel Mailing List, Eric W. Biederman


On Thu, 21 Nov 2002, Dave Hansen wrote:
>
>   BIOS-e820: 0000000000000000 - 000000000009dc00 (usable)
>   BIOS-e820: 000000000009dc00 - 00000000000a0000 (reserved)
>   BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
>   BIOS-e820: 0000000000100000 - 000000003fff9380 (usable)
>   BIOS-e820: 000000003fff9380 - 0000000040000000 (ACPI data)
>   BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
>   BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
>   BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved)
> 
> I added a " e820" onto the end of each of the cases in 
> register_memory().  Where does the "00000000000e0000 - 
> 0000000000100000 (reserved)" entry go?

The kernel removes all region claims in the 0xa0000 - 0x100000 area, since 
there are broken bioses that claim there is good memory there even if 
there isn't.

>  I wonder if it is vital to the  next boot...

Nope, the next boot would also just remove it..

		Linus


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

* Re: [PATCH] export e820 table on x86
  2002-11-22  8:00         ` Linus Torvalds
@ 2002-11-22 17:17           ` Eric W. Biederman
  2002-11-22 22:37             ` Dave Hansen
  0 siblings, 1 reply; 12+ messages in thread
From: Eric W. Biederman @ 2002-11-22 17:17 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Dave Hansen, Linux Kernel Mailing List

Linus Torvalds <torvalds@transmeta.com> writes:

> On Thu, 21 Nov 2002, Dave Hansen wrote:
> >
> >   BIOS-e820: 0000000000000000 - 000000000009dc00 (usable)
> >   BIOS-e820: 000000000009dc00 - 00000000000a0000 (reserved)
> >   BIOS-e820: 00000000000e0000 - 0000000000100000 (reserved)
> >   BIOS-e820: 0000000000100000 - 000000003fff9380 (usable)
> >   BIOS-e820: 000000003fff9380 - 0000000040000000 (ACPI data)
> >   BIOS-e820: 00000000fec00000 - 00000000fec01000 (reserved)
> >   BIOS-e820: 00000000fee00000 - 00000000fee01000 (reserved)
> >   BIOS-e820: 00000000fff80000 - 0000000100000000 (reserved)
> > 
> > I added a " e820" onto the end of each of the cases in 
> > register_memory().  Where does the "00000000000e0000 - 
> > 0000000000100000 (reserved)" entry go?

Dave please don't keep the "e820" appending in the final patch.
 
> The kernel removes all region claims in the 0xa0000 - 0x100000 area, since 
> there are broken bioses that claim there is good memory there even if 
> there isn't.

And I have at least one system that actually has useable memory there.
But it is running LinuxBIOS which makes that an entirely different
problem is this regard.  
 
> >  I wonder if it is vital to the  next boot...
> 
> Nope, the next boot would also just remove it..

To be clear all that is really critical is getting the entries marked
System RAM/(useable). The kernel really does not use the rest.  And
while it may be nice to do better, it is not necessary.

As a first pass, all that is needed is we come close enough to the
true amount of ram that peoples machines don't become unuseable,
and that repeated invocations don't make the situation worse.

The kernel is an abstraction layer, and the BIOS is an abstraction
layer.  I don't expect to exactly, or trivially replicate what the
BIOS reports with the kernels abstraction layer.  Instead I intend to
do well enough, so the loaded kernel is useable.  Eventually it may be
worth letting the kernel know this information came from another
kernel and not the BIOS.  But we don't need that currently.

Eric

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

* Re: [PATCH] export e820 table on x86
  2002-11-22 17:17           ` Eric W. Biederman
@ 2002-11-22 22:37             ` Dave Hansen
  0 siblings, 0 replies; 12+ messages in thread
From: Dave Hansen @ 2002-11-22 22:37 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Linus Torvalds, Linux Kernel Mailing List

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

Here's take one of the 64-bit resources.  resource->flags seems to be 
used often to mask out things in resource->start/end, so I think it 
needs to be u64 too.  But, Is it all right to let things like 
pcibios_update_resource() truncate the resource addresses like they do?

With my config, it has no more warnings than it did before.

Here's /proc/iomem from a 16-gig ia32 box with the patch:

0000000000000000-000000000009c7ff : System RAM
000000000009c800-000000000009ffff : reserved
00000000000a0000-00000000000bffff : Video RAM area
00000000000c0000-00000000000c7fff : Video ROM
00000000000c8000-00000000000cc7ff : Extension ROM
00000000000cc800-00000000000d47ff : Extension ROM
00000000000d4800-00000000000d5fff : Extension ROM
00000000000f0000-00000000000fffff : System ROM
0000000000100000-00000000efff64ff : System RAM
   0000000000100000-000000000029fe78 : Kernel code
   000000000029fe79-0000000000395d7f : Kernel data
00000000efff6500-00000000efffffff : ACPI Tables
00000000f8000000-00000000fbffffff : S3 Inc. Trio 64 3D
00000000fc1e0000-00000000fc1effff : PCI device 1014:00dc (IBM)
00000000fc1fd000-00000000fc1fdfff : Adaptec AIC-7896U2/7897U2 (#2)
   00000000fc1fd000-00000000fc1fdfff : aic7xxx
00000000fc1fe000-00000000fc1fefff : Adaptec AIC-7896U2/7897U2
   00000000fc1fe000-00000000fc1fefff : aic7xxx
00000000fc1ffc00-00000000fc1ffcff : PCI device 1014:00dc (IBM)
00000000fd7c0000-00000000fd7dffff : Intel Corp. 82557/8/9 [Ethernet
00000000fd7fcc00-00000000fd7fcc7f : Digital Equipment Co DECchip 21140
   00000000fd7fcc00-00000000fd7fcc7f : tulip
00000000fd7fd000-00000000fd7fdfff : Intel Corp. 82557/8/9 [Ethernet
   00000000fd7fd000-00000000fd7fdfff : eepro100
00000000fd7fe000-00000000fd7fffff : IBM Netfinity ServeRAID
   00000000fd7fe000-00000000fd7fffff : ips
00000000fe1c0000-00000000fe1dffff : Intel Corp. 82546EB Gigabit Ethe
   00000000fe1c0000-00000000fe1dffff : e1000
00000000fe1e0000-00000000fe1fffff : Intel Corp. 82546EB Gigabit Ethe
   00000000fe1e0000-00000000fe1fffff : e1000
00000000fffb0000-00000000ffffffff : reserved
0000000100000000-00000003ffffffff : System RAM



-- 
Dave Hansen
haveblue@us.ibm.com

[-- Attachment #2: 64-bit-resource-2.5.49-0.patch --]
[-- Type: text/plain, Size: 34877 bytes --]

diff -Nru a/arch/alpha/kernel/pci.c b/arch/alpha/kernel/pci.c
--- a/arch/alpha/kernel/pci.c	Fri Nov 22 14:32:09 2002
+++ b/arch/alpha/kernel/pci.c	Fri Nov 22 14:32:09 2002
@@ -149,12 +149,12 @@
 
 void
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
 	struct pci_dev *dev = data;
 	struct pci_controller *hose = dev->sysdata;
-	unsigned long alignto;
-	unsigned long start = res->start;
+	u64 alignto;
+	u64 start = res->start;
 
 	if (res->flags & IORESOURCE_IO) {
 		/* Make sure we start at our min on all hoses */
diff -Nru a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
--- a/arch/arm/kernel/bios32.c	Fri Nov 22 14:32:09 2002
+++ b/arch/arm/kernel/bios32.c	Fri Nov 22 14:32:09 2002
@@ -268,7 +268,7 @@
 	int reg;
 
 	if (debug_pci)
-		printk("PCI: Assigning %3s %08lx to %s\n",
+		printk("PCI: Assigning %3s %016Lx to %s\n",
 			res->flags & IORESOURCE_IO ? "IO" : "MEM",
 			res->start, dev->dev.name);
 
@@ -585,9 +585,9 @@
  * which might be mirrored at 0x0100-0x03ff..
  */
 void pcibios_align_resource(void *data, struct resource *res,
-			    unsigned long size, unsigned long align)
+			    u64 size, u64 align)
 {
-	unsigned long start = res->start;
+	u64 start = res->start;
 
 	if (res->flags & IORESOURCE_IO && start & 0x300)
 		start = (start + 0x3ff) & ~0x3ff;
diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
--- a/arch/i386/kernel/setup.c	Fri Nov 22 14:32:10 2002
+++ b/arch/i386/kernel/setup.c	Fri Nov 22 14:32:10 2002
@@ -798,15 +798,18 @@
 	probe_roms();
 	for (i = 0; i < e820.nr_map; i++) {
 		struct resource *res;
-		if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL)
-			continue;
+		
+		//if (e820.map[i].addr + e820.map[i].size > 0x100000000ULL)
+		//	continue;
+	
 		res = alloc_bootmem_low(sizeof(struct resource));
 		switch (e820.map[i].type) {
-		case E820_RAM:	res->name = "System RAM"; break;
-		case E820_ACPI:	res->name = "ACPI Tables"; break;
-		case E820_NVS:	res->name = "ACPI Non-volatile Storage"; break;
-		default:	res->name = "reserved";
+		case E820_RAM:	res->name = "System RAM e820"; break;
+		case E820_ACPI:	res->name = "ACPI Tables e820"; break;
+		case E820_NVS:	res->name = "ACPI Non-volatile Storage e820"; break;
+		default:	res->name = "reserved e820";
 		}
+		res->type = e820.map[i].type;
 		res->start = e820.map[i].addr;
 		res->end = res->start + e820.map[i].size - 1;
 		res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
diff -Nru a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c
--- a/arch/i386/pci/i386.c	Fri Nov 22 14:32:09 2002
+++ b/arch/i386/pci/i386.c	Fri Nov 22 14:32:09 2002
@@ -76,10 +76,10 @@
  */
 void
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
 	if (res->flags & IORESOURCE_IO) {
-		unsigned long start = res->start;
+		u64 start = res->start;
 
 		if (start & 0x300) {
 			start = (start + 0x3ff) & ~0x3ff;
@@ -167,7 +167,7 @@
 			else
 				disabled = !(command & PCI_COMMAND_MEMORY);
 			if (pass == disabled) {
-				DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n",
+				DBG("PCI: Resource %016Lx-%016Lx (f=%Lx, d=%d, p=%d)\n",
 				    r->start, r->end, r->flags, disabled, pass);
 				pr = pci_find_parent_resource(dev, r);
 				if (!pr || request_resource(pr, r) < 0) {
diff -Nru a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
--- a/arch/ia64/pci/pci.c	Fri Nov 22 14:32:09 2002
+++ b/arch/ia64/pci/pci.c	Fri Nov 22 14:32:09 2002
@@ -151,7 +151,8 @@
 pcibios_update_resource (struct pci_dev *dev, struct resource *root,
 			 struct resource *res, int resource)
 {
-	unsigned long where, size;
+	unsigned long where
+	u64 size;
 	u32 reg;
 
 	where = PCI_BASE_ADDRESS_0 + (resource * 4);
@@ -229,7 +230,7 @@
 
 void
 pcibios_align_resource (void *data, struct resource *res,
-		        unsigned long size, unsigned long align)
+		        u64 size, u64 align)
 {
 }
 
diff -Nru a/arch/mips/ddb5074/pci.c b/arch/mips/ddb5074/pci.c
--- a/arch/mips/ddb5074/pci.c	Fri Nov 22 14:32:10 2002
+++ b/arch/mips/ddb5074/pci.c	Fri Nov 22 14:32:10 2002
@@ -373,12 +373,12 @@
 }
 
 void pcibios_align_resource(void *data, struct resource *res,
-			    unsigned long size, unsigned long align)
+			    u64 size, u64 align)
 {
 	struct pci_dev *dev = data;
 
 	if (res->flags & IORESOURCE_IO) {
-		unsigned long start = res->start;
+		u64 start = res->start;
 
 		/* We need to avoid collisions with `mirrored' VGA ports
 		   and other strange ISA hardware, so we always want the
diff -Nru a/arch/mips/ddb5476/pci.c b/arch/mips/ddb5476/pci.c
--- a/arch/mips/ddb5476/pci.c	Fri Nov 22 14:32:09 2002
+++ b/arch/mips/ddb5476/pci.c	Fri Nov 22 14:32:09 2002
@@ -431,12 +431,12 @@
 }
 
 void pcibios_align_resource(void *data, struct resource *res,
-			    unsigned long size, unsigned long align)
+			    u64 size, u64 align)
 {
 	struct pci_dev *dev = data;
 
 	if (res->flags & IORESOURCE_IO) {
-		unsigned long start = res->start;
+		u64 start = res->start;
 
 		/* We need to avoid collisions with `mirrored' VGA ports
 		   and other strange ISA hardware, so we always want the
diff -Nru a/arch/mips/ddb5xxx/common/pci.c b/arch/mips/ddb5xxx/common/pci.c
--- a/arch/mips/ddb5xxx/common/pci.c	Fri Nov 22 14:32:10 2002
+++ b/arch/mips/ddb5xxx/common/pci.c	Fri Nov 22 14:32:10 2002
@@ -165,7 +165,7 @@
 
 void
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
 	/* this should not be called */
 	MIPS_ASSERT(1 == 0);
diff -Nru a/arch/mips/gt64120/common/pci.c b/arch/mips/gt64120/common/pci.c
--- a/arch/mips/gt64120/common/pci.c	Fri Nov 22 14:32:10 2002
+++ b/arch/mips/gt64120/common/pci.c	Fri Nov 22 14:32:10 2002
@@ -819,12 +819,12 @@
 }
 
 void pcibios_align_resource(void *data, struct resource *res,
-			    unsigned long size, unsigned long align)
+			    u64 size, u64 align)
 {
 	struct pci_dev *dev = data;
 
 	if (res->flags & IORESOURCE_IO) {
-		unsigned long start = res->start;
+		u64 start = res->start;
 
 		/* We need to avoid collisions with `mirrored' VGA ports
 		   and other strange ISA hardware, so we always want the
diff -Nru a/arch/mips/ite-boards/generic/it8172_pci.c b/arch/mips/ite-boards/generic/it8172_pci.c
--- a/arch/mips/ite-boards/generic/it8172_pci.c	Fri Nov 22 14:32:10 2002
+++ b/arch/mips/ite-boards/generic/it8172_pci.c	Fri Nov 22 14:32:10 2002
@@ -183,7 +183,7 @@
 
 void __init
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
     printk("pcibios_align_resource\n");
 }
diff -Nru a/arch/mips/kernel/pci.c b/arch/mips/kernel/pci.c
--- a/arch/mips/kernel/pci.c	Fri Nov 22 14:32:10 2002
+++ b/arch/mips/kernel/pci.c	Fri Nov 22 14:32:10 2002
@@ -162,7 +162,7 @@
 
 void
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
 	/* this should not be called */
 }
diff -Nru a/arch/mips/mips-boards/generic/pci.c b/arch/mips/mips-boards/generic/pci.c
--- a/arch/mips/mips-boards/generic/pci.c	Fri Nov 22 14:32:09 2002
+++ b/arch/mips/mips-boards/generic/pci.c	Fri Nov 22 14:32:09 2002
@@ -232,7 +232,7 @@
 
 void __init
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
 }
 
diff -Nru a/arch/mips/sni/pci.c b/arch/mips/sni/pci.c
--- a/arch/mips/sni/pci.c	Fri Nov 22 14:32:10 2002
+++ b/arch/mips/sni/pci.c	Fri Nov 22 14:32:10 2002
@@ -180,7 +180,7 @@
 
 void __init
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
 }
 
diff -Nru a/arch/mips64/mips-boards/generic/pci.c b/arch/mips64/mips-boards/generic/pci.c
--- a/arch/mips64/mips-boards/generic/pci.c	Fri Nov 22 14:32:09 2002
+++ b/arch/mips64/mips-boards/generic/pci.c	Fri Nov 22 14:32:09 2002
@@ -291,7 +291,7 @@
 
 void __init
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
 }
 
diff -Nru a/arch/mips64/sgi-ip27/ip27-pci.c b/arch/mips64/sgi-ip27/ip27-pci.c
--- a/arch/mips64/sgi-ip27/ip27-pci.c	Fri Nov 22 14:32:10 2002
+++ b/arch/mips64/sgi-ip27/ip27-pci.c	Fri Nov 22 14:32:10 2002
@@ -249,7 +249,7 @@
 
 void __init
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
 }
 
diff -Nru a/arch/mips64/sgi-ip32/ip32-pci.c b/arch/mips64/sgi-ip32/ip32-pci.c
--- a/arch/mips64/sgi-ip32/ip32-pci.c	Fri Nov 22 14:32:10 2002
+++ b/arch/mips64/sgi-ip32/ip32-pci.c	Fri Nov 22 14:32:10 2002
@@ -329,7 +329,7 @@
 }
 
 void __init pcibios_align_resource (void *data, struct resource *res,
-				    unsigned long size, unsigned long align)
+				    u64 size, u64 align)
 {
 }
 
diff -Nru a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
--- a/arch/parisc/kernel/pci.c	Fri Nov 22 14:32:09 2002
+++ b/arch/parisc/kernel/pci.c	Fri Nov 22 14:32:09 2002
@@ -392,11 +392,11 @@
 */
 void __devinit
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long alignment)
+		       u64 size, u64 alignment)
 {
-	unsigned long mask, align;
+	u64 mask, align;
 
-	DBG_RES("pcibios_align_resource(%s, (%p) [%lx,%lx]/%x, 0x%lx, 0x%lx)\n",
+	DBG_RES("pcibios_align_resource(%s, (%p) [%Lx,%Lx]/%Lx, 0x%Lx, 0x%Lx)\n",
 		((struct pci_dev *) data)->slot_name,
 		res->parent, res->start, res->end,
 		(int) res->flags, size, alignment);
diff -Nru a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
--- a/arch/ppc/kernel/pci.c	Fri Nov 22 14:32:09 2002
+++ b/arch/ppc/kernel/pci.c	Fri Nov 22 14:32:09 2002
@@ -128,7 +128,7 @@
 		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
 		       new, check);
 	}
-	printk(KERN_INFO "PCI: moved device %s resource %d (%lx) to %x\n",
+	printk(KERN_INFO "PCI: moved device %s resource %d (%Lx) to %x\n",
 	       dev->slot_name, resource, res->flags,
 	       new & ~PCI_REGION_FLAG_MASK);
 }
@@ -149,7 +149,7 @@
 		if (!res->flags)
 			continue;
 		if (!res->start || res->end == 0xffffffff) {
-			DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n",
+			DBG("PCI:%s Resource %d [%016Lx-%016Lx] is unassigned\n",
 			    dev->slot_name, i, res->start, res->end);
 			res->end -= res->start;
 			res->start = 0;
@@ -167,7 +167,7 @@
 			res->start += offset;
 			res->end += offset;
 #ifdef DEBUG
-			printk("Fixup res %d (%lx) of dev %s: %lx -> %lx\n",
+			printk("Fixup res %d (%Lx) of dev %s: %Lx -> %Lx\n",
 			       i, res->flags, dev->slot_name,
 			       res->start - offset, res->start);
 #endif
@@ -230,17 +230,17 @@
  * which might have be mirrored at 0x0100-0x03ff..
  */
 void
-pcibios_align_resource(void *data, struct resource *res, unsigned long size,
-		       unsigned long align)
+pcibios_align_resource(void *data, struct resource *res, u64 size,
+		       u64 align)
 {
 	struct pci_dev *dev = data;
 
 	if (res->flags & IORESOURCE_IO) {
-		unsigned long start = res->start;
+		u64 start = res->start;
 
 		if (size > 0x100) {
-			printk(KERN_ERR "PCI: I/O Region %s/%d too large"
-			       " (%ld bytes)\n", dev->slot_name,
+			printk(KERN_ERR "PCI: I/O Region %s/%Ld too large"
+			       " (%Ld bytes)\n", dev->slot_name,
 			       dev->resource - res, size);
 		}
 
@@ -314,7 +314,7 @@
 				}
 			}
 
-			DBG("PCI: bridge rsrc %lx..%lx (%lx), parent %p\n",
+			DBG("PCI: bridge rsrc %Lx..%Lx (%Lx), parent %p\n",
 			    res->start, res->end, res->flags, pr);
 			if (pr) {
 				if (request_resource(pr, res) == 0)
@@ -419,12 +419,12 @@
 		try = conflict->start - 1;
 	}
 	if (request_resource(pr, res)) {
-		DBG(KERN_ERR "PCI: huh? couldn't move to %lx..%lx\n",
+		DBG(KERN_ERR "PCI: huh? couldn't move to %Lx..%Lx\n",
 		    res->start, res->end);
 		return -1;		/* "can't happen" */
 	}
 	update_bridge_base(bus, i);
-	printk(KERN_INFO "PCI: bridge %d resource %d moved to %lx..%lx\n",
+	printk(KERN_INFO "PCI: bridge %d resource %d moved to %Lx..%Lx\n",
 	       bus->number, i, res->start, res->end);
 	return 0;
 }
@@ -485,7 +485,8 @@
 	u8 io_base_lo, io_limit_lo;
 	u16 mem_base, mem_limit;
 	u16 cmd;
-	unsigned long start, end, off;
+	u64 start, end;
+	unsigned long off;
 	struct pci_dev *dev = bus->self;
 	struct pci_controller *hose = dev->sysdata;
 
@@ -530,7 +531,7 @@
 		pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, mem_limit);
 
 	} else {
-		DBG(KERN_ERR "PCI: ugh, bridge %s res %d has flags=%lx\n",
+		DBG(KERN_ERR "PCI: ugh, bridge %s res %d has flags=%Lx\n",
 		    dev->slot_name, i, res->flags);
 	}
 	pci_write_config_word(dev, PCI_COMMAND, cmd);
@@ -540,14 +541,14 @@
 {
 	struct resource *pr, *r = &dev->resource[idx];
 
-	DBG("PCI:%s: Resource %d: %08lx-%08lx (f=%lx)\n",
+	DBG("PCI:%s: Resource %d: %016Lx-%016Lx (f=%Lx)\n",
 	    dev->slot_name, idx, r->start, r->end, r->flags);
 	pr = pci_find_parent_resource(dev, r);
 	if (!pr || request_resource(pr, r) < 0) {
 		printk(KERN_ERR "PCI: Cannot allocate resource region %d"
 		       " of device %s\n", idx, dev->slot_name);
 		if (pr)
-			DBG("PCI:  parent is %p: %08lx-%08lx (f=%lx)\n",
+			DBG("PCI:  parent is %p: %016Lx-%016Lx (f=%Lx)\n",
 			    pr, pr->start, pr->end, pr->flags);
 		/* We'll assign a new address later */
 		r->flags |= IORESOURCE_UNSET;
diff -Nru a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
--- a/arch/ppc64/kernel/pci.c	Fri Nov 22 14:32:10 2002
+++ b/arch/ppc64/kernel/pci.c	Fri Nov 22 14:32:10 2002
@@ -178,15 +178,15 @@
  */
 void
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
 	struct pci_dev *dev = data;
 
 	if (res->flags & IORESOURCE_IO) {
-		unsigned long start = res->start;
+		u64 start = res->start;
 
 		if (size > 0x100) {
-			printk(KERN_ERR "PCI: Can not align I/O Region %s %s because size %ld is too large.\n",
+			printk(KERN_ERR "PCI: Can not align I/O Region %s %s because size %Ld is too large.\n",
                                         dev->slot_name, res->name, size);
 		}
 
diff -Nru a/arch/sh/kernel/pcibios.c b/arch/sh/kernel/pcibios.c
--- a/arch/sh/kernel/pcibios.c	Fri Nov 22 14:32:09 2002
+++ b/arch/sh/kernel/pcibios.c	Fri Nov 22 14:32:09 2002
@@ -61,10 +61,10 @@
  * modulo 0x400.
  */
 void pcibios_align_resource(void *data, struct resource *res,
-			    unsigned long size, unsigned long align)
+			    u64 size, u64 align)
 {
 	if (res->flags & IORESOURCE_IO) {
-		unsigned long start = res->start;
+		u64 start = res->start;
 
 		if (start & 0x300) {
 			start = (start + 0x3ff) & ~0x3ff;
diff -Nru a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
--- a/arch/sparc/kernel/pcic.c	Fri Nov 22 14:32:10 2002
+++ b/arch/sparc/kernel/pcic.c	Fri Nov 22 14:32:10 2002
@@ -861,7 +861,7 @@
 }
 
 void pcibios_align_resource(void *data, struct resource *res,
-			    unsigned long size, unsigned long align)
+			    u64 size, u64 align)
 {
 }
 
diff -Nru a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
--- a/arch/sparc64/kernel/pci.c	Fri Nov 22 14:32:09 2002
+++ b/arch/sparc64/kernel/pci.c	Fri Nov 22 14:32:09 2002
@@ -485,7 +485,7 @@
 }
 
 void pcibios_align_resource(void *data, struct resource *res,
-			    unsigned long size, unsigned long align)
+			    u64 size, u64 align)
 {
 }
 
diff -Nru a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
--- a/arch/sparc64/kernel/pci_common.c	Fri Nov 22 14:32:09 2002
+++ b/arch/sparc64/kernel/pci_common.c	Fri Nov 22 14:32:09 2002
@@ -270,7 +270,7 @@
 			    ap->phys_hi, ap->phys_mid, ap->phys_lo,
 			    ap->size_hi, ap->size_lo);
 	if (res)
-		prom_printf("PCI: RES[%016lx-->%016lx:(%lx)]\n",
+		prom_printf("PCI: RES[%016lx-->%016lx:(%Lx)]\n",
 			    res->start, res->end, res->flags);
 	prom_printf("Please email this information to davem@redhat.com\n");
 	if (do_prom_halt)
@@ -403,7 +403,7 @@
 			 */
 			if ((res->start >> 32) != 0UL) {
 				printk(KERN_ERR "PCI: OBP assigns out of range MEM address "
-				       "%016lx for region %ld on device %s\n",
+				       "%016Lx for region %ld on device %s\n",
 				       res->start, (res - &pdev->resource[0]), pdev->dev.name);
 				continue;
 			}
diff -Nru a/arch/v850/kernel/rte_mb_a_pci.c b/arch/v850/kernel/rte_mb_a_pci.c
--- a/arch/v850/kernel/rte_mb_a_pci.c	Fri Nov 22 14:32:09 2002
+++ b/arch/v850/kernel/rte_mb_a_pci.c	Fri Nov 22 14:32:09 2002
@@ -339,7 +339,7 @@
 
 void
 pcibios_align_resource (void *data, struct resource *res,
-			unsigned long size, unsigned long align)
+			u64 size, u64 align)
 {
 }
 
diff -Nru a/arch/x86_64/pci/x86-64.c b/arch/x86_64/pci/x86-64.c
--- a/arch/x86_64/pci/x86-64.c	Fri Nov 22 14:32:10 2002
+++ b/arch/x86_64/pci/x86-64.c	Fri Nov 22 14:32:10 2002
@@ -76,10 +76,10 @@
  */
 void
 pcibios_align_resource(void *data, struct resource *res,
-		       unsigned long size, unsigned long align)
+		       u64 size, u64 align)
 {
 	if (res->flags & IORESOURCE_IO) {
-		unsigned long start = res->start;
+		u64 start = res->start;
 
 		if (start & 0x300) {
 			start = (start + 0x3ff) & ~0x3ff;
@@ -167,7 +167,7 @@
 			else
 				disabled = !(command & PCI_COMMAND_MEMORY);
 			if (pass == disabled) {
-				DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n",
+				DBG("PCI: Resource %016Lx-%016Lx (f=%Lx, d=%d, p=%d)\n",
 				    r->start, r->end, r->flags, disabled, pass);
 				pr = pci_find_parent_resource(dev, r);
 				if (!pr || request_resource(pr, r) < 0) {
diff -Nru a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c
--- a/drivers/ide/pci/aec62xx.c	Fri Nov 22 14:32:10 2002
+++ b/drivers/ide/pci/aec62xx.c	Fri Nov 22 14:32:10 2002
@@ -413,7 +413,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("%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
+		printk("%s: ROM enabled at 0x%016Lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 
 #if defined(DISPLAY_AEC62XX_TIMINGS) && defined(CONFIG_PROC_FS)
diff -Nru a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
--- a/drivers/ide/pci/cmd64x.c	Fri Nov 22 14:32:10 2002
+++ b/drivers/ide/pci/cmd64x.c	Fri Nov 22 14:32:10 2002
@@ -606,7 +606,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("%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
+		printk("%s: ROM enabled at 0x%016Lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 #endif
 
diff -Nru a/drivers/ide/pci/hpt34x.c b/drivers/ide/pci/hpt34x.c
--- a/drivers/ide/pci/hpt34x.c	Fri Nov 22 14:32:09 2002
+++ b/drivers/ide/pci/hpt34x.c	Fri Nov 22 14:32:09 2002
@@ -249,7 +249,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%016Lx\n",
 				dev->resource[PCI_ROM_RESOURCE].start);
 		}
 		pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xF0);
diff -Nru a/drivers/ide/pci/pdc202xx_new.c b/drivers/ide/pci/pdc202xx_new.c
--- a/drivers/ide/pci/pdc202xx_new.c	Fri Nov 22 14:32:10 2002
+++ b/drivers/ide/pci/pdc202xx_new.c	Fri Nov 22 14:32:10 2002
@@ -538,7 +538,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("%s: ROM enabled at 0x%08lx\n",
+		printk("%s: ROM enabled at 0x%016Lx\n",
 			name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 
diff -Nru a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
--- a/drivers/ide/pci/pdc202xx_old.c	Fri Nov 22 14:32:10 2002
+++ b/drivers/ide/pci/pdc202xx_old.c	Fri Nov 22 14:32:10 2002
@@ -718,7 +718,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("%s: ROM enabled at 0x%08lx\n",
+		printk("%s: ROM enabled at 0x%016Lx\n",
 			name, dev->resource[PCI_ROM_RESOURCE].start);
 	}
 
diff -Nru a/drivers/net/e100/e100_main.c b/drivers/net/e100/e100_main.c
--- a/drivers/net/e100/e100_main.c	Fri Nov 22 14:32:09 2002
+++ b/drivers/net/e100/e100_main.c	Fri Nov 22 14:32:09 2002
@@ -2986,7 +2986,7 @@
 	bdp->scb = (scb_t *) ioremap_nocache(dev->mem_start, sizeof (scb_t));
 
 	if (!bdp->scb) {
-		printk(KERN_ERR "e100: %s: Failed to map PCI address 0x%lX\n",
+		printk(KERN_ERR "e100: %s: Failed to map PCI address 0x%LX\n",
 		       dev->name, pci_resource_start(pcid, 0));
 		rc = -ENOMEM;
 		goto err_region;
diff -Nru a/drivers/net/eepro100.c b/drivers/net/eepro100.c
--- a/drivers/net/eepro100.c	Fri Nov 22 14:32:10 2002
+++ b/drivers/net/eepro100.c	Fri Nov 22 14:32:10 2002
@@ -621,12 +621,12 @@
 	ioaddr = (unsigned long)ioremap(pci_resource_start(pdev, 0),
 									pci_resource_len(pdev, 0));
 	if (!ioaddr) {
-		printk (KERN_ERR "eepro100: cannot remap MMIO region %lx @ %lx\n",
+		printk (KERN_ERR "eepro100: cannot remap MMIO region %Lx @ %Lx\n",
 				pci_resource_len(pdev, 0), pci_resource_start(pdev, 0));
 		goto err_out_free_mmio_region;
 	}
 	if (DEBUG & NETIF_MSG_PROBE)
-		printk("Found Intel i82557 PCI Speedo, MMIO at %#lx, IRQ %d.\n",
+		printk("Found Intel i82557 PCI Speedo, MMIO at %#Lx, IRQ %d.\n",
 			   pci_resource_start(pdev, 0), irq);
 #endif
 
diff -Nru a/drivers/net/tc35815.c b/drivers/net/tc35815.c
--- a/drivers/net/tc35815.c	Fri Nov 22 14:32:09 2002
+++ b/drivers/net/tc35815.c	Fri Nov 22 14:32:09 2002
@@ -499,7 +499,7 @@
 
 	        pci_memaddr = pci_resource_start (pdev, 1);
 
-	        printk(KERN_INFO "    pci_memaddr=%#08lx  resource_flags=%#08lx\n", pci_memaddr, pci_resource_flags (pdev, 0));
+	        printk(KERN_INFO "    pci_memaddr=%#016Lx  resource_flags=%#016Lx\n", pci_memaddr, pci_resource_flags (pdev, 0));
 
 		if (!pci_memaddr) {
 			printk(KERN_WARNING "no PCI MEM resources, aborting\n");
diff -Nru a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
--- a/drivers/net/tulip/tulip_core.c	Fri Nov 22 14:32:10 2002
+++ b/drivers/net/tulip/tulip_core.c	Fri Nov 22 14:32:10 2002
@@ -1361,7 +1361,7 @@
 	}
 
 	if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) {
-		printk (KERN_ERR PFX "%s: I/O region (0x%lx@0x%lx) too small, "
+		printk (KERN_ERR PFX "%s: I/O region (0x%Lx@0x%Lx) too small, "
 			"aborting\n", pdev->slot_name,
 			pci_resource_len (pdev, 0),
 			pci_resource_start (pdev, 0));
diff -Nru a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
--- a/drivers/parisc/ccio-dma.c	Fri Nov 22 14:32:09 2002
+++ b/drivers/parisc/ccio-dma.c	Fri Nov 22 14:32:09 2002
@@ -1438,7 +1438,7 @@
 	res->name = name;
 	result = request_resource(&iomem_resource, res);
 	if (result < 0) {
-		printk(KERN_ERR "%s: failed to claim CCIO bus address space (%08lx,%08lx)\n", 
+		printk(KERN_ERR "%s: failed to claim CCIO bus address space (%016Lx,%016Lx)\n", 
 		       __FILE__, res->start, res->end);
 	}
 }
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c	Fri Nov 22 14:32:09 2002
+++ b/drivers/pci/pci.c	Fri Nov 22 14:32:09 2002
@@ -500,7 +500,7 @@
 	return 0;
 
 err_out:
-	printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%lx@%lx for device %s\n",
+	printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%Lx@%Lx for device %s\n",
 		pci_resource_flags(pdev, bar) & IORESOURCE_IO ? "I/O" : "mem",
 		bar + 1, /* PCI BAR # */
 		pci_resource_len(pdev, bar), pci_resource_start(pdev, bar),
@@ -549,7 +549,7 @@
 	return 0;
 
 err_out:
-	printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%lx@%lx for device %s\n",
+	printk (KERN_WARNING "PCI: Unable to reserve %s region #%d:%Lx@%Lx for device %s\n",
 		pci_resource_flags(pdev, i) & IORESOURCE_IO ? "I/O" : "mem",
 		i + 1, /* PCI BAR # */
 		pci_resource_len(pdev, i), pci_resource_start(pdev, i),
diff -Nru a/drivers/pci/proc.c b/drivers/pci/proc.c
--- a/drivers/pci/proc.c	Fri Nov 22 14:32:10 2002
+++ b/drivers/pci/proc.c	Fri Nov 22 14:32:10 2002
@@ -299,11 +299,7 @@
 #endif /* HAVE_PCI_MMAP */
 };
 
-#if BITS_PER_LONG == 32
-#define LONG_FORMAT "\t%08lx"
-#else
-#define LONG_FORMAT "\t%16lx"
-#endif
+#define LONG_FORMAT "\t%016Lx"
 
 /* iterator */
 static void *pci_seq_start(struct seq_file *m, loff_t *pos)
diff -Nru a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
--- a/drivers/pci/setup-res.c	Fri Nov 22 14:32:10 2002
+++ b/drivers/pci/setup-res.c	Fri Nov 22 14:32:10 2002
@@ -46,7 +46,7 @@
 		err = request_resource(root, res);
 
 	if (err) {
-		printk(KERN_ERR "PCI: %s region %d of %s %s [%lx:%lx]\n",
+		printk(KERN_ERR "PCI: %s region %d of %s %s [%Lx:%Lx]\n",
 		       root ? "Address space collision on" :
 			      "No parent found for",
 		       resource, dtype, dev->slot_name, res->start, res->end);
@@ -63,12 +63,12 @@
 static int pci_assign_bus_resource(const struct pci_bus *bus,
 	struct pci_dev *dev,
 	struct resource *res,
-	unsigned long size,
-	unsigned long min,
-	unsigned int type_mask,
+	u64 size,
+	u64 min,
+	u64 type_mask,
 	int resno)
 {
-	unsigned long align;
+	u64 align;
 	int i;
 
 	type_mask |= IORESOURCE_IO | IORESOURCE_MEM;
@@ -123,13 +123,13 @@
 		 * window (it will just not perform as well).
 		 */
 		if (!(res->flags & IORESOURCE_PREFETCH) || pci_assign_bus_resource(bus, dev, res, size, min, 0, i) < 0) {
-			printk(KERN_ERR "PCI: Failed to allocate resource %d(%lx-%lx) for %s\n",
+			printk(KERN_ERR "PCI: Failed to allocate resource %d(%Lx-%Lx) for %s\n",
 			       i, res->start, res->end, dev->slot_name);
 			return -EBUSY;
 		}
 	}
 
-	DBGC((KERN_ERR "  got res[%lx:%lx] for resource %d of %s\n", res->start,
+	DBGC((KERN_ERR "  got res[%Lx:%Lx] for resource %d of %s\n", res->start,
 						res->end, i, dev->dev.name));
 
 	return 0;
@@ -153,7 +153,7 @@
 			continue;
 		if (!r_align) {
 			printk(KERN_WARNING "PCI: Ignore bogus resource %d "
-					    "[%lx:%lx] of %s\n",
+					    "[%Lx:%Lx] of %s\n",
 					    i, r->start, r->end, dev->dev.name);
 			continue;
 		}
diff -Nru a/drivers/video/clgenfb.c b/drivers/video/clgenfb.c
--- a/drivers/video/clgenfb.c	Fri Nov 22 14:32:10 2002
+++ b/drivers/video/clgenfb.c	Fri Nov 22 14:32:10 2002
@@ -2690,7 +2690,7 @@
 		info->fbmem_phys = board_addr + 16777216;
 		info->fbmem = ioremap (info->fbmem_phys, 16777216);
 	} else {
-		printk (" REG at $%lx\n", (unsigned long) z2->resource.start);
+		printk (" REG at $%Lx\n", (unsigned long) z2->resource.start);
 
 		info->fbmem_phys = board_addr;
 		if (board_addr > 0x01000000)
diff -Nru a/include/linux/ioport.h b/include/linux/ioport.h
--- a/include/linux/ioport.h	Fri Nov 22 14:32:09 2002
+++ b/include/linux/ioport.h	Fri Nov 22 14:32:09 2002
@@ -5,6 +5,8 @@
  * Authors:	Linus Torvalds
  */
 
+#include <asm/types.h>
+
 #ifndef _LINUX_IOPORT_H
 #define _LINUX_IOPORT_H
 
@@ -14,8 +16,9 @@
  */
 struct resource {
 	const char *name;
-	unsigned long start, end;
-	unsigned long flags;
+	u64 start, end;
+	u64 flags;
+	unsigned long type;
 	struct resource *parent, *sibling, *child;
 };
 
@@ -28,23 +31,23 @@
 /*
  * IO resources have these defined flags.
  */
-#define IORESOURCE_BITS		0x000000ff	/* Bus-specific bits */
+#define IORESOURCE_BITS		0x00000000000000ff	/* Bus-specific bits */
 
-#define IORESOURCE_IO		0x00000100	/* Resource type */
-#define IORESOURCE_MEM		0x00000200
-#define IORESOURCE_IRQ		0x00000400
-#define IORESOURCE_DMA		0x00000800
-
-#define IORESOURCE_PREFETCH	0x00001000	/* No side effects */
-#define IORESOURCE_READONLY	0x00002000
-#define IORESOURCE_CACHEABLE	0x00004000
-#define IORESOURCE_RANGELENGTH	0x00008000
-#define IORESOURCE_SHADOWABLE	0x00010000
-#define IORESOURCE_BUS_HAS_VGA	0x00080000
-
-#define IORESOURCE_UNSET	0x20000000
-#define IORESOURCE_AUTO		0x40000000
-#define IORESOURCE_BUSY		0x80000000	/* Driver has marked this resource busy */
+#define IORESOURCE_IO		0x0000000000000100	/* Resource type */
+#define IORESOURCE_MEM		0x0000000000000200
+#define IORESOURCE_IRQ		0x0000000000000400
+#define IORESOURCE_DMA		0x0000000000000800
+
+#define IORESOURCE_PREFETCH	0x0000000000001000	/* No side effects */
+#define IORESOURCE_READONLY	0x0000000000002000
+#define IORESOURCE_CACHEABLE	0x0000000000004000
+#define IORESOURCE_RANGELENGTH	0x0000000000008000
+#define IORESOURCE_SHADOWABLE	0x0000000000010000
+#define IORESOURCE_BUS_HAS_VGA	0x0000000000080000
+
+#define IORESOURCE_UNSET	0x0000000020000000
+#define IORESOURCE_AUTO		0x0000000040000000
+#define IORESOURCE_BUSY		0x0000000080000000	/* Driver has marked this resource busy */
 
 /* ISA PnP IRQ specific bits (IORESOURCE_BITS) */
 #define IORESOURCE_IRQ_HIGHEDGE		(1<<0)
@@ -88,18 +91,18 @@
 extern int request_resource(struct resource *root, struct resource *new);
 extern int release_resource(struct resource *new);
 extern int allocate_resource(struct resource *root, struct resource *new,
-			     unsigned long size,
-			     unsigned long min, unsigned long max,
-			     unsigned long align,
+			     u64 size,
+			     u64 min, u64 max,
+			     u64 align,
 			     void (*alignf)(void *, struct resource *,
-					    unsigned long, unsigned long),
+					    u64, u64),
 			     void *alignf_data);
 
 /* Convenience shorthand with allocation */
 #define request_region(start,n,name)	__request_region(&ioport_resource, (start), (n), (name))
 #define request_mem_region(start,n,name) __request_region(&iomem_resource, (start), (n), (name))
 
-extern struct resource * __request_region(struct resource *, unsigned long start, unsigned long n, const char *name);
+extern struct resource * __request_region(struct resource *, u64 start, u64 n, const char *name);
 
 /* Compatibility cruft */
 #define check_region(start,n)	__check_region(&ioport_resource, (start), (n))
@@ -107,8 +110,8 @@
 #define check_mem_region(start,n)	__check_region(&iomem_resource, (start), (n))
 #define release_mem_region(start,n)	__release_region(&iomem_resource, (start), (n))
 
-extern int __check_region(struct resource *, unsigned long, unsigned long);
-extern void __release_region(struct resource *, unsigned long, unsigned long);
+extern int __check_region(struct resource *, u64, u64);
+extern void __release_region(struct resource *, u64, u64);
 
 #define get_ioport_list(buf)	get_resource_list(&ioport_resource, buf, PAGE_SIZE)
 #define get_mem_list(buf)	get_resource_list(&iomem_resource, buf, PAGE_SIZE)
diff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h	Fri Nov 22 14:32:09 2002
+++ b/include/linux/pci.h	Fri Nov 22 14:32:09 2002
@@ -511,7 +511,7 @@
 
 /* Used only when drivers/pci/setup.c is used */
 void pcibios_align_resource(void *, struct resource *,
-			    unsigned long, unsigned long);
+			    u64, u64);
 void pcibios_update_resource(struct pci_dev *, struct resource *,
 			     struct resource *, int);
 void pcibios_update_irq(struct pci_dev *, int irq);
diff -Nru a/kernel/resource.c b/kernel/resource.c
--- a/kernel/resource.c	Fri Nov 22 14:32:10 2002
+++ b/kernel/resource.c	Fri Nov 22 14:32:10 2002
@@ -16,7 +16,7 @@
 #include <asm/io.h>
 
 struct resource ioport_resource = { "PCI IO", 0x0000, IO_SPACE_LIMIT, IORESOURCE_IO };
-struct resource iomem_resource = { "PCI mem", 0x00000000, 0xffffffff, IORESOURCE_MEM };
+struct resource iomem_resource = { "PCI mem", 0x0000000000000000, 0xffffffffffffffff, IORESOURCE_MEM };
 
 static rwlock_t resource_lock = RW_LOCK_UNLOCKED;
 
@@ -30,7 +30,7 @@
 
 	while (entry) {
 		const char *name = entry->name;
-		unsigned long from, to;
+		u64 from, to;
 
 		if ((int) (end-buf) < 80)
 			return buf;
@@ -39,7 +39,7 @@
 		to = entry->end;
 		if (!name)
 			name = "<BAD>";
-
+		
 		buf += sprintf(buf, fmt + offset, from, to, name);
 		if (entry->child)
 			buf = do_resource_list(entry->child, fmt, offset-2, buf, end);
@@ -54,9 +54,9 @@
 	char *fmt;
 	int retval;
 
-	fmt = "        %08lx-%08lx : %s\n";
+	fmt = "        %016Lx-%016Lx : %s\n";
 	if (root->end < 0x10000)
-		fmt = "        %04lx-%04lx : %s\n";
+		fmt = "        %04Lx-%04Lx : %s\n";
 	read_lock(&resource_lock);
 	retval = do_resource_list(root->child, fmt, 8, buf, buf + size) - buf;
 	read_unlock(&resource_lock);
@@ -66,8 +66,8 @@
 /* Return the conflict entry if you can't request it */
 static struct resource * __request_resource(struct resource *root, struct resource *new)
 {
-	unsigned long start = new->start;
-	unsigned long end = new->end;
+	u64 start = new->start;
+	u64 end = new->end;
 	struct resource *tmp, **p;
 
 	if (end < start)
@@ -135,11 +135,11 @@
  * Find empty slot in the resource tree given range and alignment.
  */
 static int find_resource(struct resource *root, struct resource *new,
-			 unsigned long size,
-			 unsigned long min, unsigned long max,
-			 unsigned long align,
+			 u64 size,
+			 u64 min, u64 max,
+			 u64 align,
 			 void (*alignf)(void *, struct resource *,
-					unsigned long, unsigned long),
+					u64, u64),
 			 void *alignf_data)
 {
 	struct resource *this = root->child;
@@ -173,11 +173,11 @@
  * Allocate empty slot in the resource tree given range and alignment.
  */
 int allocate_resource(struct resource *root, struct resource *new,
-		      unsigned long size,
-		      unsigned long min, unsigned long max,
-		      unsigned long align,
+		      u64 size,
+		      u64 min, u64 max,
+		      u64 align,
 		      void (*alignf)(void *, struct resource *,
-				     unsigned long, unsigned long),
+				     u64, u64),
 		      void *alignf_data)
 {
 	int err;
@@ -202,7 +202,7 @@
  *
  * Release-region releases a matching busy region.
  */
-struct resource * __request_region(struct resource *parent, unsigned long start, unsigned long n, const char *name)
+struct resource * __request_region(struct resource *parent, u64 start, u64 n, const char *name)
 {
 	struct resource *res = kmalloc(sizeof(*res), GFP_KERNEL);
 
@@ -237,7 +237,7 @@
 	return res;
 }
 
-int __check_region(struct resource *parent, unsigned long start, unsigned long n)
+int __check_region(struct resource *parent, u64 start, u64 n)
 {
 	struct resource * res;
 
@@ -250,10 +250,10 @@
 	return 0;
 }
 
-void __release_region(struct resource *parent, unsigned long start, unsigned long n)
+void __release_region(struct resource *parent, u64 start, u64 n)
 {
 	struct resource **p;
-	unsigned long end;
+	u64 end;
 
 	p = &parent->child;
 	end = start + n - 1;
@@ -276,7 +276,7 @@
 		}
 		p = &res->sibling;
 	}
-	printk(KERN_WARNING "Trying to free nonexistent resource <%08lx-%08lx>\n", start, end);
+	printk(KERN_WARNING "Trying to free nonexistent resource <%016Lx-%016Lx>\n", start, end);
 }
 
 /*

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

end of thread, other threads:[~2002-11-22 22:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-21  2:00 [PATCH] export e820 table on x86 Dave Hansen
2002-11-21  2:09 ` Christoph Hellwig
2002-11-21 21:01   ` Dave Hansen
2002-11-21 22:50 ` Linus Torvalds
2002-11-21 23:46   ` Dave Hansen
2002-11-22  0:04     ` Linus Torvalds
2002-11-22  0:53       ` H. Peter Anvin
2002-11-22  6:20       ` Eric W. Biederman
2002-11-22  7:50       ` Dave Hansen
2002-11-22  8:00         ` Linus Torvalds
2002-11-22 17:17           ` Eric W. Biederman
2002-11-22 22:37             ` Dave Hansen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.