Commit b16c829e authored by Len Brown's avatar Len Brown Committed by Len Brown

[PNP] handler more than 16 IRQs

Signed-off-by: default avatarDavid Shaohua Li <shaohua.li@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 2168e7bc
...@@ -60,8 +60,8 @@ static void pnp_print_irq(pnp_info_buffer_t *buffer, char *space, struct pnp_irq ...@@ -60,8 +60,8 @@ static void pnp_print_irq(pnp_info_buffer_t *buffer, char *space, struct pnp_irq
int first = 1, i; int first = 1, i;
pnp_printf(buffer, "%sirq ", space); pnp_printf(buffer, "%sirq ", space);
for (i = 0; i < 16; i++) for (i = 0; i < PNP_IRQ_NR; i++)
if (irq->map & (1<<i)) { if (test_bit(i, irq->map)) {
if (!first) { if (!first) {
pnp_printf(buffer, ","); pnp_printf(buffer, ",");
} else { } else {
...@@ -72,7 +72,7 @@ static void pnp_print_irq(pnp_info_buffer_t *buffer, char *space, struct pnp_irq ...@@ -72,7 +72,7 @@ static void pnp_print_irq(pnp_info_buffer_t *buffer, char *space, struct pnp_irq
else else
pnp_printf(buffer, "%i", i); pnp_printf(buffer, "%i", i);
} }
if (!irq->map) if (bitmap_empty(irq->map, PNP_IRQ_NR))
pnp_printf(buffer, "<none>"); pnp_printf(buffer, "<none>");
if (irq->flags & IORESOURCE_IRQ_HIGHEDGE) if (irq->flags & IORESOURCE_IRQ_HIGHEDGE)
pnp_printf(buffer, " High-Edge"); pnp_printf(buffer, " High-Edge");
......
...@@ -477,12 +477,14 @@ static void __init isapnp_parse_irq_resource(struct pnp_option *option, ...@@ -477,12 +477,14 @@ static void __init isapnp_parse_irq_resource(struct pnp_option *option,
{ {
unsigned char tmp[3]; unsigned char tmp[3];
struct pnp_irq *irq; struct pnp_irq *irq;
unsigned long bits;
isapnp_peek(tmp, size); isapnp_peek(tmp, size);
irq = isapnp_alloc(sizeof(struct pnp_irq)); irq = isapnp_alloc(sizeof(struct pnp_irq));
if (!irq) if (!irq)
return; return;
irq->map = (tmp[1] << 8) | tmp[0]; bits = (tmp[1] << 8) | tmp[0];
bitmap_copy(irq->map, &bits, 16);
if (size > 2) if (size > 2)
irq->flags = tmp[2]; irq->flags = tmp[2];
else else
......
...@@ -150,13 +150,19 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx) ...@@ -150,13 +150,19 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx)
*flags |= rule->flags | IORESOURCE_IRQ; *flags |= rule->flags | IORESOURCE_IRQ;
*flags &= ~IORESOURCE_UNSET; *flags &= ~IORESOURCE_UNSET;
if (!rule->map) { if (bitmap_empty(rule->map, PNP_IRQ_NR)) {
*flags |= IORESOURCE_DISABLED; *flags |= IORESOURCE_DISABLED;
return 1; /* skip disabled resource requests */ return 1; /* skip disabled resource requests */
} }
/* TBD: need check for >16 IRQ */
*start = find_next_bit(rule->map, PNP_IRQ_NR, 16);
if (*start < PNP_IRQ_NR) {
*end = *start;
return 1;
}
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
if(rule->map & (1<<xtab[i])) { if(test_bit(xtab[i], rule->map)) {
*start = *end = xtab[i]; *start = *end = xtab[i];
if(pnp_check_irq(dev, idx)) if(pnp_check_irq(dev, idx))
return 1; return 1;
......
...@@ -287,10 +287,13 @@ static void ...@@ -287,10 +287,13 @@ static void
pnpbios_parse_irq_option(unsigned char *p, int size, struct pnp_option *option) pnpbios_parse_irq_option(unsigned char *p, int size, struct pnp_option *option)
{ {
struct pnp_irq * irq; struct pnp_irq * irq;
unsigned long bits;
irq = pnpbios_kmalloc(sizeof(struct pnp_irq), GFP_KERNEL); irq = pnpbios_kmalloc(sizeof(struct pnp_irq), GFP_KERNEL);
if (!irq) if (!irq)
return; return;
irq->map = (p[2] << 8) | p[1]; bits = (p[2] << 8) | p[1];
bitmap_copy(irq->map, &bits, 16);
if (size > 2) if (size > 2)
irq->flags = p[3]; irq->flags = p[3];
else else
......
...@@ -63,14 +63,17 @@ static void quirk_awe32_resources(struct pnp_dev *dev) ...@@ -63,14 +63,17 @@ static void quirk_awe32_resources(struct pnp_dev *dev)
static void quirk_cmi8330_resources(struct pnp_dev *dev) static void quirk_cmi8330_resources(struct pnp_dev *dev)
{ {
struct pnp_option *res = dev->dependent; struct pnp_option *res = dev->dependent;
unsigned long tmp;
for ( ; res ; res = res->next ) { for ( ; res ; res = res->next ) {
struct pnp_irq *irq; struct pnp_irq *irq;
struct pnp_dma *dma; struct pnp_dma *dma;
for( irq = res->irq; irq; irq = irq->next ) // Valid irqs are 5, 7, 10 for( irq = res->irq; irq; irq = irq->next ) { // Valid irqs are 5, 7, 10
irq->map = 0x04A0; // 0000 0100 1010 0000 tmp = 0x04A0;
bitmap_copy(irq->map, &tmp, 16); // 0000 0100 1010 0000
}
for( dma = res->dma; dma; dma = dma->next ) // Valid 8bit dma channels are 1,3 for( dma = res->dma; dma; dma = dma->next ) // Valid 8bit dma channels are 1,3
if( ( dma->flags & IORESOURCE_DMA_TYPE_MASK ) == IORESOURCE_DMA_8BIT ) if( ( dma->flags & IORESOURCE_DMA_TYPE_MASK ) == IORESOURCE_DMA_8BIT )
......
...@@ -101,8 +101,8 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) ...@@ -101,8 +101,8 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
{ {
int i; int i;
for (i=0; i<16; i++) for (i = 0; i < 16; i++)
if (data->map & (1<<i)) if (test_bit(i, data->map))
pcibios_penalize_isa_irq(i); pcibios_penalize_isa_irq(i);
} }
#endif #endif
......
...@@ -82,8 +82,9 @@ struct pnp_port { ...@@ -82,8 +82,9 @@ struct pnp_port {
struct pnp_port *next; /* next port */ struct pnp_port *next; /* next port */
}; };
#define PNP_IRQ_NR 256
struct pnp_irq { struct pnp_irq {
unsigned short map; /* bitmaks for IRQ lines */ DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmaks for IRQ lines */
unsigned char flags; /* IRQ flags */ unsigned char flags; /* IRQ flags */
unsigned char pad; /* pad */ unsigned char pad; /* pad */
struct pnp_irq *next; /* next IRQ */ struct pnp_irq *next; /* next IRQ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment