aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/pnpbios/rsparser.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2008-04-28 18:34:34 -0400
committerLen Brown <len.brown@intel.com>2008-04-29 03:22:28 -0400
commitdbddd0383c59d588f8db5e773b062756e39117ec (patch)
tree77009fb218b4fc21090ae83105aa0f84664ae61c /drivers/pnp/pnpbios/rsparser.c
parenta50b6d7b8d7e1a8b13bd1be65a865b115e1190d9 (diff)
PNP: make generic pnp_add_irq_resource()
Add a pnp_add_irq_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.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index d3b0a4e53692..845730c57edc 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -54,28 +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_irqresource(struct pnp_dev *dev, int irq)
58{
59 struct resource *res;
60 int i;
61
62 for (i = 0; i < PNP_MAX_IRQ; i++) {
63 res = pnp_get_resource(dev, IORESOURCE_IRQ, i);
64 if (!pnp_resource_valid(res))
65 break;
66 }
67
68 if (i < PNP_MAX_IRQ) {
69 res->flags = IORESOURCE_IRQ; // Also clears _UNSET flag
70 if (irq == -1) {
71 res->flags |= IORESOURCE_DISABLED;
72 return;
73 }
74 res->start = res->end = (unsigned long)irq;
75 pcibios_penalize_isa_irq(irq, 1);
76 }
77}
78
79static void pnpbios_parse_allocated_dmaresource(struct pnp_dev *dev, int dma) 57static void pnpbios_parse_allocated_dmaresource(struct pnp_dev *dev, int dma)
80{ 58{
81 struct resource *res; 59 struct resource *res;
@@ -148,7 +126,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev,
148 unsigned char *end) 126 unsigned char *end)
149{ 127{
150 unsigned int len, tag; 128 unsigned int len, tag;
151 int io, size, mask, i; 129 int io, size, mask, i, flags;
152 130
153 if (!p) 131 if (!p)
154 return NULL; 132 return NULL;
@@ -205,12 +183,17 @@ static unsigned char *pnpbios_parse_allocated_resource_data(struct pnp_dev *dev,
205 case SMALL_TAG_IRQ: 183 case SMALL_TAG_IRQ:
206 if (len < 2 || len > 3) 184 if (len < 2 || len > 3)
207 goto len_err; 185 goto len_err;
186 flags = 0;
208 io = -1; 187 io = -1;
209 mask = p[1] + p[2] * 256; 188 mask = p[1] + p[2] * 256;
210 for (i = 0; i < 16; i++, mask = mask >> 1) 189 for (i = 0; i < 16; i++, mask = mask >> 1)
211 if (mask & 0x01) 190 if (mask & 0x01)
212 io = i; 191 io = i;
213 pnpbios_parse_allocated_irqresource(dev, io); 192 if (io != -1)
193 pcibios_penalize_isa_irq(io, 1);
194 else
195 flags = IORESOURCE_DISABLED;
196 pnp_add_irq_resource(dev, io, flags);
214 break; 197 break;
215 198
216 case SMALL_TAG_DMA: 199 case SMALL_TAG_DMA: