Ask the kernel about IRQ 0 first. If the kernel responds with an IRQ,
use it. If not, then loop asking for each one, with normal -I processing. This will effectively disable -I for when the pcic is in PCI function interrupt routing mode.
This commit is contained in:
parent
fa7a1ab968
commit
f18be15b41
@ -521,27 +521,29 @@ assign_driver(struct slot *sp, struct card *cp)
|
||||
res.type = SYS_RES_IRQ;
|
||||
res.size = 1;
|
||||
if (conf->irq == 0) {
|
||||
for (i = 1; i < 16; i++) {
|
||||
/*
|
||||
* The foloowing code will properly implement sanpai's
|
||||
* -I option. However, it will break everyone that
|
||||
* I told to use this as a workaround for my pccard
|
||||
* patches testing.
|
||||
*/
|
||||
if (!use_kern_irq && pool_irq[i]) {
|
||||
conf->irq = i;
|
||||
pool_irq[i] = 0;
|
||||
break;
|
||||
}
|
||||
res.min = i;
|
||||
res.max = i;
|
||||
if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0)
|
||||
err(1, "ioctl (PIOCSRESOURCE)");
|
||||
if (res.resource_addr == ~0ul)
|
||||
continue;
|
||||
res.min = 0;
|
||||
res.max = 0;
|
||||
if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0)
|
||||
err(1, "ioctl (PIOCSRESOURCE)");
|
||||
if (res.resource_addr != ~0ul) {
|
||||
conf->irq = res.resource_addr;
|
||||
pool_irq[conf->irq] = 0;
|
||||
break;
|
||||
} else {
|
||||
for (i = 1; i < 16; i++) {
|
||||
if (!use_kern_irq && pool_irq[i]) {
|
||||
conf->irq = i;
|
||||
pool_irq[i] = 0;
|
||||
break;
|
||||
}
|
||||
res.min = i;
|
||||
res.max = i;
|
||||
if (ioctl(sp->fd, PIOCSRESOURCE, &res) < 0)
|
||||
err(1, "ioctl (PIOCSRESOURCE)");
|
||||
if (res.resource_addr == ~0ul)
|
||||
continue;
|
||||
conf->irq = res.resource_addr;
|
||||
pool_irq[conf->irq] = 0;
|
||||
}
|
||||
}
|
||||
if (conf->irq == 0) {
|
||||
logmsg("Failed to allocate IRQ for %s\n", cp->manuf);
|
||||
|
@ -171,7 +171,7 @@ main(int argc, char *argv[])
|
||||
while ((count = getopt(argc, argv, COM_OPTS)) != -1) {
|
||||
switch (count) {
|
||||
case 'I':
|
||||
/* use_kern_irq = 0; */
|
||||
use_kern_irq = 0;
|
||||
break;
|
||||
case 'd':
|
||||
setbuf(stdout, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user