aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpbios/rsparser.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:35 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:28 -0400
commitdc16f5f2ede8cc2acf8ac22857a7fecf3a4296c2 (patch)
treeb4ba965b7c5e1e6011697160aa5346b63afbbbf9 /drivers/pnp/pnpbios/rsparser.c
parentdbddd0383c59d588f8db5e773b062756e39117ec (diff)
PNP: make generic pnp_add_dma_resource()
Add a pnp_add_dma_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/pnpbios/rsparser.c')
-rw-r--r--drivers/pnp/pnpbios/rsparser.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index 845730c57edc..7f8d65728599 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -54,27 +54,6 @@ inline void pcibios_penalize_isa_irq(int irq, int active)
54 * Allocated Resources 54 * Allocated Resources
55 */ 55 */
56 56
57static void pnpbios_parse_allocated_dmaresource(struct pnp_dev *dev, int dma)
58{
59 struct resource *res;
60 int i;
61
62 for (i = 0; i < PNP_MAX_DMA; i++) {
63 res = pnp_get_resource(dev, IORESOURCE_DMA, i);
64 if (!pnp_resource_valid(res))
65 break;
66 }
67
68 if (i < PNP_MAX_DMA) {
69 res->flags = IORESOURCE_DMA; // Also clears _UNSET flag
70 if (dma == -1) {
71 res->flags |= IORESOURCE_DISABLED;
72 return;
73 }
74 res->start = res->end = (unsigned long)dma;
75 }
76}
77
78static void pnpbios_parse_allocated_ioresource(struct pnp_dev *dev, 57static void pnpbios_parse_allocated_ioresource(struct pnp_dev *dev,
79 int io, int len) 58 int io, int len)
80{ 59{
@@ -199,12 +178,15 @@ static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev,
199 case SMALL_TAG_DMA: 178 case SMALL_TAG_DMA:
200 if (len != 2) 179 if (len != 2)
201 goto len_err; 180 goto len_err;
181 flags = 0;
202 io = -1; 182 io = -1;
203 mask = p[1]; 183 mask = p[1];
204 for (i = 0; i < 8; i++, mask = mask >> 1) 184 for (i = 0; i < 8; i++, mask = mask >> 1)
205 if (mask & 0x01) 185 if (mask & 0x01)
206 io = i; 186 io = i;
207 pnpbios_parse_allocated_dmaresource(dev, io); 187 if (io == -1)
188 flags = IORESOURCE_DISABLED;
189 pnp_add_dma_resource(dev, io, flags);
208 break; 190 break;
209 191
210 case SMALL_TAG_PORT: 192 case SMALL_TAG_PORT: