diff options
Diffstat (limited to 'drivers/pnp')
-rw-r--r-- | drivers/pnp/system.c | 26 |
1 files changed, 19 insertions, 7 deletions
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 @@ | |||
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,7 +22,7 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
21 | { "", 0 } | 22 | { "", 0 } |
22 | }; | 23 | }; |
23 | 24 | ||
24 | static void reserve_ioport_range(char *pnpid, int start, int end) | 25 | static 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; |
@@ -30,7 +31,10 @@ static void reserve_ioport_range(char *pnpid, int start, int end) | |||
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) |
35 | res = request_region(start,end-start+1,regionid); | ||
36 | else | ||
37 | res = request_mem_region(start,end-start+1,regionid); | ||
34 | if ( res == NULL ) | 38 | if ( res == NULL ) |
35 | kfree( regionid ); | 39 | kfree( regionid ); |
36 | else | 40 | else |
@@ -41,8 +45,8 @@ 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 | ); | 51 | ); |
48 | 52 | ||
@@ -75,13 +79,21 @@ static void reserve_resources_of_dev( struct pnp_dev *dev ) | |||
75 | /* invalid endpoint */ | 79 | /* invalid endpoint */ |
76 | /* Do nothing */ | 80 | /* Do nothing */ |
77 | continue; | 81 | continue; |
78 | reserve_ioport_range( | 82 | reserve_range( |
79 | dev->dev.bus_id, | 83 | dev->dev.bus_id, |
80 | pnp_port_start(dev, i), | 84 | pnp_port_start(dev, i), |
81 | pnp_port_end(dev, i) | 85 | pnp_port_end(dev, i), 1 |
82 | ); | 86 | ); |
83 | } | 87 | } |
84 | 88 | ||
89 | for (i = 0; i < PNP_MAX_MEM; i++) { | ||
90 | if (!pnp_mem_valid(dev, i)) | ||
91 | continue; | ||
92 | |||
93 | reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i), | ||
94 | pnp_mem_end(dev, i), 0); | ||
95 | } | ||
96 | |||
85 | return; | 97 | return; |
86 | } | 98 | } |
87 | 99 | ||