Commit a8c78f7f authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Len Brown

PNP: reserve system board iomem resources as well as ioport resources

Most x86 boxes have no iomem system board resources, but some ia64
boxes do.
Signed-off-by: default avatarBjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 9a47cdb1
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
* *
* Some code is based on pnpbios_core.c * Some code is based on pnpbios_core.c
* Copyright 2002 Adam Belay <ambx1@neo.rr.com> * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
* * (c) Copyright 2007 Hewlett-Packard Development Company, L.P.
* Bjorn Helgaas <bjorn.helgaas@hp.com>
*/ */
#include <linux/pnp.h> #include <linux/pnp.h>
...@@ -21,7 +22,7 @@ static const struct pnp_device_id pnp_dev_table[] = { ...@@ -21,7 +22,7 @@ static const struct pnp_device_id pnp_dev_table[] = {
{ "", 0 } { "", 0 }
}; };
static void reserve_ioport_range(char *pnpid, int start, int end) static void reserve_range(char *pnpid, int start, int end, int port)
{ {
struct resource *res; struct resource *res;
char *regionid; char *regionid;
...@@ -30,7 +31,10 @@ static void reserve_ioport_range(char *pnpid, int start, int end) ...@@ -30,7 +31,10 @@ static void reserve_ioport_range(char *pnpid, int start, int end)
if ( regionid == NULL ) if ( regionid == NULL )
return; return;
snprintf(regionid, 16, "pnp %s", pnpid); snprintf(regionid, 16, "pnp %s", pnpid);
res = request_region(start,end-start+1,regionid); if (port)
res = request_region(start,end-start+1,regionid);
else
res = request_mem_region(start,end-start+1,regionid);
if ( res == NULL ) if ( res == NULL )
kfree( regionid ); kfree( regionid );
else else
...@@ -41,8 +45,8 @@ static void reserve_ioport_range(char *pnpid, int start, int end) ...@@ -41,8 +45,8 @@ static void reserve_ioport_range(char *pnpid, int start, int end)
* have double reservations. * have double reservations.
*/ */
printk(KERN_INFO printk(KERN_INFO
"pnp: %s: ioport range 0x%x-0x%x %s reserved\n", "pnp: %s: %s range 0x%x-0x%x %s reserved\n",
pnpid, start, end, pnpid, port ? "ioport" : "iomem", start, end,
NULL != res ? "has been" : "could not be" NULL != res ? "has been" : "could not be"
); );
...@@ -75,13 +79,21 @@ static void reserve_resources_of_dev( struct pnp_dev *dev ) ...@@ -75,13 +79,21 @@ static void reserve_resources_of_dev( struct pnp_dev *dev )
/* invalid endpoint */ /* invalid endpoint */
/* Do nothing */ /* Do nothing */
continue; continue;
reserve_ioport_range( reserve_range(
dev->dev.bus_id, dev->dev.bus_id,
pnp_port_start(dev, i), pnp_port_start(dev, i),
pnp_port_end(dev, i) pnp_port_end(dev, i), 1
); );
} }
for (i = 0; i < PNP_MAX_MEM; i++) {
if (!pnp_mem_valid(dev, i))
continue;
reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i),
pnp_mem_end(dev, i), 0);
}
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment