Skip to content

Commit

Permalink
PNP: reserve system board iomem resources as well as ioport resources
Browse files Browse the repository at this point in the history
Most x86 boxes have no iomem system board resources, but some ia64
boxes do.

Signed-off-by: Bjorn Helgaas <[email protected]>
Signed-off-by: Len Brown <[email protected]>
  • Loading branch information
Bjorn Helgaas authored and lenb committed Jan 26, 2007
1 parent 9a47cdb commit a8c78f7
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions drivers/pnp/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*
* Some code is based on pnpbios_core.c
* Copyright 2002 Adam Belay <[email protected]>
*
* (c) Copyright 2007 Hewlett-Packard Development Company, L.P.
* Bjorn Helgaas <[email protected]>
*/

#include <linux/pnp.h>
Expand All @@ -21,7 +22,7 @@ static const struct pnp_device_id pnp_dev_table[] = {
{ "", 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;
char *regionid;
Expand All @@ -30,7 +31,10 @@ static void reserve_ioport_range(char *pnpid, int start, int end)
if ( regionid == NULL )
return;
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 )
kfree( regionid );
else
Expand All @@ -41,8 +45,8 @@ static void reserve_ioport_range(char *pnpid, int start, int end)
* have double reservations.
*/
printk(KERN_INFO
"pnp: %s: ioport range 0x%x-0x%x %s reserved\n",
pnpid, start, end,
"pnp: %s: %s range 0x%x-0x%x %s reserved\n",
pnpid, port ? "ioport" : "iomem", start, end,
NULL != res ? "has been" : "could not be"
);

Expand Down Expand Up @@ -75,13 +79,21 @@ static void reserve_resources_of_dev( struct pnp_dev *dev )
/* invalid endpoint */
/* Do nothing */
continue;
reserve_ioport_range(
reserve_range(
dev->dev.bus_id,
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;
}

Expand Down

0 comments on commit a8c78f7

Please sign in to comment.