aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpacpi/rsparser.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:36 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:29 -0400
commitcc8c2e308194f0997c718c7c735550ff06754d20 (patch)
tree1464d278291fd285653ff026f62c5f4f6d75286c /drivers/pnp/pnpacpi/rsparser.c
parentdc16f5f2ede8cc2acf8ac22857a7fecf3a4296c2 (diff)
PNP: make generic pnp_add_io_resource()
Add a pnp_add_io_resource() that can be used by all the PNP backends. This consolidates a little more pnp_resource_table knowledge into one place. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/pnp/pnpacpi/rsparser.c')
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index fc7cf73b7a7e..d3ca8e035c19 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -158,33 +158,18 @@ static int dma_flags(int type, int bus_master, int transfer)
158 return flags; 158 return flags;
159} 159}
160 160
161static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, 161static void pnpacpi_parse_allocated_ioresource(struct pnp_dev *dev, u64 start,
162 u64 io, u64 len, int io_decode) 162 u64 len, int io_decode)
163{ 163{
164 struct resource *res; 164 int flags = 0;
165 int i; 165 u64 end = start + len - 1;
166 static unsigned char warned;
167 166
168 for (i = 0; i < PNP_MAX_PORT; i++) { 167 if (io_decode == ACPI_DECODE_16)
169 res = pnp_get_resource(dev, IORESOURCE_IO, i); 168 flags |= PNP_PORT_FLAG_16BITADDR;
170 if (!pnp_resource_valid(res)) 169 if (len == 0 || end >= 0x10003)
171 break; 170 flags |= IORESOURCE_DISABLED;
172 } 171
173 if (i < PNP_MAX_PORT) { 172 pnp_add_io_resource(dev, start, end, flags);
174 res->flags = IORESOURCE_IO; // Also clears _UNSET flag
175 if (io_decode == ACPI_DECODE_16)
176 res->flags |= PNP_PORT_FLAG_16BITADDR;
177 if (len <= 0 || (io + len - 1) >= 0x10003) {
178 res->flags |= IORESOURCE_DISABLED;
179 return;
180 }
181 res->start = io;
182 res->end = io + len - 1;
183 } else if (!warned) {
184 printk(KERN_WARNING "pnpacpi: exceeded the max number of IO "
185 "resources: %d \n", PNP_MAX_PORT);
186 warned = 1;
187 }
188} 173}
189 174
190static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev, 175static void pnpacpi_parse_allocated_memresource(struct pnp_dev *dev,