From a8c78f7fb1571764f48b8af5459abdd2c66a765f Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Thu, 18 Jan 2007 16:43:27 -0700 Subject: 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: Bjorn Helgaas Signed-off-by: Len Brown --- drivers/pnp/system.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'drivers/pnp/system.c') diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c index d42015c382af..fd17c7173c7b 100644 --- a/drivers/pnp/system.c +++ b/drivers/pnp/system.c @@ -3,7 +3,8 @@ * * Some code is based on pnpbios_core.c * Copyright 2002 Adam Belay - * + * (c) Copyright 2007 Hewlett-Packard Development Company, L.P. + * Bjorn Helgaas */ #include @@ -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; @@ -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 @@ -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" ); @@ -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; } -- cgit v1.2.3 From 5859554c3ad31b722f0b5a1d3a40e19d8ccedd0b Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Thu, 18 Jan 2007 16:43:46 -0700 Subject: PNP: system.c whitespace cleanup No functional change. Signed-off-by: Bjorn Helgaas Signed-off-by: Len Brown --- drivers/pnp/system.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'drivers/pnp/system.c') diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c index fd17c7173c7b..2065e74bb63f 100644 --- a/drivers/pnp/system.c +++ b/drivers/pnp/system.c @@ -28,15 +28,15 @@ static void reserve_range(char *pnpid, int start, int end, int port) char *regionid; regionid = kmalloc(16, GFP_KERNEL); - if ( regionid == NULL ) + if (regionid == NULL) return; snprintf(regionid, 16, "pnp %s", pnpid); 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 ); + if (res == NULL) + kfree(regionid); else res->flags &= ~IORESOURCE_BUSY; /* @@ -47,24 +47,18 @@ static void reserve_range(char *pnpid, int start, int end, int port) printk(KERN_INFO "pnp: %s: %s range 0x%x-0x%x %s reserved\n", pnpid, port ? "ioport" : "iomem", start, end, - NULL != res ? "has been" : "could not be" - ); - - return; + NULL != res ? "has been" : "could not be"); } -static void reserve_resources_of_dev( struct pnp_dev *dev ) +static void reserve_resources_of_dev(struct pnp_dev *dev) { int i; - for (i=0;idev.bus_id, - pnp_port_start(dev, i), - pnp_port_end(dev, i), 1 - ); + continue; /* invalid */ + + reserve_range(dev->dev.bus_id, pnp_port_start(dev, i), + pnp_port_end(dev, i), 1); } for (i = 0; i < PNP_MAX_MEM; i++) { -- cgit v1.2.3