aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/system.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-07 18:36:08 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-07 18:36:08 -0500
commit21d37bbc65e39a26856de6b14be371ff24e0d03f (patch)
treea04bb72e191cae13f47462c57bb1641c42b7b52b /drivers/pnp/system.c
parentbff288c19e8b6217ddd660d4fa42c29a0ab1d58c (diff)
parent57e1c5c87db512629dd44ddeb882a5aaf0e4299e (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (140 commits) ACPICA: reduce table header messages to fit within 80 columns asus-laptop: merge with ACPICA table update ACPI: bay: Convert ACPI Bay driver to be compatible with sysfs update. ACPI: bay: new driver is EXPERIMENTAL ACPI: bay: make drive_bays static ACPI: bay: make bay a platform driver ACPI: bay: remove prototype procfs code ACPI: bay: delete unused variable ACPI: bay: new driver adding removable drive bay support ACPI: dock: check if parent is on dock ACPICA: fix gcc build warnings Altix: Add ACPI SSDT PCI device support (hotplug) Altix: ACPI SSDT PCI device support ACPICA: reduce conflicts with Altix patch series ACPI_NUMA: fix HP IA64 simulator issue with extended memory domain ACPI: fix HP RX2600 IA64 boot ACPI: build fix for IBM x440 - CONFIG_X86_SUMMIT ACPICA: Update version to 20070126 ACPICA: Fix for incorrect parameter passed to AcpiTbDeleteTable during table load. ACPICA: Update copyright to 2007. ...
Diffstat (limited to 'drivers/pnp/system.c')
-rw-r--r--drivers/pnp/system.c52
1 files changed, 27 insertions, 25 deletions
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c
index d42015c382af..2065e74bb63f 100644
--- a/drivers/pnp/system.c
+++ b/drivers/pnp/system.c
@@ -3,7 +3,8 @@
3 * 3 *
4 * Some code is based on pnpbios_core.c 4 * Some code is based on pnpbios_core.c
5 * Copyright 2002 Adam Belay <ambx1@neo.rr.com> 5 * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
6 * 6 * (c) Copyright 2007 Hewlett-Packard Development Company, L.P.
7 * Bjorn Helgaas <bjorn.helgaas@hp.com>
7 */ 8 */
8 9
9#include <linux/pnp.h> 10#include <linux/pnp.h>
@@ -21,18 +22,21 @@ static const struct pnp_device_id pnp_dev_table[] = {
21 { "", 0 } 22 { "", 0 }
22}; 23};
23 24
24static void reserve_ioport_range(char *pnpid, int start, int end) 25static void reserve_range(char *pnpid, int start, int end, int port)
25{ 26{
26 struct resource *res; 27 struct resource *res;
27 char *regionid; 28 char *regionid;
28 29
29 regionid = kmalloc(16, GFP_KERNEL); 30 regionid = kmalloc(16, GFP_KERNEL);
30 if ( regionid == NULL ) 31 if (regionid == NULL)
31 return; 32 return;
32 snprintf(regionid, 16, "pnp %s", pnpid); 33 snprintf(regionid, 16, "pnp %s", pnpid);
33 res = request_region(start,end-start+1,regionid); 34 if (port)
34 if ( res == NULL ) 35 res = request_region(start,end-start+1,regionid);
35 kfree( regionid ); 36 else
37 res = request_mem_region(start,end-start+1,regionid);
38 if (res == NULL)
39 kfree(regionid);
36 else 40 else
37 res->flags &= ~IORESOURCE_BUSY; 41 res->flags &= ~IORESOURCE_BUSY;
38 /* 42 /*
@@ -41,26 +45,20 @@ static void reserve_ioport_range(char *pnpid, int start, int end)
41 * have double reservations. 45 * have double reservations.
42 */ 46 */
43 printk(KERN_INFO 47 printk(KERN_INFO
44 "pnp: %s: ioport range 0x%x-0x%x %s reserved\n", 48 "pnp: %s: %s range 0x%x-0x%x %s reserved\n",
45 pnpid, start, end, 49 pnpid, port ? "ioport" : "iomem", start, end,
46 NULL != res ? "has been" : "could not be" 50 NULL != res ? "has been" : "could not be");
47 );
48
49 return;
50} 51}
51 52
52static void reserve_resources_of_dev( struct pnp_dev *dev ) 53static void reserve_resources_of_dev(struct pnp_dev *dev)
53{ 54{
54 int i; 55 int i;
55 56
56 for (i=0;i<PNP_MAX_PORT;i++) { 57 for (i = 0; i < PNP_MAX_PORT; i++) {
57 if (!pnp_port_valid(dev, i)) 58 if (!pnp_port_valid(dev, i))
58 /* end of resources */
59 continue; 59 continue;
60 if (pnp_port_start(dev, i) == 0) 60 if (pnp_port_start(dev, i) == 0)
61 /* disabled */ 61 continue; /* disabled */
62 /* Do nothing */
63 continue;
64 if (pnp_port_start(dev, i) < 0x100) 62 if (pnp_port_start(dev, i) < 0x100)
65 /* 63 /*
66 * Below 0x100 is only standard PC hardware 64 * Below 0x100 is only standard PC hardware
@@ -72,14 +70,18 @@ static void reserve_resources_of_dev( struct pnp_dev *dev )
72 */ 70 */
73 continue; 71 continue;
74 if (pnp_port_end(dev, i) < pnp_port_start(dev, i)) 72 if (pnp_port_end(dev, i) < pnp_port_start(dev, i))
75 /* invalid endpoint */ 73 continue; /* invalid */
76 /* Do nothing */ 74
75 reserve_range(dev->dev.bus_id, pnp_port_start(dev, i),
76 pnp_port_end(dev, i), 1);
77 }
78
79 for (i = 0; i < PNP_MAX_MEM; i++) {
80 if (!pnp_mem_valid(dev, i))
77 continue; 81 continue;
78 reserve_ioport_range( 82
79 dev->dev.bus_id, 83 reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i),
80 pnp_port_start(dev, i), 84 pnp_mem_end(dev, i), 0);
81 pnp_port_end(dev, i)
82 );
83 } 85 }
84 86
85 return; 87 return;