export e820 table on x86
Subsystems (9)
PATCH 1/1 export e820 table on x86
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.
Signature · 2 lines
Dave Hansen [email protected]
arch/i386/Kconfig +5 -0
@@ -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
arch/i386/kernel/Makefile +1 -0
@@ -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
arch/i386/kernel/e820.c new file +75 -0
75 lines not on this page · raw message
Quoted 4 lines · Dave Hansen
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.patchWe 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 :))
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Dave Hansen
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.patchWe 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?
Signature · 2 lines
Dave Hansen [email protected]
arch/i386/Kconfig +5 -0
@@ -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
arch/i386/kernel/Makefile +1 -0
@@ -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
arch/i386/kernel/e820.c new file +98 -0
98 lines not on this page · raw message
Quoted 5 lines · Dave Hansen
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.patchWe 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
Quoted 10 lines · Linus Torvalds
Quoted 4 lines · Dave Hansen
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.patchWe need this so avoid making BIOS calls when using kexec.
- why isn't the info in
/proc/iomemgood 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
Quoted 2 lines
- please use the
seq_fileinterfaces for new files if you do end up creating new files.
I posted one this morning.
Signature · 2 lines
Dave Hansen [email protected]
Quoted 7 lines · Dave Hansen
Quoted 4 lines
- why isn't the info in
/proc/iomemgood 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.
Quoted 2 lines
What would you think of just adding another field to
/proc/iomemwhich 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
Followup to: <[email protected]> By author: Linus Torvalds <[email protected]> In newsgroup: linux.dev.kernel
Quoted 8 lines
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
Signature · 3 lines
<[email protected]> at work, <[email protected]> in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt <[email protected]>
Quoted 5 lines · Linus Torvalds
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
Quoted 4 lines · Linus Torvalds
Quoted 1 line
What would you think of just adding another field to
/proc/iomemwhich contains the e820 field type?Actually, it's already there, to some degree. See the case statement in
register_memory()inarch/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.
Quoted 4 lines
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
Signature · 2 lines
Dave Hansen [email protected]
Quoted 10 lines · Dave Hansen
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)
Quoted 3 lines
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.
Quoted 1 line
I wonder if it is vital to the next boot...
Nope, the next boot would also just remove it..
Linus
Quoted 11 lines · Linus Torvalds
Quoted 10 lines · Dave Hansen
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)
Quoted 3 lines
Quoted 3 lines
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.
Quoted 3 lines
The kernel removes all region claims in the
0xa0000-0x100000area, 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.
Quoted 3 lines
Quoted 1 line
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
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
Signature · 2 lines
Dave Hansen [email protected]
arch/alpha/kernel/pci.c +3 -3
@@ -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 */
arch/arm/kernel/bios32.c +3 -3
@@ -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 ;
arch/i386/kernel/setup.c +9 -6
@@ -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 ;
arch/i386/pci/i386.c +3 -3
@@ -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 ) {
arch/ia64/pci/pci.c +3 -2
@@ -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) { }
arch/mips/ddb5074/pci.c +2 -2
@@ -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
arch/mips/ddb5476/pci.c +2 -2
@@ -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
arch/mips/ddb5xxx/common/pci.c +1 -1
@@ -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 );
arch/mips/gt64120/common/pci.c +2 -2
@@ -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
arch/mips/ite-boards/generic/it8172_pci.c +1 -1
@@ -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" ); }
arch/mips/kernel/pci.c +1 -1
@@ -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 */ }
arch/mips/mips-boards/generic/pci.c +1 -1
@@ -232,7 +232,7 @@void __init pcibios_align_resource (void *data,struct resource *res, -unsigned long size,unsigned long align) +u64 size,u64 align) { }
arch/mips/sni/pci.c +1 -1
@@ -180,7 +180,7 @@void __init pcibios_align_resource (void *data,struct resource *res, -unsigned long size,unsigned long align) +u64 size,u64 align) { }
arch/mips64/mips-boards/generic/pci.c +1 -1
@@ -291,7 +291,7 @@void __init pcibios_align_resource (void *data,struct resource *res, -unsigned long size,unsigned long align) +u64 size,u64 align) { }
arch/mips64/sgi-ip27/ip27-pci.c +1 -1
@@ -249,7 +249,7 @@void __init pcibios_align_resource (void *data,struct resource *res, -unsigned long size,unsigned long align) +u64 size,u64 align) { }
arch/mips64/sgi-ip32/ip32-pci.c +1 -1
@@ -329,7 +329,7 @@ }void __init pcibios_align_resource (void *data,struct resource *res, -unsigned long size,unsigned long align) +u64 size,u64 align) { }
arch/parisc/kernel/pci.c +3 -3
@@ -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);
arch/ppc/kernel/pci.c +16 -15
@@ -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 ;
arch/ppc64/kernel/pci.c +3 -3
@@ -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); }
arch/sh/kernel/pcibios.c +2 -2
@@ -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 ;
arch/sparc/kernel/pcic.c +1 -1
@@ -861,7 +861,7 @@ }void pcibios_align_resource (void *data,struct resource *res, -unsigned long size,unsigned long align) +u64 size,u64 align) { }
arch/sparc64/kernel/pci.c +1 -1
@@ -485,7 +485,7 @@ }void pcibios_align_resource (void *data,struct resource *res, -unsigned long size,unsigned long align) +u64 size,u64 align) { }
arch/sparc64/kernel/pci_common.c +2 -2
@@ -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 [email protected]\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 ; }
arch/v850/kernel/rte_mb_a_pci.c +1 -1
@@ -339,7 +339,7 @@void pcibios_align_resource (void *data,struct resource *res, -unsigned long size,unsigned long align) +u64 size,u64 align) { }
arch/x86_64/pci/x86-64.c +3 -3
@@ -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 ) {
drivers/ide/pci/aec62xx.c +1 -1
@@ -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 )
drivers/ide/pci/cmd64x.c +1 -1
@@ -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
drivers/ide/pci/hpt34x.c +1 -1
@@ -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 );
drivers/ide/pci/pdc202xx_new.c +1 -1
@@ -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); }
drivers/ide/pci/pdc202xx_old.c +1 -1
@@ -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); }
drivers/net/e100/e100_main.c +1 -1
@@ -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;
drivers/net/eepro100.c +2 -2
@@ -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
drivers/net/tc35815.c +1 -1
@@ -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" );
drivers/net/tulip/tulip_core.c +1 -1
@@ -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));
drivers/parisc/ccio-dma.c +1 -1
@@ -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); } }
drivers/pci/pci.c +2 -2
@@ -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),
drivers/pci/proc.c +1 -5
@@ -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)
drivers/pci/setup-res.c +8 -8
@@ -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 ; }
drivers/video/clgenfb.c +1 -1
@@ -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 )
include/linux/ioport.h +28 -25
91 lines not on this page · raw message
include/linux/pci.h +1 -1
@@ -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);
kernel/resource.c +20 -20
@@ -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); }/*